296 lines
8.2 KiB
JavaScript
296 lines
8.2 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_product = require("../../api/product.js");
|
|
const utils_enumUtils = require("../../utils/enumUtils.js");
|
|
const choiceness = () => "../../components/choiceness/choiceness.js";
|
|
const _sfc_main = {
|
|
components: { choiceness },
|
|
data() {
|
|
return {
|
|
swiperList: [
|
|
"/static/home/banner02.png",
|
|
"/static/home/banner01.png"
|
|
],
|
|
currentNum: 0,
|
|
sortList: [
|
|
{
|
|
id: 1,
|
|
name: "家居百货",
|
|
url: "/static/home/sort/1.png"
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "水果生鲜",
|
|
url: "/static/home/sort/2.png"
|
|
},
|
|
{
|
|
id: 3,
|
|
name: "爆款新品",
|
|
url: "/static/home/sort/3.png"
|
|
},
|
|
{
|
|
id: 4,
|
|
name: "服装服饰",
|
|
url: "/static/home/sort/4.png"
|
|
},
|
|
{
|
|
id: 5,
|
|
name: "箱包皮具",
|
|
url: "/static/home/sort/5.png"
|
|
},
|
|
{
|
|
id: 6,
|
|
name: "手机数码",
|
|
url: "/static/home/sort/6.png"
|
|
},
|
|
{
|
|
id: 7,
|
|
name: "营养保健",
|
|
url: "/static/home/sort/7.png"
|
|
},
|
|
{
|
|
id: 8,
|
|
name: "个护家清",
|
|
url: "/static/home/sort/8.png"
|
|
},
|
|
{
|
|
id: 9,
|
|
name: "厨房生活",
|
|
url: "/static/home/sort/9.png"
|
|
},
|
|
{
|
|
id: 10,
|
|
name: "全部",
|
|
url: "/static/home/sort/10.png"
|
|
}
|
|
],
|
|
languageShow: false,
|
|
// 语言选项
|
|
languageList: [
|
|
{
|
|
name: "中文",
|
|
key: "CN"
|
|
},
|
|
{
|
|
name: "英文",
|
|
key: "EN"
|
|
}
|
|
],
|
|
currentLanguage: {},
|
|
yxProduct: [],
|
|
// 好物优选列表
|
|
faddishProduct: [],
|
|
// 爆款专区
|
|
hotList: [
|
|
{
|
|
id: 1,
|
|
name: "中文中文中文中文中文",
|
|
url: "/static/common/product_def.png",
|
|
price: 99
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "中文中文中文中文",
|
|
url: "/static/common/product_def.png",
|
|
price: 99
|
|
},
|
|
{
|
|
id: 3,
|
|
name: "中文中文中文中文中文",
|
|
url: "/static/common/product_def.png",
|
|
price: 99
|
|
},
|
|
{
|
|
id: 4,
|
|
name: "中文中文中文中文中文",
|
|
url: "/static/common/product_def.png",
|
|
price: 99
|
|
}
|
|
],
|
|
// 热门
|
|
productLoading: false
|
|
};
|
|
},
|
|
mounted() {
|
|
this.querySearchList(utils_enumUtils.SEARCH_TYPE.SOMETHING);
|
|
this.querySearchList(utils_enumUtils.SEARCH_TYPE.EXPLOSIVE);
|
|
},
|
|
methods: {
|
|
jumpTurntable() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/turntable/turntable"
|
|
});
|
|
},
|
|
jumpPrdference() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/preference/preference"
|
|
});
|
|
},
|
|
jumpWelcome() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/welcome/welcome"
|
|
});
|
|
},
|
|
jumpSearch() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/search/search"
|
|
});
|
|
},
|
|
/**
|
|
* 查询商品列表
|
|
*/
|
|
async querySearchList(type) {
|
|
this.productLoading = true;
|
|
const params = {
|
|
type,
|
|
page: 1,
|
|
pageSize: 3
|
|
};
|
|
const resp = await api_product.searchList(params);
|
|
if (resp && resp.bizcode === 100) {
|
|
if (type === utils_enumUtils.SEARCH_TYPE.SOMETHING) {
|
|
this.yxProduct = resp.data;
|
|
} else if (type === utils_enumUtils.SEARCH_TYPE.EXPLOSIVE) {
|
|
this.faddishProduct = resp.data;
|
|
}
|
|
}
|
|
this.productLoading = false;
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
|
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
|
|
const _easycom_up_loading_icon2 = common_vendor.resolveComponent("up-loading-icon");
|
|
const _easycom_choiceness2 = common_vendor.resolveComponent("choiceness");
|
|
const _easycom_up_action_sheet2 = common_vendor.resolveComponent("up-action-sheet");
|
|
(_easycom_up_image2 + _easycom_up_swiper2 + _easycom_up_loading_icon2 + _easycom_choiceness2 + _easycom_up_action_sheet2)();
|
|
}
|
|
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
|
const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
|
|
const _easycom_up_loading_icon = () => "../../uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js";
|
|
const _easycom_choiceness = () => "../../components/choiceness/choiceness.js";
|
|
const _easycom_up_action_sheet = () => "../../uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.js";
|
|
if (!Math) {
|
|
(_easycom_up_image + _easycom_up_swiper + _easycom_up_loading_icon + _easycom_choiceness + _easycom_up_action_sheet)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.o(_ctx.jumpMine),
|
|
b: common_vendor.p({
|
|
src: "/static/home/logo.png",
|
|
width: "104",
|
|
height: "30",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
c: common_vendor.p({
|
|
src: "/static/home/search.png",
|
|
width: "18",
|
|
height: "18",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
d: common_vendor.o((...args) => $options.jumpSearch && $options.jumpSearch(...args)),
|
|
e: common_vendor.p({
|
|
src: "/static/common/down.png",
|
|
width: "10",
|
|
height: "10",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
f: common_vendor.o(($event) => $data.languageShow = true),
|
|
g: common_vendor.t($data.currentNum + 1),
|
|
h: common_vendor.t($data.swiperList.length),
|
|
i: common_vendor.p({
|
|
list: $data.swiperList,
|
|
height: "140",
|
|
radius: "10"
|
|
}),
|
|
j: common_vendor.f($data.sortList, (item, k0, i0) => {
|
|
return {
|
|
a: "07e72d3c-4-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.url,
|
|
width: "40",
|
|
height: "32",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
c: common_vendor.t(item.name),
|
|
d: item.id
|
|
};
|
|
}),
|
|
k: common_vendor.o($options.jumpTurntable),
|
|
l: common_vendor.p({
|
|
src: "/static/home/turntable.png",
|
|
width: "100%",
|
|
height: "134",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
m: common_vendor.p({
|
|
src: "/static/common/right_y_st2.png",
|
|
width: "12",
|
|
height: "12",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
n: common_vendor.o((...args) => $options.jumpPrdference && $options.jumpPrdference(...args)),
|
|
o: common_vendor.p({
|
|
show: $data.productLoading
|
|
}),
|
|
p: common_vendor.f($data.yxProduct, (item, k0, i0) => {
|
|
return {
|
|
a: "07e72d3c-8-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.url,
|
|
width: "100%",
|
|
height: "100",
|
|
bgColor: "#f1f6ff00",
|
|
shape: "square",
|
|
radius: "16"
|
|
}),
|
|
c: common_vendor.t(item.title),
|
|
d: common_vendor.t(item.price),
|
|
e: item.id
|
|
};
|
|
}),
|
|
q: common_vendor.p({
|
|
src: "/static/common/right_y_st2.png",
|
|
width: "12",
|
|
height: "12",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
r: common_vendor.o((...args) => $options.jumpWelcome && $options.jumpWelcome(...args)),
|
|
s: common_vendor.p({
|
|
show: $data.productLoading
|
|
}),
|
|
t: common_vendor.f($data.faddishProduct, (item, k0, i0) => {
|
|
return {
|
|
a: "07e72d3c-11-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.url,
|
|
width: "100%",
|
|
height: "100",
|
|
bgColor: "#f1f6ff00",
|
|
shape: "square",
|
|
radius: "16"
|
|
}),
|
|
c: common_vendor.t(item.title),
|
|
d: common_vendor.t(item.price),
|
|
e: item.id
|
|
};
|
|
}),
|
|
v: common_vendor.p({
|
|
src: "/static/common/right.png",
|
|
width: "16",
|
|
height: "16",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
w: common_vendor.o(($event) => $data.languageShow = false),
|
|
x: common_vendor.p({
|
|
actions: $data.languageList,
|
|
show: $data.languageShow,
|
|
cancelText: "取消"
|
|
})
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-07e72d3c"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/home/home.js.map
|