123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const sheep_index = require("../../sheep/index.js");
- const sheep_api_product_history = require("../../sheep/api/product/history.js");
- const sheep_helper_utils = require("../../sheep/helper/utils.js");
- require("../../sheep/api/index.js");
- require("../../sheep/api/distri/score.js");
- require("../../sheep/request/index.js");
- require("../../sheep/config/index.js");
- require("../../sheep/store/index.js");
- require("../../sheep/store/app.js");
- require("../../sheep/api/promotion/diy.js");
- require("../../sheep/platform/index.js");
- require("../../sheep/platform/provider/wechat/index.js");
- require("../../sheep/platform/provider/wechat/miniProgram.js");
- require("../../sheep/api/member/auth.js");
- require("../../sheep/api/member/social.js");
- require("../../sheep/api/member/user.js");
- require("../../sheep/platform/provider/apple/index.js");
- require("../../sheep/platform/share.js");
- require("../../sheep/router/index.js");
- require("../../sheep/hooks/useModal.js");
- require("../../sheep/helper/index.js");
- require("../../sheep/helper/test.js");
- require("../../sheep/helper/digit.js");
- require("../../sheep/api/member/signin.js");
- require("../../sheep/helper/throttle.js");
- require("../../sheep/url/index.js");
- require("../../sheep/platform/pay.js");
- require("../../sheep/api/pay/order.js");
- require("../../sheep/store/user.js");
- require("../../sheep/store/cart.js");
- require("../../sheep/api/trade/cart.js");
- require("../../sheep/api/pay/wallet.js");
- require("../../sheep/api/trade/order.js");
- require("../../sheep/api/promotion/coupon.js");
- require("../../sheep/store/sys.js");
- require("../../sheep/store/modal.js");
- require("../../sheep/api/distri/share.js");
- require("../../sheep/api/distri/team.js");
- require("../../sheep/api/infra/file.js");
- require("../../sheep/api/member/address.js");
- require("../../sheep/api/member/point.js");
- require("../../sheep/api/migration/app.js");
- require("../../sheep/api/migration/chat.js");
- require("../../sheep/api/migration/index.js");
- require("../../sheep/api/migration/third.js");
- require("../../sheep/api/pay/channel.js");
- require("../../sheep/api/product/category.js");
- require("../../sheep/api/product/comment.js");
- require("../../sheep/api/product/favorite.js");
- require("../../sheep/api/product/spu.js");
- require("../../sheep/api/promotion/activity.js");
- require("../../sheep/api/promotion/article.js");
- require("../../sheep/api/promotion/bargain.js");
- require("../../sheep/api/promotion/combination.js");
- require("../../sheep/api/promotion/rewardActivity.js");
- require("../../sheep/api/promotion/seckill.js");
- require("../../sheep/api/system/area.js");
- require("../../sheep/api/system/voice.js");
- require("../../sheep/api/trade/afterSale.js");
- require("../../sheep/api/trade/brokerage.js");
- require("../../sheep/api/trade/config.js");
- require("../../sheep/api/trade/delivery.js");
- require("../../sheep/config/zIndex.js");
- if (!Array) {
- const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
- const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
- const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
- const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
- const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
- (_easycom_s_goods_item2 + _easycom_su_fixed2 + _easycom_uni_load_more2 + _easycom_s_empty2 + _easycom_s_layout2)();
- }
- const _easycom_s_goods_item = () => "../../sheep/components/s-goods-item/s-goods-item.js";
- const _easycom_su_fixed = () => "../../sheep/ui/su-fixed/su-fixed.js";
- const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
- const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
- const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
- if (!Math) {
- (_easycom_s_goods_item + _easycom_su_fixed + _easycom_uni_load_more + _easycom_s_empty + _easycom_s_layout)();
- }
- const _sfc_main = {
- __name: "goods-log",
- setup(__props) {
- common_vendor.useCssVars((_ctx) => ({
- "1ab964d1": common_vendor.unref(sys_navBar)
- }));
- const sys_navBar = sheep_index.sheep.$platform.navbar;
- const pagination = {
- list: [],
- pageNo: 1,
- total: 1,
- pageSize: 10
- };
- const state = common_vendor.reactive({
- pagination: sheep_helper_utils.cloneDeep(pagination),
- loadStatus: "",
- editMode: false,
- selectedSpuIdList: [],
- selectAll: false
- });
- async function getList() {
- state.loadStatus = "loading";
- const { code, data } = await sheep_api_product_history.SpuHistoryApi.getBrowseHistoryPage({
- pageNo: state.pagination.pageNo,
- pageSize: state.pagination.pageSize
- });
- if (code !== 0) {
- return;
- }
- state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
- state.pagination.total = data.total;
- state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
- }
- const onSelect = (id) => {
- if (!state.selectedSpuIdList.includes(id)) {
- state.selectedSpuIdList.push(id);
- } else {
- state.selectedSpuIdList.splice(state.selectedSpuIdList.indexOf(id), 1);
- }
- state.selectAll = state.selectedSpuIdList.length === state.pagination.list.length;
- };
- const onSelectAll = () => {
- state.selectAll = !state.selectAll;
- if (!state.selectAll) {
- state.selectedSpuIdList = [];
- } else {
- state.pagination.list.forEach((item) => {
- if (state.selectedSpuIdList.includes(item.spuId)) {
- state.selectedSpuIdList.splice(state.selectedSpuIdList.indexOf(item.spuId), 1);
- }
- state.selectedSpuIdList.push(item.spuId);
- });
- }
- };
- async function onDelete() {
- if (state.selectedSpuIdList.length <= 0) {
- return;
- }
- const { code } = await sheep_api_product_history.SpuHistoryApi.deleteBrowseHistory(state.selectedSpuIdList);
- if (code === 0) {
- reload();
- }
- }
- async function onClean() {
- const { code } = await sheep_api_product_history.SpuHistoryApi.cleanBrowseHistory();
- if (code === 0) {
- reload();
- }
- }
- function reload() {
- state.editMode = false;
- state.selectedSpuIdList = [];
- state.selectAll = false;
- state.pagination = pagination;
- getList();
- }
- function loadMore() {
- if (state.loadStatus !== "noMore") {
- state.pagination.pageNo += 1;
- getList();
- }
- }
- common_vendor.onReachBottom(() => {
- loadMore();
- });
- common_vendor.onLoad(() => {
- getList();
- });
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.t(state.pagination.total),
- b: state.editMode && state.pagination.total
- }, state.editMode && state.pagination.total ? {
- c: common_vendor.o(($event) => state.editMode = false)
- } : {}, {
- d: !state.editMode && state.pagination.total
- }, !state.editMode && state.pagination.total ? {
- e: common_vendor.o(($event) => state.editMode = true)
- } : {}, {
- f: common_vendor.f(state.pagination.list, (item, k0, i0) => {
- return common_vendor.e(state.editMode ? {
- a: state.selectedSpuIdList.includes(item.spuId),
- b: common_vendor.o(($event) => onSelect(item.spuId), item.id),
- c: common_vendor.o(($event) => onSelect(item.spuId), item.id)
- } : {}, {
- d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/index", {
- id: item.spuId
- }), item.id),
- e: "e113b195-1-" + i0 + ",e113b195-0",
- f: common_vendor.p({
- title: item.spuName,
- img: item.picUrl,
- price: item.price,
- skuText: item.introduction,
- priceColor: "#FF3000",
- titleWidth: 400
- }),
- g: item.id
- });
- }),
- g: state.editMode,
- h: state.selectAll,
- i: common_vendor.o(onSelectAll),
- j: common_vendor.o(onSelectAll),
- k: common_vendor.n({
- "ui-BG-Main-Gradient": state.selectedSpuIdList.length > 0,
- "ui-Shadow-Main": state.selectedSpuIdList.length > 0
- }),
- l: common_vendor.o(onDelete),
- m: common_vendor.o(onClean),
- n: state.editMode,
- o: common_vendor.p({
- bottom: true,
- val: 0,
- placeholder: true
- }),
- p: state.pagination.total > 0
- }, state.pagination.total > 0 ? {
- q: common_vendor.o(loadMore),
- r: common_vendor.p({
- status: state.loadStatus,
- ["content-text"]: {
- contentdown: "上拉加载更多"
- }
- })
- } : {}, {
- s: state.pagination.total === 0
- }, state.pagination.total === 0 ? {
- t: common_vendor.p({
- text: "暂无浏览记录",
- icon: "/static/collect-empty.png"
- })
- } : {}, {
- v: common_vendor.s(_ctx.__cssVars()),
- w: common_vendor.p({
- title: "我的足迹",
- bgStyle: {
- color: "#f2f2f2"
- }
- })
- });
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e113b195"], ["__file", "D:/zx/mall-front-app/pages/user/goods-log.vue"]]);
- wx.createPage(MiniProgramPage);
|