cash.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <app-layout>
  3. <view class="info">
  4. <view class="last">可提现金额:¥{{region.total_bonus ? region.total_bonus : '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">¥</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-style="color:#cdcdcd" 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-style="color:#cdcdcd" 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==1" placeholder-style="color:#cdcdcd" placeholder="请输入正确的微信帐号"></input>
  44. <input class="info-input" v-model="mobile" v-if="mark_num==2" placeholder-style="color:#cdcdcd" placeholder="请输入正确的支付宝帐号"></input>
  45. <input class="info-input" v-model="mobile" v-if="mark_num==3" type="number"
  46. placeholder-style="color:#cdcdcd" placeholder="请输入正确的银行卡帐号"></input>
  47. </view>
  48. </view>
  49. <view class="submit">
  50. <button @click="subscribe" class="red-background">提交申请</button>
  51. </view>
  52. </view>
  53. <view class="bg" v-if="submitOver || warningInfo">
  54. <view class="dialog">
  55. <view class="dialog-title">提示</view>
  56. <view v-if="submitOver">提现申请提交成功</view>
  57. <view v-if="warningInfo">{{warningInfo}}</view>
  58. <view @click="toDetail" v-if="submitOver" class="close-button">确认</view>
  59. <view @click="warningInfo = false" v-if="warningInfo" class="close-button">确认</view>
  60. </view>
  61. </view>
  62. <app-cash-model
  63. :is-auto="pay_type.auto"
  64. :is-wx="pay_type.wechat"
  65. :is-alipay="pay_type.alipay"
  66. :is-bank="pay_type.bank"
  67. :is-balance="pay_type.balance"
  68. :pay-type="cashType"
  69. @change="payTypeChange"
  70. v-model="cashTypeModel"
  71. ></app-cash-model>
  72. </app-layout>
  73. </template>
  74. <script>
  75. import {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. region: {},
  84. moneyInput: '',
  85. pay_type: {
  86. auto: false,
  87. alipay: false,
  88. wechat: false,
  89. bank: false,
  90. balance: false,
  91. },
  92. loading: false,
  93. warningInfo: '',
  94. submitOver: false,
  95. config: [],
  96. name: '',
  97. mobile: '',
  98. template_message: [],
  99. getMoney: null,
  100. cashType: '',
  101. }
  102. },
  103. components: {appCashModel,},
  104. computed: {
  105. ...mapState({
  106. mall: state => state.mallConfig.mall,
  107. }),
  108. cashName() {
  109. switch (this.cashType) {
  110. case 'auto':
  111. // #ifdef MP-WEIXIN
  112. return '微信零钱';
  113. // #endif
  114. // #ifdef MP-ALIPAY
  115. return '支付宝余额';
  116. // #endif
  117. // #ifndef MP-WEIXIN || MP-ALIPAY
  118. return '自动';
  119. // #endif
  120. case 'wx':
  121. return '微信线下打款';
  122. case 'alipay':
  123. return '支付宝线下打款';
  124. case 'bank':
  125. return '银联线下打款';
  126. case 'balance':
  127. return '商城余额';
  128. default:
  129. return;
  130. break;
  131. }
  132. },
  133. },
  134. methods: {
  135. payTypeChange(value) {
  136. this.cashType = value;
  137. switch (value) {
  138. case 'auto':
  139. this.mark_num = 0;
  140. break;
  141. case 'wx':
  142. this.mark_num = 1;
  143. break;
  144. case 'alipay':
  145. this.mark_num = 2;
  146. break;
  147. case 'bank':
  148. this.mark_num = 3;
  149. break;
  150. case 'balance':
  151. this.mark_num = 4;
  152. break;
  153. default:
  154. this.mark_num = -1;
  155. break;
  156. }
  157. },
  158. subscribe() {
  159. if (this.loading) {
  160. return false
  161. }
  162. if (this.submitOver || this.warningInfo) {
  163. return false
  164. }
  165. if (this.moneyInput > 0) {
  166. if (this.mark_num == -1) {
  167. uni.showToast({title: '请选择提现方式', icon: 'none'});
  168. return;
  169. }
  170. this.loading = true;
  171. this.$subscribe(this.template_message).then(res => {
  172. this.submit();
  173. }).catch(res => {
  174. this.submit();
  175. });
  176. }else {
  177. this.warningInfo = '请输入正确的提现金额'
  178. }
  179. },
  180. submit() {
  181. let that = this;
  182. uni.showLoading({
  183. mask: true,
  184. title: '加载中...'
  185. });
  186. let para = {
  187. price: that.moneyInput,
  188. type: 'auto'
  189. };
  190. if (that.mark_num == 4) {
  191. para.type = 'balance';
  192. } else if (that.mark_num == 0) {
  193. para.type = 'auto';
  194. } else {
  195. para.name = that.name;
  196. para.mobile = that.mobile;
  197. if (that.mark_num == 1) {
  198. para.type = 'wechat';
  199. }
  200. if (that.mark_num == 2) {
  201. para.type = 'alipay';
  202. }
  203. if (that.mark_num == 3) {
  204. para.type = 'bank';
  205. para.bank_name = that.bank_name;
  206. }
  207. }
  208. that.$request({
  209. url: that.$api.region.cash,
  210. data: para,
  211. method: 'post'
  212. }).then(response=>{
  213. uni.hideLoading();
  214. that.loading = false;
  215. if(response.code == 0) {
  216. that.submitOver = true;
  217. }else {
  218. that.warningInfo = response.msg;
  219. }
  220. }).catch(response => {
  221. that.loading = false;
  222. uni.hideLoading();
  223. });
  224. },
  225. toDetail() {
  226. this.submitOver = false;
  227. uni.redirectTo({
  228. url: '/plugins/region/cash-detail/cash-detail'
  229. });
  230. },
  231. getStatus() {
  232. let that = this;
  233. that.$request({
  234. url: that.$api.region.status,
  235. }).then(response=>{
  236. that.$hideLoading();
  237. if(response.code == 0) {
  238. that.region = response.data.region;
  239. }else {
  240. uni.showToast({
  241. title: response.msg,
  242. icon: 'none',
  243. duration: 1000
  244. });
  245. }
  246. }).catch(response => {
  247. that.$hideLoading();
  248. });
  249. },
  250. setting() {
  251. let that = this;
  252. that.$request({
  253. url: that.$api.region.setting,
  254. }).then(response=>{
  255. that.$hideLoading();
  256. that.getStatus();
  257. if(response.code == 0) {
  258. that.config = response.data;
  259. that.template_message = response.data.template_message_withdraw;
  260. for (let i = 0; i < that.config.pay_type.length; i++) {
  261. switch (that.config.pay_type[i]) {
  262. case "auto":
  263. that.pay_type.auto = true;
  264. //that.mark_num = 0;
  265. break;
  266. case "alipay":
  267. that.pay_type.alipay = true;
  268. //that.mark_num = 2;
  269. break;
  270. case "wechat":
  271. that.pay_type.wechat = true;
  272. //that.mark_num = 1;
  273. break;
  274. case "balance":
  275. that.pay_type.balance = true;
  276. //that.mark_num = 4;
  277. break;
  278. case "bank":
  279. that.pay_type.bank = true;
  280. //that.mark_num = 3;
  281. break;
  282. }
  283. }
  284. }else {
  285. uni.showToast({
  286. title: response.msg,
  287. icon: 'none',
  288. duration: 1000
  289. });
  290. }
  291. }).catch(response => {
  292. that.$hideLoading();
  293. });
  294. },
  295. },
  296. onLoad(options) { this.$commonLoad.onload(options);
  297. let that = this;
  298. if (options.money > 0) {
  299. that.money = options.money;
  300. };
  301. that.setting();
  302. }
  303. }
  304. </script>
  305. <style scoped lang="scss">
  306. .cash-type {
  307. height: #{120rpx};
  308. background: white;
  309. color: #353535;
  310. font-size: #{32rpx};
  311. padding: 0 #{24rpx};
  312. margin-top: #{24rpx};
  313. .arrow-image {
  314. width: #{12rpx};
  315. height: #{24rpx};
  316. display: block;
  317. margin-left: #{12rpx};
  318. }
  319. }
  320. .cash-info {
  321. margin-top: #{20rpx};
  322. }
  323. .info {
  324. background-color: #fff;
  325. padding: #{32rpx} #{24rpx};
  326. border-bottom: #{1rpx} solid #e2e2e2;
  327. color: #353535;
  328. }
  329. .info.input-money {
  330. border-bottom: 0;
  331. }
  332. .info.cash-type {
  333. margin: #{20rpx} 0;
  334. padding: #{32rpx} 0;
  335. }
  336. .last {
  337. font-size: #{40rpx};
  338. margin-bottom: #{15rpx};
  339. }
  340. .last-info {
  341. font-size: #{24rpx};
  342. color: #666;
  343. }
  344. .last-info view {
  345. float: left;
  346. height: #{44rpx};
  347. line-height: #{44rpx};
  348. }
  349. .last-info .show-tip {
  350. color: #666;
  351. display: inline-block;
  352. background-color: #fff;
  353. font-size: #{24rpx};
  354. padding: 0 #{12rpx};
  355. height: #{44rpx};
  356. line-height: #{44rpx};
  357. border-radius: #{22rpx};
  358. border: #{1rpx} solid #e2e2e2;
  359. }
  360. .last-info button::after {
  361. border: 0;
  362. }
  363. .price {
  364. height: #{80rpx};
  365. line-height: #{80rpx};
  366. font-size: #{46rpx};
  367. position: absolute;
  368. left: 0;
  369. top: 0;
  370. color: #ff4544;
  371. }
  372. .all {
  373. color: #666;
  374. }
  375. .input {
  376. font-size: #{36rpx};
  377. height: #{80rpx};
  378. line-height: #{80rpx};
  379. width: 70%;
  380. padding-left: #{50rpx};
  381. position: relative;
  382. }
  383. .input input {
  384. height: #{80rpx};
  385. line-height: #{80rpx};
  386. }
  387. .about {
  388. font-size: #{26rpx};
  389. padding: #{32rpx} #{24rpx} #{12rpx};
  390. color: #999;
  391. }
  392. .icon {
  393. height: #{40rpx};
  394. width: #{40rpx};
  395. margin-right: #{16rpx};
  396. display: flex;
  397. justify-content: center;
  398. }
  399. .mode-item {
  400. width: #{200rpx};
  401. border: #{1rpx} solid #999;
  402. text-align: center;
  403. padding: 0 #{24rpx};
  404. height: #{66rpx};
  405. line-height: #{66rpx};
  406. border-radius: #{33rpx};
  407. display: flex;
  408. align-items: center;
  409. margin: #{10rpx} #{24rpx};
  410. font-size: #{30rpx};
  411. position: relative;
  412. }
  413. .mode-title {
  414. margin-bottom: #{25rpx};
  415. padding-left: #{24rpx};
  416. font-size: #{34rpx};
  417. }
  418. .enter {
  419. color: #353535;
  420. float: left;
  421. width: #{100rpx};
  422. height: #{56rpx};
  423. line-height: #{56rpx};
  424. font-size: #{32rpx};
  425. }
  426. .content {
  427. height: #{120rpx};
  428. }
  429. .info-input {
  430. font-size: #{32rpx};
  431. height: #{56rpx};
  432. padding: 0 #{32rpx};
  433. }
  434. .on-active {
  435. height: #{32rpx};
  436. width: #{32rpx};
  437. position: absolute;
  438. right: 0;
  439. bottom: 0;
  440. }
  441. .submit {
  442. margin-top: #{40rpx};
  443. }
  444. .submit button {
  445. height: #{80rpx};
  446. border-radius: #{40rpx};
  447. line-height: #{80rpx};
  448. width: 90%;
  449. margin: 0 auto;
  450. color: #fff;
  451. font-size: #{32rpx};
  452. background-color: #ff4544;
  453. }
  454. .bg {
  455. position: fixed;
  456. top: 0;
  457. left: 0;
  458. height: 100%;
  459. width: 100%;
  460. background-color: rgba(0, 0, 0, .3);
  461. z-index: 10;
  462. }
  463. .dialog {
  464. position: fixed;
  465. top: #{400rpx};
  466. left: 0;
  467. right: 0;
  468. height: #{300rpx};
  469. width: #{640rpx};
  470. margin: 0 auto;
  471. z-index: 21;
  472. background-color: #fff;
  473. border-radius: 10px;
  474. text-align: center;
  475. font-size: #{30rpx};
  476. }
  477. .dialog-title {
  478. margin: #{40rpx} auto #{35rpx};
  479. }
  480. .dialog-btn {
  481. height: #{88rpx};
  482. width: #{640rpx};
  483. border-top: #{1rpx} solid #e2e2e2;
  484. line-height: #{88rpx};
  485. position: absolute;
  486. bottom: 0;
  487. left: 0;
  488. }
  489. .dialog-close,.dialog-submit {
  490. width: 50%;
  491. }
  492. .line {
  493. height: #{44rpx};
  494. margin-top: #{22rpx};
  495. width: #{1rpx};
  496. background-color: #e2e2e2;
  497. }
  498. .dialog-submit {
  499. color: #ff4544;
  500. }
  501. .bg {
  502. position: fixed;
  503. top: 0;
  504. left: 0;
  505. right: 0;
  506. height: 100%;
  507. width: 100%;
  508. z-index: 20;
  509. background-color: rgba(0, 0, 0, 0.3);
  510. }
  511. .dialog {
  512. position: fixed;
  513. top: #{400rpx};
  514. left: 0;
  515. right: 0;
  516. height: #{300rpx};
  517. width: #{640rpx};
  518. margin: 0 auto;
  519. z-index: 21;
  520. background-color: #fff;
  521. border-radius: 10px;
  522. text-align: center;
  523. font-size: #{30rpx};
  524. }
  525. .close-button {
  526. height: #{88rpx};
  527. width: #{640rpx};
  528. border-top: #{1rpx} solid #e2e2e2;
  529. line-height: #{88rpx};
  530. color: #ff4544;
  531. position: absolute;
  532. bottom: 0;
  533. left: 0;
  534. }
  535. .dialog-title {
  536. margin: #{40rpx} auto #{35rpx};
  537. }
  538. </style>