withdrawal.vue 8.0 KB

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