withdrawal.vue 9.9 KB

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