draw.vue 14 KB

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