修复支付按钮启用状态逻辑

修复了在满足支付条件时按钮未正确启用的问题,并优化了相关UI逻辑。
lu_quan_dev
Tuzki 1 year ago
parent 9a0dd1ba58
commit d3fb5a1182
  1. 33
      subPageC/bookTicket/bookTicket.vue

@ -209,8 +209,8 @@
<view class="m-feet-right">
<!-- <button class="m-prime-red" @click.stop="isPayPopup = true">支付</button> -->
<button :hover-class="!ticket.num || ticket.num == 0 ? 'btn-hover' : ''"
:class="['m-prime-red', !ticket.num || ticket.num == 0 ? 'disabled-btn' : '']"
:disabled="!ticket.num || ticket.num == 0" @click.stop="checkOrder('first')">
:class="['m-prime-red', cantClick ? 'disabled-btn' : '']"
:disabled="cantClick" @click.stop="checkOrder('first')">
支付
</button>
</view>
@ -487,6 +487,7 @@ export default {
maxNum: -1,
maxBuyNums: 100,
overSituation: true,//
cantClick:true,
tentId: null,
selected: null, //
startDate: parseTime(new Date()),
@ -1083,6 +1084,7 @@ export default {
console.log(date.price.replace("元", ""))
this.ticket.settlementPrice = parseFloat(date.price.replace("元", "").trim());
this.ticket.num = 1
this.cantClick=false
this.sumPrice = this.ticket.settlementPrice;
this.maxBuyNums = date.inventory == -1 ? 100 : date.inventory
this.$forceUpdate();
@ -1201,10 +1203,13 @@ export default {
},
//
checkOrder(val) {
this.cantClick = true
// if (this.ticket.qmxId == null) {
let that = this;
if (this.ticket.touristInformation == 2) {
if (!this.selectUserList || this.selectUserList.length < 1) {
this.cantClick = false
uni.showToast({ title: "暂无游客信息", icon: "none" });
return;
} else {
@ -1217,10 +1222,12 @@ export default {
this.selectUserList.length <
Number(this.ticket.usersNumber) * Number(this.ticket.num)
) {
this.cantClick = false
uni.showToast({ title: "请填写全部游客信息", icon: "none" });
return;
} else if (this.selectUserList.length >
Number(this.ticket.usersNumber) * Number(this.ticket.num)) {
this.cantClick = false
uni.showToast({ title: "请删除超出的游客信息", icon: "none" });
return;
} else {
@ -1280,6 +1287,7 @@ export default {
let isValid = validateID(that.ticket.visitorInfoList[i].idtype, that.ticket.visitorInfoList[i].idCardNumber);
if (!isValid && this.ticket.ischeckedIdcard == 1) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客${this.labelName(that.ticket.visitorInfoList[i].idtype)}格式错误,请检查!`,
icon: "none"
@ -1288,6 +1296,7 @@ export default {
break;
}
if (this.ticket.ischeckedIdcard == 1 && !that.ticket.visitorInfoList[i].idCardNumber) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客${this.labelName(that.ticket.visitorInfoList[i].idtype)}未输入,请检查!`,
icon: "none"
@ -1296,6 +1305,7 @@ export default {
break;
}
if (this.ticket.ischeckedMobile == 1 && !that.ticket.visitorInfoList[i].phoneNumber) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客手机号未输入,请检查!`,
icon: "none"
@ -1305,6 +1315,7 @@ export default {
}
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if (this.ticket.ischeckedMobile == 1 && !reg.test(that.ticket.visitorInfoList[i].phoneNumber)) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客手机号错误,请检查!`,
icon: "none"
@ -1314,6 +1325,7 @@ export default {
}
}
if (this.hasDuplicateIdcard(that.ticket.visitorInfoList)) {
this.cantClick = false
allValids = false;
uni.showToast({
title: `游客证件号重复,请核对!`,
@ -1361,6 +1373,7 @@ export default {
if (that.ticket.qmxTicketInfoVO.needContactName == true) {
if (!that.bookerusername) {
this.cantClick = false
uni.showToast({
title: '请输入联系人姓名',
icon: 'none'
@ -1371,6 +1384,7 @@ export default {
if (that.ticket.qmxTicketInfoVO.needContactPhone == true) {
if (!that.bookerphone) {
this.cantClick = false
uni.showToast({
title: '请输入联系人手机号',
icon: 'none'
@ -1379,6 +1393,7 @@ export default {
}
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if (reg.test(that.bookerphone) == false) {
this.cantClick = false
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
@ -1389,6 +1404,7 @@ export default {
if (that.ticket.qmxTicketInfoVO.needContactIdCard == true) {
if (!that.bookeridcard) {
this.cantClick = false
uni.showToast({
title: '请输入联系人身份证号',
icon: 'none'
@ -1397,6 +1413,7 @@ export default {
}
const reg = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
if (reg.test(that.bookeridcard) == false) {
this.cantClick = false
uni.showToast({
title: '请输入正确的身份证号',
icon: 'none'
@ -1414,6 +1431,7 @@ export default {
let isValid = validateID(that.ticket.visitorInfoList[i].idtype, that.ticket.visitorInfoList[i].idCardNumber);
if (!isValid && this.ticketIdType != null) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客${this.labelName(that.ticket.visitorInfoList[i].idtype)}格式错误,请检查!`,
icon: "none"
@ -1422,6 +1440,7 @@ export default {
break;
}
if (this.ticketIdType != null && !that.ticket.visitorInfoList[i].idCardNumber) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客${this.labelName(that.ticket.visitorInfoList[i].idtype)}未输入,请检查!`,
icon: "none"
@ -1430,6 +1449,7 @@ export default {
break;
}
if (this.ticket.qmxTicketInfoVO.needVisitorPhone == true && !that.ticket.visitorInfoList[i].phoneNumber) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客手机号未输入,请检查!`,
icon: "none"
@ -1439,6 +1459,7 @@ export default {
}
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if (this.ticket.qmxTicketInfoVO.needVisitorPhone == true && !reg.test(that.ticket.visitorInfoList[i].phoneNumber)) {
this.cantClick = false
uni.showToast({
title: `${i + 1}位游客手机号错误,请检查!`,
icon: "none"
@ -1449,6 +1470,7 @@ export default {
}
if (this.hasDuplicateIdcard(that.ticket.visitorInfoList)) {
allValids = false;
this.cantClick = false
uni.showToast({
title: `游客证件号重复,请核对!`,
icon: "none"
@ -1534,6 +1556,7 @@ export default {
this.isPayPopup = true;
}
else {
this.cantClick = false
uni.showToast({
title: res.msg,
icon: 'none'
@ -1583,6 +1606,7 @@ export default {
e.extraInfo.topInfo.replace("元", "").trim()
);
this.ticket.num = 1
this.cantClick=false
this.sumPrice = this.ticket.settlementPrice;
this.$forceUpdate();
console.log(this.ticket, "this.ticket");
@ -1601,6 +1625,11 @@ export default {
//
changeCount(val, ticket) {
console.log(val, ticket);
if(val == 0){
this.cantClick = true
}else{
this.cantClick = false
}
this.ticket.num = val;
const priceInCents = Math.round(Number(ticket.settlementPrice) * 100);
const quantity = Number(val);

Loading…
Cancel
Save