"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);
|