|
|
@@ -1145,10 +1145,16 @@ export default {
|
|
|
params.deliveryBracketContent = this.selectedDeliveryData.bracketContent // 配送平台括号里的内容
|
|
|
}
|
|
|
let self = this;
|
|
|
- self.$util.confirmModal({content:'确认提交?'},() => {
|
|
|
+ self.$util.confirmModal({content:'确认提交?'}, async () => {
|
|
|
+ let pendingMsg = '';
|
|
|
uni.showLoading({title: '加载中',mask:true})
|
|
|
- createOrder(params).then(res => {
|
|
|
- uni.hideLoading()
|
|
|
+ try {
|
|
|
+ // hideError:避免 luch-request 在 showLoading 期间 showToast 被挡住
|
|
|
+ const res = await createOrder(params, { hideError: true })
|
|
|
+ if (!res || typeof res !== 'object') {
|
|
|
+ pendingMsg = '提交失败,请重试'
|
|
|
+ return
|
|
|
+ }
|
|
|
if(res.code == 1){
|
|
|
this.limitExceedProductId = ''
|
|
|
this.limitExceedLimitBuy = ''
|
|
|
@@ -1156,7 +1162,7 @@ export default {
|
|
|
if(res.data.hasLackError && res.data.hasLackError == 1){
|
|
|
this.lackList = res.data.lackList ? res.data.lackList : []
|
|
|
this.$refs.selectFlowerNumRef.open('center')
|
|
|
- return true
|
|
|
+ return
|
|
|
}
|
|
|
const {orderSn,realPrice,id} = res.data
|
|
|
self.pageTo({url: '/pagesPurchase/wechatPay',query:{orderSn,realPrice,id}, type: 2})
|
|
|
@@ -1164,24 +1170,32 @@ export default {
|
|
|
self.removeMemory(self.ghsInfo.id)
|
|
|
self.resetLimitBuyInfoByType(self.pageType)
|
|
|
}, 600)
|
|
|
- return true
|
|
|
+ return
|
|
|
}
|
|
|
if(res.code == -1 && res.data && String(res.data.productId || '') !== ''){
|
|
|
this.limitExceedProductId = res.data.productId ? String(res.data.productId) : ''
|
|
|
this.limitExceedLimitBuy = res.data.limitBuy ? String(res.data.limitBuy) : '0'
|
|
|
this.limitExceedNum = res.data.exceed ? String(res.data.exceed) : '0'
|
|
|
- this.$msg(res.msg || '累计已超出限购数')
|
|
|
- return false
|
|
|
+ pendingMsg = res.msg || '累计已超出限购数'
|
|
|
+ return
|
|
|
}
|
|
|
this.limitExceedProductId = ''
|
|
|
this.limitExceedLimitBuy = ''
|
|
|
this.limitExceedNum = ''
|
|
|
if(res.msg){
|
|
|
- this.$msg(res.msg)
|
|
|
+ pendingMsg = res.msg
|
|
|
}
|
|
|
- }).catch(() => {
|
|
|
+ } catch (err) {
|
|
|
+ pendingMsg = '提交失败,请重试'
|
|
|
+ } finally {
|
|
|
uni.hideLoading()
|
|
|
- })
|
|
|
+ if (pendingMsg) {
|
|
|
+ // 小程序 hideLoading 后立即 showToast 可能不显示,需短暂延迟
|
|
|
+ setTimeout(() => {
|
|
|
+ self.$msg(pendingMsg)
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
isLimitExceededItem(item){
|