withdrawal.vue 7.5 KB

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