Commit 7b25a25e by wangql

模块代码提交

1 parent 409c4806
{ {
"name": "services", "name": "marketing",
"version": "0.1.0", "version": "0.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
...@@ -3673,6 +3673,11 @@ ...@@ -3673,6 +3673,11 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"dayjs": {
"version": "1.10.7",
"resolved": "https://registry.nlark.com/dayjs/download/dayjs-1.10.7.tgz",
"integrity": "sha1-LPX5Gt0oEWdIRAhmoKHSbzps5Gg="
},
"de-indent": { "de-indent": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^3.4.4", "core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
......
import { http } from '@/main'
const defaultPath = 'scrm.api.coupon.'
//优惠券列表
const getMerchantListApi = params => {
params.method = `${defaultPath}list.merchant`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//生效/失效
const effectiveCouponApi = params => {
params.method = `${defaultPath}effective`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除
const deleteCouponApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//核销记录列表
const getVerificationListApi = params => {
params.method = `${defaultPath}verification.code.verification.list`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//查看优惠券
const getCouponDetailApi = params => {
params.method = `${defaultPath}detail`
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//优惠券核销
const codeVerificationApi = params => {
params.method = `${defaultPath}verification.code.verification`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//创建优惠券
const createCouponApi = params => {
params.method = `${defaultPath}create`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//修改优惠券
const updateCouponApi = params => {
params.method = `${defaultPath}update`
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getMerchantListApi, getVerificationListApi, effectiveCouponApi, codeVerificationApi, getCouponDetailApi, deleteCouponApi, createCouponApi, updateCouponApi }
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.activity.'
//分页查询活动
const getActivityPageApi = params => {
params.method = `${defaultPath}page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//开始/结束活动
const toggleStatusApi = params => {
params.method = `${defaultPath}toggle.status`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除活动
const deleteActivityApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//置顶活动
const topActivityApi = params => {
params.method = `${defaultPath}top`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getActivityPageApi, toggleStatusApi, deleteActivityApi, topActivityApi }
...@@ -64,5 +64,17 @@ const staticRoutes = Object.freeze([ ...@@ -64,5 +64,17 @@ const staticRoutes = Object.freeze([
component: resolve => require([`@/views/productStore/index.vue`], resolve), component: resolve => require([`@/views/productStore/index.vue`], resolve),
meta: {} meta: {}
}, },
{
name: 'couponManage',
path: '/couponManage/index',
component: resolve => require([`@/views/couponManage/index.vue`], resolve),
meta: {}
},
{
name: 'editCashCoupon',
path: '/couponManage/editCashCoupon/:addOrEdit',
component: resolve => require([`@/views/couponManage/editCashCoupon.vue`], resolve),
meta: {}
}
]) ])
export default staticRoutes export default staticRoutes
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}代金券</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="waysHtml">
<el-radio v-model="editForm.way" label="1" :disabled="apear!='couponAdd'">线上商品</el-radio>
<el-radio v-model="editForm.way" label="2" :disabled="apear!='couponAdd'" @change="clickWay">到店核销</el-radio>
</template>
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear!='couponAdd'">无有效期</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期" :disabled="editForm.effectiveType != 2||apear!='couponAdd'">
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="barriersHtml">
<el-radio v-model="editForm.barriers" label="1" :disabled="apear!='couponAdd'">无限制</el-radio>
<el-radio v-model="editForm.barriers" label="2" :disabled="apear!='couponAdd' || editForm.way == 2">
<el-form-item prop="full">
订单满<el-input v-model="editForm.full" placeholder="输入金额(元)" style="width: 110px;" :disabled="apear!='couponAdd'|| editForm.barriers != 2" />元可用
<span style="color:red" v-if="priceFlag">存在零售价低于代金券的商品</span>
</el-form-item>
</el-radio>
</template>
<template slot="goodsHtml">
<el-radio v-model="editForm.goods" label="1" :disabled="apear!='couponAdd'">全部商品可用</el-radio>
<el-radio v-model="editForm.goods" label="2" :disabled="apear!='couponAdd'">指定商品可用</el-radio><br>
<el-button type="primary" v-if="editForm.goods == 2" @click="chooseGoods">选择商品</el-button>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'editCashCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
priceFlag: false,
editForm: {
couponName: '',
way: '1',
effectiveType: '3',
barriers: '1',
goods: '1'
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
barriers: [{ required: true, message: '请选择使用限制', trigger: 'change' }],
full: [{ required: true, message: '门槛数值不能为空', trigger: 'blur' }],
denomination: [{ required: true, message: '面值不能为空', trigger: 'change' }],
stock: [{ required: true, message: '库存不能为空', trigger: 'change' }],
goods: [{ required: true, message: '请选择适用商品', trigger: 'change' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }]
},
editFormData: [
{
label: '优惠券名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '使用途径',
name: 'ways',
addHtml: 'waysHtml'
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用限制',
name: 'barriers',
addHtml: 'barriersHtml'
},
{
label: '面值',
name: 'denomination',
width: '150px',
type: 'input'
},
{
label: '库存',
name: 'stock',
width: '150px',
type: 'input'
},
{
label: '适用商品',
name: 'goods',
addHtml: 'goodsHtml'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
} else {
this.apear = 'couponAdd';
this.title = '创建';
}
},
methods: {
getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
// this.editForm.zoneName = res.zoneName
// this.editForm.zoneImg = res.zoneImg
// this.editForm.merchantList = res.merchantRefList
// this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId
// })
// })
},
//选择到店核销使用限制默认无使用门槛
clickWay(){
this.editForm.barriers = '1'
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
if(form.barriers == '2'){//判断 使用限制-订单满多少可用是否验证
this.editRule.full[0].required = true
}else {
this.editRule.full[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '3';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//使用限制 1:无限制 2:满减
obj.useBarriers = form.barriers
if (form.barriers == 2) {
//满多少减
obj.full = form.full;
}
//面值
obj.denomination = form.denomination;
//库存
obj.stock = form.stock;
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = 1
//有效期或者间隔天数使用次数
obj.useAmount = 1
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
// this.$apis.couponManage[method](params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.handleCancel()
// }
// })
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
<!-- 编辑代金券 -->
<template>
<div class="edit-share marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}会员服务</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear!='couponAdd'">无有效期</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveTime">
<el-date-picker
v-model="editForm.effectiveTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:disabled="editForm.effectiveType != 2||apear!='couponAdd'" clearable>
</el-date-picker>
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.effectiveType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="effectiveDays">
领取后&nbsp;&nbsp;<el-input v-model="editForm.effectiveDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.effectiveType != 1" />&nbsp;&nbsp;天内有效
</el-form-item>
</el-radio>
</template>
<template slot="useTypeHtml">
<el-radio v-model="editForm.useType" label="0" :disabled="apear!='couponAdd'">无限制</el-radio><br>
<el-radio v-model="editForm.useType" label="1" :disabled="apear!='couponAdd'">
<el-form-item prop="usageTimes">
有效期内可使用&nbsp;&nbsp;
<el-input v-model="editForm.usageTimes" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.useType != 1" />&nbsp;&nbsp;次
</el-form-item>
</el-radio><br>
<el-radio v-model="editForm.useType" label="2" :disabled="apear!='couponAdd'">
<el-form-item prop="useLimitDays">
有效期内
<el-input v-model="editForm.useLimitDays" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.useType != 2" />&nbsp;&nbsp;天
&nbsp;&nbsp;可使用&nbsp;&nbsp;
</el-form-item>
<el-form-item prop="usageTimes2">
<el-input v-model="editForm.usageTimes2" style="width: 100px;" :disabled="apear!='couponAdd'|| editForm.useType != 2" />&nbsp;&nbsp;次
</el-form-item>
</el-radio>
</template>
<template slot="useDescriptionHtml">
<el-input type="textarea" v-model="editForm.useDescription" style="width: 308px" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" :disabled="apear=='couponSee'" />
</template>
</glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" v-if="apear!='couponSee'" @click="handleConfirm">确定</el-button>
<el-button type="default" v-if="apear!='couponSee'" @click="handleCancel">取消</el-button>
<el-button type="default" v-if="apear=='couponSee'" @click="handleCancel">返回</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'editCashCoupon',
data() {
return {
size: 'small',
title: '创建',
titleObj: {
1: '创建晒单',
2: '编辑晒单'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
// pickerOptions: {
// disabledDate(v) {//禁用当前之前的日期
// return v.getTime() < new Date().getTime() - 86400000;
// },
// disabledDate(time) {//禁用当前之后的日期
// return time.getTime() > Date.now() - 8.64e6
// }
// },
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
apear: '',
isDisabled: true,
editForm: {
couponName: '',
effectiveType: '3',
useType: '0',
usageTimes: 1,
usageTimes2: 1
},
editRule: {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'change' }],
effectiveType: [{ required: true, message: '请选择有效期', trigger: 'change' }],
effectiveTime: [{ required: true, message: '有效期不能为空', trigger: 'change' }],
effectiveDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
useType: [{ required: true, message: '请选择使用限制', trigger: 'change' }],
usageTimes: [{ required: true, message: '使用次数不能为空', trigger: 'blur' }],
useLimitDays: [{ required: true, message: '有效期天数不能为空', trigger: 'blur' }],
usageTimes2: [{ required: true, message: '使用次数不能为空', trigger: 'blur' }],
vipPrice: [{ required: true, message: '会员价不能为空', trigger: 'change' }],
shopPrice: [{ required: true, message: '门店价不能为空', trigger: 'change' }],
stock: [{ required: true, message: '库存不能为空', trigger: 'change' }],
useDescription: [{ required: true, message: '使用说明不能为空', trigger: 'change' }]
},
editFormData: [
{
label: '服务名称',
name: 'couponName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '有效期',
name: 'effectiveType',
addHtml: 'effectiveHtml'
},
{
label: '使用限制',
name: 'useType',
addHtml: 'useTypeHtml'
},
{
label: '会员价',
name: 'vipPrice',
width: '150px',
type: 'input'
},
{
label: '门店价',
name: 'shopPrice',
width: '150px',
type: 'input'
},
{
label: '库存',
name: 'stock',
width: '150px',
type: 'input'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
}
]
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
// this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
var id = this.routeInfo.id
var addOrEdit = this.routeInfo.addOrEdit
if (id) {
if(addOrEdit == 3){
this.apear = 'couponSee';
this.title = '查看';
}else if(addOrEdit == 2){
this.apear = 'couponEdit';
this.title = '编辑';
}
this.isDisabled = true
this.editFormData[0].isDisabled = this.isDisabled
this.editFormData[3].isDisabled = this.isDisabled
this.editFormData[4].isDisabled = this.isDisabled
this.editFormData[5].isDisabled = this.isDisabled
} else {
this.apear = 'couponAdd';
this.title = '创建';
this.isDisabled = false
}
},
methods: {
getInfo() {
this.$apis.couponManage.getCouponDetailApi({ couponId: this.routeInfo.id }).then(res => {
console.log(res);
this.editForm = this.$common.utils.deepClone(res)
this.editForm.effectiveType = this.editForm.effectiveType + ''
this.editForm.useType = this.editForm.useType + ''
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
if (this.editForm.effectiveType == 2) {
this.editForm.effectiveTime = [this.editForm.effectiveStartTime,this.editForm.effectiveEndTime]
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
if (this.editForm.useType == 1) {
this.editForm.usageTimes = this.editForm.useAmount;
} else if (this.editForm.useType == 2) {
this.editForm.usageTimes2 = this.editForm.useAmount;
}
})
},
validateRules(){
var form = this.editForm
if(form.effectiveType == '2'){//判断 有效期-日期选择是否验证
this.editRule.effectiveTime[0].required = true
}else {
this.editRule.effectiveTime[0].required = false
}
if(form.effectiveType == '1'){//判断 有效期-有效天数是否验证
this.editRule.effectiveDays[0].required = true
}else {
this.editRule.effectiveDays[0].required = false
}
if(form.useType == '1'){//判断 使用限制-有效期内使用次数是否验证
this.editRule.usageTimes[0].required = true
}else {
this.editRule.usageTimes[0].required = false
}
if(form.useType == '2'){//判断 使用限制-有效天数和使用次数是否验证
this.editRule.useLimitDays[0].required = true
this.editRule.usageTimes2[0].required = true
}else {
this.editRule.useLimitDays[0].required = false
this.editRule.usageTimes2[0].required = false
}
},
getCouponInfoParams() {
var obj = {};
var id = this.routeInfo.id
var form = this.$common.utils.deepClone(this.editForm)
if (id) {
obj.couponId = id;
}else{//编辑时只允许编辑使用说明
//优惠券名称
obj.couponName = form.couponName;
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '7';
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
if (form.effectiveType == 1) {//固定天数
obj.effectiveDays = form.effectiveDays;
} else if (form.effectiveType == 2) {//时间段
const d = form.effectiveTime
if (d && d.length > 0) {
obj.effectiveStartTime = d[0] + ' 00:00:00';
obj.effectiveEndTime = d[1] + ' 23:59:59';
}
}
//类型(0:不限制次数,1:根据有效期限制多少次,2:根据间隔多少天限制多少次)
obj.useType = form.useType;
if (form.useType == 1) {
obj.useAmount = form.usageTimes;
} else if (form.useType == 2) {
obj.useLimitDays = form.useLimitDays;
obj.useAmount = form.usageTimes2;
}
//会员价
obj.vipPrice = form.vipPrice;
//门店价
obj.shopPrice = form.shopPrice;
//库存
obj.stock = form.stock;
}
//使用描述
obj.useDescription = form.useDescription;
return obj;
},
handleConfirm() {
this.validateRules()
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.getCouponInfoParams()
console.log(params);
let method = ''
if(params.couponId){
method = 'updateCouponApi'//后台修改优惠券
}else {
method = 'createCouponApi'//后台创建优惠券
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/couponManage/index'
})
}
}
}
</script>
<style scoped></style>
<!-- 商品管理-门店 -->
<template>
<div class="marketing pro-group">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新建代金券</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建会员服务</el-button>
<el-button :size="size" type="primary" class="el-icon-plus" @click="addService()">新建折扣卷</el-button>
</div>
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="coupon" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button v-if="scope.scope.status == '1'" type="text" @click="start(scope.scope)">生效</el-button>
<el-button v-if="scope.scope.status == '2'" type="text" @click="end(scope.scope)">失效</el-button>
<el-button v-if="scope.scope.status == '1'" type="text" @click="handleEdit(2,scope.scope)">编辑</el-button>
<el-button v-if="scope.scope.status == '2' || scope.scope.status == '3'" type="text" @click="handleEdit(3,scope.scope)">查看</el-button>
<el-button v-if="scope.scope.status == '1' || scope.scope.status == '3'" type="text" @click="del(scope.scope)">删除</el-button>
<el-button type="text" @click="writeOffDetail(scope.scope)">核销详情</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 下架 -->
<glsx-dialog title="下架" :isVisible.sync="isDownVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="downRef" label-width="100px" :rules="downRules" :model="downForm">
<el-form-item label="下架备注" prop="offReason">
<el-input :size="size" v-model="downForm.offReason" placeholder="请输入下架备注" maxlength="30"></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div>
</template>
<script>
import shareDialog from '../productGroup/components/shareDialog'
export default {
name: 'coupon',
data() {
return {
size: 'small',
// 下架
isDownVisible: false,
downForm: {
id: '',
offReason: '',
goodsStatus: 0
},
downRules: {
offReason: [{ required: true, message: '请输入下架备注', trigger: 'change' }]
},
// 分享
isShareVisible: false,
shareForm: {},
// 表格
searchForm: {
couponName: '',
discountType: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '名称',
name: 'couponName',
type: 'input',
maxlength: 20
},
// {
// label: '创建日期',
// name: 'createDate',
// type: 'datePicker',
// isClear: true,
// pickerOptions: 'beforeRangePickerOptions'
// },
{
label: '优惠券类型',
name: 'discountType',
type: 'select',
width: '160px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'discountTypeList'
},
{
label: '优惠券状态',
name: 'status',
type: 'select',
width: '160px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
}
],
// 表格
getListApi: this.$apis.couponManage.getMerchantListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '名称',
prop: 'couponName',
line: 2
},
{
label: '优惠券类型',
name: 'discountType',
formatter: cellValue => {
return this.baseData.discountTypeList.find(item => item.confId == cellValue.discountType).confName
}
},
{
label: '已领取',
prop: 'getAmount'
},
{
label: '剩余',
prop: 'residueAmount'
},
{
label: '优惠券状态',
name: 'status',
formatter: cellValue => {
return this.baseData.statusList.find(item => item.confId == cellValue.status).confName
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
discountTypeList: [{
confId: '3',
confName: '代金券'
}, {
confId: '7',
confName: '会员服务'
}],
statusList: [{
confId: '1',
confName: '未生效'
}, {
confId: '2',
confName: '生效中'
}, {
confId: '3',
confName: '已失效'
}],
}
}
},
components: {
shareDialog
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
// delete this.tableSearchForm.createDate
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
//生效
start(item){
this.startOrEndConfirm('生效',item)
},
//失效
end(item){
this.startOrEndConfirm('失效',item)
},
startOrEndConfirm(txt,row) {
var title = txt
var params = {}
params.couponId = row.id
if(txt == '生效'){
params.status = '2' //优惠券状态(2:生效,3:失效)
}else if(txt == '失效'){
params.status = '3' //优惠券状态(2:生效,3:失效)
}
this.secondConfirm(title, '确定要' + txt + '该优惠券?', 'couponManage', 'effectiveCouponApi', params)
},
//核销记录
writeOffDetail(row){
this.$router.push('/couponManage/writeOffDetail/' + row.id)
},
//删除
del(row){
var params = {}
params.couponId = row.id
this.secondConfirm('删除', '确定删除此优惠券?', 'couponManage', 'deleteCouponApi', params)
},
//新增代金券
addCashCoupon() {
this.$router.push('/couponManage/editCashCoupon/1')
},
//新增会员服务
addService() {
this.$router.push('/couponManage/editMemberService/1')
},
// addOrEdit:1-新增;2-编辑;3-查看
handleEdit(addOrEdit, row) {
var goto = ''
if(row.discountType == '3'){//代金券
goto = '/couponManage/editCashCoupon/'
}else if(row.discountType == '7'){//会员服务
goto = '/couponManage/editMemberService/'
}
console.log(goto + addOrEdit + '/' + row.id);
this.$router.push(goto + addOrEdit + '/' + row.id)
},
// 下架通知
handleDwonNotice(row) {
this.$alert( '你带货的' + row.goodsName + '商品现已下架,下架原因:' + row.offReason, '商品下架通知', {
confirmButtonText: '确定',
callback: action => { }
})
},
handleUpOrDown(row) {
var title = row.goodsStatus == 0 ? '上架' : '下架'
this.secondConfirm(title, '是否确认' + title + '该商品?', 'proManage', 'updateStatusProApi', { id: row.id, goodsStatus: row.goodsStatus == 0 ? 1 : 0 })
},
// 取消带货
handleTakeGood(row) {
this.secondConfirm('取消带货', '是否确认取消带货该商品?', 'proManage', 'deleteTakeProApi', { id: row.id })
},
dwonVisibleChange() {
this.$refs.downRef && this.$refs.downRef.clearValidate()
this.isDownVisible = !this.isDownVisible
},
handleDownClose() {
this.dwonVisibleChange()
this.downForm = {
id: '',
offReason: '',
goodsStatus: 0
}
},
handleDownConfirm() {
this.$refs.downRef.validate(valid => {
if (valid) {
this.$apis.proManage.updateStatusProApi(this.downForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleDownClose()
this.handleSearch()
}
})
}
})
},
// 置顶
handleTop(row) {
this.secondConfirm('置顶', '是否确认置顶该商品?', 'proManage', 'topProApi', { id: row.id })
},
handleShare(row) {
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleSearch() {
this.$refs.coupon.refreshTable()
},
handleReset() {
this.searchForm = {
couponName: '',
discountType: '',
status: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
<!-- 商品管理-门店 -->
<template>
<div class="marketing pro-group">
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="writeOff">优惠券核销</el-button>
<el-button :size="size" type="primary" @click="goback">返回</el-button>
</span>
</glsx-combi-form>
</div>
<div class="icon-tips icon-green" style="width: 98%;display: inline-block; margin-bottom: 20px;">
<img src="../../images/comment.png" />
<span>优惠券名称:<i>{{coupon.couponName}}</i></span>
<span>发行总量:<i>{{coupon.stock}}</i></span>
<span>核销总量:<i>{{coupon.usedAmount}}</i></span>
<span>有效期:<i>{{effective}}</i></span>
<span>使用限制:<i>{{useB}}</i></span>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="writeOffList" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 优惠券核销 -->
<glsx-dialog title="优惠券核销(请确保用户到店后核销,避免引起不必要问题)" :isVisible.sync="writeOffVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="writeOffRef" label-width="100px" :rules="writeOffRules" :model="writeOffForm">
<el-form-item label="核销码" prop="verficationCode">
<el-input :size="size" v-model="writeOffForm.verficationCode" placeholder="请输入核销码" style="width:300px;" maxlength="32"></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
export default {
name: 'writeOffDetail',
data() {
return {
size: 'small',
// 下架
writeOffVisible: false,
coupon: {
couponName: '',
stock: '',
usedAmount: ''
},
effective: '',
useB: '',
writeOffForm: {
verficationCode: ''
},
writeOffRules: {
verficationCode: [{ required: true, message: '请输入核销码', trigger: 'change' }]
},
shareForm: {},
// 表格
searchForm: {
verificationCode: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '核销码',
name: 'verificationCode',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.couponManage.getVerificationListApi,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '核销码',
prop: 'verificationCode'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '领取时间',
prop: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '核销时间',
prop: 'verificationTime',
formatter: cellValue => {
return dayjs(cellValue.verificationTime).format('YYYY-MM-DD HH:mm:ss')
}
},
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
},
}
},
components: {
},
mounted() {
this.getOptionsList('searchFormData')
this.getInfo(this.$route.params.id)
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.couponId = this.$route.params.id
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
getInfo(couponId) {
var params = {}
params.couponId = couponId
this.$apis.couponManage.getCouponDetailApi(params).then(res => {
this.coupon = res
this.effective = ''
this.useB = ''
var coupon = res
//有效期
if(coupon.effectiveType == 1){//固定天数,领取后计算
this.effective = coupon.effectiveDays + '天'
}else if(coupon.effectiveType == 2){//时间段
this.effective = coupon.effectiveStartTime + ' - ' + coupon.effectiveEndTime
}else if(coupon.effectiveType == 3){//无有效期
this.effective = '无有效期'
}
if(coupon.discountType == 3){//代金券
//使用限制
if(coupon.useBarriers == 1){//无限制
this.useB = '无限制'
}else if(coupon.useBarriers == 2){//满减
this.useB = '满' + coupon.full + '元可用'
}
}
if(coupon.discountType == 7){//会员服务
//使用限制
if(coupon.useType == 0){//无限制
this.useB = '无限制'
}else if(coupon.useType == 1){//有效期内可使用次数
this.useB = '有效期内可使用' + coupon.useAmount + '次'
}else if(coupon.useType == 2){//有效期内多少天内可使用次数
this.useB = '有效期内' + coupon.useLimitDays + '天可使用' + coupon.usedAmount + '次'
}
}
})
},
writeOff(){
this.writeOffVisible = !this.writeOffVisible
},
//返回
goback(){
this.$router.push('/couponManage/index')
},
dwonVisibleChange() {
this.$refs.writeOffRef && this.$refs.writeOffRef.clearValidate()
this.writeOffVisible = !this.writeOffVisible
},
handleDownClose() {
this.dwonVisibleChange()
this.writeOffForm = {
verficationCode: ''
}
},
handleDownConfirm() {
this.$refs.writeOffRef.validate(valid => {
if (valid) {
this.$apis.couponManage.codeVerificationApi(this.writeOffForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleDownClose()
this.handleSearch()
}
})
}
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleSearch() {
this.$refs.writeOffList.refreshTable()
},
handleReset() {
this.searchForm = {
verificationCode: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped>
.modal-title span {
font-size: 12px;
font-weight: 400;
}
.icon-green {
background-color: rgba(3,153,69,.2);
border: 1px solid rgba(3,153,69,.2);
}
.icon-tips {
border-radius: 2px;
font-size: 12px;
color: #333;
line-height: 30px;
padding: 0 10px 0 30px;
position: relative;
}
.icon-tips span {
margin-right: 10px;
}
.icon-tips i {
font-style: normal;
color: #ff3f3f;
margin: 0 3px;
}
.icon-tips img {
position: absolute;
top: 8px;
left: 10px;
}
</style>
<!-- 商品管理-门店 -->
<template>
<div class="marketing pro-group">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="addCashCoupon()">新增秒杀活动</el-button>
</div>
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="100px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="coupon" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<template slot="activityImg" slot-scope="scope">
<img class="img-60" :src="scope.scope.activityImg"/>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button v-if="scope.scope.activityStatus == '1'" type="text" @click="start(scope.scope)">开始</el-button>
<el-button v-if="scope.scope.activityStatus == '2'" type="text" @click="end(scope.scope)">结束</el-button>
<el-button v-if="scope.scope.activityStatus == '1'" type="text" @click="handleEdit(2,scope.scope)">编辑</el-button>
<el-button v-if="scope.scope.activityStatus == '2' || scope.scope.activityStatus == '3'" type="text" @click="handleEdit(3,scope.scope)">查看</el-button>
<el-button v-if="scope.scope.activityStatus == '3'" type="text" @click="del(scope.scope)">删除</el-button>
<el-button type="text" @click="topping(scope.scope)">置顶</el-button>
<el-button v-if="scope.scope.activityStatus == '1' || scope.scope.activityStatus == '2'" type="text" @click="share(scope.scope)">分享</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div>
</template>
<script>
import shareDialog from '../productGroup/components/shareDialog'
import * as dayjs from 'dayjs'
export default {
name: 'coupon',
data() {
return {
size: 'small',
downForm: {
id: '',
offReason: '',
goodsStatus: 0
},
// 分享
isShareVisible: false,
shareForm: {},
// 表格
searchForm: {
activityName: '',
activityStatus: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '活动名称',
name: 'activityName',
type: 'input',
maxlength: 20
},
{
label: '状态',
name: 'activityStatus',
type: 'select',
width: '160px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
}
],
// 表格
getListApi: this.$apis.seckillActivity.getActivityPageApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '活动名称',
prop: 'activityName'
},
{
label: '缩略图',
prop: 'activityImg',
addHtml: 'activityImg'
},
{
label: '浏览量(次)',
prop: 'viewAmount'
},
{
label: '销量',
prop: 'saleAmount'
},
{
label: '秒杀价(元)',
name: 'activityPrice',
formatter: cellValue => {
if(cellValue.activityPrice){
return (cellValue.activityPrice/100).toFixed(2);
}
return '';
}
},
{
label: '库存',
prop: 'goodsStock'
},
{
label: '创建日期',
name: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '活动状态',
name: 'activityStatus',
formatter: cellValue => {
return this.baseData.statusList.find(item => item.confId == cellValue.activityStatus).confName
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total'},
baseData: {
statusList: [{
confId: '1',
confName: '未开始 '
}, {
confId: '2',
confName: '进行中'
}, {
confId: '3',
confName: '已结束'
}],
}
}
},
components: {
shareDialog
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
// delete this.tableSearchForm.createDate
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
//开始
start(item){
this.startOrEndConfirm('开始',item)
},
//结束
end(item){
this.startOrEndConfirm('结束',item)
},
startOrEndConfirm(txt,row) {
var title = txt
var params = {}
params.id = row.id
if(txt == '开始'){
params.activityStatus = '2' //活动状态(1:未开始,2:开始,3:结束)
}else if(txt == '结束'){
params.activityStatus = '3' //活动状态(1:未开始,2:开始,3:结束)
}
this.secondConfirm(title, '确定要' + txt + '此活动?', 'seckillActivity', 'toggleStatusApi', params)
},
//置顶
topping(row){
var params = {}
params.id = row.id
this.secondConfirm('删除', '确定置顶此活动?', 'seckillActivity', 'topActivityApi', params)
},
//删除
del(row){
var params = {}
params.id = row.id
this.secondConfirm('删除', '确定删除此活动?', 'seckillActivity', 'deleteActivityApi', params)
},
//新增代金券
addCashCoupon() {
this.$router.push('/couponManage/editCashCoupon/1')
},
// addOrEdit:1-新增;2-编辑;3-查看
handleEdit(addOrEdit, row) {
var goto = ''
if(row.discountType == '3'){//代金券
goto = '/couponManage/editCashCoupon/'
}else if(row.discountType == '7'){//会员服务
goto = '/couponManage/editMemberService/'
}
console.log(goto + addOrEdit + '/' + row.id);
this.$router.push(goto + addOrEdit + '/' + row.id)
},
handleShare(row) {
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleSearch() {
this.$refs.coupon.refreshTable()
},
handleReset() {
this.searchForm = {
activityName: '',
activityStatus: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!