withdrawal.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view class="content">
  3. <view class="" style="padding: 20rpx;font-size: 20rpx; color: #999;background-color: #fff;">
  4. 提现需收取{{commission || '0'}}%手续费
  5. </view>
  6. <view class="content-money">
  7. <view class="buttom">
  8. <text class="text">可提现金额</text>
  9. <view class="icon">
  10. <text>¥</text>
  11. {{ money }}
  12. </view>
  13. </view>
  14. <view class="interval"></view>
  15. <view class="buttom">
  16. <text class="text">申请提现金额</text>
  17. <view class=" icon">
  18. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  19. </view>
  20. </view>
  21. <view class="interval"></view>
  22. <view class="tip">
  23. <text class="tip-text">申请提现金额</text>
  24. <view class=" tip-icon" @click="all()">全部提现</view>
  25. </view>
  26. </view>
  27. <template v-if="withdrawal*1 > 0">
  28. <view class="sq">
  29. <text class="" style="font-size: 28rpx;">
  30. 手续费
  31. </text>
  32. <text class="num" style="font-size: 28rpx;">
  33. ¥{{ sxf | getMoneyStyle }}
  34. </text>
  35. </view>
  36. <view class="sq" >
  37. <text class="" style="font-size: 28rpx;">
  38. 实际到账
  39. </text>
  40. <text class="num" style="font-size: 28rpx;">
  41. ¥{{ sjdz | getMoneyStyle }}
  42. </text>
  43. </view>
  44. </template>
  45. <view class="list">
  46. <radio-group @change="tabRadio">
  47. <!-- <label>
  48. <view class="box">
  49. <view class="icon iconfont iconweixin1"></view>
  50. <view class="title-box">
  51. <view class="title"><text>提现至微信</text></view>
  52. </view>
  53. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  54. </view>
  55. </label> -->
  56. <label>
  57. <view class="box">
  58. <view class="icon iconfont iconzhifubao"></view>
  59. <view class="title-box">
  60. <view class="title">
  61. <text v-if="aliData.fullname != null">提现至支付宝</text>
  62. <text v-else>请创建支付宝账号</text>
  63. </view>
  64. <view class="node">
  65. <text v-if="aliData.fullname != null">真实姓名({{ aliData.fullname }})</text>
  66. </view>
  67. </view>
  68. <view class="right"><radio value="alipay" color="#FF4C4C" :checked="type == 'alipay'" /></view>
  69. </view>
  70. </label>
  71. <label>
  72. <view class="box">
  73. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  74. <view class="title-box">
  75. <view class="title">
  76. <text v-if="bankData.bankno != null">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  77. <text v-else>请创建银行账号</text>
  78. </view>
  79. <view class="node">
  80. <text v-if="bankData.fullname != null">真实姓名({{ bankData.fullname}})</text>
  81. </view>
  82. </view>
  83. <view class="right"><radio value="bank" color="#FF4C4C" :checked="type == 'bank'" /></view>
  84. </view>
  85. </label>
  86. </radio-group>
  87. </view>
  88. <button class="add-btn up" @click="loading?'':confirm()">提交申请</button>
  89. <button class="add-btn modified" @click="navTo('/pages/set/userinfo')">账号管理</button>
  90. </view>
  91. </template>
  92. <script>
  93. import { getMoneyStyle } from '@/utils/rocessor.js';
  94. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  95. import { mapState, mapMutations } from 'vuex';
  96. import { getUserInfo } from '@/api/user.js'
  97. export default {
  98. filters: {
  99. getMoneyStyle
  100. },
  101. data() {
  102. return {
  103. loading: true,
  104. // userInfo: {},
  105. commission: 0,
  106. type: 'alipay', //提现方式
  107. money: '', //可提现金额
  108. withdrawal: '', //提现金额
  109. minPrice: '', //最少提现金额
  110. coldMoney: '', //冻结中的金额
  111. aliData: { fullname: '', alino: '' },
  112. bankData: { fullname: '', bank: '', bankno: '' },
  113. // #ifdef H5
  114. weichatBsrowser: false
  115. // #endif
  116. };
  117. },
  118. computed: {
  119. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  120. moneyMin() {
  121. return '最低提现金额' + this.minPrice + '元';
  122. },
  123. //提现手续费
  124. sxf() {
  125. return (this.withdrawal*1*0.01*this.commission)
  126. },
  127. //实际到账
  128. sjdz() {
  129. return (this.withdrawal*1*(100-this.commission)*0.01)
  130. }
  131. },
  132. async onShow(options) {
  133. // #ifdef H5
  134. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  135. // #endif
  136. //加载提现信息
  137. await this.getUserInfo()
  138. this.loadData();
  139. // 加载提款账号信息
  140. this.aliData.fullname = this.userInfo.alipay_name;
  141. console.log(this.aliData.fullname);
  142. this.aliData.alino = this.userInfo.alipay_no;
  143. this.bankData.fullname = this.userInfo.bank_name;
  144. this.bankData.bank = this.userInfo.account_Bank + '(' + this.userInfo.bank_branch + ')';
  145. this.bankData.bankno = this.userInfo.bank_card;
  146. },
  147. methods: {
  148. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  149. getUserInfo() {
  150. getUserInfo({}).then(({data}) => {
  151. this.setUserInfo(data)
  152. })
  153. },
  154. // 加载余额信息
  155. async loadData() {
  156. extractBank({}).then(({ data }) => {
  157. console.log(data);
  158. this.commission = data.commission
  159. this.coldMoney = data.brokerage_price; //冻结中金额
  160. this.money = data.commissionCount * 1; //可提现余额
  161. this.minPrice = data.minPrice; //最小提现
  162. this.freeze = data.inmoneyCount; //提现中的余额
  163. this.loading = false
  164. });
  165. },
  166. // 跳转
  167. navTo(url) {
  168. uni.navigateTo({
  169. url: url
  170. });
  171. },
  172. all() {
  173. this.withdrawal = this.money;
  174. },
  175. // 切换选中对象
  176. tabRadio(e) {
  177. this.type = e.detail.value;
  178. },
  179. // 提交
  180. confirm() {
  181. console.log(this.withdrawal);
  182. if (this.withdrawal === '') {
  183. this.$api.msg('请填写需要提现的佣金');
  184. return;
  185. }
  186. if(this.withdrawal*1 > this.money*1 ) {
  187. this.$api.msg('可提金额不足!');
  188. return;
  189. }
  190. if (this.withdrawal == 0) {
  191. this.$api.msg('提现红利不能为0');
  192. return;
  193. }
  194. if (this.withdrawal < this.minPrice) {
  195. this.$api.msg('提现金额不能低于最小金额');
  196. return;
  197. }
  198. let data = {
  199. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  200. money: this.withdrawal, //金额
  201. money_type: 'brokerage' ,//0佣金1余额
  202. balance_type: 0,
  203. };
  204. if (this.type == 'alipay') {
  205. data.name = this.aliData.fullname;
  206. data.alipay_code = this.aliData.alino;
  207. }
  208. if (this.type == 'bank') {
  209. data.name = this.bankData.fullname;
  210. data.bankname = this.bankData.bank;
  211. data.cardnum = this.bankData.bankno;
  212. }
  213. this.loading = true
  214. extractCash(data)
  215. .then(e => {
  216. // uni.navigateTo({
  217. // url: '/pages/money/success?type=1'
  218. // });
  219. uni.showToast({
  220. title: '提交成功',
  221. duration: 2000,
  222. position: 'top'
  223. });
  224. this.getUserInfo()
  225. this.loadData()
  226. })
  227. .catch(e => {
  228. console.log();
  229. });
  230. }
  231. }
  232. };
  233. </script>
  234. <style lang="scss">
  235. page {
  236. height: 100%;
  237. }
  238. .content-money {
  239. padding: 0 20rpx;
  240. background-color: #ffffff;
  241. .buttom {
  242. display: flex;
  243. justify-content: space-between;
  244. align-items: center;
  245. height: 110rpx;
  246. }
  247. .interval {
  248. width: 100%;
  249. height: 1px;
  250. background: #e6e6e6;
  251. }
  252. .icon {
  253. font-size: 48rpx;
  254. font-family: SourceHanSansCN;
  255. font-weight: 500;
  256. color: #333333;
  257. text {
  258. font-size: 32rpx;
  259. }
  260. .input {
  261. text-align: right;
  262. flex: 1;
  263. font-size: 30rpx;
  264. color: $font-color-dark;
  265. }
  266. .iconlocation {
  267. text-align: right;
  268. font-size: 36rpx;
  269. color: $font-color-light;
  270. }
  271. }
  272. .text {
  273. font-size: 32rpx;
  274. font-family: PingFang SC;
  275. font-weight: 500;
  276. color: #333333;
  277. }
  278. .tip {
  279. height: 74rpx;
  280. display: flex;
  281. justify-content: space-between;
  282. align-items: center;
  283. .tip-text {
  284. font-size: 24rpx;
  285. font-family: PingFang SC;
  286. font-weight: 500;
  287. color: #999999;
  288. }
  289. .tip-icon {
  290. font-size: 26rpx;
  291. font-family: SourceHanSansCN;
  292. font-weight: 400;
  293. color: #438bed;
  294. }
  295. }
  296. }
  297. .add-btn {
  298. &.modified {
  299. color: #FF4C4C;
  300. border:1px solid #FF4C4C;
  301. }
  302. &.up {
  303. background: #FF4C4C;
  304. color: #fff;
  305. }
  306. display: flex;
  307. align-items: center;
  308. justify-content: center;
  309. width: 690rpx;
  310. height: 80rpx;
  311. margin: 0 auto;
  312. margin-top: 30rpx;
  313. font-size: $font-lg;
  314. border-radius: 10rpx;
  315. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  316. }
  317. .list {
  318. padding-left: 30rpx;
  319. margin-top: 30rpx;
  320. background-color: #ffffff;
  321. .box {
  322. display: flex;
  323. align-items: center;
  324. width: 100%;
  325. height: 120rpx;
  326. border-bottom: 1px solid $border-color-light;
  327. .icon {
  328. font-size: 48rpx;
  329. padding-right: 20rpx;
  330. .icon-img {
  331. height: 50rpx;
  332. width: 50rpx;
  333. }
  334. }
  335. .iconweixin1 {
  336. color: #18bf16;
  337. }
  338. .iconzhifubao {
  339. color: #08aaec;
  340. }
  341. .title-box {
  342. flex-grow: 1;
  343. text-align: left;
  344. .title {
  345. font-size: $font-base + 2rpx;
  346. color: $font-color-base;
  347. }
  348. .node {
  349. font-size: $font-sm;
  350. color: $font-color-light;
  351. }
  352. }
  353. }
  354. }
  355. /deep/ .uni-radio-input {
  356. width: 45rpx;
  357. height: 45rpx;
  358. }
  359. .sq {
  360. // height: 110rpx;
  361. padding: 10rpx 20rpx;
  362. background-color: #fff;
  363. font-size: 32rpx;
  364. font-weight: 600;
  365. color: #333333;
  366. // line-height: 110rpx;
  367. display: flex;
  368. justify-content: space-between;
  369. .num {
  370. font-size: 40rpx;
  371. font-weight: bold;
  372. color: #333333;
  373. // line-height: 46px;
  374. }
  375. }
  376. </style>