|
|
@@ -334,9 +334,9 @@
|
|
|
initialValue:
|
|
|
detail.start_time && detail.end_time
|
|
|
? [
|
|
|
- moment(detail.start_time, 'YYYY-MM-DD HH:mm:ss'),
|
|
|
- moment(detail.end_time, 'YYYY-MM-DD HH:mm:ss'),
|
|
|
- ]
|
|
|
+ moment(detail.start_time, 'YYYY-MM-DD HH:mm:ss'),
|
|
|
+ moment(detail.end_time, 'YYYY-MM-DD HH:mm:ss'),
|
|
|
+ ]
|
|
|
: null,
|
|
|
rules: [{ required: true, message: '请选择券领取时间' }],
|
|
|
},
|
|
|
@@ -363,7 +363,7 @@
|
|
|
<a-radio :value="10">所有用户</a-radio>
|
|
|
<a-radio :value="20">
|
|
|
新用户
|
|
|
- <span class="radioBotTool">(指未在五常大米小程序下过单的用户)</span>
|
|
|
+ <span class="radioBotTool">(指未在公明腊肠小程序下过单的用户)</span>
|
|
|
</a-radio>
|
|
|
</a-radio-group>
|
|
|
</a-form-item>
|
|
|
@@ -404,31 +404,31 @@ const goodsColumns = [
|
|
|
{
|
|
|
title: '商品ID',
|
|
|
width: '80px',
|
|
|
- dataIndex: 'goods_id',
|
|
|
+ dataIndex: 'goods_id'
|
|
|
},
|
|
|
{
|
|
|
title: '商品编码',
|
|
|
width: '150px',
|
|
|
- dataIndex: 'goods_no',
|
|
|
+ dataIndex: 'goods_no'
|
|
|
},
|
|
|
{
|
|
|
title: '商品名称',
|
|
|
width: '300px',
|
|
|
ellipsis: true,
|
|
|
- dataIndex: 'goods_name',
|
|
|
+ dataIndex: 'goods_name'
|
|
|
},
|
|
|
{
|
|
|
title: '售价',
|
|
|
width: '150px',
|
|
|
dataIndex: 'goods_price',
|
|
|
- scopedSlots: { customRender: 'goods_price' },
|
|
|
+ scopedSlots: { customRender: 'goods_price' }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
width: '100px',
|
|
|
dataIndex: 'action',
|
|
|
- scopedSlots: { customRender: 'action' },
|
|
|
- },
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
]
|
|
|
|
|
|
export default {
|
|
|
@@ -436,25 +436,25 @@ export default {
|
|
|
SelectImage,
|
|
|
InputNumberGroup,
|
|
|
SelectRegion,
|
|
|
- SettingGoods,
|
|
|
+ SettingGoods
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
- couponId: '', //优惠卷id
|
|
|
- couponType: 20, //优惠卷类型 ->10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
- validTimeType: 20, //有效期类型 -> 10顺延日期 20指定日期
|
|
|
- couponNumberType: 10, //发券数量限制类型 -> 10总量 20不限数量
|
|
|
- receiveNumberType: 10, //领取数量限制 ->10每人限领 20每人每天限制领取
|
|
|
+ couponId: '', // 优惠卷id
|
|
|
+ couponType: 20, // 优惠卷类型 ->10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
+ validTimeType: 20, // 有效期类型 -> 10顺延日期 20指定日期
|
|
|
+ couponNumberType: 10, // 发券数量限制类型 -> 10总量 20不限数量
|
|
|
+ receiveNumberType: 10, // 领取数量限制 ->10每人限领 20每人每天限制领取
|
|
|
receive_type: 10, // 券领取方式 =>10 线上发券 20 使用兑换码领取
|
|
|
- receiveVlaue: 1, //券领取方式 => 使用兑换码领取的 限制值
|
|
|
- send_type: 10, //券发放对象 => 10所有用户 20新用户 (指未在五常大米小程序下过单的用户)
|
|
|
- is_show_position: 1, //1默认公开发券,2不在领券中心,3:不在商品详情页,4:定向发放券
|
|
|
- goodsData: [], //除外商品列表
|
|
|
+ receiveVlaue: 1, // 券领取方式 => 使用兑换码领取的 限制值
|
|
|
+ send_type: 10, // 券发放对象 => 10所有用户 20新用户 (指未在公明腊肠小程序下过单的用户)
|
|
|
+ is_show_position: 1, // 1默认公开发券,2不在领券中心,3:不在商品详情页,4:定向发放券
|
|
|
+ goodsData: [], // 除外商品列表
|
|
|
activity_type: 0, // 是否关联活动
|
|
|
plainOptions: [{ label: '分销员商品折扣', value: '1' }],
|
|
|
checkboxValue: ['1'],
|
|
|
goodsColumns,
|
|
|
- detail: {}, //卷详情
|
|
|
+ detail: {}, // 卷详情
|
|
|
editState: null,
|
|
|
// 标签布局属性
|
|
|
labelCol: { span: 3 },
|
|
|
@@ -465,17 +465,17 @@ export default {
|
|
|
isBtnLoading: false,
|
|
|
// 当前表单元素
|
|
|
form: this.$form.createForm(this),
|
|
|
- startTime: '', //领取时间段 开始时间
|
|
|
- endTime: '', //领取时间段 结束时间,
|
|
|
+ startTime: '', // 领取时间段 开始时间
|
|
|
+ endTime: '', // 领取时间段 结束时间,
|
|
|
role: '',
|
|
|
- isSuper: 1,
|
|
|
+ isSuper: 1
|
|
|
}
|
|
|
},
|
|
|
// 初始化数据
|
|
|
- created() {
|
|
|
+ created () {
|
|
|
if (this.$store.getters.roles) {
|
|
|
this.isSuper = this.$store.getters.roles.isSuper
|
|
|
- let permissions = this.$store.getters.roles.permissions
|
|
|
+ const permissions = this.$store.getters.roles.permissions
|
|
|
permissions.forEach((item) => {
|
|
|
if (item.permissionId == '/marketingCenter/manage' && item.actionEntitySet && item.actionEntitySet.length > 0) {
|
|
|
this.role = item.actionEntitySet[0].action
|
|
|
@@ -483,8 +483,8 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
this.couponId = this.$route.query.id || ''
|
|
|
- //editState && editState == 1 来源编辑 editState ==2 来源复制
|
|
|
- let editState = this.$route.query.editState || null
|
|
|
+ // editState && editState == 1 来源编辑 editState ==2 来源复制
|
|
|
+ const editState = this.$route.query.editState || null
|
|
|
if (editState && (editState == 1 || editState == 2)) {
|
|
|
this.getCouponDetail()
|
|
|
this.editState = editState
|
|
|
@@ -498,8 +498,8 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
moment,
|
|
|
- //领劵方式切换回调
|
|
|
- changeReceiveType(e) {
|
|
|
+ // 领劵方式切换回调
|
|
|
+ changeReceiveType (e) {
|
|
|
this.receive_type = e.target.value
|
|
|
if (e.target.value == 20) {
|
|
|
this.start_time = ''
|
|
|
@@ -507,7 +507,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 切换关联活动
|
|
|
- changeActiveType(value) {
|
|
|
+ changeActiveType (value) {
|
|
|
this.activity_type = value
|
|
|
if (value == 1) {
|
|
|
this.start_time = ''
|
|
|
@@ -516,12 +516,12 @@ export default {
|
|
|
this.receive_type = 10
|
|
|
}
|
|
|
},
|
|
|
- //获取优惠卷详情
|
|
|
- getCouponDetail() {
|
|
|
+ // 获取优惠卷详情
|
|
|
+ getCouponDetail () {
|
|
|
this.isLoading = true
|
|
|
Api.detail({ coupon_id: this.couponId })
|
|
|
.then((result) => {
|
|
|
- let { detail } = result.data || {}
|
|
|
+ const { detail } = result.data || {}
|
|
|
this.detail = detail
|
|
|
this.goodsData = detail.goodsExcept || []
|
|
|
this.couponType = detail.coupon_type || 10
|
|
|
@@ -540,22 +540,22 @@ export default {
|
|
|
this.isLoading = false
|
|
|
})
|
|
|
},
|
|
|
- //有效期类型切换回调
|
|
|
- changeEadio(e) {
|
|
|
- let value = e.target.value
|
|
|
+ // 有效期类型切换回调
|
|
|
+ changeEadio (e) {
|
|
|
+ const value = e.target.value
|
|
|
this.validTimeType = value
|
|
|
},
|
|
|
// 设置除外商品
|
|
|
- showSettingGoods() {
|
|
|
+ showSettingGoods () {
|
|
|
if (this.goodsData) {
|
|
|
this.$refs.SettingGoods.open(this.goodsData)
|
|
|
} else {
|
|
|
this.$refs.SettingGoods.open()
|
|
|
}
|
|
|
},
|
|
|
- //除外商品选择回调
|
|
|
- handleSettingGoods() {
|
|
|
- let selectList = storage.get('selectList')
|
|
|
+ // 除外商品选择回调
|
|
|
+ handleSettingGoods () {
|
|
|
+ const selectList = storage.get('selectList')
|
|
|
const { goodsCount, goodsData } = this
|
|
|
selectList.forEach((item) => {
|
|
|
this.goodsData.push({
|
|
|
@@ -563,50 +563,50 @@ export default {
|
|
|
goods_id: item.goods_id,
|
|
|
goods_name: item.goods_name,
|
|
|
goods_price: item.goods_price,
|
|
|
- goods_no: item.goods_no,
|
|
|
+ goods_no: item.goods_no
|
|
|
})
|
|
|
})
|
|
|
this.goodsCount = goodsCount + 1
|
|
|
},
|
|
|
- //删除除外商品
|
|
|
- deleteGoods(index) {
|
|
|
+ // 删除除外商品
|
|
|
+ deleteGoods (index) {
|
|
|
const app = this
|
|
|
const modal = this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '确认删除吗?',
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- onOk() {
|
|
|
+ onOk () {
|
|
|
app.goodsData.splice(index, 1)
|
|
|
- },
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- timeFormate(timeStamp) {
|
|
|
- let year = new Date(timeStamp).getFullYear()
|
|
|
- let month =
|
|
|
+ timeFormate (timeStamp) {
|
|
|
+ const year = new Date(timeStamp).getFullYear()
|
|
|
+ const month =
|
|
|
new Date(timeStamp).getMonth() + 1 < 10
|
|
|
? '0' + (new Date(timeStamp).getMonth() + 1)
|
|
|
: new Date(timeStamp).getMonth() + 1
|
|
|
- let date =
|
|
|
+ const date =
|
|
|
new Date(timeStamp).getDate() < 10 ? '0' + new Date(timeStamp).getDate() : new Date(timeStamp).getDate()
|
|
|
- let hh =
|
|
|
+ const hh =
|
|
|
new Date(timeStamp).getHours() < 10 ? '0' + new Date(timeStamp).getHours() : new Date(timeStamp).getHours()
|
|
|
- let mm =
|
|
|
+ const mm =
|
|
|
new Date(timeStamp).getMinutes() < 10
|
|
|
? '0' + new Date(timeStamp).getMinutes()
|
|
|
: new Date(timeStamp).getMinutes()
|
|
|
- let ss =
|
|
|
+ const ss =
|
|
|
new Date(timeStamp).getSeconds() < 10
|
|
|
? '0' + new Date(timeStamp).getSeconds()
|
|
|
: new Date(timeStamp).getSeconds()
|
|
|
return year + '-' + month + '-' + date + ' ' + hh + ':' + mm + ':' + ss
|
|
|
},
|
|
|
// 提交审核
|
|
|
- handleSubmit(e) {
|
|
|
+ handleSubmit (e) {
|
|
|
e.preventDefault()
|
|
|
// 表单验证
|
|
|
const {
|
|
|
- form: { validateFields },
|
|
|
+ form: { validateFields }
|
|
|
} = this
|
|
|
|
|
|
validateFields((errors, values) => {
|
|
|
@@ -651,14 +651,14 @@ export default {
|
|
|
startTime = ''
|
|
|
endTime = ''
|
|
|
}
|
|
|
- let formData = {
|
|
|
- name: values.couponName, //标题
|
|
|
- subtitle: values.couponSubTitle, //副标题
|
|
|
- describe: values.couponExplain, //优惠券说明
|
|
|
- coupon_type: values.couponType, //10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
- expire_type: values.validTimeType, //有效期类型 -> 10顺延日期 20指定日期
|
|
|
- start_time: this.timeFormate(values.collectionTime[0]), //券领取开始时间
|
|
|
- end_time: this.timeFormate(values.collectionTime[1]), //券领结束时间
|
|
|
+ const formData = {
|
|
|
+ name: values.couponName, // 标题
|
|
|
+ subtitle: values.couponSubTitle, // 副标题
|
|
|
+ describe: values.couponExplain, // 优惠券说明
|
|
|
+ coupon_type: values.couponType, // 10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
+ expire_type: values.validTimeType, // 有效期类型 -> 10顺延日期 20指定日期
|
|
|
+ start_time: this.timeFormate(values.collectionTime[0]), // 券领取开始时间
|
|
|
+ end_time: this.timeFormate(values.collectionTime[1]), // 券领结束时间
|
|
|
receive_type: this.receive_type, // 券领取方式
|
|
|
send_type: values.send_type, // 券发放对象,
|
|
|
is_show_position: values.is_show_position, // 公开券发,
|
|
|
@@ -666,16 +666,16 @@ export default {
|
|
|
end_hour: endTime, // 结束时间段
|
|
|
limit_receive_type: this.receiveNumberType,
|
|
|
activity_type: values.activity_type || 0,
|
|
|
- overlay_discount: this.checkboxValue, // 是否有叠加优惠
|
|
|
+ overlay_discount: this.checkboxValue // 是否有叠加优惠
|
|
|
}
|
|
|
- //优惠卷类型 ->10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
+ // 优惠卷类型 ->10 立减券 20 满减券 30 首单券 40 新人券
|
|
|
if (values.couponType == 20) {
|
|
|
if (Number(values.achieveMoney) < Number(values.reduceMoney)) {
|
|
|
this.$message.error('满减金额需大于可减金额', 1.5)
|
|
|
return
|
|
|
}
|
|
|
- formData.min_price = values.achieveMoney //实付满x元
|
|
|
- formData.reduce_price = values.reduceMoney //可减x元
|
|
|
+ formData.min_price = values.achieveMoney // 实付满x元
|
|
|
+ formData.reduce_price = values.reduceMoney // 可减x元
|
|
|
}
|
|
|
// 有效期类型 -> 10顺延日期 20指定日期
|
|
|
if (values.validTimeType == 10) {
|
|
|
@@ -683,17 +683,17 @@ export default {
|
|
|
this.$message.error('使用有效期最少是1天', 1.5)
|
|
|
return
|
|
|
}
|
|
|
- formData.expire_day = values.validTimeDay //领取后N天失效
|
|
|
+ formData.expire_day = values.validTimeDay // 领取后N天失效
|
|
|
}
|
|
|
// 有效期类型 -> 10顺延日期 20指定日期
|
|
|
if (values.validTimeType == 20) {
|
|
|
- formData.expire_time = this.timeFormate(values.validTime) //固定时间失效
|
|
|
+ formData.expire_time = this.timeFormate(values.validTime) // 固定时间失效
|
|
|
}
|
|
|
- //发券数量限制类型 -> 10总量 20不限数量
|
|
|
+ // 发券数量限制类型 -> 10总量 20不限数量
|
|
|
if (values.couponNumberType == 10) {
|
|
|
- let number = Number(values.couponTotalNumber),
|
|
|
- bodyN = Number(values.everyBodyNumber),
|
|
|
- dayN = Number(values.everyDayNumber)
|
|
|
+ const number = Number(values.couponTotalNumber)
|
|
|
+ const bodyN = Number(values.everyBodyNumber)
|
|
|
+ const dayN = Number(values.everyDayNumber)
|
|
|
if (number == 0) {
|
|
|
this.$message.error('发券总量需大于0', 1.5)
|
|
|
return
|
|
|
@@ -703,47 +703,47 @@ export default {
|
|
|
this.$message.error('发券数量需大于领取数量', 1.5)
|
|
|
return
|
|
|
}
|
|
|
- formData.total_num = values.couponTotalNumber //券总数
|
|
|
+ formData.total_num = values.couponTotalNumber // 券总数
|
|
|
formData.limit_total_type = 10
|
|
|
}
|
|
|
if (values.couponNumberType == 20) {
|
|
|
formData.limit_total_type = 20
|
|
|
}
|
|
|
- //领取数量限制 ->10每人限领
|
|
|
+ // 领取数量限制 ->10每人限领
|
|
|
if (this.receiveNumberType == 10) {
|
|
|
// 券领取方式 20=>使用兑换码领取
|
|
|
if (values.receive_type == 20) {
|
|
|
- formData.limit_receive_cnt = this.receiveVlaue || 1 //用户限领张数 固定1张
|
|
|
+ formData.limit_receive_cnt = this.receiveVlaue || 1 // 用户限领张数 固定1张
|
|
|
} else {
|
|
|
- formData.limit_receive_cnt = values.everyBodyNumber //用户限领张数
|
|
|
+ formData.limit_receive_cnt = values.everyBodyNumber // 用户限领张数
|
|
|
}
|
|
|
}
|
|
|
// 每人每天
|
|
|
if (this.receiveNumberType == 20) {
|
|
|
// 券领取方式 20=>使用兑换码领取
|
|
|
if (values.receive_type == 20) {
|
|
|
- formData.limit_receive_cnt = this.receiveVlaue || 1 //用户限领张数 固定1张
|
|
|
+ formData.limit_receive_cnt = this.receiveVlaue || 1 // 用户限领张数 固定1张
|
|
|
} else {
|
|
|
- formData.limit_receive_cnt = values.everyDayNumber //用户每人每天限领张数
|
|
|
+ formData.limit_receive_cnt = values.everyDayNumber // 用户每人每天限领张数
|
|
|
}
|
|
|
}
|
|
|
- let coupon_goods_expect = []
|
|
|
+ const coupon_goods_expect = []
|
|
|
this.goodsData.forEach((item) => {
|
|
|
coupon_goods_expect.push({
|
|
|
goods_id: item.goods_id,
|
|
|
- goods_sku_id: item.goods_sku_id,
|
|
|
+ goods_sku_id: item.goods_sku_id
|
|
|
})
|
|
|
})
|
|
|
- formData.coupon_goods_expect = coupon_goods_expect //除外商品
|
|
|
- formData.role = this.role == 'coupon-zg-audit' ? 1 : 2 //1:主管,2:专员
|
|
|
+ formData.coupon_goods_expect = coupon_goods_expect // 除外商品
|
|
|
+ formData.role = this.role == 'coupon-zg-audit' ? 1 : 2 // 1:主管,2:专员
|
|
|
if (this.editState) {
|
|
|
- //编辑优惠卷提交
|
|
|
+ // 编辑优惠卷提交
|
|
|
if (this.editState == 1) {
|
|
|
- formData.coupon_id = this.couponId //优惠卷id
|
|
|
+ formData.coupon_id = this.couponId // 优惠卷id
|
|
|
this.updateCoupon(formData)
|
|
|
return true
|
|
|
}
|
|
|
- //复制优惠卷提交
|
|
|
+ // 复制优惠卷提交
|
|
|
if (this.editState == 2) {
|
|
|
this.addCoupon(formData)
|
|
|
return true
|
|
|
@@ -756,7 +756,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 新建优惠卷
|
|
|
- addCoupon(formData) {
|
|
|
+ addCoupon (formData) {
|
|
|
this.isLoading = true
|
|
|
this.isBtnLoading = true
|
|
|
Api.add({ form: formData })
|
|
|
@@ -776,7 +776,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 编辑优惠卷
|
|
|
- updateCoupon(formData) {
|
|
|
+ updateCoupon (formData) {
|
|
|
this.isLoading = true
|
|
|
this.isBtnLoading = true
|
|
|
Api.update({ form: formData })
|
|
|
@@ -796,23 +796,23 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 关闭
|
|
|
- close() {
|
|
|
+ close () {
|
|
|
this.$router.go(-1)
|
|
|
},
|
|
|
- disabledDate(current) {
|
|
|
+ disabledDate (current) {
|
|
|
return current && current < moment().subtract(1, 'days')
|
|
|
},
|
|
|
- changeType(e) {
|
|
|
+ changeType (e) {
|
|
|
this.couponNumberType = e.target.value
|
|
|
},
|
|
|
- changeLimit(e) {
|
|
|
+ changeLimit (e) {
|
|
|
this.receiveNumberType = e.target.value
|
|
|
},
|
|
|
// 是否允许叠加其他优惠
|
|
|
- onChange(checkedValues) {
|
|
|
+ onChange (checkedValues) {
|
|
|
this.checkboxValue = checkedValues
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|