withdrawal.vue 8.0 KB

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