Commit ce248f7b by wuwx

修改定向礼包需求

1 parent dd7fb649
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<!-- radio --> <!-- radio -->
<div v-else-if="item.type === 'radio'"> <div v-else-if="item.type === 'radio'">
<el-radio-group v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :disabled="item.isDisabled" @change="item.handleRadioChange"> <el-radio-group v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :disabled="subItem.isDisabled" :label="subItem[item.optionId]">{{ subItem[item.optionLabel] }}</el-radio> <el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :disabled="subItem.isDisabled" :label="subItem[item.optionId]">{{ subItem[item.optionLabel] }} <slot :name="subItem.suffixSonSlot" :scope="subItem"></slot></el-radio>
</el-radio-group> </el-radio-group>
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
</div> </div>
......
No preview for this file type
<!-- 编辑礼包 --> <!-- 编辑礼包 -->
<template> <template>
<div class="edit-gift marketing edit-box"> <div class="edit-gift marketing p-t-20 edit-box">
<!-- <div v-if="routeInfo.addOrEdit != 'add'" class="container approval-container"> <!-- <div v-if="routeInfo.addOrEdit != 'add'" class="container approval-container">
<p class="edit-title">审批信息</p> <p class="edit-title">审批信息</p>
<div class="approval-info"> <div class="approval-info">
...@@ -52,16 +52,17 @@ ...@@ -52,16 +52,17 @@
<el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="2">无需审批</el-radio> <el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="2">无需审批</el-radio>
<p class="approval-tip">无需审批,可直接赠送给客户</p> <p class="approval-tip">无需审批,可直接赠送给客户</p>
</div> </div>
<div v-if="editForm.receiveRule === 1" class="telArea" slot="configSlot"> <div v-if="editForm.receiveRule === 1 || editForm.receiveRule === 4" class="telArea" slot="configSlot">
<label class="receiving" for="">领取条件:</label> <label class="receiving" for="" v-show="editForm.receiveRule !== 4">领取条件:</label>
<el-radio-group @change="resetTextArea" v-model="receiveWay"> <label class="receiving" for="" v-show="editForm.receiveRule === 4">用户手机号:</label>
<el-radio-group v-if="editForm.receiveRule !== 4" @change="resetTextArea" v-model="receiveWay">
<el-radio :label="1">指定手机号</el-radio> <el-radio :label="1">指定手机号</el-radio>
<el-radio :label="2">指定车架号后6位</el-radio> <el-radio :label="2">指定车架号后6位</el-radio>
</el-radio-group> </el-radio-group>
<div style="margin-left:70px;width: calc(100% - 70px);"> <div style="margin-left:70px;width: calc(100% - 70px);">
<el-input @blur="formatPhone" type="textarea" v-model="phone" :placeholder="placeholder"></el-input> <el-input :style="editForm.receiveRule === 4?'margin-top: -22px;margin-left: 8px;':''" @blur="formatPhone" type="textarea" v-model="phone" :placeholder="placeholder"></el-input>
<span class="approval-tip" style="margin-left:0;">客户需准确输入该{{ receiveWay == 1 ? '手机号码' : '车架号后6位' }}才能成功领取</span> <span v-if="editForm.receiveRule !== 4" class="approval-tip" style="margin-left:0;">客户需准确输入该{{ receiveWay == 1 ? '手机号码' : '车架号后6位' }}才能成功领取</span>
<div> <div :style="editForm.receiveRule === 4?'margin-left: 7px;':''">
<div :class="['tel-item', !item.valid ? 'valid-tel': receiveWay == 1?'realTel':'realNum']" v-for="(item, index) in phoneList" :key="index"> <div :class="['tel-item', !item.valid ? 'valid-tel': receiveWay == 1?'realTel':'realNum']" v-for="(item, index) in phoneList" :key="index">
{{ item.tel }} {{ item.tel }}
<i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i> <i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i>
...@@ -69,9 +70,29 @@ ...@@ -69,9 +70,29 @@
</div> </div>
</div> </div>
</div> </div>
<span slot="bubble">
<el-popover placement="top-start" width="200" trigger="hover" content="创建礼包时指定好领取条件,客户需正确输入领取条件方可成功领取">
<i slot="reference" class="el-icon-question" style="color: #C6C6C6;"></i>
</el-popover>
</span>
<span slot="giveAway">
<el-popover placement="top-start" width="200" trigger="hover" content="员工在每次发送礼包给客户之前,需设置好领取条件,客户需正确输入领取条件方可成功领取">
<i slot="reference" class="el-icon-question" style="color: #C6C6C6;"></i>
</el-popover>
</span>
<span slot="receives">
<el-popover placement="top-start" width="200" trigger="hover" content="客户无需输入任何领取条件,即可直接领取礼包">
<i slot="reference" class="el-icon-question" style="color: #C6C6C6;"></i>
</el-popover>
</span>
<span slot="cardHolder">
<el-popover placement="top-start" width="200" trigger="hover" content="将根据手机号直接发送至小程序客户的卡包当中,客户无需领取">
<i slot="reference" class="el-icon-question" style="color: #C6C6C6;"></i>
</el-popover>
</span>
<!-- <div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '1' ? '手机号' : '车架号后6位' }}才能成功领取</div> --> <!-- <div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '1' ? '手机号' : '车架号后6位' }}才能成功领取</div> -->
<el-button slot="selectStaffBtn" :disabled="routeInfo.receivedStock" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button> <el-button slot="selectStaffBtn" :disabled="routeInfo.receivedStock" 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 && editForm.grantType == 1"> <div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0 && editForm.receiveRule !== 4">
<div :key="key" class="el-input-tag input-tag-wrapper"> <div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :closable="!routeInfo.receivedStock" :disable-transitions="false" @close="handleStaffRemove(tag, idx)"> <el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :closable="!routeInfo.receivedStock" :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
...@@ -79,14 +100,6 @@ ...@@ -79,14 +100,6 @@
</el-tag> </el-tag>
</div> </div>
</div> </div>
<div class="approval" slot="grantType">
<el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.grantType" :label="1">否</el-radio>
<el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.grantType" :label="2">是</el-radio>
<p class="grantType-tip">(根据手机号将礼包中的优惠券直接发放到小程序对应账户的卡包中)</p>
</div>
<div class="approval" slot="receiveDetails">
<phoneArea :phones="phones" :phoneLists="phoneLists" ref="phoneArea" @changePhoneList="changePhoneList" placeholder="请输入领取手机号,多个手机号以换行隔开" />
</div>
</glsx-combi-form> </glsx-combi-form>
<div v-if="routeInfo.addOrEdit != 'add'" class="approval_note_container"> <div v-if="routeInfo.addOrEdit != 'add'" class="approval_note_container">
<div class="line"></div> <div class="line"></div>
...@@ -102,28 +115,23 @@ ...@@ -102,28 +115,23 @@
</div> </div>
</div> </div>
</div> </div>
<GLFooter> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button @click="handleCancel" size="medium">取消</el-button> <el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">提交</el-button> <el-button type="primary" @click="handleConfirm">提交</el-button>
</GLFooter> </div>
<select-gift-dialog v-if="isSelectGiftVisible" :isSelectGiftVisible="isSelectGiftVisible" :selectedGiftList="selectedGiftList" @handleGiftConfirm="handleGiftConfirm" @handleGiftClose="handleGiftClose"></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 './selectGiftDialog.vue' import selectGiftDialog from './selectGiftDialog.vue'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import phoneArea from './components/phone-area'
export default { export default {
name: 'editGift', name: 'editGift',
data() { data() {
return { return {
phones:'',
phoneLists:[],
phone: '', phone: '',
arr:[],
isLoaded: true, isLoaded: true,
loading:false, loading:false,
phoneList: [], phoneList: [],
...@@ -133,6 +141,8 @@ export default { ...@@ -133,6 +141,8 @@ export default {
add: '新增礼包', add: '新增礼包',
edit: '编辑礼包' edit: '编辑礼包'
}, },
footerLeft: '0',
footerWidth: '0',
// 选择员工弹窗 // 选择员工弹窗
isMutiSelectVisible: false, isMutiSelectVisible: false,
searchStaffForm: {}, searchStaffForm: {},
...@@ -160,8 +170,7 @@ export default { ...@@ -160,8 +170,7 @@ export default {
couponList: [], couponList: [],
stock: 1, stock: 1,
approveFlag: 1, approveFlag: 1,
receiveRule: 1, receiveRule: 1
grantType: 1,
}, },
totalEstimatedCost: '', totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'], orderShow: ['service', 'cash', 'discount', 'exchange'],
...@@ -219,17 +228,7 @@ export default { ...@@ -219,17 +228,7 @@ export default {
} }
], ],
approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }], approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }],
receiveRule: [{ required: true, message: '请选择领取规则设置', trigger: 'change' }], receiveRule: [{ required: true, message: '请选择领取规则设置', trigger: 'change' }]
grantType: [{ required: true, message: '', trigger: 'change' }],
receiveDetails: [
{
required: true,
validator: (rule, value, callback) => {
return this.$refs.phoneArea.phones ? callback() : callback(new Error('请输入用户手机号'))
},
trigger: 'change'
}
]
// receiveDetails: [ // receiveDetails: [
// { required: true, message: '请输入领取条件', trigger: 'change' }, // { required: true, message: '请输入领取条件', trigger: 'change' },
// { // {
...@@ -280,16 +279,10 @@ export default { ...@@ -280,16 +279,10 @@ export default {
addHtml: 'couponListBlock' addHtml: 'couponListBlock'
}, },
{ {
label: '立即发至卡包',
name: 'grantType',
isDisabled: false,
addHtml: 'grantType'
},
{
label: '库存数量', label: '库存数量',
name: 'stock', name: 'stock',
addHtml: 'stockNumInput', addHtml: 'stockNumInput',
isDisabled: false, isHide: false,
}, },
{ {
label: '审批要求', label: '审批要求',
...@@ -304,23 +297,33 @@ export default { ...@@ -304,23 +297,33 @@ export default {
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName',
isDisabled: false, isDisabled: false,
isHide: false,
optionList: [ optionList: [
{ {
confId: 1, confId: 1,
confName: '创建时指定' confName: '创建时指定',
suffixSonSlot: 'bubble'
}, },
{ {
confId: 2, confId: 2,
confName: '员工赠送时指定', confName: '员工赠送时指定',
suffixSonSlot: 'giveAway'
}, },
{ {
confId: 3, confId: 3,
confName: '直接领取' confName: '直接领取',
suffixSonSlot: 'receives'
},
{
confId: 4,
confName: '直接发送到小程序卡包',
suffixSonSlot: 'cardHolder'
} }
], ],
suffixSlot: 'configSlot', suffixSlot: 'configSlot',
handleRadioChange: () => { handleRadioChange: (e) => {
if(e==4){
this.receiveWay = 1
}
this.resetTextArea() this.resetTextArea()
} }
}, },
...@@ -367,12 +370,6 @@ export default { ...@@ -367,12 +370,6 @@ export default {
addHtml: 'staffListBlock' addHtml: 'staffListBlock'
}, },
{ {
label: '用户手机号',
name: 'receiveDetails',
addHtml: 'receiveDetails',
isHide: true
},
{
label: '赠送原因', label: '赠送原因',
name: 'giveReason', name: 'giveReason',
type: 'input', type: 'input',
...@@ -394,10 +391,8 @@ export default { ...@@ -394,10 +391,8 @@ export default {
}, },
components: { components: {
selectStaffDialog, selectStaffDialog,
selectGiftDialog, selectGiftDialog
phoneArea
}, },
watch: { watch: {
editForm: { editForm: {
handler(val) { handler(val) {
...@@ -415,17 +410,13 @@ export default { ...@@ -415,17 +410,13 @@ export default {
this.isChangePeople = this.judgeAddOrDel(val, this.currentPeople, 'staffUUID') this.isChangePeople = this.judgeAddOrDel(val, this.currentPeople, 'staffUUID')
} }
}, },
'editForm.grantType'(newValue) { 'editForm.receiveRule'(newValue) {
let idx = this.editFormData.findIndex(item => item.name == 'staffList') let idx = this.editFormData.findIndex(item => item.name == 'staffList')
let idxx = this.editFormData.findIndex(item => item.name == 'approveFlag') let idxx = this.editFormData.findIndex(item => item.name == 'approveFlag')
let idxxx = this.editFormData.findIndex(item => item.name == 'receiveRule') let idxxx = this.editFormData.findIndex(item => item.name == 'stock')
let idxxxx = this.editFormData.findIndex(item => item.name == 'receiveDetails') this.editFormData[idx].isHide = newValue == 4
let idxxxxx = this.editFormData.findIndex(item => item.name == 'stock') this.editFormData[idxx].isHide = newValue == 4
this.editFormData[idx].isHide = newValue == 2 this.editFormData[idxxx].isHide = newValue == 4
this.editFormData[idxx].isHide = newValue == 2
this.editFormData[idxxx].isHide = newValue == 2
this.editFormData[idxxxxx].isHide = newValue == 2
this.editFormData[idxxxx].isHide = newValue == 1
}, },
}, },
computed: { computed: {
...@@ -433,9 +424,9 @@ export default { ...@@ -433,9 +424,9 @@ export default {
return `请输入领取${this.receiveWay == 1 ? '手机号' : '车架号后6位'},多个${this.receiveWay == 1 ? '手机号' : '车架号'}以换行符隔开` return `请输入领取${this.receiveWay == 1 ? '手机号' : '车架号后6位'},多个${this.receiveWay == 1 ? '手机号' : '车架号'}以换行符隔开`
} }
}, },
mounted() { mounted() {
this.setMinHeight() this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
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]
...@@ -451,12 +442,7 @@ export default { ...@@ -451,12 +442,7 @@ export default {
}) })
} }
}, },
methods: { methods: {
changePhoneList(val,v){
this.phoneLists = val
this.phones = v
},
resetTextArea() { resetTextArea() {
this.phone = '' this.phone = ''
this.phoneList = [] this.phoneList = []
...@@ -507,18 +493,11 @@ export default { ...@@ -507,18 +493,11 @@ 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.editForm.grantType = res.data.grantType || 1
this.receiveWay = res.data.receiveWay || 1 this.receiveWay = res.data.receiveWay || 1
if (res.data && res.data.receiveDetails && res.data.grantType == 1) { if (res.data && res.data.receiveDetails) {
this.phone = res.data.receiveDetails.replaceAll(',', '\n') this.phone = res.data.receiveDetails.replaceAll(',', '\n')
this.formatPhone() this.formatPhone()
} }
if(res.data.receiveDetails && res.data.grantType == 2) {
this.phones = res.data.receiveDetails.replaceAll(',','\n')
setTimeout(() => {
this.$refs.phoneArea.formatPhone()
},50)
}
this.recoveryCoupon() this.recoveryCoupon()
this.recoveryTotalPrice() this.recoveryTotalPrice()
this.hasStaffBlock(false) this.hasStaffBlock(false)
...@@ -531,7 +510,6 @@ export default { ...@@ -531,7 +510,6 @@ export default {
this.isLoaded = true this.isLoaded = true
}) })
}, },
recoveryCoupon() { recoveryCoupon() {
this.orderShow.forEach(item => { this.orderShow.forEach(item => {
this.couponObj[item].list = [] this.couponObj[item].list = []
...@@ -544,7 +522,6 @@ export default { ...@@ -544,7 +522,6 @@ export default {
this.currentPeople = this.$common.utils.deepClone(this.editForm.staffList) this.currentPeople = this.$common.utils.deepClone(this.editForm.staffList)
this.hasCouponBlock(false) this.hasCouponBlock(false)
}, },
// 用来判断券和发放员工是否有增删 type: id为礼券 staffUUID为发放员工 // 用来判断券和发放员工是否有增删 type: id为礼券 staffUUID为发放员工
judgeAddOrDel(newArr, oldArr, type = 'id') { judgeAddOrDel(newArr, oldArr, type = 'id') {
let id1 = [], let id1 = [],
...@@ -558,13 +535,11 @@ export default { ...@@ -558,13 +535,11 @@ export default {
let flag = id1.length === id2.length && id1.sort().toString() === id2.sort().toString() let flag = id1.length === id2.length && id1.sort().toString() === id2.sort().toString()
return flag return flag
}, },
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 == '1' ? '请输入领取手机号' : '请输入领取车架号后6位' this.editFormData[receiveDetailsIdx].placeholder = val == '1' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6 this.editFormData[receiveDetailsIdx].maxlength = val == '1' ? 11 : 6
}, },
// 计算预估成本 // 计算预估成本
recoveryTotalPrice() { recoveryTotalPrice() {
this.totalEstimatedCost = 0 this.totalEstimatedCost = 0
...@@ -578,13 +553,11 @@ export default { ...@@ -578,13 +553,11 @@ export default {
}) })
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2) this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
}, },
hasCouponBlock(isValidate = true) { hasCouponBlock(isValidate = true) {
var idx = this.editFormData.findIndex(item => item.name == 'couponListBlock') var idx = this.editFormData.findIndex(item => item.name == 'couponListBlock')
this.editFormData[idx].isHide = !this.editForm.couponList.length this.editFormData[idx].isHide = !this.editForm.couponList.length
isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('couponList') isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('couponList')
}, },
// 礼包 // 礼包
recoveryGiftList() { recoveryGiftList() {
this.editForm.couponList = [] this.editForm.couponList = []
...@@ -595,51 +568,43 @@ export default { ...@@ -595,51 +568,43 @@ export default {
}) })
this.hasCouponBlock() this.hasCouponBlock()
}, },
handleGiftAdd() { handleGiftAdd() {
// console.log(this.couponObj, '')
this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj)) this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose() this.handleGiftClose()
}, },
handleGiftConfirm(selectedData) { handleGiftConfirm(selectedData) {
this.handleGiftClose() this.handleGiftClose()
this.couponObj = selectedData this.couponObj = selectedData
this.recoveryTotalPrice() this.recoveryTotalPrice()
this.recoveryGiftList() this.recoveryGiftList()
}, },
handleGiftClose() { handleGiftClose() {
this.isSelectGiftVisible = !this.isSelectGiftVisible this.isSelectGiftVisible = !this.isSelectGiftVisible
}, },
handleGiftDelete(attr, idx) { handleGiftDelete(attr, idx) {
if (this.routeInfo.receivedStock) return if (this.routeInfo.receivedStock) return
this.couponObj[attr].list.splice(idx, 1) this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice() this.recoveryTotalPrice()
this.recoveryGiftList() this.recoveryGiftList()
}, },
handleStaffRemove(val, idx) { handleStaffRemove(val, idx) {
this.editForm.staffList.splice(idx, 1) this.editForm.staffList.splice(idx, 1)
this.hasStaffBlock() this.hasStaffBlock()
this.key = new Date() this.key = new Date()
}, },
hasStaffBlock(isValidate = true) { 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
isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('staffList') isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('staffList')
}, },
handleSelectStaff() { handleSelectStaff() {
this.selectedStaffList = JSON.parse(JSON.stringify(this.editForm.staffList)) this.selectedStaffList = JSON.parse(JSON.stringify(this.editForm.staffList))
this.handleMutiSelectClose() this.handleMutiSelectClose()
}, },
handleMutiSelectClose() { handleMutiSelectClose() {
this.isMutiSelectVisible = !this.isMutiSelectVisible this.isMutiSelectVisible = !this.isMutiSelectVisible
}, },
handleMutiSelectConfirm(selectedData) { handleMutiSelectConfirm(selectedData) {
this.editForm.staffList = [] this.editForm.staffList = []
selectedData.forEach(item => { selectedData.forEach(item => {
...@@ -651,18 +616,11 @@ export default { ...@@ -651,18 +616,11 @@ export default {
this.hasStaffBlock() this.hasStaffBlock()
this.handleMutiSelectClose() this.handleMutiSelectClose()
}, },
handleConfirm() { handleConfirm() {
let validItem = this.phoneList.find(item => !item.valid) let validItem = this.phoneList.find(item => !item.valid)
if (validItem && validItem.tel && this.editForm.grantType == 1) { if (validItem && validItem.tel) {
return this.$message.error(`${this.receiveWay == 1 ? '手机号' : '车架号'}${validItem.tel}格式错误,请修改!`) return this.$message.error(`${this.receiveWay == 1 ? '手机号' : '车架号'}${validItem.tel}格式错误,请修改!`)
} }
if(this.editForm.grantType == 2){
let validItems = this.$refs.phoneArea.phoneLists.find(item => !item.valid)
if (validItems && validItems.tel) {
return this.$message.error(`手机号格式错误,请修改!`)
}
}
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)
...@@ -671,7 +629,7 @@ export default { ...@@ -671,7 +629,7 @@ export default {
params.couponCreateRequests.forEach(item => { params.couponCreateRequests.forEach(item => {
item.couponId = item.id item.couponId = item.id
}) })
if (this.editForm.receiveRule == 1 && this.editForm.grantType == 1) { 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)
let maxLength = 500 let maxLength = 500
if(params.receiveDetailList && params.receiveDetailList.length > maxLength){ if(params.receiveDetailList && params.receiveDetailList.length > maxLength){
...@@ -683,17 +641,12 @@ export default { ...@@ -683,17 +641,12 @@ export default {
delete params.couponList delete params.couponList
if (this.routeInfo.addOrEdit == 'edit') { if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id params.id = this.routeInfo.id
if (this.editForm.receiveRule == 2 && this.editForm.grantType == 1) { if (this.editForm.receiveRule == 2) {
let telArr = [] let telArr = []
this.editForm.receiveDetails && (telArr = this.editForm.receiveDetails.split(',')) this.editForm.receiveDetails && (telArr = this.editForm.receiveDetails.split(','))
params.receiveDetailList = [...telArr] params.receiveDetailList = [...telArr]
} }
} }
if(this.editForm.grantType == 2) {
let phoneLists = this.$refs.phoneArea.phoneLists
params.receiveDetailList = phoneLists.map(item => item.tel)
params.receiveWay = this.receiveWay
}
params.requestSource = 1 params.requestSource = 1
// 插入判断是否存在审批模板 // 插入判断是否存在审批模板
// const { session } = this.$globalState // const { session } = this.$globalState
...@@ -1002,10 +955,4 @@ export default { ...@@ -1002,10 +955,4 @@ export default {
} }
} }
} }
.grantType-tip { </style>
display: inline;
font-size: 12px;
color: #999;
margin-left: -27px;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -42,15 +42,11 @@ ...@@ -42,15 +42,11 @@
{{ editForm.approveFlag == 1 ? '赠送前需审批' : '无需审批' }} {{ editForm.approveFlag == 1 ? '赠送前需审批' : '无需审批' }}
</div> </div>
<div slot="receiveDetails"> <div slot="receiveDetails">
<span v-if="editForm.receiveRule != 1">{{ editForm.receiveRule == 2 ? '员工赠送时指定' : '直接领取' }}</span> <span v-if="editForm.receiveRule != 1 && editForm.receiveRule != 4">{{ editForm.receiveRule == 2 ? '员工赠送时指定' : '直接领取' }}</span>
<span v-if="editForm.receiveRule == 2 && editForm.receiveWay && editForm.receiveDetails">{{ `${editForm.receiveWay == '1' ? '手机号:' : '车架号后6位:'}${editForm.receiveDetails}` }}</span> <span v-if="editForm.receiveRule == 2 && editForm.receiveWay && editForm.receiveDetails">{{ `${editForm.receiveWay == '1' ? '手机号:' : '车架号后6位:'}${editForm.receiveDetails}` }}</span>
<span v-if="editForm.receiveRule == 1">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:</span> <span v-if="editForm.receiveRule == 1">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:</span>
<div v-if="editForm.receiveRule == 1" class="phone-wrap"> <span v-if="editForm.receiveRule == 4">用户手机号:</span>
<span :class="['phone', editForm.receiveWay == 1 ? 'realTel' : 'realNum']" v-for="(item, id) in receiveDetailList" :key="id">{{ item }}</span> <div v-if="editForm.receiveRule == 1 || editForm.receiveRule == 4" class="phone-wrap">
</div>
</div>
<div slot="phones">
<div v-if="receiveDetailList" class="phone-wrap">
<span :class="['phone', editForm.receiveWay == 1 ? 'realTel' : 'realNum']" v-for="(item, id) in receiveDetailList" :key="id">{{ item }}</span> <span :class="['phone', editForm.receiveWay == 1 ? 'realTel' : 'realNum']" v-for="(item, id) in receiveDetailList" :key="id">{{ item }}</span>
</div> </div>
</div> </div>
...@@ -153,7 +149,6 @@ export default { ...@@ -153,7 +149,6 @@ export default {
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }], staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }], approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }],
stock: [{ required: true, message: '请选择库存数量', trigger: 'change' }], stock: [{ required: true, message: '请选择库存数量', trigger: 'change' }],
phones: [{ required: true, message: '请选择用户手机号', trigger: 'change' }]
}, },
isEdit: true, isEdit: true,
editFormData: [ editFormData: [
...@@ -187,8 +182,7 @@ export default { ...@@ -187,8 +182,7 @@ export default {
{ {
label: '领取规则', label: '领取规则',
name: 'receiveWay', name: 'receiveWay',
addHtml: 'receiveDetails', addHtml: 'receiveDetails'
isHide: false
}, },
{ {
label: '发放员工', label: '发放员工',
...@@ -196,12 +190,6 @@ export default { ...@@ -196,12 +190,6 @@ export default {
addHtml: 'staffListBlock' addHtml: 'staffListBlock'
}, },
{ {
label: '用户手机号',
name: 'phones',
addHtml: 'phones',
isHide: true
},
{
label: '赠送原因', label: '赠送原因',
name: 'giveReason', name: 'giveReason',
type: 'showTxt' type: 'showTxt'
...@@ -229,15 +217,11 @@ export default { ...@@ -229,15 +217,11 @@ export default {
res.data.createdDate = dayjs(res.data.createdDate).format('YYYY-MM-DD HH:mm:ss') res.data.createdDate = dayjs(res.data.createdDate).format('YYYY-MM-DD HH:mm:ss')
res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss') res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss')
this.editForm = res.data this.editForm = res.data
if(res?.data?.grantType==2){ if(res?.data?.receiveRule==4){
let target = this.editFormData.find(item => item.name == 'stock') let target = this.editFormData.find(item => item.name == 'stock')
let targets = this.editFormData.find(item => item.name == 'approveFlag') let targets = this.editFormData.find(item => item.name == 'approveFlag')
let targetss = this.editFormData.find(item => item.name == 'receiveWay')
let targetsss = this.editFormData.find(item => item.name == 'phones')
target.isHide = true target.isHide = true
targets.isHide = true targets.isHide = true
targetss.isHide = true
targetsss.isHide = false
} }
let arr = [] let arr = []
res.data.receiveDetails && (arr = res.data.receiveDetails.split(',')) res.data.receiveDetails && (arr = res.data.receiveDetails.split(','))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!