Fix:5397 【商城小程序】商品链接,连续快速点击“送给朋友”,重复弹出多个送礼页面
(cherry picked from commit 6d963a5bc0)
This commit is contained in:
@@ -51,6 +51,7 @@ export const chatMixinsV2 = {
|
||||
audioPlayId: '',
|
||||
showGiftBtn: false,
|
||||
buyLoading: false,
|
||||
buyActionLock: false,
|
||||
exceptionConfig: {
|
||||
model_exception: '您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!',
|
||||
voice_exception: ''
|
||||
@@ -533,6 +534,10 @@ export const chatMixinsV2 = {
|
||||
this.productItemBuyNowOrGiftBuy(item, 2)
|
||||
},
|
||||
productItemBuyNowOrGiftBuy(item, BuyNowOrGiftBuyType) {
|
||||
if (this.buyActionLock) {
|
||||
return
|
||||
}
|
||||
this.buyActionLock = true
|
||||
this.audioStopHandle()
|
||||
this.cart_num = 1
|
||||
this.m_id = item.id
|
||||
@@ -540,6 +545,7 @@ export const chatMixinsV2 = {
|
||||
const { data } = res
|
||||
this.storeInfo = {...data.storeInfo}
|
||||
if(data.storeInfo.stock === 0) {
|
||||
this.buyActionLock = false
|
||||
uni.showToast({
|
||||
title: "产品库存不足,请选择其他商品",
|
||||
icon: "none",
|
||||
@@ -577,6 +583,14 @@ export const chatMixinsV2 = {
|
||||
return
|
||||
}
|
||||
this.attr.cartAttr = !this.isOpen ? true : false
|
||||
this.buyActionLock = false
|
||||
}).catch(error => {
|
||||
this.buyActionLock = false
|
||||
uni.showToast({
|
||||
title: error.msg || '操作失败,请稍后重试',
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
},
|
||||
buyNowOrGiftBuyReq(type) {
|
||||
@@ -617,6 +631,7 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
}).finally(() => {
|
||||
_this.buyLoading = false
|
||||
_this.buyActionLock = false
|
||||
})
|
||||
},
|
||||
closeAttrWindow() {
|
||||
|
||||
@@ -398,7 +398,8 @@ export default {
|
||||
pageKeyId: Object.freeze('orderConfirm'),
|
||||
total: 0,
|
||||
couponTitle: '',
|
||||
hasCoupon: false
|
||||
hasCoupon: false,
|
||||
pageQuery: {}
|
||||
}
|
||||
},
|
||||
computed: mapGetters(["userInfo", "storeItems"]),
|
||||
@@ -417,17 +418,18 @@ export default {
|
||||
},
|
||||
onLoad(opts) {
|
||||
const that = this
|
||||
if (that.$yroute.query.pinkid !== undefined) {
|
||||
that.pinkId = that.$yroute.query.pinkid
|
||||
that.pageQuery = Object.assign({}, that.resolvePageQuery(), opts || {})
|
||||
if (that.pageQuery.pinkid !== undefined) {
|
||||
that.pinkId = that.pageQuery.pinkid
|
||||
}
|
||||
if (that.$yroute.query.id !== undefined) {
|
||||
that.cartid = that.$yroute.query.id
|
||||
if (that.pageQuery.id !== undefined) {
|
||||
that.cartid = that.pageQuery.id
|
||||
console.log(that.cartid)
|
||||
}
|
||||
if (that.$yroute.query.lotteryRecordId !== undefined) {
|
||||
that.lotteryRecordId = that.$yroute.query.lotteryRecordId
|
||||
if (that.pageQuery.lotteryRecordId !== undefined) {
|
||||
that.lotteryRecordId = that.pageQuery.lotteryRecordId
|
||||
}
|
||||
that.hasCoupon = opts.couponId !== ''
|
||||
that.hasCoupon = !!(opts && opts.couponId !== '')
|
||||
that.getCartInfo()
|
||||
},
|
||||
onShow() {
|
||||
@@ -452,14 +454,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
isNullOrEmpty,
|
||||
resolvePageQuery() {
|
||||
if (this.$yroute && this.$yroute.query) {
|
||||
return this.$yroute.query
|
||||
}
|
||||
if (this.$route && this.$route.query) {
|
||||
return this.$route.query
|
||||
}
|
||||
if (this._route && this._route.query) {
|
||||
return this._route.query
|
||||
}
|
||||
return {}
|
||||
},
|
||||
isLotteryOrder() {
|
||||
const cartInfo = Array.isArray(this.orderGroupInfo && this.orderGroupInfo.cartInfo)
|
||||
? this.orderGroupInfo.cartInfo
|
||||
: []
|
||||
return Boolean(
|
||||
this.lotteryRecordId ||
|
||||
this.$yroute.query.from === 'countyLottery' ||
|
||||
Number(this.$yroute.query.drawActivityId || 0) > 0 ||
|
||||
this.pageQuery.from === 'countyLottery' ||
|
||||
Number(this.pageQuery.drawActivityId || 0) > 0 ||
|
||||
cartInfo.some(item => Number(
|
||||
item.drawActivityId ||
|
||||
(item.productInfo && item.productInfo.drawActivityId) ||
|
||||
@@ -567,8 +581,8 @@ export default {
|
||||
}
|
||||
_this.systemStore = data.systemStore || {}
|
||||
_this.storeSelfMention = data.storeSelfMention
|
||||
if(_this.$yroute.query.address !== undefined ) {
|
||||
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
|
||||
if(_this.pageQuery.address !== undefined ) {
|
||||
_this.addressInfo = JSON.parse(_this.pageQuery.address) || {}
|
||||
_this.computedPrice()
|
||||
} else {
|
||||
// _this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
|
||||
|
||||
@@ -655,7 +655,8 @@ export default {
|
||||
pageKeyId: '',
|
||||
couponListLimit2ToShow: [],
|
||||
qualifications: [],
|
||||
couponId: null
|
||||
couponId: null,
|
||||
submitActionLock: false
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'location', 'userInfo']),
|
||||
@@ -821,6 +822,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.submitActionLock = false
|
||||
this.getMapData()
|
||||
getGiftCardSendBackground().then(res => {
|
||||
if (res.status === 200) {
|
||||
@@ -1500,6 +1502,10 @@ export default {
|
||||
q.drawActivityId = Number(this.activityId || 0)
|
||||
break
|
||||
}
|
||||
if (that.submitActionLock) {
|
||||
return
|
||||
}
|
||||
that.submitActionLock = true
|
||||
postCartAdd(q).then(function (res) {
|
||||
that.isOpen = false
|
||||
that.attr.cartAttr = false
|
||||
@@ -1511,6 +1517,9 @@ export default {
|
||||
discount: that.storeInfo.discount,
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
that.submitActionLock = false
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
if(news === 2) {
|
||||
@@ -1527,8 +1536,12 @@ export default {
|
||||
// + '&couponId=' + coupId
|
||||
url: giftUrl
|
||||
})
|
||||
setTimeout(() => {
|
||||
that.submitActionLock = false
|
||||
}, 1500)
|
||||
}
|
||||
if(news === 0) {
|
||||
that.submitActionLock = false
|
||||
uni.showToast({
|
||||
title: "添加购物车成功",
|
||||
icon: "success",
|
||||
@@ -1541,6 +1554,7 @@ export default {
|
||||
}
|
||||
}).catch(error => {
|
||||
that.isOpen = false;
|
||||
that.submitActionLock = false
|
||||
uni.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
|
||||
Reference in New Issue
Block a user