diff --git a/yshop-drink-uniapp-vue3/pages/components/pages/address/address.vue b/yshop-drink-uniapp-vue3/pages/components/pages/address/address.vue index 0df6f5a..20c5ee0 100644 --- a/yshop-drink-uniapp-vue3/pages/components/pages/address/address.vue +++ b/yshop-drink-uniapp-vue3/pages/components/pages/address/address.vue @@ -88,25 +88,32 @@ const edit = (id) => { }) } const handleSwipeClick = async(id) => { - let [error, res] = await uni.showModal({ + uni.showModal({ title: '提示', - content: '确定要删除?' - }); - if (res && res.confirm) { - let data = await addressDelete({ - id: id - }); - if (data) { - const index = addresses.value.findIndex(item => item.id == id) - const newaddresses = JSON.parse(JSON.stringify(addresses.value)) - newaddresses.splice(index, 1) - main.SET_ADDRESSES(newaddresses) - uni.showToast({ - title: '删除成功!', - icon: 'success' - }) + content: '确定要删除?', + success: async function (res) { + if (res.confirm) { + let data = await addressDelete({ + id: id + }); + if (data) { + const index = addresses.value.findIndex(item => item.id == id) + const newaddresses = JSON.parse(JSON.stringify(addresses.value)) + newaddresses.splice(index, 1) + main.SET_ADDRESSES(newaddresses) + uni.showToast({ + title: '删除成功!', + icon: 'success' + }) + } + } else if (res.cancel) { + console.log('用户点击取消'); + } } - } + }); + // if (res && res.confirm) { + + // } } const chooseAddress = async(address) => { if (!is_choose.value) { diff --git a/yshop-drink-uniapp-vue3/pages/components/pages/pay/pay.vue b/yshop-drink-uniapp-vue3/pages/components/pages/pay/pay.vue index e5dc7ff..19764bb 100644 --- a/yshop-drink-uniapp-vue3/pages/components/pages/pay/pay.vue +++ b/yshop-drink-uniapp-vue3/pages/components/pages/pay/pay.vue @@ -552,7 +552,9 @@ const pay = async() => { if (!order) { uni.hideLoading(); return; - } + } + + main.DEL_COUPON() if (payType.value == 'weixin') { diff --git a/yshop-drink-uniapp-vue3/store/store.js b/yshop-drink-uniapp-vue3/store/store.js index 1585a04..8eed33a 100644 --- a/yshop-drink-uniapp-vue3/store/store.js +++ b/yshop-drink-uniapp-vue3/store/store.js @@ -30,6 +30,9 @@ export const useMainStore = defineStore('main', { //isLogin: state => Object.keys(state.member).length > 0 //是否登录 }, actions: { + DEL_COUPON() { + this.mycoupon = {} + }, SET_COUPON(coupon) { this.mycoupon = coupon },