withdrawal.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="content">
  3. <view class="tip">提现7个工作日到账</view>
  4. <!-- 可提现金额 -->
  5. <view class="row-box">
  6. <view class="title">提现金额</view>
  7. <view class="row">
  8. <text class="tit">¥</text>
  9. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  10. <view class="buttom" @click="withdrawal = money">全部提现</view>
  11. </view>
  12. </view>
  13. <view class="navbar">
  14. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  15. </view>
  16. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  17. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  18. <view class="row b-b">
  19. <text class="tit">姓名</text>
  20. <input class="input" v-model="tabItem.orderList.name" type="text" placeholder="提款人姓名" placeholder-class="placeholder" />
  21. </view>
  22. <view class="row b-b" v-if="tabIndex==1">
  23. <text class="tit">账号</text>
  24. <input class="input" v-model="tabItem.orderList.code" type="text" placeholder="请输入账号" placeholder-class="placeholder" />
  25. </view>
  26. <view class="row b-b" v-if="tabIndex==0">
  27. <text class="tit">银行卡号</text>
  28. <input class="input" v-model="tabItem.orderList.code" type="text" placeholder="请输入银行卡号" placeholder-class="placeholder" />
  29. </view>
  30. <view class="row b-b" v-if="tabIndex==2">
  31. <text class="tit">微信号</text>
  32. <input class="input" v-model="tabItem.orderList.code" type="text" placeholder="请输入微信号" placeholder-class="placeholder" />
  33. </view>
  34. <view class="row b-b" v-if="tabIndex == 0">
  35. <text class="tit">所属银行</text>
  36. <input class="input" v-model="name" type="text" placeholder="请输入所属银行" placeholder-class="placeholder" />
  37. </view>
  38. <view class="row b-b" v-if="tabIndex == 0">
  39. <text class="tit">开户行</text>
  40. <input class="input" v-model="tabItem.orderList.bankName" type="text" placeholder="请输入开户地址所属支行" placeholder-class="placeholder" />
  41. </view>
  42. </swiper-item>
  43. </swiper>
  44. <!-- <view class="money-top">
  45. <view class="money">{{ money || 0.00 }}</view>
  46. <view class="text">可提现金额</view>
  47. </view> -->
  48. <button class="add-btn up" @click="confirm">提交申请</button>
  49. </view>
  50. </template>
  51. <script>
  52. import { withdraw_info,save_withdraw } from '@/api/wallet.js';
  53. import LbPicker from '@/components/lb-picker/index.vue'
  54. export default {
  55. components: {
  56. LbPicker
  57. },
  58. data() {
  59. return {
  60. withdrawal: '', //提现金额
  61. minPrice: '', //最少提现金额
  62. money: '0.00', //可提现金额
  63. tabCurrentIndex: 0,
  64. extract_type:'',//支付方式
  65. token:'',
  66. name:'',
  67. show: false,
  68. extract_bank:[],
  69. navList: [
  70. // {
  71. // state: 0,
  72. // text: '支付宝',
  73. // loadingType: 'more',
  74. // orderList: {
  75. // name: '',
  76. // code: '',
  77. // id: ''
  78. // }
  79. // },
  80. {
  81. state: 0,
  82. text: '银行卡',
  83. loadingType: 'more',
  84. orderList: {
  85. name: '',
  86. code: '',
  87. bankName: '',
  88. id: ''
  89. }
  90. },
  91. // {
  92. // state: 2,
  93. // text: '微信',
  94. // loadingType: 'more',
  95. // orderList: {
  96. // name: '',
  97. // code: '',
  98. // id: ''
  99. // }
  100. // }
  101. ]
  102. };
  103. },
  104. onLoad() {
  105. this.loadData();
  106. },
  107. methods: {
  108. // 加载余额信息
  109. async loadData() {
  110. withdraw_info({}).then(({ data }) => {
  111. this.money = data.brokerage_price;
  112. this.minPrice = data.extract_min_money;
  113. this.extract_bank = data.extract_bank;
  114. // this.freeze = data.incommissionCount;
  115. });
  116. },
  117. // 提交保存
  118. confirm() {
  119. let obj = this;
  120. // 获取当前选中的对象
  121. let arr = obj.navList[obj.tabCurrentIndex].orderList;
  122. let data = {
  123. money: obj.withdrawal, //金额
  124. name: arr.name
  125. };
  126. // 判断是否为支付宝
  127. // if (obj.tabCurrentIndex == 0) {
  128. // data.alipay_code = arr.code;
  129. // data.extract_type = 'alipay'
  130. // }
  131. // 判断是否为银行卡
  132. if (obj.tabCurrentIndex == 0) {
  133. data.bankname = obj.name+','+arr.bankName;
  134. data.cardnum = arr.code;
  135. data.extract_type = 'bank'
  136. }
  137. // 判断是否微信
  138. if (obj.tabCurrentIndex == 2) {
  139. data.weixin= arr.code;
  140. data.extract_type = 'weixin'
  141. }
  142. if (obj.withdrawal < obj.minPrice) {
  143. obj.$api.msg('提现金额必须大于' + obj.minPrice);
  144. return;
  145. }
  146. console.log(data,55)
  147. save_withdraw(data)
  148. .then(e => {
  149. obj.$api.msg(e.msg);
  150. obj.withdrawal = '';
  151. obj.loadData();
  152. setTimeout(function() {
  153. uni.navigateTo({
  154. url:'/pages/wallet/commission'
  155. })
  156. }, 1000);
  157. })
  158. .catch(e => {
  159. console.log();
  160. });
  161. },
  162. //swiper 切换
  163. changeTab(e) {
  164. this.tabCurrentIndex = e.target.current;
  165. },
  166. //顶部tab点击
  167. tabClick(index) {
  168. this.tabCurrentIndex = index;
  169. },
  170. }
  171. };
  172. </script>
  173. <style lang="scss">
  174. .row {
  175. display: flex;
  176. align-items: center;
  177. position: relative;
  178. padding: 0 30rpx;
  179. height: 110rpx;
  180. background: #fff;
  181. .tit {
  182. flex-shrink: 0;
  183. width: 180rpx;
  184. font-size: 30rpx;
  185. color: $font-color-dark;
  186. }
  187. .input {
  188. flex: 1;
  189. font-size: 30rpx;
  190. color: $font-color-dark;
  191. }
  192. .iconlocation {
  193. font-size: 36rpx;
  194. color: $font-color-light;
  195. }
  196. }
  197. page,
  198. .content {
  199. background: $page-color-base;
  200. height: 100%;
  201. padding-top: 10rpx;
  202. }
  203. .tip{
  204. font-size: 30rpx;
  205. width: 100%;
  206. color: #6786FB;
  207. background:rgba(103,134,251,0.18);
  208. padding: 15rpx 25rpx;
  209. }
  210. // 可提现金额
  211. .money-top {
  212. width: 100%;
  213. height: 120rpx;
  214. background: #FFFFFF;
  215. display: flex;
  216. justify-content: center;
  217. flex-direction: column;
  218. align-items: center;
  219. margin-bottom: 50rpx;
  220. .text {
  221. font-size: $font-base;
  222. font-weight: 500;
  223. color: rgba(102,102,102,1);
  224. }
  225. .money {
  226. font-size: 42rpx;
  227. font-weight: bold;
  228. color: rgba(51,51,51,1);
  229. }
  230. }
  231. .swiper-box {
  232. margin-bottom: 25rpx;
  233. height: 500rpx;
  234. }
  235. .navbar {
  236. margin-top: 20rpx;
  237. display: flex;
  238. height: 40px;
  239. padding: 0 5px;
  240. background: #fff;
  241. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  242. position: relative;
  243. z-index: 10;
  244. .nav-item {
  245. flex: 1;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. height: 100%;
  250. font-size: 15px;
  251. color: $font-color-dark;
  252. position: relative;
  253. &.current {
  254. color: $base-color;
  255. &:after {
  256. content: '';
  257. position: absolute;
  258. left: 50%;
  259. bottom: 0;
  260. transform: translateX(-50%);
  261. width: 44px;
  262. height: 0;
  263. border-bottom: 2px solid $base-color;
  264. }
  265. }
  266. }
  267. }
  268. .add-btn {
  269. &.up {
  270. background-color: $base-color;
  271. color: #fff;
  272. }
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. width: 690rpx;
  277. height: 80rpx;
  278. margin: 0 auto;
  279. margin-top: 30rpx;
  280. font-size: $font-lg;
  281. border-radius: 10rpx;
  282. background: $base-color;
  283. border-radius: 40px;
  284. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  285. }
  286. .row-box {
  287. padding: 20rpx 30rpx;
  288. background: #fff;
  289. .title {
  290. font-size: $font-base + 2rpx;
  291. color: $font-color-dark;
  292. }
  293. .row {
  294. display: flex;
  295. align-items: center;
  296. position: relative;
  297. height: 150rpx;
  298. .tit {
  299. flex-shrink: 0;
  300. width: 40rpx;
  301. font-size: 30rpx;
  302. color: $font-color-dark;
  303. }
  304. .input {
  305. flex: 1;
  306. font-size: 30rpx;
  307. color: $font-color-dark;
  308. }
  309. .iconlocation {
  310. font-size: 36rpx;
  311. color: $font-color-light;
  312. }
  313. .buttom {
  314. color: $font-color-spec;
  315. font-size: $font-base;
  316. }
  317. }
  318. }
  319. </style>