"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 modules_mall_sheep_index = require("../sheep/index.js"); const modules_mall_sheep_hooks_useGoods = require("../sheep/hooks/useGoods.js"); const modules_mall_sheep_api_trade_config = require("../sheep/api/trade/config.js"); const modules_mall_sheep_api_trade_brokerage = require("../sheep/api/trade/brokerage.js"); if (!Array) { const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput"); const _easycom_s_uploader2 = common_vendor.resolveComponent("s-uploader"); const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout"); const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni"); (_easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_s_layout2 + _component_layout_default_uni)(); } const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js"; const _easycom_s_uploader = () => "../sheep/components/s-uploader/s-uploader.js"; const _easycom_s_layout = () => "../sheep/components/s-layout/s-layout.js"; if (!Math) { (_easycom_uni_easyinput + _easycom_s_uploader + accountTypeSelect + _easycom_s_layout)(); } const accountTypeSelect = () => "./components/account-type-select.js"; const _sfc_main = { __name: "withdraw", setup(__props) { common_vendor.useCssVars((_ctx) => ({ "8fb7b444": common_vendor.unref(headerBg) })); const headerBg = modules_mall_sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png"); const statusBarHeight = modules_mall_sheep_index.sheep.$platform.device.statusBarHeight * 2; const userStore = modules_mall_sheep_index.sheep.$store("user"); common_vendor.computed(() => userStore.userInfo); const state = common_vendor.reactive({ accountInfo: { // 提现表单 type: void 0, accountNo: void 0, accountQrCodeUrl: void 0, name: void 0, bankName: void 0, bankAddress: void 0 }, accountSelect: false, brokerageInfo: {}, // 分销信息 frozenDays: 0, // 冻结天数 minPrice: 0, // 最低提现金额 withdrawTypes: [] // 提现方式 }); const onAccountSelect = (e) => { state.accountSelect = e; }; const onConfirm = () => __async(this, null, function* () { debugger; if (!state.accountInfo.price || state.accountInfo.price > state.brokerageInfo.price || state.accountInfo.price <= 0) { modules_mall_sheep_index.sheep.$helper.toast("请输入正确的提现金额"); return; } if (!state.accountInfo.type) { modules_mall_sheep_index.sheep.$helper.toast("请选择提现方式"); return; } const { code } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.createBrokerageWithdraw(__spreadProps(__spreadValues({}, state.accountInfo), { price: state.accountInfo.price * 100 })); if (code !== 0) { return; } common_vendor.index.showModal({ title: "操作成功", content: "您的提现申请已成功提交", cancelText: "继续提现", confirmText: "查看记录", success: (res) => { if (res.confirm) { modules_mall_sheep_index.sheep.$router.go("/modules/mall/commission/wallet", { type: 2 }); return; } getBrokerageUser(); state.accountInfo = {}; } }); }); function getWithdrawRules() { return __async(this, null, function* () { const { code, data } = yield modules_mall_sheep_api_trade_config.TradeConfigApi.getTradeConfig(); if (code !== 0) { return; } if (data) { state.minPrice = data.brokerageWithdrawMinPrice || 0; state.frozenDays = data.brokerageFrozenDays || 0; state.withdrawTypes = data.brokerageWithdrawTypes; } }); } function getBrokerageUser() { return __async(this, null, function* () { const { data, code } = yield modules_mall_sheep_api_trade_brokerage.BrokerageApi.getBrokerageUser(); if (code === 0) { state.brokerageInfo = data; } }); } common_vendor.onBeforeMount(() => { getWithdrawRules(); getBrokerageUser(); }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.brokerageInfo.brokeragePrice)), b: common_vendor.o(($event) => common_vendor.unref(modules_mall_sheep_index.sheep).$router.go("/modules/mall/commission/wallet", { type: 2 })), c: common_vendor.s({ marginTop: "-" + Number(statusBarHeight + 88) + "rpx", paddingTop: Number(statusBarHeight + 108) + "rpx" }), d: !state.accountInfo.type }, !state.accountInfo.type ? {} : {}, { e: state.accountInfo.type === "1" }, state.accountInfo.type === "1" ? {} : {}, { f: state.accountInfo.type === "2" }, state.accountInfo.type === "2" ? {} : {}, { g: state.accountInfo.type === "3" }, state.accountInfo.type === "3" ? {} : {}, { h: state.accountInfo.type === "4" }, state.accountInfo.type === "4" ? {} : {}, { i: common_vendor.o(($event) => onAccountSelect(true)), j: common_vendor.o(($event) => state.accountInfo.price = $event), k: common_vendor.p({ inputBorder: false, type: "number", placeholder: "请输入提现金额", modelValue: state.accountInfo.price }), l: ["2", "3", "4"].includes(state.accountInfo.type), m: common_vendor.o(($event) => state.accountInfo.accountNo = $event), n: common_vendor.p({ inputBorder: false, placeholder: "请输入提现账号", modelValue: state.accountInfo.accountNo }), o: ["2", "3", "4"].includes(state.accountInfo.type), p: ["3", "4"].includes(state.accountInfo.type), q: common_vendor.o(($event) => state.accountInfo.accountQrCodeUrl = $event), r: common_vendor.p({ fileMediatype: "image", limit: "1", mode: "grid", imageStyles: { width: "168rpx", height: "168rpx" }, url: state.accountInfo.accountQrCodeUrl }), s: ["3", "4"].includes(state.accountInfo.type), t: state.accountInfo.type === "2", v: common_vendor.o(($event) => state.accountInfo.name = $event), w: common_vendor.p({ inputBorder: false, placeholder: "请输入持卡人姓名", modelValue: state.accountInfo.name }), x: state.accountInfo.type === "2", y: state.accountInfo.type === "2", z: common_vendor.o(($event) => state.accountInfo.bankName = $event), A: common_vendor.p({ inputBorder: false, placeholder: "请输入提现银行", modelValue: state.accountInfo.bankName }), B: state.accountInfo.type === "2", C: state.accountInfo.type === "2", D: common_vendor.o(($event) => state.accountInfo.bankAddress = $event), E: common_vendor.p({ inputBorder: false, placeholder: "请输入开户地址", modelValue: state.accountInfo.bankAddress }), F: state.accountInfo.type === "2", G: common_vendor.o(onConfirm), H: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.minPrice)), I: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(state.brokerageInfo.frozenPrice)), J: common_vendor.t(state.frozenDays), K: common_vendor.o(($event) => onAccountSelect(false)), L: common_vendor.o(($event) => state.accountInfo = $event), M: common_vendor.p({ show: state.accountSelect, round: "10", methods: state.withdrawTypes, modelValue: state.accountInfo }), N: common_vendor.p({ title: "申请提现", navbar: "inner" }), O: common_vendor.s(_ctx.__cssVars()) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d0629fab"]]); wx.createPage(MiniProgramPage);