cash.vue 19 KB

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