withdrawal.vue 7.7 KB

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