withdrawal.vue 7.5 KB

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