withdrawal.vue 7.2 KB

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