REFACTOR:礼品功能重构

This commit is contained in:
LinCyJang
2025-10-24 01:31:50 +08:00
parent 705d64d238
commit d1bbea6e9b
8 changed files with 986 additions and 58 deletions
+31 -4
View File
@@ -1,6 +1,11 @@
<template>
<view v-if="!loading">
<GiftCard v-if="!giftCard.isExpire" :card="giftCard" :addr="giftChooseAddress" @receive="getGiftCard($event)" />
<GiftCard
v-if="!giftCard.isExpire"
:card="giftCard"
:isTravelGroup="isTravelGroup"
:addr="giftChooseAddress"
@receive="getGiftCard($event)" />
<view v-else>
<view class="no-img-wrap">
<view class="wrap-box" >
@@ -15,7 +20,7 @@
<script>
import GiftCard from './components/GiftCard.vue'
import { getGiftCardDetail } from '@/api/gift'
import { getGiftCardDetail, fetchSojoumGroupBuyGiftDetail } from '@/api/gift'
export default {
components: {
GiftCard
@@ -25,11 +30,17 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL,
giftCard: {},
giftChooseAddress: {},
loading: false
loading: false,
isTravelGroup: false
}
},
onLoad(opts) {
this.getGiftCard(opts.code)
this.isTravelGroup = opts.isTravelGroup === '1'
if(opts.isTravelGroup === '1') {
this.getSojoumGroupBuyGiftDetail(opts.code)
} else {
this.getGiftCard(opts.code)
}
},
onShow() {
@@ -47,6 +58,22 @@ export default {
}
},
methods: {
/**
* 获取旅居团购礼品卡订单详情
*/
getSojoumGroupBuyGiftDetail(code) {
fetchSojoumGroupBuyGiftDetail({
code: code
}).then(res => {
this.giftCard = res.data || {}
})
},
/**
* 跳转首页
*/
toHome() {
uni.switchTab({
url: '/pages/home/index'