withdrawal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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. obj.bank_code = e.data.bank.payment;
  158. obj.bank_people = e.data.bank.name;
  159. obj.bank_name = e.data.bank.bank;
  160. });
  161. getUserInfo({})
  162. .then(({ data }) => {
  163. console.log(data);
  164. this.setUserInfo(data);
  165. if (obj.from == 'purple') {
  166. obj.money = data.white_integral;
  167. }
  168. if (obj.from == 'shop') {
  169. obj.money = data.business_integral;
  170. }
  171. obj.load = false;
  172. })
  173. .catch(e => {
  174. console.log(e);
  175. });
  176. },
  177. // 跳转
  178. navTo(url) {
  179. uni.navigateTo({
  180. url: url
  181. });
  182. },
  183. // 切换选中对象
  184. tabRadio(e) {
  185. this.type = e.detail.value;
  186. },
  187. // 提交
  188. confirm() {
  189. if (this.load) {
  190. return;
  191. }
  192. let data = {
  193. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  194. money: this.withdrawal, //金额
  195. type: this.from == 'purple' ? 1 : 2 //0佣金1余额 1紫积分 2商家积分
  196. };
  197. if (this.withdrawal % 100 != 0) {
  198. uni.showToast({
  199. title: '提现金额为100的倍数',
  200. duration: 2000,
  201. mask: false,
  202. icon: 'none'
  203. });
  204. return;
  205. }
  206. if (this.withdrawal < this.minPrice) {
  207. uni.showToast({
  208. title: '提现金额不可少于' + this.minPrice,
  209. duration: 2000,
  210. mask: false,
  211. icon: 'none'
  212. });
  213. return;
  214. }
  215. if (this.type == 'alipay') {
  216. console.log('alipay');
  217. data.name = this.alipay_name;
  218. data.alipay_code = this.alipay_code;
  219. }
  220. if (this.type == 'bank') {
  221. data.name = this.bank_people;
  222. data.bankname = this.bank_name;
  223. data.cardnum = this.bank_code;
  224. }
  225. let zfbData = {
  226. type: 2,
  227. payment: this.alipay_code,
  228. name: this.alipay_name
  229. };
  230. let bankData = {
  231. type: 3,
  232. payment: this.bank_code,
  233. name: this.bank_people,
  234. bank: this.bank_name
  235. };
  236. let scdata = '';
  237. if (this.type == 'bank') {
  238. scdata = bankData;
  239. }
  240. if (this.type == 'alipay') {
  241. scdata = zfbData;
  242. }
  243. this.load = true;
  244. getMoneyType(scdata)
  245. .then(e => {
  246. console.log(e, 'eeeeee');
  247. this.$api.prePage().dataUp();
  248. })
  249. .catch(e => {
  250. console.log(e);
  251. });
  252. extractCash(data)
  253. .then(e => {
  254. this.loadData();
  255. uni.showToast({
  256. title: '提交成功',
  257. duration: 2000,
  258. position: 'top'
  259. });
  260. })
  261. .catch(e => {
  262. this.load = false;
  263. console.log();
  264. });
  265. }
  266. }
  267. };
  268. </script>
  269. <style lang="scss">
  270. page {
  271. height: 100%;
  272. }
  273. .content-money {
  274. padding: 30rpx 0;
  275. background: #ffffff;
  276. }
  277. .flex {
  278. background-color: #ffffff;
  279. text-align: center;
  280. margin: 0 30rpx;
  281. border-radius: $border-radius-sm;
  282. .buttom {
  283. font-size: $font-lg;
  284. width: 50%;
  285. }
  286. .interval {
  287. width: 2px;
  288. height: 60rpx;
  289. background-color: #eeeeee;
  290. }
  291. .icon {
  292. background-size: 100%;
  293. font-size: 42rpx;
  294. color: $font-color-dark;
  295. font-weight: bold;
  296. background-repeat: no-repeat;
  297. background-position: center;
  298. }
  299. .text {
  300. color: $font-color-light;
  301. }
  302. }
  303. .row-box {
  304. margin-top: 30rpx;
  305. padding: 20rpx 30rpx;
  306. background: #fff;
  307. .title {
  308. font-size: $font-base + 2rpx;
  309. color: $font-color-dark;
  310. }
  311. .row {
  312. display: flex;
  313. align-items: center;
  314. position: relative;
  315. height: 80rpx;
  316. .tit {
  317. flex-shrink: 0;
  318. width: 40rpx;
  319. font-size: 30rpx;
  320. color: $font-color-dark;
  321. }
  322. .input {
  323. flex: 1;
  324. font-size: 30rpx;
  325. color: $font-color-dark;
  326. }
  327. .iconlocation {
  328. font-size: 36rpx;
  329. color: $font-color-light;
  330. }
  331. .buttom {
  332. color: #ff0060;
  333. font-size: $font-base;
  334. }
  335. }
  336. }
  337. .add-btn {
  338. &.modified {
  339. color: #ffffff;
  340. }
  341. &.up {
  342. background: linear-gradient(90deg, #ff0060, #ff0060);
  343. color: #fff;
  344. }
  345. display: flex;
  346. align-items: center;
  347. justify-content: center;
  348. width: 690rpx;
  349. height: 80rpx;
  350. margin: 0 auto;
  351. margin-top: 30rpx;
  352. font-size: $font-lg;
  353. border-radius: 10rpx;
  354. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  355. }
  356. .list {
  357. padding-left: 30rpx;
  358. margin-top: 30rpx;
  359. background-color: #ffffff;
  360. .box {
  361. display: flex;
  362. align-items: center;
  363. width: 100%;
  364. height: 120rpx;
  365. border-bottom: 1px solid $border-color-light;
  366. .icon {
  367. font-size: 48rpx;
  368. padding-right: 20rpx;
  369. .icon-img {
  370. height: 50rpx;
  371. width: 50rpx;
  372. }
  373. }
  374. .iconweixin1 {
  375. color: #18bf16;
  376. }
  377. .iconzhifubao {
  378. color: #08aaec;
  379. }
  380. .title-box {
  381. flex-grow: 1;
  382. text-align: left;
  383. .title {
  384. font-size: $font-base + 2rpx;
  385. color: $font-color-base;
  386. }
  387. .node {
  388. font-size: $font-sm;
  389. color: $font-color-light;
  390. }
  391. }
  392. }
  393. }
  394. /deep/ .uni-radio-input {
  395. width: 45rpx;
  396. height: 45rpx;
  397. }
  398. .row {
  399. display: flex;
  400. align-items: center;
  401. position: relative;
  402. padding: 0 30upx;
  403. height: 110upx;
  404. background: #fff;
  405. .tit {
  406. flex-shrink: 0;
  407. width: 250upx;
  408. font-size: 30upx;
  409. color: $font-color-dark;
  410. }
  411. .input {
  412. flex: 1;
  413. font-size: 30upx;
  414. color: $font-color-dark;
  415. }
  416. .iconlocation {
  417. font-size: 36upx;
  418. color: $font-color-light;
  419. }
  420. }
  421. .tip {
  422. padding: 20rpx;
  423. color: #fd3b39;
  424. }
  425. .loading {
  426. background: #999;
  427. }
  428. </style>