130 lines
3.8 KiB
JavaScript
130 lines
3.8 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 _sfc_main = {
|
|
data() {
|
|
return {
|
|
swiperList: [
|
|
"/static/home/banner05.png"
|
|
],
|
|
productList: [],
|
|
productListLoading: false
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getSearchList();
|
|
},
|
|
methods: {
|
|
jumpHome() {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/home/home"
|
|
});
|
|
},
|
|
// 邀请好友
|
|
jumpInviteFriends() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/invite_friends/invite_friends"
|
|
});
|
|
},
|
|
async getSearchList() {
|
|
this.productListLoading = true;
|
|
const params = {
|
|
type: utils_enumUtils.SEARCH_TYPE.EXPLOSIVE,
|
|
page: 1,
|
|
pageSize: 99
|
|
};
|
|
const resp = await api_product.searchList(params);
|
|
if (resp && resp.bizcode === 100) {
|
|
const data = resp.data || [];
|
|
if (data && data.length !== 0) {
|
|
data.map((item) => {
|
|
const priceN = item.price.split("-");
|
|
item.priceN = priceN[0];
|
|
});
|
|
}
|
|
this.productList = data;
|
|
}
|
|
this.productListLoading = false;
|
|
},
|
|
/**
|
|
* 跳转到商品详情
|
|
* @param {Object} item
|
|
*/
|
|
jumpInfo(item) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/productInfo/productInfo?id=" + item.id
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
|
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
|
|
const _easycom_up_loading_page2 = common_vendor.resolveComponent("up-loading-page");
|
|
(_easycom_up_image2 + _easycom_up_swiper2 + _easycom_up_loading_page2)();
|
|
}
|
|
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_page = () => "../../uni_modules/uview-plus/components/u-loading-page/u-loading-page.js";
|
|
if (!Math) {
|
|
(_easycom_up_image + _easycom_up_swiper + _easycom_up_loading_page)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.o($options.jumpHome),
|
|
b: common_vendor.p({
|
|
src: "/static/common/left.png",
|
|
width: "20",
|
|
height: "20",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
c: common_vendor.o($options.jumpInviteFriends),
|
|
d: common_vendor.p({
|
|
src: "/static/common/share.png",
|
|
width: "20",
|
|
height: "20",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
e: common_vendor.p({
|
|
list: $data.swiperList,
|
|
height: "140"
|
|
}),
|
|
f: common_vendor.p({
|
|
src: "/static/product/bk_l.png",
|
|
width: "60",
|
|
height: "2",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
g: common_vendor.p({
|
|
src: "/static/product/bk_r.png",
|
|
width: "60",
|
|
height: "2",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
h: common_vendor.p({
|
|
loading: $data.productListLoading
|
|
}),
|
|
i: common_vendor.f($data.productList, (item, index, i0) => {
|
|
return {
|
|
a: "085f0530-6-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.url,
|
|
width: "100",
|
|
height: "100",
|
|
bgColor: "#f1f6ff00"
|
|
}),
|
|
c: common_vendor.t(item.title),
|
|
d: common_vendor.t(item.adPrice),
|
|
e: common_vendor.t((item.adPrice - item.priceN).toFixed(2)),
|
|
f: common_vendor.t(item.priceN),
|
|
g: index,
|
|
h: common_vendor.o(($event) => $options.jumpInfo(item), index)
|
|
};
|
|
})
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-085f0530"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/welcome/welcome.js.map
|