withdrawal.vue 8.4 KB

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