Txmoney.vue 16 KB

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