Commit 7bbfe36f by 胡悦

Merge branch 'v1.2.0' of http://192.168.3.233:8090/saas/scrm-micro-marketing into v1.2.0

2 parents e3996bb2 62a7019e
...@@ -53,5 +53,48 @@ const getGiftInfoApi = params => { ...@@ -53,5 +53,48 @@ const getGiftInfoApi = params => {
returnAll: true returnAll: true
}) })
} }
// 根据条件获取已领取定向礼包列表
const getReceivedGiftInfoApi = params => {
params.method = 'scrm.api.coupon.user.saas.directional.gift.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
// returnAll: true
})
}
// 导出已领取礼包
const exportGiftInfoApi = params => {
params.method = 'scrm.api.coupon.user.saas.directional.gift.list.export'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
})
}
// 编辑-选择定向礼包列表
const getDirectionalGiftListApi = params => {
params.method = 'scrm.api.coupon.directional.gift.coupon.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
const insertGiftApi = params => {
params.method = 'scrm.api.coupon.directional.gift.create'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi } export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi }
...@@ -12,7 +12,6 @@ let cfg = require('./conf.js') ...@@ -12,7 +12,6 @@ let cfg = require('./conf.js')
import { Http } from 'glsx-common' import { Http } from 'glsx-common'
let timeout = 30000 //超时时间 let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) { export const fetchConfig = function (isEnv = true) {
// console.log(1111111)
// if (isEnv) { // if (isEnv) {
// let { request } = cfg // let { request } = cfg
// Object.assign(request, { timeout }) // Object.assign(request, { timeout })
......
...@@ -610,7 +610,7 @@ export default { ...@@ -610,7 +610,7 @@ export default {
//是否定制礼包专用 //是否定制礼包专用
obj.directionalFlag = form.directionalFlag obj.directionalFlag = form.directionalFlag
//预估成本 //预估成本
obj.anticipatedCost = form.anticipatedCost * 100 // obj.anticipatedCost = form.anticipatedCost * 100
//面值 //面值
obj.denomination = form.denomination obj.denomination = form.denomination
//库存 //库存
...@@ -634,6 +634,8 @@ export default { ...@@ -634,6 +634,8 @@ export default {
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj return obj
}, },
......
...@@ -299,8 +299,6 @@ export default { ...@@ -299,8 +299,6 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2' obj.discountType = '2'
obj.directionalFlag = '1' obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
...@@ -325,6 +323,8 @@ export default { ...@@ -325,6 +323,8 @@ export default {
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj return obj
}, },
......
...@@ -277,8 +277,6 @@ export default { ...@@ -277,8 +277,6 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务 //优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4' obj.discountType = '4'
obj.directionalFlag = '1' obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期 //有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期 //有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType obj.effectiveType = form.effectiveType
...@@ -303,6 +301,8 @@ export default { ...@@ -303,6 +301,8 @@ export default {
} }
//使用描述 //使用描述
obj.useDescription = form.useDescription obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj return obj
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="gift-content"> <div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex"> <div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span> <span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p> <p :class="['gift-coupon-name', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p> <p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
<i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i> <i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i>
</div> </div>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
</div> </div>
</div> </div>
<div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '0' ? '手机号' : '车架号后6位' }}才能成功领取</div> <div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '1' ? '手机号' : '车架号后6位' }}才能成功领取</div>
<el-button slot="selectStaffBtn" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button> <el-button slot="selectStaffBtn" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button>
<div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0"> <div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper"> <div :key="key" class="el-input-tag input-tag-wrapper">
...@@ -42,23 +42,23 @@ ...@@ -42,23 +42,23 @@
<el-button type="default" @click="handleCancel">取消</el-button> <el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
</div> </div>
<select-gift-dialog></select-gift-dialog> <select-gift-dialog v-if="isSelectGiftVisible" :isSelectGiftVisible="isSelectGiftVisible" :selectedGiftList="selectedGiftList" @handleGiftConfirm="handleGiftConfirm" @handleGiftClose="handleGiftClose"></select-gift-dialog>
<select-staff-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchStaffForm" :selectedStaffList="selectedStaffList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-staff-dialog> <select-staff-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchStaffForm" :selectedStaffList="selectedStaffList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-staff-dialog>
</div> </div>
</template> </template>
<script> <script>
import selectStaffDialog from './selectStaffDialog.vue' import selectStaffDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectStaffDialog.vue' import selectGiftDialog from './selectGiftDialog.vue'
export default { export default {
name: 'editGift', name: 'editGift',
data() { data() {
return { return {
size: 'small', size: 'small',
title: '新增信息', title: '新增礼包',
titleObj: { titleObj: {
add: '新增信息', add: '新增礼包',
edit: '编辑信息' edit: '编辑礼包'
}, },
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
...@@ -66,6 +66,9 @@ export default { ...@@ -66,6 +66,9 @@ export default {
isMutiSelectVisible: false, isMutiSelectVisible: false,
searchStaffForm: {}, searchStaffForm: {},
selectedStaffList: [], selectedStaffList: [],
// 选择定向礼包弹窗
isSelectGiftVisible: false,
selectedGiftList: [],
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
routeInfo: { routeInfo: {
// add-新增;edit-编辑;detail-详情 // add-新增;edit-编辑;detail-详情
...@@ -77,30 +80,31 @@ export default { ...@@ -77,30 +80,31 @@ export default {
editForm: { editForm: {
name: '', name: '',
remarkName: '', remarkName: '',
receiveWay: '0', receiveWay: '1',
receiveDetails: '', receiveDetails: '',
staffList: [], staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务 // 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效 // 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [{ couponList: []
discountType: 3, // couponList: [{
couponName: '测试有效期查询券2', // discountType: 3,
couponAmount: '1', // couponName: '测试有效期查询券2',
couponAnticipatedCost: '10', // couponAmount: '1',
status: '2' // couponAnticipatedCost: '10',
}, { // status: '2'
discountType: 3, // }, {
couponName: '7折代金券', // discountType: 3,
couponAmount: '1', // couponName: '7折代金券',
couponAnticipatedCost: '20', // couponAmount: '1',
status: '3' // couponAnticipatedCost: '20',
}, { // status: '3'
discountType: 3, // }, {
couponName: '9.9折代金券', // discountType: 3,
couponAmount: '5', // couponName: '9.9折代金券',
couponAnticipatedCost: '15', // couponAmount: '5',
status: '2' // couponAnticipatedCost: '15',
}] // status: '2'
// }]
}, },
totalEstimatedCost: '', totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'], orderShow: ['service', 'cash', 'discount', 'exchange'],
...@@ -148,7 +152,7 @@ export default { ...@@ -148,7 +152,7 @@ export default {
if (!value) { if (!value) {
return callback() return callback()
} }
if (this.editForm.receiveWay == '0') { if (this.editForm.receiveWay == '1') {
let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/ let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号')) return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号'))
} else { } else {
...@@ -194,11 +198,11 @@ export default { ...@@ -194,11 +198,11 @@ export default {
optionLabel: 'confName', optionLabel: 'confName',
optionList: [ optionList: [
{ {
confId: '0', confId: '1',
confName: '指定手机号' confName: '指定手机号'
}, },
{ {
confId: '1', confId: '2',
confName: '指定车架号后6位' confName: '指定车架号后6位'
} }
], ],
...@@ -236,27 +240,13 @@ export default { ...@@ -236,27 +240,13 @@ export default {
maxlength: 50, maxlength: 50,
width: '567px' width: '567px'
} }
// {
// label: '礼包图片',
// name: 'zoneImg',
// type: 'upload',
// limitSize: 10,
// maxPhotoNum: 1,
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
// }
// }
] ]
} }
}, },
components: { components: {
selectStaffDialog selectStaffDialog,
selectGiftDialog
}, },
watch: { watch: {
...@@ -278,16 +268,25 @@ export default { ...@@ -278,16 +268,25 @@ export default {
methods: { methods: {
getInfo() { getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.giftBag
this.editForm = res.data .getGiftInfoApi({ id: this.routeInfo.id })
this.editForm.receiveWay = this.editForm.receiveWay + '' .then(res => {
this.recoveryCoupon() res.data.couponList.forEach(item => {
this.recoveryTotalPrice() item.id = item.couponId
this.$nextTick(() => { item.anticipatedCost = item.couponAnticipatedCost
this.editStatus = false })
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
this.recoveryTotalPrice()
this.hasStaffBlock(false)
this.$nextTick(() => {
this.editStatus = false
})
})
.finally(() => {
this.loading = false this.loading = false
}) })
})
}, },
recoveryCoupon() { recoveryCoupon() {
...@@ -297,33 +296,58 @@ export default { ...@@ -297,33 +296,58 @@ export default {
this.editForm.couponList.forEach(item => { this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item) this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
}) })
// console.log(this.couponObj)
}, },
receiveWayChange(val) { receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails') var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位' this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6 this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
}, },
// 计算预估成本 // 计算预估成本
recoveryTotalPrice() { recoveryTotalPrice() {
this.totalEstimatedCost = 0 this.totalEstimatedCost = 0
this.orderShow.forEach(itme => { this.orderShow.forEach(item => {
this.couponObj[itme].list.forEach(subItem => { this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本 // 失效券不加入预估成本
if (subItem.status != '3') { if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount this.totalEstimatedCost = this.totalEstimatedCost + parseInt(subItem.couponAnticipatedCost) * parseInt(subItem.couponAmount)
} }
}) })
}) })
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
// 礼包
recoveryGiftList() {
this.editForm.couponList = []
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(k => {
this.editForm.couponList.push(k)
})
})
},
handleGiftAdd() {
this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose()
}, },
handleGiftAdd() { }, handleGiftConfirm(selectedData) {
this.handleGiftClose()
this.couponObj = selectedData
this.recoveryTotalPrice()
this.recoveryGiftList()
},
handleGiftClose() {
this.isSelectGiftVisible = !this.isSelectGiftVisible
},
handleGiftDelete(attr, idx) { handleGiftDelete(attr, idx) {
this.couponObj[attr].list.splice(idx, 1) this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice() this.recoveryTotalPrice()
this.recoveryGiftList()
}, },
handleStaffRemove(val, idx) { handleStaffRemove(val, idx) {
...@@ -332,10 +356,10 @@ export default { ...@@ -332,10 +356,10 @@ export default {
this.key = new Date() this.key = new Date()
}, },
hasStaffBlock() { hasStaffBlock(isValidate = true) {
var idx = this.editFormData.findIndex(item => item.name == 'staffListBlock') var idx = this.editFormData.findIndex(item => item.name == 'staffListBlock')
this.editFormData[idx].isHide = !this.editForm.staffList.length this.editFormData[idx].isHide = !this.editForm.staffList.length
this.$refs.editFormRef.$refs[this.editChildRef].validateField('staffList') isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('staffList')
}, },
handleSelectStaff() { handleSelectStaff() {
...@@ -351,7 +375,7 @@ export default { ...@@ -351,7 +375,7 @@ export default {
this.editForm.staffList = [] this.editForm.staffList = []
selectedData.forEach(item => { selectedData.forEach(item => {
this.editForm.staffList.push({ this.editForm.staffList.push({
staffId: item.userOneId, staffUUID: item.userOneId,
staffName: item.staffName staffName: item.staffName
}) })
}) })
...@@ -363,28 +387,32 @@ export default { ...@@ -363,28 +387,32 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.$common.utils.deepClone(this.editForm) var params = this.$common.utils.deepClone(this.editForm)
params.staffCreateRequests = this.$common.utils.deepClone(params.staffList)
params.couponCreateRequests = this.$common.utils.deepClone(params.couponList)
params.couponCreateRequests.forEach(item => {
item.couponId = item.id
})
delete params.staffList
delete params.couponList
if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id
}
console.log(params) console.log(params)
// if (this.routeInfo.addOrEdit == 'edit') { this.loading = true
// params.id = this.routeInfo.id this.$apis.giftBag
// } .insertGiftApi(params)
// params.merchantList = [] .then(res => {
// this.editForm.merchantList.forEach(item => { this.$message({
// params.merchantList.push({ message: res.code == '0' ? '操作成功' : res.message,
// merchantId: item.merchantNo, type: res.code == '0' ? 'success' : 'error'
// merchantName: item.merchantName, })
// merchantAccountLevel: item.merchantAccountLevel if (res.code == '0') {
// }) this.cancelJump()
// }) }
// console.log(params) })
// this.$apis.zoneList.insertZoneApi(params).then(res => { .finally(() => {
// this.$message({ this.loading = false
// message: res.code == '0' ? '操作成功' : '操作失败', })
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
} }
}) })
}, },
...@@ -449,7 +477,7 @@ export default { ...@@ -449,7 +477,7 @@ export default {
.gift-item { .gift-item {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
.gift-info { .gift-coupon-name {
display: inline-block; display: inline-block;
margin: 0 5px 0 7px; margin: 0 5px 0 7px;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
</div> </div>
</div> </div>
<div slot="receiveDetails">{{ editForm.receiveWay == '0' ? '指定手机号' : '指定车架号后6位' }}:{{ editForm.receiveDetails }}</div> <div slot="receiveDetails">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:{{ editForm.receiveDetails }}</div>
<div slot="staffListBlock" class="sale-select" v-show="editForm.staffList && editForm.staffList.length != 0"> <div slot="staffListBlock" class="sale-select" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper-detail"> <div :key="key" class="el-input-tag input-tag-wrapper-detail">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :disable-transitions="false" @close="handleStaffRemove(tag, idx)"> <el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="default" @click="handleCancel">返回</el-button> <el-button type="default" @click="handleCancel">返回</el-button>
<el-button type="primary" @click="handleEdit">编辑</el-button> <el-button v-show="editForm.receivedFlag == 1" type="primary" @click="handleEdit">编辑</el-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -61,8 +61,9 @@ export default { ...@@ -61,8 +61,9 @@ export default {
editForm: { editForm: {
name: '', name: '',
remarkName: '', remarkName: '',
receiveWay: '0', receiveWay: '1',
receiveDetails: '', receiveDetails: '',
receivedFlag: 2,
staffList: [], staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务 // 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效 // 优惠券状态(status):1:未生效,2:生效中,3:已失效
...@@ -155,14 +156,16 @@ export default { ...@@ -155,14 +156,16 @@ export default {
methods: { methods: {
getInfo() { getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => { this.$apis.giftBag
this.editForm = res.data .getGiftInfoApi({ id: this.routeInfo.id })
this.recoveryCoupon() .then(res => {
this.recoveryTotalPrice() this.editForm = res.data
this.$nextTick(() => { this.recoveryCoupon()
this.recoveryTotalPrice()
})
.finally(() => {
this.loading = false this.loading = false
}) })
})
}, },
recoveryCoupon() { recoveryCoupon() {
...@@ -176,8 +179,8 @@ export default { ...@@ -176,8 +179,8 @@ export default {
receiveWayChange(val) { receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails') var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位' this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6 this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
}, },
// 计算预估成本 // 计算预估成本
...@@ -197,7 +200,7 @@ export default { ...@@ -197,7 +200,7 @@ export default {
handleEdit() { handleEdit() {
var params = { var params = {
addOrEdit: 'edit', addOrEdit: 'edit',
$title: encodeURI('编辑信息') $title: encodeURI('编辑礼包')
} }
params.id = this.routeInfo.id params.id = this.routeInfo.id
this.$router.push({ this.$router.push({
......
...@@ -29,15 +29,20 @@ ...@@ -29,15 +29,20 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"> <GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope"> <div slot="giftInfo" slot-scope="scope">
<div>礼包明细</div> <div class="p-b-12">礼包明细</div>
<div>{{ scope.scope }}</div> <div class="gift-detail flex-default">
<div class="gift-item" v-for="(item, index) in scope.scope.couponList" :key="index">
<p :class="['gift-coupon-name', item.status == '3' ? ' txt-grey' : '']">{{ item.couponName }} × {{ item.couponAmount }}</p>
<p v-show="item.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div> </div>
<div slot="name" slot-scope="scope"> <div slot="name" slot-scope="scope">
<el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button> <el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button>
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> <!-- <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> -->
<!-- <GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton> --> <GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton>
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
...@@ -56,8 +61,8 @@ export default { ...@@ -56,8 +61,8 @@ export default {
size: 'small', size: 'small',
url: url, url: url,
searchForm: { searchForm: {
orderCode: '', name: '',
commentStatus: '', staffName: '',
createDate: [] createDate: []
}, },
tableSearchForm: {}, tableSearchForm: {},
...@@ -131,7 +136,10 @@ export default { ...@@ -131,7 +136,10 @@ export default {
}, },
{ {
label: '赠送原因', label: '赠送原因',
prop: 'giveReason' prop: 'giveReason',
formatter: cellValue => {
return cellValue.giveReason || '-'
}
}, },
{ {
label: '创建时间', label: '创建时间',
...@@ -228,7 +236,7 @@ export default { ...@@ -228,7 +236,7 @@ export default {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id) // addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = { var params = {
addOrEdit: addOrEdit, addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息') $title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
} }
addOrEdit != 'add' && (params.id = row.id) addOrEdit != 'add' && (params.id = row.id)
this.$router.push({ this.$router.push({
...@@ -278,8 +286,8 @@ export default { ...@@ -278,8 +286,8 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
orderCode: '', name: '',
commentStatus: '', staffName: '',
createDate: [] createDate: []
} }
this.handleSearch() this.handleSearch()
...@@ -288,4 +296,27 @@ export default { ...@@ -288,4 +296,27 @@ export default {
} }
</script> </script>
<style scoped></style> <style lang="scss">
.p-b-12 {
margin-bottom: 14px;
}
.gift-detail .gift-item {
margin-right: 80px;
.gift-coupon-name {
display: inline-block;
margin-right: 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-detail .gift-item:last-child {
margin-right: 0;
}
</style>
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<div class="gift-bag"> <div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="定向礼包" name="giftList"> <el-tab-pane label="定向礼包" name="giftList">
<gift-list></gift-list> <gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList"> <el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList></receivedGiftList> <receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
......
...@@ -18,11 +18,15 @@ ...@@ -18,11 +18,15 @@
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"> <GLTable ref="receivedGiftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<span slot="nickName" slot-scope="scope">
<el-button type="text" @click="customerDetail(scope.scope)">{{ scope.scope.nickName }}</el-button>
</span>
<span slot="directionalGiftName" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">{{ scope.scope.directionalGiftName }}</el-button>
</span>
<div slot="giftInfo" slot-scope="scope"> <div slot="giftInfo" slot-scope="scope">
<div>礼包明细</div> <GLTable ref="giftListRef" :hasNum="false" :hasPage="false" :noDataImg="url" :tableParams="giftParams" :tableData="scope.scope | filterTable" @setTableFinishFun="setGiftTableFinishFun"></GLTable>
<div>{{ scope.scope }}</div>
<GLTable ref="giftListRef" :getListApi="getGiftListApi" :hasNum="false" :noDataImg="url" :searchForm="giftSearchForm" :tableParams="giftParams" :pageConf="giftPageConf"></GLTable>
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
...@@ -33,16 +37,39 @@ ...@@ -33,16 +37,39 @@
<script> <script>
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
export default { export default {
name: 'giftList', name: 'giftList',
filters: {
filterTable(list) {
// console.log(params)
// return
let arr1 = list.couponList
let arr2 = list.verificationCouponList
let reduceArr = arr1.map(item => {
// item.numBer = ''
arr2.map(ele => {
if (item.couponId == ele.couponId) {
item.numBer = item.couponAmount - ele.couponAmount
item.delet = ele.couponAmount
// item.couponAmount = ele.couponAmount
}
})
return item
})
console.log(reduceArr)
return reduceArr
}
},
data() { data() {
return { return {
size: 'small', size: 'small',
url: url, url: url,
searchForm: { searchForm: {
whether: '', nickName: '',
orderCode: '', wechatUserFlag: '',
commentStatus: '', giftName: '',
staffName: '',
createDate: [] createDate: []
}, },
tableSearchForm: {}, tableSearchForm: {},
...@@ -50,33 +77,37 @@ export default { ...@@ -50,33 +77,37 @@ export default {
searchFormData: [ searchFormData: [
{ {
label: '领用客户', label: '领用客户',
name: 'customer', name: 'nickName',
type: 'input' type: 'input',
placeholder: '请输入客户名称或手机号'
}, },
{ {
label: '礼包名称', label: '礼包名称',
name: 'giftName', name: 'giftName',
type: 'input' type: 'input',
placeholder: '请输入礼包名称或备注名称'
}, },
{ {
label: '是否为企微客户', label: '是否为企微客户',
name: 'whether', name: 'wechatUserFlag',
type: 'select', type: 'select',
optionList: [], optionList: [],
optionId: 'Id', optionId: 'Id',
optionLabel: 'Name', optionLabel: 'Name',
optionsName: 'List' optionsName: 'List',
placeholder: '请选择'
} }
], ],
searchFormData1: [ searchFormData1: [
{ {
label: '发放员工', label: '发放员工',
name: 'staff', name: 'staffName',
type: 'input' type: 'input',
placeholder: '请输入'
}, },
{ {
label: '领用日期', label: '领取用日期',
name: 'receiveDate', name: 'createDate',
type: 'datePicker', type: 'datePicker',
pickerOptions: 'beforeRangePickerOptions' pickerOptions: 'beforeRangePickerOptions'
} }
...@@ -93,8 +124,7 @@ export default { ...@@ -93,8 +124,7 @@ export default {
} }
] ]
}, },
//礼包表格 //礼包详情
getGiftListApi: this.$apis.orderComment.getListApi,
giftParams: { giftParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: false,
...@@ -105,31 +135,36 @@ export default { ...@@ -105,31 +135,36 @@ export default {
}, },
{ {
label: '礼包数量', label: '礼包数量',
name: 'discountType', name: 'couponAmount',
width: '100px', width: '100px',
formatter: cellValue => { formatter: cellValue => {
return 'X' + cellValue.numBer return 'X' + cellValue.couponAmount
} }
}, },
{ {
label: '已核销', label: '已核销',
prop: 'anticipatedCost ', prop: 'anticipatedCost ',
formatter: cellValue => { formatter: cellValue => {
return 'X' + cellValue.numBer if (cellValue.delet) {
return 'X' + cellValue.delet
}
} }
}, },
{ {
label: '可使用', label: '可使用',
prop: 'getAmount', prop: 'getAmount',
formatter: cellValue => { formatter: cellValue => {
return 'X' + cellValue.numBer if (cellValue.numBer) {
return 'X' + cellValue.numBer
} else {
return 'X' + cellValue.couponAmount
}
} }
} }
] ]
}, },
giftPageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, // 礼包
// 表格 getListApi: this.$apis.giftBag.getReceivedGiftInfoApi,
getListApi: this.$apis.orderComment.getListApi,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: false, tableOption: false,
...@@ -144,41 +179,55 @@ export default { ...@@ -144,41 +179,55 @@ export default {
}, },
{ {
label: '序号', label: '序号',
prop: 'idx' prop: 'idx',
width: '60'
}, },
{ {
label: '领取客户', label: '领取客户',
prop: 'orderCode' addHtml: 'nickName'
}, },
{ {
label: '是否为企微客户', label: '是否为企微客户',
prop: 'orderCode', prop: 'wechatUserFlag',
width: '200' width: '200',
formatter: cellValue => {
if (cellValue.wechatUserFlag == 1) {
return '否'
} else if (cellValue.wechatUserFlag == 2) {
return '是'
}
}
}, },
{ {
label: '礼包名称', label: '礼包名称',
prop: 'orderCode', width: '200',
width: '200' addHtml: 'directionalGiftName'
}, },
{ {
label: '备注名称', label: '礼包备注名称',
prop: 'orderCode', prop: 'directionalGiftRemarkName',
width: '200' width: '200'
}, },
// {
// label: '备注名称',
// prop: 'orderCode',
// width: '200'
// },
{ {
label: '预估成本/元', label: '预估成本/元',
prop: 'orderCode' prop: 'anticipatedCost'
}, },
{ {
label: '已核销成本', label: '已核销成本',
prop: 'orderCode' prop: 'verificationAnticipatedCos'
}, },
{ {
label: '发放员工', label: '发放员工',
prop: 'orderCode' prop: 'staffName'
}, },
{ {
label: '创建时间', label: '领取时间',
prop: 'createdDate', prop: 'createdDate',
width: '180', width: '180',
formatter: cellValue => { formatter: cellValue => {
...@@ -187,7 +236,7 @@ export default { ...@@ -187,7 +236,7 @@ export default {
} }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' } pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
} }
}, },
...@@ -196,11 +245,26 @@ export default { ...@@ -196,11 +245,26 @@ export default {
}, },
methods: { methods: {
//客户
customerDetail(row) {
this.$router.push({
path: '/custom/clientManage/clientDetail?id==' + row.accountId
})
},
// 查看
handleDetail(row) {
this.$router.push({
path: '/giftBag/giftDetail',
query: {
id: row.id
}
})
},
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) { if (this.searchForm.createDate.length) {
params.createStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59' params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
} }
delete params.createDate delete params.createDate
return params return params
...@@ -246,9 +310,9 @@ export default { ...@@ -246,9 +310,9 @@ export default {
handleExport() { handleExport() {
var params = this.getParams() var params = this.getParams()
// this.$apis.couponManage.couponExportApi(params).then(res => { this.$apis.giftBag.exportGiftInfoApi(params).then(res => {
// exportFn(res) aToExport(res)
// }) })
}, },
handleDelete(row) { handleDelete(row) {
...@@ -260,7 +324,7 @@ export default { ...@@ -260,7 +324,7 @@ export default {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id) // addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = { var params = {
addOrEdit: addOrEdit, addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息') $title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
} }
addOrEdit != 'add' && (params.id = row.id) addOrEdit != 'add' && (params.id = row.id)
this.$router.push({ this.$router.push({
...@@ -295,23 +359,31 @@ export default { ...@@ -295,23 +359,31 @@ export default {
} }
}, },
setTableFinishFun() { setTableFinishFun() {
var page = this.$refs.giftListRef.page var page = this.$refs.receivedGiftListRef.page
console.log(this.$refs.receivedGiftListRef, '1')
// 添加序号 // 添加序号
this.$refs.giftListRef.data.forEach((item, index) => { if (this.$refs.receivedGiftListRef.data) {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1 this.$refs.receivedGiftListRef.data.forEach((item, index) => {
}) item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
//接收到的数据为空 })
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
//接收到的数据为空
this.$refs.receivedGiftListRef.data.length ? (this.$refs.receivedGiftListRef.tableHeightValues = '') : this.$refs.receivedGiftListRef.setTableHeightFun()
}
},
setGiftTableFinishFun() {
console.log(this.$refs.giftListRef, '2')
},
handleSearch() { handleSearch() {
this.$refs.giftListRef.refreshTable() this.$refs.receivedGiftListRef.refreshTable()
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
orderCode: '', nickName: '',
commentStatus: '', wechatUserFlag: '',
giftName: '',
staffName: '',
createDate: [] createDate: []
} }
this.handleSearch() this.handleSearch()
......
<!-- 选择礼包弹窗 -->
<template> <template>
<div> <glsx-dialog class="muti-gift" title="选择礼包内容" :isVisible.sync="isSelectGiftVisible" width="70%" @confirmDialog="handleGiftConfirm" @closeDialog="handleGiftClose" v-loading="loading">
<!-- <div class="nogiftDiv" v-show="!giftList.length && fnCallBack">
</div> <img src="@/assets/noPro.png" />
<p class="nogiftP">系统暂无已创建的礼包</p>
</div> -->
<div class="flex-default">
<div class="gift-table flex-grow">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="门店服务" name="service"></el-tab-pane>
<el-tab-pane label="代金券" name="cash"></el-tab-pane>
<el-tab-pane label="折扣券" name="discount"></el-tab-pane>
<el-tab-pane label="兑换券" name="exchange"></el-tab-pane>
</el-tabs>
<div>
<glsx-combi-form class="p-16" style="padding-bottom: 0px;" ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<GLTable v-loading="loading" v-show="activeName == 'service'" ref="serviceRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toRestrictLabelText(scope.scope) }}</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'cash'" ref="cashRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toCashRestrictLabelText(scope.scope) }}</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'discount'" ref="discountRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType">
<span>-</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'exchange'" ref="exchangeRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList" @selectionTable="handleSelectionTable">
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType">
<span>-</span>
</span>
</GLTable>
</div>
</div>
<div class="selected-list">
<p class="list-title p-16">已选({{ selectedSum }})</p>
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="selectedGiftList[item].list.length">
<div class="gift-label">{{ selectedGiftList[item].label }}</div>
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in selectedGiftList[item].list" :key="subIndex">
<i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i>
<p :class="['gift-coupon-name', 'ellipsis-1', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }}</p>
<div class="gift-sum">
<el-input-number v-if="subItem.discountType == 7" :disabled="subItem.status == '3'" class="sum-input" v-model="subItem.couponAmount" @change="handleChange" :min="1" :max="10" size="mini" label="描述文字"></el-input-number>
<p :class="[subItem.status == '3' ? ' txt-grey' : '']" v-else>×{{ subItem.couponAmount }}</p>
</div>
<!-- <p v-show="subItem.status == '3'" class="gift-tips">已失效</p> -->
</div>
</div>
</div>
</div>
</div>
</div>
</glsx-dialog>
</template> </template>
<script> <script>
// import { getGoodsList } from '@/api/modules/common'
import url from '@/assets/empty.png'
import glsxDialog from '@/components/glsx-dialog'
export default { export default {
name: 'selectGiftDialog', name: 'selectGiftDialog',
data() { data() {
return { return {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
activeName: 'service',
userInfo: {},
giftList: [],
fnCallBack: false,
url: url,
loading: true,
selectedSum: 0,
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
// 搜索
searchForm: {
couponName: ''
},
searchFormData: [
{
label: '礼包名称',
name: 'couponName',
type: 'input',
maxlength: 30,
width: '415px',
placeholder: '请输入券/服务名称进行搜索',
isClear: true
}
],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '名称',
prop: 'couponName'
},
{
label: '预估成本/元',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '有效期',
prop: 'effectiveType',
addHtml: 'effectiveType'
},
{
label: '使用原则',
prop: 'useType',
addHtml: 'useType'
},
{
label: '剩余库存',
prop: 'residueAmount'
}
]
}
}
},
props: {
isSelectGiftVisible: {
type: Boolean,
default: false
},
selectedGiftList: {
type: Object,
default: () => {
return {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
}
}
} }
}, },
mounted() { components: {
glsxDialog
},
mounted() {
this.userInfo = this.$globalState.session
this.getList(true)
}, },
methods: { methods: {
getList(isReset = false) {
var params = {
...this.searchForm,
discountType: this.selectedGiftList[this.activeName].discountType,
pageNum: isReset ? 1 : this.$refs[this.activeName + 'Ref'].page.pageNum,
pageSize: isReset ? 10 : this.$refs[this.activeName + 'Ref'].page.pageSize
}
this.loading = true
this.$apis.giftBag
.getDirectionalGiftListApi(params)
.then(res => {
this.giftList = res.list
this.giftList.forEach(item => {
item.couponAnticipatedCost = item.anticipatedCost
})
this.fnCallBack = true
this.$refs[this.activeName + 'Ref'].tableTotal = res.total
this.recoverySelected()
this.recoveryTotal()
this.$refs[this.activeName + 'Ref'].tableHeightValues = '50vh'
})
.finally(() => {
this.loading = false
})
},
handleTabClick() {
this.getList(true)
},
handleSearch() {
this.getList(true)
},
toLabelText(row) {
switch (row.effectiveType) {
case 3:
return '无有效期'
case 2:
return row.effectiveStartTime ? row.effectiveStartTime.split(' ')[0] + '-' + row.effectiveEndTime.split(' ')[0] : ''
case 1:
return row.effectiveDays + '天'
}
},
toRestrictLabelText(row) {
switch (row.useType) {
case 0:
return '无限制'
case 1:
return '有效期内可使用' + row.useAmount + '次'
case 2:
return '每' + row.useLimitDays + '天可以使用' + row.useAmount + '次'
}
},
toCashRestrictLabelText(row) {
switch (row.useType) {
case 1:
return '无限制'
case 2:
return '订单满' + row.useAmount + '元可用'
}
},
recoverySelected() {
if (this.selectedGiftList[this.activeName].list && this.selectedGiftList[this.activeName].list.length) {
this.selectedGiftList[this.activeName].list.forEach(row => {
if (row.status != '3') {
this.$refs[this.activeName + 'Ref'].$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
}
})
}
},
handleGiftDelete(attr, idx) {
this.selectedGiftList[attr].list.splice(idx, 1)
this.recoveryTotal()
},
// 计算已选张数
recoveryTotal() {
this.selectedSum = 0
this.orderShow.forEach(itme => {
this.selectedGiftList[itme].list.forEach(subItem => {
this.selectedSum = this.selectedSum + parseInt(subItem.couponAmount)
})
})
},
// 选择/取消
handleSelectionTable(val) {
console.log(val)
var list = JSON.parse(JSON.stringify(this.selectedGiftList[this.activeName].list))
this.selectedGiftList[this.activeName].list = []
val.forEach(item => {
let isSelected = list.find(k => k.id == item.id)
if (this.selectedGiftList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
this.selectedGiftList[this.activeName].list.push({
id: item.id,
discountType: item.discountType,
couponName: item.couponName,
couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1',
couponAnticipatedCost: item.couponAnticipatedCost,
status: '2'
})
}
})
list.forEach(item => {
if (item.status == '3') {
this.selectedGiftList[this.activeName].list.push(item)
}
})
this.recoveryTotal()
},
handleGiftConfirm() {
// if (!this.giftList.length) {
// var params = {
// addOrEdit: 1,
// groupOrStore: this.userInfo.accountLevel == 4 ? 2 : 1,
// $title: '新建礼包'
// }
// this.$router.push({
// path: '/productGroup/editProduct',
// query: params
// })
// return true
// }
// var selectedData = this.$refs[this.activeName + 'Ref'].mutiSelectArr[this.tableParams.mutiSelectName]
var selectedData = JSON.parse(JSON.stringify(this.selectedGiftList))
this.$emit('handleGiftConfirm', selectedData)
},
handleGiftClose() {
this.$emit('handleGiftClose')
}
} }
} }
</script> </script>
<style lang="scss">
<style scoped> .muti-gift .el-tabs__nav-wrap:after {
opacity: 0;
}
.muti-gift .el-tabs__item {
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px !important;
line-height: 36px !important;
}
.muti-gift .el-tabs__item:hover,
.muti-gift .el-tabs__item.is-active {
color: #5f5efb;
}
.muti-gift .m-t-10 {
margin-top: 10px;
}
/* .muti-gift .nogiftP {
width: 100%;
height: 20px;
font-family: PingFangSC-Medium;
font-size: 16px;
color: #666666;
line-height: 20px;
font-weight: 500;
text-align: center;
} */
.muti-gift .gift-table {
border: 1px solid #eeeeee;
margin-right: 10px;
}
.muti-gift .p-16 {
padding: 16px;
}
.muti-gift .selected-list {
width: 280px;
border-radius: 2px;
border: 1px solid #eeeeee;
.list-title {
font-size: 16px;
border-bottom: 1px solid #f1f1f1;
}
.gift-box {
// display: flex;
padding: 16px;
.gift-label {
// width: 70px;
color: #999999;
// text-align: right;
margin-bottom: 14px;
}
.gift-content {
border-bottom: 1px solid #e5e5e5;
.gift-item {
display: inline-block;
margin-bottom: 20px;
.gift-coupon-name {
display: inline-block;
width: 131px;
margin: 0 5px 0 7px;
}
.gift-sum {
display: inline-block;
width: 80px;
text-align: right;
.sum-input {
display: inline-block;
width: 80px;
}
.el-input--mini .el-input__inner {
border: 0px;
}
.el-input-number--mini .el-input-number__decrease,
.el-input-number--mini .el-input-number__increase {
width: 20px !important;
border: 0px;
background-color: #fff;
}
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-item:last-child {
margin-bottom: 0;
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
</style> </style>
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
recoverySelected() { recoverySelected() {
if (this.selectedStaffList && this.selectedStaffList.length) { if (this.selectedStaffList && this.selectedStaffList.length) {
this.selectedStaffList.forEach(row => { this.selectedStaffList.forEach(row => {
row.userOneId = row.staffId row.userOneId = row.staffUUID
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row) this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!