withdrawal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="实际到账98%"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex " style="width: 750rpx;justify-content: space-around;margin-left: 0;">
  6. <view class="buttom">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现{{showType}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="row-box">
  13. <view class="title">提现金额</view>
  14. <view class="row">
  15. <text class="tit">¥</text>
  16. <input class="input" type="number" v-model="withdrawal" placeholder="请输入提现金额"
  17. placeholder-class="placeholder" />
  18. <view class="buttom" @click="withdrawal = money">全部提现</view>
  19. </view>
  20. </view>
  21. <!-- #ifndef MP-WEIXIN -->
  22. <view class="list">
  23. <radio-group @change="tabRadio">
  24. <!-- <label>
  25. <view class="box">
  26. <view class="icon iconfont iconweixin1"></view>
  27. <view class="title-box">
  28. <view class="title"><text>提现至微信</text></view>
  29. </view>
  30. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  31. </view>
  32. </label> -->
  33. <label>
  34. <view class="box">
  35. <view class="icon iconfont iconzhifubao"></view>
  36. <view class="title-box">
  37. <view class="title">
  38. <text v-if="aliData.fullname">提现至支付宝</text>
  39. <text v-else>请创建支付宝账号</text>
  40. </view>
  41. <view class="node">
  42. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  43. </view>
  44. </view>
  45. <view class="right">
  46. <radio value="alipay" color="#ff0060" :checked="type == 'alipay'" />
  47. </view>
  48. </view>
  49. </label>
  50. <!-- <label>
  51. <view class="box">
  52. <view class="icon iconfont">
  53. <image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image>
  54. </view>
  55. <view class="title-box">
  56. <view class="title">
  57. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  58. <text v-else>请创建银行账号</text>
  59. </view>
  60. <view class="node">
  61. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  62. </view>
  63. </view>
  64. <view class="right">
  65. <radio value="bank" color="#ff0060" :checked="type == 'bank'" />
  66. </view>
  67. </view>
  68. </label> -->
  69. </radio-group>
  70. </view>
  71. <!-- #endif -->
  72. <view class="row b-b" v-if="type == 'alipay'">
  73. <text class="tit">支付宝账号</text>
  74. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号"
  75. placeholder-class="placeholder" />
  76. </view>
  77. <view class="row b-b" v-if="type == 'alipay'">
  78. <text class="tit">支付宝姓名</text>
  79. <input class="input" type="text" v-model="alipay_name" placeholder="请输入支付宝姓名"
  80. placeholder-class="placeholder" />
  81. </view>
  82. <view class="row b-b" v-if="type == 'alipay'">
  83. <text class="tit">手机号</text>
  84. <input class="input" v-model="alipay_phone" type="number" placeholder="请输入手机号"
  85. placeholder-class="placeholder"/>
  86. </view>
  87. <view class="row b-b" v-if="type == 'bank'">
  88. <text class="tit">银行卡号</text>
  89. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号"
  90. placeholder-class="placeholder" />
  91. </view>
  92. <view class="row b-b" v-if="type == 'bank'">
  93. <text class="tit">姓名</text>
  94. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名"
  95. placeholder-class="placeholder" />
  96. </view>
  97. <view class="row b-b" v-if="type == 'bank'">
  98. <text class="tit">所属银行</text>
  99. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行"
  100. placeholder-class="placeholder" />
  101. </view>
  102. <button class="add-btn up" @click="confirm" :class="{'loading': load}">提交申请</button>
  103. <!-- <button class="add-btn " v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button> -->
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. getMoneyStyle
  109. } from '@/utils/rocessor.js';
  110. import {
  111. extractCash,
  112. extractBank,
  113. setAliInfo,
  114. aliInfo,
  115. bankInfo,
  116. getMoneyType
  117. } from '@/api/wallet.js';
  118. import {
  119. orderData,
  120. getUserInfo
  121. } from '@/api/user.js';
  122. import {
  123. mapState,
  124. mapMutations
  125. } from 'vuex';
  126. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  127. export default {
  128. filters: {
  129. getMoneyStyle
  130. },
  131. components: {
  132. uniNoticeBar
  133. },
  134. computed: {
  135. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  136. },
  137. data() {
  138. return {
  139. load: true,
  140. showType: '',
  141. from: '',
  142. type: 'alipay', //提现方式
  143. money: '0.00', //可提现金额
  144. freeze: '0.0', //冻结金额
  145. withdrawal: '', //提现金额
  146. minPrice: '', //最少提现金额
  147. aliData: {},
  148. bankData: {},
  149. alipay_code: '',
  150. alipay_name: '',
  151. alipay_phone:'',
  152. bank_code: '',
  153. bank_people: '',
  154. bank_name: '',
  155. // #ifdef H5
  156. weichatBsrowser: false
  157. // #endif
  158. };
  159. },
  160. onLoad(options) {
  161. // #ifdef H5
  162. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  163. // #endif
  164. if (options.type) {
  165. this.from = options.type
  166. if (this.from == 'purple') {
  167. this.showType = '阳光积分'
  168. }
  169. if (this.from == 'shop') {
  170. this.showType = '美好积分'
  171. }
  172. }
  173. //加载提现信息
  174. this.loadData();
  175. // // 加载提款账号信息
  176. // this.loadAli();
  177. // this.loadBank();
  178. },
  179. methods: {
  180. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  181. // 加载余额信息
  182. async loadData() {
  183. let obj = this
  184. aliInfo().then(e=>{
  185. console.log(e,'eeee');
  186. obj.alipay_code=e.data.zfb.payment
  187. obj.alipay_name=e.data.zfb.name
  188. obj.alipay_phone=e.data.zfb.phone
  189. });
  190. getUserInfo({})
  191. .then(({
  192. data
  193. }) => {
  194. console.log(data)
  195. this.setUserInfo(data);
  196. if (obj.from == 'purple') {
  197. obj.money = data.purple_integral
  198. }
  199. if (obj.from == 'shop') {
  200. obj.money = data.business_integral
  201. }
  202. obj.load = false
  203. })
  204. .catch(e => {
  205. console.log(e);
  206. });
  207. },
  208. // 跳转
  209. navTo(url) {
  210. uni.navigateTo({
  211. url: url
  212. });
  213. },
  214. // 切换选中对象
  215. tabRadio(e) {
  216. this.type = e.detail.value;
  217. },
  218. // 提交
  219. confirm() {
  220. if (this.load) {
  221. return
  222. }
  223. let zfbData= {
  224. phone:this.alipay_phone,
  225. type:2,
  226. payment:this.alipay_code,
  227. name:this.alipay_name
  228. }
  229. let data = {
  230. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  231. money: this.withdrawal, //金额
  232. type: this.from == 'purple' ? 1 : 2 //0佣金1余额 1紫积分 2商家积分
  233. };
  234. // if (this.withdrawal % 100 != 0) {
  235. // uni.showToast({
  236. // title: '提现金额为100的倍数',
  237. // duration: 2000,
  238. // mask: false,
  239. // icon: 'none'
  240. // });
  241. // return;
  242. // }
  243. if (this.withdrawal < this.minPrice) {
  244. uni.showToast({
  245. title: '提现金额不可少于' + this.minPrice,
  246. duration: 2000,
  247. mask: false,
  248. icon: 'none'
  249. });
  250. return;
  251. }
  252. if (this.type == 'alipay') {
  253. console.log('alipay');
  254. data.name = this.alipay_name;
  255. data.alipay_code = this.alipay_code;
  256. zfbData.phone=this.alipay_phone;
  257. }
  258. if (this.type == 'bank') {
  259. data.name = this.bank_people;
  260. data.bankname = this.bank_name;
  261. data.cardnum = this.bank_code;
  262. }
  263. this.load = true
  264. getMoneyType(zfbData)
  265. .then(e => {
  266. console.log(e,"eeeeee");
  267. // uni.showToast({
  268. // title: '修改成功',
  269. // duration: 2000,
  270. // position: 'top'
  271. // });
  272. // setTimeout(() => {
  273. // uni.navigateBack({
  274. // url:'pages/user/shopJf'
  275. // })
  276. // },1500)
  277. this.$api.prePage().dataUp()
  278. })
  279. .catch(e => {
  280. console.log(e);
  281. });
  282. extractCash(data)
  283. .then(e => {
  284. console.log(e,'eeeeee');
  285. this.loadData()
  286. uni.showToast({
  287. title: '提交成功',
  288. duration: 2000,
  289. position: 'top'
  290. });
  291. })
  292. .catch(e => {
  293. this.load = false
  294. console.log();
  295. });
  296. }
  297. }
  298. };
  299. </script>
  300. <style lang="scss">
  301. page {
  302. height: 100%;
  303. }
  304. .content-money {
  305. padding: 30rpx 0;
  306. background: #ffffff;
  307. }
  308. .flex {
  309. background-color: #ffffff;
  310. text-align: center;
  311. margin: 0 30rpx;
  312. border-radius: $border-radius-sm;
  313. .buttom {
  314. font-size: $font-lg;
  315. width: 50%;
  316. }
  317. .interval {
  318. width: 2px;
  319. height: 60rpx;
  320. background-color: #eeeeee;
  321. }
  322. .icon {
  323. background-size: 100%;
  324. font-size: 42rpx;
  325. color: $font-color-dark;
  326. font-weight: bold;
  327. background-repeat: no-repeat;
  328. background-position: center;
  329. }
  330. .text {
  331. color: $font-color-light;
  332. }
  333. }
  334. .row-box {
  335. margin-top: 30rpx;
  336. padding: 20rpx 30rpx;
  337. background: #fff;
  338. .title {
  339. font-size: $font-base + 2rpx;
  340. color: $font-color-dark;
  341. }
  342. .row {
  343. display: flex;
  344. align-items: center;
  345. position: relative;
  346. height: 80rpx;
  347. .tit {
  348. flex-shrink: 0;
  349. width: 40rpx;
  350. font-size: 30rpx;
  351. color: $font-color-dark;
  352. }
  353. .input {
  354. flex: 1;
  355. font-size: 30rpx;
  356. color: $font-color-dark;
  357. }
  358. .iconlocation {
  359. font-size: 36rpx;
  360. color: $font-color-light;
  361. }
  362. .buttom {
  363. color: #ff0060;
  364. font-size: $font-base;
  365. }
  366. }
  367. }
  368. .add-btn {
  369. &.modified {
  370. color: #ffffff;
  371. }
  372. &.up {
  373. background: linear-gradient(90deg, #ff0060, #ff0060);
  374. color: #fff;
  375. }
  376. display: flex;
  377. align-items: center;
  378. justify-content: center;
  379. width: 690rpx;
  380. height: 80rpx;
  381. margin: 0 auto;
  382. margin-top: 30rpx;
  383. font-size: $font-lg;
  384. border-radius: 10rpx;
  385. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  386. }
  387. .list {
  388. padding-left: 30rpx;
  389. margin-top: 30rpx;
  390. background-color: #ffffff;
  391. .box {
  392. display: flex;
  393. align-items: center;
  394. width: 100%;
  395. height: 120rpx;
  396. border-bottom: 1px solid $border-color-light;
  397. .icon {
  398. font-size: 48rpx;
  399. padding-right: 20rpx;
  400. .icon-img {
  401. height: 50rpx;
  402. width: 50rpx;
  403. }
  404. }
  405. .iconweixin1 {
  406. color: #18bf16;
  407. }
  408. .iconzhifubao {
  409. color: #08aaec;
  410. }
  411. .title-box {
  412. flex-grow: 1;
  413. text-align: left;
  414. .title {
  415. font-size: $font-base + 2rpx;
  416. color: $font-color-base;
  417. }
  418. .node {
  419. font-size: $font-sm;
  420. color: $font-color-light;
  421. }
  422. }
  423. }
  424. }
  425. /deep/ .uni-radio-input {
  426. width: 45rpx;
  427. height: 45rpx;
  428. }
  429. .row {
  430. display: flex;
  431. align-items: center;
  432. position: relative;
  433. padding: 0 30upx;
  434. height: 110upx;
  435. background: #fff;
  436. .tit {
  437. flex-shrink: 0;
  438. width: 250upx;
  439. font-size: 30upx;
  440. color: $font-color-dark;
  441. }
  442. .input {
  443. flex: 1;
  444. font-size: 30upx;
  445. color: $font-color-dark;
  446. }
  447. .iconlocation {
  448. font-size: 36upx;
  449. color: $font-color-light;
  450. }
  451. }
  452. .tip {
  453. padding: 20rpx;
  454. color: #fd3b39;
  455. }
  456. .loading {
  457. background: #999;
  458. }
  459. </style>