withdrawal.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex ">
  5. <view class="buttom">
  6. <view class="icon">{{ money | getMoneyStyle }}</view>
  7. <text class="text">可转换金额</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">转换金额</view>
  13. <view class="row">
  14. <text class="tit">¥</text>
  15. <input class="input" type="number" v-model="withdrawal" placeholder="请输入消费券数量" placeholder-class="placeholder" />
  16. <view class="buttom" @click="withdrawal = money">全部转换</view>
  17. </view>
  18. </view>
  19. <button class="add-btn up" @click="confirm">提交申请</button>
  20. <view class="tip" v-if="withdrawal != 0">
  21. 实际到账{{ realmoney }}现金,{{ gy }}响亮积分
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { getMoneyStyle } from '@/utils/rocessor.js';
  27. import { exchangeCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  28. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  29. export default {
  30. filters: {
  31. getMoneyStyle
  32. },
  33. components: {
  34. uniNoticeBar
  35. },
  36. data() {
  37. return {
  38. type: 'weixin', //提现方式
  39. money: '0.00', //可提现金额
  40. withdrawal: '', //提现金额
  41. aliData: {},
  42. bankData: {},
  43. // #ifdef H5
  44. weichatBsrowser: false
  45. // #endif
  46. };
  47. },
  48. onLoad(options) {
  49. // #ifdef H5
  50. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  51. // #endif
  52. //加载提现信息
  53. this.loadData();
  54. // 加载提款账号信息
  55. this.loadAli();
  56. this.loadBank();
  57. },
  58. computed:{
  59. realmoney() {
  60. return (this.withdrawal * 0.7).toFixed(2) * 1
  61. },
  62. gy() {
  63. return (this.withdrawal * 0.3).toFixed(2) * 1
  64. }
  65. },
  66. methods: {
  67. // 更新数据
  68. dataUp(){
  69. this.loadAli();
  70. this.loadBank();
  71. },
  72. //加载数据
  73. async loadAli(source) {
  74. aliInfo({}).then(e => {
  75. this.aliData = e.data;
  76. });
  77. },
  78. // 加载银行卡信息
  79. async loadBank() {
  80. bankInfo({}).then(e => {
  81. this.bankData = e.data;
  82. });
  83. },
  84. // 加载余额信息
  85. async loadData() {
  86. extractBank({}).then(({ data }) => {
  87. this.money = data.commissionCount;//可提现余额
  88. this.minPrice = data.minPrice;//最小提现
  89. });
  90. },
  91. // 跳转
  92. navTo(url) {
  93. uni.navigateTo({
  94. url: url
  95. });
  96. },
  97. // 切换选中对象
  98. tabRadio(e) {
  99. this.type = e.detail.value;
  100. },
  101. // 提交
  102. confirm() {
  103. let data = {
  104. money: this.withdrawal, //金额
  105. }
  106. exchangeCash(data)
  107. .then(e => {
  108. uni.showToast({
  109. title: '提交成功',
  110. duration: 2000,
  111. position: 'top'
  112. });
  113. })
  114. .catch(e => {
  115. console.log();
  116. });
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="scss">
  122. page {
  123. height: 100%;
  124. }
  125. .content-money {
  126. padding: 30rpx 0;
  127. background: #ffffff;
  128. }
  129. .flex {
  130. background-color: #ffffff;
  131. text-align: center;
  132. margin: 0 30rpx;
  133. border-radius: $border-radius-sm;
  134. .buttom {
  135. width: 100%;
  136. text-align: center;
  137. font-size: $font-lg;
  138. }
  139. .interval {
  140. width: 2px;
  141. height: 60rpx;
  142. background-color: #eeeeee;
  143. }
  144. .icon {
  145. background-size: 100%;
  146. font-size: 42rpx;
  147. color: $font-color-dark;
  148. font-weight: bold;
  149. background-repeat: no-repeat;
  150. background-position: center;
  151. }
  152. .text {
  153. color: $font-color-light;
  154. }
  155. }
  156. .row-box {
  157. margin-top: 30rpx;
  158. padding: 20rpx 30rpx;
  159. background: #fff;
  160. .title {
  161. font-size: $font-base + 2rpx;
  162. color: $font-color-dark;
  163. }
  164. .row {
  165. display: flex;
  166. align-items: center;
  167. position: relative;
  168. height: 80rpx;
  169. .tit {
  170. flex-shrink: 0;
  171. width: 40rpx;
  172. font-size: 30rpx;
  173. color: $font-color-dark;
  174. }
  175. .input {
  176. flex: 1;
  177. font-size: 30rpx;
  178. color: $font-color-dark;
  179. }
  180. .iconlocation {
  181. font-size: 36rpx;
  182. color: $font-color-light;
  183. }
  184. .buttom {
  185. color: $font-color-spec;
  186. font-size: $font-base;
  187. }
  188. }
  189. }
  190. .add-btn {
  191. &.modified {
  192. color: $base-color;
  193. }
  194. &.up {
  195. background-color: $base-color;
  196. color: #fff;
  197. }
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. width: 690rpx;
  202. height: 80rpx;
  203. margin: 0 auto;
  204. margin-top: 30rpx;
  205. font-size: $font-lg;
  206. border-radius: 10rpx;
  207. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  208. }
  209. .list {
  210. padding-left: 30rpx;
  211. margin-top: 30rpx;
  212. background-color: #ffffff;
  213. .box {
  214. display: flex;
  215. align-items: center;
  216. width: 100%;
  217. height: 120rpx;
  218. border-bottom: 1px solid $border-color-light;
  219. .icon {
  220. font-size: 48rpx;
  221. padding-right: 20rpx;
  222. .icon-img {
  223. height: 50rpx;
  224. width: 50rpx;
  225. }
  226. }
  227. .iconweixin1 {
  228. color: #18bf16;
  229. }
  230. .iconzhifubao {
  231. color: #08aaec;
  232. }
  233. .title-box {
  234. flex-grow: 1;
  235. text-align: left;
  236. .title {
  237. font-size: $font-base + 2rpx;
  238. color: $font-color-base;
  239. }
  240. .node {
  241. font-size: $font-sm;
  242. color: $font-color-light;
  243. }
  244. }
  245. }
  246. }
  247. .tip {
  248. padding: 20rpx 40rpx;
  249. color: #FD3B39;
  250. }
  251. /deep/ .uni-radio-input {
  252. width: 45rpx;
  253. height: 45rpx;
  254. }
  255. </style>