"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const common_util = require("../../common/util.js");
|
const _sfc_main = {
|
data() {
|
return {
|
timeHMS: common_util.timeHMS,
|
getNumData: common_util.getNumData,
|
mathf: common_util.mathf,
|
timer: null,
|
newsList: [],
|
list: [],
|
title: "Hello",
|
TabCur: 0,
|
Cur: 0,
|
loadingMore: true,
|
lists: [{
|
cid: 0,
|
cname: "精选",
|
// isopen: true,
|
url: "pages/tabBar/component/component"
|
}],
|
moduleList1: [
|
{
|
id: 1,
|
title: "9块9包邮",
|
imgurl: "https://img.alicdn.com/imgextra/i2/2053469401/O1CN01xWCtV62JJi9b21iQp_!!2053469401.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 2,
|
title: "折上折",
|
imgurl: "https://img.alicdn.com/imgextra/i4/751308485/O1CN01ndxl472CYBRrNzRIL_!!751308485.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 3,
|
title: "每日爆款",
|
imgurl: "https://img.alicdn.com/imgextra/i3/751308485/O1CN015wcJqk2CYBRfcRgpE_!!751308485.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 4,
|
title: "整点秒杀",
|
imgurl: "https://img.alicdn.com/imgextra/i1/2053469401/O1CN01jFhUBl2JJi9OQBQHL_!!2053469401.gif",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 9,
|
title: "历史最低",
|
imgurl: "https://img.alicdn.com/imgextra/i4/751308485/O1CN01I1H3BR2CYBS0mb6rW_!!751308485.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 5,
|
title: "京东",
|
imgurl: "https://img.alicdn.com/imgextra/i2/2053469401/O1CN01Iu2xBJ2JJi9nqIQpb_!!2053469401.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 6,
|
title: "抖音",
|
imgurl: "https://sr.ffquan.cn/cms_pic/20220309/c8k95qi3fg9k53m0g0600.gif",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 7,
|
title: "拼多多",
|
imgurl: "https://img.alicdn.com/imgextra/i2/751308485/O1CN01t7PJKo2CYBRkK09rZ_!!751308485.png",
|
targetUrl: "/pages/index/ability/index"
|
},
|
{
|
id: 8,
|
title: "全网热卖榜",
|
imgurl: "https://img.alicdn.com/imgextra/i1/2053469401/O1CN01g59ZH52JJi9SxWxdF_!!2053469401.gif",
|
targetUrl: "/pages/rankingList/index"
|
},
|
{
|
id: 10,
|
title: "捡漏爆款",
|
imgurl: "https://img.alicdn.com/imgextra/i3/751308485/O1CN01XzeqNu2CYBRz7oZUH_!!751308485.png",
|
targetUrl: "/pages/index/ability/index"
|
}
|
],
|
goodsList: [],
|
showTime: void 0,
|
nowTurn: 9,
|
turnList: [9, 12, 15, 17, 20],
|
currentGoodsPage: 1,
|
scrollInto: "",
|
scrollTop: 0,
|
old: {
|
scrollTop: 0
|
},
|
hotSellList: [],
|
madbuyList: []
|
};
|
},
|
// mounted() {
|
// this.GetRecommendGoodsList(1)
|
// this.GetSuperCategory()
|
// },
|
onShareAppMessage: function() {
|
return {
|
title: "淘券获取",
|
path: "/pages/index/index"
|
// promise
|
};
|
},
|
onShareTimeline() {
|
return {
|
title: "淘券获取",
|
query: "/pages/index/index"
|
};
|
},
|
onLoad() {
|
this.GetRecommendGoodsList(1);
|
this.GetSuperCategory();
|
this.GetRankingGoodsList();
|
this.GetExplosiveGoodsList();
|
},
|
watch: {
|
TabCur: {
|
handler() {
|
this.goTop();
|
common_vendor.index.pageScrollTo({
|
scrollTop: 0
|
});
|
}
|
}
|
},
|
methods: {
|
GetExplosiveGoodsList() {
|
let me = this;
|
common_vendor.index.request({
|
url: "https://h.ushopvip.com/api/TkProduct/GetExplosiveGoodsList",
|
method: "POST",
|
data: {
|
pageNo: 1,
|
pageSize: 2,
|
hasCoupon: true
|
},
|
success(res) {
|
var _a;
|
if ((_a = res.data) == null ? void 0 : _a.success) {
|
me.madbuyList = res.data.result;
|
}
|
},
|
fail(err) {
|
console.log("获取openid失败:", err);
|
}
|
});
|
},
|
GetRankingGoodsList() {
|
let me = this;
|
common_vendor.index.request({
|
url: "https://h.ushopvip.com/api/TkProduct/GetRankingGoodsList",
|
method: "POST",
|
data: {
|
pageNo: 1,
|
pageSize: 2,
|
hasCoupon: true
|
},
|
success(res) {
|
var _a;
|
if ((_a = res.data) == null ? void 0 : _a.success) {
|
me.hotSellList = res.data.result;
|
}
|
},
|
fail(err) {
|
console.log("GetRankingGoodsList失败:", err);
|
}
|
});
|
},
|
getgoodlist(cur, cid) {
|
let me = this;
|
if (cur !== 1 && cur == me.currentGoodsPage) {
|
return;
|
}
|
me.currentGoodsPage = cur;
|
common_vendor.index.request({
|
url: "https://h.ushopvip.com/api/TkProduct/GetCategoryProductList",
|
method: "POST",
|
data: {
|
PageNo: cur,
|
PageSize: 20,
|
cid
|
},
|
success(res) {
|
var _a;
|
if ((_a = res.data) == null ? void 0 : _a.success) {
|
if (cur === 1) {
|
me.goodsList = res.data.result;
|
me.loadingMore = true;
|
} else {
|
let data = me.goodsList;
|
me.goodsList = data.concat(res.data.result);
|
me.loadingMore = true;
|
}
|
}
|
},
|
fail(err) {
|
console.log("GetCategoryProductList失败:", err);
|
}
|
});
|
},
|
GetSuperCategory() {
|
let me = this;
|
common_vendor.index.request({
|
// header:{'Access-Control-Allow-Originle':'*'},
|
url: "https://h.ushopvip.com/api/TkProduct/GetSuperCategory",
|
method: "POST",
|
// data: {},
|
success(res) {
|
var _a;
|
if ((_a = res.data) == null ? void 0 : _a.success) {
|
me.lists = me.lists.concat(res.data.result);
|
}
|
},
|
fail(err) {
|
console.log("GetSuperCategory失败:", err);
|
}
|
});
|
},
|
GetRecommendGoodsList(cur) {
|
let me = this;
|
if (cur !== 1 && cur == me.currentGoodsPage) {
|
return;
|
}
|
me.currentGoodsPage = cur;
|
common_vendor.index.request({
|
// header:{'Access-Control-Allow-Originle':'*'},
|
url: "https://h.ushopvip.com/api/TkProduct/GetRecommendGoodsList",
|
method: "POST",
|
data: {
|
pageNo: cur,
|
pageSize: 20,
|
hasCoupon: true
|
},
|
success(res) {
|
var _a;
|
if ((_a = res.data) == null ? void 0 : _a.success) {
|
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;
|
}
|
}
|
},
|
fail(err) {
|
console.log("GetRecommendGoodsList失败:", err);
|
}
|
});
|
},
|
TabClick(id) {
|
if (this.TabCur == id) {
|
return;
|
}
|
this.goodsList = [];
|
this.currentGoodsPage = 1;
|
for (let i = 0; i < this.lists.length; ++i) {
|
if (id === this.lists[i].cid) {
|
this.lists[i].isopen = true;
|
this.TabCur = this.lists[i].cid;
|
this.Cur = i;
|
this.scrollInto = this.lists[i].cid;
|
common_vendor.index.pageScrollTo({
|
scrollTop: 0
|
});
|
if (i == 0) {
|
this.GetRecommendGoodsList(1);
|
} else {
|
this.getgoodlist(1, this.lists[i].cid);
|
}
|
} else {
|
this.lists[i].isopen = false;
|
}
|
}
|
},
|
scroll: function(e) {
|
this.old.scrollTop = e.detail.scrollTop;
|
},
|
goTop: function(e) {
|
let me = this;
|
me.scrollTop = me.old.scrollTop;
|
me.$nextTick(function() {
|
me.scrollTop = 0;
|
me.old.scrollTop = 0;
|
});
|
},
|
loadMore() {
|
this.loadingMore = false;
|
if (this.Cur == 0) {
|
this.GetRecommendGoodsList(this.currentGoodsPage + 1);
|
} else {
|
this.getgoodlist(this.currentGoodsPage + 1, this.lists[this.Cur].cid);
|
}
|
},
|
switchTab(e) {
|
if (this.Cur == e.target.current) {
|
return;
|
}
|
this.goodsList = [];
|
let cur = e.target.current;
|
for (let i = 0; i < this.lists.length; ++i) {
|
if (cur === i) {
|
this.lists[i].isopen = true;
|
this.TabCur = this.lists[i].cid;
|
this.Cur = i;
|
this.scrollInto = this.lists[i].cid;
|
if (i == 0) {
|
this.GetRecommendGoodsList(1);
|
} else {
|
this.getgoodlist(1, this.lists[i].cid);
|
}
|
} else {
|
this.lists[i].isopen = false;
|
}
|
}
|
},
|
gotoDetail(info) {
|
if (info.id == 8) {
|
common_vendor.index.switchTab({
|
url: "/pages/rankingList/index"
|
});
|
} else {
|
common_vendor.index.navigateTo({
|
url: info.targetUrl + "?id=" + info.id + "&title=" + info.title
|
});
|
}
|
},
|
gotoPage(keyWords) {
|
common_vendor.index.navigateTo({
|
url: "/pages/index/search/index?keyWords=" + keyWords
|
});
|
},
|
gotogoodDetail(type, id) {
|
if (type == 1) {
|
common_vendor.index.navigateTo({
|
url: "/pages/goodDetail/index?id=" + id
|
});
|
} else if (type == 2) {
|
common_vendor.index.switchTab({
|
url: "/pages/rankingList/index"
|
});
|
} else if (type == 3) {
|
common_vendor.index.navigateTo({
|
url: "/pages/madBuy/index?id=" + id
|
});
|
} else if (type == 4) {
|
common_vendor.index.navigateTo({
|
url: "/pages/index/search/index"
|
});
|
}
|
},
|
countDown(endtime) {
|
let d = this.timeHMS(endtime);
|
if (d == "00:00:00") {
|
clearInterval(this.timer);
|
}
|
this.showTime = d;
|
}
|
}
|
};
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
return {
|
a: common_vendor.o(($event) => $options.gotogoodDetail(4, "")),
|
b: common_vendor.f($data.lists, (item, index, i0) => {
|
return {
|
a: common_vendor.t(item.cname),
|
b: "id" + item.cid,
|
c: "key" + item.cid,
|
d: common_vendor.n(item.cid == $data.TabCur ? "textlight" : "textan"),
|
e: index,
|
f: common_vendor.o(($event) => $options.TabClick(item.cid), "key" + item.cid)
|
};
|
}),
|
c: "id" + $data.scrollInto,
|
d: common_vendor.f($data.lists, (item, index, i0) => {
|
var _a, _b, _c, _d, _e, _f;
|
return common_vendor.e({
|
a: index == 0
|
}, index == 0 ? {
|
b: common_vendor.f($data.moduleList1, (item2, index2, i1) => {
|
return {
|
a: item2.imgurl,
|
b: common_vendor.t(item2.title),
|
c: common_vendor.o(($event) => $options.gotoDetail(item2), item2.imgurl),
|
d: item2.imgurl
|
};
|
})
|
} : {}, {
|
c: index == 0
|
}, index == 0 ? {
|
d: common_vendor.f($data.hotSellList, (item1, index1, i1) => {
|
return common_vendor.e({
|
a: index1 == 0
|
}, index1 == 0 ? {} : {}, {
|
b: index1 == 1
|
}, index1 == 1 ? {} : {}, {
|
c: item1 == null ? void 0 : item1.mainPic,
|
d: index1 == 0
|
}, index1 == 0 ? {
|
e: common_vendor.t($data.getNumData(item1.monthsale))
|
} : {}, {
|
f: index1 == 1
|
}, index1 == 1 ? {
|
g: common_vendor.t($data.getNumData(item1.monthsale))
|
} : {}, {
|
h: common_vendor.t(item1 == null ? void 0 : item1.actualPrice),
|
i: item1 == null ? void 0 : item1.mainPic
|
});
|
}),
|
e: common_vendor.o(($event) => $options.gotogoodDetail(2, item.goodsId), "key" + item.cid),
|
f: (_a = $data.madbuyList[0]) == null ? void 0 : _a.mainPic,
|
g: common_vendor.t((_b = $data.madbuyList[0]) == null ? void 0 : _b.couponPrice),
|
h: common_vendor.t((_c = $data.madbuyList[0]) == null ? void 0 : _c.actualPrice),
|
i: (_d = $data.madbuyList[1]) == null ? void 0 : _d.mainPic,
|
j: common_vendor.t((_e = $data.madbuyList[1]) == null ? void 0 : _e.couponPrice),
|
k: common_vendor.t((_f = $data.madbuyList[1]) == null ? void 0 : _f.actualPrice),
|
l: common_vendor.o(($event) => $options.gotogoodDetail(3, item.goodsId), "key" + item.cid),
|
m: "ss" + item.id
|
} : {}, {
|
n: index == 0
|
}, index == 0 ? {} : {}, {
|
o: index != 0
|
}, index != 0 ? {
|
p: common_vendor.f(item.subcategories, (item2, index2, i1) => {
|
return {
|
a: item2.scpic,
|
b: common_vendor.t(item2.scname),
|
c: common_vendor.o(($event) => $options.gotoPage(item2.scname), item2.scpic),
|
d: item2.scpic
|
};
|
}),
|
q: item.cid
|
} : {}, {
|
r: $data.goodsList.length > 0 && item.cid == $data.TabCur
|
}, $data.goodsList.length > 0 && item.cid == $data.TabCur ? {
|
s: common_vendor.f($data.goodsList, (item2, index2, i1) => {
|
return common_vendor.e({
|
a: item2 == null ? void 0 : item2.mainPic,
|
b: item2.shopType == 0 ? "https://img.alicdn.com/imgextra/i4/751308485/O1CN01ppfg8j2CYBRpPtb51_!!751308485.png" : "https://img.alicdn.com/imgextra/i4/751308485/O1CN01mKVp3U2CYBRzeHVcG_!!751308485.png",
|
c: common_vendor.t(item2 == null ? void 0 : item2.dtitle),
|
d: item2 == null ? void 0 : item2.couponPrice
|
}, (item2 == null ? void 0 : item2.couponPrice) ? {} : {}, {
|
e: common_vendor.t(item2 == null ? void 0 : item2.actualPrice),
|
f: common_vendor.t($data.mathf.add(Number(item2 == null ? void 0 : item2.actualPrice), Number(item2 == null ? void 0 : item2.couponPrice))),
|
g: common_vendor.t(item2 == null ? void 0 : item2.couponPrice),
|
h: common_vendor.t($data.getNumData(item2.monthsale)),
|
i: item2.goodsId,
|
j: common_vendor.o(($event) => $options.gotogoodDetail(1, item2.goodsId), item2.goodsId)
|
});
|
})
|
} : {}, $data.goodsList.length > 0 ? common_vendor.e({
|
t: $data.loadingMore
|
}, $data.loadingMore ? {} : {}, {
|
v: $data.loadingMore == false
|
}, $data.loadingMore == false ? {} : {}) : {}, {
|
w: common_vendor.o(($event) => $options.loadMore(), "key" + item.cid),
|
x: common_vendor.o((...args) => $options.scroll && $options.scroll(...args), "key" + item.cid),
|
y: "key" + item.cid
|
});
|
}),
|
e: $data.goodsList.length > 0,
|
f: $data.scrollTop,
|
g: $data.Cur,
|
h: common_vendor.o((...args) => $options.switchTab && $options.switchTab(...args))
|
};
|
}
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/项目/Yfcodes/crm_app_new/pages/index/index.vue"]]);
|
_sfc_main.__runtimeHooks = 6;
|
wx.createPage(MiniProgramPage);
|