withdrawal.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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">提现至支付宝</text>
  37. <text v-else>请创建支付宝账号</text>
  38. </view>
  39. <view class="node">
  40. <text v-if="aliData.fullname">真实姓名({{ 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">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  52. <text v-else>请创建银行账号</text>
  53. </view>
  54. <view class="node">
  55. <text v-if="bankData.fullname">真实姓名({{ 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/money/account')">账号管理</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. export default {
  72. data() {
  73. return {
  74. type: 'weixin', //提现方式
  75. money: 10, //可提现金额
  76. withdrawal: '', //提现金额
  77. minPrice: '', //最少提现金额
  78. aliData: {},
  79. bankData: {},
  80. // #ifdef H5
  81. weichatBsrowser: false
  82. // #endif
  83. };
  84. },
  85. onLoad(options) {
  86. // #ifdef H5
  87. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  88. // #endif
  89. //加载提现信息
  90. this.loadData();
  91. // 加载提款账号信息
  92. this.loadAli();
  93. this.loadBank();
  94. },
  95. methods: {
  96. // 更新数据
  97. dataUp() {
  98. this.loadAli();
  99. this.loadBank();
  100. },
  101. //加载数据
  102. async loadAli(source) {
  103. aliInfo({}).then(e => {
  104. this.aliData = e.data;
  105. });
  106. },
  107. // 加载银行卡信息
  108. async loadBank() {
  109. bankInfo({}).then(e => {
  110. this.bankData = e.data;
  111. });
  112. },
  113. // 加载余额信息
  114. async loadData() {
  115. extractBank({}).then(({ data }) => {
  116. console.log(data)
  117. this.money = data.brokerage_price; //可提现余额
  118. this.minPrice = data.minPrice; //最小提现
  119. this.freeze = data.inmoneyCount; //提现中的余额
  120. });
  121. },
  122. // 跳转
  123. navTo(url) {
  124. uni.navigateTo({
  125. url: url
  126. });
  127. },
  128. all(){
  129. this.withdrawal = this.money
  130. },
  131. // 切换选中对象
  132. tabRadio(e) {
  133. this.type = e.detail.value;
  134. },
  135. // 提交
  136. confirm() {
  137. let data = {
  138. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  139. money: this.withdrawal, //金额
  140. money_type: 1 //0佣金1余额
  141. };
  142. if (this.type == 'alipay') {
  143. data.name = this.aliData.fullname;
  144. data.alipay_code = this.aliData.alino;
  145. }
  146. if (this.type == 'bank') {
  147. data.name = this.bankData.fullname;
  148. data.bankname = this.bankData.bank;
  149. data.cardnum = this.bankData.bankno;
  150. }
  151. extractCash(data)
  152. .then(e => {
  153. uni.showToast({
  154. title: '提交成功',
  155. duration: 2000,
  156. position: 'top'
  157. });
  158. })
  159. .catch(e => {
  160. console.log();
  161. });
  162. }
  163. }
  164. };
  165. </script>
  166. <style lang="scss">
  167. page {
  168. height: 100%;
  169. }
  170. .content-money {
  171. padding: 0 20rpx;
  172. background-color: #ffffff;
  173. .buttom {
  174. display: flex;
  175. justify-content: space-between;
  176. align-items: center;
  177. height: 110rpx;
  178. }
  179. .interval {
  180. width: 100%;
  181. height: 1px;
  182. background: #E6E6E6;
  183. }
  184. .icon {
  185. font-size: 48rpx;
  186. font-family: SourceHanSansCN;
  187. font-weight: 500;
  188. color: #333333;
  189. text{
  190. font-size: 32rpx;
  191. }
  192. .input {
  193. text-align: right;
  194. flex: 1;
  195. font-size: 30rpx;
  196. color: $font-color-dark;
  197. }
  198. .iconlocation {
  199. text-align: right;
  200. font-size: 36rpx;
  201. color: $font-color-light;
  202. }
  203. }
  204. .text {
  205. font-size: 32rpx;
  206. font-family: PingFang SC;
  207. font-weight: 500;
  208. color: #333333;
  209. }
  210. .tip {
  211. height: 74rpx;
  212. display: flex;
  213. justify-content: space-between;
  214. align-items: center;
  215. .tip-text {
  216. font-size: 24rpx;
  217. font-family: PingFang SC;
  218. font-weight: 500;
  219. color: #999999;
  220. }
  221. .tip-icon {
  222. font-size: 26rpx;
  223. font-family: SourceHanSansCN;
  224. font-weight: 400;
  225. color: #438BED;
  226. }
  227. }
  228. }
  229. .add-btn {
  230. &.modified {
  231. color: $base-color;
  232. }
  233. &.up {
  234. background-color: $base-color;
  235. color: #fff;
  236. }
  237. display: flex;
  238. align-items: center;
  239. justify-content: center;
  240. width: 690rpx;
  241. height: 80rpx;
  242. margin: 0 auto;
  243. margin-top: 30rpx;
  244. font-size: $font-lg;
  245. border-radius: 10rpx;
  246. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  247. }
  248. .list {
  249. padding-left: 30rpx;
  250. margin-top: 30rpx;
  251. background-color: #ffffff;
  252. .box {
  253. display: flex;
  254. align-items: center;
  255. width: 100%;
  256. height: 120rpx;
  257. border-bottom: 1px solid $border-color-light;
  258. .icon {
  259. font-size: 48rpx;
  260. padding-right: 20rpx;
  261. .icon-img {
  262. height: 50rpx;
  263. width: 50rpx;
  264. }
  265. }
  266. .iconweixin1 {
  267. color: #18bf16;
  268. }
  269. .iconzhifubao {
  270. color: #08aaec;
  271. }
  272. .title-box {
  273. flex-grow: 1;
  274. text-align: left;
  275. .title {
  276. font-size: $font-base + 2rpx;
  277. color: $font-color-base;
  278. }
  279. .node {
  280. font-size: $font-sm;
  281. color: $font-color-light;
  282. }
  283. }
  284. }
  285. }
  286. /deep/ .uni-radio-input {
  287. width: 45rpx;
  288. height: 45rpx;
  289. }
  290. </style>