withdraw.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
  3. <!-- <view class="page-bg"></view> -->
  4. <!-- <view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
  5. {
  6. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  7. paddingTop: Number(statusBarHeight + 108) + 'rpx',
  8. },
  9. ]">
  10. <view class="">
  11. <view class="num-title">可提现金额(元)</view>
  12. <view class="wallet-num">{{ userInfo.commission }}</view>
  13. </view>
  14. <button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')">提现记录</button>
  15. </view> -->
  16. <!-- 提现输入卡片-->
  17. <view class="draw-card">
  18. <view class="card-title">提现金额</view>
  19. <view class="input-box ss-flex ss-col-center border-bottom">
  20. <view class="unit">¥</view>
  21. <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
  22. placeholder="请输入提现金额" />
  23. </view>
  24. <view class="card-title" v-show='txfag==1'>持卡人</view>
  25. <view class="input-box ss-flex ss-col-center border-bottom" v-show='txfag==1'>
  26. <view class="unit"></view>
  27. <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.name"
  28. placeholder="请输入持卡人姓名" />
  29. </view>
  30. <view class="card-title" v-show='txfag==1'>卡号</view>
  31. <view class="input-box ss-flex ss-col-center border-bottom" v-show='txfag==1'>
  32. <view class="unit"></view>
  33. <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountNo"
  34. placeholder="请输卡号" />
  35. </view>
  36. <view class="card-title">收款码</view>
  37. <view class="input-box ss-flex ss-col-center border-bottom">
  38. <view class="unit"></view>
  39. <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountQrCodeUrl"
  40. placeholder="请输收款码地址" />
  41. </view>
  42. <view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30" style='display:block'>
  43. <view class="name">选择提现方式:</view>
  44. <!-- <view class="bank-list ss-flex ss-col-center" style="margin-left:auto" >
  45. <view class="empty-text">请选择提现方式</view>
  46. <text class="cicon-forward"></text>
  47. </view> -->
  48. <uni-section title="单选" type="line">
  49. <view class="uni-px-5 uni-pb-5" style='font-size:28rpx'>
  50. <uni-data-checkbox v-model="txfag" :localdata="txList"></uni-data-checkbox>
  51. </view>
  52. </uni-section>
  53. </view>
  54. <view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30" v-show='txfag==1'>
  55. <view class="name">选择银行</view>
  56. <view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
  57. <view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
  58. <view v-if="state.accountInfo.type === '0'" class="empty-text">工商银行</view>
  59. <view v-if="state.accountInfo.type === '1'" class="empty-text">建设银行</view>
  60. <view v-if="state.accountInfo.type === '2'" class="empty-text">农业银行</view>
  61. <text class="cicon-forward"></text>
  62. </view>
  63. </view>
  64. <view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type">
  65. <view class="placeholder-text" v-if="state.accountInfo.account_name">
  66. {{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }}
  67. </view>
  68. </view>
  69. <button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
  70. 确认提现
  71. </button>
  72. </view>
  73. <!-- 提现说明 -->
  74. <view class="draw-notice">
  75. <view class="title ss-m-b-30">提现说明</view>
  76. <!-- <view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index">
  77. {{ index + 1 }}.{{ rule }}
  78. </view>-->
  79. <view class="draw-list">
  80. 当前可提现金额:<text>¥{{state.userGet.brokeragePrice}}</text>
  81. </view>
  82. <view class="draw-list">
  83. 冻结佣金:<text>¥{{state.userGet.frozenPrice}}</text>
  84. </view>
  85. <view class="draw-list">
  86. 说明:每笔佣金冻结期为0天,到期后可提现
  87. </view>
  88. </view>
  89. <!-- 选择提现账户 -->
  90. <account-type-select :show="state.accountSelect" @close="onAccountSelect(false)" round="10"
  91. v-model="state.accountInfo" :methods="state.rules.methods" />
  92. <!-- 编辑账户信息 -->
  93. <account-info-modal v-if="state.accountInfo.type" v-model="state.accountInfo" :show="state.accountEdit"
  94. @close="onAccountEdit(false)" round="10" />
  95. </s-layout>
  96. </template>
  97. <script setup>
  98. import {
  99. computed,
  100. reactive,
  101. onBeforeMount,ref
  102. } from 'vue';
  103. import sheep from '@/sheep';
  104. import accountTypeSelect from './components/account-type-select.vue';
  105. import accountInfoModal from './components/account-info-modal.vue';
  106. import {
  107. onPageScroll
  108. } from '@dcloudio/uni-app';
  109. const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
  110. onPageScroll(() => {});
  111. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  112. function filterRules(rules) {
  113. let list = [];
  114. let str1 = '';
  115. if (rules.min_amount > 0) {
  116. str1 += `最少 ${rules.min_amount}元; `;
  117. }
  118. if (rules.max_amount > 0) {
  119. str1 += `最多 ${rules.max_amount}元;`;
  120. }
  121. if (str1 !== '') {
  122. list.push('单次提现金额 ' + str1);
  123. }
  124. if (rules.max_num > 0) {
  125. list.push(`每${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num} 次;`);
  126. }
  127. if (rules.charge_rate_format > 0) {
  128. list.push(`每次收取提现手续费 ${rules.charge_rate_format}%;`);
  129. }
  130. list.push(
  131. `提现申请后将${rules.auto_arrival ? '自动' : '审核后'}到账, 到账结果请查收对应渠道服务通知;`,
  132. );
  133. list.push('如有疑问请及时联系客服.');
  134. return list;
  135. }
  136. let txfag=ref(1)
  137. const txList=[{text:'银行卡提现',value:1},{text:'微信提现',value:2},{text:'支付宝提现',value:3}]
  138. function tixian(v){
  139. console.log(v)
  140. }
  141. const userStore = sheep.$store('user');
  142. const userInfo = computed(() => userStore.userInfo);
  143. const state = reactive({
  144. userGet: {},
  145. accountNo: '',
  146. name: '',
  147. amount: '',
  148. type: '',
  149. accountInfo: {},
  150. accountSelect: false,
  151. accountEdit: false,
  152. rules: {
  153. min_amount: 0,
  154. max_amount: 0,
  155. max_num: 0,
  156. num_unit: 0,
  157. charge_rate_format: 0,
  158. charge_rate: 0,
  159. methods: [],
  160. },
  161. rulesList: [],
  162. accountQrCodeUrl:''
  163. });
  164. const onAccountEdit = (e) => {
  165. state.accountEdit = e;
  166. };
  167. const onAccountSelect = (e) => {
  168. state.accountSelect = e;
  169. };
  170. const onConfirm = async () => {
  171. let payload = {
  172. accountNo: state.accountNo,
  173. name: state.name,
  174. bankName: state.accountInfo.type,
  175. type: txfag.value,
  176. price: state.amount * 100,
  177. accountQrCodeUrl:state.accountQrCodeUrl
  178. };
  179. console.log(payload);
  180. // return;
  181. // if (payload.money > userInfo.commission || payload.money <= 0) {
  182. // sheep.$helper.toast('请输入正确的提现金额');
  183. // return;
  184. // }
  185. // if (!payload.type) {
  186. // sheep.$helper.toast('请选择提现方式');
  187. // return;
  188. // }
  189. // if (!payload.account_name || !payload.account_header || !payload.account_no) {
  190. // sheep.$helper.toast('请完善您的账户信息');
  191. // return;
  192. // }
  193. // if (sheep.$platform.name === 'H5' && payload.type === 'wechat') {
  194. // sheep.$helper.toast('请使用微信浏览器操作');
  195. // return;
  196. // }
  197. let {
  198. code,
  199. msg,
  200. data
  201. } = await sheep.$api.pay.withdraw.apply(payload);
  202. if (code === -1) {
  203. sheep.$platform.useProvider('wechat').bind();
  204. }
  205. if (code === 0) {
  206. userStore.getInfo();
  207. uni.showModal({
  208. title: '操作成功',
  209. content: '您的提现申请已成功提交',
  210. cancelText: '继续提现',
  211. confirmText: '查看记录',
  212. success: function(res) {
  213. res.confirm && sheep.$router.go('/pages/pay/withdraw-log');
  214. },
  215. });
  216. }
  217. };
  218. async function getWithdrawRules() {
  219. let {
  220. error,
  221. data
  222. } = await sheep.$api.pay.withdraw.rules();
  223. if (error === 0) {
  224. state.rules = data;
  225. state.rulesList = filterRules(state.rules);
  226. }
  227. }
  228. onBeforeMount(async () => {
  229. getWithdrawRules();
  230. let res = await sheep.$api.pay.withdraw.userGet();
  231. state.userGet = res.data
  232. });
  233. </script>
  234. <style lang="scss" scoped>
  235. :deep() {
  236. .uni-input-input {
  237. font-family: OPPOSANS !important;
  238. }
  239. }
  240. .wallet-num-box {
  241. padding: 0 40rpx 80rpx;
  242. background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
  243. border-radius: 0 0 5% 5%;
  244. .num-title {
  245. font-size: 26rpx;
  246. font-weight: 500;
  247. color: $white;
  248. margin-bottom: 20rpx;
  249. }
  250. .wallet-num {
  251. font-size: 60rpx;
  252. font-weight: 500;
  253. color: $white;
  254. font-family: OPPOSANS;
  255. }
  256. .log-btn {
  257. width: 170rpx;
  258. height: 60rpx;
  259. line-height: 60rpx;
  260. border: 1rpx solid $white;
  261. border-radius: 30rpx;
  262. padding: 0;
  263. font-size: 26rpx;
  264. font-weight: 500;
  265. color: $white;
  266. }
  267. }
  268. // 提现输入卡片
  269. .draw-card {
  270. background-color: $white;
  271. border-radius: 20rpx;
  272. width: 690rpx;
  273. min-height: 560rpx;
  274. margin: -60rpx 30rpx 30rpx 30rpx;
  275. padding: 30rpx;
  276. position: relative;
  277. z-index: 3;
  278. box-sizing: border-box;
  279. .card-title {
  280. font-size: 30rpx;
  281. font-weight: 500;
  282. margin-bottom: 30rpx;
  283. }
  284. .bank-box {
  285. .name {
  286. font-size: 28rpx;
  287. font-weight: 500;
  288. }
  289. .bank-list {
  290. .empty-text {
  291. font-size: 28rpx;
  292. font-weight: 400;
  293. color: $dark-9;
  294. }
  295. .cicon-forward {
  296. color: $dark-9;
  297. }
  298. }
  299. .input-box {
  300. width: 624rpx;
  301. height: 100rpx;
  302. margin-bottom: 40rpx;
  303. .unit {
  304. font-size: 48rpx;
  305. color: #333;
  306. font-weight: 500;
  307. }
  308. .uni-easyinput__placeholder-class {
  309. font-size: 30rpx;
  310. height: 36rpx;
  311. }
  312. :deep(.uni-easyinput__content-input) {
  313. font-size: 48rpx;
  314. }
  315. }
  316. .save-btn {
  317. width: 616rpx;
  318. height: 86rpx;
  319. line-height: 86rpx;
  320. border-radius: 40rpx;
  321. margin-top: 80rpx;
  322. }
  323. }
  324. .bind-box {
  325. .placeholder-text {
  326. font-size: 26rpx;
  327. color: $dark-9;
  328. }
  329. .add-btn {
  330. width: 100rpx;
  331. height: 50rpx;
  332. border-radius: 25rpx;
  333. line-height: 50rpx;
  334. font-size: 22rpx;
  335. color: var(--ui-BG-Main);
  336. background-color: var(--ui-BG-Main-light);
  337. }
  338. }
  339. .input-box {
  340. width: 624rpx;
  341. height: 100rpx;
  342. margin-bottom: 40rpx;
  343. .unit {
  344. font-size: 48rpx;
  345. color: #333;
  346. font-weight: 500;
  347. }
  348. .uni-easyinput__placeholder-class {
  349. font-size: 30rpx;
  350. }
  351. :deep(.uni-easyinput__content-input) {
  352. font-size: 48rpx;
  353. }
  354. }
  355. .save-btn {
  356. width: 616rpx;
  357. height: 86rpx;
  358. line-height: 86rpx;
  359. border-radius: 40rpx;
  360. margin-top: 80rpx;
  361. }
  362. }
  363. // 提现说明
  364. .draw-notice {
  365. width: 684rpx;
  366. background: #ffffff;
  367. border: 2rpx solid #fffaee;
  368. border-radius: 20rpx;
  369. margin: 20rpx 32rpx 0 32rpx;
  370. padding: 30rpx;
  371. box-sizing: border-box;
  372. .title {
  373. font-weight: 500;
  374. color: #333333;
  375. font-size: 30rpx;
  376. }
  377. .draw-list {
  378. font-size: 24rpx;
  379. color: #999999;
  380. line-height: 46rpx;
  381. }
  382. }
  383. </style>