withdrawal.vue 7.3 KB

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