cashDetail.vue 16 KB

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