Commit f12057d9 by 前端

Merge branch 'zq_dev_v3.2.0' into 'v3.2.0'

Zq dev v3.2.0

See merge request !368
2 parents 910c1c7f 6ad06615
...@@ -140,4 +140,13 @@ const getQrcode = params => { ...@@ -140,4 +140,13 @@ const getQrcode = params => {
}) })
} }
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi, templateModal, getghDirectionalGiftListApi, toVoidGift, getQrcode } const getGroupGift = params => {
params.method = 'scrm.api.coupon.group.directional.gift.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi, templateModal, getghDirectionalGiftListApi, toVoidGift, getQrcode, getGroupGift }
import { http,http_merchant } from '@/main'
const getListApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.page'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
const giftExportApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.list.export'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
//删除
const deleteGiftApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.delete'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const getMerchantListApi = params => {
params.method = 'merchants.api.open.findMerchantBySupMerchantNo'
return http_merchant({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const insertGiftApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.create'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 获取详情
const getGiftInfoApi = params => {
params.method = 'scrm.api.coupon.group.directional.gift.detail'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, giftExportApi, deleteGiftApi, getMerchantListApi, insertGiftApi, getGiftInfoApi }
\ No newline at end of file \ No newline at end of file
...@@ -239,6 +239,24 @@ const staticRoutes = Object.freeze([ ...@@ -239,6 +239,24 @@ const staticRoutes = Object.freeze([
meta: {} meta: {}
}, },
{ {
name: 'groupGiftBag',
path: '/groupGiftBag/index',
component: resolve => require([`@/views/groupGiftBag/index.vue`], resolve),
meta: {}
},
{
name: 'groupGiftDetail',
path: '/groupGiftBag/giftDetail',
component: resolve => require([`@/views/groupGiftBag/giftDetail.vue`], resolve),
meta: {}
},
{
name: 'groupEditGift',
path: '/groupGiftBag/editGift',
component: resolve => require([`@/views/groupGiftBag/editGift.vue`], resolve),
meta: {}
},
{
name: 'sopIndex', name: 'sopIndex',
path: '/sop/index', path: '/sop/index',
component: resolve => require([`@/views/sop/index.vue`], resolve), component: resolve => require([`@/views/sop/index.vue`], resolve),
......
<template>
<div>
<el-input @blur.stop="formatPhone" type="textarea" v-model="phones" :placeholder="placeholder"></el-input>
<span v-if="isTip" class="approval-tip" style="margin-left:0;">{{ tip }}</span>
<div style="width: 565px;">
<div :class="['tel-item', !item.valid ? 'valid-tel' : receiveType == 1 ? 'realTel' : 'realNum']" v-for="(item, index) in phoneLists" :key="index">
{{ item.tel }}
<i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'phone-area',
model: {
prop: 'newList',
event: 'changePhoneList'
},
props: {
receiveType: {
type: String,
require: true,
default: '1'
},
placeholder: {
type: String,
default: ''
},
isTip: {
type: String,
default: ''
},
phones: {
type: String,
default: ''
},
phoneLists: {
type: Array
}
},
// data() {
// return {
// phones: '',
// phoneLists: []
// }
// },
methods: {
delPhone(val) {
let phones = '\n' + this.phones + '\n'
phones = phones.replace(/[\n]/g, '\n\n')
phones = phones.replace(new RegExp('[\n]' + val + '[\n]', 'g'), '\n')
phones = phones.replace(/[\n]+/g, '\n')
phones = phones.replace(/^[\n]+/, '')
this.phones = phones
this.formatPhone()
},
formatPhone() {
let phoneLists = this.phones.split('\n')
phoneLists = [...new Set(phoneLists)]
// let phoneLists = this.phones.split(/[\n|\s|,|,]/)
let reg
if (this.receiveType == 1) {
reg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
} else {
reg = /^[0-9a-zA-Z]{6}$/
}
let arr = []
phoneLists.forEach(item => {
arr.push({
tel: item,
valid: reg.test(item)
})
})
this.phoneLists = arr.filter(item => item.tel)
this.$emit('changePhoneList', this.phoneLists, this.phones)
},
}
}
</script>
<style scope lang="scss">
.tel-item {
height: 26px;
display: inline-block;
padding: 0 8px;
line-height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
color: #666666;
text-align: center;
margin-right: 4px;
box-sizing: border-box;
}
.valid-tel {
background: #fff1f0;
border: 1px solid #ffa39e;
color: #ff4d4f;
}
.realTel {
width: 130px;
}
.realNum {
width: 90px;
}
.el-textarea {
width: 632px;
}
</style>
<!-- 编辑礼包 --> <!-- 编辑礼包 -->
<template> <template>
<div class="edit-gift marketing edit-box"> <div class="edit-gift marketing edit-box">
<!-- <div v-if="routeInfo.addOrEdit != 'add'" class="container approval-container">
<p class="edit-title">审批信息</p>
<div class="approval-info">
<div class="approval_label">审批人:{{ editForm.approveBy }}</div>
<div class="approval_label">
审批状态:
<span :style="{ color: approvalStatusColor[approvalStatus] }">{{ approvalStatusVal[approvalStatus] }}</span>
</div>
<div v-if="approvalStatus == 2" class="approval_label">
驳回说明:
<div class="approval_con">{{ editForm.approveExplain }}</div>
</div>
</div>
</div> -->
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form v-loading="loading" class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="giftTypeSlot">
<div :class="['gift-type',{'active-gift': merchantType==item.value}]" v-for="item in giftTypeList" :key="item.value" @click="changeMerchantType(item.value)">
{{item.name}}
</div>
</div>
<div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div> <div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div>
<el-button slot="selectGiftBtn" :disabled="routeInfo.receivedStock" class="default-blue-btn" @click="handleGiftAdd">选择礼包内容</el-button> <el-button slot="selectGiftBtn" :disabled="routeInfo.receivedStock" class="default-blue-btn" @click="handleGiftAdd">选择礼包内容</el-button>
<div slot="selectGroupGiftSlot">
<el-radio v-for="(item,index) in groupList" :key="index" v-model="groupDirectionalGiftId" :label="item.id">{{item.name}}</el-radio>
</div>
<div slot="couponListBlock" class="gift-block" :style="{ 'margin-left': defaultLabelWidth }" v-show="editForm.couponList && editForm.couponList.length != 0"> <div slot="couponListBlock" class="gift-block" :style="{ 'margin-left': defaultLabelWidth }" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title"> <div class="gift-title">
预估成本: 预估成本:
...@@ -35,7 +29,7 @@ ...@@ -35,7 +29,7 @@
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span> <span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-coupon-name', 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 :style="{ cursor: routeInfo.receivedStock ? 'not-allowed' : 'pointer' }" class="el-icon-delete" style="color: #C6C6C6;" @click="handleGiftDelete(item, subIndex)"></i> <i v-if="merchantType==1" :style="{ cursor: routeInfo.receivedStock ? 'not-allowed' : 'pointer' }" class="el-icon-delete" style="color: #C6C6C6;" @click="handleGiftDelete(item, subIndex)"></i>
</div> </div>
</div> </div>
</div> </div>
...@@ -155,6 +149,7 @@ export default { ...@@ -155,6 +149,7 @@ export default {
phone: '', phone: '',
isLoaded: true, isLoaded: true,
loading: false, loading: false,
merchantType: 1,
tableSearchForm: { staffName: '' }, tableSearchForm: { staffName: '' },
phoneList: [], phoneList: [],
size: 'small', size: 'small',
...@@ -225,6 +220,16 @@ export default { ...@@ -225,6 +220,16 @@ export default {
list: [] list: []
} }
}, },
giftTypeList: [
{
name: '自店礼包',
value: 1
},
{
name: '集团礼包',
value: 2
}
],
editRule: { editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }], name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }], remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
...@@ -236,9 +241,9 @@ export default { ...@@ -236,9 +241,9 @@ export default {
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (!value) { if (!value) {
return callback(new Error('请输入库存数量')) return callback(new Error('请输入礼包数量'))
} else if (this.routeInfo.id && +this.curStock > +value && this.curReceiveRule != 4) { } else if (this.routeInfo.id && +this.curStock > +value && this.curReceiveRule != 4) {
return callback(new Error('二次编辑,库存数量不能减少')) return callback(new Error('二次编辑,礼包数量不能减少'))
} else { } else {
return callback() return callback()
} }
...@@ -271,11 +276,18 @@ export default { ...@@ -271,11 +276,18 @@ export default {
isEdit: true, isEdit: true,
editFormData: [ editFormData: [
{ {
label: '礼包类型',
name:'',
addHtml:'giftTypeSlot',
isHide: false
},
{
label: '礼包名称', label: '礼包名称',
name: 'name', name: 'name',
isDisabled: false, isDisabled: false,
type: 'input', type: 'input',
maxlength: 15 maxlength: 15,
isHide: false
}, },
{ {
label: '备注名称', label: '备注名称',
...@@ -289,7 +301,14 @@ export default { ...@@ -289,7 +301,14 @@ export default {
{ {
label: '礼包设置', label: '礼包设置',
name: 'couponList', name: 'couponList',
addHtml: 'selectGiftBtn' addHtml: 'selectGiftBtn',
isHide: false
},
{
label:'选择礼包',
name: 'couponList',
addHtml: 'selectGroupGiftSlot',
isHide: true
}, },
{ {
label: '', label: '',
...@@ -298,7 +317,7 @@ export default { ...@@ -298,7 +317,7 @@ export default {
addHtml: 'couponListBlock' addHtml: 'couponListBlock'
}, },
{ {
label: '库存数量', label: '礼包数量',
name: 'stock', name: 'stock',
addHtml: 'stockNumInput', addHtml: 'stockNumInput',
isHide: false isHide: false
...@@ -405,7 +424,9 @@ export default { ...@@ -405,7 +424,9 @@ export default {
isChangeCoupons: true, isChangeCoupons: true,
isChangePeople: true, isChangePeople: true,
currentCoupons: [], currentCoupons: [],
currentPeople: [] currentPeople: [],
groupDirectionalGiftId: '',
groupList:[]
} }
}, },
components: { components: {
...@@ -419,6 +440,33 @@ export default { ...@@ -419,6 +440,33 @@ export default {
}, },
deep: true deep: true
}, },
merchantType: {
handler(val){
let target = this.editFormData.find(item => item.addHtml == 'selectGroupGiftSlot')
let setGiftTarget = this.editFormData.find(item => item.addHtml == 'selectGiftBtn')
let nameTarget = this.editFormData.find(item => item.name == 'name')
target.isHide = val == 1
setGiftTarget.isHide = val != 1
nameTarget.isHide = val != 1
if(val == 2){
this.groupDirectionalGiftId = this.groupList[0]?.id
}else{
this.editForm.name = ''
this.groupDirectionalGiftId = ''
}
},
deep: true
},
groupDirectionalGiftId: {
handler(val){
if(this.merchantType == 2){
let target = this.groupList.find(item=> item.id == this.groupDirectionalGiftId)
this.editForm.name = target.name
this.selectGroupGiftFn(target)
}
},
deep: true
},
'editForm.couponList': { 'editForm.couponList': {
handler(val) { handler(val) {
this.isChangeCoupons = this.judgeAddOrDel(val, this.currentCoupons, 'id') this.isChangeCoupons = this.judgeAddOrDel(val, this.currentCoupons, 'id')
...@@ -449,6 +497,7 @@ export default { ...@@ -449,6 +497,7 @@ export default {
}, },
mounted() { mounted() {
this.setMinHeight() this.setMinHeight()
this.getGroupGift()
this.routeInfo = this.$route.query this.routeInfo = this.$route.query
if (this.routeInfo.receivedStock) this.routeInfo.receivedStock = +this.routeInfo.receivedStock if (this.routeInfo.receivedStock) this.routeInfo.receivedStock = +this.routeInfo.receivedStock
this.title = this.titleObj[this.routeInfo.addOrEdit] this.title = this.titleObj[this.routeInfo.addOrEdit]
...@@ -465,6 +514,44 @@ export default { ...@@ -465,6 +514,44 @@ export default {
} }
}, },
methods: { methods: {
changeMerchantType(val){
this.merchantType = val
if(val==1){
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.couponList = []
this.hasCouponBlock(false)
}
},
getGroupGift(){
this.$apis.giftBag.getGroupGift({}).then(res => {
let giftArr = []
if(res?.length){
let Obj = this.$common.utils.deepClone(this.couponObj)
this.orderShow.forEach(item => {
Obj[item].list = []
})
res.forEach(ele => {
let gift = this.$common.utils.deepClone(Obj)
console.log(JSON.stringify(Obj))
const {id, name, couponDTOList} = ele
couponDTOList.forEach(item=>{
gift[this.numToCoupon[item.discountType]].list.push(item)
})
giftArr.push({id, name, gift})
})
this.groupList = this.$common.utils.deepClone(giftArr)
}else{
let target = this.editFormData.find(item => item.addHtml == 'giftTypeSlot')
target.isHide = true
}
})
},
selectGroupGiftFn(item){
let gift = this.$common.utils.deepClone(item.gift)
this.handleGiftConfirm(gift, 'group')
},
//员工查询 //员工查询
handleSearch() { handleSearch() {
this.$refs?.staffDialog?.getList({}, true) this.$refs?.staffDialog?.getList({}, true)
...@@ -519,6 +606,10 @@ export default { ...@@ -519,6 +606,10 @@ export default {
this.approvalStatus = res.data.approveStatus - 1 this.approvalStatus = res.data.approveStatus - 1
this.editForm = res.data this.editForm = res.data
this.curStock = res.data.stock this.curStock = res.data.stock
this.merchantType = res.data.merchantType
this.$nextTick(()=>{
this.groupDirectionalGiftId = res.data.groupDirectionalGiftId
})
this.curReceiveRule = res.data.receiveRule this.curReceiveRule = res.data.receiveRule
this.receiveWay = res.data.receiveWay || 1 this.receiveWay = res.data.receiveWay || 1
if (res.data && res.data.receiveDetails) { if (res.data && res.data.receiveDetails) {
...@@ -600,8 +691,11 @@ export default { ...@@ -600,8 +691,11 @@ export default {
this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj)) this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose() this.handleGiftClose()
}, },
handleGiftConfirm(selectedData) { handleGiftConfirm(selectedData, type) {
console.log(selectedData,'selectedData')
if(type!='group'){
this.handleGiftClose() this.handleGiftClose()
}
this.couponObj = selectedData this.couponObj = selectedData
this.recoveryTotalPrice() this.recoveryTotalPrice()
this.recoveryGiftList() this.recoveryGiftList()
...@@ -655,7 +749,7 @@ export default { ...@@ -655,7 +749,7 @@ export default {
params.staffCreateRequests = this.$common.utils.deepClone(params.staffList) params.staffCreateRequests = this.$common.utils.deepClone(params.staffList)
params.couponCreateRequests = this.$common.utils.deepClone(params.couponList) params.couponCreateRequests = this.$common.utils.deepClone(params.couponList)
params.couponCreateRequests.forEach(item => { params.couponCreateRequests.forEach(item => {
item.couponId = item.id item.couponId = this.merchantType==2 ? item.couponId: item.id
}) })
if (this.editForm.receiveRule == 1 || this.editForm.receiveRule == 4) { if (this.editForm.receiveRule == 1 || this.editForm.receiveRule == 4) {
params.receiveDetailList = this.phoneList.map(item => item.tel) params.receiveDetailList = this.phoneList.map(item => item.tel)
...@@ -676,6 +770,8 @@ export default { ...@@ -676,6 +770,8 @@ export default {
} }
} }
params.requestSource = 1 params.requestSource = 1
params.merchantType = this.merchantType
if(this.merchantType==2) params.groupDirectionalGiftId = this.groupDirectionalGiftId
// 插入判断是否存在审批模板 // 插入判断是否存在审批模板
// const { session } = this.$globalState // const { session } = this.$globalState
if (this.editForm.receiveRule == 1 || this.editForm.receiveRule == 4) { if (this.editForm.receiveRule == 1 || this.editForm.receiveRule == 4) {
...@@ -785,6 +881,25 @@ export default { ...@@ -785,6 +881,25 @@ export default {
} }
} }
} }
.gift-type{
display: inline-block;
border: 1px solid #D5D5D5;
box-sizing: border-box;
text-align: center;
width: 70px;
height: 20px;
line-height: 20px;
font-weight: 400;
font-size: 12px;
color: rgba(0,0,0,0.65);
cursor: pointer;
}
.active-gift{
background: #5850FF;
border: 1px solid #5850FF;
color: #fff;
}
.approval-tip { .approval-tip {
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
......
...@@ -28,7 +28,10 @@ ...@@ -28,7 +28,10 @@
</div> </div>
</div> </div>
<div slot="name" slot-scope="scope"> <div slot="name" slot-scope="scope">
<p class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</p> <div class="gift-name">
<div class="group-label" v-if="scope.scope.merchantType==2">集团</div>
<div class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</div>
</div>
</div> </div>
<!-- <div style="display: flex;align-items: center;" slot="approveStatus" slot-scope="scope"> <!-- <div style="display: flex;align-items: center;" slot="approveStatus" slot-scope="scope">
<div class="approve-status" :style="{ 'background-color': approvalStatusColor[scope.scope.approveStatus - 1] }"></div> <div class="approve-status" :style="{ 'background-color': approvalStatusColor[scope.scope.approveStatus - 1] }"></div>
...@@ -82,7 +85,10 @@ export default { ...@@ -82,7 +85,10 @@ export default {
}, },
attrs: { attrs: {
type: 'text', type: 'text',
fn: '编辑' fn: '编辑',
disabled:row=>{
return row.scope.merchantType==2 && row.scope.receivedStock
}
}, },
listeners: { listeners: {
click: row => this.handleEdit('edit', row.scope) click: row => this.handleEdit('edit', row.scope)
...@@ -544,6 +550,26 @@ export default { ...@@ -544,6 +550,26 @@ export default {
} }
} }
} }
.gift-name{
display: flex;
align-items: center;
.group-label{
width: 42px;
height: 20px;
line-height: 20px;
text-align: center;
background: rgba(255,101,61,0.15);
border-radius: 4px;
margin-right: 4px;
font-size: 12px;
color: #FF653D;
}
.cursor-pointer{
height: 20px;
line-height: 20px;
}
}
.gift-detail { .gift-detail {
padding:0 200px 0 10px; padding:0 200px 0 10px;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="receivedGiftListRef" :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="directionalGiftName" slot-scope="scope"> <span slot="directionalGiftName" slot-scope="scope">
<div class="gift-name-slot">
<div class="group-label" v-if="scope.scope.merchantType==2">集团</div>
<el-tooltip effect="dark" :content="scope.scope.directionalGiftName" placement="top-start"> <el-tooltip effect="dark" :content="scope.scope.directionalGiftName" placement="top-start">
<p class="gift-name" @click="handleDetail(scope.scope)"> <p class="gift-name" @click="handleDetail(scope.scope)">
{{ scope.scope.directionalGiftName }} {{ scope.scope.directionalGiftName }}
...@@ -31,6 +33,7 @@ ...@@ -31,6 +33,7 @@
<el-tooltip effect="dark" :content="scope.scope.cancelReason" placement="top-start"> <el-tooltip effect="dark" :content="scope.scope.cancelReason" placement="top-start">
<p class="void-reason" v-if="scope.scope.receiveStatus == 2">作废原因:{{ scope.scope.cancelReason || '--' }}</p> <p class="void-reason" v-if="scope.scope.receiveStatus == 2">作废原因:{{ scope.scope.cancelReason || '--' }}</p>
</el-tooltip> </el-tooltip>
</div>
</span> </span>
<div slot="giftInfo" slot-scope="scope"> <div slot="giftInfo" slot-scope="scope">
<GLTable class="secondTable" ref="giftListRef" :hasNum="false" :hasPage="false" :noDataImg="url" :tableParams="giftParams" :tableData="scope.scope | filterTable" @setTableFinishFun="setGiftTableFinishFun"></GLTable> <GLTable class="secondTable" ref="giftListRef" :hasNum="false" :hasPage="false" :noDataImg="url" :tableParams="giftParams" :tableData="scope.scope | filterTable" @setTableFinishFun="setGiftTableFinishFun"></GLTable>
...@@ -279,7 +282,7 @@ export default { ...@@ -279,7 +282,7 @@ export default {
{ {
label: '礼包名称', label: '礼包名称',
width: 200, width: 300,
addHtml: 'directionalGiftName' addHtml: 'directionalGiftName'
}, },
{ {
...@@ -523,6 +526,22 @@ export default { ...@@ -523,6 +526,22 @@ export default {
.secondTable { .secondTable {
padding-left: 10px; padding-left: 10px;
} }
.group-label{
width: 42px;
height: 20px;
line-height: 20px;
text-align: center;
background: rgba(255,101,61,0.15);
border-radius: 4px;
margin-right: 4px;
font-size: 12px;
color: #FF653D;
flex-shrink: 0;
}
.gift-name-slot{
display: flex;
align-items: center;
}
.gift-name { .gift-name {
color: #5850ff; color: #5850ff;
margin: 0; margin: 0;
...@@ -542,7 +561,7 @@ export default { ...@@ -542,7 +561,7 @@ export default {
text-align: center; text-align: center;
line-height: 18px; line-height: 18px;
background: #eeeded; background: #eeeded;
margin-top: 2px; flex-shrink: 0;
} }
.void-reason { .void-reason {
font-size: 10px; font-size: 10px;
...@@ -551,7 +570,6 @@ export default { ...@@ -551,7 +570,6 @@ export default {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
margin: 4px 0 0;
} }
.void-dialog { .void-dialog {
/deep/ .el-dialog__body { /deep/ .el-dialog__body {
......
<!-- 定向礼包-->
<template>
<div class="marketing">
<div class="m-b-10">
<!-- <el-button :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</el-button> -->
<GLButton :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</GLButton>
</div>
<div class="list-tips m-b-10">
<img class="tips-img" src="@/assets/icon-info.png" />
<span>集团礼包:将多种券组合成礼包,由集团指定的门店进行发放,客户领取后可在指定的门店间进行使用。</span>
</div>
<div class="container">
<div>
<GLCombiForm @handleOk="handleSearch" :rowNumber="1" @handleRest="handleReset" ref="showSearch" :formObj="searchForm" :formData="searchFormData"></GLCombiForm>
<GLButton style="float:right;margin-bottom:10px;" :size="size" class="default-blue-btn" type="default" fn="导出" @click="handleExport">导出</GLButton>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div class="p-b-12">礼包明细</div>
<div class="gift-detail flex-wrap">
<div class="gift-item" v-for="(item, index) in scope.scope.couponDTOList" :key="index">
<img :src="require(`@/assets/coupon/icon-${attrToIcon[item.discountType]}.png`)" />
<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">
<p class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</p>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
export default {
name: 'giftList',
data() {
return {
attrToIcon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
buttonList: [
{
type: 'GLButton',
name: row => {
return '编辑'
},
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.handleEdit('edit', row.scope)
}
},
{
type: 'GLButton',
name: row => {
return '删除'
},
attrs: {
type: 'text',
fn: '删除'
},
listeners: {
click: row => this.handleDelete(row.scope)
}
}
],
size: 'small',
url: url,
searchForm: {
name: '',
merchantName: ''
},
// 搜索
searchFormData: [
{
label: '礼包名称',
name: 'name',
type: 'input',
maxlength: 30,
placeholder: '请输入礼包/备注名称',
isClear: true
},
{
label: '下发门店',
name: 'merchantName',
type: 'input',
maxlength: 30,
placeholder: '请输入门店名称',
isClear: true
},
],
// 表格
getListApi: this.$apis.groupGiftBag.getListApi,
tableParams: {
listName: 'list',
tableOption: {
width: 200,
align: 'center'
},
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
},
{
label: '序号',
prop: 'idx',
width: 60
},
{
label: '礼包名称',
prop: 'name',
addHtml: 'name'
},
{
label: '预估成本/元',
prop: 'anticipatedCost',
formatter: cellValue => {
let total = cellValue.couponDTOList.reduce(function(prev, cur) {
return prev + +(cur.couponAnticipatedCost * cur.couponAmount).toFixed(0)
}, 0)
return total / 100
}
},
{
label: '下发门店',
prop: 'staffList',
line: 1,
formatter: cellValue => {
return cellValue.storeList.map(item => item.merchantName).join('、')
}
},
{
label: '已领取',
prop: 'stock',
formatter: cellValue => {
return cellValue.receivedAmount || '0'
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
}
},
mounted() {
},
methods: {
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
handleDelete(row) {
this.secondConfirm('删除', '是否确认删除该礼包?', 'groupGiftBag', 'deleteGiftApi', { id: row.id })
},
// 导出
handleExport() {
var params = {...this.searchForm}
this.$apis.groupGiftBag.giftExportApi(params).then(res => {
aToExport(res)
})
},
// 查看
handleDetail(row) {
this.$router.push({
path: '/groupGiftBag/giftDetail',
query: {
id: row.id
}
})
},
// add-新增;edit-编辑
handleEdit(addOrEdit, row) {
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
path: '/groupGiftBag/editGift',
query: params
})
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
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()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
name: '',
merchantName: ''
},
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.p-b-12 {
margin-bottom: 14px;
font-weight: 500;
padding-left: 10px;
color: #333333;
}
.approve-status {
width: 6px;
height: 6px;
border-radius: 4px;
margin-right: 8px;
display: inline-block;
}
.qr-dialog {
/deep/.el-dialog__body {
// padding: 20px;
.el-scrollbar__wrap {
overflow: hidden;
}
.qrcode-body {
display: flex;
flex-direction: column;
align-items: center;
p {
line-height: 28px;
margin-bottom: 16px;
}
.el-select {
.el-input__inner {
width: 360px;
height: 36px;
}
.el-input__icon {
line-height: 36px;
}
}
.img {
margin-top: 16px;
background: #eee;
display: flex;
align-items: center;
justify-content: center;
&,
img {
width: 160px;
height: 160px;
}
}
}
}
}
.gift-detail {
padding:0 200px 0 10px;
.gift-item {
margin-right: 80px;
display: flex;
align-items: center;
color: #333333;
width: 400px;
img {
height: 23px;
width: 58px;
margin-right: 10px;
}
.gift-coupon-name {
display: inline-block;
}
.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>
<!-- 定向礼包 -->
<template>
<div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="集团礼包" name="giftList">
<gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import giftList from './giftList.vue'
import receivedGiftList from './receivedGiftList.vue'
export default {
name: 'gitfBag',
data() {
return {
activeName: 'giftList'
}
},
components: {
giftList,
receivedGiftList
},
created() {
// this.activeName = sessionStorage.getItem('GIFTNAME') ? sessionStorage.getItem('GIFTNAME') : 'giftList'
if (this.$route.query.type == 'received') {
this.activeName = 'receivedGiftList'
}
},
mounted() {},
methods: {
handleTabClick() {
this.$router.push({ path: this.$route.path, query: { type: this.activeName == 'receivedGiftList' ? 'received' : 'gift' } })
}
}
}
</script>
<style>
.gift-bag .el-tabs__nav-wrap:after {
opacity: 0;
}
.gift-bag .el-tabs__item {
height: 20px !important;
line-height: 10px !important;
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px;
line-height: 36px;
}
.gift-bag .el-tabs__item:hover,
.gift-bag .el-tabs__item.is-active {
color: #5f5efb;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!