withdrawal.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="content">
  3. <view class="tishi">
  4. <!-- 提示:提现税率为7.5% -->
  5. </view>
  6. <view class="row-box">
  7. <view class="could">
  8. <text class="">
  9. 可提现金额
  10. </text>
  11. <text class="num" v-if="money*1 >= 0">
  12. ¥{{ money | getMoneyStyle }}
  13. </text>
  14. <text class="num" v-else>
  15. ¥{{ money*-1 | getMoneyStyle }}(冻结中)
  16. </text>
  17. </view>
  18. <view class="jg"></view>
  19. <view class="sq">
  20. <text class="">
  21. 申请提现金额
  22. </text>
  23. <text class="num">
  24. ¥{{ withdrawal | getMoneyStyle }}
  25. </text>
  26. </view>
  27. <view class="jg"></view>
  28. <view class="row">
  29. <text class="tit">¥</text>
  30. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  31. <view class="buttom" @click="withdrawal = money">全部提现</view>
  32. </view>
  33. </view>
  34. <!-- #ifndef MP-WEIXIN -->
  35. <view class="list">
  36. <view style="padding-top: 28rpx; font-size: 32rpx; font-weight: 600;color: #4d4d4d;">
  37. 提现到
  38. </view>
  39. <radio-group @change="tabRadio">
  40. <!-- <label>
  41. <view class="box">
  42. <view class="icon iconfont iconweixin1"></view>
  43. <view class="title-box">
  44. <view class="title"><text>提现至微信</text></view>
  45. </view>
  46. <view class="right"><radio value="weixin" color="#ff4c4c" :checked="type == 'weixin'" /></view>
  47. </view>
  48. </label> -->
  49. <label>
  50. <view class="box">
  51. <view class="icon iconfont iconzhifubao"></view>
  52. <view class="title-box">
  53. <view class="title">
  54. <text v-if="aliData.fullname">提现至支付宝</text>
  55. <text v-else>请创建支付宝账号</text>
  56. </view>
  57. <view class="node">
  58. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  59. </view>
  60. </view>
  61. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  62. </view>
  63. </label>
  64. <label>
  65. <view class="box">
  66. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  67. <view class="title-box">
  68. <view class="title">
  69. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  70. <text v-else>请创建银行账号</text>
  71. </view>
  72. <view class="node">
  73. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  74. </view>
  75. </view>
  76. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  77. </view>
  78. </label>
  79. </radio-group>
  80. </view>
  81. <!-- #endif -->
  82. <button class="add-btn up" @click="confirm">提交申请</button>
  83. <button class="add-btn up" @click="navTo('/pages/money/account')">账号管理</button>
  84. </view>
  85. </template>
  86. <script>
  87. import { getMoneyStyle } from '@/utils/rocessor.js';
  88. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  89. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  90. import { getSpreadCount } from '@/api/user.js';
  91. export default {
  92. filters: {
  93. getMoneyStyle
  94. },
  95. components: {
  96. uniNoticeBar
  97. },
  98. data() {
  99. return {
  100. // sxf: '0.00',
  101. type: 'alipay', //提现方式
  102. money: '0.00', //可提现金额
  103. freeze: '0.0', //冻结金额
  104. withdrawal: '', //提现金额
  105. minPrice: '', //最少提现金额
  106. aliData: {},
  107. bankData: {},
  108. // #ifdef H5
  109. weichatBsrowser: false
  110. // #endif
  111. };
  112. },
  113. computed: {
  114. //提现手续费
  115. sxf() {
  116. return (this.withdrawal*1*0.075)
  117. },
  118. //实际到账
  119. sjdz() {
  120. return (this.withdrawal*1*0.925)
  121. }
  122. },
  123. onLoad(options) {
  124. // #ifdef H5
  125. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  126. // #endif
  127. //加载提现信息
  128. this.loadData();
  129. // 加载提款账号信息
  130. // this.loadAli();
  131. // this.loadBank();
  132. },
  133. methods: {
  134. // 更新数据
  135. dataUp(){
  136. this.loadAli();
  137. this.loadBank();
  138. },
  139. //加载数据
  140. async loadAli(source) {
  141. aliInfo({}).then(e => {
  142. this.aliData = e.data;
  143. });
  144. },
  145. // 加载银行卡信息
  146. async loadBank() {
  147. bankInfo({}).then(e => {
  148. this.bankData = e.data;
  149. });
  150. },
  151. // 加载余额信息
  152. async loadData() {
  153. extractBank({}).then(({ data }) => {
  154. this.money = data.commissionCount;//可提现余额
  155. console.log(this.money)
  156. this.minPrice = data.minPrice;//最小提现
  157. this.freeze =data.inmoneyCount//提现中的余额
  158. });
  159. },
  160. // 跳转
  161. navTo(url) {
  162. uni.navigateTo({
  163. url: url
  164. });
  165. },
  166. // 切换选中对象
  167. tabRadio(e) {
  168. this.type = e.detail.value;
  169. },
  170. // 提交
  171. confirm() {
  172. console.log(this.withdrawal,this.money)
  173. if(+this.withdrawal == 0) {
  174. return this.$api.msg('请输入提现金额')
  175. }
  176. if(+this.withdrawal < +this.minPrice){
  177. return this.$api.msg('提现金额不足最低提现金额')
  178. }
  179. if(+this.withdrawal > +this.money){
  180. return this.$api.msg('可提现佣金不足')
  181. }
  182. let data = {
  183. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  184. money: this.withdrawal, //金额
  185. money_type: 0//0佣金1余额
  186. }
  187. if (this.type=='alipay') {
  188. data.name = this.aliData.fullname;
  189. data.alipay_code = this.aliData.alino;
  190. if(!data.name){
  191. return this.$api.msg('请完善账户名称')
  192. }
  193. if(!data.alipay_code){
  194. return this.$api.msg('请完善支付宝账号')
  195. }
  196. }
  197. if (this.type=='bank') {
  198. data.name = this.bankData.fullname;
  199. data.bankname = this.bankData.bank;
  200. data.cardnum = this.bankData.bankno;
  201. if(!data.name) {
  202. return this.$api.msg('请完善银行卡信息')
  203. }
  204. if(!data.bankname) {
  205. return this.$api.msg('请完善银行卡信息')
  206. }
  207. if(!data.cardnum) {
  208. return this.$api.msg('请完善银行卡信息')
  209. }
  210. }
  211. extractCash(data)
  212. .then(e => {
  213. uni.showToast({
  214. title: '提交成功',
  215. duration: 2000,
  216. position: 'top'
  217. });
  218. })
  219. .catch(e => {
  220. console.log();
  221. });
  222. }
  223. }
  224. };
  225. </script>
  226. <style lang="scss">
  227. page {
  228. height: 100%;
  229. }
  230. .content-money {
  231. padding: 30rpx 0;
  232. background: #ffffff;
  233. }
  234. .flex {
  235. background-color: #ffffff;
  236. text-align: center;
  237. margin: 0 30rpx;
  238. border-radius: $border-radius-sm;
  239. justify-content: space-between;
  240. flex-direction: row;
  241. .buttom {
  242. font-size: $font-lg;
  243. width: 50%;
  244. }
  245. .interval {
  246. width: 2px;
  247. height: 60rpx;
  248. background-color: #eeeeee;
  249. }
  250. .icon {
  251. background-size: 100%;
  252. font-size: 42rpx;
  253. color: $font-color-dark;
  254. font-weight: bold;
  255. background-repeat: no-repeat;
  256. background-position: center;
  257. }
  258. .text {
  259. color: $font-color-light;
  260. }
  261. }
  262. .row-box {
  263. // margin-top: 30rpx;
  264. padding: 20rpx 30rpx;
  265. background: #fff;
  266. .title {
  267. font-size: $font-base + 2rpx;
  268. color: $font-color-dark;
  269. }
  270. .row {
  271. display: flex;
  272. align-items: center;
  273. position: relative;
  274. height: 80rpx;
  275. .tit {
  276. flex-shrink: 0;
  277. width: 40rpx;
  278. font-size: 30rpx;
  279. color: $font-color-dark;
  280. }
  281. .input {
  282. flex: 1;
  283. font-size: 30rpx;
  284. color: $font-color-dark;
  285. }
  286. .iconlocation {
  287. font-size: 36rpx;
  288. color: $font-color-light;
  289. }
  290. .buttom {
  291. // color: $font-color-spec;
  292. color: #5dbc7c;
  293. font-size: $font-base;
  294. }
  295. }
  296. }
  297. .add-btn {
  298. &.modified {
  299. color: $base-color;
  300. }
  301. &.up {
  302. background-color: $base-color;
  303. color: #fff;
  304. }
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. width: 690rpx;
  309. height: 80rpx;
  310. margin: 0 auto;
  311. margin-top: 30rpx;
  312. font-size: $font-lg;
  313. border-radius: 10rpx;
  314. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  315. }
  316. .list {
  317. padding-left: 30rpx;
  318. margin-top: 30rpx;
  319. background-color: #ffffff;
  320. .box {
  321. display: flex;
  322. align-items: center;
  323. width: 100%;
  324. padding:0 21rpx ;
  325. height: 120rpx;
  326. border-bottom: 1px solid $border-color-light;
  327. .icon {
  328. font-size: 48rpx;
  329. padding-right: 20rpx;
  330. .icon-img {
  331. height: 50rpx;
  332. width: 50rpx;
  333. }
  334. }
  335. .iconweixin1 {
  336. color: #18bf16;
  337. }
  338. .iconzhifubao {
  339. color: #08aaec;
  340. }
  341. .title-box {
  342. flex-grow: 1;
  343. text-align: left;
  344. .title {
  345. font-size: $font-base + 2rpx;
  346. color: $font-color-base;
  347. }
  348. .node {
  349. font-size: $font-sm;
  350. color: $font-color-light;
  351. }
  352. }
  353. }
  354. }
  355. /deep/ .uni-radio-input {
  356. width: 45rpx;
  357. height: 45rpx;
  358. }
  359. .could, .sq {
  360. height: 110rpx;
  361. font-size: 32rpx;
  362. font-weight: 600;
  363. color: #333333;
  364. line-height: 110rpx;
  365. display: flex;
  366. justify-content: space-between;
  367. .num {
  368. font-size: 40rpx;
  369. font-weight: bold;
  370. color: #333333;
  371. // line-height: 46px;
  372. }
  373. }
  374. .jg {
  375. width: 100%;
  376. height: 1px;
  377. background-color: #E6E6E6;
  378. }
  379. .tishi {
  380. padding:10rpx 30rpx;
  381. font-size: 28rpx;
  382. color: #eb8a31;
  383. }
  384. </style>