Txmoney.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <view class="content" v-if="XCXIsSelect !='否'">
  3. <view class="part_one">
  4. <view class="one_title">可提现金额</view>
  5. <view class="one_price">¥{{mayMoney}}</view>
  6. </view>
  7. <view class="part_two">
  8. <view class="two_title">提现金额
  9. <text>提现最低额度{{minMoney}}元</text>
  10. </view>
  11. <view class="two_box">
  12. ¥
  13. <u-input v-model="money" type="number" :clearable="false" :border="border" placeholder="请输入提现金额" />
  14. </view>
  15. <view class="beizhu">*注单笔限制提现最低额度{{minMoney}}元,最大提现额度为{{manMoney}}元,单笔提现手续费{{shouxufei*100}}%</view>
  16. </view>
  17. <view class="part_three">
  18. <view class="three_name">兑换方式</view>
  19. <view class="btn">
  20. <view class="btn_left" :class="current==2?'btna':''" @click="bindToindex(2)">
  21. <image src="../../../../static/my/weixin.png"></image>
  22. <text>微信</text>
  23. </view>
  24. <view class="btn_right" :class="current==1?'btna':''" @click="bindToindex(1)">
  25. <image src="../../../../static/my/zhifubao.png"></image>
  26. <text>支付宝</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="part_four">
  31. <view class="submit" @click="getOut()">立即提现</view>
  32. <view class="four_box">
  33. <view class="box_left" @click="goZhifuBao">
  34. 提现账户
  35. </view>
  36. <view class="box_right" @click="list">
  37. 提现记录
  38. </view>
  39. <view class="box_right" @click="isShow">
  40. 微信收款码
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 微信收款码弹框 -->
  45. <u-popup v-model="show" mode="center">
  46. <view class="padding">
  47. <view class="text-center text-lg text-bold flex justify-between">
  48. <view></view>
  49. <view>添加微信收款码</view>
  50. <view @click="show=false">X</view>
  51. </view>
  52. <!-- <view class="text-center padding-top-sm padding-bottom-lg" style="color: #999999;">请提交微信号和微信二维码
  53. </view> -->
  54. <view style="width: 80%;margin: 0 auto;">
  55. <view class="margin-top" @click.stop="weixin"
  56. style="border: 4rpx solid #010101;border-radius: 16rpx;overflow: hidden;">
  57. <image v-if="!wximg" src="../../../../static/image/erweima.png"></image>
  58. <image v-else :src="wximg" mode=""></image>
  59. </view>
  60. </view>
  61. <!-- <view class="text-center margin-top-sm " @click="submit"
  62. style="border-radius: 10rpx;background-color: #7E59FF;color: #fff;height: 80rpx;line-height: 80rpx;">保存</view> -->
  63. </view>
  64. </u-popup>
  65. </view>
  66. </template>
  67. <script>
  68. import { showToast } from '../../../../common/queue';
  69. import configdata from '../../../../common/config.js';
  70. export default {
  71. data() {
  72. return {
  73. show: false,
  74. current: '1',
  75. // value: 10,
  76. money: '',
  77. zhifubaoName: '',
  78. zhifubao: '',
  79. shouxufei: 0.01,
  80. minMoney: '10',
  81. manMoney: '200',
  82. mayMoney: '',
  83. XCXIsSelect: '否',
  84. wximg: '',
  85. values: ''
  86. }
  87. },
  88. onLoad() {
  89. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  90. if (this.XCXIsSelect == '否') {
  91. uni.setNavigationBarTitle({
  92. title: '隐私政策'
  93. });
  94. } else {
  95. uni.setNavigationBarTitle({
  96. title: '余额提现'
  97. });
  98. }
  99. },
  100. onShow() {
  101. this.getMoney()
  102. //最低可提现金额度
  103. this.$Request.getT('/app/common/type/112').then(res => {
  104. if (res.code === 0) {
  105. this.minMoney = res.data.value
  106. }
  107. });
  108. //最高可提现金额度
  109. this.$Request.getT('/app/common/type/153').then(res => {
  110. if (res.code === 0) {
  111. this.manMoney = res.data.value
  112. }
  113. });
  114. //手续费
  115. this.$Request.getT('/app/common/type/114').then(res => {
  116. if (res.code === 0) {
  117. this.shouxufei = res.data.value
  118. }
  119. });
  120. this.$Request.getT('/app/common/type/290').then(res => { //判断微信提现方式
  121. if (res.code == 0) {
  122. if (res.data && res.data.value) {
  123. this.values = res.data.value
  124. }
  125. }
  126. })
  127. },
  128. methods: {
  129. //用户收款码弹框
  130. isShow() {
  131. this.getMoney()
  132. this.show = true
  133. },
  134. //微信 支付宝提现选择
  135. bindToindex(e) {
  136. this.current = e
  137. console.log(e, this.current)
  138. },
  139. list() {
  140. uni.navigateTo({
  141. url: '/pages/riderMy/myAccount/AcontMoney/cashList'
  142. });
  143. },
  144. goZhifuBao() {
  145. uni.navigateTo({
  146. url: '/pages/riderMy/myAccount/AcontMoney/zhifubao'
  147. });
  148. },
  149. getMoney() {
  150. let that = this;
  151. let token = this.$queue.getData('token');
  152. let userId = this.$queue.getData('userId');
  153. if (token) {
  154. //this.$queue.showLoading("加载中...");
  155. //可以提现金额查询预估收入查询
  156. that.$Request.getT("/app/userinfo/findUserInfoById").then(res => {
  157. if (res.code === 0 && res.data) {
  158. that.mayMoney = res.data.balance;
  159. that.zhifubao = res.data.zhiFuBao;
  160. that.zhifubaoName = res.data.zhiFuBaoName;
  161. that.wximg = res.data.cashQrCode
  162. } else if (res.code === -102) {
  163. that.$queue.showToast(res.msg);
  164. that.$queue.logout();
  165. // uni.navigateTo({
  166. // url: '/pages/public/login'
  167. // });
  168. } else {
  169. that.mayMoney = '0';
  170. //this.$queue.showToast(res.msg);
  171. }
  172. });
  173. }
  174. },
  175. getOut() {
  176. let that = this;
  177. let token = that.$queue.getData('token');
  178. let userId = that.$queue.getData('userId');
  179. if (token) {
  180. if (that.current == 1) {
  181. if (!that.zhifubao || !that.zhifubaoName) {
  182. uni.navigateTo({
  183. url: '/pages/riderMy/myAccount/AcontMoney/zhifubao'
  184. });
  185. return
  186. }
  187. if (!/^\d+$/.test(that.money)) {
  188. // uni.showToast({
  189. // icon: 'none',
  190. // title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
  191. // });
  192. that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
  193. return;
  194. }
  195. if (Number(that.money) < Number(that.minMoney)) {
  196. uni.showToast({
  197. icon: 'none',
  198. title: '提现金额不能小于' + that.minMoney + '元'
  199. });
  200. return;
  201. }
  202. if (Number(that.money) > Number(that.manMoney)) {
  203. uni.showToast({
  204. icon: 'none',
  205. title: '提现金额不能大于' + that.manMoney + '元'
  206. });
  207. return;
  208. }
  209. uni.showModal({
  210. title: '提现申请提示',
  211. content: '请仔细确认收款人信息\n姓名:' + that.zhifubaoName + '\n提现金额:' + that.money + '\n提现手续费:' +
  212. parseFloat(that.money * that.shouxufei).toFixed(2) + '元' + '\n收款账号:' + that.zhifubao + '',
  213. success: e => {
  214. if (e.confirm) {
  215. let data = {
  216. classify: that.current,
  217. money:that.money
  218. };
  219. that.$queue.showLoading('提现中...');
  220. that.$Request.getT('/app/cash/cashMoney',data).then(res => {
  221. if (res.code === 0) {
  222. that.$queue.showToast('提现申请成功,预计三个工作日到账');
  223. that.getMoney();
  224. that.mayMoney = ''
  225. } else {
  226. uni.showModal({
  227. title: '温馨提示',
  228. content: res.msg,
  229. showCancel: false,
  230. cancelText: '取消',
  231. confirmText: '确认'
  232. });
  233. }
  234. uni.hideLoading();
  235. });
  236. }
  237. }
  238. });
  239. } else if (that.current == 2) {
  240. if (!/^\d+$/.test(that.money)) {
  241. // uni.showToast({
  242. // icon: 'none',
  243. // title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
  244. // });
  245. that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
  246. return;
  247. }
  248. if (Number(that.money) < Number(that.minMoney)) {
  249. uni.showToast({
  250. icon: 'none',
  251. title: '提现金额不能小于' + that.minMoney + '元'
  252. });
  253. return;
  254. }
  255. if (Number(that.money) > Number(that.manMoney)) {
  256. uni.showToast({
  257. icon: 'none',
  258. title: '提现金额不能大于' + that.manMoney + '元'
  259. });
  260. return;
  261. }
  262. if (that.values == 2) {
  263. that.$Request.getT('/app/userinfo/findUserInfoById').then(res => {
  264. if (res.code === 0) {
  265. let wxImg = res.data.cashQrCode;
  266. if (!wxImg) {
  267. uni.showModal({
  268. title: '提现提示',
  269. content: '请上传微信收款码',
  270. showCancel: true,
  271. cancelText: '取消',
  272. confirmText: '上传',
  273. success: res => {
  274. if (res.confirm) {
  275. that.show = true
  276. }
  277. },
  278. fail: () => {},
  279. complete: () => {}
  280. });
  281. return;
  282. }
  283. if (that.money * 1 >= that.minMoney * 1) {
  284. uni.showModal({
  285. title: '提现申请提示',
  286. content: '金额:' + that.money + '元' + ',' + '手续费:' + (that
  287. .money * that.shouxufei).toFixed(2),
  288. success: e => {
  289. if (e.confirm) {
  290. that.$queue.showLoading('提现中...');
  291. let data = {
  292. money: that.money,
  293. classify: 2
  294. }
  295. that.$Request.getT('/app/cash/cashMoney',
  296. data).then(
  297. res => {
  298. if (res.code === 0) {
  299. setTimeout(function() {
  300. that.$queue.showToast(
  301. '提现申请成功,预计三个工作日到账'
  302. );
  303. }, 1000)
  304. that.getMoney();
  305. that.money = ''
  306. } else {
  307. uni.showModal({
  308. title: '温馨提示',
  309. content: res.msg,
  310. showCancel: false,
  311. cancelText: '取消',
  312. confirmText: '确认'
  313. });
  314. }
  315. uni.hideLoading();
  316. });
  317. }
  318. }
  319. });
  320. } else {
  321. setTimeout(function() {
  322. that.$queue.showToast('提现金额必须大于或等于' + that.minMoney + '元才可提现');
  323. }, 1000)
  324. }
  325. } else {
  326. that.$queue.showToast('网络状态不好,请刷新后重试!');
  327. }
  328. });
  329. } else {
  330. if (!/^\d+$/.test(that.money)) {
  331. // uni.showToast({
  332. // icon: 'none',
  333. // title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
  334. // });
  335. that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
  336. return;
  337. }
  338. if (parseFloat(that.money).toFixed(1) >= that.minMoney) {
  339. uni.showModal({
  340. title: '提现申请提示',
  341. content: '金额:' + that.money + '元' + ',' + '手续费:' + parseFloat(that
  342. .money * that.shouxufei).toFixed(2),
  343. success: e => {
  344. if (e.confirm) {
  345. that.$queue.showLoading('提现中...');
  346. let data = {
  347. money: that.money,
  348. classify: 2,
  349. type: 3
  350. }
  351. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then(
  352. res => {
  353. if (res.code === 0) {
  354. setTimeout(function() {
  355. that.$queue.showToast(
  356. '提现申请成功,预计三个工作日到账');
  357. }, 1000)
  358. that.getMoney();
  359. that.money =''
  360. } else {
  361. uni.showModal({
  362. title: '温馨提示',
  363. content: res.msg,
  364. showCancel: false,
  365. cancelText: '取消',
  366. confirmText: '确认'
  367. });
  368. that.getMoney();
  369. }
  370. uni.hideLoading();
  371. });
  372. }
  373. }
  374. });
  375. } else {
  376. that.$queue.showToast('提现金额必须大于或等于' + that.minMoney + '元才可提现');
  377. }
  378. }
  379. }
  380. } else {
  381. uni.showToast({
  382. title: '提现失败'
  383. })
  384. }
  385. },
  386. config: function(name) {
  387. var info = null;
  388. if (name) {
  389. var name2 = name.split("."); //字符分割
  390. if (name2.length > 1) {
  391. info = configdata[name2[0]][name2[1]] || null;
  392. } else {
  393. info = configdata[name] || null;
  394. }
  395. if (info == null) {
  396. // let web_config = cache.get("web_config");
  397. // if (web_config) {
  398. // if (name2.length > 1) {
  399. // info = web_config[name2[0]][name2[1]] || null;
  400. // } else {
  401. // info = web_config[name] || null;
  402. // }
  403. // }
  404. }
  405. }
  406. return info;
  407. },
  408. weixin() {
  409. let that = this
  410. uni.chooseImage({
  411. count: 1, //默认9
  412. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  413. sourceType: ['album', 'camera'], //从相册选择
  414. success: (res) => {
  415. that.$queue.showLoading("上传中...");
  416. for (let i = 0; i < 1; i++) {
  417. uni.uploadFile({ // 上传接口
  418. url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  419. filePath: res.tempFilePaths[i],
  420. name: 'file',
  421. success: (uploadFileRes) => {
  422. let img = JSON.parse(uploadFileRes.data).data
  423. let userId = that.$queue.getData('userId');
  424. let data = {
  425. cashQrCode: img
  426. }
  427. that.$Request.postJson('/app/user/updateUser',
  428. data).then(
  429. res => {
  430. if (res.code == 0) {
  431. that.getMoney()
  432. setTimeout(function() {
  433. that.$queue.showToast('上传成功')
  434. }, 1000)
  435. }
  436. });
  437. uni.hideLoading();
  438. // that.show = false
  439. }
  440. });
  441. }
  442. }
  443. });
  444. },
  445. }
  446. }
  447. </script>
  448. <style>
  449. body {
  450. background: #F5F5F5;
  451. }
  452. .content {
  453. width: 100%;
  454. }
  455. .part_one {
  456. width: 90%;
  457. margin: 0 auto;
  458. background: #FFFFFF;
  459. margin-top: 20rpx;
  460. border-radius: 20rpx;
  461. height: 170rpx;
  462. }
  463. .one_title {
  464. width: 90%;
  465. margin: 0 auto;
  466. font-size: 32rpx;
  467. letter-spacing: 1rpx;
  468. padding-top: 30rpx;
  469. }
  470. .one_price {
  471. width: 90%;
  472. margin: 0 auto;
  473. margin-top: 20rpx;
  474. font-size: 47rpx;
  475. font-weight: bold;
  476. }
  477. .part_two {
  478. width: 90%;
  479. margin: 0 auto;
  480. background: #FFFFFF;
  481. margin-top: 20rpx;
  482. border-radius: 20rpx;
  483. }
  484. .two_title {
  485. width: 90%;
  486. margin: 0 auto;
  487. line-height: 95rpx;
  488. font-size: 34rpx;
  489. }
  490. .two_title text {
  491. font-size: 27rpx;
  492. margin-left: 34rpx;
  493. }
  494. .two_box {
  495. width: 90%;
  496. margin: 0 auto;
  497. display: flex;
  498. align-items: center;
  499. font-size: 32rpx;
  500. font-weight: bold;
  501. }
  502. .u-input__input {
  503. font-size: 50rpx !important;
  504. color: #747474 !important;
  505. border-bottom: 1rpx solid #cccccc;
  506. }
  507. .tit {
  508. width: 90%;
  509. margin: 0 auto;
  510. font-size: 31rpx;
  511. margin-top: 10rpx;
  512. color: black;
  513. }
  514. .beizhu {
  515. width: 90%;
  516. margin: 0 auto;
  517. line-height: 55rpx;
  518. color: red;
  519. letter-spacing: 1rpx;
  520. }
  521. .part_three {
  522. width: 90%;
  523. margin: 0 auto;
  524. background: #FFFFFF;
  525. margin-top: 20rpx;
  526. border-radius: 20rpx;
  527. }
  528. .three_name {
  529. width: 90%;
  530. margin: 0 auto;
  531. font-size: 33rpx;
  532. color: black;
  533. line-height: 80rpx;
  534. }
  535. .btn {
  536. width: 96%;
  537. margin: 0 auto;
  538. display: flex;
  539. padding-bottom: 30rpx;
  540. }
  541. .btn_left {
  542. flex: 1;
  543. height: 90rpx;
  544. border: 1rpx solid #ccc;
  545. border-radius: 20rpx;
  546. margin-right: 10rpx;
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. }
  551. .btn_right {
  552. flex: 1;
  553. /* width: 240rpx; */
  554. height: 90rpx;
  555. border: 1rpx solid #ccc;
  556. border-radius: 20rpx;
  557. margin-left: 10rpx;
  558. display: flex;
  559. justify-content: center;
  560. align-items: center;
  561. }
  562. .btna {
  563. border: 1rpx solid #E34B21 !important;
  564. }
  565. .btn_left image {
  566. width: 50rpx;
  567. height: 50rpx;
  568. margin-right: 12rpx;
  569. }
  570. .btn_right image {
  571. width: 50rpx;
  572. height: 50rpx;
  573. margin-right: 12rpx;
  574. }
  575. .part_four {
  576. width: 90%;
  577. margin: 0 auto;
  578. /* background: #FFFFFF; */
  579. margin-top: 20rpx;
  580. border-radius: 20rpx;
  581. }
  582. .submit {
  583. width: 100%;
  584. height: 90rpx;
  585. background: #F8501F;
  586. color: #F8EBD2;
  587. text-align: center;
  588. line-height: 90rpx;
  589. font-size: 37rpx;
  590. border-radius: 12rpx;
  591. }
  592. .four_box {
  593. width: 90%;
  594. margin: 0 auto;
  595. height: 125rpx;
  596. display: flex;
  597. color: #838383;
  598. }
  599. .box_left {
  600. flex: 1;
  601. display: flex;
  602. justify-content: center;
  603. align-items: center;
  604. }
  605. .box_right {
  606. flex: 1;
  607. display: flex;
  608. justify-content: center;
  609. align-items: center;
  610. }
  611. </style>