withdrawal.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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" v-if="!weichatBsrowser">
  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="#ff4c4c" :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="#ff4c4c" :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" v-if="!weichatBsrowser" @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. type: 'weixin', //提现方式
  101. money: '0.00', //可提现金额
  102. freeze: '0.0', //冻结金额
  103. withdrawal: '', //提现金额
  104. minPrice: '', //最少提现金额
  105. aliData: {},
  106. bankData: {},
  107. // #ifdef H5
  108. weichatBsrowser: false
  109. // #endif
  110. };
  111. },
  112. onLoad(options) {
  113. // #ifdef H5
  114. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  115. // #endif
  116. //加载提现信息
  117. this.loadData();
  118. // 加载提款账号信息
  119. // this.loadAli();
  120. // this.loadBank();
  121. },
  122. methods: {
  123. // 更新数据
  124. dataUp(){
  125. this.loadAli();
  126. this.loadBank();
  127. },
  128. //加载数据
  129. async loadAli(source) {
  130. aliInfo({}).then(e => {
  131. this.aliData = e.data;
  132. });
  133. },
  134. // 加载银行卡信息
  135. async loadBank() {
  136. bankInfo({}).then(e => {
  137. this.bankData = e.data;
  138. });
  139. },
  140. // 加载余额信息
  141. async loadData() {
  142. // spreadInfo().then( ({data}) => {
  143. // console.log(data,"spreadInfo++++++++++++++++++")
  144. // this.money = data.brokerage_price//可提现余额
  145. // this.minPrice = data.user_extract_min//最小提现
  146. // this.freeze = data.lock_brokerage//冻结金额
  147. // })
  148. // getSpreadCount({}, 3).then(({ data }) => {
  149. // console.log(data);
  150. // this.money = data.count;
  151. // });
  152. extractBank({}).then(({ data }) => {
  153. this.money = data.commissionCount;//可提现余额
  154. console.log(this.money)
  155. this.minPrice = data.minPrice;//最小提现
  156. this.freeze =data.inmoneyCount//提现中的余额
  157. });
  158. },
  159. // 跳转
  160. navTo(url) {
  161. uni.navigateTo({
  162. url: url
  163. });
  164. },
  165. // 切换选中对象
  166. tabRadio(e) {
  167. this.type = e.detail.value;
  168. },
  169. // 提交
  170. confirm() {
  171. console.log(this.withdrawal,this.money)
  172. if(+this.withdrawal == 0) {
  173. return this.$api.msg('请输入提现金额')
  174. }
  175. if(+this.withdrawal < +this.minPrice){
  176. return this.$api.msg('提现金额不足最低提现金额')
  177. }
  178. if(+this.withdrawal > +this.money){
  179. return this.$api.msg('可提现佣金不足')
  180. }
  181. let data = {
  182. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  183. money: this.withdrawal, //金额
  184. money_type: 1//0佣金1余额
  185. }
  186. if (this.type=='alipay') {
  187. data.name = this.aliData.fullname;
  188. data.alipay_code = this.aliData.alino;
  189. if(!data.name){
  190. return this.$api.msg('请完善账户名称')
  191. }
  192. if(!data.alipay_code){
  193. return this.$api.msg('请完善支付宝账号')
  194. }
  195. }
  196. if (this.type=='bank') {
  197. data.name = this.bankData.fullname;
  198. data.bankname = this.bankData.bank;
  199. data.cardnum = this.bankData.bankno;
  200. if(!data.name) {
  201. return this.$api.msg('请完善银行卡信息')
  202. }
  203. if(!data.bankname) {
  204. return this.$api.msg('请完善银行卡信息')
  205. }
  206. if(!data.cardnum) {
  207. return this.$api.msg('请完善银行卡信息')
  208. }
  209. }
  210. extractCash(data)
  211. .then(e => {
  212. uni.showToast({
  213. title: '提交成功',
  214. duration: 2000,
  215. position: 'top'
  216. });
  217. })
  218. .catch(e => {
  219. console.log();
  220. });
  221. }
  222. }
  223. };
  224. </script>
  225. <style lang="scss">
  226. page {
  227. height: 100%;
  228. }
  229. .content-money {
  230. padding: 30rpx 0;
  231. background: #ffffff;
  232. }
  233. .flex {
  234. background-color: #ffffff;
  235. text-align: center;
  236. margin: 0 30rpx;
  237. border-radius: $border-radius-sm;
  238. justify-content: space-between;
  239. flex-direction: row;
  240. .buttom {
  241. font-size: $font-lg;
  242. width: 50%;
  243. }
  244. .interval {
  245. width: 2px;
  246. height: 60rpx;
  247. background-color: #eeeeee;
  248. }
  249. .icon {
  250. background-size: 100%;
  251. font-size: 42rpx;
  252. color: $font-color-dark;
  253. font-weight: bold;
  254. background-repeat: no-repeat;
  255. background-position: center;
  256. }
  257. .text {
  258. color: $font-color-light;
  259. }
  260. }
  261. .row-box {
  262. // margin-top: 30rpx;
  263. padding: 20rpx 30rpx;
  264. background: #fff;
  265. .title {
  266. font-size: $font-base + 2rpx;
  267. color: $font-color-dark;
  268. }
  269. .row {
  270. display: flex;
  271. align-items: center;
  272. position: relative;
  273. height: 80rpx;
  274. .tit {
  275. flex-shrink: 0;
  276. width: 40rpx;
  277. font-size: 30rpx;
  278. color: $font-color-dark;
  279. }
  280. .input {
  281. flex: 1;
  282. font-size: 30rpx;
  283. color: $font-color-dark;
  284. }
  285. .iconlocation {
  286. font-size: 36rpx;
  287. color: $font-color-light;
  288. }
  289. .buttom {
  290. // color: $font-color-spec;
  291. color: #f34358;
  292. font-size: $font-base;
  293. }
  294. }
  295. }
  296. .add-btn {
  297. &.modified {
  298. color: $base-color;
  299. }
  300. &.up {
  301. background-color: $base-color;
  302. color: #fff;
  303. }
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. width: 690rpx;
  308. height: 80rpx;
  309. margin: 0 auto;
  310. margin-top: 30rpx;
  311. font-size: $font-lg;
  312. border-radius: 10rpx;
  313. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  314. }
  315. .list {
  316. padding-left: 30rpx;
  317. margin-top: 30rpx;
  318. background-color: #ffffff;
  319. .box {
  320. display: flex;
  321. align-items: center;
  322. width: 100%;
  323. padding:0 21rpx ;
  324. height: 120rpx;
  325. border-bottom: 1px solid $border-color-light;
  326. .icon {
  327. font-size: 48rpx;
  328. padding-right: 20rpx;
  329. .icon-img {
  330. height: 50rpx;
  331. width: 50rpx;
  332. }
  333. }
  334. .iconweixin1 {
  335. color: #18bf16;
  336. }
  337. .iconzhifubao {
  338. color: #08aaec;
  339. }
  340. .title-box {
  341. flex-grow: 1;
  342. text-align: left;
  343. .title {
  344. font-size: $font-base + 2rpx;
  345. color: $font-color-base;
  346. }
  347. .node {
  348. font-size: $font-sm;
  349. color: $font-color-light;
  350. }
  351. }
  352. }
  353. }
  354. /deep/ .uni-radio-input {
  355. width: 45rpx;
  356. height: 45rpx;
  357. }
  358. .could, .sq {
  359. height: 110rpx;
  360. font-size: 32rpx;
  361. font-weight: 600;
  362. color: #333333;
  363. line-height: 110rpx;
  364. display: flex;
  365. justify-content: space-between;
  366. .num {
  367. font-size: 40rpx;
  368. font-weight: bold;
  369. color: #333333;
  370. // line-height: 46px;
  371. }
  372. }
  373. .jg {
  374. width: 100%;
  375. height: 1px;
  376. background-color: #E6E6E6;
  377. }
  378. .tishi {
  379. padding:10rpx 30rpx;
  380. font-size: 28rpx;
  381. color: #eb8a31;
  382. }
  383. </style>