Txmoney.vue 16 KB

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