Commit eecda43d by chenwq

优惠券列表;新增/编辑loading

1 parent 001b8ddb
...@@ -3,7 +3,7 @@ import { http } from '@/main' ...@@ -3,7 +3,7 @@ import { http } from '@/main'
const defaultPath = 'scrm.api.coupon.' const defaultPath = 'scrm.api.coupon.'
//优惠券列表 //优惠券列表
const getMerchantListApi = params => { const getCouponListApi = params => {
// params.method = `${defaultPath}list.merchant` // params.method = `${defaultPath}list.merchant`
params.method = 'scrm.backstage.coupon.list.merchant' params.method = 'scrm.backstage.coupon.list.merchant'
return http({ return http({
...@@ -151,4 +151,4 @@ const getAllGoodsApi = params => { ...@@ -151,4 +151,4 @@ const getAllGoodsApi = params => {
}) })
} }
export default { getMerchantListApi, couponExportApi, getVerificationListApi, verificationExportApi, effectiveCouponApi, codeVerificationApi, getCouponDetailApi, deleteCouponApi, createCouponApi, updateCouponApi, getAllGoodsApi, getListReceiveRecordApi, exportReceiveRecordApi } export default { getCouponListApi, couponExportApi, getVerificationListApi, verificationExportApi, effectiveCouponApi, codeVerificationApi, getCouponDetailApi, deleteCouponApi, createCouponApi, updateCouponApi, getAllGoodsApi, getListReceiveRecordApi, exportReceiveRecordApi }
<!-- 编辑代金券 --> <!-- 编辑代金券 -->
<template> <template>
<div class="edit-share marketing p-t-20 edit-box"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="position: relative"> <div class="container edit-container" style="position: relative" v-loading="loading">
<div class="right_show"> <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
<div class="slider"> <div class="slider">
...@@ -169,6 +169,7 @@ export default { ...@@ -169,6 +169,7 @@ export default {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false,
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // 1-新增;2-编辑;3-查看
addOrEdit: 1, addOrEdit: 1,
...@@ -198,7 +199,8 @@ export default { ...@@ -198,7 +199,8 @@ export default {
full: '', full: '',
goods: '1', goods: '1',
goodsRefList: [], goodsRefList: [],
directionalFlag: '1' directionalFlag: '1',
scopeApplication: ''
}, },
//商品列表 //商品列表
tableParams: { tableParams: {
...@@ -319,15 +321,16 @@ export default { ...@@ -319,15 +321,16 @@ export default {
], ],
// 适用门店 // 适用门店
merchantRule: { merchantRule: {
merchantRadio: [{ required: true, message: '请选择适用范围', trigger: 'change' }] scopeApplication: [{ required: true, message: '请选择适用范围', trigger: 'change' }]
}, },
merchantEditFormData: [ merchantEditFormData: [
{ {
label: '适用范围', label: '适用范围',
name: 'merchantRadio', name: 'scopeApplication',
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false,
optionList: [ optionList: [
{ {
confId: '1', confId: '1',
...@@ -361,6 +364,7 @@ export default { ...@@ -361,6 +364,7 @@ export default {
this.title = '查看' this.title = '查看'
let idx = this.editFormData.findIndex(item => item.name == 'editHtml') let idx = this.editFormData.findIndex(item => item.name == 'editHtml')
this.editFormData[idx].isHide = false this.editFormData[idx].isHide = false
this.setAllDisabled('merchantEditFormData')
} else if (addOrEdit == 2) { } else if (addOrEdit == 2) {
this.apear = 'couponEdit' this.apear = 'couponEdit'
this.title = '编辑' this.title = '编辑'
...@@ -474,6 +478,11 @@ export default { ...@@ -474,6 +478,11 @@ export default {
}, },
methods: { methods: {
setAllDisabled(editName) {
this[editName].forEach(item => {
item.isDisabled = true
})
},
editCoupon(attribute) { editCoupon(attribute) {
attribute.forEach(item => { attribute.forEach(item => {
let index = this.editFormData.findIndex(val => val.name == `${item}`) let index = this.editFormData.findIndex(val => val.name == `${item}`)
...@@ -512,7 +521,10 @@ export default { ...@@ -512,7 +521,10 @@ export default {
if (goodsName) { if (goodsName) {
params.goodsName = goodsName params.goodsName = goodsName
} }
this.$apis.couponManage.getAllGoodsApi(params).then(res => { this.loading = true
this.$apis.couponManage
.getAllGoodsApi(params)
.then(res => {
const goods = this.$common.utils.deepClone(res.list) const goods = this.$common.utils.deepClone(res.list)
this.selectedAllProList = goods this.selectedAllProList = goods
if (goods && goods.length > 0) { if (goods && goods.length > 0) {
...@@ -527,6 +539,11 @@ export default { ...@@ -527,6 +539,11 @@ export default {
} }
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
}) })
.finally(() => {
if (this.routeInfo.addOrEdit == 1) {
this.loading = false
}
})
}, },
//选择商品 //选择商品
...@@ -591,7 +608,10 @@ export default { ...@@ -591,7 +608,10 @@ export default {
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.loading = true
this.$apis.couponManage
.getCouponDetailApi({ couponId: this.routeInfo.id })
.then(res => {
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveTime = [] this.editForm.effectiveTime = []
this.editForm.useChannel = this.editForm.useChannel + '' this.editForm.useChannel = this.editForm.useChannel + ''
...@@ -599,6 +619,9 @@ export default { ...@@ -599,6 +619,9 @@ export default {
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useBarriers = this.editForm.useBarriers + '' this.editForm.useBarriers = this.editForm.useBarriers + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2) this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
if (this.$isGroupUp) {
this.editForm.scopeApplication = this.editForm.scopeApplication + ''
}
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
...@@ -617,6 +640,9 @@ export default { ...@@ -617,6 +640,9 @@ export default {
this.editStatus = false this.editStatus = false
}) })
}) })
.finally(() => {
this.loading = false
})
}, },
validateRules() { validateRules() {
...@@ -689,7 +715,12 @@ export default { ...@@ -689,7 +715,12 @@ export default {
//面值 //面值
obj.denomination = form.denomination obj.denomination = form.denomination
//库存 //库存
obj.limitStockFlag = this.$isGroupUp ? 2 : 1
if (!this.$isGroupUp) {
obj.stock = form.stock obj.stock = form.stock
} else {
obj.scopeApplication = form.scopeApplication
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
...@@ -742,6 +773,7 @@ export default { ...@@ -742,6 +773,7 @@ export default {
} else { } else {
method = 'createCouponApi' //后台创建优惠券 method = 'createCouponApi' //后台创建优惠券
} }
console.log(params)
this.$apis.couponManage[method](params).then(res => { this.$apis.couponManage[method](params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message, message: res.code == '0' ? '操作成功' : res.message,
......
<!-- 编辑折扣券 --> <!-- 编辑折扣券 -->
<template> <template>
<div class="edit-share marketing p-t-20 edit-box"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="position: relative"> <div class="container edit-container" style="position: relative" v-loading="loading">
<!-- <div class="right_show"> <!-- <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
<div class="card-middle"> <div class="card-middle">
...@@ -165,6 +165,7 @@ export default { ...@@ -165,6 +165,7 @@ export default {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false,
// pickerOptions: { // pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期 // disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000; // return v.getTime() < new Date().getTime() - 86400000;
...@@ -200,7 +201,8 @@ export default { ...@@ -200,7 +201,8 @@ export default {
effectiveDays: '', effectiveDays: '',
anticipatedCost: '', anticipatedCost: '',
discountIntensity: '', discountIntensity: '',
directionalFlag: '1' directionalFlag: '1',
scopeApplication: ''
}, },
editRule: { editRule: {
anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }], anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }],
...@@ -273,15 +275,16 @@ export default { ...@@ -273,15 +275,16 @@ export default {
], ],
// 适用门店 // 适用门店
merchantRule: { merchantRule: {
merchantRadio: [{ required: true, message: '请选择适用范围', trigger: 'change' }] scopeApplication: [{ required: true, message: '请选择适用范围', trigger: 'change' }]
}, },
merchantEditFormData: [ merchantEditFormData: [
{ {
label: '适用范围', label: '适用范围',
name: 'merchantRadio', name: 'scopeApplication',
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false,
optionList: [ optionList: [
{ {
confId: '1', confId: '1',
...@@ -316,6 +319,7 @@ export default { ...@@ -316,6 +319,7 @@ export default {
this.title = '查看' this.title = '查看'
const editHtmlIndex = this.editFormData.findIndex(val => val.addHtml == 'editHtml') const editHtmlIndex = this.editFormData.findIndex(val => val.addHtml == 'editHtml')
this.editFormData[editHtmlIndex].isHide = false this.editFormData[editHtmlIndex].isHide = false
this.setAllDisabled('merchantEditFormData')
} else if (addOrEdit == 2) { } else if (addOrEdit == 2) {
this.apear = 'couponEdit' this.apear = 'couponEdit'
this.title = '编辑' this.title = '编辑'
...@@ -375,6 +379,11 @@ export default { ...@@ -375,6 +379,11 @@ export default {
} }
}, },
methods: { methods: {
setAllDisabled(editName) {
this[editName].forEach(item => {
item.isDisabled = true
})
},
editCoupon(attribute) { editCoupon(attribute) {
attribute.forEach(item => { attribute.forEach(item => {
let index = this.editFormData.findIndex(val => val.name == `${item}`) let index = this.editFormData.findIndex(val => val.name == `${item}`)
...@@ -407,7 +416,10 @@ export default { ...@@ -407,7 +416,10 @@ export default {
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.loading = true
this.$apis.couponManage
.getCouponDetailApi({ couponId: this.routeInfo.id })
.then(res => {
console.log(res) console.log(res)
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.directionalFlag = this.editForm.directionalFlag + '' this.editForm.directionalFlag = this.editForm.directionalFlag + ''
...@@ -415,6 +427,9 @@ export default { ...@@ -415,6 +427,9 @@ export default {
this.editForm.useBarriers = this.editForm.useBarriers + '' this.editForm.useBarriers = this.editForm.useBarriers + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2) this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
this.editForm.discountIntensity = (this.editForm.discountIntensity / 100).toFixed(2) this.editForm.discountIntensity = (this.editForm.discountIntensity / 100).toFixed(2)
if (this.$isGroupUp) {
this.editForm.scopeApplication = this.editForm.scopeApplication + ''
}
//使用限制,满多少元可用 //使用限制,满多少元可用
if (this.editForm.useBarriers == 2) { if (this.editForm.useBarriers == 2) {
this.editForm.full = this.editForm.full this.editForm.full = this.editForm.full
...@@ -428,6 +443,9 @@ export default { ...@@ -428,6 +443,9 @@ export default {
this.editStatus = false this.editStatus = false
}) })
}) })
.finally(() => {
this.loading = false
})
}, },
validateRules() { validateRules() {
...@@ -488,7 +506,12 @@ export default { ...@@ -488,7 +506,12 @@ export default {
obj.full = form.full obj.full = form.full
} }
//库存 //库存
obj.limitStockFlag = this.$isGroupUp ? 2 : 1
if (!this.$isGroupUp) {
obj.stock = form.stock obj.stock = form.stock
} else {
obj.scopeApplication = form.scopeApplication
}
//折扣 //折扣
obj.discountIntensity = (form.discountIntensity * 100).toFixed(0) obj.discountIntensity = (form.discountIntensity * 100).toFixed(0)
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
......
<!-- 编辑兑换券 --> <!-- 编辑兑换券 -->
<template> <template>
<div class="edit-share marketing p-t-20 edit-box"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container" style="position: relative"> <div class="container edit-container" style="position: relative" v-loading="loading">
<div class="right_show"> <div class="right_show">
<div class="card-top"></div> <div class="card-top"></div>
<div class="slider"> <div class="slider">
...@@ -128,6 +128,7 @@ export default { ...@@ -128,6 +128,7 @@ export default {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false,
editStatus: false, editStatus: false,
// pickerOptions: { // pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期 // disabledDate(v) {//禁用当前之前的日期
...@@ -160,7 +161,8 @@ export default { ...@@ -160,7 +161,8 @@ export default {
effectiveTime: [], effectiveTime: [],
effectiveDays: '', effectiveDays: '',
anticipatedCost: '', anticipatedCost: '',
directionalFlag: '1' directionalFlag: '1',
scopeApplication: ''
}, },
editRule: { editRule: {
anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }], anticipatedCost: [{ required: true, message: '请输入预估成本', trigger: 'change' }],
...@@ -219,15 +221,16 @@ export default { ...@@ -219,15 +221,16 @@ export default {
], ],
// 适用门店 // 适用门店
merchantRule: { merchantRule: {
merchantRadio: [{ required: true, message: '请选择适用范围', trigger: 'change' }] scopeApplication: [{ required: true, message: '请选择适用范围', trigger: 'change' }]
}, },
merchantEditFormData: [ merchantEditFormData: [
{ {
label: '适用范围', label: '适用范围',
name: 'merchantRadio', name: 'scopeApplication',
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false,
optionList: [ optionList: [
{ {
confId: '1', confId: '1',
...@@ -262,6 +265,7 @@ export default { ...@@ -262,6 +265,7 @@ export default {
this.editFormData[editHtmlIndex].isHide = false this.editFormData[editHtmlIndex].isHide = false
this.showSubmit = false this.showSubmit = false
this.title = '查看' this.title = '查看'
this.setAllDisabled('merchantEditFormData')
} else if (addOrEdit == 2) { } else if (addOrEdit == 2) {
this.apear = 'couponEdit' this.apear = 'couponEdit'
this.title = '编辑' this.title = '编辑'
...@@ -309,6 +313,11 @@ export default { ...@@ -309,6 +313,11 @@ export default {
}, },
methods: { methods: {
setAllDisabled(editName) {
this[editName].forEach(item => {
item.isDisabled = true
})
},
editCoupon(attribute) { editCoupon(attribute) {
attribute.forEach(item => { attribute.forEach(item => {
let index = this.editFormData.findIndex(val => val.name == `${item}`) let index = this.editFormData.findIndex(val => val.name == `${item}`)
...@@ -333,11 +342,17 @@ export default { ...@@ -333,11 +342,17 @@ export default {
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.loading = true
this.$apis.couponManage
.getCouponDetailApi({ couponId: this.routeInfo.id })
.then(res => {
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.directionalFlag = this.editForm.directionalFlag + '' this.editForm.directionalFlag = this.editForm.directionalFlag + ''
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2) this.editForm.anticipatedCost = (this.editForm.anticipatedCost / 100).toFixed(2)
if (this.$isGroupUp) {
this.editForm.scopeApplication = this.editForm.scopeApplication + ''
}
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) { if (this.editForm.effectiveType == 2) {
...@@ -346,6 +361,8 @@ export default { ...@@ -346,6 +361,8 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.editStatus = false this.editStatus = false
}) })
}).finally(() => {
this.loading = false
}) })
}, },
...@@ -394,7 +411,12 @@ export default { ...@@ -394,7 +411,12 @@ export default {
} }
//库存 //库存
obj.limitStockFlag = this.$isGroupUp ? 2 : 1
if (!this.$isGroupUp) {
obj.stock = form.stock obj.stock = form.stock
} else {
obj.scopeApplication = form.scopeApplication
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次) //类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1 obj.useType = 1
//有效期或者间隔天数使用次数 //有效期或者间隔天数使用次数
......
<!-- 编辑会员服务 --> <!-- 编辑会员服务 -->
<template> <template>
<div class="edit-share marketing p-t-20 edit-box"> <div class="edit-share marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container" v-loading="loading">
<p class="edit-title">{{ title }}会员服务</p> <p class="edit-title">{{ title }}会员服务</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml"> <template slot="effectiveHtml">
...@@ -97,6 +97,7 @@ export default { ...@@ -97,6 +97,7 @@ export default {
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
loading: false,
// pickerOptions: { // pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期 // disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000; // return v.getTime() < new Date().getTime() - 86400000;
...@@ -118,7 +119,8 @@ export default { ...@@ -118,7 +119,8 @@ export default {
effectiveType: '3', effectiveType: '3',
useType: '0', useType: '0',
usageTimes: 1, usageTimes: 1,
usageTimes2: 1 usageTimes2: 1,
scopeApplication: ''
}, },
editRule: { editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }], couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
...@@ -179,15 +181,16 @@ export default { ...@@ -179,15 +181,16 @@ export default {
], ],
// 适用门店 // 适用门店
merchantRule: { merchantRule: {
merchantRadio: [{ required: true, message: '请选择适用范围', trigger: 'change' }] scopeApplication: [{ required: true, message: '请选择适用范围', trigger: 'change' }]
}, },
merchantEditFormData: [ merchantEditFormData: [
{ {
label: '适用范围', label: '适用范围',
name: 'merchantRadio', name: 'scopeApplication',
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false,
optionList: [ optionList: [
{ {
confId: '1', confId: '1',
...@@ -219,6 +222,7 @@ export default { ...@@ -219,6 +222,7 @@ export default {
if (addOrEdit == 3) { if (addOrEdit == 3) {
this.apear = 'couponSee' this.apear = 'couponSee'
this.title = '查看' this.title = '查看'
this.setAllDisabled('merchantEditFormData')
} else if (addOrEdit == 2) { } else if (addOrEdit == 2) {
this.apear = 'couponEdit' this.apear = 'couponEdit'
this.title = '编辑' this.title = '编辑'
...@@ -267,16 +271,27 @@ export default { ...@@ -267,16 +271,27 @@ export default {
}, },
methods: { methods: {
setAllDisabled(editName) {
this[editName].forEach(item => {
item.isDisabled = true
})
},
setDateString(objField, special) { setDateString(objField, special) {
var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日') var value = typeof objField == 'string' ? objField.split(' ')[0] : special ? objField.format('YYYY年MM月DD日') : objField.format('YYYY年MM月DD日')
return value return value
}, },
getInfo() { getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => { this.loading = true
this.$apis.couponManage
.getCouponDetailApi({ couponId: this.routeInfo.id })
.then(res => {
this.editForm = this.$common.utils.deepClone(res) this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + '' this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useType = this.editForm.useType + '' this.editForm.useType = this.editForm.useType + ''
if (this.$isGroupUp) {
this.editForm.scopeApplication = this.editForm.scopeApplication + ''
}
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
...@@ -289,6 +304,8 @@ export default { ...@@ -289,6 +304,8 @@ export default {
} else if (this.editForm.useType == 2) { } else if (this.editForm.useType == 2) {
this.editForm.usageTimes2 = this.editForm.useAmount this.editForm.usageTimes2 = this.editForm.useAmount
} }
}).finally(() => {
this.loading = false
}) })
}, },
...@@ -364,7 +381,12 @@ export default { ...@@ -364,7 +381,12 @@ export default {
//门店价 //门店价
obj.shopPrice = form.shopPrice obj.shopPrice = form.shopPrice
//库存 //库存
obj.limitStockFlag = this.$isGroupUp ? 2 : 1
if (!this.$isGroupUp) {
obj.stock = form.stock obj.stock = form.stock
} else {
obj.scopeApplication = form.scopeApplication
}
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription obj.useDescription = form.useDescription
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant' import { exportFn } from '@/common/constant'
export default { export default {
...@@ -82,7 +83,7 @@ export default { ...@@ -82,7 +83,7 @@ export default {
couponName: '', couponName: '',
discountType: '', discountType: '',
status: '', status: '',
discountTypes: [2, 3, 4] discountTypes: [2, 3, 4, 7]
}, },
tableSearchForm: {}, tableSearchForm: {},
// 搜索 // 搜索
...@@ -122,7 +123,7 @@ export default { ...@@ -122,7 +123,7 @@ export default {
// } // }
], ],
// 表格 // 表格
getListApi: this.$apis.couponManage.getMerchantListApi, getListApi: this.$apis.couponManage.getCouponListApi,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
...@@ -136,19 +137,51 @@ export default { ...@@ -136,19 +137,51 @@ export default {
{ {
label: '券名称', label: '券名称',
prop: 'couponName', prop: 'couponName',
width: 200,
line: 2 line: 2
}, },
{ {
label: '有效期', label: '有效期',
prop: '' prop: 'effectiveType',
width: 200,
formatter: cellValue => {
switch (cellValue.effectiveType) {
case 1:
return '领取后' + cellValue.effectiveDays + '天内有效'
case 2:
return dayjs(cellValue.effectiveStartTime).format('YYYY-MM-DD HH:mm:ss') + '-' + dayjs(cellValue.effectiveEndTime).format('YYYY-MM-DD HH:mm:ss')
case 3:
return '无有效期'
default:
return '-'
}
}
}, },
{ {
label: '可用次数', label: '可用次数',
prop: '' prop: 'useType',
width: 200,
line: 2,
formatter: cellValue => {
switch (cellValue.useType) {
case 0:
return '不限制次数'
case 1:
return '有效期内可使用' + cellValue.useAmount + '次'
case 2:
return '有效期内' + cellValue.useLimitDays + '天可使用' + cellValue.useAmount + '次'
default:
return '-'
}
}
}, },
{ {
label: '库存', label: '库存',
prop: '' prop: 'stock',
width: 120,
formatter: cellValue => {
return cellValue.limitStockFlag == 1 ? cellValue.stock : '无库存限制'
}
}, },
{ {
label: '使用途径', label: '使用途径',
...@@ -200,7 +233,14 @@ export default { ...@@ -200,7 +233,14 @@ export default {
}, },
{ {
label: '适用范围', label: '适用范围',
name: 'application' name: 'scopeApplication',
width: 160,
formatter: cellValue => {
return {
1: '旗下所有店通用',
2: '旗下品牌店通用'
}[cellValue.scopeApplication]
}
}, },
{ {
label: '已领取', label: '已领取',
...@@ -216,7 +256,8 @@ export default { ...@@ -216,7 +256,8 @@ export default {
attrToIcon: { attrToIcon: {
2: 'discount', 2: 'discount',
3: 'cash', 3: 'cash',
4: 'exchange' 4: 'exchange',
7: 'service'
}, },
baseData: { baseData: {
discountTypeList: [ discountTypeList: [
...@@ -231,11 +272,11 @@ export default { ...@@ -231,11 +272,11 @@ export default {
{ {
confId: '4', confId: '4',
confName: '兑换券' confName: '兑换券'
},
{
confId: '7',
confName: '服务券'
} }
// {
// confId: '7',
// confName: '会员服务'
// }
], ],
// directionalFlagList: [ // directionalFlagList: [
// { // {
...@@ -448,7 +489,7 @@ export default { ...@@ -448,7 +489,7 @@ export default {
couponName: '', couponName: '',
discountType: '', discountType: '',
status: '', status: '',
discountTypes: [2, 3, 4] discountTypes: [2, 3, 4, 7]
} }
this.handleSearch() this.handleSearch()
}, },
......
...@@ -96,7 +96,8 @@ export default { ...@@ -96,7 +96,8 @@ export default {
attrToIcon: { attrToIcon: {
2: 'discount', 2: 'discount',
3: 'cash', 3: 'cash',
4: 'exchange' 4: 'exchange',
7: 'service'
}, },
// 优惠券信息 // 优惠券信息
couponFormData: [ couponFormData: [
......
...@@ -98,17 +98,13 @@ export default { ...@@ -98,17 +98,13 @@ export default {
}, },
size: 'small', size: 'small',
searchForm: { searchForm: {
// couponId:222 //卷id
//userCouponId //用户卷id
// name: '',
// daterange:''
couponName: '', couponName: '',
userReq: '', userReq: '',
verificationOperator: '', verificationOperator: '',
orderCode: '', orderCode: '',
merchantId: 0, merchantId: 0,
discountType: '', discountType: '',
discountTypes: [7] discountTypes: [2, 3, 4, 7]
}, },
tableSearchForm: {}, tableSearchForm: {},
// 搜索 // 搜索
...@@ -219,7 +215,8 @@ export default { ...@@ -219,7 +215,8 @@ export default {
attrToIcon: { attrToIcon: {
2: 'discount', 2: 'discount',
3: 'cash', 3: 'cash',
4: 'exchange' 4: 'exchange',
7: 'service'
}, },
baseData: { baseData: {
discountTypeList: [ discountTypeList: [
...@@ -399,7 +396,7 @@ export default { ...@@ -399,7 +396,7 @@ export default {
// this.searchForm = { merchantId: 44184606 } // this.searchForm = { merchantId: 44184606 }
// this.handleSearch() // this.handleSearch()
this.isReload = false this.isReload = false
this.searchForm = { merchantId: this.merchantId, discountTypes: [7] } this.searchForm = { merchantId: this.merchantId, discountTypes: [2, 3, 4, 7] }
this.$nextTick(() => { this.$nextTick(() => {
this.isReload = true this.isReload = true
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!