first commit
This commit is contained in:
118
unpackage/dist/dev/mp-weixin/pages/cate/cate.js
vendored
Normal file
118
unpackage/dist/dev/mp-weixin/pages/cate/cate.js
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
if (!Array) {
|
||||
const _easycom_wd_search2 = common_vendor.resolveComponent("wd-search");
|
||||
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
|
||||
(_easycom_wd_search2 + _easycom_z_paging2)();
|
||||
}
|
||||
const _easycom_wd_search = () => "../../uni_modules/wot-design-uni/components/wd-search/wd-search.js";
|
||||
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
|
||||
if (!Math) {
|
||||
(_easycom_wd_search + _easycom_z_paging)();
|
||||
}
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "cate",
|
||||
setup(__props) {
|
||||
const current = common_vendor.ref(0);
|
||||
const goodsCate = common_vendor.ref([]);
|
||||
common_vendor.ref([]);
|
||||
const paging = common_vendor.ref(null);
|
||||
const dataList = common_vendor.ref([]);
|
||||
const goodsCateId = common_vendor.ref(null);
|
||||
const name = common_vendor.ref("");
|
||||
common_vendor.onLoad(() => {
|
||||
api_index.api.goodsCate().then((res) => {
|
||||
goodsCate.value = res.list;
|
||||
goodsCateId.value = res.list[0].id;
|
||||
});
|
||||
});
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
if (!goodsCateId.value) {
|
||||
api_index.api.goodsCate().then((res) => {
|
||||
goodsCate.value = res.list;
|
||||
goodsCateId.value = res.list[0].id;
|
||||
api_index.api.goodsPage({ pageNo, pageSize, categoryId: goodsCateId.value, name: name.value }).then((res2) => {
|
||||
paging.value.complete(res2.list);
|
||||
}).catch((res2) => {
|
||||
paging.value.complete(false);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
api_index.api.goodsPage({ pageNo, pageSize, categoryId: goodsCateId.value, name: name.value }).then((res) => {
|
||||
paging.value.complete(res.list);
|
||||
}).catch((res) => {
|
||||
paging.value.complete(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
const toGoods = (e) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/goods/goods?id=${e}`
|
||||
});
|
||||
};
|
||||
const clear = () => {
|
||||
name.value = "";
|
||||
paging.value.reload();
|
||||
};
|
||||
const search = (e) => {
|
||||
name.value = e.value;
|
||||
paging.value.reload();
|
||||
};
|
||||
let swichMenu = (index, id) => {
|
||||
current.value = index;
|
||||
goodsCateId.value = id;
|
||||
paging.value.reload();
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.o(search),
|
||||
b: common_vendor.o(clear),
|
||||
c: common_vendor.p({
|
||||
["placeholder-left"]: true,
|
||||
placeholder: "搜一搜药品名称",
|
||||
["hide-cancel"]: true,
|
||||
customStyle: {
|
||||
background: "#799675",
|
||||
height: "80rpx"
|
||||
}
|
||||
}),
|
||||
d: common_vendor.f(goodsCate.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: index,
|
||||
c: common_vendor.n(current.value == index ? "u-tab-item-active" : ""),
|
||||
d: index,
|
||||
e: common_vendor.o(($event) => common_vendor.unref(swichMenu)(index, item.id), index)
|
||||
};
|
||||
}),
|
||||
e: common_vendor.f(dataList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: item.cover,
|
||||
b: common_vendor.t(item.name),
|
||||
c: common_vendor.t(item.specs),
|
||||
d: common_vendor.t(item.currentPrice),
|
||||
e: common_vendor.t(item.originalPrice),
|
||||
f: index,
|
||||
g: common_vendor.o(($event) => toGoods(item.id), index)
|
||||
};
|
||||
}),
|
||||
f: common_vendor.sr(paging, "7db0ce29-1", {
|
||||
"k": "paging"
|
||||
}),
|
||||
g: common_vendor.o(queryList),
|
||||
h: common_vendor.o(($event) => dataList.value = $event),
|
||||
i: common_vendor.p({
|
||||
["use-page-scroll"]: true,
|
||||
["paging-style"]: {
|
||||
"background-color": "#FFF"
|
||||
},
|
||||
modelValue: dataList.value
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7db0ce29"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/cate/cate.js.map
|
||||
Reference in New Issue
Block a user