|
@@ -6,32 +6,39 @@
|
|
|
v-for="(item,index) in tabs" :key="index">{{item}}</view>
|
|
|
</view>
|
|
|
<view class="list" v-show="active === 0">
|
|
|
- <view class="item" v-for="(item,index) in 3" :key="index">
|
|
|
- <view class="item-info">
|
|
|
- <image class="img" :src="`${config.BASIC_IMG}home/fruit.png`"></image>
|
|
|
- <view class="cont">
|
|
|
- <up-text bold text="牛乳蜂蜜饼干一份"></up-text>
|
|
|
- <up-text size="12" color="#999999" text="有限期:2025.06.05至2025.06.23"></up-text>
|
|
|
+ <template v-if="giftData.length">
|
|
|
+ <view class="item" v-for="(item,index) in giftData" :key="index">
|
|
|
+ <view class="item-info">
|
|
|
+ <image class="img" :src="item.icon"></image>
|
|
|
+ <view class="cont">
|
|
|
+ <up-text bold :text="item.remark"></up-text>
|
|
|
+ <up-text size="12" color="#999999"
|
|
|
+ :text="`有限期:${item.startDate}至${item.endDate}`"></up-text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <view class="button">去兑换</view>
|
|
|
</view>
|
|
|
- <view class="button">去兑换</view>
|
|
|
- </view>
|
|
|
+ </template>
|
|
|
+ <up-empty v-else mode="list" marginTop="50"></up-empty>
|
|
|
</view>
|
|
|
<view class="list" v-show="active === 1">
|
|
|
- <view class="item" v-for="(item,index) in 3" :key="index">
|
|
|
- <view class="item-info">
|
|
|
- <view class="money">
|
|
|
- <view class="sum"><text class="unit">¥</text>50</view>
|
|
|
- <view class="tips">满100可用</view>
|
|
|
- </view>
|
|
|
- <view class="cont">
|
|
|
- <up-text bold text="仙桃荔全场优惠券"></up-text>
|
|
|
- <up-text bold text="满100减50"></up-text>
|
|
|
- <up-text size="12" color="#999999" text="有限期:2025.06.05至2025.06.23"></up-text>
|
|
|
+ <template v-if="couponData.length">
|
|
|
+ <view class="item" v-for="(item,index) in couponData" :key="index">
|
|
|
+ <view class="item-info">
|
|
|
+ <view class="money">
|
|
|
+ <view class="sum"><text class="unit">¥</text>50</view>
|
|
|
+ <view class="tips">满100可用</view>
|
|
|
+ </view>
|
|
|
+ <view class="cont">
|
|
|
+ <up-text bold text="仙桃荔全场优惠券"></up-text>
|
|
|
+ <up-text bold text="满100减50"></up-text>
|
|
|
+ <up-text size="12" color="#999999" text="有限期:2025.06.05至2025.06.23"></up-text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <view class="button">去使用</view>
|
|
|
</view>
|
|
|
- <view class="button">去使用</view>
|
|
|
- </view>
|
|
|
+ </template>
|
|
|
+ <up-empty v-else mode="coupon" marginTop="50"></up-empty>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -41,17 +48,46 @@
|
|
|
import config from "@/api/config.js"
|
|
|
import {
|
|
|
ref
|
|
|
- } from 'vue';
|
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
-
|
|
|
- onLoad(({type})=>{
|
|
|
- active.value = Number(type)
|
|
|
+ } from 'vue';
|
|
|
+ import {
|
|
|
+ onLoad
|
|
|
+ } from '@dcloudio/uni-app'
|
|
|
+ import MINE from '@/api/mine.js'
|
|
|
+
|
|
|
+ onLoad(({
|
|
|
+ type
|
|
|
+ }) => {
|
|
|
+ active.value = Number(type)
|
|
|
+ handleTab(active.value)
|
|
|
})
|
|
|
|
|
|
+ const giftData = ref([])
|
|
|
+ const getMyGift = () => {
|
|
|
+ MINE.myGift({
|
|
|
+ farmId: 766
|
|
|
+ }).then((res => {
|
|
|
+ giftData.value = res.data.useList.filter(item => item.use === 0)
|
|
|
+ }))
|
|
|
+ }
|
|
|
+
|
|
|
+ const couponData = ref([])
|
|
|
+ const getCouponList = () => {
|
|
|
+ MINE.couponList({
|
|
|
+ farmId: 766
|
|
|
+ }).then((res => {
|
|
|
+ couponData.value = res.data || []
|
|
|
+ }))
|
|
|
+ }
|
|
|
+
|
|
|
const active = ref(0)
|
|
|
const tabs = ["守护兑换", "优惠券"]
|
|
|
const handleTab = (index) => {
|
|
|
active.value = index
|
|
|
+ if (index) {
|
|
|
+ getCouponList()
|
|
|
+ } else {
|
|
|
+ getMyGift()
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -151,10 +187,12 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /* #ifdef H5 */
|
|
|
- .exchange-card{
|
|
|
- height: calc(100vh - 14vh - 88rpx);
|
|
|
- }
|
|
|
- /* #endif */
|
|
|
+
|
|
|
+ /* #ifdef H5 */
|
|
|
+ .exchange-card {
|
|
|
+ height: calc(100vh - 14vh - 88rpx);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* #endif */
|
|
|
}
|
|
|
</style>
|