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