zhaojs
2023-04-27 582f536845628ffb8132aaed1885ee535fcf08ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_util = require("../../common/util.js");
const _sfc_main = {
  data() {
    return {
      getNumData: common_util.getNumData,
      scrollInto: "",
      newsList: [],
      list: [],
      title: "Hello",
      TabCur: 9,
      Cur: 0,
      loadingMore: true,
      lists: [9, 12, 15, 17, 20],
      goodsList: [],
      curHour: 9,
      currentGoodsPage: 1,
      loadingMore: true,
      nomore: false,
      nodata: false
    };
  },
  created() {
    this.GetExplosiveGoodsList(1);
  },
  onLoad(option) {
    let now = new Date();
    let curH = now.getHours();
    this.curHour = curH;
    let index = this.lists.findIndex((i) => {
      return i > curH;
    });
    this.TabCur = this.lists[index];
    this.Cur = index;
  },
  onShareAppMessage: function() {
    return {
      title: "淘券获取",
      path: " /pages/index/index"
      // promise
    };
  },
  onShareTimeline() {
    return {
      title: "淘券获取",
      query: "/pages/index/index"
    };
  },
  methods: {
    GetExplosiveGoodsList(cur) {
      let me = this;
      common_vendor.index.request({
        url: "https://h.ushopvip.com/api/TkProduct/GetExplosiveGoodsList",
        method: "POST",
        data: {
          pageNo: cur,
          pageSize: 100,
          hasCoupon: true
        },
        success(res) {
          var _a;
          if ((_a = res.data) == null ? void 0 : _a.success) {
            me.nodata = false;
            if (res.data.result.length < 100) {
              me.nomore = true;
            }
            if (cur === 1) {
              me.goodsList = res.data.result;
              me.currentGoodsPage = cur;
              me.loadingMore = true;
            } else {
              let data = me.goodsList;
              me.goodsList = data.concat(res.data.result);
              me.currentGoodsPage = cur;
              me.loadingMore = true;
            }
          } else {
            if (cur === 1) {
              me.nodata = true;
            } else {
              me.nodata = false;
            }
          }
        },
        fail(err) {
          console.log("获取openid失败:", err);
        }
      });
    },
    gotogoodDetail(type, id) {
      if (type == 1) {
        common_vendor.index.navigateTo({
          url: "/pages/goodDetail/index?id=" + id
        });
      }
    },
    TabClick(id) {
      for (let i = 0; i < this.lists.length; ++i) {
        if (id === this.lists[i]) {
          this.TabCur = this.lists[i];
          this.Cur = i;
          this.scrollInto = this.lists[i];
        }
      }
    },
    loadMore() {
      this.loadingMore = false;
      this.GetExplosiveGoodsList(this.currentGoodsPage + 1);
    },
    switchTab(e) {
      let cur = e.target.current;
      for (let i = 0; i < this.lists.length; ++i) {
        if (cur === i) {
          this.TabCur = this.lists[i];
          this.Cur = i;
          this.scrollInto = this.lists[i];
        }
      }
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: common_vendor.f($data.goodsList, (item2, index, i0) => {
      return {
        a: item2 == null ? void 0 : item2.mainPic,
        b: common_vendor.t(item2.dtitle),
        c: common_vendor.t(item2.tip),
        d: common_vendor.t(item2.couponPrice),
        e: common_vendor.t(item2.actualPrice),
        f: common_vendor.t(item2.yprice),
        g: common_vendor.t($data.getNumData(item2.monthsale)),
        h: common_vendor.o(($event) => $options.gotogoodDetail(1, item2.goodsId), item2.goodsId),
        i: item2.goodsId
      };
    }),
    b: $data.nodata
  }, $data.nodata ? {} : $data.nomore ? {} : $data.loadingMore && !$data.nomore ? {} : $data.loadingMore == false && !$data.nomore ? {} : {}, {
    c: $data.nomore,
    d: $data.loadingMore && !$data.nomore,
    e: $data.loadingMore == false && !$data.nomore,
    f: common_vendor.o(($event) => $options.loadMore())
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/OPProject/fx_h5_web/pages/madBuy/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);