withdrawal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar v-if="case_fee !=0" single="true" :text="'提现收取'+case_fee+'%手续费'"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex ">
  6. <view class="buttom">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现金额</text>
  9. </view>
  10. <!-- <view class="interval"></view>
  11. <view class="buttom">
  12. <view class=" icon">{{ freeze | getMoneyStyle }}</view>
  13. <text class="text">待审核提现金额</text>
  14. </view> -->
  15. </view>
  16. </view>
  17. <!-- <view class="row-box" v-if="case_fee !=0">
  18. <view class="title">实际到账金额</view>
  19. <view class="row">
  20. <text class="tit">¥</text>
  21. <input class="input" type="number" v-model="realmoney" disabled="true" placeholder="实际到账" placeholder-class="placeholder" />
  22. </view>
  23. </view> -->
  24. <!-- <view class="list_row b-b">
  25. <text class="tit">手机号</text>
  26. <input class="input" v-model="account" type="text" placeholder="请输入手机号" placeholder-class="placeholder" />
  27. </view>
  28. <view class="list_row b-b">
  29. <text class="tit">验证码</text>
  30. <input class="input" v-model="captcha" type="text" placeholder="请填写验证码" placeholder-class="placeholder" />
  31. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  32. </view> -->
  33. <view class="list">
  34. <radio-group @change="tabRadio">
  35. <label>
  36. <view class="box">
  37. <view class="icon"><image class="icon-img" src="../../static/spend/img-weixin.png" mode="aspectFit"></image></view>
  38. <view class="title-box flex-start">
  39. <view class="title">
  40. <text v-if="aliData.fullname">微信</text>
  41. <text v-else>请创建微信账号</text>
  42. </view>
  43. <view class="node">
  44. <text v-if="weixinData.fullname">(微信号:{{weixinData.fullname}})</text>
  45. </view>
  46. </view>
  47. <view class="right"><radio class="radio" value="weixin" color="#FA2740" :checked="type == 'weixin'" /></view>
  48. </view>
  49. </label>
  50. <label>
  51. <view class="box">
  52. <view class="icon iconfont iconzhifubao"></view>
  53. <view class="title-box flex-start">
  54. <view class="title">
  55. <text v-if="aliData.fullname">支付宝</text>
  56. <text v-else>请创建支付宝账号</text>
  57. </view>
  58. <view class="node">
  59. <text v-if="aliData.fullname">(账号:{{aliData.fullname}})</text>
  60. </view>
  61. </view>
  62. <view class="right"><radio class="radio" value="alipay" color="#FA2740" :checked="type == 'alipay'" /></view>
  63. </view>
  64. </label>
  65. <label>
  66. <view class="box">
  67. <view class="icon"><image class="icon-img" src="/static/img/img31.jpg" mode="aspectFit"></image></view>
  68. <view class="title-box">
  69. <view class="title">
  70. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  71. <text v-else>请创建银行账号</text>
  72. </view>
  73. <view class="node">
  74. <text v-if="bankData.fullname">(卡号:{{bankData.fullname}})</text>
  75. </view>
  76. </view>
  77. <view class="right"><radio class="radio" value="bank" color="#FA2740" :checked="type == 'bank'" /></view>
  78. </view>
  79. </label>
  80. </radio-group>
  81. </view>
  82. <view class="row-box">
  83. <view class="title">提现金额</view>
  84. <view class="row">
  85. <text class="tit">¥</text>
  86. <input class="input" type="number" v-model="withdrawal" @blur="bindTextAreaBlur" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  87. <view class="buttom" @click="withdrawal = money">全部提现</view>
  88. </view>
  89. </view>
  90. <button class="add-btn up" @click="confirm">提交申请</button>
  91. <!-- <button class="add-btn modified" @click="navTo('/pages/wallet/account')">账号管理</button> -->
  92. </view>
  93. </template>
  94. <script>
  95. import { getMoneyStyle } from '@/utils/rocessor.js';
  96. import { mapState } from 'vuex';
  97. import { verify } from '@/api/login.js';
  98. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  99. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  100. export default {
  101. filters: {
  102. getMoneyStyle
  103. },
  104. components: {
  105. uniNoticeBar
  106. },
  107. data() {
  108. return {
  109. time: '', //保存倒计时对象
  110. type: 'alipay', //提现方式
  111. money: '0.00', //可提现金额
  112. freeze: '0.0', //冻结金额
  113. withdrawal: '', //提现金额
  114. minPrice: '', //最少提现金额
  115. case_fee:'',//提现手续费
  116. aliData: {
  117. /* fullname:'45214mjj@qq.com', */
  118. },
  119. bankData:{
  120. /* fullname:'6228 8458 458', */
  121. },
  122. weixinData:{
  123. /* fullname:'6228lsd', */
  124. },
  125. countDown: 0, //倒计时
  126. account:'',//手机号
  127. captcha:'',//验证码
  128. realmoney:'0.00',//实际到账金额
  129. // #ifdef H5
  130. weichatBsrowser: false
  131. // #endif
  132. };
  133. },
  134. onLoad(options) {
  135. // #ifdef H5
  136. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  137. // #endif
  138. //加载提现信息
  139. this.loadData();
  140. // 加载提款账号信息
  141. this.loadAli();
  142. this.loadBank();
  143. },
  144. watch: {
  145. // 监听倒计时
  146. countDown(i) {
  147. if (i == 0) {
  148. clearInterval(this.time);
  149. }
  150. }
  151. },
  152. computed: {
  153. ...mapState(['userInfo'])
  154. },
  155. methods: {
  156. //发送验证码
  157. verification() {
  158. let obj = this;
  159. if (this.account == '') {
  160. this.$api.msg('请输入电话号码');
  161. return;
  162. }
  163. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  164. this.$api.msg('请输入正确的手机号');
  165. return;
  166. }
  167. // 判断是否在倒计时
  168. if (obj.countDown > 0) {
  169. return false;
  170. } else {
  171. obj.countDown = 60;
  172. obj.time = setInterval(() => {
  173. obj.countDown--;
  174. }, 1000);
  175. //调用验证码接口
  176. verify({
  177. phone: obj.account,
  178. type: 'BDING_CODE'
  179. })
  180. .then(({ data }) => {})
  181. .catch(err => {
  182. console.log(err);
  183. });
  184. }
  185. },
  186. //失去焦点,实际到账金额
  187. bindTextAreaBlur(event){
  188. let obj = this;
  189. if(obj.case_fee == 0){
  190. return;
  191. }
  192. if(eval(event.detail.value) > obj.money){
  193. obj.$api.msg('提现金额不足');
  194. obj.realmoney = '0.00';
  195. return;
  196. }
  197. if(eval(event.detail.value) < obj.minPrice){
  198. obj.$api.msg('最小提现金额为'+obj.minPrice);
  199. obj.realmoney = '0.00';
  200. return;
  201. }
  202. let case_fee = (100 - obj.case_fee)/100;
  203. obj.realmoney = (event.detail.value * case_fee).toFixed(2);
  204. },
  205. // 更新数据
  206. dataUp(){
  207. this.loadAli();
  208. this.loadBank();
  209. this.loadData();
  210. },
  211. //加载数据
  212. async loadAli(source) {
  213. aliInfo({}).then(e => {
  214. this.aliData = e.data;
  215. });
  216. },
  217. // 加载银行卡信息
  218. async loadBank() {
  219. bankInfo({}).then(e => {
  220. this.bankData = e.data;
  221. });
  222. },
  223. // 加载余额信息
  224. async loadData() {
  225. extractBank({}).then(({ data }) => {
  226. console.log(data,'100');
  227. this.money = data.commissionCount;//可提现余额
  228. this.minPrice = data.minPrice;//最小提现
  229. this.freeze =data.Cashin;//提现中的余额
  230. this.case_fee = data.case_fee;//提现手续费
  231. if(this.userInfo.phone == ''){
  232. this.account = ''
  233. }else{
  234. this.account = this.userInfo.phone;
  235. }
  236. });
  237. },
  238. // 跳转
  239. navTo(url) {
  240. uni.navigateTo({
  241. url: url
  242. });
  243. },
  244. // 切换选中对象
  245. tabRadio(e) {
  246. this.type = e.detail.value;
  247. },
  248. // 提交
  249. confirm() {
  250. let data = {
  251. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  252. money: this.withdrawal, //金额
  253. money_type: 0,//0佣金1余额
  254. captcha:this.captcha,
  255. phone:this.account,
  256. }
  257. if (this.type=='alipay') {
  258. data.name = this.aliData.fullname;
  259. data.alipay_code = this.aliData.alino;
  260. }
  261. if (this.type=='bank') {
  262. data.name = this.bankData.fullname;
  263. data.bankname = this.bankData.bank;
  264. data.cardnum = this.bankData.bankno;
  265. }
  266. extractCash(data)
  267. .then(e => {
  268. uni.showToast({
  269. title: '提交成功',
  270. duration: 2000,
  271. position: 'top',
  272. icon:"none"
  273. });
  274. this.dataUp();
  275. })
  276. .catch(e => {
  277. this.dataUp();
  278. console.log();
  279. });
  280. }
  281. }
  282. };
  283. </script>
  284. <style lang="scss">
  285. page {
  286. height: 100%;
  287. }
  288. .content{
  289. padding-bottom: 25rpx;
  290. }
  291. .content-money {
  292. margin: 20rpx 0;
  293. padding: 20rpx 0;
  294. background: #ffffff;
  295. }
  296. .flex {
  297. background-color: #ffffff;
  298. text-align: center;
  299. margin: 0 30rpx;
  300. border-radius: $border-radius-sm;
  301. .buttom {
  302. flex:1;
  303. font-size: $font-lg;
  304. width: 50%;
  305. }
  306. .interval {
  307. width: 2px;
  308. height: 60rpx;
  309. background-color: #eeeeee;
  310. }
  311. .icon {
  312. background-size: 100%;
  313. font-size: 42rpx;
  314. color: $font-color-dark;
  315. font-weight: bold;
  316. background-repeat: no-repeat;
  317. background-position: center;
  318. }
  319. .text {
  320. font-size: 28rpx;
  321. color: #666666;
  322. }
  323. }
  324. .list_row{
  325. display: flex;
  326. align-items: center;
  327. position: relative;
  328. padding: 0 30rpx;
  329. height: 110rpx;
  330. background: #fff;
  331. .tit {
  332. flex-shrink: 0;
  333. width: 120rpx;
  334. font-size: 30rpx;
  335. color: $font-color-dark;
  336. }
  337. .input {
  338. flex: 1;
  339. font-size: 30rpx;
  340. color: $font-color-dark;
  341. }
  342. .code {
  343. color: #5dbc7c;
  344. font-size: 23rpx;
  345. border-left: 1px solid #eeeeee;
  346. width: 150rpx;
  347. flex-shrink: 0;
  348. text-align: center;
  349. }
  350. .iconlocation {
  351. font-size: 36rpx;
  352. color: $font-color-light;
  353. }
  354. }
  355. .row-box {
  356. margin: 20rpx 0rpx;
  357. padding: 20rpx 30rpx;
  358. background: #fff;
  359. .title {
  360. font-size: $font-base + 2rpx;
  361. color: $font-color-dark;
  362. }
  363. .row {
  364. display: flex;
  365. align-items: center;
  366. position: relative;
  367. height: 80rpx;
  368. .tit {
  369. flex-shrink: 0;
  370. width: 40rpx;
  371. font-size: 30rpx;
  372. color: $font-color-dark;
  373. }
  374. .input {
  375. flex: 1;
  376. font-size: 30rpx;
  377. color: $font-color-dark;
  378. }
  379. .iconlocation {
  380. font-size: 36rpx;
  381. color: $font-color-light;
  382. }
  383. .buttom {
  384. color: $font-color-spec;
  385. font-size: $font-base;
  386. }
  387. }
  388. }
  389. .add-btn {
  390. &.modified {
  391. color: $base-color;
  392. }
  393. &.up {
  394. background:linear-gradient(0deg,#fa2740,#fe5544);
  395. color: #fff;
  396. }
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. width: 560rpx;
  401. height: 80rpx;
  402. margin: 0 auto;
  403. margin-top: 60rpx;
  404. font-size: $font-lg;
  405. border-radius: 40rpx;
  406. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  407. }
  408. .list {
  409. padding-left: 30rpx;
  410. margin-top: 20rpx;
  411. background-color: #ffffff;
  412. .box {
  413. display: flex;
  414. align-items: center;
  415. width: 100%;
  416. height: 120rpx;
  417. border-bottom: 1px solid $border-color-light;
  418. .box-weixin{
  419. }
  420. .icon {
  421. height: 45rpx;
  422. width: 45rpx;
  423. font-size: 42rpx;
  424. margin-right: 20rpx;
  425. .icon-img {
  426. height: 45rpx;
  427. width: 45rpx;
  428. }
  429. }
  430. .iconweixin1 {
  431. color: #18bf16;
  432. }
  433. .iconzhifubao {
  434. color: #08aaec;
  435. }
  436. .title-box {
  437. flex-grow: 1;
  438. text-align: left;
  439. .title {
  440. font-size: $font-base + 2rpx;
  441. color: $font-color-base;
  442. }
  443. .node {
  444. font-size: $font-sm;
  445. color: $font-color-light;
  446. }
  447. }
  448. .right{
  449. margin-right: 15rpx;
  450. }
  451. .radio{
  452. transform: scale(0.75);
  453. }
  454. }
  455. }
  456. </style>