withdrawal.vue 8.9 KB

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