index.vue 12 KB

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