绿满眶商城微信小程序-uniapp
peng
1 天以前 d50a3ed44e2edab2a7a661c43491c3aa42c57794
pages/cart/coupon/myCoupon.vue
@@ -97,12 +97,12 @@
              <image
                class="no-icon"
                v-if="navIndex == 1"
                src="@/static/img/used.png"
                src="@/pages/subComponents/static/img/used.png"
              ></image>
              <image
                class="no-icon"
                v-if="navIndex == 2"
                src="@/static/img/overdue.png"
                src="@/pages/subComponents/static/img/overdue.png"
              ></image>
              <view
                class="receive"
@@ -123,13 +123,12 @@
</template>
<script>
import UEmpty from '@/uview-components/uview-ui/components/u-empty/u-empty.vue';
import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue';
import '@/components/uview-components/uview-ui';
import { getMemberCoupons } from "@/api/members.js";
import { getSessionId, userAction } from "@/api/userAction.js";
export default {
  components: {UEmpty,UIcon},
  data() {
    return {
      tabCurrentIndex: 0, //tab栏下标默认为0 未使用
@@ -173,10 +172,44 @@
        },
      ],
      couponList: [], //优惠券列表
     pageSessionNo:"",
     actionParam:{
         sessionId:'',
         actionType:"PAGE",
         joinType:"SELF",
         pageCode:"MY_COUPON",
         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)
  },
  onLoad(options) {
   this.actionParam.pageParams = JSON.stringify(options)
  },
  onShow() {
     getSessionId().then(res=>{
      this.pageSessionNo = res.data.data
      if(this.pageSessionNo){
      let   param = this.actionParam;
         param.sessionId = this.pageSessionNo
         userAction(param)
      }
     })
    this.navList[this.tabCurrentIndex].params.pageNumber = 1;
    this.navList[this.tabCurrentIndex].dataList = [];
    this.getData();
@@ -206,6 +239,7 @@
        title: "加载中",
      });
      let index = this.tabCurrentIndex;
     console.log(this.navList[index].params)
      getMemberCoupons(this.navList[index].params).then((res) => {
        uni.stopPullDownRefresh();
        if (res.data.success) {
@@ -249,9 +283,18 @@
     * 立即使用优惠券
     */
    useItNow(item) {
      uni.navigateTo({
        url: `/pages/navigation/search/searchPage?promotionsId=${item.couponId}&promotionType=COUPON`,
      });
      console.log('优惠卷详情--------------------->',JSON.stringify(item))
      // uni.navigateTo({
      //   url: `/pages/navigation/search/searchPage?promotionsId=${item.couponId}&promotionType=COUPON`,
      // });
     if(item.scopeType ==='PORTION_GOODS'){
        //获取优惠卷对应的商品
        //指定跳转到商品详情页面进行购买
     }
     uni.navigateTo({
        url: `/pages/commodity-square/coups-goods-list?promotionsId=${item.couponId}&promotionType=COUPON`
     });
    },
    /**