cashDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  287. uni.showLoading({
  288. title: '上传中'
  289. })
  290. uni.uploadFile({
  291. url: that.config('APIHOST1') + '/alioss/upload',
  292. filePath: resPath,
  293. name: 'file',
  294. success: (uploadFileRes) => {
  295. let img = JSON.parse(uploadFileRes.data).data
  296. let data = {
  297. cashQrCode: img
  298. }
  299. that.$Request.getA('/shop/shopmoney/shopBindingQrCode', data).then((res) => {
  300. if (res.code == 0) {
  301. that.getUserInfo()
  302. setTimeout(function () {
  303. that.$queue.showToast('上传成功')
  304. }, 1000)
  305. }
  306. })
  307. uni.hideLoading()
  308. },
  309. fail: () => {
  310. uni.showToast({
  311. title: '上传失败',
  312. icon: 'error'
  313. })
  314. }
  315. })
  316. })
  317. }
  318. }
  319. })
  320. },
  321. config: function (name) {
  322. var info = null
  323. if (name) {
  324. var name2 = name.split('.') //字符分割
  325. if (name2.length > 1) {
  326. info = configdata[name2[0]][name2[1]] || null
  327. } else {
  328. info = configdata[name] || null
  329. }
  330. if (info == null) {
  331. let web_config = cache.get('web_config')
  332. if (web_config) {
  333. if (name2.length > 1) {
  334. info = web_config[name2[0]][name2[1]] || null
  335. } else {
  336. info = web_config[name] || null
  337. }
  338. }
  339. }
  340. }
  341. return info
  342. },
  343. //校验用户输入金额
  344. checkMobile(money) {
  345. return RegExp(/^1[34578]\d{9}$/).test(money)
  346. },
  347. getOut(money) {
  348. let that = this
  349. if (money) {
  350. that.moneys = money
  351. }
  352. if (!/^\d+$/.test(that.moneys)) {
  353. uni.showModal({
  354. title: '提示',
  355. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  356. success: function (res) {
  357. if (res.confirm) {
  358. } else if (res.cancel) {
  359. }
  360. }
  361. })
  362. return
  363. }
  364. if (that.openWay == 2) {
  365. //支付宝提现
  366. if (that.zhifubao != null && that.zhifubaoName != null) {
  367. uni.showModal({
  368. title: '提现申请提示',
  369. content:
  370. '请仔细确认收款人信息\n\n收款人姓名:' +
  371. that.zhifubaoName +
  372. '\n\n收款人账号:' +
  373. that.zhifubao +
  374. '\n\n提现金额:' +
  375. that.moneys +
  376. '元\t\t手续费:' +
  377. (that.moneys * that.shouxufei).toFixed(1),
  378. success: (e) => {
  379. if (e.confirm) {
  380. that.$queue.showLoading('提现中...')
  381. let data = {
  382. money: that.moneys
  383. // classify: '1'
  384. }
  385. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  386. if (res.status === 0 && res.data) {
  387. setTimeout(function () {
  388. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  389. }, 3000)
  390. that.getwalletMoney()
  391. } else {
  392. that.$queue.showToast(res.msg)
  393. that.getwalletMoney()
  394. }
  395. uni.hideLoading()
  396. })
  397. }
  398. }
  399. })
  400. } else {
  401. uni.navigateTo({
  402. url: '/my/other/zhifubao'
  403. })
  404. }
  405. } else if (that.openWay == 1) {
  406. //微信提现
  407. if (that.values == 2) {
  408. that.$Request.getA('/sys/user/info').then((res) => {
  409. if (res.code === 0) {
  410. let wxImg = res.user.userEntity.cashQrCode
  411. if (!wxImg) {
  412. uni.showModal({
  413. title: '提现提示',
  414. content: '请上传微信收款码',
  415. showCancel: true,
  416. cancelText: '取消',
  417. confirmText: '上传',
  418. success: (res) => {
  419. if (res.confirm) {
  420. that.show = true
  421. }
  422. },
  423. fail: () => {},
  424. complete: () => {}
  425. })
  426. return
  427. }
  428. if (!/^\d+$/.test(that.moneys)) {
  429. uni.showModal({
  430. title: '提示',
  431. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  432. success: function (res) {
  433. if (res.confirm) {
  434. } else if (res.cancel) {
  435. }
  436. }
  437. })
  438. return
  439. }
  440. if (that.moneys * 1 >= that.value * 1) {
  441. uni.showModal({
  442. title: '提现申请提示',
  443. content: '金额:' + that.moneys + '元' + ',' + '手续费:' + (that.moneys * that.shouxufei).toFixed(1),
  444. success: (e) => {
  445. if (e.confirm) {
  446. that.$queue.showLoading('提现中...')
  447. let data = {
  448. money: that.moneys
  449. // classify: 2
  450. }
  451. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  452. if (res.code === 0) {
  453. setTimeout(function () {
  454. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  455. }, 1000)
  456. that.getwalletMoney()
  457. } else {
  458. uni.showModal({
  459. title: '温馨提示',
  460. content: res.msg,
  461. showCancel: false,
  462. cancelText: '取消',
  463. confirmText: '确认'
  464. })
  465. }
  466. uni.hideLoading()
  467. })
  468. }
  469. }
  470. })
  471. } else {
  472. setTimeout(function () {
  473. that.$queue.showToast('提现金额必须大于或等于' + that.value + '元才可提现')
  474. }, 1000)
  475. }
  476. } else {
  477. that.$queue.showToast('网络状态不好,请刷新后重试!')
  478. }
  479. })
  480. } else {
  481. if (!/^\d+$/.test(that.moneys)) {
  482. uni.showModal({
  483. title: '提示',
  484. content: '请输入正确金额,不能包含中文,英文,特殊字符和小数',
  485. success: function (res) {
  486. if (res.confirm) {
  487. } else if (res.cancel) {
  488. }
  489. }
  490. })
  491. return
  492. }
  493. if (parseFloat(that.moneys).toFixed(1) >= that.value) {
  494. uni.showModal({
  495. title: '提现申请提示',
  496. content: '金额:' + that.moneys + '元' + ',' + '手续费:' + parseFloat(that.moneys * that.shouxufei).toFixed(1),
  497. success: (e) => {
  498. if (e.confirm) {
  499. that.$queue.showLoading('提现中...')
  500. let data = {
  501. money: that.moneys
  502. // classify: 2
  503. }
  504. that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then((res) => {
  505. if (res.code === 0) {
  506. setTimeout(function () {
  507. that.$queue.showToast('提现申请成功,预计三个工作日到账')
  508. }, 1000)
  509. that.getwalletMoney()
  510. } else {
  511. uni.showModal({
  512. title: '温馨提示',
  513. content: res.msg,
  514. showCancel: false,
  515. cancelText: '取消',
  516. confirmText: '确认'
  517. })
  518. that.getwalletMoney()
  519. }
  520. uni.hideLoading()
  521. })
  522. }
  523. }
  524. })
  525. } else {
  526. that.$queue.showToast('提现金额必须大于或等于' + that.value + '元才可提现')
  527. }
  528. }
  529. }
  530. }
  531. }
  532. }
  533. </script>
  534. <style lang="less">
  535. // @import '../../static/css/index.css';
  536. .view2-view-text {
  537. font-size: 14px;
  538. color: #000000;
  539. margin-left: 20upx;
  540. width: 80%;
  541. }
  542. .view2-view-image-right {
  543. width: 18upx;
  544. height: 30upx;
  545. margin-left: 50upx;
  546. }
  547. .cash {
  548. text-align: center;
  549. background: white;
  550. height: 100%;
  551. position: absolute;
  552. width: 100%;
  553. .cash-top {
  554. padding: 32upx 32upx 50upx 32upx;
  555. /* border-bottom: 1px solid gainsboro; */
  556. background: #ff2638;
  557. }
  558. .leiji {
  559. font-size: 14px;
  560. color: #ffffff;
  561. margin-bottom: 10px;
  562. }
  563. // 提现银行卡信息
  564. .yinghang {
  565. height: 80rpx;
  566. line-height: 80rpx;
  567. font-size: 36rpx;
  568. font-weight: 700;
  569. text-align: left;
  570. }
  571. .yinghang2 {
  572. height: 80rpx;
  573. line-height: 80rpx;
  574. font-size: 36rpx;
  575. font-weight: 700;
  576. }
  577. }
  578. </style>