withdrawal.vue 7.2 KB

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