兑换完成之后返回上一页

This commit is contained in:
wangxiaowei
2026-01-07 16:01:27 +08:00
parent 9b30cd0ce1
commit 9925ffc52d

View File

@ -68,14 +68,14 @@
</template>
<script lang="ts" setup>
import { useMessage } from 'wot-design-uni'
import {toast} from '@/utils/toast'
import { useMessage, useToast } from 'wot-design-uni'
import { checkDouyinCoupon } from '@/api/user'
import { router } from '@/utils/tools'
const OSS = inject('OSS')
const code = ref<string>('')
const message = useMessage('wd-message-box-slot')
const toast = useToast()
// 茶室ID
const storeId = ref<number>(0)
@ -89,12 +89,16 @@
* 扫码
*/
handleScan: () => {
uni.scanCode({
success: async (res) => {
console.log("🚀 ~ res:", res)
if(res.result) {
toast.loading({
loadingType: 'ring',
loadingColor: '#4C9F44',
msg: '兑换中...'
})
code.value = res.result
uni.showLoading({ title: '兑换中...' })
try {
const params = {
store_id: storeId.value,
@ -103,19 +107,19 @@
}
await checkDouyinCoupon(params)
uni.hideLoading()
toast.close()
// 跳转页面
Excharge.handleToExcharge()
} catch (error) {
uni.hideLoading()
toast.close()
return
}
}
},
fail: (err) => {
console.log('scanCode err', err);
}
},
})
},
@ -128,7 +132,11 @@
return
}
uni.showLoading({ title: '兑换中...' })
toast.loading({
loadingType: 'ring',
loadingColor: '#4C9F44',
msg: '兑换中...'
})
try {
const params = {
store_id: storeId.value,
@ -137,12 +145,12 @@
}
await checkDouyinCoupon(params)
uni.hideLoading()
toast.close()
// 跳转页面
Excharge.handleToExcharge()
} catch (error) {
uni.hideLoading()
toast.close()
return
}
},