withdrawal.vue 11 KB

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