修复优惠券使用后del store存储与修复地址删除错误问题

This commit is contained in:
hupeng committed 2024-09-01 18:13:24 +08:00
1 parent 27c4b69cb8
commit a4a895b548
3 files changed
+30 -18

No files matched your search

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