Commit dd5249cb by 李伟康

commit 修复

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