REFACTOR:礼品功能重构
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user