withdrawal.vue 10 KB

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