withdrawal.vue 6.7 KB

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