Txmoney.vue 14 KB

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