withdrawal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="实际到账98%"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex " style="width: 750rpx;justify-content: space-around;margin-left: 0;">
  6. <view class="buttom">
  7. <view class="icon">{{ money }}</view>
  8. <text class="text">可提现佣金</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="row-box">
  13. <view class="title">提现金额</view>
  14. <view class="row">
  15. <text class="tit">¥</text>
  16. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'"
  17. placeholder-class="placeholder" />
  18. <view class="buttom" @click="withdrawal = money">全部提现</view>
  19. </view>
  20. <view class="tip" v-if="withdrawal">
  21. 提现手续费{{sxf}}%,实际到账{{(withdrawal*1 - (withdrawal*1*sxf*1/100)).toFixed(2)*1}}
  22. </view>
  23. </view>
  24. <view class="">
  25. </view>
  26. <view class="list">
  27. <radio-group @change="tabRadio">
  28. <template>
  29. <!-- <label>
  30. <view class="box">
  31. <view class="icon iconfont iconzhifubao"></view>
  32. <view class="title-box">
  33. <view class="title"><text>提现至支付宝</text></view>
  34. </view>
  35. <view class="right"><radio value="alipay" color="#ff2d2d" :checked="type == 'alipay'" /></view>
  36. </view>
  37. </label> -->
  38. <label>
  39. <view class="box">
  40. <view class="icon iconfont">
  41. <image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image>
  42. </view>
  43. <view class="title-box">
  44. <view class="title"><text>提现银行账号</text></view>
  45. </view>
  46. <view class="right">
  47. <radio value="bank" color="#9a82e2" :checked="type == 'bank'" />
  48. </view>
  49. </view>
  50. </label>
  51. </template>
  52. </radio-group>
  53. </view>
  54. <template>
  55. <view class="row b-b" v-if="type == 'alipay'">
  56. <text class="tit">姓名</text>
  57. <input class="input" type="text" v-model="ali_people" placeholder="请输入支付宝姓名"
  58. placeholder-class="placeholder" />
  59. </view>
  60. <view class="row b-b" v-if="type == 'alipay'">
  61. <text class="tit">支付宝账号</text>
  62. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号"
  63. placeholder-class="placeholder" />
  64. </view>
  65. <view class="row b-b" v-if="type == 'bank'">
  66. <text class="tit">姓名</text>
  67. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名"
  68. placeholder-class="placeholder" />
  69. </view>
  70. <view class="row b-b" v-if="type == 'bank'">
  71. <text class="tit">银行卡号</text>
  72. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号"
  73. placeholder-class="placeholder" />
  74. </view>
  75. <view class="row b-b" v-if="type == 'bank'">
  76. <text class="tit">手机号</text>
  77. <input class="input" type="text" v-model="phone" placeholder="请输入手机号" placeholder-class="placeholder" />
  78. </view>
  79. <view class="row b-b" v-if="type == 'bank'">
  80. <text class="tit">所属银行</text>
  81. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行"
  82. placeholder-class="placeholder" />
  83. </view>
  84. </template>
  85. <!-- <view class="row b-b" v-if="type == 'bank'">
  86. <text class="tit">所属支行</text>
  87. <input class="input" type="text" v-model="bank_belonging" placeholder="请输入所属支行"
  88. placeholder-class="placeholder" />
  89. </view> -->
  90. <button class="add-btn up" @click="confirm">提交申请</button>
  91. </view>
  92. </template>
  93. <script>
  94. import {
  95. getMoneyStyle
  96. } from '@/utils/rocessor.js';
  97. import {
  98. extractCash,
  99. extractBank,
  100. aliInfo,
  101. bankInfo,
  102. setBank,
  103. getBank
  104. } from '@/api/wallet.js';
  105. import {
  106. orderData,
  107. getUserInfo
  108. } from '@/api/user.js';
  109. import {
  110. mapState,
  111. mapMutations
  112. } from 'vuex';
  113. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  114. export default {
  115. filters: {
  116. getMoneyStyle
  117. },
  118. components: {
  119. uniNoticeBar
  120. },
  121. computed: {
  122. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  123. },
  124. data() {
  125. return {
  126. ali_people: '',
  127. loading: false,
  128. phone: '',
  129. weixin_no: '',
  130. type: 'bank', //提现方式
  131. money: '0.00', //可提现金额
  132. freeze: '0.0', //冻结金额
  133. withdrawal: '', //提现金额
  134. minPrice: '', //最少提现金额
  135. weixin: {},
  136. alipay_code: '',
  137. alipay_name: '',
  138. bank_code: '',
  139. bank_people: '',
  140. bank_name: '',
  141. bank_belonging: '',
  142. sxf: ''
  143. };
  144. },
  145. onLoad(options) {
  146. //加载提现信息
  147. this.loadData();
  148. },
  149. methods: {
  150. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  151. async loadData() {
  152. extractBank({}).then(({
  153. data
  154. }) => {
  155. console.log(data, 'data+++++++++');
  156. this.minPrice = data.minPrice;
  157. this.money = data.brokerage_price;
  158. this.sxf = data.extract_commission
  159. if (data.extractInfo != null) {
  160. this.bank_people = data.extractInfo.real_name;
  161. this.bank_name = data.extractInfo.bank_address;
  162. this.bank_code = data.extractInfo.bank_code;
  163. this.phone = this.userInfo.phone;
  164. }
  165. });
  166. },
  167. // 跳转
  168. navTo(url) {
  169. uni.navigateTo({
  170. url: url
  171. });
  172. },
  173. // 切换选中对象
  174. tabRadio(e) {
  175. this.type = e.detail.value;
  176. },
  177. // 提交
  178. confirm() {
  179. let obj = this;
  180. if (obj.loading) {
  181. return;
  182. }
  183. let data = {
  184. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  185. money: this.withdrawal, //金额
  186. type: 0 //0佣金1余额
  187. };
  188. if (this.withdrawal * 1 < this.minPrice * 1) {
  189. uni.showToast({
  190. title: '提现金额不可少于' + this.minPrice,
  191. duration: 2000,
  192. mask: false,
  193. icon: 'none'
  194. });
  195. return;
  196. }
  197. if (obj.type == 'alipay') {
  198. if (obj.ali_people == '') {
  199. return obj.$api.msg('请输入姓名');
  200. }
  201. if (obj.alipay_code == '') {
  202. return obj.$api.msg('请输入支付宝账号');
  203. }
  204. data.name = obj.ali_people;
  205. data.alipay_code = obj.alipay_code;
  206. }
  207. // if (this.type == 'alipay') {
  208. // console.log('alipay');
  209. // data.name = this.aliData.name;
  210. // data.alipay_code = this.aliData.payment;
  211. // }
  212. if (obj.type == 'bank') {
  213. if (obj.bank_people == '') {
  214. return obj.$api.msg('请输入姓名');
  215. }
  216. if (obj.phone == '') {
  217. return obj.$api.msg('请输入手机号码');
  218. }
  219. if (obj.bank_name == '') {
  220. return obj.$api.msg('请输入所属银行');
  221. }
  222. if (obj.bank_code == '') {
  223. return obj.$api.msg('请输入银行卡号');
  224. }
  225. data.name = obj.bank_people;
  226. data.phone = obj.phone;
  227. data.bankname = obj.bank_name;
  228. data.cardnum = obj.bank_code;
  229. }
  230. // if (this.type == 'bank') {
  231. // console.log('bank');
  232. // data.name = this.bankData.name;
  233. // data.bankname = this.bankData.bank;
  234. // data.cardnum = this.bankData.payment;
  235. // // data.bank_belonging = this.bankData.bank_name
  236. // }
  237. if (this.type == 'weixin') {
  238. console.log('weixin');
  239. data.weixin = '123456';
  240. }
  241. obj.loading = true;
  242. extractCash(data)
  243. .then(e => {
  244. obj.loadData();
  245. obj.withdrawal = '';
  246. obj.loading = false;
  247. uni.showToast({
  248. title: '提交成功',
  249. duration: 2000,
  250. position: 'top'
  251. });
  252. })
  253. .catch(e => {
  254. obj.loading = false;
  255. });
  256. }
  257. }
  258. };
  259. </script>
  260. <style lang="scss">
  261. page {
  262. height: 100%;
  263. }
  264. .content-money {
  265. padding: 30rpx 0;
  266. background: #ffffff;
  267. }
  268. .flex {
  269. background-color: #ffffff;
  270. text-align: center;
  271. margin: 0 30rpx;
  272. border-radius: $border-radius-sm;
  273. .buttom {
  274. font-size: $font-lg;
  275. width: 50%;
  276. }
  277. .interval {
  278. width: 2px;
  279. height: 60rpx;
  280. background-color: #eeeeee;
  281. }
  282. .icon {
  283. background-size: 100%;
  284. font-size: 42rpx;
  285. color: $font-color-dark;
  286. font-weight: bold;
  287. background-repeat: no-repeat;
  288. background-position: center;
  289. }
  290. .text {
  291. color: $font-color-light;
  292. }
  293. }
  294. .row-box {
  295. margin-top: 30rpx;
  296. padding: 20rpx 30rpx;
  297. background: #fff;
  298. .title {
  299. font-size: $font-base + 2rpx;
  300. color: $font-color-dark;
  301. }
  302. .row {
  303. display: flex;
  304. align-items: center;
  305. position: relative;
  306. height: 80rpx;
  307. .tit {
  308. flex-shrink: 0;
  309. width: 40rpx;
  310. font-size: 30rpx;
  311. color: $font-color-dark;
  312. }
  313. .input {
  314. flex: 1;
  315. font-size: 30rpx;
  316. color: $font-color-dark;
  317. }
  318. .iconlocation {
  319. font-size: 36rpx;
  320. color: $font-color-light;
  321. }
  322. .buttom {
  323. color: #ff2d2d;
  324. font-size: $font-base;
  325. }
  326. }
  327. }
  328. .add-btn {
  329. &.modified {
  330. // color: #ffffff;
  331. border: 1px solid #ff4072;
  332. // background-color: #fff;
  333. color: #ff4072;
  334. }
  335. &.up {
  336. background: linear-gradient(270deg, #CA57DC, #65B2E9);
  337. color: #fff;
  338. }
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. width: 690rpx;
  343. height: 80rpx;
  344. margin: 0 auto;
  345. margin-top: 30rpx;
  346. font-size: $font-lg;
  347. border-radius: 10rpx;
  348. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  349. }
  350. .list {
  351. padding-left: 30rpx;
  352. margin-top: 30rpx;
  353. background-color: #ffffff;
  354. .box {
  355. display: flex;
  356. align-items: center;
  357. width: 100%;
  358. height: 120rpx;
  359. border-bottom: 1px solid $border-color-light;
  360. .icon {
  361. font-size: 48rpx;
  362. padding-right: 20rpx;
  363. .icon-img {
  364. height: 50rpx;
  365. width: 50rpx;
  366. }
  367. }
  368. .iconweixin1 {
  369. color: #18bf16;
  370. }
  371. .iconzhifubao {
  372. color: #08aaec;
  373. }
  374. .title-box {
  375. flex-grow: 1;
  376. text-align: left;
  377. .title {
  378. font-size: $font-base + 2rpx;
  379. color: $font-color-base;
  380. }
  381. .node {
  382. font-size: $font-sm;
  383. color: $font-color-light;
  384. }
  385. }
  386. }
  387. }
  388. /deep/ .uni-radio-input {
  389. width: 45rpx;
  390. height: 45rpx;
  391. }
  392. .row {
  393. display: flex;
  394. align-items: center;
  395. position: relative;
  396. padding: 0 30upx;
  397. height: 110upx;
  398. background: #fff;
  399. .tit {
  400. flex-shrink: 0;
  401. width: 250upx;
  402. font-size: 30upx;
  403. color: $font-color-dark;
  404. }
  405. .input {
  406. flex: 1;
  407. font-size: 30upx;
  408. color: $font-color-dark;
  409. }
  410. .iconlocation {
  411. font-size: 36upx;
  412. color: $font-color-light;
  413. }
  414. }
  415. .tip {
  416. padding: 20rpx;
  417. color: #fd3b39;
  418. }
  419. </style>