Commit dd5249cb by 李伟康

commit 修复

1 parent d5658688
......@@ -49,7 +49,8 @@ export default {
data () {
return {
carlist: [],
selectItem: {}
selectItem: {},
clickFlga: false
}
},
watch: {
......@@ -81,6 +82,9 @@ export default {
this.$refs.carBrandListVisible.open()
},
selectCar (e) {
let { clickFlga } = this
if (clickFlga) return
this.clickFlga = true
uni.showLoading()
const customerInfo = this.$store.state.user.customerInfo
customerInfo.carBrand = e.name
......@@ -99,7 +103,11 @@ export default {
uni.hideLoading()
this.carlist = res
this.$refs.carBoxVisible.open()
}).catch(() => uni.hideLoading())
this.clickFlga = false
}).catch(() => {
this.clickFlga = false
uni.hideLoading()
})
},
handleSelect (item) {
this.$refs.carBoxVisible.close();
......
......@@ -245,7 +245,8 @@ export default {
couponId: '',
carInfo: {},
QRURL: '',
showDetail: false
showDetail: false,
clickFlag: false
},
couponErrorTips: '',
refreshKey: Date.now()
......@@ -354,12 +355,14 @@ export default {
},
async createCoupon () {
try {
const { pageParams: { couponId, carInfo }, customerInfo } = this, {
const { pageParams: { clickFlag, couponId, carInfo }, customerInfo } = this, {
shopMerchantId } = uni.$storage.get("userInfo"),
validateStatus = await this.validate(),
checkCouponAmount = await this.checkCouponAmount(couponId, [shopMerchantId])
if (!checkCouponAmount.length) throw '该门店礼券已使用完,请联系管理员配置。'
if (!validateStatus) return
if (clickFlag) return
this.pageParams.clickFlag = true
uni.showLoading()
let { staffName, salesUuid } = customerInfo,
scene = `id=${couponId}&userId=${salesUuid}&employName=${staffName}&merchantId=${shopMerchantId}&customerName=${customerInfo.customerName}&customerPhone=${customerInfo.phoneNumber}`,
......@@ -371,23 +374,25 @@ export default {
scene += `&carChildsBrandId=${carInfo.carChildsBrandId}&carChildsBrandName=${carInfo.carChildsBrandName}&carBrandId=${carInfo.carBrandId}&carBrand=${carInfo.carBrand}&carSeriesId=${carInfo.id}&carSeriesName=${carInfo.name}`
}
params.scene = scene
console.log(scene)
let {
code,
data,
message
} = await uni.$api.commonApi.createQrcode(params)
uni.hideLoading()
if (code == 0) {
if (data) {
this.pageParams.QRURL = data
this.checkCustomerReceivedStatus(dayjs().format("YYYY-MM-DD HH:mm:ss"))
this.$refs.qrbox.open()
uni.hideLoading()
this.pageParams.clickFlag = false
}
else throw '生成小程序码失败,请重试!'
} else throw message
} catch (error) {
uni.hideLoading()
if (error) {
this.pageParams.clickFlag = false
this.couponErrorTips = error
this.$refs.couponTips.open()
}
......@@ -403,6 +408,8 @@ export default {
if (phoneNumber && !phoneRex.test(phoneNumber)) throw '请输入正确的手机号'
if (!couponId) throw '请选择礼券类型'
} catch (error) {
this.pageParams.clickFlag = false
uni.hideLoading()
uni.showToast({
title: error,
icon: 'none',
......@@ -412,6 +419,7 @@ export default {
return flag
},
checkCustomerReceivedStatus (receiveCouponStartTime) {
if(this.pageParams.qrTimer) return
try {
this.pageParams.received = false
this.pageParams.qrTimer = setInterval(async () => {
......
......@@ -120,6 +120,9 @@ export default {
this.init()
},
immediate:true
},
show(){
this.$refs.receptionTips?.close()
}
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!