"use strict"; const common_vendor = require("../../../common/vendor.js"); const common_util = require("../../../common/util.js"); const common_request = require("../../../common/request.js"); const _sfc_main = { data() { return { getNumData: common_util.getNumData, mathf: common_util.mathf, requestx: common_request.requestx, scrollInto: "", newsList: [], list: [], title: "", TabCur: -1, Cur: 0, loadingMore: true, currentGoodsPage: 1, lists: [], goodsList: [], goodsList1: [], goodsList2: [], nomore: false, nodata: false, curstatus: 1, baseUrl: "" }; }, onShareAppMessage: function() { return { title: "淘券获取", path: "/pages/index/index" // promise }; }, onShareTimeline() { return { title: "淘券获取", query: "/pages/index/index" }; }, onLoad(option) { this.baseUrl = common_vendor.index.getStorageSync("baseUrl"); 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 = "/TkProduct/GetOpGoodsList"; param.nineCid = id; } else if (title == "折上折") { url = "/TkProduct/GetSupperDiscountGoodsList"; } else if (title == "每日爆款") { url = "/TkProduct/GetExplosiveGoodsList"; } else if (title == "整点秒杀") { url = "/TkProduct/GetDdqGoodList"; param = { roundTime: id }; } else if (title == "京东") { url = "/TkJdProduct/GetSearchGoodsList"; } else if (title == "抖音") { url = "/TkTiktokProduct/GetSxSearchGoodsList"; } else if (title == "拼多多") { url = "/TkPddProduct/GetPddSearchGoodsList"; } else if (title == "历史最低") { url = "/TkProduct/GetHistoryLowGoodList"; } else if (title == "捡漏爆款") { url = "/TkProduct/GetHeightCommissionGoodList"; } this.requestx({ url, method: "POST", data: param }).then((res) => { if (res.success) { this.nodata = false; if (title == "整点秒杀") { let data = res.result.data.roundsList.map((item) => { let date = item.ddqTime.slice(11, 16); if (item.ddqTime == res.result.data.ddqTime) { this.curstatus = item.status; } return { ...item, id: item.ddqTime.replace(" ", ""), name: date }; }); this.nomore = true; this.lists = data; this.TabCur = res.result.data.ddqTime.replace(" ", ""); if (cur === 1) { this.goodsList = res.result.data.goodsList; this.currentGoodsPage = cur; this.loadingMore = true; } else { let data2 = this.goodsList; this.goodsList = data2.concat(res.result.data.goodsList); this.currentGoodsPage = cur; this.loadingMore = true; } } else { if (res.result.length < 20) { this.nomore = true; } let data = res.result; let data1 = data.filter((i, index) => { return index % 2 == 0; }); let data2 = data.filter((i, index) => { return index % 2 != 0; }); if (cur === 1) { this.goodsList1 = data1; this.goodsList2 = data2; this.currentGoodsPage = cur; this.loadingMore = true; } else { this.goodsList1 = this.goodsList1.concat(data1); this.goodsList2 = this.goodsList2.concat(data2); this.currentGoodsPage = cur; this.loadingMore = true; } } } }); }, 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 == null ? void 0 : item2.dtitle.length) > 24 ? (item2 == null ? void 0 : item2.dtitle.slice(0, 24)) + "..." : item2 == null ? void 0 : 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 == null ? void 0 : item.dtitle.length) > 24 ? (item == null ? void 0 : item.dtitle.slice(0, 24)) + "..." : item == null ? void 0 : 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 == null ? void 0 : item.dtitle.length) > 24 ? (item == null ? void 0 : item.dtitle.slice(0, 24)) + "..." : item == null ? void 0 : 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", "E:/OPProject/TK_H5_Web/pages/index/ability/index.vue"]]); _sfc_main.__runtimeHooks = 6; wx.createPage(MiniProgramPage);