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 => {
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')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
// console.log(1111111)
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
......
......@@ -610,7 +610,7 @@ export default {
//是否定制礼包专用
obj.directionalFlag = form.directionalFlag
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
// obj.anticipatedCost = form.anticipatedCost * 100
//面值
obj.denomination = form.denomination
//库存
......@@ -634,6 +634,8 @@ export default {
}
//使用描述
obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj
},
......
......@@ -299,8 +299,6 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '2'
obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
......@@ -325,6 +323,8 @@ export default {
}
//使用描述
obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj
},
......
......@@ -277,8 +277,6 @@ export default {
//优惠券类型 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
obj.discountType = '4'
obj.directionalFlag = '1'
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
//有效期
//有效类型 1:固定天数,领取后计算 2:时间段,3:无有效期
obj.effectiveType = form.effectiveType
......@@ -303,6 +301,8 @@ export default {
}
//使用描述
obj.useDescription = form.useDescription
//预估成本
obj.anticipatedCost = form.anticipatedCost * 100
return obj
},
......
......@@ -18,7 +18,7 @@
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<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>
<i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i>
</div>
......@@ -26,7 +26,7 @@
</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>
<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">
......@@ -42,23 +42,23 @@
<el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</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>
</div>
</template>
<script>
import selectStaffDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectGiftDialog.vue'
export default {
name: 'editGift',
data() {
return {
size: 'small',
title: '新增信息',
title: '新增礼包',
titleObj: {
add: '新增信息',
edit: '编辑信息'
add: '新增礼包',
edit: '编辑礼包'
},
footerLeft: '0',
footerWidth: '0',
......@@ -66,6 +66,9 @@ export default {
isMutiSelectVisible: false,
searchStaffForm: {},
selectedStaffList: [],
// 选择定向礼包弹窗
isSelectGiftVisible: false,
selectedGiftList: [],
editChildRef: 'editChildRef',
routeInfo: {
// add-新增;edit-编辑;detail-详情
......@@ -77,30 +80,31 @@ export default {
editForm: {
name: '',
remarkName: '',
receiveWay: '0',
receiveWay: '1',
receiveDetails: '',
staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [{
discountType: 3,
couponName: '测试有效期查询券2',
couponAmount: '1',
couponAnticipatedCost: '10',
status: '2'
}, {
discountType: 3,
couponName: '7折代金券',
couponAmount: '1',
couponAnticipatedCost: '20',
status: '3'
}, {
discountType: 3,
couponName: '9.9折代金券',
couponAmount: '5',
couponAnticipatedCost: '15',
status: '2'
}]
couponList: []
// couponList: [{
// discountType: 3,
// couponName: '测试有效期查询券2',
// couponAmount: '1',
// couponAnticipatedCost: '10',
// status: '2'
// }, {
// discountType: 3,
// couponName: '7折代金券',
// couponAmount: '1',
// couponAnticipatedCost: '20',
// status: '3'
// }, {
// discountType: 3,
// couponName: '9.9折代金券',
// couponAmount: '5',
// couponAnticipatedCost: '15',
// status: '2'
// }]
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
......@@ -148,7 +152,7 @@ export default {
if (!value) {
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}$/
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号'))
} else {
......@@ -194,11 +198,11 @@ export default {
optionLabel: 'confName',
optionList: [
{
confId: '0',
confId: '1',
confName: '指定手机号'
},
{
confId: '1',
confId: '2',
confName: '指定车架号后6位'
}
],
......@@ -236,27 +240,13 @@ export default {
maxlength: 50,
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: {
selectStaffDialog
selectStaffDialog,
selectGiftDialog
},
watch: {
......@@ -278,16 +268,25 @@ export default {
methods: {
getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.editStatus = false
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
res.data.couponList.forEach(item => {
item.id = item.couponId
item.anticipatedCost = item.couponAnticipatedCost
})
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
})
})
},
recoveryCoupon() {
......@@ -297,33 +296,58 @@ export default {
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
// console.log(this.couponObj)
},
receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6
this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本
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) {
this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice()
this.recoveryGiftList()
},
handleStaffRemove(val, idx) {
......@@ -332,10 +356,10 @@ export default {
this.key = new Date()
},
hasStaffBlock() {
hasStaffBlock(isValidate = true) {
var idx = this.editFormData.findIndex(item => item.name == 'staffListBlock')
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() {
......@@ -351,7 +375,7 @@ export default {
this.editForm.staffList = []
selectedData.forEach(item => {
this.editForm.staffList.push({
staffId: item.userOneId,
staffUUID: item.userOneId,
staffName: item.staffName
})
})
......@@ -363,28 +387,32 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
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)
// if (this.routeInfo.addOrEdit == 'edit') {
// params.id = this.routeInfo.id
// }
// params.merchantList = []
// this.editForm.merchantList.forEach(item => {
// params.merchantList.push({
// merchantId: item.merchantNo,
// merchantName: item.merchantName,
// merchantAccountLevel: item.merchantAccountLevel
// })
// })
// console.log(params)
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
this.loading = true
this.$apis.giftBag
.insertGiftApi(params)
.then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
.finally(() => {
this.loading = false
})
}
})
},
......@@ -449,7 +477,7 @@ export default {
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
.gift-coupon-name {
display: inline-block;
margin: 0 5px 0 7px;
}
......
......@@ -23,7 +23,7 @@
</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 :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)">
......@@ -36,7 +36,7 @@
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<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>
</template>
......@@ -61,8 +61,9 @@ export default {
editForm: {
name: '',
remarkName: '',
receiveWay: '0',
receiveWay: '1',
receiveDetails: '',
receivedFlag: 2,
staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
......@@ -155,14 +156,16 @@ export default {
methods: {
getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
})
.finally(() => {
this.loading = false
})
})
},
recoveryCoupon() {
......@@ -176,8 +179,8 @@ export default {
receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6
this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
},
// 计算预估成本
......@@ -197,7 +200,7 @@ export default {
handleEdit() {
var params = {
addOrEdit: 'edit',
$title: encodeURI('编辑信息')
$title: encodeURI('编辑礼包')
}
params.id = this.routeInfo.id
this.$router.push({
......
......@@ -29,15 +29,20 @@
<!-- 表格区域 开始 -->
<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>礼包明细</div>
<div>{{ scope.scope }}</div>
<div class="p-b-12">礼包明细</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 slot="name" slot-scope="scope">
<el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton> -->
<!-- <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button> -->
<GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton>
</div>
</GLTable>
<!-- 表格区域 end -->
......@@ -56,8 +61,8 @@ export default {
size: 'small',
url: url,
searchForm: {
orderCode: '',
commentStatus: '',
name: '',
staffName: '',
createDate: []
},
tableSearchForm: {},
......@@ -131,7 +136,10 @@ export default {
},
{
label: '赠送原因',
prop: 'giveReason'
prop: 'giveReason',
formatter: cellValue => {
return cellValue.giveReason || '-'
}
},
{
label: '创建时间',
......@@ -228,7 +236,7 @@ export default {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息')
$title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
......@@ -278,8 +286,8 @@ export default {
handleReset() {
this.searchForm = {
orderCode: '',
commentStatus: '',
name: '',
staffName: '',
createDate: []
}
this.handleSearch()
......@@ -288,4 +296,27 @@ export default {
}
</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 @@
<div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="定向礼包" name="giftList">
<gift-list></gift-list>
<gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList></receivedGiftList>
<receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane>
</el-tabs>
</div>
......
......@@ -18,11 +18,15 @@
</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>礼包明细</div>
<div>{{ scope.scope }}</div>
<GLTable ref="giftListRef" :getListApi="getGiftListApi" :hasNum="false" :noDataImg="url" :searchForm="giftSearchForm" :tableParams="giftParams" :pageConf="giftPageConf"></GLTable>
<GLTable ref="giftListRef" :hasNum="false" :hasPage="false" :noDataImg="url" :tableParams="giftParams" :tableData="scope.scope | filterTable" @setTableFinishFun="setGiftTableFinishFun"></GLTable>
</div>
</GLTable>
<!-- 表格区域 end -->
......@@ -33,16 +37,39 @@
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
export default {
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() {
return {
size: 'small',
url: url,
searchForm: {
whether: '',
orderCode: '',
commentStatus: '',
nickName: '',
wechatUserFlag: '',
giftName: '',
staffName: '',
createDate: []
},
tableSearchForm: {},
......@@ -50,33 +77,37 @@ export default {
searchFormData: [
{
label: '领用客户',
name: 'customer',
type: 'input'
name: 'nickName',
type: 'input',
placeholder: '请输入客户名称或手机号'
},
{
label: '礼包名称',
name: 'giftName',
type: 'input'
type: 'input',
placeholder: '请输入礼包名称或备注名称'
},
{
label: '是否为企微客户',
name: 'whether',
name: 'wechatUserFlag',
type: 'select',
optionList: [],
optionId: 'Id',
optionLabel: 'Name',
optionsName: 'List'
optionsName: 'List',
placeholder: '请选择'
}
],
searchFormData1: [
{
label: '发放员工',
name: 'staff',
type: 'input'
name: 'staffName',
type: 'input',
placeholder: '请输入'
},
{
label: '领用日期',
name: 'receiveDate',
label: '领取用日期',
name: 'createDate',
type: 'datePicker',
pickerOptions: 'beforeRangePickerOptions'
}
......@@ -93,8 +124,7 @@ export default {
}
]
},
//礼包表格
getGiftListApi: this.$apis.orderComment.getListApi,
//礼包详情
giftParams: {
listName: 'list',
tableOption: false,
......@@ -105,31 +135,36 @@ export default {
},
{
label: '礼包数量',
name: 'discountType',
name: 'couponAmount',
width: '100px',
formatter: cellValue => {
return 'X' + cellValue.numBer
return 'X' + cellValue.couponAmount
}
},
{
label: '已核销',
prop: 'anticipatedCost ',
formatter: cellValue => {
return 'X' + cellValue.numBer
if (cellValue.delet) {
return 'X' + cellValue.delet
}
}
},
{
label: '可使用',
prop: 'getAmount',
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.orderComment.getListApi,
// 礼包
getListApi: this.$apis.giftBag.getReceivedGiftInfoApi,
tableParams: {
listName: 'list',
tableOption: false,
......@@ -144,41 +179,55 @@ export default {
},
{
label: '序号',
prop: 'idx'
prop: 'idx',
width: '60'
},
{
label: '领取客户',
prop: 'orderCode'
addHtml: 'nickName'
},
{
label: '是否为企微客户',
prop: 'orderCode',
width: '200'
prop: 'wechatUserFlag',
width: '200',
formatter: cellValue => {
if (cellValue.wechatUserFlag == 1) {
return '否'
} else if (cellValue.wechatUserFlag == 2) {
return '是'
}
}
},
{
label: '礼包名称',
prop: 'orderCode',
width: '200'
width: '200',
addHtml: 'directionalGiftName'
},
{
label: '备注名称',
prop: 'orderCode',
label: '礼包备注名称',
prop: 'directionalGiftRemarkName',
width: '200'
},
// {
// label: '备注名称',
// prop: 'orderCode',
// width: '200'
// },
{
label: '预估成本/元',
prop: 'orderCode'
prop: 'anticipatedCost'
},
{
label: '已核销成本',
prop: 'orderCode'
prop: 'verificationAnticipatedCos'
},
{
label: '发放员工',
prop: 'orderCode'
prop: 'staffName'
},
{
label: '创建时间',
label: '领取时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
......@@ -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 {
},
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() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) {
params.createStartDateStr = 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.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
......@@ -246,9 +310,9 @@ export default {
handleExport() {
var params = this.getParams()
// this.$apis.couponManage.couponExportApi(params).then(res => {
// exportFn(res)
// })
this.$apis.giftBag.exportGiftInfoApi(params).then(res => {
aToExport(res)
})
},
handleDelete(row) {
......@@ -260,7 +324,7 @@ export default {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息')
$title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
......@@ -295,23 +359,31 @@ export default {
}
},
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) => {
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()
},
if (this.$refs.receivedGiftListRef.data) {
this.$refs.receivedGiftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.receivedGiftListRef.data.length ? (this.$refs.receivedGiftListRef.tableHeightValues = '') : this.$refs.receivedGiftListRef.setTableHeightFun()
}
},
setGiftTableFinishFun() {
console.log(this.$refs.giftListRef, '2')
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
this.$refs.receivedGiftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
orderCode: '',
commentStatus: '',
nickName: '',
wechatUserFlag: '',
giftName: '',
staffName: '',
createDate: []
}
this.handleSearch()
......
<!-- 选择礼包弹窗 -->
<template>
<div>
</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">
<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>
<script>
// import { getGoodsList } from '@/api/modules/common'
import url from '@/assets/empty.png'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectGiftDialog',
data() {
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: {
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>
<style scoped>
<style lang="scss">
.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>
......@@ -97,7 +97,7 @@ export default {
recoverySelected() {
if (this.selectedStaffList && this.selectedStaffList.length) {
this.selectedStaffList.forEach(row => {
row.userOneId = row.staffId
row.userOneId = row.staffUUID
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!