161 lines
5.2 KiB
JavaScript
161 lines
5.2 KiB
JavaScript
|
"use strict";
|
||
|
var __defProp = Object.defineProperty;
|
||
|
var __defProps = Object.defineProperties;
|
||
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
||
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||
|
var __spreadValues = (a, b) => {
|
||
|
for (var prop in b || (b = {}))
|
||
|
if (__hasOwnProp.call(b, prop))
|
||
|
__defNormalProp(a, prop, b[prop]);
|
||
|
if (__getOwnPropSymbols)
|
||
|
for (var prop of __getOwnPropSymbols(b)) {
|
||
|
if (__propIsEnum.call(b, prop))
|
||
|
__defNormalProp(a, prop, b[prop]);
|
||
|
}
|
||
|
return a;
|
||
|
};
|
||
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||
|
var __async = (__this, __arguments, generator) => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
var fulfilled = (value) => {
|
||
|
try {
|
||
|
step(generator.next(value));
|
||
|
} catch (e) {
|
||
|
reject(e);
|
||
|
}
|
||
|
};
|
||
|
var rejected = (value) => {
|
||
|
try {
|
||
|
step(generator.throw(value));
|
||
|
} catch (e) {
|
||
|
reject(e);
|
||
|
}
|
||
|
};
|
||
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||
|
step((generator = generator.apply(__this, __arguments)).next());
|
||
|
});
|
||
|
};
|
||
|
const common_vendor = require("../../../../common/vendor.js");
|
||
|
const sheep_api_trade_order = require("../../../../sheep/api/trade/order.js");
|
||
|
const sheep_api_product_history = require("../../../../sheep/api/product/history.js");
|
||
|
if (!Array) {
|
||
|
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
||
|
const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
|
||
|
(_easycom_uni_load_more2 + _easycom_su_popup2)();
|
||
|
}
|
||
|
const _easycom_uni_load_more = () => "../../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
|
||
|
const _easycom_su_popup = () => "../../../../sheep/ui/su-popup/su-popup.js";
|
||
|
if (!Math) {
|
||
|
(GoodsItem + OrderItem + _easycom_uni_load_more + _easycom_su_popup)();
|
||
|
}
|
||
|
const GoodsItem = () => "./goods.js";
|
||
|
const OrderItem = () => "./order.js";
|
||
|
const _sfc_main = {
|
||
|
__name: "select-popup",
|
||
|
props: {
|
||
|
mode: {
|
||
|
type: String,
|
||
|
default: "goods"
|
||
|
},
|
||
|
show: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
}
|
||
|
},
|
||
|
emits: ["select", "close"],
|
||
|
setup(__props, { emit: __emit }) {
|
||
|
const emits = __emit;
|
||
|
const props = __props;
|
||
|
common_vendor.watch(
|
||
|
() => props.mode,
|
||
|
() => {
|
||
|
state.pagination.data = [];
|
||
|
if (props.mode) {
|
||
|
getList(state.pagination.page);
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
const state = common_vendor.reactive({
|
||
|
loadStatus: "",
|
||
|
pagination: {
|
||
|
data: [],
|
||
|
current_page: 1,
|
||
|
total: 1,
|
||
|
last_page: 1
|
||
|
}
|
||
|
});
|
||
|
function getList(page, list_rows = 5) {
|
||
|
return __async(this, null, function* () {
|
||
|
state.loadStatus = "loading";
|
||
|
const res = props.mode == "goods" ? yield sheep_api_product_history.SpuHistoryApi.getBrowseHistoryPage({
|
||
|
page,
|
||
|
list_rows
|
||
|
}) : yield sheep_api_trade_order.OrderApi.getOrderPage({
|
||
|
page,
|
||
|
list_rows
|
||
|
});
|
||
|
const orderList = common_vendor.lodash.concat(state.pagination.data, res.data.list);
|
||
|
state.pagination = __spreadProps(__spreadValues({}, res.data), {
|
||
|
data: orderList
|
||
|
});
|
||
|
if (state.pagination.current_page < state.pagination.last_page) {
|
||
|
state.loadStatus = "more";
|
||
|
} else {
|
||
|
state.loadStatus = "noMore";
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
function loadmore() {
|
||
|
if (state.loadStatus !== "noMore") {
|
||
|
getList(state.pagination.current_page + 1);
|
||
|
}
|
||
|
}
|
||
|
return (_ctx, _cache) => {
|
||
|
return {
|
||
|
a: common_vendor.t(__props.mode == "goods" ? "我的浏览" : "我的订单"),
|
||
|
b: common_vendor.f(state.pagination.data, (item, k0, i0) => {
|
||
|
return common_vendor.e(__props.mode == "goods" ? {
|
||
|
a: "502edb98-1-" + i0 + ",502edb98-0",
|
||
|
b: common_vendor.p({
|
||
|
goodsData: item
|
||
|
})
|
||
|
} : {}, __props.mode == "order" ? {
|
||
|
c: "502edb98-2-" + i0 + ",502edb98-0",
|
||
|
d: common_vendor.p({
|
||
|
orderData: item
|
||
|
})
|
||
|
} : {}, {
|
||
|
e: item.id,
|
||
|
f: common_vendor.o(($event) => emits("select", {
|
||
|
type: __props.mode,
|
||
|
data: item
|
||
|
}), item.id)
|
||
|
});
|
||
|
}),
|
||
|
c: __props.mode == "goods",
|
||
|
d: __props.mode == "order",
|
||
|
e: common_vendor.p({
|
||
|
status: state.loadStatus,
|
||
|
["content-text"]: {
|
||
|
contentdown: "上拉加载更多"
|
||
|
}
|
||
|
}),
|
||
|
f: common_vendor.o(loadmore),
|
||
|
g: common_vendor.o(($event) => emits("close")),
|
||
|
h: common_vendor.p({
|
||
|
show: __props.show,
|
||
|
showClose: true,
|
||
|
round: "10",
|
||
|
backgroundColor: "#eee"
|
||
|
})
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-502edb98"]]);
|
||
|
wx.createComponent(Component);
|
||
|
//# sourceMappingURL=select-popup.js.map
|