acdr-ui/dist/dev/mp-weixin/modules/mall/commission/wallet.js
2024-10-01 09:15:35 +08:00

258 lines
9.9 KiB
JavaScript

"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");
const modules_mall_sheep_index = require("../sheep/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");
const modules_mall_sheep_util_index = require("../sheep/util/index.js");
if (!Array) {
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
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_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
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_uni_datetime_picker2 + _easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_easyinput2 + _easycom_su_popup2 + _easycom_uni_load_more2 + _easycom_s_layout2 + _component_layout_default_uni)();
}
const _easycom_uni_datetime_picker = () => "../../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
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";
const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
const _easycom_su_popup = () => "../sheep/ui/su-popup/su-popup.js";
const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
const _easycom_s_layout = () => "../sheep/components/s-layout/s-layout.js";
if (!Math) {
(_easycom_uni_datetime_picker + _easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_easyinput + _easycom_su_popup + _easycom_uni_load_more + _easycom_s_layout)();
}
const _sfc_main = {
__name: "wallet",
setup(__props) {
common_vendor.useCssVars((_ctx) => ({
"6c9ce1a8": common_vendor.unref(headerBg)
}));
const headerBg = modules_mall_sheep_index.sheep.$url.css("/static/img/shop/user/wallet_card_bg.png");
const state = common_vendor.reactive({
showMoney: false,
summary: {},
// 分销信息
today: "",
date: [],
currentTab: 0,
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 1
},
loadStatus: "",
price: void 0,
showModal: false
});
const tabMaps = [
{
name: "分佣",
value: "1"
// BrokerageRecordBizTypeEnum.ORDER
},
{
name: "提现",
value: "2"
// BrokerageRecordBizTypeEnum.WITHDRAW
}
];
const dateFilterText = common_vendor.computed(() => {
if (state.date[0] === state.date[1]) {
return state.date[0];
} else {
return state.date.join("~");
}
});
function getLogList() {
return __async(this, null, function* () {
state.loadStatus = "loading";
const { code, data } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.getBrokerageRecordPage({
pageSize: state.pagination.pageSize,
pageNo: state.pagination.pageNo,
bizType: tabMaps[state.currentTab].value,
"createTime[0]": state.date[0] + " 00:00:00",
"createTime[1]": state.date[1] + " 23:59:59"
});
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";
});
}
function onChangeTab(e) {
modules_mall_sheep_util_index.resetPagination(state.pagination);
state.currentTab = e.index;
getLogList();
}
function onChangeTime(e) {
state.date[0] = e[0];
state.date[1] = e[e.length - 1];
modules_mall_sheep_util_index.resetPagination(state.pagination);
getLogList();
}
function onConfirm() {
return __async(this, null, function* () {
if (state.price <= 0) {
modules_mall_sheep_index.sheep.$helper.toast("请输入正确的金额");
return;
}
common_vendor.index.showModal({
title: "提示",
content: "确认把您的佣金转入到余额钱包中?",
success: function(res) {
return __async(this, null, function* () {
if (!res.confirm) {
return;
}
const { code } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.createBrokerageWithdraw({
type: 1,
// 钱包
price: state.price * 100
});
if (code === 0) {
state.showModal = false;
yield getAgentInfo();
onChangeTab({
index: 1
});
}
});
}
});
});
}
function getAgentInfo() {
return __async(this, null, function* () {
const { code, data } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserSummary();
if (code !== 0) {
return;
}
state.summary = data;
});
}
common_vendor.onLoad((options) => __async(this, null, function* () {
state.today = common_vendor.dayjs().format("YYYY-MM-DD");
state.date = [state.today, state.today];
if (options.type === 2) {
state.currentTab = 1;
}
getLogList();
getAgentInfo();
}));
common_vendor.onReachBottom(() => {
if (state.loadStatus === "noMore") {
return;
}
state.pagination.pageNo++;
getLogList();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(($event) => state.showMoney = !state.showMoney),
b: common_vendor.n(state.showMoney ? "cicon-eye" : "cicon-eye-off"),
c: common_vendor.t(state.showMoney ? common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.summary.withdrawPrice || 0) : "*****"),
d: common_vendor.o(($event) => common_vendor.unref(modules_mall_sheep_index.sheep).$router.go("/modules/mall/commission/withdraw")),
e: common_vendor.o(($event) => state.showModal = true),
f: common_vendor.t(state.showMoney ? common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.summary.frozenPrice || 0) : "*****"),
g: common_vendor.t(state.showMoney ? common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.summary.brokeragePrice || 0) : "*****"),
h: common_vendor.t(dateFilterText.value),
i: common_vendor.o(onChangeTime),
j: common_vendor.o(($event) => state.date = $event),
k: common_vendor.p({
type: "daterange",
end: state.today,
modelValue: state.date
}),
l: common_vendor.o(onChangeTab),
m: common_vendor.p({
list: tabMaps,
scrollable: false,
current: state.currentTab
}),
n: state.pagination.total === 0
}, state.pagination.total === 0 ? {
o: common_vendor.p({
icon: "/static/data-empty.png",
text: "暂无数据"
})
} : {}, {
p: common_vendor.o(($event) => state.price = $event),
q: common_vendor.p({
inputBorder: false,
type: "number",
placeholder: "请输入金额",
modelValue: state.price
}),
r: common_vendor.o(onConfirm),
s: common_vendor.o(($event) => state.showModal = false),
t: common_vendor.p({
show: state.showModal,
type: "bottom",
round: "20",
showClose: true
}),
v: state.pagination.total > 0
}, state.pagination.total > 0 ? {
w: common_vendor.f(state.pagination.list, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: item.price >= 0
}, item.price >= 0 ? {
c: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.price))
} : {
d: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.price))
}, {
e: common_vendor.t(common_vendor.unref(modules_mall_sheep_index.sheep).$helper.timeFormat(item.createTime, "yyyy-mm-dd hh:MM:ss")),
f: item.id
});
})
} : {}, {
x: state.pagination.total > 0
}, state.pagination.total > 0 ? {
y: common_vendor.p({
status: state.loadStatus,
["content-text"]: {
contentdown: "上拉加载更多"
}
})
} : {}, {
z: common_vendor.p({
title: "佣金"
}),
A: common_vendor.s(_ctx.__cssVars())
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e2d70286"]]);
wx.createPage(MiniProgramPage);