合完了
This commit is contained in:
parent
a1615640c4
commit
df093ceb70
|
@ -94,9 +94,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const flushCouponListHandler = () => {
|
// const flushCouponListHandler = () => {
|
||||||
getMyCouponList()
|
// getMyCouponList()
|
||||||
}
|
// }
|
||||||
|
|
||||||
const getTotalPriceHandler = (val) => {
|
const getTotalPriceHandler = (val) => {
|
||||||
totalAmount = val
|
totalAmount = val
|
||||||
|
@ -107,13 +107,13 @@
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emitter.on('getTotalPrice', getTotalPriceHandler)
|
emitter.on('getTotalPrice', getTotalPriceHandler)
|
||||||
emitter.on('flushCouponList', flushCouponListHandler)
|
// emitter.on('flushCouponList', flushCouponListHandler)
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
uni.removeStorageSync('couponMap')
|
uni.removeStorageSync('couponMap')
|
||||||
emitter.off('getTotalPrice', getTotalPriceHandler)
|
emitter.off('getTotalPrice', getTotalPriceHandler)
|
||||||
emitter.off('flushCouponList', flushCouponListHandler)
|
// emitter.off('flushCouponList', flushCouponListHandler)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,29 +163,31 @@
|
||||||
|
|
||||||
|
|
||||||
const getMyCouponList = async () => {
|
const getMyCouponList = async () => {
|
||||||
couponMap = uni.getStorageSync('couponMap')
|
// couponMap = uni.getStorageSync('couponMap')
|
||||||
console.log('读缓存======================>', couponMap)
|
// console.log('读缓存======================>', couponMap)
|
||||||
if (couponMap) {
|
// if (couponMap) {
|
||||||
if (isShow.value) myCouponList.value = couponMap['可用']
|
// if (isShow.value) myCouponList.value = couponMap['可用']
|
||||||
else myCouponList.value = couponMap['不可用']
|
// else myCouponList.value = couponMap['不可用']
|
||||||
checkedArr.value = new Array(myCouponList.value.length).fill(false)
|
// checkedArr.value = new Array(myCouponList.value.length).fill(false)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
const res = await uni.request({
|
const res = await uni.request({
|
||||||
url: baseUrl + '/coupon/list/all/own',
|
url: baseUrl + '/coupon/list/use',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
header: {
|
header: {
|
||||||
cookie
|
cookie
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
currentAmount: totalAmount
|
currentAmount: totalAmount,
|
||||||
|
isAvailable: isShow.value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log('发请求=====================>', res.data.data)
|
// console.log('发请求=====================>', res.data.data)
|
||||||
couponMap = res.data.data
|
// couponMap = res.data.data
|
||||||
uni.setStorageSync('couponMap', couponMap)
|
// uni.setStorageSync('couponMap', couponMap)
|
||||||
if (isShow.value) myCouponList.value = couponMap['可用']
|
// if (isShow.value) myCouponList.value = couponMap['可用']
|
||||||
else myCouponList.value = couponMap['不可用']
|
// else myCouponList.value = couponMap['不可用']
|
||||||
|
myCouponList.value = res.data.data
|
||||||
checkedArr.value = new Array(myCouponList.value.length).fill(false)
|
checkedArr.value = new Array(myCouponList.value.length).fill(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -413,6 +413,7 @@ const wxPay = async( oid )=> { //传入订单id
|
||||||
showLoading()
|
showLoading()
|
||||||
debounceTimer = setTimeout(async () => {
|
debounceTimer = setTimeout(async () => {
|
||||||
await getMyCouponList()
|
await getMyCouponList()
|
||||||
|
emitter.emit('flushCouponListHandler')
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,6 +455,7 @@
|
||||||
showLoading()
|
showLoading()
|
||||||
debounceTimer = setTimeout(async () => {
|
debounceTimer = setTimeout(async () => {
|
||||||
await getMyCouponList()
|
await getMyCouponList()
|
||||||
|
emitter.emit('flushCouponList')
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,6 +310,7 @@ const updateAddressHandler = (val) => {
|
||||||
showLoading()
|
showLoading()
|
||||||
debounceTimer = setTimeout(async () => {
|
debounceTimer = setTimeout(async () => {
|
||||||
await getMyCouponList()
|
await getMyCouponList()
|
||||||
|
emitter.emit('flushCouponList')
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,6 +452,7 @@
|
||||||
showLoading()
|
showLoading()
|
||||||
debounceTimer = setTimeout(async () => {
|
debounceTimer = setTimeout(async () => {
|
||||||
await getMyCouponList()
|
await getMyCouponList()
|
||||||
|
// emitter.emit('flushCouponList')
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user