withdrawal.vue 11 KB

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