withdrawal.vue 10.0 KB

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