withdrawal.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="content">
  3. <uni-notice-bar v-if="sxf != ''" single="true" :text="'提现手续费' + sxf + '%'"></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">{{ userInfo.point | 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>
  25. <view class="list">
  26. <radio-group @change="tabRadio">
  27. <!-- <label>
  28. <view class="box">
  29. <view class="icon iconfont iconweixin1"></view>
  30. <view class="title-box">
  31. <view class="title"><text>提现至微信</text></view>
  32. </view>
  33. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  34. </view>
  35. </label> -->
  36. <label>
  37. <view class="box">
  38. <view class="icon iconfont iconzhifubao"></view>
  39. <view class="title-box">
  40. <view class="title">
  41. <text v-if="aliData.fullname">提现至支付宝</text>
  42. <text v-else>请创建支付宝账号</text>
  43. </view>
  44. <view class="node">
  45. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  46. </view>
  47. </view>
  48. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  49. </view>
  50. </label>
  51. <label>
  52. <view class="box">
  53. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  54. <view class="title-box">
  55. <view class="title">
  56. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  57. <text v-else>请创建银行账号</text>
  58. </view>
  59. <view class="node">
  60. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  61. </view>
  62. </view>
  63. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  64. </view>
  65. </label>
  66. </radio-group>
  67. </view>
  68. <button class="add-btn up" @click="confirm">提交申请</button>
  69. <button class="add-btn modified" @click="navTo('/pages/money/account')">账号管理</button>
  70. </view>
  71. </template>
  72. <script>
  73. import { getMoneyStyle } from '@/utils/rocessor.js';
  74. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  75. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  76. import { mapState, mapMutations } from 'vuex';
  77. export default {
  78. filters: {
  79. getMoneyStyle
  80. },
  81. components: {
  82. uniNoticeBar
  83. },
  84. computed: {
  85. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  86. },
  87. data() {
  88. return {
  89. sxf: 0, //手续费
  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. };
  98. },
  99. onLoad(options) {
  100. //加载提现信息
  101. this.loadData();
  102. },
  103. onShow(options) {
  104. // #ifdef H5
  105. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  106. // #endif
  107. //加载提现信息
  108. this.loadData();
  109. // 加载提款账号信息
  110. this.aliData.fullname = this.userInfo.alipay_name;
  111. console.log(this.aliData.fullname);
  112. this.aliData.alino = this.userInfo.alipay_code;
  113. this.bankData.fullname = this.userInfo.bank_user_name;
  114. this.bankData.bank = this.userInfo.bank_name;
  115. this.bankData.bankno = this.userInfo.bank_code;
  116. },
  117. methods: {
  118. // 加载余额信息
  119. async loadData() {
  120. extractBank({}).then(({ data }) => {
  121. this.money = data.brokerage_price; //可提现余额
  122. this.minPrice = data.minPrice; //最小提现
  123. this.freeze = data.extractPriceCount; //提现中的余额
  124. this.exchange = data.real_get_ratio / 100;
  125. this.sxf = data.extractCommission; //提现手续费
  126. });
  127. },
  128. // 跳转
  129. navTo(url) {
  130. uni.navigateTo({
  131. url: url
  132. });
  133. },
  134. // 切换选中对象
  135. tabRadio(e) {
  136. this.type = e.detail.value;
  137. console.log(this.type);
  138. },
  139. imgsub() {
  140. console.log(1111);
  141. uploads({
  142. filename: ''
  143. }).then(data => {
  144. console.log('data', data);
  145. this.img = data[0].url;
  146. });
  147. },
  148. imgsubW() {
  149. uploads({
  150. filename: ''
  151. }).then(data => {
  152. console.log('data', data);
  153. this.img_wei = data[0].url;
  154. });
  155. },
  156. // 提交
  157. confirm() {
  158. console.log(this.withdrawal);
  159. if (this.withdrawal === '') {
  160. this.$api.msg('请填写需要提现的佣金');
  161. return;
  162. }
  163. if (this.withdrawal == 0) {
  164. this.$api.msg('提现佣金不能为0');
  165. return;
  166. }
  167. if (this.withdrawal < 50) {
  168. this.$api.msg('提现金额不能低于最小金额');
  169. return;
  170. }
  171. let data = {
  172. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  173. money: this.withdrawal, //金额
  174. money_type: 'brokerage' //0佣金1余额
  175. };
  176. if (this.type == 'alipay') {
  177. data.name = this.aliData.fullname;
  178. data.alipay_code = this.aliData.alino;
  179. }
  180. if (this.type == 'bank') {
  181. data.name = this.bankData.fullname;
  182. data.bankname = this.bankData.bank;
  183. data.cardnum = this.bankData.bankno;
  184. }
  185. extractCash(data)
  186. .then(e => {
  187. uni.navigateTo({
  188. url: '/pages/money/success?type=1'
  189. });
  190. })
  191. .catch(e => {
  192. console.log();
  193. });
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="scss">
  199. page {
  200. height: 100%;
  201. }
  202. .content-money {
  203. padding: 30rpx 0;
  204. background: #ffffff;
  205. }
  206. .flex {
  207. background-color: #ffffff;
  208. text-align: center;
  209. margin: 0 30rpx;
  210. border-radius: $border-radius-sm;
  211. .buttom {
  212. font-size: $font-lg;
  213. width: 50%;
  214. }
  215. .interval {
  216. width: 2px;
  217. height: 60rpx;
  218. background-color: #eeeeee;
  219. }
  220. .icon {
  221. background-size: 100%;
  222. font-size: 42rpx;
  223. color: $font-color-dark;
  224. font-weight: bold;
  225. background-repeat: no-repeat;
  226. background-position: center;
  227. }
  228. .text {
  229. color: $font-color-light;
  230. }
  231. }
  232. .row-box {
  233. margin-top: 30rpx;
  234. padding: 20rpx 30rpx;
  235. background: #fff;
  236. .title {
  237. font-size: $font-base + 2rpx;
  238. color: $font-color-dark;
  239. }
  240. .row {
  241. display: flex;
  242. align-items: center;
  243. position: relative;
  244. height: 80rpx;
  245. .tit {
  246. flex-shrink: 0;
  247. width: 40rpx;
  248. font-size: 30rpx;
  249. color: $font-color-dark;
  250. }
  251. .input {
  252. flex: 1;
  253. font-size: 30rpx;
  254. color: $font-color-dark;
  255. }
  256. .iconlocation {
  257. font-size: 36rpx;
  258. color: $font-color-light;
  259. }
  260. .buttom {
  261. color: $font-color-spec;
  262. font-size: $font-base;
  263. }
  264. }
  265. }
  266. .add-btn {
  267. &.modified {
  268. color: $base-color;
  269. }
  270. &.up {
  271. background-color: $base-color;
  272. color: #fff;
  273. }
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. width: 690rpx;
  278. height: 80rpx;
  279. margin: 0 auto;
  280. margin-top: 30rpx;
  281. font-size: $font-lg;
  282. border-radius: 10rpx;
  283. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  284. }
  285. .list {
  286. padding-left: 30rpx;
  287. margin-top: 30rpx;
  288. background-color: #ffffff;
  289. .box {
  290. display: flex;
  291. align-items: center;
  292. width: 100%;
  293. height: 120rpx;
  294. border-bottom: 1px solid $border-color-light;
  295. .icon {
  296. font-size: 48rpx;
  297. padding-right: 20rpx;
  298. .icon-img {
  299. height: 50rpx;
  300. width: 50rpx;
  301. }
  302. }
  303. .iconweixin1 {
  304. color: #18bf16;
  305. }
  306. .iconzhifubao {
  307. color: #08aaec;
  308. }
  309. .title-box {
  310. flex-grow: 1;
  311. text-align: left;
  312. .title {
  313. font-size: $font-base + 2rpx;
  314. color: $font-color-base;
  315. }
  316. .node {
  317. font-size: $font-sm;
  318. color: $font-color-light;
  319. }
  320. }
  321. }
  322. }
  323. /deep/ .uni-radio-input {
  324. width: 45rpx;
  325. height: 45rpx;
  326. }
  327. .row {
  328. display: flex;
  329. align-items: center;
  330. position: relative;
  331. padding: 0 30upx;
  332. height: 110upx;
  333. background: #fff;
  334. .tit {
  335. flex-shrink: 0;
  336. width: 250upx;
  337. font-size: 30upx;
  338. color: $font-color-dark;
  339. }
  340. .input {
  341. flex: 1;
  342. font-size: 30upx;
  343. color: $font-color-dark;
  344. }
  345. .iconlocation {
  346. font-size: 36upx;
  347. color: $font-color-light;
  348. }
  349. }
  350. </style>