Commit dcb938f4 by 前端

Merge branch 'wuwx_dev_v2.7.0' into 'v2.7.0'

Wuwx dev v2.7.0

See merge request !269
2 parents 1952ec13 ece1a919
This diff could not be displayed because it is too large.
...@@ -57,9 +57,6 @@ export default { ...@@ -57,9 +57,6 @@ export default {
this.formatPhone() this.formatPhone()
}, },
formatPhone() { formatPhone() {
this.$nextTick(() => {
setTimeout(() => {
console.log('phones',this.phones);
let phoneLists = this.phones.split('\n') let phoneLists = this.phones.split('\n')
phoneLists = [...new Set(phoneLists)] phoneLists = [...new Set(phoneLists)]
// let phoneLists = this.phones.split(/[\n|\s|,|,]/) // let phoneLists = this.phones.split(/[\n|\s|,|,]/)
...@@ -77,10 +74,7 @@ export default { ...@@ -77,10 +74,7 @@ export default {
}) })
}) })
this.phoneLists = arr.filter(item => item.tel) this.phoneLists = arr.filter(item => item.tel)
console.log('phoneLists',this.phoneLists);
this.$emit('changePhoneList', this.phoneLists) this.$emit('changePhoneList', this.phoneLists)
},100)
})
}, },
} }
} }
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
<div class="approval" slot="approvalSlot"> <div class="approval" slot="approvalSlot">
<!-- <el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio> --> <!-- <el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio> -->
<el-radio disabled v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio> <el-radio v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio>
<p class="approval-tip" style="margin-bottom:12px;">员工在赠送时需提交赠送申请,审批通过后才可赠送</p> <p class="approval-tip" style="margin-bottom:12px;">员工在赠送时需提交赠送申请,审批通过后才可赠送</p>
<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>
...@@ -79,10 +79,12 @@ ...@@ -79,10 +79,12 @@
</el-tag> </el-tag>
</div> </div>
</div> </div>
<div class="approval" slot="cardHolder"> <div class="approval" slot="grantType">
<el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.cardHolder" :label="1">否</el-radio> <el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.grantType" :label="1">否</el-radio>
<el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.cardHolder" :label="2">是</el-radio> <el-radio :disabled="routeInfo.addOrEdit == 'edit'" v-model="editForm.grantType" :label="2">是</el-radio>
<p class="cardHolder-tip">(根据手机号将礼包中的优惠券直接发放到小程序对应账户的卡包中)</p> <p class="grantType-tip">(根据手机号将礼包中的优惠券直接发放到小程序对应账户的卡包中)</p>
</div>
<div class="approval" slot="receiveDetails">
<phoneArea :phones="phones" :phoneLists="phoneLists" ref="phoneArea" placeholder="请输入领取手机号,多个手机号以换行隔开" /> <phoneArea :phones="phones" :phoneLists="phoneLists" ref="phoneArea" placeholder="请输入领取手机号,多个手机号以换行隔开" />
</div> </div>
</glsx-combi-form> </glsx-combi-form>
...@@ -120,7 +122,6 @@ export default { ...@@ -120,7 +122,6 @@ export default {
return { return {
phones:'', phones:'',
phoneLists:[], phoneLists:[],
arrs:'18952120000,18952120001,18952120002,18952120003,18952120004,18952120005,18952120006,18952120007,18952120008,18952120009,',
phone: '', phone: '',
arr:[], arr:[],
isLoaded: true, isLoaded: true,
...@@ -160,9 +161,9 @@ export default { ...@@ -160,9 +161,9 @@ export default {
// 优惠券状态(status):1:未生效,2:生效中,3:已失效 // 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [], couponList: [],
stock: 1, stock: 1,
approveFlag: 2, approveFlag: 1,
receiveRule: 1, receiveRule: 1,
cardHolder: 1, grantType: 1,
}, },
totalEstimatedCost: '', totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'], orderShow: ['service', 'cash', 'discount', 'exchange'],
...@@ -221,7 +222,16 @@ export default { ...@@ -221,7 +222,16 @@ 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' }],
cardHolder: [{ 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' },
// { // {
...@@ -273,12 +283,9 @@ export default { ...@@ -273,12 +283,9 @@ export default {
}, },
{ {
label: '发放到小程序卡包', label: '发放到小程序卡包',
name: 'cardHolder', name: 'grantType',
isDisabled: false, isDisabled: false,
addHtml: 'cardHolder', addHtml: 'grantType'
// style: {
// 'margin-left': '10px'
// }
}, },
{ {
label: '库存数量', label: '库存数量',
...@@ -307,7 +314,6 @@ export default { ...@@ -307,7 +314,6 @@ export default {
{ {
confId: 2, confId: 2,
confName: '员工赠送时指定', confName: '员工赠送时指定',
isDisabled: true
}, },
{ {
confId: 3, confId: 3,
...@@ -362,6 +368,12 @@ export default { ...@@ -362,6 +368,12 @@ export default {
addHtml: 'staffListBlock' addHtml: 'staffListBlock'
}, },
{ {
label: '用户手机号',
name: 'receiveDetails',
addHtml: 'receiveDetails',
isHide: true
},
{
label: '赠送原因', label: '赠送原因',
name: 'giveReason', name: 'giveReason',
type: 'input', type: 'input',
...@@ -404,14 +416,15 @@ export default { ...@@ -404,14 +416,15 @@ export default {
this.isChangePeople = this.judgeAddOrDel(val, this.currentPeople, 'staffUUID') this.isChangePeople = this.judgeAddOrDel(val, this.currentPeople, 'staffUUID')
} }
}, },
'editForm.cardHolder'(newValue) { 'editForm.grantType'(newValue) {
console.log('newValue',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 == 'receiveRule')
let idxxxx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[idx].isHide = newValue == 2 this.editFormData[idx].isHide = newValue == 2
this.editFormData[idxx].isHide = newValue == 2 this.editFormData[idxx].isHide = newValue == 2
this.editFormData[idxxx].isHide = newValue == 2 this.editFormData[idxxx].isHide = newValue == 2
this.editFormData[idxxxx].isHide = newValue == 1
}, },
}, },
computed: { computed: {
...@@ -490,15 +503,17 @@ export default { ...@@ -490,15 +503,17 @@ 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) { if (res.data && res.data.receiveDetails && res.data.grantType == 1) {
this.phone = res.data.receiveDetails.replaceAll(',', '\n') this.phone = res.data.receiveDetails.replaceAll(',', '\n')
this.formatPhone() this.formatPhone()
} }
if(this.arrs) { if(res.data.receiveDetails && res.data.grantType == 2) {
this.editForm.cardHolder = 1 this.phones = res.data.receiveDetails.replaceAll(',','\n')
this.phones = this.arrs.replaceAll(',','\n') setTimeout(() => {
this.$refs.phoneArea.formatPhone() this.$refs.phoneArea.formatPhone()
},50)
} }
this.recoveryCoupon() this.recoveryCoupon()
this.recoveryTotalPrice() this.recoveryTotalPrice()
...@@ -635,15 +650,16 @@ export default { ...@@ -635,15 +650,16 @@ export default {
}, },
handleConfirm() { handleConfirm() {
if(this.arrs) {
setTimeout(() => {
console.log('phoneLists',this.$refs.phoneArea.phoneLists);
},100)
}
let validItem = this.phoneList.find(item => !item.valid) let validItem = this.phoneList.find(item => !item.valid)
if (validItem && validItem.tel) { 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)
...@@ -652,7 +668,7 @@ export default { ...@@ -652,7 +668,7 @@ export default {
params.couponCreateRequests.forEach(item => { params.couponCreateRequests.forEach(item => {
item.couponId = item.id item.couponId = item.id
}) })
if (this.editForm.receiveRule == 1) { if (this.editForm.receiveRule == 1 && this.editForm.grantType == 1) {
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){
...@@ -664,12 +680,17 @@ export default { ...@@ -664,12 +680,17 @@ 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) { if (this.editForm.receiveRule == 2 && this.editForm.grantType == 1) {
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
...@@ -978,7 +999,7 @@ export default { ...@@ -978,7 +999,7 @@ export default {
} }
} }
} }
.cardHolder-tip { .grantType-tip {
display: inline; display: inline;
font-size: 12px; font-size: 12px;
color: #999; color: #999;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!