apply_cash.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <!-- 申请提现 -->
  3. <view class="Withdrawal" :class="['qn-page-' + theme]">
  4. <view class="w-view w-channel clearfix" @click="openPay">
  5. <view class="float_left">转出方式</view>
  6. <view class="float_right">
  7. <text v-if="cashTypeIndex>-1">{{ cashType.length>0 ? cashType[cashTypeIndex].title:""}}</text>
  8. <text v-else class="w-input-place">请选择</text>
  9. <text class="ibonfont ibonjinru"></text>
  10. </view>
  11. </view>
  12. <view class="w-view clearfix" v-if="cashType.length>0">
  13. <view class="float_left">姓名</view>
  14. <view class="float_right">
  15. <input type="text" placeholder-class="w-input-place" placeholder="请输入真实姓名" class="w-input" v-model="subData.bank_name" />
  16. </view>
  17. </view>
  18. <view class="w-view clearfix" v-if="cashTypeIndex>-1 && cashType[cashTypeIndex].code == 'bank'">
  19. <view class="float_left">开户银行</view>
  20. <view class="float_right">
  21. <input placeholder-class="w-input-place" class="w-input" placeholder="请输入开户银行" type="text" v-model="subData.bank_ad" />
  22. </view>
  23. </view>
  24. <view class="w-view clearfix">
  25. <view class="float_left">
  26. {{cashTypeIndex>-1 && cashType[cashTypeIndex].code == 'bank' ? "银行卡号" : "提现账号"}}
  27. </view>
  28. <view class="float_right">
  29. <input placeholder-class="w-input-place" class="w-input" :placeholder="cashTypeIndex>-1 && cashType[cashTypeIndex].code == 'bank' ? '请输入银行卡号' : '请输入提现账号'" type="text" v-model="subData.bank_num" />
  30. </view>
  31. </view>
  32. <view class="w-view clearfix" v-if="cashTypeIndex>-1 && cashType[cashTypeIndex].code == 'bank'">
  33. <view class="float_left">确认卡号</view>
  34. <view class="float_right">
  35. <input placeholder-class="w-input-place" class="w-input" placeholder="请输入确认卡号" type="number" v-model="subData.bank_num_agin" />
  36. </view>
  37. </view>
  38. <view class="w-view w-money">
  39. <view class="w-tit">
  40. <text>提现金额</text>
  41. <text class="w-tit-r">最少提现金额{{ min_money }}元</text>
  42. </view>
  43. <view class="w-money-input-view">
  44. <text class="rmb-ic">¥</text>
  45. <input class="w-money-input" type="number" v-model="subData.money" />
  46. </view>
  47. </view>
  48. <view class="clearfix w-tip">
  49. <view class="float_left">
  50. <text>可提现:¥{{ dataInfo.balance }}</text>
  51. <!-- <text>(手续费:10%)</text> -->
  52. </view>
  53. <view class="float_right primary-color" @click="allWitjdrawal">全部提现</view>
  54. </view>
  55. <view class="w-btn w-btn-on" @click="subForm">
  56. <u-loading :show="isLoding"></u-loading>
  57. <text style="margin-left: 10rpx;">提现</text>
  58. </view>
  59. <u-popup mode="bottom" v-model="payPop" :border-radius="12">
  60. <view class="pay-pop-view">
  61. <view class="pay-sel-title clearfix">
  62. <text class="float_left">提现方式</text>
  63. <text class="float_right ibonfont ibonguanbi1" @click="closePayPop"></text>
  64. </view>
  65. <view class="pay-ul">
  66. <view class="pay-li" v-for="(item,index) in cashType" :key="index" @click="paymentChange(index)">
  67. <text class="ibonfont ibonweixinzhifu" :class="item.icon?item.icon:'ibonyinhangqia'"></text>
  68. <view class="pay-name clearfix">
  69. <text class="float_left">{{item.title}}</text>
  70. <text class="float_right ibonfont primary-color" :class="[cashTypeIndex === index ? 'ibonxuanze_xuanzhong' : 'ibonxuanze']"></text>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </u-popup>
  76. <u-modal v-model="tip_show" content="抱歉,您未设置支付密码,无法提现余额" :show-cancel-button="true" confirm-text="立即设置" cancel-text="取消" @confirm="setPassword"></u-modal>
  77. <!-- 余额支付密码弹窗 -->
  78. <u-keyboard default="" ref="uKeyboard" mode="number" :mask="true" :mask-close-able="false" :dot-enabled="false"
  79. v-model="pwd_show" :safe-area-inset-bottom="true" :tooltip="false" @change="balancePopChange"
  80. @backspace="onBackspace">
  81. <view>
  82. <view class="u-text-center u-padding-20 balance-money">
  83. <text>密码验证</text>
  84. <view class="u-padding-10 close" data-flag="false" @tap="inputShowPop(false)">
  85. <u-icon name="close" color="#333333" size="28"></u-icon>
  86. </view>
  87. </view>
  88. <view class="u-flex u-row-center">
  89. <u-message-input mode="box" :maxlength="6" :dot-fill="true" v-model="balance_pwd"
  90. :disabled-keyboard="true" @finish="inputFinish"></u-message-input>
  91. </view>
  92. <view class="u-text-center u-padding-top-10 u-padding-bottom-20 tips">密码键盘</view>
  93. </view>
  94. </u-keyboard>
  95. </view>
  96. </template>
  97. <script>
  98. // import { getOpenid } from '@/access/common.js';
  99. export default {
  100. data() {
  101. return {
  102. min_money: 1, // 最少提现
  103. isLoding: false,
  104. payPop: false,
  105. tip_show: false, // 余额支付提示
  106. pwd_show: false, // 余额支付密码输入弹窗
  107. balance_pwd: '', // 余额支付密码
  108. cashType:[],
  109. cashTypeIndex:-1,
  110. dataInfo:{balance:0.00},
  111. subData:{
  112. money:"",
  113. bank_type:"",
  114. bank_name:"",
  115. bank_ad:"",
  116. bank_num:"",
  117. bank_num_agin:"",
  118. },
  119. payCheckStatus:false,
  120. };
  121. },
  122. computed: {
  123. userInfo() {
  124. return this.$store.state.userStatus;
  125. }
  126. },
  127. onShow() {
  128. this.getPartnerInfo();
  129. },
  130. methods: {
  131. subCheckPayPassword(){
  132. if (this.userInfo.payPassword) {
  133. //输入支付密码
  134. this.inputShowPop();
  135. } else {
  136. this.tip_show = true;
  137. }
  138. },
  139. // 密码弹窗显示
  140. inputShowPop(flag = true) {
  141. this.balance_pwd = '';
  142. this.pwd_show = flag;
  143. },
  144. // 余额密码输入完成
  145. inputFinish() {
  146. // 唤起支付
  147. // this.subForm();
  148. },
  149. // 去设置支付密码
  150. setPassword() {
  151. this.goPage('/pagesT/money/PayPassword');
  152. },
  153. //键盘退格键被点击
  154. onBackspace(e) {
  155. if (this.balance_pwd.length > 0) {
  156. this.balance_pwd = this.balance_pwd.substring(0, this.balance_pwd.length - 1);
  157. }
  158. },
  159. // 余额支付密码键盘按键被点击(不包含退格键被点击)
  160. balancePopChange(val) {
  161. if (this.balance_pwd.length < 6) {
  162. this.balance_pwd += val;
  163. }
  164. if (this.balance_pwd.length >= 6) {
  165. // 唤起密码验证
  166. this.checkPayPassword();
  167. }
  168. },
  169. // 支付密码校验
  170. checkPayPassword() {
  171. uni.showLoading();
  172. this.$u.api.checkPayPassword({id: this.userInfo.id,payPassword: this.balance_pwd}).then(res => {
  173. this.payCheckStatus = true;
  174. this.inputShowPop(false);
  175. this.subForm();
  176. }).catch(res => {
  177. this.balance_pwd = '';
  178. });
  179. },
  180. getPartnerCashType() {
  181. var that = this;
  182. this.$u.api.getPartnerCashType().then(res=>{
  183. if(res.data && res.data.length>0){
  184. that.cashType = res.data;
  185. }
  186. })
  187. },
  188. getPartnerInfo(){
  189. var that = this;
  190. this.$u.api.getCommissionPartnerData().then(res=>{
  191. if(res.data && res.data.id>0){
  192. that.dataInfo = res.data;
  193. that.getPartnerCashType();
  194. }
  195. });
  196. },
  197. // 申请提现
  198. subForm() {
  199. var postData = this.subData,that = this;
  200. if(!this.payCheckStatus){
  201. that.subCheckPayPassword();
  202. return;
  203. }
  204. if(this.isLoding==true){
  205. return false;
  206. }
  207. if(this.cashTypeIndex<0 || this.cashType.length<=0){
  208. this.$api.msg('请选择提现方式');
  209. return;
  210. }
  211. postData.bank_type = this.cashType[this.cashTypeIndex].title || "";
  212. if(!this.$_utils.isDefine(postData.bank_type)){
  213. this.$api.msg('请选择提现方式');
  214. return;
  215. }
  216. if(!this.$_utils.isDefine(postData.bank_name)){
  217. this.$api.msg('请输入您的真实姓名');
  218. return;
  219. }
  220. var code = this.cashType[this.cashTypeIndex].code;
  221. if(this.cashType[this.cashTypeIndex].code == "bank"){
  222. if(!this.$_utils.isDefine(postData.bank_ad)){
  223. this.$api.msg('请输入您的开户行');
  224. return;
  225. }
  226. if(!this.$_utils.isDefine(postData.bank_num)){
  227. this.$api.msg('请输入您的银行卡号');
  228. return;
  229. }
  230. if(!this.$_utils.isDefine(postData.bank_num_agin)){
  231. this.$api.msg('请再次输入您的银行卡号');
  232. return;
  233. }
  234. if(postData.bank_num!=postData.bank_num_agin){
  235. this.$api.msg('两次卡号输入不一致');
  236. return;
  237. }
  238. }else{
  239. if(!this.$_utils.isDefine(postData.bank_num)){
  240. this.$api.msg('请输入您的提现账号');
  241. return;
  242. }
  243. if(code=="wxpay" && !this.$_utils.isMobile(postData.bank_num)){
  244. this.$api.msg('请输入正确微信手机账号');
  245. return;
  246. }
  247. postData.bank_ad = this.cashType[this.cashTypeIndex].title;
  248. }
  249. if(!this.$_utils.isMoney(postData.money)){
  250. this.$api.msg('请输入正确的提现金额');
  251. return;
  252. }
  253. if (Number(postData.money) < this.min_money) {
  254. this.$api.msg('最低提现金额为' + this.min_money + '元');
  255. return;
  256. }
  257. if (Number(postData.money) > Number(this.dataInfo.balance)) {
  258. this.$api.msg('可提现金额不足');
  259. return;
  260. }
  261. this.isLoding = true;
  262. this.$u.api.partnerCashApply(postData).then(res => {
  263. that.isLoding = false;
  264. if(res.errorcode==0){
  265. that.$api.msg("提现成功");
  266. setTimeout(res => {
  267. that.goPage('/pages/user/user', 'switchTab');
  268. }, 1500);
  269. }else{
  270. that.$api.msg(res.data);
  271. }
  272. }).catch(res => {
  273. that.isLoding = false;
  274. });
  275. },
  276. // 全部提现按钮点击事件
  277. allWitjdrawal() {
  278. this.subData.money = this.dataInfo.balance;
  279. },
  280. // 自动提现
  281. paymentChange(index) {
  282. this.cashTypeIndex = index;
  283. this.closePayPop();
  284. },
  285. closePayPop() {
  286. this.payPop = false;
  287. this.cash_out_form.reflectInfo.account = '';
  288. this.cash_out_form.reflectInfo.bankName = '';
  289. },
  290. openPay() {
  291. this.payPop = true;
  292. },
  293. }
  294. };
  295. </script>
  296. <style lang="scss">
  297. .Withdrawal {
  298. width: 702upx;
  299. margin: 20upx auto;
  300. padding: 0 24upx 50upx;
  301. background-color: #ffffff;
  302. font-size: 28upx;
  303. .w-view {
  304. border-bottom: 1px solid #f5f5f5;
  305. padding: 24upx 0;
  306. .ibonjinru {
  307. font-size: 28upx;
  308. color: #666;
  309. height: 32upx;
  310. margin-left: 10upx;
  311. }
  312. .w-input {
  313. width: 480rpx;
  314. }
  315. .w-input-place {
  316. color: #b0b3bf;
  317. font-size: 26upx;
  318. }
  319. .w-tit {
  320. .w-tit-r {
  321. margin-left: 10upx;
  322. font-size: 24upx;
  323. color: #b0b3bf;
  324. }
  325. }
  326. }
  327. .w-money {
  328. .w-money-input-view {
  329. padding-top: 40upx;
  330. .rmb-ic {
  331. font-size: 60upx;
  332. font-weight: bold;
  333. display: inline-block;
  334. vertical-align: middle;
  335. height: 70upx;
  336. }
  337. .w-money-input {
  338. display: inline-block;
  339. width: 580upx;
  340. height: 70upx;
  341. font-size: 60upx;
  342. padding-left: 20upx;
  343. font-weight: bold;
  344. vertical-align: middle;
  345. padding-top: 6rpx;
  346. }
  347. }
  348. }
  349. .w-tip {
  350. font-size: 24upx;
  351. padding: 20upx 0 50upx;
  352. }
  353. .w-btn {
  354. margin: 0 auto;
  355. width: 660upx;
  356. line-height: 70upx;
  357. height: 70upx;
  358. color: #666;
  359. text-align: center;
  360. font-size: 28upx;
  361. border-radius: 70upx;
  362. background-color: #eee;
  363. }
  364. .w-btn-on {
  365. color: #fff;
  366. background-color: #fe582e;
  367. }
  368. }
  369. .pay-pop-view {
  370. background-color: #ffffff;
  371. border-top-left-radius: 12upx;
  372. border-top-right-radius: 12upx;
  373. padding-bottom: 40upx;
  374. font-size: 28upx;
  375. .pay-sel-title {
  376. padding: 0 30upx;
  377. line-height: 88upx;
  378. font-weight: bold;
  379. font-size: 32upx;
  380. .ibonfont {
  381. color: #999;
  382. font-weight: 400;
  383. width: 50rpx;
  384. text-align: center;
  385. font-size: 24rpx;
  386. }
  387. }
  388. .pay-btn {
  389. width: 690upx;
  390. height: 80upx;
  391. line-height: 80upx;
  392. color: #fff;
  393. font-size: 32upx;
  394. text-align: center;
  395. margin: 20upx auto 0;
  396. border-radius: 80upx;
  397. }
  398. .pay-ul {
  399. .pay-tip {
  400. font-size: 24upx;
  401. color: #999999;
  402. line-height: 32upx;
  403. padding: 20upx 30upx 0;
  404. }
  405. .pay-li {
  406. line-height: 100upx;
  407. .ibonfont {
  408. padding-left: 30upx;
  409. font-size: 46upx;
  410. vertical-align: middle;
  411. margin-right: 24upx;
  412. }
  413. .ibonweixinzhifu {
  414. color: #04be02;
  415. }
  416. .ibonumidd17 {
  417. color: #108ee9;
  418. }
  419. .ibonyinhangqia {
  420. color: #f2b844;
  421. }
  422. .pay-name {
  423. width: 650upx;
  424. display: inline-block;
  425. padding-right: 30upx;
  426. vertical-align: middle;
  427. border-bottom: 1px solid #f5f5f5;
  428. .ibonxuanze,
  429. .ibonxuanze_xuanzhong {
  430. margin-right: 0;
  431. padding-left: 0;
  432. font-size: 38upx;
  433. }
  434. }
  435. }
  436. .pay-li:last-child {
  437. .pay-name {
  438. border-bottom: 0 none;
  439. }
  440. }
  441. }
  442. }
  443. </style>