withdraw.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. <!-- 提现 -->
  2. <template>
  3. <view class="">
  4. <!-- #ifdef H5 -->
  5. <view style="color: #000000;">
  6. <tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">提现</tn-nav-bar>
  7. <view :style="{height: tobheight+'px'}"></view>
  8. </view>
  9. <!-- #endif -->
  10. <view class="draw-money-wrap" style="background: #f6f6f6;height: 100%;">
  11. <view class="head-box">
  12. <!-- <shopro-navbar :background="{ background: 'none' }" :backTextStyle="{ color: '#fff' }" backText="提现" backIconColor="#fff"></shopro-navbar> -->
  13. <!-- 可提现 -->
  14. <view class="wallet-num-box u-flex u-col-center u-row-between">
  15. <view class="">
  16. <view class="num-title">可提现金额(元)</view>
  17. <view class="wallet-num">{{enableMoney.toFixed(2)}}</view>
  18. </view>
  19. <button class="u-reset-button log-btn"
  20. @tap="$Router.push({ path: '/pages/user/commission/withdraw-log' })">提现记录</button>
  21. <!-- <button class="u-reset-button log-btn">提现记录</button> -->
  22. </view>
  23. </view>
  24. <!-- 提现输入卡片-->
  25. <view class="draw-card">
  26. <view class="card-title">提现金额</view>
  27. <view class="input-box u-flex u-col-center">
  28. <view calss="unit">¥</view>
  29. <input class="u-flex-1 u-p-l-10" type="number" @input="onWithdrawInput" v-model="money"
  30. :placeholder-style="placeholderStyle" placeholder="请输入提现金额" />
  31. </view>
  32. <view class="bank-box u-flex u-col-center u-row-between u-m-b-30">
  33. <view class="name">提现至</view>
  34. <view class="bank-list u-flex" v-if="selectedWithdrawType==1" @click="showWithdrawList=true">
  35. <view class="sel-box u-flex u-col-center">
  36. <image class="item-img" src="https://file.shopro.top/imgs/wallet/bank_type.png" mode="">
  37. </image>
  38. <view class="item-title u-m-l-20">银行卡</view>
  39. </view>
  40. </view>
  41. <view class="bank-list u-flex" v-if="selectedWithdrawType==2" @click="showWithdrawList=true">
  42. <view class="sel-box u-flex u-col-center">
  43. <image class="item-img" src="https://file.shopro.top/imgs/wallet/wx_type.png" mode="">
  44. </image>
  45. <view class="item-title u-m-l-20">微信</view>
  46. </view>
  47. </view>
  48. <view class="bank-list u-flex" v-if="selectedWithdrawType==3" @click="showWithdrawList=true">
  49. <view class="sel-box u-flex u-col-center">
  50. <image class="item-img" src="https://file.shopro.top/imgs/wallet/ali_type.png" mode="">
  51. </image>
  52. <view class="item-title u-m-l-20">支付宝</view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 提现信息 -->
  57. <view class="bank-info u-m-b-80">
  58. <view class="u-flex u-row-between u-col-center" v-if="withdrawType">
  59. <block v-if="withdrawType === 'wechat'">
  60. <view class="bank-info-title">
  61. {{ !withdrawInfo ? '暂无微信授权信息' : `${withdrawInfo.bank_name || ''} [${withdrawInfo.card_no || ''}] ${withdrawInfo.real_name || ''}` }}
  62. </view>
  63. <button v-if="!withdrawInfo" class="u-reset-button bind-btn u-m-l-20"
  64. @tap="bindThirdOauth()">绑定</button>
  65. </block>
  66. <block v-else>
  67. <view class="bank-info-title">
  68. {{
  69. !withdrawInfo
  70. ? `暂无${withdrawList[withdrawType].title}信息`
  71. : `${withdrawInfo.bank_name || ''} [${withdrawInfo.card_no || ''}] ${withdrawInfo.real_name || ''}`
  72. }}
  73. </view>
  74. <button class="u-reset-button bind-btn u-m-l-20"
  75. @tap="toBind">{{ withdrawInfo ? '修改' : '添加' }}</button>
  76. </block>
  77. </view>
  78. </view>
  79. <button class="u-reset-button save-btn" @tap="confirmWithdraw">确认提现</button>
  80. </view>
  81. <!-- 提现说明 -->
  82. <view class="draw-notice">
  83. <view class="title">{{ruleInfo.instructions}}</view>
  84. <view class="draw-list">1.单次最低提现 {{minCash}} 元。</view>
  85. <view class="draw-list">2.单日可提现 {{dayCash}} 元。</view>
  86. <view class="draw-list">{{withdrawTxt}}</view>
  87. <!-- <view class="draw-list">
  88. 2.每日最多可提现次数: {{ ruleInfo.perday_num ? ruleInfo.perday_num : '不限' }};每日最多提现金额(元):
  89. {{ ruleInfo.perday_amount ? ruleInfo.perday_amount : '不限' }};
  90. </view>
  91. <!-- <view class="draw-list">3.每笔收取提现手续费 {{ ruleInfo.extract_rate }}%;</view> -->
  92. <!-- <view class="draw-list">2.提现结果请查收对应渠道服务通知。</view>
  93. <view class="draw-list">3.如有疑问请及时联系客服。</view> -->
  94. <!-- <view class="draw-list">4.一级分佣比例为{{ruleInfo.first}}%。</view>
  95. <view class="draw-list">4.一级分佣比例为{{ruleInfo.first}}%。</view>
  96. <view class="draw-list">5.二级分佣比例为{{ruleInfo.second}}%。</view> -->
  97. <!-- <view class="draw-list">6.三级分佣比例为{{ruleInfo.third}}%。</view> -->
  98. </view>
  99. <!-- 提现方式 -->
  100. <u-popup :show="showWithdrawList" @close="showWithdrawList=false" mode="bottom" safe-area-inset-bottom
  101. :closeable="true" border-radius="30">
  102. <view class="page_box withdraw-modal">
  103. <view class="modal-head u-flex u-row-center u-col-center">选择提现方式</view>
  104. <view class="content_box modal-content">
  105. <u-radio-group v-model="selectedWithdrawType" activeColor="#A36FFF" wrap
  106. v-for="(item, index) in withdrawList" :key="index">
  107. <view class="type-item"
  108. style="display: flex;align-items: center;justify-content: space-between;">
  109. <view class="" style="display: flex;align-items: center; ">
  110. <u-radio shape="circle" iconSize="30" :name="item.type" labelWidth="100%">
  111. </u-radio>
  112. <view class="item-left u-flex u-col-center u-m-l-30">
  113. <image class="item-img" :src="item.icon" mode=""></image>
  114. <view class="item-title u-m-l-20">{{item.title}}</view>
  115. </view>
  116. </view>
  117. <view class="" style="color: rgb(163, 111, 255);width: 100rpx;"
  118. @click="updateWithDrawInfo(index+1)">
  119. 修改
  120. </view>
  121. </view>
  122. </u-radio-group>
  123. </view>
  124. <view class="modal-bottom"><button class="u-reset-button modal-save-btn"
  125. @tap="onSaveWithdrawType">确定</button></view>
  126. </view>
  127. </u-popup>
  128. <u-popup :show="showBindForm" @close="showBindForm = false" :round="10">
  129. <view class="carmimodal">
  130. <view class="carmiclose" @click="showBindForm = false"><u-icon name="close-circle-fill" color="#fff"
  131. size="22"></u-icon></view>
  132. <view class="carmititle">添加提现信息</view>
  133. <view class="" v-if="selectedWithdrawType==1">
  134. <view class="carmiinput"><u--input placeholder="请输入您的银行卡号" border="surround" clearable
  135. v-model="cardNum"></u--input></view>
  136. <view class="carmiinput"><u--input placeholder="请输入银行卡开户行" border="surround" clearable
  137. v-model="bankName"></u--input></view>
  138. </view>
  139. <view class="">
  140. <view class="kf_qrcode tn-flex justify-center" v-if="selectedWithdrawType==2">
  141. <u--image :showLoading="true" :src="wx_qrcode_url" width="100px" height="100px"
  142. @click="clickuimage()"></u--image>
  143. </view>
  144. <view class="kf_qrcode tn-flex justify-center" v-if="selectedWithdrawType==3">
  145. <u--image :showLoading="true" :src="ali_qrcode_url" width="100px" height="100px"
  146. @click="clickuimage()"></u--image>
  147. </view>
  148. <view class="u-text-center" v-if="selectedWithdrawType!=1">
  149. 点击上传{{selectedWithdrawType==2?"微信":'支付宝'}}收款码
  150. </view>
  151. </view>
  152. <view class="carmiinput"><u--input placeholder="请输入您的真实姓名" border="surround" clearable
  153. v-model="realname"></u--input></view>
  154. <view @click="exchange" class="carmiexchange">立即保存</view>
  155. </view>
  156. </u-popup>
  157. <!-- 绑定修改银行信息 -->
  158. <!-- modal -->
  159. <u-modal ref="uModal" v-model="showModal" :show-cancel-button="true" confirm-color="#7063D2"
  160. cancel-color="#666666" @confirm="$Router.push('/pages/user/wallet/withdraw-log')" confirm-text="查看记录"
  161. cancel-text="继续提现" content="您的申请提现已提交" title="申请成功"></u-modal>
  162. </view>
  163. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  164. </view>
  165. </template>
  166. <script>
  167. import {
  168. mapState,
  169. mapActions,
  170. mapGetters
  171. } from 'vuex';
  172. import {
  173. apiurl
  174. } from '@/common/request/request';
  175. import {
  176. sysParms,
  177. applyWithdraw,
  178. withDrawInfo,
  179. saveWithDrawInfo
  180. } from '@/api/my/index.js'
  181. // import FormValidate from '@/shopro/validate/form';
  182. // import wechat from '@/shopro/wechat/wechat';
  183. import {
  184. taskCount,
  185. recommendCount,
  186. userInfo
  187. } from '@/api/my/index.js'
  188. export default {
  189. data() {
  190. return {
  191. // isLoading:true,
  192. isLoading: false,
  193. tobheight: 45,
  194. platform: this.$platform.get(),
  195. showModal: false,
  196. money: '', //提现金额
  197. ruleInfo: {}, //提现规则
  198. formTitle: '',
  199. withdrawType: '',
  200. showBindForm: false,
  201. selectedWithdrawType: 2,
  202. withdrawInfo: {}, //提现信息
  203. showWithdrawList: false,
  204. withdrawList: [],
  205. // 表单样式
  206. errorType: ['message'],
  207. labelStyle: {
  208. 'font-size': '30rpx',
  209. 'font-weight': '500',
  210. color: '#333'
  211. },
  212. placeholderStyle: 'font-size: 30rpx; font-weight: 500;color:#C2C7CF;',
  213. form: {
  214. data: {
  215. real_name: '',
  216. bank_name: '',
  217. card_no: ''
  218. },
  219. // bankRules: {
  220. // real_name: FormValidate.realName,
  221. // bank_name: FormValidate.bankName,
  222. // card_no: FormValidate.bankCode
  223. // },
  224. // alipayRules: {
  225. // real_name: FormValidate.realName,
  226. // card_no: FormValidate.alipayAccount
  227. // }
  228. },
  229. okmoney: 0.00,
  230. extract_min_price: 0,
  231. extract_rate: 0,
  232. paymentcode: '',
  233. paymentcodeid: '',
  234. realname: '',
  235. qrcode_wechat: '',
  236. withdrawTxt: "",
  237. withDrawWay: -1,
  238. enableMoney: 0,
  239. withDrawType: 1,
  240. minCash: 0,
  241. dayCash: 0,
  242. methods: [],
  243. cardNum: '',
  244. bankName: '',
  245. withDrawInfo: {},
  246. userInfo: {},
  247. wx_qrcode_url: '',
  248. ali_qrcode_url: ''
  249. };
  250. },
  251. computed: {
  252. // ...mapGetters(['appInfo', 'userInfo'])
  253. },
  254. async onShow() {
  255. if (this.withDrawType == 1) {
  256. let ress1 = await taskCount()
  257. if (ress1.code == 0) {
  258. console.log('提现-任务佣金汇总返回值', ress1);
  259. this.enableMoney = Number(ress1.data.cashing)
  260. console.log('任务-可提现金额', this.enableMoney);
  261. }
  262. } else {
  263. let ress2 = await recommendCount()
  264. if (ress2.code == 0) {
  265. console.log('提现-推广佣金汇总返回值', ress2);
  266. this.enableMoney = Number(ress2.data.cashing)
  267. console.log('推广-可提现金额', this.enableMoney);
  268. }
  269. }
  270. let res66 = await userInfo()
  271. if (res66.code == 0) {
  272. this.userInfo = res66.data
  273. this.bankName = this.userInfo.bank_name
  274. this.cardNum = this.userInfo.card_num
  275. this.realname = this.userInfo.real_name
  276. this.wx_qrcode_url = this.userInfo.wx_qrcode_url
  277. this.ali_qrcode_url = this.userInfo.ali_qrcode_url
  278. console.log('提现-用户个人信息', this.userInfo);
  279. }
  280. },
  281. async onLoad(o) {
  282. // let ress6 = await withDrawInfo()
  283. // if (ress6.code == 0) {
  284. // console.log('用户保存的提现信息', ress6);
  285. // this.withDrawInfo = ress6.data
  286. // }
  287. this.withDrawType = o.type
  288. let ress = await sysParms()
  289. console.log('提现页系统参数返回值', ress, ress.msg, this.$IMG_URL + '/imgs/wallet/bank_type.png');
  290. if (ress.code == 0) {
  291. this.withdrawTxt = ress.data[4].value.description
  292. this.minCash = ress.data[4].value.rule.min
  293. this.dayCash = ress.data[4].value.rule.day
  294. this.methods = ress.data[4].value.method
  295. this.selectedWithdrawType = Number(this.methods[0])
  296. this.methods.forEach((item, index) => {
  297. if (item == 2) {
  298. this.withdrawList.push({
  299. icon: 'https://file.shopro.top/imgs/wallet/wx_type.png',
  300. title: '微信零钱',
  301. value: 'wechat',
  302. type: 2
  303. })
  304. } else if (item == 3) {
  305. this.withdrawList.push({
  306. icon: 'https://file.shopro.top/imgs/wallet/ali_type.png',
  307. title: '支付宝账户',
  308. value: 'alipay',
  309. type: 3
  310. })
  311. } else if (item == 1) {
  312. this.withdrawList.push({
  313. icon: 'https://file.shopro.top/imgs/wallet/bank_type.png',
  314. title: '银行卡转账',
  315. value: 'bank',
  316. type: 1
  317. })
  318. }
  319. })
  320. console.log('支持的提现方式列表', this.withdrawList);
  321. }
  322. },
  323. methods: {
  324. updateWithDrawInfo(i) {
  325. this.showWithdrawList = false;
  326. this.showBindForm = true
  327. this.selectedWithdrawType = i
  328. // if (i == 1) {
  329. // this.bankName = this.userInfo.bank_name
  330. // this.cardNum = this.userInfo.card_num
  331. // this.realname = this.userInfo.real_name
  332. // } else if (i == 2) {
  333. // this.realname = this.userInfo.real_name
  334. // this.paymentcode = this.userInfo.wx_qrcode_url
  335. // } else {
  336. // this.realname = this.userInfo.real_name
  337. // this.paymentcode = this.userInfo.ali_qrcode_url
  338. // }
  339. },
  340. async confirmWithdraw() {
  341. const that = this;
  342. // 类型(1.余额 2.分销)
  343. // 提现方式(1.银行卡 2.微信 3.支付宝)
  344. if (this.money.trim() == '') {
  345. return uni.showToast({
  346. title: '请输入提现金额',
  347. icon: 'none'
  348. })
  349. }
  350. if (Number(this.money.trim()) < this.minCash) {
  351. return uni.showToast({
  352. title: '最低提现金额为' + this.minCash,
  353. icon: 'none'
  354. })
  355. }
  356. if (Number(this.money.trim()) > this.enableMoney) {
  357. return uni.showToast({
  358. title: '提现金额不能大于可提现金额',
  359. icon: 'none'
  360. })
  361. }
  362. // if (this.selectedWithdrawType == 1) {
  363. // this.$u.toast('银行卡提现暂未开通');
  364. // return;
  365. // }
  366. if (this.selectedWithdrawType == 1) {
  367. if (!this.cardNum || !this.realname || !this.bankName) {
  368. this.$u.toast('请上传提现信息');
  369. this.showBindForm = true
  370. return;
  371. }
  372. } else if (this.selectedWithdrawType == 2) {
  373. if (!this.wx_qrcode_url || !this.realname) {
  374. this.$u.toast('请上传提现信息');
  375. this.showBindForm = true
  376. return;
  377. }
  378. } else {
  379. if (!this.ali_qrcode_url || !this.realname) {
  380. this.$u.toast('请上传提现信息');
  381. this.showBindForm = true
  382. return;
  383. }
  384. }
  385. console.log('申请提现参数', {
  386. type: this.withDrawType,
  387. method: this.selectedWithdrawType,
  388. amount: this.money,
  389. wx_qrcode_url: this.wx_qrcode_url,
  390. ali_qrcode_url: this.ali_qrcode_url,
  391. real_name: this.realname,
  392. card_num: this.cardNum,
  393. bank_name: this.bankName
  394. });
  395. let parms = {}
  396. if (this.selectedWithdrawType == 1) {
  397. parms = {
  398. type: this.withDrawType,
  399. method: this.selectedWithdrawType,
  400. amount: this.money,
  401. real_name: this.realname,
  402. card_num: this.cardNum,
  403. bank_name: this.bankName
  404. }
  405. } else if (this.selectedWithdrawType == 2) {
  406. parms = {
  407. type: this.withDrawType,
  408. method: this.selectedWithdrawType,
  409. amount: this.money,
  410. real_name: this.realname,
  411. wx_qrcode_url: this.wx_qrcode_url
  412. }
  413. } else {
  414. parms = {
  415. type: this.withDrawType,
  416. method: this.selectedWithdrawType,
  417. amount: this.money,
  418. real_name: this.realname,
  419. ali_qrcode_url: this.ali_qrcode_url
  420. }
  421. }
  422. let ress = await applyWithdraw(parms)
  423. console.log('申请提现返回值', ress, ress.msg);
  424. // if (ress.code == 0) {
  425. if (ress.code == 0) {
  426. uni.showToast({
  427. title: '提现申请成功'
  428. })
  429. this.selectedWithdrawType = Number(this.methods[0])
  430. this.money = ''
  431. this.realname = ''
  432. this.cardNum = ''
  433. this.bankName = ''
  434. this.paymentcode = ''
  435. console.log('提现参数重置后', {
  436. type: this.withDrawType,
  437. method: this.selectedWithdrawType,
  438. amount: this.money,
  439. real_name: this.realname,
  440. card_num: this.cardNum,
  441. bank_name: this.bankName,
  442. qrcode_url: this.paymentcode
  443. });
  444. setTimeout(() => {
  445. uni.navigateTo({
  446. url: '/pages/user/commission/withdraw-log'
  447. })
  448. }, 1500)
  449. } else {
  450. uni.showToast({
  451. title: ress.msg,
  452. icon: 'none'
  453. })
  454. }
  455. },
  456. getCheck() {
  457. var that = this;
  458. that.$http('commission.auth').then(res => {
  459. if (res.code == 0) {
  460. uni.setNavigationBarTitle({
  461. title: this.appInfo.site_name
  462. });
  463. that.okmoney = res.data.money
  464. that.qrcode_wechat = res.data.qrcode_wechat
  465. that.isLoading = false
  466. }
  467. })
  468. },
  469. getGroupConf() {
  470. var that = this;
  471. // that.$http('conf.getGroupConf',{group: 'system.commission_cashout'}).then(res => {
  472. // if(res.code == 0){
  473. // that.extract_min_price = res.data.extract_min_price
  474. // that.extract_rate = res.data.extract_rate
  475. // }
  476. // })
  477. },
  478. // 确认提现方式
  479. onSaveWithdrawType() {
  480. this.showWithdrawList = false;
  481. },
  482. async bindThirdOauth() {
  483. let that = this;
  484. wechat.bind();
  485. that.getWithdrawInfo();
  486. },
  487. async exchange() {
  488. let that = this;
  489. if (this.selectedWithdrawType == 1) {
  490. if (!that.cardNum) {
  491. uni.showToast({
  492. title: '请填写提现银行卡号',
  493. icon: 'none'
  494. })
  495. return;
  496. }
  497. if (!that.bankName) {
  498. uni.showToast({
  499. title: '请填写开户行',
  500. icon: 'none'
  501. })
  502. return;
  503. }
  504. } else if (this.selectedWithdrawType == 2) {
  505. if (!that.wx_qrcode_url) {
  506. uni.showToast({
  507. title: '请上传微信收款码',
  508. icon: 'none'
  509. })
  510. return;
  511. }
  512. } else {
  513. if (!that.ali_qrcode_url) {
  514. uni.showToast({
  515. title: '请上传支付宝收款码',
  516. icon: 'none'
  517. })
  518. return;
  519. }
  520. }
  521. if (!that.realname) {
  522. uni.showToast({
  523. title: '请填写您的真实姓名',
  524. icon: 'none'
  525. })
  526. return;
  527. }
  528. if (this.selectedWithdrawType == 1) {
  529. if (that.realname && that.cardNum && that.bankName) {
  530. that.showBindForm = false
  531. }
  532. } else if (this.selectedWithdrawType == 2) {
  533. if (that.realname && that.wx_qrcode_url) {
  534. that.showBindForm = false
  535. }
  536. } else {
  537. if (that.realname && that.ali_qrcode_url) {
  538. that.showBindForm = false
  539. }
  540. }
  541. this.confirmWithdraw()
  542. return
  543. },
  544. //上传收款码
  545. clickuimage() {
  546. var that = this;
  547. uni.chooseImage({
  548. count: 1, //默认9
  549. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  550. sourceType: ['album', 'camera'], //从相册选择
  551. success: function(res) {
  552. uni.showLoading({
  553. title: '上传中...'
  554. })
  555. const tempFilePaths = res.tempFilePaths;
  556. //上传服务器将服务器;
  557. uni.uploadFile({
  558. url: 'http://t20.9026.com/api/common/upload',
  559. filePath: tempFilePaths[0],
  560. name: 'file',
  561. formData: {
  562. accept: 'image'
  563. },
  564. success: res2 => {
  565. uni.hideLoading();
  566. let a = JSON.parse(res2.data);
  567. if (a.code == 0) {
  568. if (that.selectedWithdrawType == 2) {
  569. that.wx_qrcode_url = a.data.url
  570. } else {
  571. that.ali_qrcode_url = a.data.url
  572. }
  573. // that.paymentcodeid = a.data.id
  574. } else {
  575. uni.showToast({
  576. title: '上传收款码失败',
  577. icon: 'none'
  578. })
  579. }
  580. }
  581. });
  582. }
  583. });
  584. },
  585. // 提现检验
  586. onWithdrawInput(e) {
  587. let sVal = String(e.detail.value);
  588. sVal = sVal.replace(/\b(0+)/gi, '');
  589. sVal = sVal.replace(/[^\d]/g, '');
  590. this.money = sVal;
  591. },
  592. // 提现
  593. withdraw() {
  594. const that = this;
  595. if (!this.qrcode_wechat) {
  596. this.$u.toast('请上传提现信息');
  597. this.showBindForm = true
  598. return;
  599. }
  600. // console.log(that.money,that.ruleInfo.extract_min_price,that.okmoney);
  601. // if (that.okmoney == 0 && that.money > that.okmoney) {
  602. // that.$u.toast('金额不足');
  603. // return;
  604. // }
  605. console.log(Number(that.money), Number(that.ruleInfo.extract_min_price), Number(that.okmoney));
  606. if (Number(that.money) <= 0) {
  607. that.$u.toast('请输入提现金额');
  608. return;
  609. }
  610. if (Number(that.okmoney) == 0) {
  611. that.$u.toast('金额不足');
  612. return;
  613. }
  614. if (Number(that.okmoney) > 0 && Number(that.money) > Number(that.okmoney)) {
  615. that.$u.toast('金额不足');
  616. return;
  617. }
  618. if (Number(that.money) < Number(that.ruleInfo.extract_min_price)) {
  619. that.$u.toast('最低提现金额' + that.ruleInfo.extract_min_price + '元');
  620. return;
  621. }
  622. that.$http(
  623. 'commission.extract', {
  624. // type: that.withdrawType,
  625. extract_price: that.money
  626. },
  627. '申请中...',
  628. false
  629. ).then(res => {
  630. if (res.code === 0) {
  631. // that.$u.toast(res.msg);
  632. that.money = '';
  633. // uni.showToast({
  634. // title:'提现成功'
  635. // })
  636. uni.showModal({
  637. confirmText: '继续提现',
  638. confirmColor: '#5e49c3',
  639. content: '提现成功',
  640. title: '提示',
  641. success(res) {
  642. }
  643. })
  644. that.getCheck()
  645. } else {
  646. that.money = '';
  647. // that.showModal = true;
  648. // #ifdef MP-WEIXIN
  649. // this.$store.commit('subscribeMessage', 'wallet');
  650. // #endif
  651. uni.showToast({
  652. title: '提现失败',
  653. icon: 'none'
  654. })
  655. }
  656. });
  657. },
  658. initForm() {
  659. this.form.data = {
  660. real_name: '',
  661. bank_name: '',
  662. card_no: ''
  663. };
  664. },
  665. // 绑定,修改
  666. toBind() {
  667. this.showBindForm = true;
  668. this.form.data = {
  669. ...this.form.data,
  670. ...this.withdrawInfo
  671. };
  672. switch (this.withdrawType) {
  673. case 'bank':
  674. this.formTitle = this.withdrawInfo ? '修改银行卡' : '添加银行卡';
  675. this.$nextTick(() => {
  676. this.$refs.bank.setRules(this.form.bankRules);
  677. });
  678. break;
  679. case 'alipay':
  680. this.formTitle = this.withdrawInfo ? '修改支付宝' : '添加支付宝';
  681. this.$nextTick(() => {
  682. this.$refs.alipay.setRules(this.form.alipayRules);
  683. });
  684. break;
  685. default:
  686. break;
  687. }
  688. },
  689. // 确认提交表单
  690. saveForm() {
  691. let that = this;
  692. this.$refs[this.withdrawType].validate().then(res => {
  693. if (res) {
  694. that.$http(
  695. 'money.bankEdit', {
  696. type: that.withdrawType,
  697. ...that.form.data
  698. },
  699. '提交中...'
  700. ).then(res => {
  701. if (res.code === 1) {
  702. that.showBindForm = false;
  703. that.$u.toast(res.msg);
  704. that.initForm();
  705. that.getWithdrawInfo();
  706. }
  707. });
  708. }
  709. });
  710. },
  711. // 提现规则
  712. getWithdrawRules() {
  713. let that = this;
  714. that.$http('conf.getGroupConf', {
  715. group: 'system.commission'
  716. }).then(res => {
  717. if (res.code === 0) {
  718. that.ruleInfo = res.data;
  719. // that.selectedWithdrawType = that.ruleInfo.methods[0];
  720. }
  721. });
  722. },
  723. // 获取提现信息
  724. getWithdrawInfo() {
  725. let that = this;
  726. that.$http(
  727. 'money.bankInfo', {
  728. type: that.withdrawType
  729. },
  730. '',
  731. false
  732. ).then(res => {
  733. that.withdrawInfo = res.code === 1 ? res.data : null;
  734. });
  735. }
  736. }
  737. };
  738. </script>
  739. <style lang="scss">
  740. .head-box {
  741. background: url('http://file.shopro.top/imgs/user/draw_money_head_bg.png') no-repeat;
  742. background-size: 100% auto;
  743. min-height: 400rpx;
  744. padding-bottom: var(--status-bar-height);
  745. // 可提现
  746. .wallet-num-box {
  747. padding: 20rpx 40rpx 0;
  748. .num-title {
  749. font-size: 26rpx;
  750. font-weight: 500;
  751. color: #ffffff;
  752. margin-bottom: 20rpx;
  753. }
  754. .wallet-num {
  755. font-size: 60rpx;
  756. font-weight: 500;
  757. color: #ffffff;
  758. }
  759. .log-btn {
  760. width: 170rpx;
  761. height: 60rpx;
  762. line-height: 60rpx;
  763. background: rgba(255, 255, 255, 0.1);
  764. border: 1rpx solid #eeeeee;
  765. border-radius: 30rpx;
  766. padding: 0;
  767. font-size: 26rpx;
  768. font-weight: 500;
  769. color: #ffffff;
  770. margin-right: 0;
  771. }
  772. }
  773. }
  774. // 提现输入卡片
  775. .draw-card {
  776. background-color: #fff;
  777. border-radius: 20rpx;
  778. width: 690rpx;
  779. min-height: 530rpx;
  780. margin: -70rpx auto 0;
  781. padding: 30rpx;
  782. .card-title {
  783. font-size: 30rpx;
  784. font-weight: 500;
  785. color: #333333;
  786. margin-bottom: 30rpx;
  787. }
  788. .input-box {
  789. width: 624rpx;
  790. border-bottom: 1rpx solid #eee;
  791. height: 100rpx;
  792. margin-bottom: 40rpx;
  793. .unit {
  794. font-size: 48rpx;
  795. color: #333;
  796. }
  797. }
  798. .bank-box {
  799. .name {
  800. font-size: 28rpx;
  801. font-weight: 500;
  802. color: #333333;
  803. }
  804. .bank-list {
  805. .empty-text {
  806. font-size: 28rpx;
  807. font-weight: 400;
  808. color: #999999;
  809. }
  810. .sel-box {
  811. .item-img {
  812. width: 36rpx;
  813. height: 36rpx;
  814. }
  815. .item-title {
  816. font-size: 28rpx;
  817. color: #333333;
  818. }
  819. }
  820. }
  821. }
  822. .bank-info {
  823. height: 50rpx;
  824. font-size: 28rpx;
  825. font-weight: 400;
  826. color: #999999;
  827. .bank-info-title {
  828. width: 500rpx;
  829. }
  830. .bind-btn {
  831. padding: 0 20rpx;
  832. line-height: 50rpx;
  833. background: #f5f6f8;
  834. border-radius: 20rpx;
  835. color: #999;
  836. }
  837. }
  838. .save-btn {
  839. width: 616rpx;
  840. height: 86rpx;
  841. line-height: 86rpx;
  842. background: linear-gradient(-90deg, #a36fff, #5336ff);
  843. box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
  844. border-radius: 43rpx;
  845. font-size: 30rpx;
  846. font-weight: 500;
  847. color: #ffffff;
  848. }
  849. }
  850. // 提现说明
  851. .draw-notice {
  852. width: 684rpx;
  853. min-height: 327rpx;
  854. background: #ffffff;
  855. border-radius: 20rpx;
  856. padding: 30rpx 35rpx;
  857. margin: 20rpx auto;
  858. .title {
  859. font-size: 30rpx;
  860. font-weight: 500;
  861. color: #333333;
  862. margin-bottom: 30rpx;
  863. }
  864. .draw-list {
  865. font-size: 24rpx;
  866. font-weight: 400;
  867. color: #999999;
  868. margin-bottom: 10rpx;
  869. }
  870. }
  871. // 提现费方式
  872. .withdraw-modal {
  873. min-height: 600rpx;
  874. background-color: #fff;
  875. .modal-head {
  876. height: 80rpx;
  877. font-size: 30rpx;
  878. font-weight: 600;
  879. color: #333333;
  880. border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
  881. }
  882. .modal-content {
  883. // display: flex;
  884. // flex-direction: column;
  885. // padding-left: 50rpx;
  886. .type-item {
  887. height: 100rpx;
  888. border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
  889. width: 750rpx;
  890. display: flex;
  891. align-items: center;
  892. padding-left: 50rpx;
  893. .item-img {
  894. width: 36rpx;
  895. height: 36rpx;
  896. }
  897. .item-title {
  898. font-size: 28rpx;
  899. color: #333333;
  900. }
  901. }
  902. }
  903. .modal-bottom {
  904. padding: 30rpx;
  905. .modal-save-btn {
  906. width: 690rpx;
  907. height: 80rpx;
  908. line-height: 80rpx;
  909. background: linear-gradient(90deg, #a36fff, #5336ff);
  910. box-shadow: 0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
  911. border-radius: 40rpx;
  912. font-weight: 500;
  913. color: #ffffff;
  914. }
  915. }
  916. }
  917. // 绑定
  918. .form-box {
  919. .head-title {
  920. height: 100rpx;
  921. font-size: 34rpx;
  922. font-weight: 600;
  923. }
  924. .form-save-btn {
  925. width: 340rpx;
  926. height: 80rpx;
  927. line-height: 80rpx;
  928. background: linear-gradient(90deg, #a36fff, #5336ff);
  929. box-shadow: 0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
  930. border-radius: 40rpx;
  931. font-weight: 500;
  932. color: #ffffff;
  933. }
  934. .form-cancel-btn {
  935. width: 340rpx;
  936. height: 80rpx;
  937. line-height: 80rpx;
  938. border: 1rpx solid #999;
  939. border-radius: 40rpx;
  940. font-weight: 500;
  941. color: #999;
  942. }
  943. }
  944. .carmimodal {
  945. // width: 600rpx;
  946. border-radius: 20rpx;
  947. position: relative;
  948. .carmiclose {
  949. position: absolute;
  950. right: 15rpx;
  951. top: 15rpx;
  952. }
  953. .carmititle {
  954. background: linear-gradient(-90deg, #a36fff, #5336ff);
  955. color: #fff;
  956. height: 120rpx;
  957. line-height: 120rpx;
  958. font-size: 32rpx;
  959. font-weight: bold;
  960. text-align: center;
  961. border-radius: 20rpx 20rpx 0 0;
  962. margin-bottom: 60rpx;
  963. }
  964. .carmiinput {
  965. margin: 30rpx;
  966. }
  967. .carmiexchange {
  968. margin: 80rpx 30rpx 90rpx 30rpx;
  969. background: linear-gradient(-90deg, #a36fff, #5336ff);
  970. color: #fff;
  971. border-radius: 80rpx;
  972. height: 80rpx;
  973. line-height: 80rpx;
  974. text-align: center;
  975. }
  976. .kf_qrcode {
  977. // margin-left: 200rpx;
  978. margin-bottom: 30rpx;
  979. }
  980. }
  981. </style>