爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

137 lines
4.3 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
const _sfc_main = {
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
data() {
return {
brandItems: [
{
name: "MONCLER GENIUS Maya 70 By Palm A",
image: "/static/brand/moncler.png",
price: "3-10",
selected: false
},
{
name: "加拿大鹅 Wyndham系列羽绒服 冬季 男装",
image: "/static/brand/canada-goose.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE 1992 Nupse 填充夹克",
image: "/static/brand/tnf-1992.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE M'S 1996 Novelty",
image: "/static/brand/tnf-1996.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE 1996 系列 FW23",
image: "/static/brand/tnf-fw23.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE 城市户外系列羽绒服",
image: "/static/brand/tnf-urban.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE 城市户外系列羽绒服 红色",
image: "/static/brand/tnf-red.png",
price: "3-10",
selected: false
},
{
name: "THE NORTH FACE 韩国男款 1996 Nov",
image: "/static/brand/tnf-korea.png",
price: "3-10",
selected: false
}
],
selectedFromRecycle: []
};
},
onLoad(options) {
if (options.selectedItems) {
try {
this.selectedFromRecycle = JSON.parse(decodeURIComponent(options.selectedItems));
this.syncSelectionWithRecycle();
} catch (e) {
common_vendor.index.__f__("error", "at pages/subcomponent/brand.vue:106", "解析选中衣物数据失败:", e);
}
}
},
methods: {
async onRefresh() {
await new Promise((resolve) => setTimeout(resolve, 1e3));
common_vendor.index.stopPullRefresh();
},
goBack() {
common_vendor.index.navigateBack();
},
// 同步recycle页面选中的衣物到品牌页面
syncSelectionWithRecycle() {
const brandSelected = this.selectedFromRecycle.find((item) => item.showBrandCheck);
if (brandSelected) {
this.brandItems[0].selected = true;
}
},
selectItem(index) {
this.brandItems[index].selected = !this.brandItems[index].selected;
},
goToPickup() {
const selectedBrandItems = this.brandItems.filter((item) => item.selected).map((item) => ({
name: item.name,
icon: item.image,
quantity: 1,
unitPrice: item.price.split("-")[0],
desc: "品牌羽绒服,状态良好"
}));
const itemsStr = encodeURIComponent(JSON.stringify([
...this.selectedFromRecycle,
...selectedBrandItems
]));
common_vendor.index.navigateTo({
url: `/pages/component/pickup?fromRecycle=true&items=${itemsStr}`
});
}
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
type: "left",
size: "20"
}),
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: common_vendor.f($data.brandItems, (item, index, i0) => {
return {
a: item.image,
b: common_vendor.t(item.name),
c: common_vendor.t(item.price),
d: index,
e: item.selected ? 1 : "",
f: common_vendor.o(($event) => $options.selectItem(index), index)
};
}),
d: common_vendor.o((...args) => $options.goToPickup && $options.goToPickup(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f4b4ba20"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/brand.js.map