index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='cash-withdrawal'>
  4. <view class='nav acea-row'>
  5. <view v-for="(item,index) in navList" :key="index" class='item font-color'
  6. @click="swichNav(index,item)">
  7. <view class='line bg_color' :class='currentTab==index ? "on":""'></view>
  8. <view class='iconfont' :class='item.icon+" "+(currentTab==index ? "on":"")'></view>
  9. <view class="tab_text">{{item.name}}</view>
  10. </view>
  11. </view>
  12. <view class='wrapper'>
  13. <view :hidden='currentTab != 0' class='list'>
  14. <form @submit="subCash" report-submit='true'>
  15. <view class='item acea-row row-between-wrapper'>
  16. <view class='name'>姓名</view>
  17. <view class='input'>
  18. <input placeholder='请输入持卡人姓名' placeholder-class='placeholder' name="cardholder"
  19. maxlength="20"></input>
  20. </view>
  21. </view>
  22. <view class='item acea-row row-between-wrapper'>
  23. <view class='name'>卡号</view>
  24. <view class='input'>
  25. <input type='number' placeholder='请填写卡号' placeholder-class='placeholder'
  26. name="bankCardNo" maxlength="19"></input>
  27. </view>
  28. </view>
  29. <view class='item acea-row row-between-wrapper'>
  30. <view class='name'>Bank</view>
  31. <view class='input'>
  32. <picker @change="bindPickerChange" :value="index" :range="bankList">
  33. <text class='Bank'>{{bankList[index]}}</text>
  34. <text class='iconfont icon-qiepian38'></text>
  35. </picker>
  36. </view>
  37. </view>
  38. <view class='item acea-row row-between-wrapper'>
  39. <view class='name'>结算</view>
  40. <view class='input'><input
  41. :placeholder='settlementConfig.minPrice? "最低结算金额"+ settlementConfig.minPrice:"最低结算金额"+ 0'
  42. placeholder-class='placeholder' name="closingPrice" type='digit'></input></view>
  43. </view>
  44. <button formType="submit" class='bnt'
  45. :class="parseFloat(settlementConfig.brokerage)>parseFloat(settlementConfig.minPrice) ?'bg-color': 'bg-color-hui'">结算申请</button>
  46. </form>
  47. </view>
  48. <view :hidden='currentTab != 1' class='list'>
  49. <form @submit="subCash" report-submit='true'>
  50. <view class='item acea-row row-between-wrapper'>
  51. <view class='name'>姓名</view>
  52. <view class='input'>
  53. <input placeholder='请填写您的真实姓名' placeholder-class='placeholder' name="realName"
  54. maxlength="20"></input>
  55. </view>
  56. </view>
  57. <view class='item acea-row row-between-wrapper'>
  58. <view class='name'>账号</view>
  59. <view class='input'>
  60. <input placeholder='请填写您的微信账号' placeholder-class='placeholder' name="wechatNo"
  61. maxlength="20"></input>
  62. </view>
  63. </view>
  64. <view class='item acea-row row-between-wrapper'>
  65. <view class='name'>结算</view>
  66. <view class='input'>
  67. <input :placeholder='"最低结算金额"+ settlementConfig.minPrice|| 0'
  68. placeholder-class='placeholder' name="closingPrice" type='digit'
  69. maxlength="5"></input>
  70. </view>
  71. </view>
  72. <view class='item acea-row row-top row-between'>
  73. <view class='name'>收款码</view>
  74. <view class="input acea-row">
  75. <view class="picEwm" v-if="qrcodeUrlW">
  76. <image :src="qrcodeUrlW"></image>
  77. <text class='iconfont icon-guanbi1 font-color' @click='DelPicW'></text>
  78. </view>
  79. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("W")'
  80. v-else>
  81. <text class='iconfont icon-icon25201'></text>
  82. <view>上传图片</view>
  83. </view>
  84. </view>
  85. </view>
  86. <button formType="submit" class='bnt'
  87. :class="parseFloat(settlementConfig.brokerage)>parseFloat(settlementConfig.minPrice) ?'bg-color': 'bg-color-hui'">结算申请</button>
  88. </form>
  89. </view>
  90. <view :hidden='currentTab != 2' class='list'>
  91. <form @submit="subCash" report-submit='true'>
  92. <view class='item acea-row row-between-wrapper'>
  93. <view class='name'>姓名</view>
  94. <view class='input'>
  95. <input placeholder='请填写您的真实姓名' placeholder-class='placeholder' name="realName"
  96. maxlength="20"></input>
  97. </view>
  98. </view>
  99. <view class='item acea-row row-between-wrapper'>
  100. <view class='name'>账号</view>
  101. <view class='input'>
  102. <input placeholder='请填写您的支付宝账号' placeholder-class='placeholder' name="alipayAccount"
  103. maxlength="20"></input>
  104. </view>
  105. </view>
  106. <view class='item acea-row row-between-wrapper'>
  107. <view class='name'>结算</view>
  108. <view class='input'>
  109. <input :placeholder='"最低结算金额"+settlementConfig.minPrice' placeholder-class='placeholder'
  110. name="closingPrice" type='digit' maxlength="5"></input>
  111. </view>
  112. </view>
  113. <view class='item acea-row row-top row-between'>
  114. <view class='name'>收款码</view>
  115. <view class="input acea-row">
  116. <view class="picEwm" v-if="qrcodeUrlZ">
  117. <image :src="qrcodeUrlZ"></image>
  118. <text class='iconfont icon-guanbi1 font-color' @click='DelPicZ'></text>
  119. </view>
  120. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("Z")'
  121. v-else>
  122. <text class='iconfont icon-icon25201'></text>
  123. <view>上传图片</view>
  124. </view>
  125. </view>
  126. </view>
  127. <button formType="submit" class='bnt'
  128. :class="parseFloat(settlementConfig.brokerage)>parseFloat(settlementConfig.minPrice) ?'bg-color': 'bg-color-hui'">结算申请</button>
  129. </form>
  130. </view>
  131. <view class='tip'>
  132. 当前可提现金额: <text
  133. class="price">¥{{settlementConfig.brokerage?settlementConfig.brokerage:0}},</text>冻结佣金:¥{{settlementConfig.freezeBrokerage?settlementConfig.freezeBrokerage:0}}
  134. </view>
  135. <view class='tip'>
  136. 说明: 每笔佣金的冻结期为{{settlementConfig.freezeDay?settlementConfig.freezeDay:0}}天,到期后可提现
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </template>
  142. <script>
  143. // +----------------------------------------------------------------------
  144. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  145. // +----------------------------------------------------------------------
  146. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  147. // +----------------------------------------------------------------------
  148. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  149. // +----------------------------------------------------------------------
  150. // | Author: CRMEB Team <admin@crmeb.com>
  151. // +----------------------------------------------------------------------
  152. import {
  153. extractCash,
  154. closingConfigApi
  155. } from '@/api/user.js';
  156. import {
  157. toLogin
  158. } from '@/libs/login.js';
  159. import {
  160. mapGetters
  161. } from "vuex";
  162. import {
  163. Debounce
  164. } from '@/utils/validate.js'
  165. let app = getApp();
  166. export default {
  167. data() {
  168. return {
  169. navList: [{
  170. 'name': '',
  171. 'icon': 'icon-yinhangqia',
  172. 'type': 'bank'
  173. },
  174. {
  175. 'name': '',
  176. 'icon': 'icon-weixin2',
  177. 'type': 'wechat'
  178. },
  179. {
  180. 'name': '',
  181. 'icon': 'icon-icon34',
  182. 'type': 'alipay'
  183. }
  184. ],
  185. type: 'bank',
  186. currentTab: 0,
  187. index: 0,
  188. bankList: [], //提现银行
  189. userInfo: [],
  190. isClone: false,
  191. settlementConfig: {}, //结算配置
  192. qrcodeUrlW: "",
  193. qrcodeUrlZ: "",
  194. isCommitted: false, //防止多次提交
  195. theme: app.globalData.theme,
  196. };
  197. },
  198. computed: mapGetters(['isLogin']),
  199. watch: {
  200. isLogin: {
  201. handler: function(newV, oldV) {
  202. if (newV) {
  203. this.getClosingConfig();
  204. }
  205. },
  206. deep: true
  207. }
  208. },
  209. onLoad(options) {
  210. if (this.isLogin) {
  211. this.getClosingConfig();
  212. } else {
  213. toLogin();
  214. }
  215. },
  216. methods: {
  217. uploadpic: function(type) {
  218. let that = this;
  219. that.$util.uploadImageOne({
  220. url: 'upload/image',
  221. name: 'multipart',
  222. model: "user",
  223. pid: 1
  224. }, function(res) {
  225. if (type === 'W') {
  226. that.qrcodeUrlW = res;
  227. } else {
  228. that.qrcodeUrlZ = res;
  229. }
  230. });
  231. },
  232. /**
  233. * 删除图片
  234. *
  235. */
  236. DelPicW: function() {
  237. this.qrcodeUrlW = "";
  238. },
  239. DelPicZ: function() {
  240. this.qrcodeUrlZ = "";
  241. },
  242. /**
  243. * 获取用户结算配置
  244. *
  245. */
  246. getClosingConfig() {
  247. closingConfigApi().then(res => {
  248. let data = res.data;
  249. this.$set(this, 'bankList', data.bankList);
  250. this.settlementConfig = res.data;
  251. })
  252. },
  253. swichNav: function(i, item) {
  254. this.currentTab = i;
  255. this.type = item.type;
  256. },
  257. bindPickerChange: function(e) {
  258. this.index = e.detail.value;
  259. },
  260. moneyInput(e) {
  261. //正则表达试
  262. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  263. //重新赋值给input
  264. this.$nextTick(() => {
  265. this.money = e.target.value
  266. })
  267. },
  268. subCash: Debounce(function(e) {
  269. let that = this,
  270. value = e.detail.value;
  271. if(parseFloat(that.settlementConfig.brokerage) <=0) return;
  272. switch (that.currentTab) {
  273. case 0:
  274. if (value.cardholder.length == 0) return this.$util.Tips({
  275. title: '请填写持卡人姓名'
  276. });
  277. if (value.bankCardNo.length == 0) return this.$util.Tips({
  278. title: '请填写卡号'
  279. });
  280. value.bankName = that.bankList[that.index];
  281. break;
  282. case 1:
  283. if (value.wechatNo.length == 0) return this.$util.Tips({
  284. title: '请填写微信号'
  285. });
  286. if (value.realName.length == 0) return this.$util.Tips({
  287. title: '请填写真实姓名'
  288. });
  289. if (!that.qrcodeUrlW) return this.$util.Tips({
  290. title: '请填写微信收款码'
  291. });
  292. value.paymentCode = that.qrcodeUrlW;
  293. break;
  294. default:
  295. if (value.alipayAccount.length == 0) return this.$util.Tips({
  296. title: '请填写支付宝账号'
  297. });
  298. if (value.realName.length == 0) return this.$util.Tips({
  299. title: '请填写真实姓名'
  300. });
  301. if (!that.qrcodeUrlZ) return this.$util.Tips({
  302. title: '请填写支付宝收款码'
  303. });
  304. value.paymentCode = that.qrcodeUrlZ;
  305. break;
  306. }
  307. value.type = this.type;
  308. if (value.closingPrice.length == 0) return this.$util.Tips({
  309. title: '请填写结算金额'
  310. });
  311. if (!(/^(\d?)+(\.\d{0,2})?$/.test(value.closingPrice))) return this.$util.Tips({
  312. title: '结算金额保留2位小数'
  313. });
  314. if (parseFloat(value.closingPrice) < parseFloat(that.settlementConfig.minPrice)) return this.$util
  315. .Tips({
  316. title: '结算金额不能低于' + that.settlementConfig.minPrice
  317. });
  318. if (this.isCommitted == false) {
  319. this.isCommitted = true;
  320. extractCash(value).then(res => {
  321. return this.$util.Tips({
  322. title: "申请成功",
  323. icon: 'success'
  324. }, {
  325. tab: 2,
  326. url: '/pages/users/user_spread_user/index'
  327. });
  328. this.isCommitted = false;
  329. }).catch(err => {
  330. this.isCommitted = false;
  331. return this.$util.Tips({
  332. title: err
  333. });
  334. });
  335. }
  336. })
  337. }
  338. }
  339. </script>
  340. <style>
  341. body {
  342. height: 100% !important;
  343. }
  344. </style>
  345. <style lang="scss">
  346. page {
  347. background-color: #fff !important;
  348. }
  349. .cash-withdrawal .nav {
  350. height: 130rpx;
  351. box-shadow: 0 10rpx 10rpx #f8f8f8;
  352. }
  353. .cash-withdrawal .nav .item {
  354. font-size: 26rpx;
  355. flex: 1;
  356. text-align: center;
  357. }
  358. .cash-withdrawal .nav .item~.item {
  359. border-left: 1px solid #f0f0f0;
  360. }
  361. .cash-withdrawal .nav .item .iconfont {
  362. width: 40rpx;
  363. height: 40rpx;
  364. border-radius: 50%;
  365. @include coupons_border_color(theme);
  366. @include main_color(theme);
  367. text-align: center;
  368. line-height: 37rpx;
  369. margin: 0 auto 6rpx auto;
  370. font-size: 22rpx;
  371. box-sizing: border-box;
  372. }
  373. .cash-withdrawal .nav .item .iconfont.on {
  374. @include main_bg_color(theme);
  375. color: #fff !important;
  376. @include coupons_border_color(theme);
  377. // border-color: $theme-color;
  378. }
  379. .cash-withdrawal .nav .item .line {
  380. width: 2rpx;
  381. height: 20rpx;
  382. margin: 0 auto;
  383. transition: height 0.3s;
  384. }
  385. .tab_text {
  386. @include main_color(theme);
  387. }
  388. .bg_color {
  389. @include main_bg_color(theme);
  390. }
  391. .cash-withdrawal .nav .item .line.on {
  392. height: 39rpx;
  393. }
  394. .cash-withdrawal .wrapper .list {
  395. padding: 0 30rpx;
  396. }
  397. .cash-withdrawal .wrapper .list .item {
  398. border-bottom: 1rpx solid #eee;
  399. min-height: 28rpx;
  400. font-size: 30rpx;
  401. color: #333;
  402. padding: 39rpx 0;
  403. }
  404. .cash-withdrawal .wrapper .list .item .name {
  405. width: 130rpx;
  406. }
  407. .cash-withdrawal .wrapper .list .item .input {
  408. width: 505rpx;
  409. }
  410. .cash-withdrawal .wrapper .list .item .input .placeholder {
  411. color: #bbb;
  412. }
  413. .cash-withdrawal .wrapper .list .item .picEwm,
  414. .cash-withdrawal .wrapper .list .item .pictrue {
  415. width: 140rpx;
  416. height: 140rpx;
  417. border-radius: 3rpx;
  418. position: relative;
  419. margin-right: 23rpx;
  420. }
  421. .cash-withdrawal .wrapper .list .item .picEwm image {
  422. width: 100%;
  423. height: 100%;
  424. border-radius: 3rpx;
  425. }
  426. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1 {
  427. position: absolute;
  428. right: -14rpx;
  429. top: -16rpx;
  430. font-size: 40rpx;
  431. }
  432. .cash-withdrawal .wrapper .list .item .pictrue {
  433. border: 1px solid rgba(221, 221, 221, 1);
  434. font-size: 22rpx;
  435. color: #BBBBBB;
  436. }
  437. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201 {
  438. font-size: 47rpx;
  439. color: #DDDDDD;
  440. margin-bottom: 3px;
  441. }
  442. .cash-withdrawal .wrapper .tip {
  443. font-size: 26rpx;
  444. color: #999;
  445. margin-top: 25rpx;
  446. padding: 0 30rpx;
  447. }
  448. .cash-withdrawal .wrapper .bnt {
  449. font-size: 32rpx;
  450. color: #fff;
  451. width: 690rpx;
  452. height: 90rpx;
  453. text-align: center;
  454. border-radius: 50rpx;
  455. line-height: 90rpx;
  456. margin: 64rpx auto;
  457. }
  458. .cash-withdrawal .wrapper .tip2 {
  459. font-size: 26rpx;
  460. color: #999;
  461. text-align: center;
  462. margin: 44rpx 0 20rpx 0;
  463. }
  464. .cash-withdrawal .wrapper .value {
  465. height: 135rpx;
  466. line-height: 135rpx;
  467. border-bottom: 1rpx solid #eee;
  468. width: 690rpx;
  469. margin: 0 auto;
  470. }
  471. .cash-withdrawal .wrapper .value input {
  472. font-size: 80rpx;
  473. color: #282828;
  474. height: 135rpx;
  475. text-align: center;
  476. }
  477. .cash-withdrawal .wrapper .list .value .placeholder2 {
  478. color: #bbb;
  479. }
  480. .price {
  481. @include price_color(theme);
  482. }
  483. </style>