withdrawal.vue 7.6 KB

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