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