withdrawal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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="'最低提现金额' + minPrice + '元'" 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"><text>提现至支付宝</text></view>
  44. </view>
  45. <view class="right"><radio value="alipay" color="#5dbc7c" :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"><text>提现至银行卡</text></view>
  53. </view>
  54. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  55. </view>
  56. </label>
  57. <!-- <label>
  58. <view class="box">
  59. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  60. <view class="title-box">
  61. <view class="title">
  62. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  63. <text v-else>请创建银行账号</text>
  64. </view>
  65. <view class="node">
  66. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  67. </view>
  68. </view>
  69. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  70. </view>
  71. </label> -->
  72. </radio-group>
  73. </view>
  74. <view class="row b-b" v-if="type == 'weixin'">
  75. <text class="tit">微信号</text>
  76. <input class="input" type="text" v-model="wiexin" placeholder="请输入微信号" placeholder-class="placeholder" />
  77. </view>
  78. <view class="row b-b" v-if="type == 'weixin'">
  79. <text class="tit">真实姓名</text>
  80. <input class="input" type="text" v-model="wiexin_name" placeholder="请输入真实姓名" placeholder-class="placeholder" />
  81. </view>
  82. <view class="box-item1" v-if="type == 'weixin'">
  83. <view class="item-left">微信收款码:</view>
  84. <view class="item-right">
  85. <image :src="img_wei" mode="" class="upload-img" @click.stop="imgsubW" v-if="img_wei"></image>
  86. <image src="../../static/img/phone.png" class="upload-img" mode="" v-if="!img_wei" @click.stop="imgsubW"></image>
  87. </view>
  88. </view>
  89. <view class="row b-b" v-if="type == 'alipay'">
  90. <text class="tit">支付宝账号</text>
  91. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号" placeholder-class="placeholder" />
  92. </view>
  93. <view class="row b-b" v-if="type == 'alipay'">
  94. <text class="tit">支付宝姓名</text>
  95. <input class="input" type="text" v-model="alipay_name" placeholder="请输入支付宝姓名" placeholder-class="placeholder" />
  96. </view>
  97. <view class="row b-b" v-if="type == 'bank'">
  98. <text class="tit">银行卡号</text>
  99. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号" placeholder-class="placeholder" />
  100. </view>
  101. <view class="row b-b" v-if="type == 'bank'">
  102. <text class="tit">姓名</text>
  103. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名" placeholder-class="placeholder" />
  104. </view>
  105. <view class="row b-b" v-if="type == 'bank'">
  106. <text class="tit">所属银行</text>
  107. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行" placeholder-class="placeholder" />
  108. </view>
  109. <button class="add-btn up" @click="confirm">提交申请</button>
  110. </view>
  111. </template>
  112. <script>
  113. import { getMoneyStyle } from '@/utils/rocessor.js';
  114. import { extractCash, extractBank } from '@/api/wallet.js';
  115. import { uploads } from '@/api/user.js';
  116. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  117. export default {
  118. filters: {
  119. getMoneyStyle
  120. },
  121. components: {
  122. uniNoticeBar
  123. },
  124. data() {
  125. return {
  126. type: 'alipay', //提现方式
  127. money: '0.00', //可提现金额
  128. freeze: '0.0', //冻结金额
  129. withdrawal: '', //提现金额
  130. minPrice: '', //最少提现金额
  131. wiexin: '',
  132. wiexin_name:'',//真实姓名
  133. alipay_name: '', //支付宝姓名
  134. alipay_code: '', //支付宝账号
  135. img: '' ,//支付宝收款码
  136. img_wei:'',//微信收款码
  137. bank_people:'',//银行卡姓名
  138. bank_code:'',//银行卡号
  139. bank_name:'',//银行姓名
  140. exchange:'',//转化率
  141. };
  142. },
  143. computed:{
  144. realMoney(){
  145. return (this.withdrawal * this.exchange).toFixed(2)
  146. },
  147. integral(){
  148. return (this.withdrawal * (1 - this.exchange)).toFixed(2)
  149. }
  150. },
  151. onLoad(options) {
  152. // #ifdef H5
  153. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  154. // #endif
  155. //加载提现信息
  156. this.loadData();
  157. },
  158. methods: {
  159. // 加载余额信息
  160. async loadData() {
  161. extractBank({}).then(({ data }) => {
  162. this.money = data.brokerage_price; //可提现余额
  163. this.minPrice = data.minPrice; //最小提现
  164. this.freeze = data.extractPriceCount; //提现中的余额
  165. this.exchange = data.real_get_ratio / 100;
  166. });
  167. },
  168. // 跳转
  169. navTo(url) {
  170. uni.navigateTo({
  171. url: url
  172. });
  173. },
  174. // 切换选中对象
  175. tabRadio(e) {
  176. this.type = e.detail.value;
  177. console.log(this.type)
  178. },
  179. imgsub() {
  180. console.log(1111)
  181. uploads({
  182. filename: ''
  183. }).then(data => {
  184. console.log('data', data);
  185. this.img = data[0].url;
  186. });
  187. },
  188. imgsubW() {
  189. uploads({
  190. filename: ''
  191. }).then(data => {
  192. console.log('data', data);
  193. this.img_wei = data[0].url;
  194. });
  195. },
  196. // 提交
  197. confirm() {
  198. const obj = this;
  199. let data ={}
  200. this.withdrawal = 1 * this.withdrawal
  201. if(this.type == 'weixin'){
  202. data = {
  203. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  204. weixin: this.wiexin,
  205. img:this.img_wei,
  206. name:this.wiexin_name,
  207. money: this.withdrawal, //金额
  208. money_type: 1 //0佣金1余额
  209. };
  210. }
  211. if(this.type == 'alipay'){
  212. if(this.alipay_code == ''){
  213. obj.$api.msg('请输入支付宝账号')
  214. return
  215. }
  216. if(this.alipay_name == ''){
  217. obj.$api.msg('请输入支付宝姓名')
  218. return
  219. }
  220. data = {
  221. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  222. name:this.alipay_name,
  223. alipay_code:this.alipay_code,
  224. // img:this.img,
  225. money: this.withdrawal, //金额
  226. money_type: 1 //0佣金1余额
  227. };
  228. }
  229. if(this.type == 'bank') {
  230. if(this.bank_code == ''){
  231. obj.$api.msg('请输入银行卡卡号')
  232. return
  233. }
  234. if(this.bank_people == ''){
  235. obj.$api.msg('请输入银行卡姓名')
  236. return
  237. }
  238. if(this.bank_name == ''){
  239. obj.$api.msg('请输入所属银行')
  240. return
  241. }
  242. data = {
  243. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  244. name: this.bank_people,
  245. bankname: this.bank_name,
  246. cardnum: this.bank_code,
  247. // img:this.img,
  248. money: this.withdrawal, //金额
  249. money_type: 1 //0佣金1余额
  250. };
  251. }
  252. console.log(data)
  253. extractCash(data)
  254. .then(e => {
  255. uni.showToast({
  256. title: '提交成功',
  257. duration: 2000,
  258. position: 'top'
  259. });
  260. this.withdrawal = '';
  261. this.wiexin = '';
  262. this.loadData();
  263. })
  264. .catch(e => {
  265. console.log();
  266. });
  267. }
  268. }
  269. };
  270. </script>
  271. <style lang="scss">
  272. page {
  273. height: 100%;
  274. }
  275. .content-money {
  276. padding: 30rpx 0;
  277. background: #ffffff;
  278. }
  279. .row {
  280. display: flex;
  281. align-items: center;
  282. position: relative;
  283. padding: 0 30upx;
  284. height: 110upx;
  285. background: #fff;
  286. .tit {
  287. flex-shrink: 0;
  288. width: 250upx;
  289. font-size: 30upx;
  290. color: $font-color-dark;
  291. }
  292. .input {
  293. flex: 1;
  294. font-size: 30upx;
  295. color: $font-color-dark;
  296. }
  297. .iconlocation {
  298. font-size: 36upx;
  299. color: $font-color-light;
  300. }
  301. }
  302. .flex {
  303. background-color: #ffffff;
  304. text-align: center;
  305. margin: 0 30rpx;
  306. border-radius: $border-radius-sm;
  307. .buttom {
  308. font-size: $font-lg;
  309. width: 50%;
  310. }
  311. .interval {
  312. width: 2px;
  313. height: 60rpx;
  314. background-color: #eeeeee;
  315. }
  316. .icon {
  317. background-size: 100%;
  318. font-size: 42rpx;
  319. color: $font-color-dark;
  320. font-weight: bold;
  321. background-repeat: no-repeat;
  322. background-position: center;
  323. }
  324. .text {
  325. color: $font-color-light;
  326. }
  327. }
  328. .row-box {
  329. margin-top: 30rpx;
  330. padding: 20rpx 30rpx;
  331. background: #fff;
  332. .title {
  333. font-size: $font-base + 2rpx;
  334. color: $font-color-dark;
  335. }
  336. .row {
  337. display: flex;
  338. align-items: center;
  339. position: relative;
  340. height: 80rpx;
  341. .tit {
  342. flex-shrink: 0;
  343. width: 40rpx;
  344. font-size: 30rpx;
  345. color: $font-color-dark;
  346. }
  347. .input {
  348. flex: 1;
  349. font-size: 30rpx;
  350. color: $font-color-dark;
  351. }
  352. .iconlocation {
  353. font-size: 36rpx;
  354. color: $font-color-light;
  355. }
  356. .buttom {
  357. color: $font-color-spec;
  358. font-size: $font-base;
  359. }
  360. }
  361. .tip {
  362. color: #ff0000;
  363. font-size: 28rpx;
  364. padding: 10rpx 10rpx 10rpx 20rpx;
  365. }
  366. }
  367. .add-btn {
  368. &.modified {
  369. color: $base-color;
  370. }
  371. &.up {
  372. background-color: $base-color;
  373. color: #fff;
  374. }
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. width: 690rpx;
  379. height: 80rpx;
  380. margin: 0 auto;
  381. margin-top: 30rpx;
  382. font-size: $font-lg;
  383. border-radius: 10rpx;
  384. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  385. }
  386. .list {
  387. padding: 0rpx 30rpx;
  388. background-color: #ffffff;
  389. .box {
  390. display: flex;
  391. align-items: center;
  392. width: 100%;
  393. height: 120rpx;
  394. border-bottom: 1px solid $border-color-light;
  395. .icon {
  396. font-size: 48rpx;
  397. padding-right: 20rpx;
  398. .icon-img {
  399. height: 50rpx;
  400. width: 50rpx;
  401. }
  402. }
  403. .iconweixin1 {
  404. color: #18bf16;
  405. }
  406. .iconzhifubao {
  407. color: #08aaec;
  408. }
  409. .title-box {
  410. flex-grow: 1;
  411. text-align: left;
  412. .title {
  413. font-size: $font-base + 2rpx;
  414. color: $font-color-base;
  415. }
  416. .node {
  417. font-size: $font-sm;
  418. color: $font-color-light;
  419. }
  420. }
  421. }
  422. }
  423. .box-item1 {
  424. display: flex;
  425. padding: 32rpx 24rpx;
  426. background-color: #FFFFFF;
  427. .item-left{
  428. font-size: 28rpx;
  429. width: 160rpx;
  430. flex-shrink: 0;
  431. }
  432. .item-right{
  433. width: 100%;
  434. margin-left: 24rpx;
  435. font-size: 28rpx;
  436. display: flex;
  437. align-items: center;
  438. color: #999999;
  439. input{
  440. font-size: 28rpx;
  441. }
  442. image{
  443. width: 160rpx;
  444. height: 160rpx;
  445. margin-top: 24rpx;
  446. margin-left: 60rpx;
  447. }
  448. }
  449. }
  450. /deep/ .uni-radio-input {
  451. width: 45rpx;
  452. height: 45rpx;
  453. }
  454. </style>