withdrawal.vue 7.0 KB

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