"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const _sfc_main = {
|
|
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
|
|
data() {
|
|
return {
|
|
value: 0,
|
|
processes: [],
|
|
priceList: [],
|
|
records: [],
|
|
destinations: [
|
|
{
|
|
icon: "/static/home/爱心援乡.png",
|
|
title: "爱心援乡",
|
|
desc: "精准帮扶贫困群体"
|
|
},
|
|
{
|
|
icon: "/static/home/回塑新源.png",
|
|
title: "回塑新源",
|
|
desc: "塑料的第二次成型"
|
|
},
|
|
{
|
|
icon: "/static/home/织物出海.png",
|
|
title: "织物出海",
|
|
desc: "分拣出最高价值"
|
|
},
|
|
{
|
|
icon: "/static/home/碳循再生.png",
|
|
title: "碳循再生",
|
|
desc: "减碳从出发生系统"
|
|
}
|
|
],
|
|
bannerList: [],
|
|
pricePreviewList: [],
|
|
cityList: [],
|
|
addressCion: "",
|
|
sbkCion: ""
|
|
};
|
|
},
|
|
computed: {
|
|
cityListStr() {
|
|
const names = this.cityList.map((c) => c.name);
|
|
const max = 8;
|
|
if (names.length > max) {
|
|
return names.slice(0, max).join("、") + "...";
|
|
}
|
|
return names.join("、");
|
|
},
|
|
address_cion() {
|
|
common_vendor.index.__f__("log", "at pages/component/home.vue:224", getApp().globalData.configData, "home-getApp().globalData.configData");
|
|
const item = getApp().globalData.configData.find((i) => i.keyName === "address_cion");
|
|
return item ? item.keyContent : "";
|
|
},
|
|
sbk_cion() {
|
|
const item = getApp().globalData.configData.find((i) => i.keyName === "sbk_cion");
|
|
return item ? item.keyContent : "";
|
|
}
|
|
},
|
|
methods: {
|
|
changeTo(e) {
|
|
this.value = e;
|
|
common_vendor.index.__f__("log", "at pages/component/home.vue:236", e, "111");
|
|
if (e == 1) {
|
|
common_vendor.index.reLaunch({
|
|
url: "/pages/component/recycle"
|
|
}, true);
|
|
} else if (e == 2) {
|
|
common_vendor.index.reLaunch({
|
|
url: "/pages/component/my"
|
|
}, true);
|
|
}
|
|
},
|
|
goAbout() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/subcomponent/about"
|
|
});
|
|
},
|
|
goCity() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/baoyou-city/baoyou-city"
|
|
});
|
|
},
|
|
getPickupto() {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/component/recycle"
|
|
});
|
|
},
|
|
async onRefresh() {
|
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
},
|
|
getAreaList() {
|
|
this.$api("getAreaList", {}, (res) => {
|
|
common_vendor.index.__f__("log", "at pages/component/home.vue:267", res, "getAreaList");
|
|
if (res.code == 200 && Array.isArray(res.result)) {
|
|
const sorted = res.result.slice().sort((a, b) => a.sort - b.sort);
|
|
this.processes = sorted.map((item) => ({
|
|
// id: item.id,
|
|
icon: item.image,
|
|
text: item.title
|
|
}));
|
|
}
|
|
});
|
|
},
|
|
goService() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/subcomponent/admin_faq"
|
|
});
|
|
},
|
|
goToRecycleCategory(id) {
|
|
getApp().globalData.targetRecycleCategoryId = id;
|
|
common_vendor.index.__f__("log", "at pages/component/home.vue:286", getApp().globalData.targetRecycleCategoryId, "getApp().globalData.targetRecycleCategoryId");
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/component/recycle"
|
|
});
|
|
},
|
|
getPricePreview() {
|
|
const resList = this.pricePreviewList || [];
|
|
if (Array.isArray(resList)) {
|
|
const firstLevel = resList.filter((item) => item.pid === "0").sort((a, b) => a.sort - b.sort);
|
|
this.priceList = firstLevel.map((item) => {
|
|
return {
|
|
id: item.id,
|
|
// 保证有id
|
|
icon: item.icon ? item.icon : "",
|
|
name: item.title,
|
|
price: item.priceNo ? item.priceNo : "",
|
|
unit: item.unit ? item.unit : ""
|
|
};
|
|
});
|
|
}
|
|
},
|
|
getRecentGoods() {
|
|
this.$api("getRecentGoodsList", {}, (res) => {
|
|
if (res && res.code === 200 && Array.isArray(res.result) && res.result.length > 0) {
|
|
this.records = res.result.map((item) => ({
|
|
id: item.id,
|
|
image: item.image,
|
|
name: item.name,
|
|
phone: item.phone,
|
|
price: item.price
|
|
}));
|
|
} else {
|
|
this.records = [];
|
|
}
|
|
});
|
|
},
|
|
goToInspectionReport(item) {
|
|
common_vendor.index.navigateTo({
|
|
url: `/pages/subcomponent/inspection-report?id=${item.id}`
|
|
});
|
|
},
|
|
getFreeCityList() {
|
|
this.$api("getFreeCityList", {}, (res) => {
|
|
if (res && res.code === 200 && Array.isArray(res.result)) {
|
|
this.cityList = res.result.map((item) => ({ name: item.name })).filter((item) => item.name);
|
|
} else {
|
|
this.cityList = [];
|
|
}
|
|
});
|
|
},
|
|
updateCionData() {
|
|
const configData = getApp().globalData.configData || [];
|
|
const address = configData.find((i) => i.keyName === "address_cion");
|
|
const sbk = configData.find((i) => i.keyName === "sbk_cion");
|
|
this.addressCion = address ? address.keyContent : "";
|
|
this.sbkCion = sbk ? sbk.keyContent : "";
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getAreaList();
|
|
this.getPricePreview();
|
|
this.getRecentGoods();
|
|
this.pricePreviewList = getApp().globalData.pricePreviewList || [];
|
|
this.bannerList = getApp().globalData.bannerList || [];
|
|
this.getFreeCityList();
|
|
common_vendor.index.$on("pricePreviewListUpdated", () => {
|
|
this.pricePreviewList = getApp().globalData.pricePreviewList || [];
|
|
this.getPricePreview();
|
|
});
|
|
common_vendor.index.$on("bannerListUpdated", () => {
|
|
this.bannerList = getApp().globalData.bannerList || [];
|
|
});
|
|
},
|
|
onUnload() {
|
|
common_vendor.index.$off("pricePreviewListUpdated");
|
|
common_vendor.index.$off("bannerListUpdated");
|
|
common_vendor.index.$off("configDataUpdated", this.updateCionData);
|
|
},
|
|
onShow() {
|
|
this.updateCionData();
|
|
common_vendor.index.$on("configDataUpdated", this.updateCionData);
|
|
this.getPricePreview();
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_divider2 = common_vendor.resolveComponent("uv-divider");
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
const _easycom_uv_tabbar_item2 = common_vendor.resolveComponent("uv-tabbar-item");
|
|
const _easycom_uv_tabbar2 = common_vendor.resolveComponent("uv-tabbar");
|
|
(_easycom_uv_divider2 + _easycom_uni_icons2 + _easycom_uv_tabbar_item2 + _easycom_uv_tabbar2)();
|
|
}
|
|
const _easycom_uv_divider = () => "../../uni_modules/uv-divider/components/uv-divider/uv-divider.js";
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
const _easycom_uv_tabbar_item = () => "../../uni_modules/uv-tabbar/components/uv-tabbar-item/uv-tabbar-item.js";
|
|
const _easycom_uv_tabbar = () => "../../uni_modules/uv-tabbar/components/uv-tabbar/uv-tabbar.js";
|
|
if (!Math) {
|
|
(_easycom_uv_divider + _easycom_uni_icons + _easycom_uv_tabbar_item + _easycom_uv_tabbar)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.f($data.bannerList, (item, index, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: item.id || index
|
|
};
|
|
}),
|
|
b: common_vendor.f($data.processes, (item, index, i0) => {
|
|
return {
|
|
a: item.icon,
|
|
b: common_vendor.t(item.text),
|
|
c: index
|
|
};
|
|
}),
|
|
c: common_assets._imports_0,
|
|
d: common_assets._imports_1,
|
|
e: common_vendor.o((...args) => $options.getPickupto && $options.getPickupto(...args)),
|
|
f: common_vendor.p({
|
|
dashed: true
|
|
}),
|
|
g: common_vendor.p({
|
|
type: "right",
|
|
size: "16",
|
|
color: "#999"
|
|
}),
|
|
h: common_vendor.t($options.cityListStr),
|
|
i: common_vendor.o((...args) => $options.goCity && $options.goCity(...args)),
|
|
j: $data.addressCion,
|
|
k: common_assets._imports_2,
|
|
l: common_vendor.o((...args) => $options.goService && $options.goService(...args)),
|
|
m: $data.sbkCion,
|
|
n: common_vendor.p({
|
|
type: "right",
|
|
size: "16",
|
|
color: "#999"
|
|
}),
|
|
o: common_vendor.o((...args) => $options.goAbout && $options.goAbout(...args)),
|
|
p: common_vendor.p({
|
|
type: "right",
|
|
size: "14",
|
|
color: "#999"
|
|
}),
|
|
q: common_vendor.f($data.priceList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.icon
|
|
}, item.icon ? {
|
|
b: item.icon
|
|
} : {}, {
|
|
c: common_vendor.t(item.name),
|
|
d: common_vendor.t(item.price),
|
|
e: common_vendor.t(item.unit),
|
|
f: item.id || index,
|
|
g: common_vendor.o(($event) => $options.goToRecycleCategory(item.id), item.id || index)
|
|
});
|
|
}),
|
|
r: common_vendor.f($data.records, (item, index, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.name),
|
|
c: common_vendor.t(item.phone ? item.phone.slice(-4) : ""),
|
|
d: common_vendor.t(item.price),
|
|
e: index,
|
|
f: common_vendor.o(($event) => $options.goToInspectionReport(item), index)
|
|
};
|
|
}),
|
|
s: common_vendor.f($data.destinations, (item, index, i0) => {
|
|
return {
|
|
a: item.icon,
|
|
b: common_vendor.t(item.title),
|
|
c: common_vendor.t(item.desc),
|
|
d: common_vendor.n(`destination-item${index + 1}`),
|
|
e: index
|
|
};
|
|
}),
|
|
t: common_assets._imports_5,
|
|
v: common_assets._imports_6,
|
|
w: common_vendor.p({
|
|
text: "首页"
|
|
}),
|
|
x: common_assets._imports_7,
|
|
y: common_assets._imports_8,
|
|
z: common_vendor.p({
|
|
text: "回收"
|
|
}),
|
|
A: common_assets._imports_9,
|
|
B: common_assets._imports_10,
|
|
C: common_vendor.p({
|
|
text: "我的"
|
|
}),
|
|
D: common_vendor.o($options.changeTo),
|
|
E: common_vendor.p({
|
|
value: $data.value,
|
|
fixed: true
|
|
})
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-24407015"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/component/home.js.map
|