withdrawal.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="每月25号到月底可提现上月结算余额"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex ">
  6. <view class="buttom">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现金额</text>
  9. </view>
  10. <view class="interval"></view>
  11. <view class="buttom">
  12. <view class=" icon">{{ freeze | getMoneyStyle }}</view>
  13. <text class="text">待审核提现金额</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="row-box">
  18. <view class="title">提现金额</view>
  19. <view class="row">
  20. <text class="tit">¥</text>
  21. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + '50' + '元'" placeholder-class="placeholder" />
  22. <view class="buttom" @click="withdrawal = money">全部提现</view>
  23. </view>
  24. <view class="tip" v-if="withdrawal > 0">
  25. 实际到账{{ realMoney }},剩余{{ integral }}转化为消费补贴券
  26. </view>
  27. </view>
  28. <view class="list" >
  29. <radio-group @change="tabRadio">
  30. <!-- <label>
  31. <view class="box">
  32. <view class="icon iconfont iconweixin1"></view>
  33. <view class="title-box">
  34. <view class="title"><text>提现至微信</text></view>
  35. </view>
  36. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  37. </view>
  38. </label> -->
  39. <label>
  40. <view class="box">
  41. <view class="icon iconfont iconzhifubao"></view>
  42. <view class="title-box">
  43. <view class="title">
  44. <text v-if="aliData.fullname != null">提现至支付宝</text>
  45. <text v-else>请创建支付宝账号</text>
  46. </view>
  47. <view class="node">
  48. <text v-if="aliData.fullname != null">真实姓名({{ aliData.fullname }})</text>
  49. </view>
  50. </view>
  51. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  52. </view>
  53. </label>
  54. <label>
  55. <view class="box">
  56. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  57. <view class="title-box">
  58. <view class="title">
  59. <text v-if="bankData.bankno != null">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  60. <text v-else>请创建银行账号</text>
  61. </view>
  62. <view class="node">
  63. <text v-if="bankData.fullname != null">真实姓名({{ bankData.fullname}})</text>
  64. </view>
  65. </view>
  66. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  67. </view>
  68. </label>
  69. </radio-group>
  70. </view>
  71. <button class="add-btn up" @click="confirm">提交申请</button>
  72. <button class="add-btn modified" @click="navTo('/pages/collection/collection')">账号管理</button>
  73. </view>
  74. </template>
  75. <script>
  76. import { getMoneyStyle } from '@/utils/rocessor.js';
  77. import { extractCash, extractBank } from '@/api/wallet.js';
  78. import { uploads } from '@/api/user.js';
  79. import { mapState, mapMutations } from 'vuex';
  80. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  81. export default {
  82. filters: {
  83. getMoneyStyle
  84. },
  85. components: {
  86. uniNoticeBar
  87. },
  88. data() {
  89. return {
  90. type: 'alipay', //提现方式
  91. money: '0.00', //可提现金额
  92. freeze: '0.0', //冻结金额
  93. withdrawal: '', //提现金额
  94. minPrice: '', //最少提现金额
  95. aliData: {fullname:'',alino:''},
  96. bankData: {fullname:'',bank:'',bankno:''},
  97. exchange:'',//转化率
  98. };
  99. },
  100. computed:{
  101. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  102. realMoney(){
  103. return (this.withdrawal * this.exchange).toFixed(2)
  104. },
  105. integral(){
  106. return (this.withdrawal * (1 - this.exchange)).toFixed(2)
  107. }
  108. },
  109. onLoad(options) {
  110. // #ifdef H5
  111. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  112. // #endif
  113. //加载提现信息
  114. this.loadData();
  115. },
  116. onShow(options) {
  117. // #ifdef H5
  118. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  119. // #endif
  120. //加载提现信息
  121. this.loadData();
  122. // 加载提款账号信息
  123. this.aliData.fullname = this.userInfo.alipay_name;
  124. console.log(this.aliData.fullname);
  125. this.aliData.alino = this.userInfo.alipay_code
  126. this.bankData.fullname = this.userInfo.bank_user_name;
  127. this.bankData.bank = this.userInfo.bank_name;
  128. this.bankData.bankno = this.userInfo.bank_code;
  129. },
  130. methods: {
  131. // 加载余额信息
  132. async loadData() {
  133. extractBank({}).then(({ data }) => {
  134. this.money = data.brokerage_price; //可提现余额
  135. this.minPrice = data.minPrice; //最小提现
  136. this.freeze = data.extractPriceCount; //提现中的余额
  137. this.exchange = data.real_get_ratio / 100;
  138. });
  139. },
  140. // 跳转
  141. navTo(url) {
  142. uni.navigateTo({
  143. url: url
  144. });
  145. },
  146. // 切换选中对象
  147. tabRadio(e) {
  148. this.type = e.detail.value;
  149. console.log(this.type)
  150. },
  151. imgsub() {
  152. console.log(1111)
  153. uploads({
  154. filename: ''
  155. }).then(data => {
  156. console.log('data', data);
  157. this.img = data[0].url;
  158. });
  159. },
  160. imgsubW() {
  161. uploads({
  162. filename: ''
  163. }).then(data => {
  164. console.log('data', data);
  165. this.img_wei = data[0].url;
  166. });
  167. },
  168. // 提交
  169. confirm() {
  170. console.log(this.withdrawal);
  171. if(this.withdrawal === ''){
  172. this.$api.msg("请填写需要提现的佣金")
  173. return
  174. }
  175. if(this.withdrawal == 0){
  176. this.$api.msg("提现佣金不能为0")
  177. return
  178. }
  179. if(this.withdrawal < 50){
  180. this.$api.msg("提现金额不能低于最小金额")
  181. return
  182. }
  183. let data = {
  184. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  185. money: this.withdrawal, //金额
  186. money_type: "brokerage" //0佣金1余额
  187. };
  188. if (this.type == 'alipay') {
  189. data.name = this.aliData.fullname;
  190. data.alipay_code = this.aliData.alino;
  191. }
  192. if (this.type == 'bank') {
  193. data.name = this.bankData.fullname;
  194. data.bankname = this.bankData.bank;
  195. data.cardnum = this.bankData.bankno;
  196. }
  197. extractCash(data)
  198. .then(e => {
  199. uni.navigateTo({
  200. url:'/pages/money/success?type=1'
  201. })
  202. })
  203. .catch(e => {
  204. console.log();
  205. });
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss">
  211. page {
  212. height: 100%;
  213. }
  214. .content-money {
  215. padding: 30rpx 0;
  216. background: #ffffff;
  217. }
  218. .row {
  219. display: flex;
  220. align-items: center;
  221. position: relative;
  222. padding: 0 30upx;
  223. height: 110upx;
  224. background: #fff;
  225. .tit {
  226. flex-shrink: 0;
  227. width: 250upx;
  228. font-size: 30upx;
  229. color: $font-color-dark;
  230. }
  231. .input {
  232. flex: 1;
  233. font-size: 30upx;
  234. color: $font-color-dark;
  235. }
  236. .iconlocation {
  237. font-size: 36upx;
  238. color: $font-color-light;
  239. }
  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: $font-color-spec;
  297. font-size: $font-base;
  298. }
  299. }
  300. .tip {
  301. color: #ff0000;
  302. font-size: 28rpx;
  303. padding: 10rpx 10rpx 10rpx 20rpx;
  304. }
  305. }
  306. .add-btn {
  307. &.modified {
  308. color: $base-color;
  309. }
  310. &.up {
  311. background-color: $base-color;
  312. color: #fff;
  313. }
  314. display: flex;
  315. align-items: center;
  316. justify-content: center;
  317. width: 690rpx;
  318. height: 80rpx;
  319. margin: 0 auto;
  320. margin-top: 30rpx;
  321. font-size: $font-lg;
  322. border-radius: 10rpx;
  323. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  324. }
  325. .list {
  326. padding: 0rpx 30rpx;
  327. background-color: #ffffff;
  328. .box {
  329. display: flex;
  330. align-items: center;
  331. width: 100%;
  332. height: 120rpx;
  333. border-bottom: 1px solid $border-color-light;
  334. .icon {
  335. font-size: 48rpx;
  336. padding-right: 20rpx;
  337. .icon-img {
  338. height: 50rpx;
  339. width: 50rpx;
  340. }
  341. }
  342. .iconweixin1 {
  343. color: #18bf16;
  344. }
  345. .iconzhifubao {
  346. color: #08aaec;
  347. }
  348. .title-box {
  349. flex-grow: 1;
  350. text-align: left;
  351. .title {
  352. font-size: $font-base + 2rpx;
  353. color: $font-color-base;
  354. }
  355. .node {
  356. font-size: $font-sm;
  357. color: $font-color-light;
  358. }
  359. }
  360. }
  361. }
  362. .box-item1 {
  363. display: flex;
  364. padding: 32rpx 24rpx;
  365. background-color: #FFFFFF;
  366. .item-left{
  367. font-size: 28rpx;
  368. width: 160rpx;
  369. flex-shrink: 0;
  370. }
  371. .item-right{
  372. width: 100%;
  373. margin-left: 24rpx;
  374. font-size: 28rpx;
  375. display: flex;
  376. align-items: center;
  377. color: #999999;
  378. input{
  379. font-size: 28rpx;
  380. }
  381. image{
  382. width: 160rpx;
  383. height: 160rpx;
  384. margin-top: 24rpx;
  385. margin-left: 60rpx;
  386. }
  387. }
  388. }
  389. /deep/ .uni-radio-input {
  390. width: 45rpx;
  391. height: 45rpx;
  392. }
  393. </style>