| | |
| | | <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> |
| | |
| | | <view class="time word-e"> |
| | | {{item.description||''}} |
| | | </view> |
| | | <view class="button" @click="getPointGood(item)"> |
| | | <view class="button" @click="getPointGood(item)" v-if="source!=='shopping'"> |
| | | 查看详情 |
| | | </view> |
| | | <view class="button" @click="updateSelectGood(item)" v-if="source=='shopping'"> |
| | | {{isIngood(item)?'移除':'添加'}} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="tip"> |
| | | <!-- <view class="tip"> |
| | | <span class="t-red">*</span>此券每人限领1张。仅限用于花满芜鲜花交易平台鲜切花花款满额使用,不可与其他优惠同享、不可叠加使用 |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | <!-- <view style="min-height: 130rpx;"></view> --> |
| | | <view style="min-height: 130rpx;" v-if="source=='shopping'"></view> |
| | | <view class="bottom-button" @click="backpage()" v-if="source=='shopping'">返回订单结算</view> |
| | | |
| | | <!-- <view class="bottom-button" @click="toGoodAll">前往兑换</view> --> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | mapState |
| | | } from 'vuex' |
| | | export default { |
| | | computed: { |
| | | ...mapState({ |
| | | cache_goods: state => { |
| | | return state.cache.goods || [] |
| | | }, |
| | | }), |
| | | }, |
| | | |
| | | data() { |
| | | return { |
| | | flg: 0, |
| | |
| | | query: { |
| | | status: 'A' |
| | | }, |
| | | list: [] |
| | | list: [], |
| | | source: '' |
| | | |
| | | } |
| | | }, |
| | | async onLoad() { |
| | | this.listApi = '/api/customer/point/goods/exchange/list' |
| | | onReachBottom() { |
| | | this.getMore() |
| | | }, |
| | | async onLoad(options) { |
| | | if (options.source) { |
| | | this.source = options.source || '' |
| | | } |
| | | if (this.source === 'shopping') { |
| | | //只展示可用的 |
| | | this.page.size = 100 |
| | | this.listApi = '/api/customer/point/goods/exchange/list' |
| | | } else { |
| | | this.listApi = '/api/customer/point/goods/exchange/list' |
| | | } |
| | | |
| | | this.getList() |
| | | }, |
| | | |
| | | methods: { |
| | | isIngood(item) { |
| | | for (var tmp of this.cache_goods) { |
| | | if (tmp.goodsId == item.goodsId) { |
| | | return true |
| | | } |
| | | } |
| | | |
| | | return false |
| | | }, |
| | | async updateSelectGood(item) { |
| | | var has = false |
| | | for (var tmp of this.cache_goods) { |
| | | if (tmp.goodsId == item.goodsId) { |
| | | has = true |
| | | break |
| | | } |
| | | } |
| | | var arr = [] |
| | | |
| | | if (has) { |
| | | //移除 |
| | | var arr = [] |
| | | for (var tmp of this.cache_goods) { |
| | | if (tmp.goodsId == item.goodsId) {} else { |
| | | arr.push(tmp) |
| | | } |
| | | } |
| | | } else { |
| | | //添加 |
| | | for (var tmp of this.cache_goods) { |
| | | arr.push(tmp) |
| | | } |
| | | arr.push(item) |
| | | } |
| | | await this.$store.dispatch('cache_goods_select', arr) |
| | | this.$forceUpdate() |
| | | |
| | | }, |
| | | changeTab(flg) { |
| | | this.flg = '' + flg |
| | | this.query.status = this.tabs[flg].status |
| | |
| | | }, |
| | | getPointGood(item) { |
| | | uni.navigateTo({ |
| | | url: `/sub_pages/customer/coupon/good-detail?id=${item.id}` |
| | | url: `/sub_pages/customer/coupon/good-detail?id=${item.goodsId}` |
| | | }) |
| | | }, |
| | | toGoodAll() { |