Txmoney.vue 14 KB

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