acdr-ui/dist/dev/mp-weixin/modules/mall/commission/order.js

179 lines
6.2 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
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");
2024-10-01 09:15:35 +08:00
const modules_mall_sheep_index = require("../sheep/index.js");
const modules_mall_sheep_util_index = require("../sheep/util/index.js");
const modules_mall_sheep_api_trade_brokerage = require("../sheep/api/trade/brokerage.js");
const modules_mall_sheep_hooks_useGoods = require("../sheep/hooks/useGoods.js");
2024-09-19 07:20:14 +08:00
if (!Array) {
const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
(_easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2 + _component_layout_default_uni)();
}
2024-10-01 09:15:35 +08:00
const _easycom_su_tabs = () => "../sheep/ui/su-tabs/su-tabs.js";
const _easycom_su_sticky = () => "../sheep/ui/su-sticky/su-sticky.js";
const _easycom_s_empty = () => "../sheep/components/s-empty/s-empty.js";
2024-09-19 07:20:14 +08:00
const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
2024-10-01 09:15:35 +08:00
const _easycom_s_layout = () => "../sheep/components/s-layout/s-layout.js";
2024-09-19 07:20:14 +08:00
if (!Math) {
(_easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
}
const _sfc_main = {
__name: "order",
setup(__props) {
common_vendor.useCssVars((_ctx) => ({
"77f18e7a": common_vendor.unref(headerBg)
}));
2024-10-01 09:15:35 +08:00
const statusBarHeight = modules_mall_sheep_index.sheep.$platform.device.statusBarHeight * 2;
const headerBg = modules_mall_sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
2024-09-19 07:20:14 +08:00
common_vendor.onPageScroll((e) => {
state.scrollTop = e.scrollTop <= 100;
});
const state = common_vendor.reactive({
totals: 0,
// 累计推广订单(单)
scrollTop: false,
currentTab: 0,
loadStatus: "",
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 1
}
});
const tabMaps = [
{
name: "全部",
value: "all"
},
{
name: "待结算",
value: "0"
// 待结算
},
{
name: "已结算",
value: "1"
// 已结算
}
];
function onTabsChange(e) {
2024-10-01 09:15:35 +08:00
modules_mall_sheep_util_index.resetPagination(state.pagination);
2024-09-19 07:20:14 +08:00
state.currentTab = e.index;
getOrderList();
}
function getOrderList() {
return __async(this, null, function* () {
state.loadStatus = "loading";
2024-10-01 09:15:35 +08:00
const { code, data } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.getBrokerageRecordPage({
2024-09-19 07:20:14 +08:00
pageSize: state.pagination.pageSize,
pageNo: state.pagination.pageSize,
bizType: 1,
// 获得推广佣金
status: state.currentTab > 0 ? state.currentTab : void 0
});
if (code !== 0) {
return;
}
state.pagination.list = common_vendor.lodash.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
if (state.currentTab === 0) {
state.totals = data.total;
}
});
}
common_vendor.onLoad(() => {
getOrderList();
});
function loadMore() {
if (state.loadStatus === "noMore") {
return;
}
state.pagination.pageNo++;
getOrderList();
}
common_vendor.onReachBottom(() => {
loadMore();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(state.totals),
b: common_vendor.s({
marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
paddingTop: Number(statusBarHeight + 108) + "rpx"
}),
c: common_vendor.o(onTabsChange),
d: common_vendor.p({
list: tabMaps,
scrollable: false,
current: state.currentTab
}),
e: common_vendor.p({
bgColor: "#fff"
}),
f: common_vendor.f(state.pagination.list, (item, k0, i0) => {
return {
a: common_vendor.t(item.bizId),
b: common_vendor.t(item.status === 0 ? "待结算" : item.status === 1 ? "已结算" : "已取消"),
2024-10-01 09:15:35 +08:00
c: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.price)),
2024-09-19 07:20:14 +08:00
d: common_vendor.t(item.title),
2024-10-01 09:15:35 +08:00
e: common_vendor.t(common_vendor.unref(modules_mall_sheep_index.sheep).$helper.timeFormat(item.createTime, "yyyy-mm-dd hh:MM:ss")),
2024-09-19 07:20:14 +08:00
f: item
};
}),
g: state.pagination.total === 0
}, state.pagination.total === 0 ? {
h: common_vendor.p({
icon: "/static/order-empty.png",
text: "暂无订单"
})
} : {}, {
i: state.pagination.total > 0
}, state.pagination.total > 0 ? {
j: common_vendor.o(loadMore),
k: common_vendor.p({
status: state.loadStatus,
["content-text"]: {
contentdown: "上拉加载更多"
}
})
} : {}, {
l: common_vendor.n(state.scrollTop ? "order-warp" : ""),
m: common_vendor.p({
title: "分销订单",
navbar: "inner"
}),
n: common_vendor.s(_ctx.__cssVars())
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1f118ec3"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);