cashDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view class="cash">
  3. <view style="background-image: url('../../static/images/my/qanbaobg.png'); background-size: 100%; height: 400upx">
  4. <view style="font-size: 32upx; padding-top: 100upx">可提现总额</view>
  5. <view style="font-size: 40upx; padding-top: 20upx">¥ {{ money }}</view>
  6. <view
  7. style="
  8. width: 90%;
  9. height: max-content;
  10. margin-left: 40upx;
  11. background-color: #ffffff;
  12. box-shadow: rgba(183, 183, 183, 0.3) 0px 1px 10px;
  13. margin-top: 50upx;
  14. border-radius: 20upx;
  15. "
  16. >
  17. <view style="display: flex; flex-direction: row; padding: 20upx">
  18. <view style="font-size: 32upx; color: #333333">
  19. 提现金额
  20. <text style="font-size: 28upx; color: #ff2638" v-if="shouxufei">(注:提现手续费为{{ shouxufei * 100 }}%)</text>
  21. </view>
  22. </view>
  23. <view style="display: flex; flex-direction: row; padding: 20upx">
  24. <view style="font-size: 40upx; color: #333333">¥</view>
  25. <input type="text" v-model="moneys" placeholder="请输入金额" style="font-size: 40upx; color: #333333; text-align: left; margin-left: 10upx; width: 100%" />
  26. </view>
  27. <view style="background: #e6e6e6; width: 100%; height: 1upx"></view>
  28. <view style="display: flex; flex-direction: row; flex-wrap: wrap">
  29. <view style="display: flex; flex-direction: row" v-for="(item, index) in moneyList" :key="index">
  30. <view>
  31. <view style="padding: 20upx" @click="getOut(item.money)">
  32. <view style="padding-top: 40upx; width: 180upx; height: 120upx; background-color: #ffffff; border: 1px solid #ffcc00; border-radius: 10upx">
  33. {{ item.money }}
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view style="margin-top: 59upx; background-color: #fff" class="padding-lr margin-lr-sm">
  41. <view class="yinghang">提现银行卡信息</view>
  42. <view style="color: #333333; text-align: left">
  43. 银行卡号:
  44. <text class="yinghang2">{{ yingNo }}</text>
  45. </view>
  46. <view style="color: #333333; text-align: left">
  47. 开户行:
  48. <text class="yinghang2">{{ yingName }}</text>
  49. </view>
  50. <view style="color: #333333; text-align: left">
  51. 开户人姓名:
  52. <text class="yinghang2">{{ yingPeople }}</text>
  53. </view>
  54. <view style="color: #333333; text-align: left">
  55. 商户号:
  56. <text class="yinghang2">{{ yingNumber }}</text>
  57. </view>
  58. <view style="color: #333333; text-align: left">
  59. 每日提现次数:
  60. <text class="yinghang2">不限</text>
  61. </view>
  62. <view style="color: #333333; text-align: left">
  63. 可提现时间:
  64. <text class="yinghang2">工作日全天</text>
  65. </view>
  66. <view style="color: #333333; text-align: left">
  67. 到账时间:
  68. <text class="yinghang2">48小时内</text>
  69. </view>
  70. <!-- <view class="flex justify-between margin-bottom-xl" v-for="(item,index) in openLists" :key="index">
  71. <view class="flex align-center">
  72. <image :src="item.image" style="width:23px;height:20px"></image>
  73. <text class="text-lg margin-left-sm" style="color:#333333;font-weight:700;">{{item.text}}</text>
  74. </view>
  75. <view>
  76. <radio-group name="openWay" style="margin-left: 20upx;" @tap='selectWay(item)'>
  77. <label class="tui-radio">
  78. <radio color="#FF7F00" :checked="openWay === item.id ? true : false" />
  79. </label>
  80. </radio-group>
  81. </view>
  82. </view> -->
  83. </view>
  84. <view @click="getOut()" style="margin: 32upx; font-size: 18px; background: #ffcc00; border-radius: 10px; height: 40px; line-height: 40px">提现</view>
  85. <view style="display: flex; width: 100%; justify-content: center">
  86. <!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;flex: 1;" @click="goZhifuBao">提现账号
  87. </view> -->
  88. <view style="color: grey; padding-bottom: 30px; padding-top: 20upx; flex: 1" @click="goqianbao">钱包明细</view>
  89. <!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;flex: 1;" @click="isShow">微信收款码
  90. </view> -->
  91. <view style="color: grey; padding-bottom: 30px; padding-top: 20upx; flex: 1" @click="gojilu">提现记录</view>
  92. </view>
  93. </view>
  94. <!-- 微信收款码弹框 -->
  95. <u-popup v-model="show" mode="center">
  96. <view class="padding">
  97. <view class="text-center text-lg text-bold flex justify-between">
  98. <view></view>
  99. <view>添加微信收款码</view>
  100. <view @click="show = false">X</view>
  101. </view>
  102. <!-- <view class="text-center padding-top-sm padding-bottom-lg" style="color: #999999;">请提交微信号和微信二维码
  103. </view> -->
  104. <view style="width: 80%; margin: 0 auto">
  105. <view class="margin-top" @click.stop="weixin" style="border: 4rpx solid #010101; border-radius: 16rpx; overflow: hidden">
  106. <image v-if="!wximg" src="../../static/images/my/erweima.png"></image>
  107. <image v-else :src="wximg" mode=""></image>
  108. </view>
  109. </view>
  110. <!-- <view class="text-center margin-top-sm " @click="submit"
  111. style="border-radius: 10rpx;background-color: #7E59FF;color: #fff;height: 80rpx;line-height: 80rpx;">保存</view> -->
  112. </view>
  113. </u-popup>
  114. <!-- 用于图片压缩的canvas画布 -->
  115. <canvas
  116. :style="{
  117. width: cw + 'px',
  118. height: cw + 'px',
  119. position: 'absolute',
  120. zIndex: -1,
  121. left: '-10000rpx',
  122. top: '-10000rpx'
  123. }"
  124. canvas-id="zipCanvas"
  125. ></canvas>
  126. <!--画布结束-->
  127. </view>
  128. </template>
  129. <script>
  130. import configdata from '@/common/config.js'
  131. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  132. export default {
  133. data() {
  134. return {
  135. show: false,
  136. money: '',
  137. moneys: '',
  138. zhifubao: '',
  139. mayMoney: '0',
  140. zhifubaoName: '',
  141. shouxufei: '',
  142. moneyList: [
  143. {
  144. money: '10'
  145. },
  146. {
  147. money: '500'
  148. },
  149. {
  150. money: '1000'
  151. },
  152. {
  153. money: '3000'
  154. },
  155. {
  156. money: '5000'
  157. },
  158. {
  159. money: '10000'
  160. }
  161. ],
  162. value: 0,
  163. min: '',
  164. zhifubao: '',
  165. zhifubaoName: '',
  166. openLists: [],
  167. openWay: 1,
  168. values: '',
  169. wximg: '',
  170. yingName: '',
  171. yingNo: '',
  172. yingPeople: '',
  173. yingNumber: '',
  174. //画板边长默认是屏幕宽度,正方形画布
  175. cw: uni.getSystemInfoSync().windowWidth
  176. }
  177. },
  178. onLoad() {
  179. this.getUserInfo()
  180. // this.getyinghanglist()
  181. this.$Request.getT('/common/type/290').then((res) => {
  182. //判断微信提现方式
  183. if (res.code == 0) {
  184. if (res.data && res.data.value) {
  185. this.values = res.data.value
  186. }
  187. }
  188. })
  189. //提现手续费
  190. this.$Request.getT('/common/type/115').then((res) => {
  191. if (res.code === 0) {
  192. this.shouxufei = res.data.value
  193. }
  194. })
  195. this.openLists = [
  196. {
  197. image: '../../static/images/img/icon_weixin.png',
  198. text: '微信',
  199. id: 1
  200. },
  201. {
  202. image: '../../static/images/img/zhifubao.png',
  203. text: '支付宝',
  204. id: 2
  205. }
  206. ]
  207. this.openWay = 1
  208. },
  209. onShow: function (e) {
  210. this.getwalletMoney()
  211. this.getUserInfo()
  212. this.getyinghanglist()
  213. },
  214. onNavigationBarButtonTap() {
  215. this.list()
  216. },
  217. methods: {
  218. //获取商户银行信息
  219. getyinghanglist() {
  220. let data = {
  221. userId: this.$queue.getData('userId')
  222. }
  223. this.$Request.getA('/admin/shop/bank/get-by-user', data).then((res) => {
  224. // console.log(res, '999')
  225. if (res.msg == 'success') {
  226. this.yingName = res.data.openBank
  227. this.yingNo = res.data.cardNo
  228. this.yingPeople = res.data.realName
  229. this.yingNumber = res.data.mchId
  230. } else if (res.msg == 'shopId对应的银行卡记录不存在') {
  231. uni.showToast({
  232. icon: 'none',
  233. title: '银行信息不完整无法提现'
  234. })
  235. }
  236. })
  237. },
  238. //用户收款码弹框
  239. isShow() {
  240. this.getUserInfo()
  241. this.show = true
  242. },
  243. //微信 支付宝提现选择
  244. selectWay: function (item) {
  245. this.openWay = item.id
  246. },
  247. //获取用户信息获取用户是否上传收款码
  248. getUserInfo() {
  249. this.$Request.getA('/sys/user/info').then((res) => {
  250. if (res.code == 0) {
  251. this.zhifubao = res.user.userEntity.zhiFuBao
  252. this.zhifubaoName = res.user.userEntity.zhiFuBaoName
  253. this.wximg = res.user.userEntity.cashQrCode
  254. // console.log(this.zhifubao, this.zhifubaoName, '-')
  255. }
  256. })
  257. },
  258. //获取账户余额
  259. getwalletMoney() {
  260. this.$Request.getT('/shop/shopmoney/selectShopMoney').then((res) => {
  261. if (res.code == 0) {
  262. this.money = res.data.money
  263. }
  264. uni.hideLoading()
  265. })
  266. },
  267. gojilu() {
  268. uni.navigateTo({
  269. url: '/my/other/moneydetail'
  270. })
  271. },
  272. goqianbao() {
  273. uni.navigateTo({
  274. url: '/my/other/cashList'
  275. })
  276. },
  277. goZhifuBao() {
  278. uni.navigateTo({
  279. url: '/my/other/zhifubao'
  280. })
  281. },
  282. weixin() {
  283. let that = this
  284. uni.chooseImage({
  285. count: 1,
  286. sourceType: ['album', 'camera'],
  287. success: (res) => {
  288. for (let i = 0; i < 1; i++) {
  289. //这里的id和页面中写的html代码的canvas的id要一致
  290. let canvasId = 'zipCanvas'
  291. //原图的路径
  292. let imagePath = res.tempFiles[i].path
  293. //大小限制
  294. let limitSize = 1024 * 2
  295. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  296. let drawWidth = uni.getSystemInfoSync().windowWidth
  297. let that = this
  298. let token = uni.getStorageSync('shopToken')
  299. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  300. uni.showLoading({
  301. title: '上传中'
  302. })
  303. uni.uploadFile({
  304. url: that.config('APIHOST1') + '/admin/new-file/upload',
  305. filePath: resPath,
  306. header: {
  307. token: token
  308. },
  309. name: 'file',
  310. success: (uploadFileRes) => {
  311. let img = JSON.parse(uploadFileRes.data).data
  312. let data = {
  313. cashQrCode: img
  314. }
  315. that.$Request.getA('/shop/shopmoney/shopBindingQrCode', data).then((res) => {
  316. if (res.code == 0) {
  317. that.getUserInfo()
  318. setTimeout(function () {
  319. that.$queue.showToast('上传成功')
  320. }, 1000)
  321. }
  322. })
  323. uni.hideLoading()
  324. },
  325. fail: () => {
  326. uni.showToast({
  327. title: '上传失败',
  328. icon: 'error'
  329. })
  330. }
  331. })
  332. })
  333. }
  334. }
  335. })
  336. },
  337. config: function (name) {
  338. var info = null
  339. if (name) {
  340. var name2 = name.split('.') //字符分割
  341. if (name2.length > 1) {
  342. info = configdata[name2[0]][name2[1]] || null
  343. } else {
  344. info = configdata[name] || null
  345. }
  346. if (info == null) {
  347. let web_config = cache.get('web_config')
  348. if (web_config) {
  349. if (name2.length > 1) {
  350. info = web_config[name2[0]][name2[1]] || null
  351. } else {
  352. info = web_config[name] || null
  353. }
  354. }
  355. }
  356. }
  357. return info
  358. },
  359. //校验用户输入金额
  360. checkMobile(money) {
  361. return RegExp(/^1[34578]\d{9}$/).test(money)
  362. },
  363. getOut(money) {
  364. let that = this
  365. if (money) {
  366. that.moneys = money
  367. }
  368. if (!/^\d+$/.test(that.moneys)) {
  369. uni.showModal({
  370. title: '提示',
  371. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  372. success: function (res) {
  373. if (res.confirm) {
  374. } else if (res.cancel) {
  375. }
  376. }
  377. })
  378. return
  379. }
  380. if (that.openWay == 2) {
  381. //支付宝提现
  382. if (that.zhifubao != null && that.zhifubaoName != null) {
  383. uni.showModal({
  384. title: '提现申请提示',
  385. content:
  386. '请仔细确认收款人信息\n\n收款人姓名:' +
  387. that.zhifubaoName +
  388. '\n\n收款人账号:' +
  389. that.zhifubao +
  390. '\n\n提现金额:' +
  391. that.moneys +
  392. '元\t\t手续费:' +
  393. (that.moneys * that.shouxufei).toFixed(1),
  394. success: (e) => {
  395. if (e.confirm) {
  396. that.$queue.showLoading('提现中...')
  397. let data = {
  398. money: that.moneys
  399. // classify: '1'
  400. }
  401. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  402. if (res.status === 0 && res.data) {
  403. setTimeout(function () {
  404. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  405. }, 3000)
  406. that.getwalletMoney()
  407. } else {
  408. that.$queue.showToast(res.msg)
  409. that.getwalletMoney()
  410. }
  411. uni.hideLoading()
  412. })
  413. }
  414. }
  415. })
  416. } else {
  417. uni.navigateTo({
  418. url: '/my/other/zhifubao'
  419. })
  420. }
  421. } else if (that.openWay == 1) {
  422. //微信提现
  423. if (that.values == 2) {
  424. that.$Request.getA('/sys/user/info').then((res) => {
  425. if (res.code === 0) {
  426. let wxImg = res.user.userEntity.cashQrCode
  427. if (!wxImg) {
  428. uni.showModal({
  429. title: '提现提示',
  430. content: '请上传微信收款码',
  431. showCancel: true,
  432. cancelText: '取消',
  433. confirmText: '上传',
  434. success: (res) => {
  435. if (res.confirm) {
  436. that.show = true
  437. }
  438. },
  439. fail: () => {},
  440. complete: () => {}
  441. })
  442. return
  443. }
  444. if (!/^\d+$/.test(that.moneys)) {
  445. uni.showModal({
  446. title: '提示',
  447. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  448. success: function (res) {
  449. if (res.confirm) {
  450. } else if (res.cancel) {
  451. }
  452. }
  453. })
  454. return
  455. }
  456. if (that.moneys * 1 >= that.value * 1) {
  457. uni.showModal({
  458. title: '提现申请提示',
  459. content: '金额:' + that.moneys + '元' + ',' + '手续费:' + (that.moneys * that.shouxufei).toFixed(1),
  460. success: (e) => {
  461. if (e.confirm) {
  462. that.$queue.showLoading('提现中...')
  463. let data = {
  464. money: that.moneys
  465. // classify: 2
  466. }
  467. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  468. if (res.code === 0) {
  469. setTimeout(function () {
  470. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  471. }, 1000)
  472. that.getwalletMoney()
  473. } else {
  474. uni.showModal({
  475. title: '温馨提示',
  476. content: res.msg,
  477. showCancel: false,
  478. cancelText: '取消',
  479. confirmText: '确认'
  480. })
  481. }
  482. uni.hideLoading()
  483. })
  484. }
  485. }
  486. })
  487. } else {
  488. setTimeout(function () {
  489. that.$queue.showToast('提现金额必须大于或等于' + that.value + '元才可提现')
  490. }, 1000)
  491. }
  492. } else {
  493. that.$queue.showToast('网络状态不好,请刷新后重试!')
  494. }
  495. })
  496. } else {
  497. if (!/^\d+$/.test(that.moneys)) {
  498. uni.showModal({
  499. title: '提示',
  500. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  501. success: function (res) {
  502. if (res.confirm) {
  503. } else if (res.cancel) {
  504. }
  505. }
  506. })
  507. return
  508. }
  509. if (parseFloat(that.moneys).toFixed(1) >= that.value) {
  510. uni.showModal({
  511. title: '提现申请提示',
  512. content: '金额:' + that.moneys + '元' + ',' + '手续费:' + parseFloat(that.moneys * that.shouxufei).toFixed(1),
  513. success: (e) => {
  514. if (e.confirm) {
  515. that.$queue.showLoading('提现中...')
  516. let data = {
  517. money: that.moneys
  518. // classify: 2
  519. }
  520. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  521. if (res.code === 0) {
  522. setTimeout(function () {
  523. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  524. }, 1000)
  525. that.getwalletMoney()
  526. } else {
  527. uni.showModal({
  528. title: '温馨提示',
  529. content: res.msg,
  530. showCancel: false,
  531. cancelText: '取消',
  532. confirmText: '确认'
  533. })
  534. that.getwalletMoney()
  535. }
  536. uni.hideLoading()
  537. })
  538. }
  539. }
  540. })
  541. } else {
  542. that.$queue.showToast('提现金额必须大于或等于' + that.value + '元才可提现')
  543. }
  544. }
  545. }
  546. }
  547. }
  548. }
  549. </script>
  550. <style lang="less">
  551. // @import '../../static/css/index.css';
  552. .view2-view-text {
  553. font-size: 14px;
  554. color: #000000;
  555. margin-left: 20upx;
  556. width: 80%;
  557. }
  558. .view2-view-image-right {
  559. width: 18upx;
  560. height: 30upx;
  561. margin-left: 50upx;
  562. }
  563. .cash {
  564. text-align: center;
  565. background: white;
  566. height: 100%;
  567. position: absolute;
  568. width: 100%;
  569. .cash-top {
  570. padding: 32upx 32upx 50upx 32upx;
  571. /* border-bottom: 1px solid gainsboro; */
  572. background: #ff2638;
  573. }
  574. .leiji {
  575. font-size: 14px;
  576. color: #ffffff;
  577. margin-bottom: 10px;
  578. }
  579. // 提现银行卡信息
  580. .yinghang {
  581. height: 80rpx;
  582. line-height: 80rpx;
  583. font-size: 36rpx;
  584. font-weight: 700;
  585. text-align: left;
  586. }
  587. .yinghang2 {
  588. height: 80rpx;
  589. line-height: 80rpx;
  590. font-size: 36rpx;
  591. font-weight: 700;
  592. }
  593. }
  594. </style>