180 lines
6.6 KiB
JavaScript
180 lines
6.6 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_goods = require("../../api/goods.js");
|
|
const utils_helper = require("../../utils/helper.js");
|
|
if (!Array) {
|
|
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
|
|
const _easycom_nut_tag2 = common_vendor.resolveComponent("nut-tag");
|
|
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
|
|
(_easycom_nut_button2 + _easycom_nut_tag2 + _easycom_z_paging2)();
|
|
}
|
|
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
|
|
const _easycom_nut_tag = () => "../../uni_modules/nutui-uni/components/tag/tag.js";
|
|
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
|
|
if (!Math) {
|
|
(_easycom_nut_button + _easycom_nut_tag + _easycom_z_paging)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "goodsList",
|
|
setup(__props) {
|
|
const getImg = (goods) => {
|
|
var _a, _b;
|
|
const url = (_b = (_a = goods == null ? void 0 : goods.image) == null ? void 0 : _a[0]) == null ? void 0 : _b.file_path;
|
|
return url ? url + "?imageView2/1/w/200/h/200" : "";
|
|
};
|
|
const paging = common_vendor.ref(null);
|
|
const dataList = common_vendor.ref([]);
|
|
common_vendor.ref(null);
|
|
common_vendor.ref(null);
|
|
common_vendor.ref(null);
|
|
const state = common_vendor.reactive({
|
|
type_params: [],
|
|
// 产品类型
|
|
drop_down_options: [],
|
|
// 产品类型下的品牌列表
|
|
o_drop_down_options: [],
|
|
// 价格排序
|
|
price_sort_params: [
|
|
{
|
|
text: "默认排序",
|
|
value: ""
|
|
},
|
|
{
|
|
text: "价格升序",
|
|
value: "ascend"
|
|
},
|
|
{
|
|
text: "价格降序",
|
|
value: "descend"
|
|
}
|
|
],
|
|
// 成色所有选项
|
|
degree_params: [],
|
|
price_sort: "",
|
|
price_sort_name: "默认排序",
|
|
degree_ids: [],
|
|
degree_name: "成色",
|
|
product_name: "机型",
|
|
type_id: 1,
|
|
// 产品类型id 默认 1 手机
|
|
type_name: "手机",
|
|
brand_id: 0,
|
|
// 品牌id // 默认 0 全部
|
|
brand_name: "全部",
|
|
product_ids: [0],
|
|
// 机型ids 默认 0 全部
|
|
search_val: ""
|
|
// 搜索
|
|
});
|
|
common_vendor.computed(() => {
|
|
var _a;
|
|
return (_a = state == null ? void 0 : state.o_drop_down_options[state.type_id]) == null ? void 0 : _a.children[state.brand_id].children;
|
|
});
|
|
const queryList = (pageNo, pageSize) => {
|
|
const params = {
|
|
pageSize,
|
|
page: pageNo,
|
|
price_sort: state.price_sort,
|
|
degree_ids: state.degree_ids,
|
|
type_id: state.type_id,
|
|
brand_id: state.brand_id,
|
|
product_ids: state.product_ids,
|
|
search: state.search_val
|
|
};
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:299", params);
|
|
api_goods.fetchSysGoodsList(params).then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:301", "res=>", res.list);
|
|
paging.value.complete(res.list);
|
|
}).catch((res) => {
|
|
paging.value.complete(false);
|
|
});
|
|
};
|
|
const init = () => {
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:318", "init111");
|
|
api_goods.fetchFilterParmas().then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:321", res);
|
|
let degree_params = res.degree_list;
|
|
state.degree_params = degree_params.reduce((it, cit) => {
|
|
it.push({
|
|
text: cit.degree_name,
|
|
value: cit.degree_id
|
|
});
|
|
return it;
|
|
}, state.degree_params) || [];
|
|
state.type_params = res.type_list;
|
|
state.drop_down_options = res.drop_down_options;
|
|
state.o_drop_down_options = res.o_drop_down_options;
|
|
});
|
|
};
|
|
common_vendor.onShow(() => {
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:340", "onshow---");
|
|
common_vendor.index.__f__("log", "at pages/config/goodsList.vue:341", "paging.value", paging.value);
|
|
if (paging.value) {
|
|
paging.value.refresh();
|
|
}
|
|
});
|
|
common_vendor.onMounted(() => {
|
|
init();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/config/goodsAdd")),
|
|
b: common_vendor.p({
|
|
type: "primary",
|
|
block: true,
|
|
plain: true
|
|
}),
|
|
c: common_vendor.s("top:0px"),
|
|
d: common_vendor.f(dataList.value, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: getImg(item),
|
|
b: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/config/goodsDetail?id=" + item.goods_id), index),
|
|
c: common_vendor.t(item.degree.degree_name),
|
|
d: "d044a737-2-" + i0 + ",d044a737-0",
|
|
e: common_vendor.t(item.goods_name),
|
|
f: common_vendor.t(item.content),
|
|
g: common_vendor.t(item.goods_price),
|
|
h: common_vendor.t(item.status.text),
|
|
i: item.status.value == 10 || item.status.value == 20
|
|
}, item.status.value == 10 || item.status.value == 20 ? {
|
|
j: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/config/goodsEdit?id=" + item.goods_id), index),
|
|
k: "d044a737-3-" + i0 + ",d044a737-0",
|
|
l: common_vendor.p({
|
|
size: "small",
|
|
type: "primary"
|
|
})
|
|
} : {}, {
|
|
m: item.status.value == 40
|
|
}, item.status.value == 40 ? {
|
|
n: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/config/goodsEdit?id=" + item.goods_id), index),
|
|
o: "d044a737-4-" + i0 + ",d044a737-0",
|
|
p: common_vendor.p({
|
|
size: "small",
|
|
type: "primary"
|
|
})
|
|
} : {}, {
|
|
q: index
|
|
});
|
|
}),
|
|
e: common_vendor.p({
|
|
["custom-color"]: "#1a1a1a"
|
|
}),
|
|
f: common_vendor.sr(paging, "d044a737-0", {
|
|
"k": "paging"
|
|
}),
|
|
g: common_vendor.o(queryList),
|
|
h: common_vendor.o(($event) => dataList.value = $event),
|
|
i: common_vendor.p({
|
|
["refresher-enabled"]: false,
|
|
["auto-clean-list-when-reload"]: false,
|
|
["auto-scroll-to-top-when-reload"]: false,
|
|
modelValue: dataList.value
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d044a737"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/config/goodsList.js.map
|