Commit 529804ff authored by 潘永坪's avatar 潘永坪

组合票联系人处理

parent 18a1c610
......@@ -7,9 +7,9 @@ if(process.env.NODE_ENV === 'development'){//开发环境
}
const request = (url = '', data = {},showLoad) => {
data.reqId = new Date().getTime() //获取时间戳
let show=showLoad||true
let show=showLoad||false
return new Promise((resolve, reject) => {
if(show){
if(!show){
uni.showLoading({
title:'加载中',
mask:true
......
......@@ -45,7 +45,7 @@
<script>
export default {
props: ['editContact','contactTotal'],
props: ['editContactData'],
data() {
return {
showPop: false, //控制组件显示隐藏
......@@ -56,9 +56,8 @@ export default {
}
},
watch: {
editContact: {
editContactData: {
handler(newValue, oldValue) {
console.log(this.reviseContactId)
this.name = newValue.name||''
this.credentialNumber = newValue.credentialNumber||''
this.reviseContactId = newValue.id||''
......
......@@ -344,7 +344,7 @@
:defaultAreaCode="defaultAreaCode"
></chooseArea>
<times ref="times" :chooseTimeList="timeList" @timeConfig="timeConfig" :timeActive="timeActive"></times>
<editContacts ref="editContacts" :editContact="editContact" :contactTotal="contactTotal"></editContacts>
<editContacts ref="editContacts" :editContactData="editContactData"></editContacts>
<contactList
ref="contactList"
:contactTotal="contactTotal"
......@@ -418,7 +418,7 @@ export default {
dateList: [], //日期列表
timeList: [], //时间列表
buyKnowData: '', //购买须知数据
editContact: '', //编辑联系人传值对象
editContactData: '', //编辑联系人传值对象
productId: '', //产品Id
merchantId: '', //商户Id
ticketPhone: '', //联系电话
......@@ -828,7 +828,7 @@ export default {
showEdit(data) {
let obj=data||''
this.$refs.editContacts.showPop = true
this.editContact = obj
this.editContactData = obj
},
//---展示新增联系人,并获取联系人列表
showContacts() {
......@@ -836,23 +836,22 @@ export default {
},
//---游客选择
visitorChoose(i) {
let chooseList = this.chooseContact
let data = this.contactTotal
data[i].ifChoose = !data[i].ifChoose
if (data[i].ifChoose) {
if (chooseList.length == this.contactNum) {
//直接传入item,会造成item.ifChoose值变,但是this.contactTotal[i].ifChoose没变,故选择传入下标
let item = this.contactTotal[i]
item.ifChoose = !item.ifChoose
if (item.ifChoose) {
if (this.chooseContact.length == this.contactNum) {
//需要人数满足时,点击增加联系人时,删除最后一个,增加点击的那个人
chooseList[chooseList.length - 1].ifChoose = false
chooseList.splice(chooseList.length - 1, 1)
this.chooseContact[this.chooseContact.length - 1].ifChoose = false
this.chooseContact.splice(this.chooseContact.length - 1, 1)
}
chooseList.push(data[i]) //加入数组
this.chooseContact.push(item) //加入数组
} else {
let index = chooseList.findIndex(items => {
return items.id == data[i].id
let index = this.chooseContact.findIndex(items => {
return items.id == item.id
})
chooseList.splice(index, 1) //删除数组
this.chooseContact.splice(index, 1) //删除数组
}
this.$forceUpdate()
},
//---订单数量变化
buyNumChange(e) {
......@@ -965,7 +964,7 @@ export default {
merchantId: this.merchantId, //商户Id
openid:this.openid
}
this.$request('wechatUser/myPage/usableCouponList', data).then((res) => {
this.$request('wechatUser/myPage/usableCouponList', data,true).then((res) => {
if (res.code == '00') {
this.couponData = res.data
let masterSlaveCouponList=res.data.masterSlaveCouponList
......@@ -992,7 +991,7 @@ export default {
this.savedMoney=this.chooseCouponObj.savedMoney
} else {
if (res.data.unusableCouponList.length > 0) {
res.data.unusableCouponList.forEach((item, i) => { //没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
res.data.unusableCouponList.forEach((item) => { //没有可用优惠券,有达到条件可以用的优惠券,先显示条件,达到条件时显示可用优惠券
if (item.isProduct == 1) {
this.ableConpon = item
}
......@@ -1143,12 +1142,11 @@ export default {
//下架状态,点击无效
return
}
if (this.productIfo.tripTemplateFlag != 2) {
//需要填写电话号码
if (!this.$commonjs.phoneReg().test(this.ticketPhone) && this.productIfo.tripTemplateFlag != 2) {
//未填写正确手机号码
if (this.productIfo.isFetch == 1 && this.areaUp) {
//需要选择站点的票种,必须选择站点
if (!this.areaObj.areaCode) {
uni.showToast({
title: '请填写正确的手机号码',
title: '请选择站点',
icon: 'none'
})
return
......@@ -1161,25 +1159,6 @@ export default {
})
return
}
if (this.productIfo.tripTemplateFlag == 1) {
//实名制
if (this.chooseContact.length != this.buyNum) {
uni.showToast({
title: '需要添加' + this.buyNum + '位出行人',
icon: 'none'
})
return
}
} else if (this.productIfo.tripTemplateFlag == 0) {
//非实名制
if (this.chooseContact.length < 1) {
uni.showToast({
title: '需要添加一位出行人',
icon: 'none'
})
return
}
}
if (this.productIfo.productType == 3) {
//如果为班次票,需要选择班次
if (this.cruisePlanId == '') {
......@@ -1190,15 +1169,23 @@ export default {
return
}
}
if (this.productIfo.isFetch == 1 && this.areaUp) {
//需要选择站点的票种,必须选择站点
if (!this.areaObj.areaCode) {
uni.showToast({
title: '请选择站点',
icon: 'none'
})
return
}
if (this.chooseContact.length != this.contactNum) {
uni.showToast({
title: '需要添加' + this.contactNum + '位出行人',
icon: 'none'
})
return
}
if (this.productIfo.tripTemplateFlag != 2) {
//需要填写电话号码
if (!this.$commonjs.phoneReg().test(this.ticketPhone) && this.productIfo.tripTemplateFlag != 2) {
//未填写正确手机号码
uni.showToast({
title: '请填写正确的手机号码',
icon: 'none'
})
return
}
}
this.preOrder()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment