Withdrawal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <!-- 申请提现 -->
  3. <view class="Withdrawal">
  4. <u-alert-tips v-if="!distributionSet.payType || !distributionSet.payType.length" type="warning" title="抱歉,管理员未配置提现方式" show-icon></u-alert-tips>
  5. <view class="w-view w-channel clearfix" @click="openPay">
  6. <view class="float_left">转出方式</view>
  7. <view class="float_right">
  8. <text v-if="cash_out_num">{{ cash_out_num }}</text>
  9. <text v-else class="w-input-place">请选择</text>
  10. <text class="ibonfont ibonjinru"></text>
  11. </view>
  12. </view>
  13. <view class="w-view clearfix" v-if="cash_out_num && cash_out_num !== '微信钱包'">
  14. <view class="float_left">姓名</view>
  15. <view class="float_right">
  16. <input type="text" placeholder-class="w-input-place" placeholder="请输入真实姓名" class="w-input" v-model="cash_out_form.accountContent.name" />
  17. </view>
  18. </view>
  19. <block v-if="cash_out_num === '支付宝'">
  20. <view class="w-view clearfix">
  21. <view class="float_left">支付宝账号</view>
  22. <view class="float_right">
  23. <input placeholder-class="w-input-place" class="w-input" placeholder="请输入支付宝账号" type="text" v-model="cash_out_form.accountContent.account" />
  24. </view>
  25. </view>
  26. </block>
  27. <block v-if="cash_out_num === '银行卡'">
  28. <picker @change="bindBankChange" :value="bank_index" range-key="cardNum" :range="bank_list">
  29. <view class="w-view clearfix">
  30. <view class="float_left">选择银行</view>
  31. <view class="float_right clearfix" style="width: 480rpx;">
  32. <text class="float_left" v-if="cash_out_form.accountContent.bankName">{{ cash_out_form.accountContent.bankName }}</text>
  33. <text v-else class="w-input-place float_left">请选择</text>
  34. <text class="ibonfont ibonjinru float_right" style="margin-top: 4rpx;"></text>
  35. </view>
  36. </view>
  37. </picker>
  38. <view class="w-view clearfix">
  39. <view class="float_left">银行卡号</view>
  40. <view class="float_right">
  41. <input placeholder-class="w-input-place" placeholder="请输入银行卡号" class="w-input" type="text" v-model="cash_out_form.accountContent.account" />
  42. </view>
  43. </view>
  44. <view class="w-view clearfix">
  45. <view class="float_left">确认卡号</view>
  46. <view class="float_right"><input placeholder-class="w-input-place" placeholder="请再次输入银行卡号" class="w-input" type="text" v-model="agin_card_num" /></view>
  47. </view>
  48. </block>
  49. <view class="w-view w-money">
  50. <view class="w-tit">
  51. <text>{{ text_set.withdrawal || '提现' }}金额</text>
  52. <text class="w-tit-r">最少{{ text_set.withdrawal || '提现' }}金额{{ distributionSet.quota }}元</text>
  53. </view>
  54. <view class="w-money-input-view">
  55. <text class="rmb-icon">¥</text>
  56. <input class="w-money-input" type="text" v-model="cash_out_form.money" />
  57. </view>
  58. </view>
  59. <view class="clearfix w-tip">
  60. <text class="float_left">{{ text_set.commission_w || '可提现佣金' }}:¥{{ cash_out_form.nowMoney || 0 }}</text>
  61. <text class="float_right primary-color" @click="allWitjdrawal">全部{{ text_set.withdrawal || '提现' }}</text>
  62. </view>
  63. <view class="w-btn" @click="withdrawalsAdd" :class="[cash_out_form.money >= Number(distributionSet.quota) ? 'w-btn-on' : '']">{{ text_set.withdrawal || '提现' }}</view>
  64. <u-popup mode="bottom" v-model="payPop" :border-radius="12">
  65. <view class="pay-pop-view">
  66. <view class="pay-sel-title clearfix">
  67. <text class="float_left">{{ text_set.withdrawal || '提现' }}方式</text>
  68. <text class="float_right ibonfont ibonguanbi" @click="closePayPop"></text>
  69. </view>
  70. <view class="pay-ul">
  71. <view class="pay-li" @click="paymentChange(4)" v-if="distributionSet.payType.indexOf(4) > -1">
  72. <text class="ibonfont ibonweixinzhifu"></text>
  73. <view class="pay-name clearfix">
  74. <text class="float_left">微信钱包</text>
  75. <text class="float_right ibonfont primary-color" :class="[payType === 4 ? 'ibonxuanze1' : 'ibonweixuanze']"></text>
  76. </view>
  77. </view>
  78. <block v-if="distributionSet.payType.indexOf(5) > -1">
  79. <!-- <view class="pay-tip">手动打款</view> -->
  80. <!-- 手动打款 -->
  81. <view class="pay-li" @click="withdrawTypeChange(4)" v-if="distributionSet.withdrawType.indexOf(4) > -1">
  82. <text class="ibonfont ibonumidd17"></text>
  83. <view class="pay-name clearfix">
  84. <text class="float_left">支付宝</text>
  85. <text
  86. class="float_right ibonfont primary-color"
  87. :class="[payType === 5 && withdrawType === 4 ? 'ibonxuanze1' : 'ibonweixuanze']"
  88. ></text>
  89. </view>
  90. </view>
  91. <view class="pay-li" @click="withdrawTypeChange(5)" v-if="distributionSet.withdrawType.indexOf(5) > -1">
  92. <text class="ibonfont ibonyinhangqia"></text>
  93. <view class="pay-name clearfix">
  94. <text class="float_left">银行卡</text>
  95. <text
  96. class="float_right ibonfont primary-color"
  97. :class="[payType === 5 && withdrawType === 5 ? 'ibonxuanze1' : 'ibonweixuanze']"
  98. ></text>
  99. </view>
  100. </view>
  101. </block>
  102. </view>
  103. </view>
  104. </u-popup>
  105. </view>
  106. </template>
  107. <script>
  108. import { getOpenid } from '@/access/common.js';
  109. export default {
  110. data() {
  111. return {
  112. isLoding: false,
  113. payPop: false,
  114. cash_out_form: {
  115. businessmanId: '', // 提现者分销商id
  116. type: 1, //1 微信钱包;2,支付宝;3,银行卡
  117. accountContent: {
  118. name: '', // 提现者姓名
  119. account: '', // 提现账号
  120. bankName: '' //银行名称
  121. },
  122. money: 0, // 输入提现金额
  123. nowMoney: 0 // 当前实际金额
  124. },
  125. bank_list: [], // 银行卡列表
  126. bank_index: 0, //选择银行卡下标
  127. text_set: {}, //文字设置
  128. cash_out_num: '', // 转出方式
  129. agin_card_num: '', //确认卡号
  130. payType: 4, // 自动提现
  131. distributionSet: {
  132. quota: 0,
  133. // 分销基础设置
  134. payType: [],
  135. withdrawType: []
  136. },
  137. cardNum: '', //银行卡
  138. withdrawType: 4 //手动提现 4:支付宝 5:银行卡',
  139. };
  140. },
  141. onLoad(options) {
  142. this.text_set = this.$store.state.distributionTextSet;
  143. if (this.text_set.commission_r) {
  144. uni.setNavigationBarTitle({
  145. title: '申请' + (this.text_set.withdrawal || '提现')
  146. });
  147. }
  148. // 判断申请方式
  149. this.distributionSet = this.$store.state.distributionSet;
  150. if (this.distributionSet.payType && this.distributionSet.payType.length) {
  151. this.payType = this.distributionSet.payType[0];
  152. if (this.payType === 5) {
  153. if (this.distributionSet.withdrawType && this.distributionSet.withdrawType.length) {
  154. this.withdrawType = this.distributionSet.withdrawType[0];
  155. this.cash_out_num = this.withdrawType === 4 ? '支付宝' : this.withdrawType === 5 ? '银行卡' : '';
  156. }
  157. } else {
  158. this.cash_out_num = '微信钱包';
  159. }
  160. }
  161. // 可提现金额
  162. if (options.balance) {
  163. this.cash_out_form.nowMoney = options.balance || 0;
  164. }
  165. // 银行卡列表
  166. if (this.distributionSet.withdrawInfo) {
  167. this.bank_list = this.distributionSet.withdrawInfo;
  168. }
  169. // 获取提现者分销商id
  170. this.cash_out_form.businessmanId = options.id;
  171. // 获取OPenID
  172. this.cash_out_form.accountContent.account = getOpenid();
  173. },
  174. methods: {
  175. // 申请提现
  176. withdrawalsAdd() {
  177. if (this.cash_out_form.type === 2) {
  178. if (!this.cash_out_form.accountContent.name) {
  179. this.$api.msg('请输入您的真实姓名');
  180. return;
  181. }
  182. if (!this.cash_out_form.accountContent.account) {
  183. this.$api.msg('请输入您的支付宝账号');
  184. return;
  185. }
  186. }
  187. if (this.cash_out_form.type === 3) {
  188. if (!this.cash_out_form.accountContent.name) {
  189. this.$api.msg('请输入您的真实姓名');
  190. return;
  191. }
  192. if (!this.cash_out_form.accountContent.bankName) {
  193. this.$api.msg('请选择银行名称');
  194. return;
  195. }
  196. if (!this.cash_out_form.accountContent.account) {
  197. this.$api.msg('请输入您的银行账号');
  198. return;
  199. }
  200. if (!this.agin_card_num) {
  201. this.$api.msg('请再次输入您的银行账号');
  202. return;
  203. }
  204. if (this.agin_card_num !== this.cash_out_form.accountContent.account) {
  205. this.$api.msg('确认卡号与银行卡号不一致');
  206. return;
  207. }
  208. }
  209. if (!this.cash_out_form.money) {
  210. this.$api.msg('请输入要提现金额');
  211. return;
  212. }
  213. if (this.cash_out_form.money < Number(this.distributionSet.quota)) {
  214. this.$api.msg('最低提现金额为' + this.distributionSet.quota + '元');
  215. return;
  216. }
  217. if (this.cash_out_form.money > this.cash_out_form.nowMoney) {
  218. this.$api.msg('可提现金额不足');
  219. return;
  220. }
  221. this.$u.api.WithdrawalsAdd(this.cash_out_form).then(res=>{
  222. this.$api.msg('提现申请成功');
  223. this.goPage('/pagesT/Distribution/Application?id=' + res.data, 'redirectTo');
  224. });
  225. },
  226. // 全部提现按钮点击事件
  227. allWitjdrawal() {
  228. this.cash_out_form.money = this.cash_out_form.nowMoney;
  229. },
  230. // 选择银行change事件
  231. bindBankChange(e) {
  232. const index = e.target.value;
  233. this.bank_index = index;
  234. this.cash_out_form.accountContent.bankName = this.bank_list[index].cardNum;
  235. },
  236. // 自动提现
  237. paymentChange(val) {
  238. this.payType = val;
  239. switch (val) {
  240. case 4:
  241. this.cash_out_num = '微信钱包';
  242. this.cash_out_form.type = 1;
  243. break;
  244. case 5:
  245. this.cash_out_num = '手动提现';
  246. break;
  247. }
  248. this.closePayPop();
  249. },
  250. // 手动提现
  251. withdrawTypeChange(val) {
  252. this.payType = 5;
  253. this.withdrawType = val;
  254. switch (val) {
  255. case 4:
  256. this.cash_out_num = '支付宝';
  257. this.cash_out_form.type = 2;
  258. break;
  259. case 5:
  260. this.cash_out_num = '银行卡';
  261. this.cash_out_form.type = 3;
  262. break;
  263. }
  264. this.closePayPop();
  265. },
  266. closePayPop() {
  267. this.payPop=false
  268. this.cash_out_form.accountContent.account = '';
  269. this.cash_out_form.accountContent.bankName = '';
  270. },
  271. openPay() {
  272. if (!this.distributionSet.payType || !this.distributionSet.payType.length) {
  273. this.$api.msg('抱歉,管理员未配置提现方式');
  274. return;
  275. }
  276. this.payPop=true
  277. }
  278. }
  279. };
  280. </script>
  281. <style lang="scss">
  282. body {
  283. background: $page-color-base;
  284. }
  285. .Withdrawal {
  286. width: 702upx;
  287. margin: 20upx auto;
  288. padding: 0 24upx 50upx;
  289. background-color: #ffffff;
  290. font-size: 28upx;
  291. .w-view {
  292. border-bottom: 1px solid #f5f5f5;
  293. padding: 24upx 0;
  294. .ibonjinru {
  295. font-size: 28upx;
  296. color: #666;
  297. height: 32upx;
  298. margin-left: 10upx;
  299. }
  300. .w-input {
  301. width: 480rpx;
  302. }
  303. .w-input-place {
  304. color: #b0b3bf;
  305. font-size: 26upx;
  306. }
  307. .w-tit {
  308. .w-tit-r {
  309. margin-left: 10upx;
  310. font-size: 24upx;
  311. color: #b0b3bf;
  312. }
  313. }
  314. }
  315. .w-money {
  316. .w-money-input-view {
  317. padding-top: 40upx;
  318. .rmb-icon {
  319. font-size: 60upx;
  320. font-weight: bold;
  321. display: inline-block;
  322. vertical-align: middle;
  323. height: 70upx;
  324. }
  325. .w-money-input {
  326. display: inline-block;
  327. width: 580upx;
  328. height: 70upx;
  329. font-size: 60upx;
  330. padding-left: 20upx;
  331. font-weight: bold;
  332. vertical-align: middle;
  333. padding-top: 6rpx;
  334. }
  335. }
  336. }
  337. .w-tip {
  338. font-size: 24upx;
  339. padding: 20upx 0 50upx;
  340. }
  341. .w-btn {
  342. margin: 0 auto;
  343. width: 660upx;
  344. line-height: 70upx;
  345. height: 70upx;
  346. color: #666;
  347. text-align: center;
  348. font-size: 28upx;
  349. border-radius: 70upx;
  350. background-color: #eee;
  351. }
  352. .w-btn-on {
  353. color: #fff;
  354. background-color: #fe582e;
  355. }
  356. }
  357. .pay-pop-view {
  358. background-color: #ffffff;
  359. border-top-left-radius: 12upx;
  360. border-top-right-radius: 12upx;
  361. padding-bottom: 40upx;
  362. font-size: 28upx;
  363. .pay-sel-title {
  364. padding: 0 30upx;
  365. line-height: 88upx;
  366. font-weight: bold;
  367. font-size: 32upx;
  368. .ibonfont {
  369. color: #999;
  370. font-weight: 400;
  371. }
  372. }
  373. .pay-btn {
  374. width: 690upx;
  375. height: 80upx;
  376. line-height: 80upx;
  377. color: #fff;
  378. font-size: 32upx;
  379. text-align: center;
  380. margin: 20upx auto 0;
  381. border-radius: 80upx;
  382. }
  383. .pay-ul {
  384. .pay-tip {
  385. font-size: 24upx;
  386. color: #999999;
  387. line-height: 32upx;
  388. padding: 20upx 30upx 0;
  389. }
  390. .pay-li {
  391. line-height: 100upx;
  392. .ibonfont {
  393. padding-left: 30upx;
  394. font-size: 46upx;
  395. vertical-align: middle;
  396. margin-right: 24upx;
  397. }
  398. .ibonweixinzhifu {
  399. color: #04be02;
  400. }
  401. .ibonumidd17 {
  402. color: #108ee9;
  403. }
  404. .ibonyinhangqia {
  405. color: #f2b844;
  406. }
  407. .pay-name {
  408. width: 650upx;
  409. display: inline-block;
  410. padding-right: 30upx;
  411. vertical-align: middle;
  412. border-bottom: 1px solid #f5f5f5;
  413. .ibonweixuanze,
  414. .ibonxuanze1 {
  415. margin-right: 0;
  416. padding-left: 0;
  417. font-size: 38upx;
  418. }
  419. }
  420. }
  421. .pay-li:last-child {
  422. .pay-name {
  423. border-bottom: 0 none;
  424. }
  425. }
  426. }
  427. }
  428. </style>