wangtao 3 роки тому
батько
коміт
3d2603ccc1

+ 53 - 53
package.json

@@ -1,56 +1,56 @@
 {
-  "name": "invitation",
-  "version": "0.1.0",
-  "private": true,
-  "scripts": {
-    "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint"
-  },
-  "dependencies": {
-    "core-js": "^3.6.5",
-    "element-ui": "^2.15.3",
-    "file-saver": "^2.0.5",
-    "vant": "^2.12.24",
-    "vue": "^2.6.11",
-    "vue-router": "^3.2.0",
-    "vuex": "^3.4.0",
-    "xlsx": "^0.17.0"
-  },
-  "devDependencies": {
-    "@vue/cli-plugin-babel": "~4.5.0",
-    "@vue/cli-plugin-eslint": "~4.5.0",
-    "@vue/cli-plugin-router": "~4.5.0",
-    "@vue/cli-plugin-vuex": "~4.5.0",
-    "@vue/cli-service": "~4.5.0",
-    "axios": "^0.18.0",
-    "babel-eslint": "^10.1.0",
-    "eslint": "^6.7.2",
-    "eslint-plugin-vue": "^6.2.2",
-    "node-sass": "^4.12.0",
-    "postcss-px-to-viewport": "^1.1.1",
-    "sass-loader": "^8.0.2",
-    "vue-cli-plugin-axios": "0.0.4",
-    "vue-cli-plugin-element": "~1.0.1",
-    "vue-template-compiler": "^2.6.11"
-  },
-  "eslintConfig": {
-    "root": true,
-    "env": {
-      "node": true
+
+    "version": "0.1.0",
+    "private": true,
+    "scripts": {
+        "serve": "vue-cli-service serve",
+        "build": "vue-cli-service build",
+        "lint": "vue-cli-service lint"
     },
-    "extends": [
-      "plugin:vue/essential",
-      "eslint:recommended"
-    ],
-    "parserOptions": {
-      "parser": "babel-eslint"
+    "dependencies": {
+        "core-js": "^3.6.5",
+        "element-ui": "^2.15.3",
+        "file-saver": "^2.0.5",
+        "vant": "^2.12.24",
+        "vue": "^2.6.11",
+        "vue-router": "^3.2.0",
+        "vuex": "^3.4.0",
+        "xlsx": "^0.17.0"
     },
-    "rules": {}
-  },
-  "browserslist": [
-    "> 1%",
-    "last 2 versions",
-    "not dead"
-  ]
-}
+    "devDependencies": {
+        "@vue/cli-plugin-babel": "~4.5.0",
+        "@vue/cli-plugin-eslint": "~4.5.0",
+        "@vue/cli-plugin-router": "~4.5.0",
+        "@vue/cli-plugin-vuex": "~4.5.0",
+        "@vue/cli-service": "~4.5.0",
+        "axios": "^0.18.0",
+        "babel-eslint": "^10.1.0",
+        "eslint": "^6.7.2",
+        "eslint-plugin-vue": "^6.2.2",
+        "node-sass": "^4.12.0",
+        "postcss-px-to-viewport": "^1.1.1",
+        "sass-loader": "^8.0.2",
+        "vue-cli-plugin-axios": "0.0.4",
+        "vue-cli-plugin-element": "~1.0.1",
+        "vue-template-compiler": "^2.6.11"
+    },
+    "eslintConfig": {
+        "root": true,
+        "env": {
+            "node": true
+        },
+        "extends": [
+            "plugin:vue/essential",
+            "eslint:recommended"
+        ],
+        "parserOptions": {
+            "parser": "babel-eslint"
+        },
+        "rules": {}
+    },
+    "browserslist": [
+        "> 1%",
+        "last 2 versions",
+        "not dead"
+    ]
+}

+ 1 - 1
src/assets/scss/common.scss

@@ -11,7 +11,7 @@
     color: #FFF;
     font-size: 18px;
     padding: 0 10px;
-    z-index: 9;
+    z-index: 1;
     .van-icon {
         float: left;
         line-height: 44px;

+ 1 - 0
src/main.js

@@ -8,6 +8,7 @@ import 'vant/lib/index.css';
 import './assets/scss/common.scss';
 import querystring from 'querystring';
 import './plugins/element.js'
+import './plugins/common';
 document.title = '东信充值'
 Vue.use(Vant);
 Vue.config.productionTip = false

+ 3 - 4
src/plugins/axios.js

@@ -3,9 +3,8 @@ import { Notify } from "vant";
 import Vue from 'vue';
 import axios from "axios";
 // Full config:  https://github.com/axios/axios#request-config
-axios.defaults.baseURL = 'http://172.16.120.104:8085/';
-// axios.defaults.baseURL = 'http://121.40.217.77:8084/';
-// axios.defaults.baseURL = 'https://121.40.217.77:8084/';
+axios.defaults.baseURL = 'https://wx.ewoogi.com/dxapi/';
+// axios.defaults.baseURL = 'http://124.71.174.104/dxapi/';
 console.log(axios.defaults.baseURL)
     // axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
     // axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
@@ -34,7 +33,7 @@ _axios.interceptors.request.use(
 _axios.interceptors.response.use(
     function(response) {
         // Do something with response data
-        console.log(response.data)
+        // console.log(response.data)
         if (!response.data.success) Notify({ type: 'danger', message: response.data.message })
         return response;
     },

+ 38 - 0
src/plugins/common.js

@@ -0,0 +1,38 @@
+import axios from "axios";
+//获取token
+export function getTokenApi(money, topPayType, payType) {
+    return axios.post('/login', { "username": "admin", "password": "admin123" })
+        .then(res => {
+            window.localStorage.setItem('token', res.data.token)
+            getPayApi(money, topPayType, payType)
+        }).catch(() => {})
+}
+
+//支付
+export function getPayApi(money, topPayType, payType) {
+    // alert(money)
+    // alert(topPayType)
+    // alert(payType)
+    // alert(window.localStorage.getItem('token'))
+    return axios.post('/dxtop/order/callUnifiedPay', { "money": money, "topPayType": topPayType, "payType": payType }, {
+        headers: {
+            "Authorization": window.localStorage.getItem('token') //token换成从缓存获取
+        }
+    }).then(res => {
+        alert(res.data.msg)
+        console.log(res)
+        window.location.href = res.data.msg
+    }).catch(() => {
+
+    })
+}
+// 充值记录、消费记录
+export function RechargeConsumption(api, startTime, endTime, current, size) {
+    return axios.post(`/dxtop/${api}/page`, { "startTime": startTime, "endTime": endTime, "current": current, "size": size })
+        .then(res => {
+            console.log(res)
+            return res
+        }).catch(() => {
+
+        })
+}

+ 75 - 4
src/views/amount/index.vue

@@ -1,5 +1,13 @@
 <template>
   <div class="mianBox">
+    <!-- <van-tabs @click="onClick" class="select_amount">
+      <van-tab title="50" name='50'></van-tab>
+      <van-tab title="100" name='100'></van-tab>
+      <van-tab title="150" name='150'></van-tab>
+      <van-tab title="200" name='200'></van-tab>
+      <van-tab title="250" name='250'></van-tab>
+      <van-tab title="300" name='300'></van-tab>
+    </van-tabs> -->
     <van-row class="balance">
       <van-col span="8">余额:32.00元</van-col>
     </van-row>
@@ -48,17 +56,22 @@
         我是充值说明提示文字我是充值说明提示文字我是充值说 明提示文字我是充值说明提示文字我是充值说明提示文字 我是充值说明提示文字。
     </van-row>
     <van-button class="amount" round type="danger" @click="recharge">立即充值</van-button>
+    <van-loading size="24px" v-if = "loading" vertical style="z-index:999999;position:fixed;top:40%;left:0;right:0;" >加载中...</van-loading>
+    <van-overlay :show="loading"  style="z-index:100;position:fixed"/>
   </div>
 </template>
 
 <script>
-import { Field, NumberKeyboard, Dialog } from "vant";
+import { Field, NumberKeyboard, Dialog, Toast } from "vant";
+import { getTokenApi, getPayApi } from '@/plugins/common'
 export default {
   data() {
     return {
       show: false,
+      loading: false,
       overlayShow: false,
       money: "0",
+      env:null, //识别是否为扫描用户进入,以便直接进入支付跳转
       state1:"color:#000;background: #ccc;",
       state2:"color:#000;background: #ccc;",
       state3:"color:#000;background: #ccc;",
@@ -78,8 +91,15 @@ export default {
     [Field.name]: Field,
     [NumberKeyboard.name]: NumberKeyboard,
     [Dialog.name]: Dialog,
+    [Toast.name]: Toast,
+  },
+  created(){
+    localStorage.clear()
   },
   methods: {
+    // onClick(name) {
+    //   Toast(name);
+    // },
     handleInput(key) {
       this.state1 = "color:#000;background: #ccc;",
       this.state2 = "color:#000;background: #ccc;",
@@ -114,16 +134,66 @@ export default {
       this.money = Number(this.money);
       this.overlayShow = false
     },
-    recharge(){
+    isWeixinOrAlipay(){
+      let ua = window.navigator.userAgent;
+      //判断是不是微信
+      if ( ua.indexOf("MicroMessenger") > 0 ) {  
+          this.env = "WeiXin"
+      }    
+      //判断是不是支付宝
+      if(ua.indexOf("Alipay") > 0) {
+        this.env = "Alipay" 
+      }
+    },
+    // async getTokenApi(){
+    //   await this.$axios.post('/login' ,{"username":"admin","password":"admin123"})
+    //     .then(res=>{
+    //         window.localStorage.setItem('token',res.data.token)
+    //         this.getPayApi(this.money)
+    //     }).catch(()=>{
+            
+    //     })
+    // },
+    // async getPayApi(money){
+    //   console.log(window.localStorage.getItem('token'))
+    //     await this.$axios.post('/dxtop/order/callUnifiedPay' , { "money":money,"topPayType":"A01","payType":'3'}
+    //     ,{
+    //       headers: {
+    //         "Authorization":window.localStorage.getItem('token')  //token换成从缓存获取
+    //       }
+    //     }).then(res=>{
+    //       window.location.href = res.data.msg
+    //     }).catch(()=>{
+          
+    //     })
+    // },
+    async pay(money, topPayType, payType){
+      this.loading = true
+      if(window.localStorage.getItem('token')){
+        getPayApi(money, topPayType, payType)
+      }else{
+        getTokenApi(money, topPayType, payType)
+      }
+    },
+    jumpMode(){
       if(this.money){
-        this.$router.push({path: '/recharge',query:{money:this.money}})
+        if(this.env){
+          alert(this.env)
+          this.pay(this.money, "A01", "3")
+          this.loading = false
+        }else{
+          this.$router.push({path: '/recharge',query:{money:this.money}})
+        }
       }else{
         Dialog.confirm({
           title: '提示',
           message: '充值金额不能为0元!'
         })
       }
-      
+    },
+    recharge(){
+      this.isWeixinOrAlipay()
+      this.jumpMode()
     },
     btn50() {
       this.state1 = "color:#fff;background:rgba(242, 46, 60, 1);",
@@ -232,6 +302,7 @@ export default {
       margin-left:8%
     }
   }
+ 
   
   .pay_money{
     font-size: 16px;

+ 53 - 42
src/views/recharge/index.vue

@@ -16,11 +16,14 @@
       <van-row>
         请选择微信、支付宝或云闪付进行充值。
       </van-row>
+      <van-loading size="24px" v-if = "loading" vertical style="z-index:999999;position:fixed;top:40%;left:0;right:0;" >加载中...</van-loading>
+      <van-overlay :show="loading"  style="z-index:100;position:fixed"/>
     </van-row>
   </div>
 </template>
 <script>
 import { Dialog, Notify } from "vant";
+import { getTokenApi, getPayApi } from '@/plugins/common'
 export default {
   components: {
     [Notify.Component.name]: Notify.Component,
@@ -29,59 +32,75 @@ export default {
   data() {
     return {
       iosApp: "",
-      token:'',
       url:'',
+      loading: false,
       money:null
     };
   },
   mounted() {
-    if (this.isWeixin()) {
-      this.iosApp = true;
-    } else {
-      //显示手动打开外置浏览器提示
-      this.iosApp = false;
-    }
+    // if (this.isWeixin()) {
+    //   this.iosApp = true;
+    // } else {
+    //   //显示手动打开外置浏览器提示
+    //   this.iosApp = false;
+    // }
   },
   created(){
     this.money = this.$route.query.money
   },
   methods: {
-    isWeixin() {
-      return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
+    // isWeixin() {
+    //   return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
+    // },
+    // async getTokenApi(){
+    //   await this.$axios.post('/login' ,{"username":"admin","password":"admin123"})
+    //     .then(res=>{
+    //         window.localStorage.setItem('token',res.data.token)
+    //         this.getPayApi(this.money)
+    //     }).catch(()=>{
+          
+    //     })
+    // },
+    // async getPayApi(money){
+    //     await this.$axios.post('/dxtop/order/callUnifiedPay' , { "money":money,"topPayType":"A01","payType":'3'}
+    //     ,{
+    //       headers: {
+    //         "Authorization":window.localStorage.getItem('token')  //token换成从缓存获取
+    //       }
+    //     }).then(res=>{
+    //       window.location.href = res.data.msg
+    //     }).catch(()=>{
+          
+    //     })
+    // },
+    async pay(money, topPayType, payType){
+      if(window.localStorage.getItem('token')){
+        getPayApi(money, topPayType, payType)
+      }else{
+        getTokenApi(money, topPayType, payType)
+      }
     },
     async openApp(url = "") {
-      console.log(url.app)
       if (!url) return;
+      this.loading = true
       //if (url.app === 'ysf') return Notify({ type: 'primary', message: '暂不可用' });
       //if (this.iosApp) return Notify({ type: 'primary', message: '请使用浏览器打开' });
       //非微信浏览器
-      
       window.navigator.userAgent.toLowerCase();
       if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
         if (url.app === 'alipayqr'){
-            let res1 = await this.$axios.post('http://172.16.120.104:8085/login' ,{"username":"admin","password":"admin123"}).then(res=>{
-              this.token = res.data.token
-              console.log(res1)
-            }).then(()=>{
-              let res2 = this.$axios.post('http://172.16.120.104:8085/dxtop/order/callUnifiedPay' , { "money":this.money,"topPayType":"A01","payType":'3'}
-              ,{
-                headers: {
-                  "Authorization":this.token  //token换成从缓存获取
-                }
-              }).then(res=>{
-                console.log(res2)
-                window.location.href = res.data.msg
-              })
-            })
-            
+          this.pay(this.money, "A01", "3")
+          this.loading = false
         }
         const loadDateTime = +new Date();
         window.setTimeout( ()=> {
           const timeOutDateTime = +new Date();
           if (timeOutDateTime - loadDateTime > 2000) {
             window.location.href = url.downI;
+            this.loading = false
           } else {
             window.close();
+            this.loading = false
             Dialog.confirm({
               title: '提示',
               message: '是否已完成充值?',
@@ -95,25 +114,13 @@ export default {
       } else if (navigator.userAgent.match(/android/i)) {
         try {
           if (url.app === 'alipayqr'){
-            let res1 = await this.$axios.post('http://172.16.120.104:8085/login' ,{"username":"admin","password":"admin123"}).then(res=>{
-              this.token = res.data.token
-              console.log(res1)
-            }).then(()=>{
-              let res2 = this.$axios.post('http://172.16.120.104:8085/dxtop/order/callUnifiedPay' , { "money":this.money,"topPayType":"A01","payType":'3'}
-              ,{
-                headers: {
-                  "Authorization":this.token  //token换成从缓存获取
-                }
-              }).then(res=>{
-                console.log(res2)
-                window.location.href = res.data.msg
-              })
-            })
-            
-        }
+            this.pay(this.money, "A01", "3")
+            this.loading = false
+          }
           window.location.href = this.url;
           setTimeout(function () {
             window.location.href = url.downA;
+            this.loading = false
           }, 500);
         } catch (e) {
           console.log(e)
@@ -158,6 +165,7 @@ export default {
         width: 86px;
         height: 86px;
         background-size: 100% 100%;
+        
       }
     }
     &>.van-row:nth-child(2){
@@ -167,4 +175,7 @@ export default {
     }
   }
 }
+.van-loading--vertical{
+  color:#fff
+}
 </style>

+ 197 - 0
src/views/record/index - 副本.vue

@@ -0,0 +1,197 @@
+<template>
+  <div class="mianBox">
+    <van-row class="headerBox">
+      <van-icon name="arrow-left" @click="$router.go(-1)" />
+      消费记录
+    </van-row>
+    <van-tabs v-model="active" class="type" color="red" line-width="60px"> 
+      <van-tab title="充值记录">
+        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+          <van-list
+            v-model="loading"
+            :finished="finished"
+            finished-text="没有更多了"
+            @load="onLoad"
+            :style="height"
+            line-width="60px"
+          >
+            <van-row class="listBoxCell" v-for="item in list" :key="item">
+                <van-col span="18">
+                    <van-row class="jlName">充值记录</van-row>
+                    <van-row class="jlTime">时间:2021-03-08 12:37</van-row>
+                </van-col>
+                <van-col span="6" class="jlMoney" :class="item%2?'just':'negative'">+200元</van-col>
+            </van-row>
+          </van-list>
+        </van-pull-refresh>
+      </van-tab>
+      <van-tab title="消费记录">
+        <van-dropdown-menu>
+          <van-dropdown-item title="筛选" ref="item" :options="option">
+            <van-cell center :title="item.text" v-for="(item, index) in list3" :key="index" > 
+              <template #right-icon >
+                <van-switch v-model="item.zt" size="24" active-color="#ee0a24" />
+              </template>
+            </van-cell>
+            <div style="padding: 5px 16px;">
+              <van-button type="danger" block round @click="onConfirm">
+                确认
+              </van-button>
+            </div>
+          </van-dropdown-item> 
+        </van-dropdown-menu>
+        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+          <van-list
+            v-model="loading"
+            :finished="finished"
+            finished-text="没有更多了"
+            @load="onLoad"
+            :style="height"
+          >
+            <van-row class="listBoxCell" v-for="item in list" :key="item">
+                <van-col span="18">
+                    <van-row class="jlName">充值记录</van-row>
+                    <van-row class="jlTime">时间:2021-03-08 12:37</van-row>
+                </van-col>
+                <van-col span="6" class="jlMoney" :class="item%2?'just':'negative'">+200元</van-col>
+            </van-row>
+          </van-list>
+        </van-pull-refresh>
+      </van-tab>
+    </van-tabs>
+    
+  </div>
+</template>
+
+<script>
+import {  Toast } from "vant";
+export default {
+  data() {
+    return {
+      list: [],
+      loading: false,
+      finished: false,
+      refreshing: false,
+      height:{
+        height:false
+      },
+      active: 1,
+      value: 0,
+      switch1: false,
+      switch2: false,
+      option: [
+        // { text: '全部商品', value: 0 },
+        // { text: '新款商品', value: 1 },
+        // { text: '活动商品', value: 2 },
+      ],
+      list2: [
+        { text: '餐饮1', id: 0 },
+        { text: '餐饮2', id: 1 },
+        { text: '餐饮3', id: 2 },
+      ],
+      list3: [
+        { text: '餐饮1', id: 0, zt: false },
+        { text: '餐饮2', id: 1, zt: false },
+        { text: '餐饮3', id: 2, zt: false },
+      ],
+      list4: []
+    };
+  },
+  components: {
+    [Toast.name]: Toast
+  },
+  created(){
+    this.height.height = (document.documentElement.clientHeight - 80) + 'px'
+    // let a =this.list2
+    // console.log(this.list2.length)
+    // for(let i = 0; i<this.list2.length; i ++){
+    //   a.push({k:1})
+    // }
+    // console.log(this.list4)
+  },
+  methods: {
+    onConfirm() {
+      let a = this.list3.filter(item=>item.zt == true)
+      let c =[]
+      if(a.length == 0){
+        Toast('至少选择一个筛选项');
+        // for(let b = 0; b<this.list3.length; b ++){
+        //   c.push(this.list3[b].id)
+        // }
+      }else{
+        for(let b = 0; b<a.length; b ++){
+          c.push(a[b].id)
+        }
+        this.$refs.item.toggle();
+      }
+      console.log(c)
+    },
+    onLoad() {
+      setTimeout(() => {
+        if (this.refreshing) {
+          this.list = [];
+          this.refreshing = false;
+        }
+        for (let i = 0; i < 10; i++) {
+          this.list.push(this.list.length + 1);
+        }
+        this.loading = false;
+        if (this.list.length >= 40) {
+          this.finished = true;
+        }
+      }, 1000);
+    },
+    onRefresh() {
+      // 清空列表数据
+      this.finished = false;
+
+      // 重新加载数据
+      // 将 loading 设置为 true,表示处于加载状态
+      this.loading = true;
+      this.onLoad();
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.mianBox {
+  width: 100vw;
+  padding-top: 44px;
+  height: 100vh;
+  color: #000;
+  box-sizing: border-box;
+  overflow-y: hidden;
+}
+.listBoxCell{
+  height: 75px;
+  width: 100%;
+  padding:0 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  border-bottom: 1px solid rgba(237,237,237,1);
+  .jlName{
+      font-size: 16px;
+      color: #000;
+  }
+  .jlTime{
+      margin-top: 10px;
+      font-size: 12px;
+      color: #ccc;
+  }
+  .jlMoney{
+      text-align: right;
+      font-size: 16px;
+  }
+  .jlMoney.just{
+      color: rgba(56,129,253,1); 
+  }
+  .jlMoney.negative{
+      color: rgba(242,46,60,1);
+  }
+}
+.van-list{
+  overflow-y: auto;
+}
+</style>

+ 162 - 62
src/views/record/index.vue

@@ -2,56 +2,150 @@
   <div class="mianBox">
     <van-row class="headerBox">
       <van-icon name="arrow-left" @click="$router.go(-1)" />
-      选择充值方式
+      消费记录
     </van-row>
-    <van-row class="contentBox">
-      <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
-        <van-list
-          v-model="loading"
-          :finished="finished"
-          finished-text="没有更多了"
-          @load="onLoad"
-        >
-            <van-row class="listBoxCell" v-for="item in list" :key="item">
+    <van-tabs v-model="active" class="type" color="red" line-width="60px"  @click="tab"> 
+      <van-tab title="充值记录">
+        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+          <van-list
+            v-model="loading"
+            :finished="finished"
+            finished-text="没有更多了"
+            @load="onLoad"
+            :style="height"
+            line-width="60px"
+          >
+            <van-row class="listBoxCell" v-for="(item,index) in recharge" :key="index">
                 <van-col span="18">
-                    <van-row class="jlName">充值记录</van-row>
-                    <van-row class="jlTime">时间:2021-03-08 12:37</van-row>
+                    <van-row class="jlName">{{item.type}}</van-row>
+                    <van-row class="jlTime">时间:{{item.createTime}}</van-row>
+                    <van-row class="jlBalance">余额:{{item.balance}}</van-row>
+                </van-col>
+                <van-col span="6" class="jlMoney" :class="item%2?'just':'negative'">+{{item.amt}}</van-col>
+            </van-row>
+          </van-list>
+        </van-pull-refresh>
+      </van-tab>
+      <van-tab title="消费记录">
+        
+        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+          <van-list
+            v-model="loading"
+            :finished="finished"
+            finished-text="没有更多了"
+            @load="onLoad"
+            :style="height"
+          >
+            <van-row class="listBoxCell" v-for="(item,index) in consumption" :key="index">
+                <van-col span="18">
+                    <van-row class="jlName">{{item.shopName}}</van-row>
+                    <van-row class="jlTime">时间:{{item.createTime}}</van-row>
                 </van-col>
                 <van-col span="6" class="jlMoney" :class="item%2?'just':'negative'">+200元</van-col>
             </van-row>
-        </van-list>
-      </van-pull-refresh>
-    </van-row>
+          </van-list>
+        </van-pull-refresh>
+      </van-tab>
+    </van-tabs>
+    <van-cell title="选择日期区间" :value="date" @click="show = true"   style="position: absolute;top:94px;left:0;z-index:10;"/>
+    <van-calendar v-model="show" type="range" @confirm="onConfirm"  :min-date="minDate" />
+    
   </div>
 </template>
 
 <script>
+import {  Toast } from "vant";
+import { RechargeConsumption } from '@/plugins/common'
 export default {
   data() {
     return {
-      list: [],
+      recharge: [],
+      consumption:[],
       loading: false,
-      finished: false,
-      refreshing: false,
+      finished: true,
+      refreshing: true,
+      height:{
+        height:false,
+        marginTop:'60px',
+      },
+      active: 0,
+      date: '',
+      show: false,
+      minDate: new Date(2020, 1,1),
     };
+  },
+  components: {
+    [Toast.name]: Toast
+  },
+  created(){
+    this.height.height = (document.documentElement.clientHeight - 120) + 'px'
+    this.onLoad();
+
+    
   },
   methods: {
-    onLoad() {
-      setTimeout(() => {
-        if (this.refreshing) {
-          this.list = [];
-          this.refreshing = false;
-        }
+    tab(name, title) {
+      // Toast(name);
+      if(name==0){
+        this.consumption = []
+      }else{
+        this.recharge = []
+      }
+      this.date = ''
+      
+      
 
-        for (let i = 0; i < 10; i++) {
-          this.list.push(this.list.length + 1);
+    },
+    formatDate(date) {
+      return `${date.getMonth() + 1}/${date.getDate()}`;
+    },
+    onConfirm(date) {
+     
+      this.show = false;
+      
+      var start_ = new Date(date[0]);
+      var starTime= start_.getFullYear() + '-' + (start_.getMonth() + 1) + '-' + start_.getDate() 
+      // + ' ' + start_.getHours() + '0:' + start_.getMinutes() + '0:0' + start_.getSeconds();
+      var end_ = new Date(date[1]);
+      var endTime=end_.getFullYear() + '-' + (end_.getMonth() + 1) + '-' + end_.getDate()  
+      // + ' ' + end_.getHours() + '0:' + end_.getMinutes() + '0:0' + end_.getSeconds();
+      this.date = starTime + ' 至 ' + endTime
+      RechargeConsumption("charge", starTime + ' 00:00:00', endTime + ' 00:00:00' , 1, 20).then((res=>{
+        console.log(res)
+        this.recharge = []
+        if(res.data.data.records.length>0){
+          this.recharge = res.data.data.records
+        }else {
+          this.finished = false
+          this.finished = true
         }
-        this.loading = false;
 
-        if (this.list.length >= 40) {
-          this.finished = true;
+      }))
+    },
+    onLoad() {
+      RechargeConsumption("charge",  null, null , 1, 20)
+      .then((res=>{
+        console.log(res)
+        if(res.data.data.records.length>0){
+          this.recharge = res.data.data.records
+        }else {
+          this.finished = false
+          this.finished = true
         }
-      }, 1000);
+      }))
+      // setTimeout(() => {
+      //   if (this.refreshing) {
+      //     this.list = [];
+      //     this.refreshing = false;
+      //   }
+      //   for (let i = 0; i < 10; i++) {
+      //     this.list.push(this.list.length + 1);
+      //   }
+      //   this.loading = false;
+      //   if (this.list.length >= 40) {
+      //     this.finished = true;
+      //   }
+      // }, 1000);
     },
     onRefresh() {
       // 清空列表数据
@@ -73,38 +167,44 @@ export default {
   height: 100vh;
   color: #000;
   box-sizing: border-box;
-  .contentBox {
-    width: 100%;
-    height: 100%;
-    overflow-y: auto;
-    padding: 0 10px;
-    box-sizing: border-box;
-    .listBoxCell{
-        height: 75px;
-        width: 100%;
-        display: flex;
-        align-items: center;
-        border-bottom: 1px solid rgba(237,237,237,1);
-        .jlName{
-            font-size: 16px;
-            color: #000;
-        }
-        .jlTime{
-            margin-top: 10px;
-            font-size: 12px;
-            color: #ccc;
-        }
-        .jlMoney{
-            text-align: right;
-            font-size: 16px;
-        }
-        .jlMoney.just{
-            color: rgba(56,129,253,1); 
-        }
-        .jlMoney.negative{
-            color: rgba(242,46,60,1);
-        }
-    }
+  overflow-y: hidden;
+
+  
+}
+.listBoxCell{
+  height: 75px;
+  width: 100%;
+  padding:0 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  border-bottom: 1px solid rgba(237,237,237,1);
+  .jlName{
+      font-size: 16px;
+      color: #000;
   }
+  .jlTime{
+      margin-top: 10px;
+      font-size: 12px;
+      color: #ccc;
+  }
+  .jlBalance{
+    margin-top:10px;
+    font-size: 14px;
+    color: rgba(242,46,60,1);
+  }
+  .jlMoney{
+      text-align: right;
+      font-size: 16px;
+  }
+  .jlMoney.just{
+      color: rgba(56,129,253,1); 
+  }
+  .jlMoney.negative{
+      color: rgba(242,46,60,1);
+  }
+}
+.van-list{
+  overflow-y: auto;
 }
 </style>

+ 16 - 3
vue.config.js

@@ -1,5 +1,5 @@
 module.exports = {
-    publicPath: '/', //部署路径后缀
+    publicPath: '/vuepay', //部署路径后缀
     assetsDir: 'static', // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。
     indexPath: 'index.html', // 指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。
     filenameHashing: true, // 文件名hash,默认
@@ -14,12 +14,12 @@ module.exports = {
         host: '172.16.120.200',
         port: 8080, // 端口号
         // https: false, // https:{type:Boolean}
-        open: true, // 配置自动启动浏览器
+        open: false, // 配置自动启动浏览器
         hotOnly: true, // 热更新
         proxy: {
             // 配置多个跨域
             '/': {
-                target: 'http://172.16.120.92:8084/', //跨域接口的地址
+                target: 'http://124.71.174.104/dxapi/', //跨域接口的地址
                 changeOrigin: false,
                 pathRewrite: {
                     '': '/'
@@ -30,6 +30,19 @@ module.exports = {
             'Access-Control-Allow-Origin': '*',
         }
     },
+    configureWebpack: {
+        performance: {
+            hints: 'warning',
+            // 入口起点的最大体积
+            maxEntrypointSize: 50000000,
+            // 生成文件的最大体积
+            maxAssetSize: 30000000,
+            // 只给出 js 文件的性能提示
+            assetFilter: function(assetFilename) {
+                return assetFilename.endsWith('.js')
+            }
+        }
+    },
     css: {
         loaderOptions: {
             postcss: {