withdraw.js 10 KB

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