cashDetail.vue 16 KB

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