cash.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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" :class="getTheme + '-m-text ' + getTheme">¥</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" :class="getTheme + '-m-back ' + getTheme">提交申请</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" :class="getTheme + '-m-text ' + getTheme">确认</view>
  58. <view @click="warningInfo = false" v-if="warningInfo" class="close-button" :class="getTheme + '-m-text ' + getTheme">确认</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. title: '加载中...'
  188. });
  189. let para = {
  190. model: 'community',
  191. price: that.moneyInput,
  192. type: 'auto'
  193. };
  194. if (that.mark_num == 4) {
  195. para.type = 'balance';
  196. } else if (that.mark_num == 0) {
  197. para.type = 'auto';
  198. } else {
  199. para.name = that.name;
  200. para.mobile = that.mobile;
  201. if (that.mark_num == 1) {
  202. para.type = 'wechat';
  203. }
  204. if (that.mark_num == 2) {
  205. para.type = 'alipay';
  206. }
  207. if (that.mark_num == 3) {
  208. para.type = 'bank';
  209. para.bank_name = that.bank_name;
  210. }
  211. }
  212. that.$request({
  213. url: that.$api.finance.cash,
  214. data: para,
  215. method: 'post'
  216. }).then(response=>{
  217. uni.hideLoading();
  218. that.loading = false;
  219. if(response.code == 0) {
  220. that.submitOver = true;
  221. }else {
  222. that.warningInfo = response.msg;
  223. }
  224. }).catch(response => {
  225. that.loading = false;
  226. uni.hideLoading();
  227. });
  228. },
  229. toDetail() {
  230. this.submitOver = false;
  231. uni.redirectTo({
  232. url: '/plugins/community/cash-detail/cash-detail'
  233. });
  234. },
  235. getStatus() {
  236. let that = this;
  237. that.$request({
  238. url: that.$api.community.index,
  239. }).then(response=>{
  240. that.$hideLoading();
  241. if(response.code == 0) {
  242. that.community = response.data.middleman;
  243. }else {
  244. uni.showToast({
  245. title: response.msg,
  246. icon: 'none',
  247. duration: 1000
  248. });
  249. }
  250. }).catch(response => {
  251. that.$hideLoading();
  252. });
  253. },
  254. setting() {
  255. let that = this;
  256. that.$request({
  257. url: that.$api.finance.config,
  258. data: {
  259. model: 'community'
  260. },
  261. method: 'post'
  262. }).then(response=>{
  263. that.$hideLoading();
  264. that.getStatus();
  265. if(response.code == 0) {
  266. that.config = response.data.config;
  267. that.template_message = response.data.template_message;
  268. for (let i = 0; i < that.config.pay_type.length; i++) {
  269. switch (that.config.pay_type[i]) {
  270. case "auto":
  271. that.pay_type.auto = true;
  272. //that.mark_num = 0;
  273. break;
  274. case "alipay":
  275. that.pay_type.alipay = true;
  276. //that.mark_num = 2;
  277. break;
  278. case "wechat":
  279. that.pay_type.wechat = true;
  280. //that.mark_num = 1;
  281. break;
  282. case "balance":
  283. that.pay_type.balance = true;
  284. //that.mark_num = 4;
  285. break;
  286. case "bank":
  287. that.pay_type.bank = true;
  288. //that.mark_num = 3;
  289. break;
  290. }
  291. }
  292. }else {
  293. uni.showToast({
  294. title: response.msg,
  295. icon: 'none',
  296. duration: 1000
  297. });
  298. }
  299. }).catch(response => {
  300. that.$hideLoading();
  301. });
  302. },
  303. },
  304. onLoad(options) {
  305. let that = this;
  306. if (options.money > 0) {
  307. that.money = options.money;
  308. };
  309. that.setting();
  310. }
  311. }
  312. </script>
  313. <style scoped lang="scss">
  314. .cash-type {
  315. height: #{120rpx};
  316. background: white;
  317. color: #353535;
  318. font-size: #{32rpx};
  319. padding: 0 #{24rpx};
  320. margin-top: #{24rpx};
  321. .arrow-image {
  322. width: #{12rpx};
  323. height: #{24rpx};
  324. display: block;
  325. margin-left: #{12rpx};
  326. }
  327. }
  328. .cash-info {
  329. margin-top: #{20rpx};
  330. }
  331. .info {
  332. background-color: #fff;
  333. padding: #{32rpx} #{24rpx};
  334. border-bottom: #{1rpx} solid #e2e2e2;
  335. color: #353535;
  336. }
  337. .info.input-money {
  338. border-bottom: 0;
  339. }
  340. .info.cash-type {
  341. margin: #{20rpx} 0;
  342. padding: #{32rpx} 0;
  343. }
  344. .last {
  345. font-size: #{40rpx};
  346. margin-bottom: #{15rpx};
  347. }
  348. .last-info {
  349. font-size: #{24rpx};
  350. color: #666;
  351. }
  352. .last-info view {
  353. float: left;
  354. height: #{44rpx};
  355. line-height: #{44rpx};
  356. }
  357. .last-info .show-tip {
  358. color: #666;
  359. display: inline-block;
  360. background-color: #fff;
  361. font-size: #{24rpx};
  362. padding: 0 #{12rpx};
  363. height: #{44rpx};
  364. line-height: #{44rpx};
  365. border-radius: #{22rpx};
  366. border: #{1rpx} solid #e2e2e2;
  367. }
  368. .last-info button::after {
  369. border: 0;
  370. }
  371. .price {
  372. height: #{80rpx};
  373. line-height: #{80rpx};
  374. font-size: #{46rpx};
  375. position: absolute;
  376. left: 0;
  377. top: 0;
  378. }
  379. .all {
  380. color: #666;
  381. }
  382. .input {
  383. font-size: #{36rpx};
  384. height: #{80rpx};
  385. line-height: #{80rpx};
  386. width: 70%;
  387. padding-left: #{50rpx};
  388. position: relative;
  389. }
  390. .input input {
  391. height: #{80rpx};
  392. line-height: #{80rpx};
  393. }
  394. .about {
  395. font-size: #{24rpx};
  396. padding: #{32rpx} #{24rpx} #{12rpx};
  397. color: #666;
  398. }
  399. .icon {
  400. height: #{40rpx};
  401. width: #{40rpx};
  402. margin-right: #{16rpx};
  403. display: flex;
  404. justify-content: center;
  405. }
  406. .mode-item {
  407. width: #{200rpx};
  408. border: #{1rpx} solid #999;
  409. text-align: center;
  410. padding: 0 #{24rpx};
  411. height: #{66rpx};
  412. line-height: #{66rpx};
  413. border-radius: #{33rpx};
  414. display: flex;
  415. align-items: center;
  416. margin: #{10rpx} #{24rpx};
  417. font-size: #{30rpx};
  418. position: relative;
  419. }
  420. .mode-title {
  421. margin-bottom: #{25rpx};
  422. padding-left: #{24rpx};
  423. font-size: #{34rpx};
  424. }
  425. .enter {
  426. color: #353535;
  427. float: left;
  428. width: #{100rpx};
  429. height: #{56rpx};
  430. line-height: #{56rpx};
  431. font-size: #{32rpx};
  432. }
  433. .content {
  434. height: #{120rpx};
  435. }
  436. .info-input {
  437. font-size: #{32rpx};
  438. height: #{56rpx};
  439. padding: 0 #{32rpx};
  440. }
  441. .on-active {
  442. height: #{32rpx};
  443. width: #{32rpx};
  444. position: absolute;
  445. right: 0;
  446. bottom: 0;
  447. }
  448. .submit {
  449. margin-top: #{40rpx};
  450. }
  451. .submit button {
  452. height: #{80rpx};
  453. border-radius: #{40rpx};
  454. line-height: #{80rpx};
  455. width: 90%;
  456. margin: 0 auto;
  457. color: #fff;
  458. font-size: #{32rpx};
  459. }
  460. .bg {
  461. position: fixed;
  462. top: 0;
  463. left: 0;
  464. height: 100%;
  465. width: 100%;
  466. background-color: rgba(0, 0, 0, .3);
  467. z-index: 10;
  468. }
  469. .dialog {
  470. position: fixed;
  471. top: #{400rpx};
  472. left: 0;
  473. right: 0;
  474. height: #{300rpx};
  475. width: #{640rpx};
  476. margin: 0 auto;
  477. z-index: 21;
  478. background-color: #fff;
  479. border-radius: 10px;
  480. text-align: center;
  481. font-size: #{30rpx};
  482. }
  483. .dialog-title {
  484. margin: #{40rpx} auto #{35rpx};
  485. }
  486. .dialog-btn {
  487. height: #{88rpx};
  488. width: #{640rpx};
  489. border-top: #{1rpx} solid #e2e2e2;
  490. line-height: #{88rpx};
  491. position: absolute;
  492. bottom: 0;
  493. left: 0;
  494. }
  495. .dialog-close,.dialog-submit {
  496. width: 50%;
  497. }
  498. .line {
  499. height: #{44rpx};
  500. margin-top: #{22rpx};
  501. width: #{1rpx};
  502. background-color: #e2e2e2;
  503. }
  504. .dialog-submit {
  505. color: #ff4544;
  506. }
  507. .bg {
  508. position: fixed;
  509. top: 0;
  510. left: 0;
  511. right: 0;
  512. height: 100%;
  513. width: 100%;
  514. z-index: 20;
  515. background-color: rgba(0, 0, 0, 0.3);
  516. }
  517. .dialog {
  518. position: fixed;
  519. top: #{400rpx};
  520. left: 0;
  521. right: 0;
  522. height: #{300rpx};
  523. width: #{640rpx};
  524. margin: 0 auto;
  525. z-index: 21;
  526. background-color: #fff;
  527. border-radius: 10px;
  528. text-align: center;
  529. font-size: #{30rpx};
  530. }
  531. .close-button {
  532. height: #{88rpx};
  533. width: #{640rpx};
  534. border-top: #{1rpx} solid #e2e2e2;
  535. line-height: #{88rpx};
  536. position: absolute;
  537. bottom: 0;
  538. left: 0;
  539. }
  540. .dialog-title {
  541. margin: #{40rpx} auto #{35rpx};
  542. }
  543. // 经典红
  544. $classic-red-main-color: #FE3666;
  545. $classic-red-secondary-color: #A494F6;
  546. // 活力黄
  547. $vibrant-yellow-main-color: #fcc600;
  548. $vibrant-yellow-secondary-color: #555555;
  549. // 浪漫粉
  550. $romantic-powder-main-color: #ff547b;
  551. $romantic-powder-secondary-color: #ffe6e8;
  552. // 流光金
  553. $streamer-gold-main-color: #ddb766;
  554. $streamer-gold-secondary-color: #f0ebd8;
  555. // 优雅紫
  556. $elegant-purple-main-color: #7783ea;
  557. $elegant-purple-secondary-color: #e9ebff;
  558. // 品味红
  559. $taste-red-main-color: #ff4544;
  560. $taste-red-secondary-color: #555555;
  561. // 清醒绿
  562. $fresh-green-main-color: #63be72;
  563. $fresh-green-secondary-color: #e1f4e3;
  564. // 商务蓝
  565. $business-blue-main-color: #4a90e2;
  566. $business-blue-secondary-color: #dbe9f9;
  567. // 纯粹黑
  568. $pure-black-main-color: #333333;
  569. $pure-black-secondary-color: #dedede;
  570. // 热情红
  571. $passionate-red-main-color: #ff4544;
  572. $passionate-red-secondary-color: #ffdada;
  573. .classic-red-border {
  574. border-color: $classic-red-main-color;
  575. }
  576. .vibrant-yellow-border {
  577. border-color: $vibrant-yellow-main-color;
  578. }
  579. .romantic-powder-border {
  580. border-color: $romantic-powder-main-color;
  581. }
  582. .streamer-gold-border {
  583. border-color: $streamer-gold-main-color;
  584. }
  585. .elegant-purple-border {
  586. border-color: $elegant-purple-main-color;
  587. }
  588. .taste-red-border {
  589. border-color: $taste-red-main-color;
  590. }
  591. .fresh-green-border {
  592. border-color: $fresh-green-main-color;
  593. }
  594. .business-blue-border {
  595. border-color: $business-blue-main-color;
  596. }
  597. .pure-black-border {
  598. border-color: $pure-black-main-color;
  599. }
  600. .passionate-red-border {
  601. border-color: $passionate-red-main-color;
  602. }
  603. </style>