zhaojs
2023-04-25 f38ca22088b7a0de7e7db316c564b4bf7526f105
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
"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,
      mathf: common_util.mathf,
      scrollInto: "",
      newsList: [],
      list: [],
      title: "",
      TabCur: -1,
      Cur: 0,
      loadingMore: true,
      currentGoodsPage: 1,
      lists: [],
      goodsList: [],
      goodsList1: [],
      goodsList2: [],
      nomore: false,
      nodata: false,
      curstatus: 1
    };
  },
  onShareAppMessage: function() {
    return {
      title: "淘券获取",
      path: "/pages/index/index"
      // promise
    };
  },
  onShareTimeline() {
    return {
      title: "淘券获取",
      query: "/pages/index/index"
    };
  },
  onLoad(option) {
    common_vendor.index.setNavigationBarTitle({
      title: option.title
    });
    this.title = option.title;
    this.setTabbar(option.title);
    this.GetRankingGoodsList(1, option.title, option.title == "整点秒杀" ? "" : -1);
  },
  methods: {
    gotogoodDetail(type, id, record) {
      if (type == 1) {
        let t = this.title == "京东" ? 2 : this.title == "抖音" ? 3 : this.title == "拼多多" ? 4 : "";
        common_vendor.index.navigateTo({
          url: "/pages/goodDetail/index?id=" + id + "&type=" + t + "&info=" + encodeURIComponent(JSON.stringify(record))
        });
      }
    },
    GetRankingGoodsList(cur, title, id) {
      let url = "";
      let param = {
        pageNo: cur,
        pageSize: 20
        // nineCid: id,
      };
      if (title == "9块9包邮") {
        url = "https://h.ushopvip.com/api/TkProduct/GetOpGoodsList";
        param.nineCid = id;
      } else if (title == "折上折") {
        url = "https://h.ushopvip.com/api/TkProduct/GetSupperDiscountGoodsList";
      } else if (title == "每日爆款") {
        url = "https://h.ushopvip.com/api/TkProduct/GetExplosiveGoodsList";
      } else if (title == "整点秒杀") {
        url = "https://h.ushopvip.com/api/TkProduct/GetDdqGoodList";
        param = {
          roundTime: id
        };
      } else if (title == "京东") {
        url = "https://h.ushopvip.com/api/TkJdProduct/GetSearchGoodsList";
      } else if (title == "抖音") {
        url = "https://h.ushopvip.com/api/TkTiktokProduct/GetSxSearchGoodsList";
      } else if (title == "拼多多") {
        url = "https://h.ushopvip.com/api/TkPddProduct/GetPddSearchGoodsList";
      } else if (title == "历史最低") {
        url = "https://h.ushopvip.com/api/TkProduct/GetHistoryLowGoodList";
      } else if (title == "捡漏爆款") {
        url = "https://h.ushopvip.com/api/TkProduct/GetHeightCommissionGoodList";
      }
      let me = this;
      common_vendor.index.request({
        url,
        method: "POST",
        data: param,
        success(res) {
          var _a;
          if ((_a = res.data) == null ? void 0 : _a.success) {
            me.nodata = false;
            if (title == "整点秒杀") {
              let data = res.data.result.data.roundsList.map((item) => {
                let date = item.ddqTime.slice(11, 16);
                if (item.ddqTime == res.data.result.data.ddqTime) {
                  me.curstatus = item.status;
                }
                return {
                  ...item,
                  id: item.ddqTime.replace(" ", ""),
                  name: date
                };
              });
              me.nomore = true;
              me.lists = data;
              me.TabCur = res.data.result.data.ddqTime.replace(" ", "");
              if (cur === 1) {
                me.goodsList = res.data.result.data.goodsList;
                me.currentGoodsPage = cur;
                me.loadingMore = true;
              } else {
                let data2 = me.goodsList;
                me.goodsList = data2.concat(res.data.result.data.goodsList);
                me.currentGoodsPage = cur;
                me.loadingMore = true;
              }
            } else {
              if (res.data.result.length < 20) {
                me.nomore = true;
              }
              let data = res.data.result;
              let data1 = data.filter((i, index) => {
                return index % 2 == 0;
              });
              let data2 = data.filter((i, index) => {
                return index % 2 != 0;
              });
              if (cur === 1) {
                me.goodsList1 = data1;
                me.goodsList2 = data2;
                me.currentGoodsPage = cur;
                me.loadingMore = true;
              } else {
                me.goodsList1 = me.goodsList1.concat(data1);
                me.goodsList2 = me.goodsList2.concat(data2);
                me.currentGoodsPage = cur;
                me.loadingMore = true;
              }
            }
          } else {
            if (cur === 1) {
              me.nodata = true;
            } else {
              me.nodata = false;
            }
          }
        },
        fail(err) {
          console.log("获取openid失败:", err);
        }
      });
    },
    TabClick(id) {
      var _a;
      for (let i = 0; i < this.lists.length; ++i) {
        if (id === this.lists[i].id) {
          this.TabCur = id;
          this.Cur = i;
          this.scrollInto = id;
          this.GetRankingGoodsList(1, this.title, ((_a = this.lists[i]) == null ? void 0 : _a.ddqTime) ?? id);
        }
      }
    },
    loadMore() {
      if (this.title == "整点秒杀") {
        this.nomore = true;
        return;
      }
      this.loadingMore = false;
      this.GetRankingGoodsList(this.currentGoodsPage + 1, this.title);
    },
    setTabbar(title) {
      if (title == "9块9包邮") {
        this.lists = [
          {
            id: -1,
            name: "推荐"
          },
          {
            id: 1,
            name: "3.9元区"
          },
          {
            id: 2,
            name: "9.9元区"
          },
          {
            id: 3,
            name: "19.9元区"
          }
        ];
      } else if (title == "折上折") {
        this.lists = [{
          id: -1,
          name: "推荐"
        }];
      } else if (title == "每日爆款") {
        this.lists = [{
          id: -1,
          name: "推荐"
        }];
      } else
        ;
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  var _a, _b;
  return common_vendor.e({
    a: ((_a = $data.lists) == null ? void 0 : _a.length) > 1
  }, ((_b = $data.lists) == null ? void 0 : _b.length) > 1 ? {
    b: common_vendor.f($data.lists, (item, index, i0) => {
      return common_vendor.e({
        a: common_vendor.t(item.name)
      }, $data.title == "整点秒杀" ? {
        b: common_vendor.t(item.status == 0 ? "已开抢" : item.status == 2 ? "即将开始" : "疯抢中"),
        c: common_vendor.n($data.TabCur == item.id ? "textClick" : "textunClick")
      } : {}, {
        d: "id" + item.id,
        e: "key" + item.id,
        f: index,
        g: common_vendor.n($data.TabCur == item.id ? "textlight" : "textan"),
        h: index,
        i: common_vendor.o(($event) => $options.TabClick(item.id), "key" + item.id)
      });
    }),
    c: $data.title == "整点秒杀",
    d: "id" + $data.scrollInto
  } : {}, {
    e: $data.title == "整点秒杀"
  }, $data.title == "整点秒杀" ? {
    f: common_vendor.f($data.goodsList, (item2, index, i0) => {
      return common_vendor.e({
        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.originalPrice),
        g: common_vendor.t($data.getNumData(item2.monthSales))
      }, $data.curstatus != 2 ? {
        h: common_vendor.o(($event) => $options.gotogoodDetail(1, item2.goodsId, item2), item2.goodsId)
      } : {}, $data.curstatus == 2 ? {} : {}, {
        i: item2.goodsId
      });
    }),
    g: $data.curstatus != 2,
    h: $data.curstatus == 2
  } : {
    i: common_vendor.f($data.goodsList1, (item, index, i0) => {
      return common_vendor.e({
        a: item.mainPic,
        b: item.shopType == 0 || item.shopType == 1
      }, item.shopType == 0 || item.shopType == 1 ? {
        c: item.shopType == 0 ? "https://img.alicdn.com/imgextra/i4/751308485/O1CN01ppfg8j2CYBRpPtb51_!!751308485.png" : "https://img.alicdn.com/imgextra/i4/751308485/O1CN01mKVp3U2CYBRzeHVcG_!!751308485.png"
      } : {}, {
        d: common_vendor.t(item.dtitle),
        e: common_vendor.t(item.actualPrice == "0" ? item.originalPrice : item.actualPrice),
        f: item.actualPrice != "0" && (Number(item.originalPrice) - Number(item.actualPrice) > 0 || item.couponPrice !== "" && item.couponPrice !== "0")
      }, item.actualPrice != "0" && (Number(item.originalPrice) - Number(item.actualPrice) > 0 || item.couponPrice !== "" && item.couponPrice !== "0") ? {
        g: common_vendor.t(item.originalPrice ? $data.mathf.subtract(Number(item.originalPrice), Number(item.actualPrice)) : item.couponPrice)
      } : {}, {
        h: common_vendor.t(item.allsale ? item.allsale > 0 ? item.allsale : 0 : $data.getNumData(item.monthSales ?? item.monthsale) + ($data.getNumData(item.monthSales ?? item.monthsale) > 0 ? "+" : "")),
        i: item.goodsId,
        j: common_vendor.o(($event) => $options.gotogoodDetail(1, item.goodsId, item), item.goodsId)
      });
    }),
    j: common_vendor.f($data.goodsList2, (item, index, i0) => {
      return common_vendor.e({
        a: item.mainPic,
        b: item.shopType == 0 || item.shopType == 1
      }, item.shopType == 0 || item.shopType == 1 ? {
        c: item.shopType == 0 ? "https://img.alicdn.com/imgextra/i4/751308485/O1CN01ppfg8j2CYBRpPtb51_!!751308485.png" : "https://img.alicdn.com/imgextra/i4/751308485/O1CN01mKVp3U2CYBRzeHVcG_!!751308485.png"
      } : {}, {
        d: common_vendor.t(item.dtitle),
        e: common_vendor.t(item.actualPrice == "0" ? item.originalPrice : item.actualPrice),
        f: item.actualPrice != "0" && (Number(item.originalPrice) - Number(item.actualPrice) > 0 || item.couponPrice !== "" && item.couponPrice !== "0")
      }, item.actualPrice != "0" && (Number(item.originalPrice) - Number(item.actualPrice) > 0 || item.couponPrice !== "" && item.couponPrice !== "0") ? {
        g: common_vendor.t(item.originalPrice ? $data.mathf.subtract(Number(item.originalPrice), Number(item.actualPrice)) : item.couponPrice)
      } : {}, {
        h: common_vendor.t(item.allsale ? item.allsale : $data.getNumData(item.monthSales ?? item.monthsale) + ($data.getNumData(item.monthSales ?? item.monthsale) > 0 ? "+" : "")),
        i: item.goodsId,
        j: common_vendor.o(($event) => $options.gotogoodDetail(1, item.goodsId, item), item.goodsId)
      });
    })
  }, {
    k: $data.nodata
  }, $data.nodata ? {} : $data.nomore ? {} : $data.loadingMore && !$data.nomore ? {} : $data.loadingMore == false && !$data.nomore ? {} : {}, {
    l: $data.nomore,
    m: $data.loadingMore && !$data.nomore,
    n: $data.loadingMore == false && !$data.nomore,
    o: common_vendor.n($data.lists.length > 1 ? "scroll-v" : "scroll-v2"),
    p: common_vendor.o(($event) => $options.loadMore())
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/项目/Yfcodes/crm_app_new/pages/index/ability/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);