withdraw.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
  5. const sheep_api_trade_config = require("../../sheep/api/trade/config.js");
  6. const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.js");
  7. require("../../sheep/url/index.js");
  8. require("../../sheep/store/index.js");
  9. require("../../sheep/store/app.js");
  10. require("../../sheep/api/promotion/diy.js");
  11. require("../../sheep/request/index.js");
  12. require("../../sheep/config/index.js");
  13. require("../../sheep/platform/index.js");
  14. require("../../sheep/platform/provider/wechat/index.js");
  15. require("../../sheep/platform/provider/wechat/miniProgram.js");
  16. require("../../sheep/api/member/auth.js");
  17. require("../../sheep/api/member/social.js");
  18. require("../../sheep/api/member/user.js");
  19. require("../../sheep/platform/provider/apple/index.js");
  20. require("../../sheep/platform/share.js");
  21. require("../../sheep/router/index.js");
  22. require("../../sheep/hooks/useModal.js");
  23. require("../../sheep/helper/index.js");
  24. require("../../sheep/helper/test.js");
  25. require("../../sheep/helper/digit.js");
  26. require("../../sheep/helper/throttle.js");
  27. require("../../sheep/platform/pay.js");
  28. require("../../sheep/api/pay/order.js");
  29. require("../../sheep/store/user.js");
  30. require("../../sheep/store/cart.js");
  31. require("../../sheep/api/trade/cart.js");
  32. require("../../sheep/api/pay/wallet.js");
  33. require("../../sheep/api/trade/order.js");
  34. require("../../sheep/api/promotion/coupon.js");
  35. require("../../sheep/store/sys.js");
  36. require("../../sheep/store/modal.js");
  37. require("../../sheep/config/zIndex.js");
  38. require("../../sheep/util/index.js");
  39. if (!Array) {
  40. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  41. const _easycom_s_uploader2 = common_vendor.resolveComponent("s-uploader");
  42. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  43. (_easycom_uni_easyinput2 + _easycom_s_uploader2 + _easycom_s_layout2)();
  44. }
  45. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  46. const _easycom_s_uploader = () => "../../sheep/components/s-uploader/s-uploader.js";
  47. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  48. if (!Math) {
  49. (_easycom_uni_easyinput + _easycom_s_uploader + accountTypeSelect + _easycom_s_layout)();
  50. }
  51. const accountTypeSelect = () => "./components/account-type-select.js";
  52. const _sfc_main = {
  53. __name: "withdraw",
  54. setup(__props) {
  55. common_vendor.useCssVars((_ctx) => ({
  56. "11aa8d88": common_vendor.unref(headerBg)
  57. }));
  58. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
  59. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  60. const userStore = sheep_index.sheep.$store("user");
  61. common_vendor.computed(() => userStore.userInfo);
  62. const state = common_vendor.reactive({
  63. accountInfo: {
  64. // 提现表单
  65. type: void 0,
  66. accountNo: void 0,
  67. accountQrCodeUrl: void 0,
  68. name: void 0,
  69. bankName: void 0,
  70. bankAddress: void 0
  71. },
  72. accountSelect: false,
  73. brokerageInfo: {},
  74. // 分销信息
  75. frozenDays: 0,
  76. // 冻结天数
  77. minPrice: 0,
  78. // 最低提现金额
  79. withdrawTypes: []
  80. // 提现方式
  81. });
  82. const onAccountSelect = (e) => {
  83. state.accountSelect = e;
  84. };
  85. const onConfirm = async () => {
  86. debugger;
  87. if (!state.accountInfo.price || state.accountInfo.price > state.brokerageInfo.price || state.accountInfo.price <= 0) {
  88. sheep_index.sheep.$helper.toast("请输入正确的提现金额");
  89. return;
  90. }
  91. if (!state.accountInfo.type) {
  92. sheep_index.sheep.$helper.toast("请选择提现方式");
  93. return;
  94. }
  95. let { code } = await sheep_api_trade_brokerage.BrokerageApi.createBrokerageWithdraw({
  96. ...state.accountInfo,
  97. price: state.accountInfo.price * 100
  98. });
  99. if (code !== 0) {
  100. return;
  101. }
  102. common_vendor.index.showModal({
  103. title: "操作成功",
  104. content: "您的提现申请已成功提交",
  105. cancelText: "继续提现",
  106. confirmText: "查看记录",
  107. success: (res) => {
  108. if (res.confirm) {
  109. sheep_index.sheep.$router.go("/pages/commission/wallet", { type: 2 });
  110. return;
  111. }
  112. getBrokerageUser();
  113. state.accountInfo = {};
  114. }
  115. });
  116. };
  117. async function getWithdrawRules() {
  118. let { code, data } = await sheep_api_trade_config.TradeConfigApi.getTradeConfig();
  119. if (code !== 0) {
  120. return;
  121. }
  122. if (data) {
  123. state.minPrice = data.brokerageWithdrawMinPrice || 0;
  124. state.frozenDays = data.brokerageFrozenDays || 0;
  125. state.withdrawTypes = data.brokerageWithdrawTypes;
  126. }
  127. }
  128. async function getBrokerageUser() {
  129. const { data, code } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUser();
  130. if (code === 0) {
  131. state.brokerageInfo = data;
  132. }
  133. }
  134. common_vendor.onBeforeMount(() => {
  135. getWithdrawRules();
  136. getBrokerageUser();
  137. });
  138. return (_ctx, _cache) => {
  139. return common_vendor.e({
  140. a: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.brokerageInfo.brokeragePrice)),
  141. b: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/commission/wallet", {
  142. type: 2
  143. })),
  144. c: common_vendor.s({
  145. marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
  146. paddingTop: Number(statusBarHeight + 108) + "rpx"
  147. }),
  148. d: !state.accountInfo.type
  149. }, !state.accountInfo.type ? {} : {}, {
  150. e: state.accountInfo.type === "1"
  151. }, state.accountInfo.type === "1" ? {} : {}, {
  152. f: state.accountInfo.type === "2"
  153. }, state.accountInfo.type === "2" ? {} : {}, {
  154. g: state.accountInfo.type === "3"
  155. }, state.accountInfo.type === "3" ? {} : {}, {
  156. h: state.accountInfo.type === "4"
  157. }, state.accountInfo.type === "4" ? {} : {}, {
  158. i: common_vendor.o(($event) => onAccountSelect(true)),
  159. j: common_vendor.o(($event) => state.accountInfo.price = $event),
  160. k: common_vendor.p({
  161. inputBorder: false,
  162. type: "number",
  163. placeholder: "请输入提现金额",
  164. modelValue: state.accountInfo.price
  165. }),
  166. l: ["2", "3", "4"].includes(state.accountInfo.type),
  167. m: common_vendor.o(($event) => state.accountInfo.accountNo = $event),
  168. n: common_vendor.p({
  169. inputBorder: false,
  170. placeholder: "请输入提现账号",
  171. modelValue: state.accountInfo.accountNo
  172. }),
  173. o: ["2", "3", "4"].includes(state.accountInfo.type),
  174. p: ["2", "3"].includes(state.accountInfo.type),
  175. q: common_vendor.o(($event) => state.accountInfo.accountQrCodeUrl = $event),
  176. r: common_vendor.p({
  177. fileMediatype: "image",
  178. limit: "1",
  179. mode: "grid",
  180. imageStyles: {
  181. width: "168rpx",
  182. height: "168rpx"
  183. },
  184. url: state.accountInfo.accountQrCodeUrl
  185. }),
  186. s: ["2", "3"].includes(state.accountInfo.type),
  187. t: state.accountInfo.type === "4",
  188. v: common_vendor.o(($event) => state.accountInfo.name = $event),
  189. w: common_vendor.p({
  190. inputBorder: false,
  191. placeholder: "请输入持卡人姓名",
  192. modelValue: state.accountInfo.name
  193. }),
  194. x: state.accountInfo.type === "4",
  195. y: state.accountInfo.type === "4",
  196. z: common_vendor.o(($event) => state.accountInfo.bankName = $event),
  197. A: common_vendor.p({
  198. inputBorder: false,
  199. placeholder: "请输入提现银行",
  200. modelValue: state.accountInfo.bankName
  201. }),
  202. B: state.accountInfo.type === "4",
  203. C: state.accountInfo.type === "4",
  204. D: common_vendor.o(($event) => state.accountInfo.bankAddress = $event),
  205. E: common_vendor.p({
  206. inputBorder: false,
  207. placeholder: "请输入开户地址",
  208. modelValue: state.accountInfo.bankAddress
  209. }),
  210. F: state.accountInfo.type === "4",
  211. G: common_vendor.o(onConfirm),
  212. H: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.minPrice)),
  213. I: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.brokerageInfo.frozenPrice)),
  214. J: common_vendor.t(state.frozenDays),
  215. K: common_vendor.o(($event) => onAccountSelect(false)),
  216. L: common_vendor.o(($event) => state.accountInfo = $event),
  217. M: common_vendor.p({
  218. show: state.accountSelect,
  219. round: "10",
  220. methods: state.withdrawTypes,
  221. modelValue: state.accountInfo
  222. }),
  223. N: common_vendor.s(_ctx.__cssVars()),
  224. O: common_vendor.p({
  225. title: "申请提现",
  226. navbar: "inner"
  227. })
  228. });
  229. };
  230. }
  231. };
  232. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cf14c8af"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/commission/withdraw.vue"]]);
  233. wx.createPage(MiniProgramPage);