withdrawal.vue 9.4 KB

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