index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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">
  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="cardnum"></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">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  37. </view>
  38. <view class='tip'>
  39. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  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">
  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">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  69. </view>
  70. <view class='tip'>
  71. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  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">
  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">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  101. </view>
  102. <view class='tip'>
  103. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  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. getUserInfo
  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. qrcodeUrlW:"",
  160. qrcodeUrlZ:""
  161. };
  162. },
  163. computed: mapGetters(['isLogin']),
  164. watch:{
  165. isLogin:{
  166. handler:function(newV,oldV){
  167. if(newV){
  168. this.getUserInfo();
  169. this.getUserExtractBank();
  170. }
  171. },
  172. deep:true
  173. }
  174. },
  175. onLoad() {
  176. if (this.isLogin) {
  177. this.getUserInfo();
  178. this.getUserExtractBank();
  179. } else {
  180. toLogin();
  181. }
  182. },
  183. methods: {
  184. // uploadpicW(){
  185. // this.uploadpic(this.qrcodeUrlW);
  186. // },
  187. // uploadpicZ(){
  188. // this.uploadpic(this.qrcodeUrlZ);
  189. // },
  190. /**
  191. * 上传文件
  192. *
  193. */
  194. uploadpic: function (type) {
  195. let that = this;
  196. that.$util.uploadImageOne('upload/image', function (res) {
  197. if(type==='W'){
  198. that.qrcodeUrlW = res.data.url;
  199. }else{
  200. that.qrcodeUrlZ = res.data.url;
  201. }
  202. });
  203. },
  204. /**
  205. * 删除图片
  206. *
  207. */
  208. DelPicW: function () {
  209. this.qrcodeUrlW = "";
  210. },
  211. DelPicZ: function () {
  212. this.qrcodeUrlZ = "";
  213. },
  214. onLoadFun: function() {
  215. this.getUserInfo();
  216. this.getUserExtractBank();
  217. },
  218. // 授权关闭
  219. authColse: function(e) {
  220. this.isShowAuth = e
  221. },
  222. getUserExtractBank: function() {
  223. let that = this;
  224. extractBank().then(res => {
  225. let array = res.data.extractBank;
  226. array.unshift("请选择银行");
  227. that.$set(that, 'array', array);
  228. that.minPrice = res.data.minPrice;
  229. });
  230. },
  231. /**
  232. * 获取个人用户信息
  233. */
  234. getUserInfo: function() {
  235. let that = this;
  236. getUserInfo().then(res => {
  237. that.userInfo = res.data;
  238. });
  239. },
  240. swichNav: function(current) {
  241. this.currentTab = current;
  242. },
  243. bindPickerChange: function(e) {
  244. this.index = e.detail.value;
  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.cardnum.length == 0) return this.$util.Tips({
  254. title: '请填写卡号'
  255. });
  256. if (that.index == 0) return this.$util.Tips({
  257. title: "请选择银行"
  258. });
  259. value.extract_type = 'bank';
  260. value.bankname = that.array[that.index];
  261. } else if (that.currentTab == 1) { //微信
  262. value.extract_type = 'weixin';
  263. if (value.name.length == 0) return this.$util.Tips({
  264. title: '请填写微信号'
  265. });
  266. value.weixin = value.name;
  267. value.qrcode_url = that.qrcodeUrlW;
  268. } else if (that.currentTab == 2) { //支付宝
  269. value.extract_type = 'alipay';
  270. if (value.name.length == 0) return this.$util.Tips({
  271. title: '请填写账号'
  272. });
  273. value.alipay_code = value.name;
  274. value.qrcode_url = that.qrcodeUrlZ;
  275. }
  276. if (value.money.length == 0) return this.$util.Tips({
  277. title: '请填写提现金额'
  278. });
  279. if (value.money < that.minPrice) return this.$util.Tips({
  280. title: '提现金额不能低于' + that.minPrice
  281. });
  282. extractCash(value).then(res => {
  283. that.getUserInfo();
  284. return this.$util.Tips({
  285. title: res.msg,
  286. icon: 'success'
  287. },{url:'/pages/users/user_spread_user/index',tab:2});
  288. }).catch(err => {
  289. return this.$util.Tips({
  290. title: err
  291. });
  292. });
  293. }
  294. }
  295. }
  296. </script>
  297. <style lang="scss">
  298. page {
  299. background-color: #fff !important;
  300. }
  301. .cash-withdrawal .nav {
  302. height: 130rpx;
  303. box-shadow: 0 10rpx 10rpx #f8f8f8;
  304. }
  305. .cash-withdrawal .nav .item {
  306. font-size: 26rpx;
  307. flex: 1;
  308. text-align: center;
  309. }
  310. .cash-withdrawal .nav .item~.item {
  311. border-left: 1px solid #f0f0f0;
  312. }
  313. .cash-withdrawal .nav .item .iconfont {
  314. width: 40rpx;
  315. height: 40rpx;
  316. border-radius: 50%;
  317. border: 2rpx solid #e93323;
  318. text-align: center;
  319. line-height: 37rpx;
  320. margin: 0 auto 6rpx auto;
  321. font-size: 22rpx;
  322. box-sizing: border-box;
  323. }
  324. .cash-withdrawal .nav .item .iconfont.on {
  325. background-color: #e93323;
  326. color: #fff;
  327. border-color: #e93323;
  328. }
  329. .cash-withdrawal .nav .item .line {
  330. width: 2rpx;
  331. height: 20rpx;
  332. margin: 0 auto;
  333. transition: height 0.3s;
  334. }
  335. .cash-withdrawal .nav .item .line.on {
  336. height: 39rpx;
  337. }
  338. .cash-withdrawal .wrapper .list {
  339. padding: 0 30rpx;
  340. }
  341. .cash-withdrawal .wrapper .list .item {
  342. border-bottom: 1rpx solid #eee;
  343. min-height: 28rpx;
  344. font-size: 30rpx;
  345. color: #333;
  346. padding: 39rpx 0;
  347. }
  348. .cash-withdrawal .wrapper .list .item .name {
  349. width: 130rpx;
  350. }
  351. .cash-withdrawal .wrapper .list .item .input {
  352. width: 505rpx;
  353. }
  354. .cash-withdrawal .wrapper .list .item .input .placeholder {
  355. color: #bbb;
  356. }
  357. .cash-withdrawal .wrapper .list .item .picEwm,.cash-withdrawal .wrapper .list .item .pictrue{
  358. width:140rpx;
  359. height:140rpx;
  360. border-radius:3rpx;
  361. position: relative;
  362. margin-right: 23rpx;
  363. }
  364. .cash-withdrawal .wrapper .list .item .picEwm image{
  365. width:100%;
  366. height:100%;
  367. border-radius:3rpx;
  368. }
  369. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1{
  370. position:absolute;
  371. right: -14rpx;
  372. top: -16rpx;
  373. font-size:40rpx;
  374. }
  375. .cash-withdrawal .wrapper .list .item .pictrue{
  376. border:1px solid rgba(221,221,221,1);
  377. font-size:22rpx;
  378. color: #BBBBBB;
  379. }
  380. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201{
  381. font-size: 47rpx;
  382. color: #DDDDDD;
  383. margin-bottom: 3px;
  384. }
  385. .cash-withdrawal .wrapper .list .tip {
  386. font-size: 26rpx;
  387. color: #999;
  388. margin-top: 25rpx;
  389. }
  390. .cash-withdrawal .wrapper .list .bnt {
  391. font-size: 32rpx;
  392. color: #fff;
  393. width: 690rpx;
  394. height: 90rpx;
  395. text-align: center;
  396. border-radius: 50rpx;
  397. line-height: 90rpx;
  398. margin: 64rpx auto;
  399. }
  400. .cash-withdrawal .wrapper .list .tip2 {
  401. font-size: 26rpx;
  402. color: #999;
  403. text-align: center;
  404. margin: 44rpx 0 20rpx 0;
  405. }
  406. .cash-withdrawal .wrapper .list .value {
  407. height: 135rpx;
  408. line-height: 135rpx;
  409. border-bottom: 1rpx solid #eee;
  410. width: 690rpx;
  411. margin: 0 auto;
  412. }
  413. .cash-withdrawal .wrapper .list .value input {
  414. font-size: 80rpx;
  415. color: #282828;
  416. height: 135rpx;
  417. text-align: center;
  418. }
  419. .cash-withdrawal .wrapper .list .value .placeholder2 {
  420. color: #bbb;
  421. }
  422. .price {
  423. color: $theme-color;
  424. }
  425. </style>