withdrawal.vue 7.2 KB

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