From e8d258576a34f35cfefbd6bfe07b7f22e72d87d4 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期三, 11 九月 2024 10:42:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/v2' into v2
---
sub_pages/customer/coupon/coupon-self.vue | 56 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/sub_pages/customer/coupon/coupon-self.vue b/sub_pages/customer/coupon/coupon-self.vue
index dacb1f9..23a6e2b 100644
--- a/sub_pages/customer/coupon/coupon-self.vue
+++ b/sub_pages/customer/coupon/coupon-self.vue
@@ -1,6 +1,6 @@
<template>
<view class="coupon-container">
- <view class="p10">
+ <view class="p10" v-if="source!=='shopping'">
<top-tabs :tabs="tabs" :flg="flg" @change="changeTab" type="coupon">
</top-tabs>
@@ -8,7 +8,8 @@
<view class="">
<no-data v-if="!list||list.length==0" style="width: 100%;"></no-data>
- <view v-for="(item,index) of list" :key="index" class="coupont-item" :class="[query.status]">
+ <view v-for="(item,index) of list" :key="index" class="coupont-item" :class="[query.status]"
+ @click="selectCoupon(item)">
<view class="flex container img100">
<view class="info-price">
<view class="price1">
@@ -19,9 +20,12 @@
<view class="info flex1">
<view class="title">
{{item.couponName||'-'}}
+ <radio :checked="cache_coupon.id===item.id" v-if="source==='shopping'" class="select-coupon"></radio>
+
</view>
<view class="time">
- {{item.usageEndDate&&('有效期至:'+item.usageEndDate) || '长久有效'}}
+ {{item.effectiveStart&&(item.effectiveStart+' 生效,') || ''}}
+ {{item.effectiveEnd&&('有效期至 '+item.effectiveEnd) || '长久有效'}}
</view>
</view>
</view>
@@ -31,12 +35,15 @@
</view>
</view>
</view>
- <view style="min-height: 130rpx;"></view>
- <view class="bottom-button" @click="getCoupon">领取优惠券</view>
+ <view style="min-height: 130rpx;" v-if="source!=='shopping'"></view>
+ <view class="bottom-button" v-if="source!=='shopping'" @click="getCoupon">领取优惠券</view>
</view>
</template>
<script>
+ import {
+ mapState
+ } from 'vuex'
export default {
data() {
return {
@@ -63,17 +70,38 @@
query: {
status: 'unused'
},
- list: []
+ list: [],
+ source: ''
+
}
},
- async onLoad() {
- this.listApi = '/api/v2/coupon/app' + `/mine/${this.query.status}/list`
+ async onLoad(options) {
+ if (options.source) {
+ this.source = options.source || ''
+ }
+ if (this.source === 'shopping') {
+ //只展示可用的
+ this.page.size = 100
+ this.listApi = '/api/v2/coupon/app' + `/mine/unused/list`
+
+ } else {
+ this.listApi = '/api/v2/coupon/app' + `/mine/${this.query.status}/list`
+
+ }
await this.$store.dispatch('sign_clear', 'coupon')
this.getList()
},
-
+ onReachBottom() {
+ this.getMore()
+ },
methods: {
+ async selectCoupon(item) {
+ if (this.source == 'shopping') {
+ await this.$store.dispatch('cache_coupon_select', item)
+ uni.navigateBack()
+ }
+ },
changeTab(flg) {
this.flg = '' + flg
this.query.status = this.tabs[flg].status
@@ -97,6 +125,16 @@
uni.stopPullDownRefresh()
},
+ computed: {
+ ...mapState({
+ cache_coupon: state => {
+ return state.cache.coupon || {}
+ },
+ cache_goods: state => {
+ return state.cache.goods || []
+ },
+ }),
+ }
}
</script>
--
Gitblit v1.9.3