withdrawal.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="content" v-if="!sh">
  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/money/account')">账号管理</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. import { loadIndexs } from '@/api/index.js';
  76. export default {
  77. data() {
  78. return {
  79. sh: true,
  80. type: 'alipay', //提现方式
  81. money: '', //可提现金额
  82. withdrawal: '', //提现金额
  83. minPrice: '', //最少提现金额
  84. coldMoney: '', //冻结中的金额
  85. aliData: { fullname: '', alino: '' },
  86. bankData: { fullname: '', bank: '', bankno: '' },
  87. // #ifdef H5
  88. weichatBsrowser: false
  89. // #endif
  90. };
  91. },
  92. computed: {
  93. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  94. moneyMin() {
  95. return '最低提现金额' + this.minPrice + '元';
  96. }
  97. },
  98. onShow(options) {
  99. // #ifdef H5
  100. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  101. // #endif
  102. //加载提现信息
  103. this.loadData();
  104. // 加载提款账号信息
  105. this.aliData.fullname = this.userInfo.alipay_name;
  106. console.log(this.aliData.fullname);
  107. this.aliData.alino = this.userInfo.alipay_code;
  108. this.bankData.fullname = this.userInfo.bank_user_name;
  109. this.bankData.bank = this.userInfo.bank_name;
  110. this.bankData.bankno = this.userInfo.bank_code;
  111. },
  112. methods: {
  113. // 加载余额信息
  114. async loadData() {
  115. extractBank({}).then(({ data }) => {
  116. console.log(data);
  117. this.coldMoney = data.brokerage_price; //冻结中金额
  118. this.money = data.commissionCount * 1; //可提现余额
  119. this.minPrice = data.minPrice; //最小提现
  120. this.freeze = data.inmoneyCount; //提现中的余额
  121. });
  122. },
  123. // 跳转
  124. navTo(url) {
  125. uni.navigateTo({
  126. url: url
  127. });
  128. },
  129. all() {
  130. this.withdrawal = this.money;
  131. },
  132. // 切换选中对象
  133. tabRadio(e) {
  134. this.type = e.detail.value;
  135. },
  136. // 提交
  137. confirm() {
  138. console.log(this.withdrawal);
  139. if (this.withdrawal === '') {
  140. this.$api.msg('请填写需要提现的佣金');
  141. return;
  142. }
  143. if (this.withdrawal == 0) {
  144. this.$api.msg('提现佣金不能为0');
  145. return;
  146. }
  147. if (this.withdrawal < this.minPrice) {
  148. this.$api.msg('提现金额不能低于最小金额');
  149. return;
  150. }
  151. let data = {
  152. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  153. money: this.withdrawal, //金额
  154. money_type: 'brokerage' //0佣金1余额
  155. };
  156. if (this.type == 'alipay') {
  157. data.name = this.aliData.fullname;
  158. data.alipay_code = this.aliData.alino;
  159. }
  160. if (this.type == 'bank') {
  161. data.name = this.bankData.fullname;
  162. data.bankname = this.bankData.bank;
  163. data.cardnum = this.bankData.bankno;
  164. }
  165. extractCash(data)
  166. .then(e => {
  167. uni.navigateTo({
  168. url: '/pages/money/success?type=1'
  169. });
  170. })
  171. .catch(e => {
  172. console.log();
  173. });
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss">
  179. page {
  180. height: 100%;
  181. }
  182. .content-money {
  183. padding: 0 20rpx;
  184. background-color: #ffffff;
  185. .buttom {
  186. display: flex;
  187. justify-content: space-between;
  188. align-items: center;
  189. height: 110rpx;
  190. }
  191. .interval {
  192. width: 100%;
  193. height: 1px;
  194. background: #e6e6e6;
  195. }
  196. .icon {
  197. font-size: 48rpx;
  198. font-family: SourceHanSansCN;
  199. font-weight: 500;
  200. color: #333333;
  201. text {
  202. font-size: 32rpx;
  203. }
  204. .input {
  205. text-align: right;
  206. flex: 1;
  207. font-size: 30rpx;
  208. color: $font-color-dark;
  209. }
  210. .iconlocation {
  211. text-align: right;
  212. font-size: 36rpx;
  213. color: $font-color-light;
  214. }
  215. }
  216. .text {
  217. font-size: 32rpx;
  218. font-family: PingFang SC;
  219. font-weight: 500;
  220. color: #333333;
  221. }
  222. .tip {
  223. height: 74rpx;
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. .tip-text {
  228. font-size: 24rpx;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. color: #999999;
  232. }
  233. .tip-icon {
  234. font-size: 26rpx;
  235. font-family: SourceHanSansCN;
  236. font-weight: 400;
  237. color: #438bed;
  238. }
  239. }
  240. }
  241. .add-btn {
  242. &.modified {
  243. color: #2ed8db;
  244. border:1px solid #2ed8db;
  245. }
  246. &.up {
  247. background: linear-gradient(90deg, #08c4e6, #50ead2);
  248. color: #fff;
  249. }
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. width: 690rpx;
  254. height: 80rpx;
  255. margin: 0 auto;
  256. margin-top: 30rpx;
  257. font-size: $font-lg;
  258. border-radius: 10rpx;
  259. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  260. }
  261. .list {
  262. padding-left: 30rpx;
  263. margin-top: 30rpx;
  264. background-color: #ffffff;
  265. .box {
  266. display: flex;
  267. align-items: center;
  268. width: 100%;
  269. height: 120rpx;
  270. border-bottom: 1px solid $border-color-light;
  271. .icon {
  272. font-size: 48rpx;
  273. padding-right: 20rpx;
  274. .icon-img {
  275. height: 50rpx;
  276. width: 50rpx;
  277. }
  278. }
  279. .iconweixin1 {
  280. color: #18bf16;
  281. }
  282. .iconzhifubao {
  283. color: #08aaec;
  284. }
  285. .title-box {
  286. flex-grow: 1;
  287. text-align: left;
  288. .title {
  289. font-size: $font-base + 2rpx;
  290. color: $font-color-base;
  291. }
  292. .node {
  293. font-size: $font-sm;
  294. color: $font-color-light;
  295. }
  296. }
  297. }
  298. }
  299. /deep/ .uni-radio-input {
  300. width: 45rpx;
  301. height: 45rpx;
  302. }
  303. </style>