withdrawal.vue 8.7 KB

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