cash.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <template>
  2. <app-layout>
  3. <view class="info">
  4. <view class="last">可提现金额:{{community.money ? community.money : '0.00'}}元</view>
  5. </view>
  6. <view>
  7. <view class="info input-money main-between cross-center">
  8. <view class="input">
  9. <input v-model="moneyInput" type="digit" placeholder-style="color:#cdcdcd" placeholder="请输入提现金额">
  10. <view class="price" :style="{'color': getTheme.color}">¥</view>
  11. </view>
  12. </view>
  13. <view class="about"
  14. v-if="config.min_money > 0 || config.cash_service_charge > 0 || config.free_cash_min > 0 || config.free_cash_max > 0">
  15. <view class="dir-left-nowrap">
  16. <view>说明:</view>
  17. <view>
  18. <view v-if="config.min_money > 0">金额不能少于¥{{config.min_money}}元</view>
  19. <view v-if="config.cash_service_charge > 0">提现需要加收{{config.cash_service_charge}}%手续费</view>
  20. <view v-if="config.free_cash_max > 0">
  21. 免手续费提现金额区间为¥{{config.free_cash_min}}~¥{{config.free_cash_max}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="dir-left-nowrap cross-center cash-type" @click="cashTypeModel = true">
  27. <view class="box-grow-1">提现方式</view>
  28. <view class="box-grow-0">{{cashName}}</view>
  29. <image class="box-grow-0 arrow-image" src="/static/image/icon/arrow-right.png"></image>
  30. </view>
  31. <view v-if="mark_num==1 || mark_num ==2 || mark_num == 3" class="cash-info">
  32. <view class="info content">
  33. <view class="enter" v-if="mark_num==3">开户人</view>
  34. <view class="enter" v-else>姓名</view>
  35. <input class="info-input" v-model="name" placeholder="请输入正确的姓名"></input>
  36. </view>
  37. <view class="info content" v-if="mark_num==3">
  38. <view class="enter">开户行</view>
  39. <input class="info-input" v-model="bank_name" placeholder="请输入正确的银行名称"></input>
  40. </view>
  41. <view class="info content">
  42. <view class="enter">帐号</view>
  43. <input class="info-input" v-model="mobile" v-if="mark_num < 3" :placeholder="mark_num == 1 ? '请输入正确的微信帐号' : '请输入正确的支付宝帐号'"></input>
  44. <input class="info-input" v-model="mobile" v-if="mark_num==3" type="number"
  45. placeholder="请输入正确的银行卡帐号"></input>
  46. </view>
  47. </view>
  48. <view class="submit">
  49. <button @click="subscribe" :style="{'background-color': getTheme.background}">提交申请</button>
  50. </view>
  51. </view>
  52. <view class="bg" v-if="submitOver || warningInfo">
  53. <view class="dialog">
  54. <view class="dialog-title">提示</view>
  55. <view v-if="submitOver">提现申请提交成功</view>
  56. <view v-if="warningInfo">{{warningInfo}}</view>
  57. <view @click="toDetail" v-if="submitOver" class="close-button" :style="{'color': getTheme.color}">确认</view>
  58. <view @click="warningInfo = false" v-if="warningInfo" class="close-button" :style="{'color': getTheme.color}">确认</view>
  59. </view>
  60. </view>
  61. <app-cash-model
  62. :is-auto="pay_type.auto"
  63. :is-wx="pay_type.wechat"
  64. :is-alipay="pay_type.alipay"
  65. :is-bank="pay_type.bank"
  66. :is-balance="pay_type.balance"
  67. :theme="getTheme"
  68. :pay-type="cashType"
  69. @change="payTypeChange"
  70. v-model="cashTypeModel"
  71. ></app-cash-model>
  72. </app-layout>
  73. </template>
  74. <script>
  75. import {mapGetters, mapState} from 'vuex';
  76. import appCashModel from "../../../components/page-component/app-cash-model/app-cash-model.vue"
  77. export default {
  78. data() {
  79. return {
  80. cashTypeModel: false,
  81. visible: false,
  82. mark_num: -1,
  83. community: {},
  84. pay_type: {
  85. auto: false,
  86. alipay: false,
  87. wechat: false,
  88. bank: false,
  89. balance: false,
  90. },
  91. loading: false,
  92. warningInfo: '',
  93. submitOver: false,
  94. config: [],
  95. name: '',
  96. bank_name: '',
  97. mobile: '',
  98. template_message: [],
  99. getMoney: null,
  100. moneyInput: '',
  101. cashType: '',
  102. }
  103. },
  104. components: {appCashModel,},
  105. computed: {
  106. ...mapState({
  107. mall: state => state.mallConfig.mall,
  108. }),
  109. ...mapGetters('mallConfig', {
  110. getTheme: 'getTheme',
  111. }),
  112. cashName() {
  113. switch (this.cashType) {
  114. case 'auto':
  115. // #ifdef MP-WEIXIN
  116. return '微信零钱';
  117. // #endif
  118. // #ifdef MP-ALIPAY
  119. return '支付宝余额';
  120. // #endif
  121. // #ifndef MP-WEIXIN || MP-ALIPAY
  122. return '自动';
  123. // #endif
  124. case 'wx':
  125. return '微信线下打款';
  126. case 'alipay':
  127. return '支付宝线下打款';
  128. case 'bank':
  129. return '银联线下打款';
  130. case 'balance':
  131. return '商城余额';
  132. default:
  133. return;
  134. break;
  135. }
  136. },
  137. },
  138. methods: {
  139. payTypeChange(value) {
  140. this.cashType = value;
  141. switch (value) {
  142. case 'auto':
  143. this.mark_num = 0;
  144. break;
  145. case 'wx':
  146. this.mark_num = 1;
  147. break;
  148. case 'alipay':
  149. this.mark_num = 2;
  150. break;
  151. case 'bank':
  152. this.mark_num = 3;
  153. break;
  154. case 'balance':
  155. this.mark_num = 4;
  156. break;
  157. default:
  158. this.mark_num = -1;
  159. break;
  160. }
  161. },
  162. subscribe() {
  163. if (this.loading) {
  164. return false
  165. }
  166. if (this.submitOver || this.warningInfo) {
  167. return false
  168. }
  169. if (this.moneyInput > 0) {
  170. if (this.mark_num == -1) {
  171. uni.showToast({title: '请选择提现方式', icon: 'none'});
  172. return;
  173. }
  174. this.loading = true;
  175. this.$subscribe(this.template_message).then(res => {
  176. this.submit();
  177. }).catch(res => {
  178. this.submit();
  179. });
  180. }else {
  181. this.warningInfo = '请输入正确的提现金额'
  182. }
  183. },
  184. submit() {
  185. let that = this;
  186. uni.showLoading({
  187. mask: true,
  188. title: '加载中...'
  189. });
  190. let para = {
  191. model: 'community',
  192. price: that.moneyInput,
  193. type: 'auto'
  194. };
  195. if (that.mark_num == 4) {
  196. para.type = 'balance';
  197. } else if (that.mark_num == 0) {
  198. para.type = 'auto';
  199. } else {
  200. para.name = that.name;
  201. para.mobile = that.mobile;
  202. if (that.mark_num == 1) {
  203. para.type = 'wechat';
  204. }
  205. if (that.mark_num == 2) {
  206. para.type = 'alipay';
  207. }
  208. if (that.mark_num == 3) {
  209. para.type = 'bank';
  210. para.bank_name = that.bank_name;
  211. }
  212. }
  213. that.$request({
  214. url: that.$api.finance.cash,
  215. data: para,
  216. method: 'post'
  217. }).then(response=>{
  218. uni.hideLoading();
  219. that.loading = false;
  220. if(response.code == 0) {
  221. that.submitOver = true;
  222. }else {
  223. that.warningInfo = response.msg;
  224. }
  225. }).catch(response => {
  226. that.loading = false;
  227. uni.hideLoading();
  228. });
  229. },
  230. toDetail() {
  231. this.submitOver = false;
  232. uni.redirectTo({
  233. url: '/plugins/community/cash-detail/cash-detail'
  234. });
  235. },
  236. getStatus() {
  237. let that = this;
  238. that.$request({
  239. url: that.$api.community.index,
  240. }).then(response=>{
  241. that.$hideLoading();
  242. if(response.code == 0) {
  243. that.community = response.data.middleman;
  244. }else {
  245. uni.showToast({
  246. title: response.msg,
  247. icon: 'none',
  248. duration: 1000
  249. });
  250. }
  251. }).catch(response => {
  252. that.$hideLoading();
  253. });
  254. },
  255. setting() {
  256. let that = this;
  257. that.$request({
  258. url: that.$api.finance.config,
  259. data: {
  260. model: 'community'
  261. },
  262. method: 'post'
  263. }).then(response=>{
  264. that.$hideLoading();
  265. that.getStatus();
  266. if(response.code == 0) {
  267. that.config = response.data.config;
  268. that.template_message = response.data.template_message;
  269. for (let i = 0; i < that.config.pay_type.length; i++) {
  270. switch (that.config.pay_type[i]) {
  271. case "auto":
  272. that.pay_type.auto = true;
  273. //that.mark_num = 0;
  274. break;
  275. case "alipay":
  276. that.pay_type.alipay = true;
  277. //that.mark_num = 2;
  278. break;
  279. case "wechat":
  280. that.pay_type.wechat = true;
  281. //that.mark_num = 1;
  282. break;
  283. case "balance":
  284. that.pay_type.balance = true;
  285. //that.mark_num = 4;
  286. break;
  287. case "bank":
  288. that.pay_type.bank = true;
  289. //that.mark_num = 3;
  290. break;
  291. }
  292. }
  293. }else {
  294. uni.showToast({
  295. title: response.msg,
  296. icon: 'none',
  297. duration: 1000
  298. });
  299. }
  300. }).catch(response => {
  301. that.$hideLoading();
  302. });
  303. },
  304. },
  305. onLoad(options) { this.$commonLoad.onload(options);
  306. let that = this;
  307. if (options.money > 0) {
  308. that.money = options.money;
  309. };
  310. that.setting();
  311. }
  312. }
  313. </script>
  314. <style scoped lang="scss">
  315. .cash-type {
  316. height: #{120rpx};
  317. background: white;
  318. color: #353535;
  319. font-size: #{32rpx};
  320. padding: 0 #{24rpx};
  321. margin-top: #{24rpx};
  322. .arrow-image {
  323. width: #{12rpx};
  324. height: #{24rpx};
  325. display: block;
  326. margin-left: #{12rpx};
  327. }
  328. }
  329. .cash-info {
  330. margin-top: #{20rpx};
  331. }
  332. .info {
  333. background-color: #fff;
  334. padding: #{32rpx} #{24rpx};
  335. border-bottom: #{1rpx} solid #e2e2e2;
  336. color: #353535;
  337. }
  338. .info.input-money {
  339. border-bottom: 0;
  340. }
  341. .info.cash-type {
  342. margin: #{20rpx} 0;
  343. padding: #{32rpx} 0;
  344. }
  345. .last {
  346. font-size: #{40rpx};
  347. margin-bottom: #{15rpx};
  348. }
  349. .last-info {
  350. font-size: #{24rpx};
  351. color: #666;
  352. }
  353. .last-info view {
  354. float: left;
  355. height: #{44rpx};
  356. line-height: #{44rpx};
  357. }
  358. .last-info .show-tip {
  359. color: #666;
  360. display: inline-block;
  361. background-color: #fff;
  362. font-size: #{24rpx};
  363. padding: 0 #{12rpx};
  364. height: #{44rpx};
  365. line-height: #{44rpx};
  366. border-radius: #{22rpx};
  367. border: #{1rpx} solid #e2e2e2;
  368. }
  369. .last-info button::after {
  370. border: 0;
  371. }
  372. .price {
  373. height: #{80rpx};
  374. line-height: #{80rpx};
  375. font-size: #{46rpx};
  376. position: absolute;
  377. left: 0;
  378. top: 0;
  379. }
  380. .all {
  381. color: #666;
  382. }
  383. .input {
  384. font-size: #{36rpx};
  385. height: #{80rpx};
  386. line-height: #{80rpx};
  387. width: 70%;
  388. padding-left: #{50rpx};
  389. position: relative;
  390. }
  391. .input input {
  392. height: #{80rpx};
  393. line-height: #{80rpx};
  394. }
  395. .about {
  396. font-size: #{24rpx};
  397. padding: #{32rpx} #{24rpx} #{12rpx};
  398. color: #666;
  399. }
  400. .icon {
  401. height: #{40rpx};
  402. width: #{40rpx};
  403. margin-right: #{16rpx};
  404. display: flex;
  405. justify-content: center;
  406. }
  407. .mode-item {
  408. width: #{200rpx};
  409. border: #{1rpx} solid #999;
  410. text-align: center;
  411. padding: 0 #{24rpx};
  412. height: #{66rpx};
  413. line-height: #{66rpx};
  414. border-radius: #{33rpx};
  415. display: flex;
  416. align-items: center;
  417. margin: #{10rpx} #{24rpx};
  418. font-size: #{30rpx};
  419. position: relative;
  420. }
  421. .mode-title {
  422. margin-bottom: #{25rpx};
  423. padding-left: #{24rpx};
  424. font-size: #{34rpx};
  425. }
  426. .enter {
  427. color: #353535;
  428. float: left;
  429. width: #{100rpx};
  430. height: #{56rpx};
  431. line-height: #{56rpx};
  432. font-size: #{32rpx};
  433. }
  434. .content {
  435. height: #{120rpx};
  436. }
  437. .info-input {
  438. font-size: #{32rpx};
  439. height: #{56rpx};
  440. padding: 0 #{32rpx};
  441. }
  442. .on-active {
  443. height: #{32rpx};
  444. width: #{32rpx};
  445. position: absolute;
  446. right: 0;
  447. bottom: 0;
  448. }
  449. .submit {
  450. margin-top: #{40rpx};
  451. }
  452. .submit button {
  453. height: #{80rpx};
  454. border-radius: #{40rpx};
  455. line-height: #{80rpx};
  456. width: 90%;
  457. margin: 0 auto;
  458. color: #fff;
  459. font-size: #{32rpx};
  460. }
  461. .bg {
  462. position: fixed;
  463. top: 0;
  464. left: 0;
  465. height: 100%;
  466. width: 100%;
  467. background-color: rgba(0, 0, 0, .3);
  468. z-index: 10;
  469. }
  470. .dialog {
  471. position: fixed;
  472. top: #{400rpx};
  473. left: 0;
  474. right: 0;
  475. height: #{300rpx};
  476. width: #{640rpx};
  477. margin: 0 auto;
  478. z-index: 21;
  479. background-color: #fff;
  480. border-radius: 10px;
  481. text-align: center;
  482. font-size: #{30rpx};
  483. }
  484. .dialog-title {
  485. margin: #{40rpx} auto #{35rpx};
  486. }
  487. .dialog-btn {
  488. height: #{88rpx};
  489. width: #{640rpx};
  490. border-top: #{1rpx} solid #e2e2e2;
  491. line-height: #{88rpx};
  492. position: absolute;
  493. bottom: 0;
  494. left: 0;
  495. }
  496. .dialog-close,.dialog-submit {
  497. width: 50%;
  498. }
  499. .line {
  500. height: #{44rpx};
  501. margin-top: #{22rpx};
  502. width: #{1rpx};
  503. background-color: #e2e2e2;
  504. }
  505. .dialog-submit {
  506. color: #ff4544;
  507. }
  508. .bg {
  509. position: fixed;
  510. top: 0;
  511. left: 0;
  512. right: 0;
  513. height: 100%;
  514. width: 100%;
  515. z-index: 20;
  516. background-color: rgba(0, 0, 0, 0.3);
  517. }
  518. .dialog {
  519. position: fixed;
  520. top: #{400rpx};
  521. left: 0;
  522. right: 0;
  523. height: #{300rpx};
  524. width: #{640rpx};
  525. margin: 0 auto;
  526. z-index: 21;
  527. background-color: #fff;
  528. border-radius: 10px;
  529. text-align: center;
  530. font-size: #{30rpx};
  531. }
  532. .close-button {
  533. height: #{88rpx};
  534. width: #{640rpx};
  535. border-top: #{1rpx} solid #e2e2e2;
  536. line-height: #{88rpx};
  537. position: absolute;
  538. bottom: 0;
  539. left: 0;
  540. }
  541. .dialog-title {
  542. margin: #{40rpx} auto #{35rpx};
  543. }
  544. // 经典红
  545. $classic-red-main-color: #ff4544;
  546. $classic-red-secondary-color: #f39800;
  547. // 活力黄
  548. $vibrant-yellow-main-color: #fcc600;
  549. $vibrant-yellow-secondary-color: #555555;
  550. // 浪漫粉
  551. $romantic-powder-main-color: #ff547b;
  552. $romantic-powder-secondary-color: #ffe6e8;
  553. // 流光金
  554. $streamer-gold-main-color: #ddb766;
  555. $streamer-gold-secondary-color: #f0ebd8;
  556. // 优雅紫
  557. $elegant-purple-main-color: #7783ea;
  558. $elegant-purple-secondary-color: #e9ebff;
  559. // 品味红
  560. $taste-red-main-color: #ff4544;
  561. $taste-red-secondary-color: #555555;
  562. // 清醒绿
  563. $fresh-green-main-color: #63be72;
  564. $fresh-green-secondary-color: #e1f4e3;
  565. // 商务蓝
  566. $business-blue-main-color: #4a90e2;
  567. $business-blue-secondary-color: #dbe9f9;
  568. // 纯粹黑
  569. $pure-black-main-color: #333333;
  570. $pure-black-secondary-color: #dedede;
  571. // 热情红
  572. $passionate-red-main-color: #ff4544;
  573. $passionate-red-secondary-color: #ffdada;
  574. .classic-red-border {
  575. border-color: $classic-red-main-color;
  576. }
  577. .vibrant-yellow-border {
  578. border-color: $vibrant-yellow-main-color;
  579. }
  580. .romantic-powder-border {
  581. border-color: $romantic-powder-main-color;
  582. }
  583. .streamer-gold-border {
  584. border-color: $streamer-gold-main-color;
  585. }
  586. .elegant-purple-border {
  587. border-color: $elegant-purple-main-color;
  588. }
  589. .taste-red-border {
  590. border-color: $taste-red-main-color;
  591. }
  592. .fresh-green-border {
  593. border-color: $fresh-green-main-color;
  594. }
  595. .business-blue-border {
  596. border-color: $business-blue-main-color;
  597. }
  598. .pure-black-border {
  599. border-color: $pure-black-main-color;
  600. }
  601. .passionate-red-border {
  602. border-color: $passionate-red-main-color;
  603. }
  604. </style>