| | |
| | | <view v-if="item.endTime">有效期至:{{ item.endTime.split(" ")[0] }}</view> |
| | | </view> |
| | | <view class="receive" @click="receive(item)"> |
| | | <text>点击</text><br /> |
| | | <text>{{item.owned ? '已' : '点击'}}</text><br /> |
| | | <text>领取</text> |
| | | </view> |
| | | <view class="bg-quan"> 券 </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import UEmpty from '@/uview-components/uview-ui/components/u-empty/u-empty.vue'; |
| | | import '@/components/uview-components/uview-ui'; |
| | | import { |
| | | receiveCoupons |
| | | } from "@/api/members.js"; |
| | | import { getMemberCoupons } from "@/api/members.js"; |
| | | import { |
| | | getAllCoupons |
| | | } from "@/api/promotions.js"; |
| | | import { getSessionId, userAction } from "@/api/userAction.js"; |
| | | export default { |
| | | components: {UEmpty}, |
| | | data() { |
| | | return { |
| | | loadStatus: "more", //下拉状态 |
| | |
| | | pageSize: 10, |
| | | }, |
| | | storeId: "", //店铺 id, |
| | | couponData: "" |
| | | couponData: "", |
| | | sendOnShow:false, |
| | | pageSessionNo:"", |
| | | actionParam:{ |
| | | sessionId:'', |
| | | actionType:"PAGE", |
| | | joinType:"SELF", |
| | | pageCode:"COUPON_CENTER", |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"LIST" |
| | | } |
| | | }; |
| | | }, |
| | | onUnload() { |
| | | let param = this.actionParam; |
| | | if (this.sendOnShow)return |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | }, |
| | | onHide() { |
| | | this.startHidenTime = Date.now() |
| | | let param = this.actionParam; |
| | | this.sendOnShow = true; |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | }, |
| | | onShow() { |
| | | getSessionId().then(res=>{ |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = this.actionParam; |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | | }) |
| | | }, |
| | | onLoad(option) { |
| | | this.actionParam.pageParams = JSON.stringify(option) |
| | | this.storeId = option.storeId; |
| | | this.getCoupon(); |
| | | }, |
| | |
| | | .catch((err) => { |
| | | if (this.$store.state.isShowToast){ uni.hideLoading() }; |
| | | }); |
| | | console.log(this.couponList) |
| | | }, |
| | | /** |
| | | * 领取优惠券 |
| | |
| | | this.$u.throttle(()=>{ |
| | | this.fetchCoupon(val) |
| | | }, 1500) |
| | | |
| | | }, |
| | | |
| | | fetchCoupon(val){ |
| | | receiveCoupons(val.id).then((res) => { |
| | | if (res.data.code == 200) { |
| | | //修改点击的优惠卷当前的领取状态 |
| | | val.owned = res.data.result.owned; |
| | | console.log(res.data) |
| | | uni.showToast({ |
| | | title: "领取成功", |
| | | icon: "none", |