snow 1 year ago
parent
commit
8ebdd99afa

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.37830a40.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.cbd8abb2.js


BIN
dist/static/js/app.cbd8abb2.js.gz


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.ec6418d6.js


BIN
dist/static/js/app.ec6418d6.js.gz


+ 1 - 0
src/api/report.js

@@ -4,6 +4,7 @@ import { reportApi } from "@/config";
 const api = "admin/";
 
 export default {
+  list: (data, params) => http(reportApi + api + "stats", data, "post", params),
   departDay: (data, params) => http(reportApi + api + "departEveryDay", data, "post", params),
   departMonth: (data, params) => http(reportApi + api + "departEveryMonth", data, "post", params),
   companyEvery: (data, params) => http(reportApi + api + "companyEvery", data, "post", params),

+ 2 - 2
src/components/unusual/index.vue

@@ -9,10 +9,10 @@
 <script>
 export default {
   name:'UnusualState',
-  props:['message'],
+  props:['message','path'],
   methods:{
     toLogin(){
-      this.$router.push('/login')
+      this.$router.push('/login' + (this.path ? `?path=${this.path}` : ''))
     }
   }
 }

+ 242 - 0
src/pages/accountsReceivable.vue

@@ -0,0 +1,242 @@
+<template>
+  <div class="SalesReportRejectedNew">
+    <div v-if="!state.error">
+      <div class="table-header" style="line-height:36px">万宇应收账款报表看板</div>
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        :max-height="maxHeight"
+        :size="'mini'"
+        style="width: 100%"
+        row-key="id"
+        stripe
+      >
+        <el-table-column label="业务公司" fixed="left" width="80" prop="depart">
+          <template slot-scope="scope">{{scope.row.depart.split('@')[1] || '总计'}}</template>
+        </el-table-column>
+        <el-table-column label="应收账款" prop="wpay_fee" align="center" >
+          <template slot-scope="scope">
+             {{ unit2TenThousand(scope.row.wpay_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="已开票未回票" prop="wpay_ainv_fee" align="center" >
+          <template slot-scope="scope">
+             {{ unit2TenThousand(scope.row.wpay_ainv_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="未开票" prop="winv_fee" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.winv_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="待开票" prop="inv_fee" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.inv_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="已发货未开票" prop="winv_asend_fee" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.winv_asend_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="未发货" prop="wpay_send_fee" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.wpay_send_fee) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="超60天已发货未开票" prop="winv_two_month" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.winv_two_month) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="超180天应收账款" prop="wpay_six_month" align="center">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.wpay_six_month) }}
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <template v-else>
+      <unusual-state :message="state.message" path="accountsReceivable" />
+    </template>
+  </div>
+</template>
+
+<script>
+import asyncRequest from "@/api/report";
+import userRequest from "@/api/index"
+import setHeight from "@/mixins/index";
+import { 
+  mapResponseCompletionCompanyName,
+  unit2TenThousand,
+  getCompanyLabel,
+  addition
+} from "@/components/reports/src/_utils";
+import { getParameterByName } from "../utils/auth";
+import UnusualState from "@/components/unusual/index.vue"
+
+export default {
+  name: "WanyuTypeReport",
+  props: ["date"],
+  mixins: [setHeight],
+  components:{UnusualState},
+  watch: {
+    date: function(val) {
+      this.dataTime = val;
+      if (val) {
+        this.searchList();
+      }
+    }
+  },
+  data() {
+    return {
+      total:{
+        day:0,
+        month:0,
+        total_tips: 0
+      },
+      state:{
+        error:false,
+        loading:false,
+        message:'',
+      },
+      mapResponseCompletionCompanyName,
+      dataTime: this.date,
+      loading: false,
+      maxHeight: "0",
+      tableData: []
+    };
+  },
+  async created() {
+    document.title = "应收账款报表看板"
+    window.onresize = () => {
+      this.getHeight();
+    };
+  },
+  mounted() {
+    this.requestUserinfo()
+  },
+  methods: {
+    async requestUserinfo(){
+       this.state.loading = true;
+       const code = getParameterByName('code')
+       const result = await userRequest.userinfo({
+         code
+       })
+
+       // const result ={
+       // "code": 0,
+       // "message": "获取成功",
+       // "data": {
+		   //     "id": "1",
+		   //     "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
+		   //     "mobile": "",
+		   //     "gender": "0",
+		   //     "nickname": "雪寒",
+		   //     "avatar": "",
+		   //     "subscribe_time": "2022-12-21 15:52:14",
+		   //     "addr": "\/\/",
+		   //     "status": "1",
+		   //     "is_show": ["1", "2"],
+		   //     "companyArr": [{
+		   //     	"companyNo": "GS2302231125079621",
+		   //     	"companyName": "北京百辰荣达国际科贸有限公司",
+		   //     	"info": [1,2]
+		   //     }, {
+		   //     	"companyNo": "GS2302231323386950",
+		   //     	"companyName": "北京泓源广诚国际商贸有限公司",
+		   //     	"info": [1,2]
+		   //     }, {
+		   //     	"companyNo": "GS2304031312553746",
+		   //     	"companyName": "北京锦兴弘昌科技有限公司",
+		   //     	"info": [1, 2]
+		   //     }, {
+		   //     	"companyNo": "GS2302231124114965",
+		   //     	"companyName": "北京普润心堂商贸有限公司",
+		   //     	"info": [1, 2]
+		   //     }, {
+		   //     	"companyNo": "GS2203161855277894",
+		   //     	"companyName": "北京万宇恒通国际科贸有限公司",
+		   //     	"info": [1, 2]
+		   //     }],
+		   //     "addtime": "2023-04-10 18:11:07",
+		   //     "updatetime": "2023-05-09 16:22:33"
+       // 	}
+       // }
+      
+        this.state.loading = false
+        switch(Number(result.code)){
+          case 0:
+          this.$nextTick(() => this.getHeight());
+          this.searchList();
+           break
+          default:
+           this.state.error = true
+           this.state.message = result.message
+           break
+        }
+      },
+    getCompanyLabel,
+    unit2TenThousand,
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex === 0) {
+        if (rowIndex % 2 === 0) {
+          return {
+            rowspan: 2,
+            colspan: 1
+          };
+        } else {
+          return {
+            rowspan: 0,
+            colspan: 0
+          };
+        }
+      }
+    },
+    async searchList() {
+      this.loading = true;
+      this.tableData = [];
+      const res = await asyncRequest.list({
+        daytime: this.date
+      });
+
+      if (res.code === 0 && res.data && res.data.length > 0) {
+        const tableData = res.data
+        const totalItem = res.data.reduce((prev, current) => Object.keys(current).reduce((prev, currentKey) => ({
+        ...prev,
+        [currentKey]: currentKey !== 'depart' ? addition(current[currentKey] || 0, prev[currentKey] || 0) : '总计'
+      }), prev), {})
+
+        this.tableData = [...tableData,totalItem]
+      } else {
+        this.tableData = [];
+      }
+      this.getHeight();
+      this.loading = false;
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.SalesReportRejectedNew {
+  padding: 10px;
+}
+
+.table-header {
+  font-size: 18px;
+  font-weight: 700;
+  line-height: 30px;
+  border-bottom: none;
+}
+
+.table-sub__header {
+
+  span{
+    font-weight: bold !important;
+  }
+}
+</style>
+

+ 2 - 1
src/pages/login.vue

@@ -7,7 +7,8 @@ import config from "@/config"
 export default {
   name:'login',
   async mounted () {
-      const redirect_url = encodeURIComponent('http://stat.caixiao365.com/')
+      const path = (this.$route.query || {}).path
+      const redirect_url = encodeURIComponent('http://stat.caixiao365.com/' + (path ? `#/${path}` : ''))
       var state = 'wx_' + Math.random().toString(36).substr(2, 15)
       const scope = 'snsapi_userinfo'
       const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`

+ 4 - 1
src/pages/report.vue

@@ -19,6 +19,7 @@ export default {
   components:{ UnusualState , ControlDisplay },
   data() {
     return {
+      companyArr:[],
       companies:[],
       hasPlatformDimension: false,
       state:{
@@ -28,6 +29,9 @@ export default {
       }
     }
   },
+  created(){
+    document.title = "利润看板"
+  },
   async mounted(){
     this.requestUserinfo()
   },
@@ -36,7 +40,6 @@ export default {
       this.state.loading = true;
       const openid = getOpenid()
       const code = getParameterByName('code')
-
       const result = await asyncRequest.userinfo({
         code
       })

+ 8 - 3
src/router/index.js

@@ -1,17 +1,22 @@
 import Report from "./../pages/report.vue"
 import Login from "./../pages/login.vue"
+import AccountsReceivable from "./../pages/accountsReceivable.vue"
 import { getParameterByName } from "../utils/auth"
 
 const routes = [
   { path: '/', component: Report},
-  { path:'/login', component: Login}
+  { path:'/login', component: Login},
+  { path:'/accountsReceivable', component: AccountsReceivable},
 ]
 
 const router = new VueRouter({routes ,mode:'hash'})
 
-router.beforeEach((to, _, next) => {
+router.beforeEach((to, from, next) => {
   if (to.path !== '/login' && !getParameterByName('code')) {
-    next('/login')
+    next({
+      path:'login',
+      query:{ path: getParameterByName('path') }
+    })
   } else {
     next()
   }

+ 70 - 0
src/utils/auth.js

@@ -21,3 +21,73 @@ export function getParameterByName(name) {
   if (!results[2]) return '';
   return decodeURIComponent(results[2].replace(/\+/g, ' '));
 }
+
+export async function requestUserinfo(){
+  this.state.loading = true;
+  // const openid = getOpenid()
+  const code = getParameterByName('code')
+  const result = await asyncRequest.userinfo({
+    code
+  })
+
+  const state = {
+    companine:[],
+    error:false,
+    hasPlatformDimension:false,
+    message:""
+  }
+
+  // const result ={
+  // "code": 0,
+  // "message": "获取成功",
+  // "data": {
+  //     "id": "1",
+  //     "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
+  //     "mobile": "",
+  //     "gender": "0",
+  //     "nickname": "雪寒",
+  //     "avatar": "",
+  //     "subscribe_time": "2022-12-21 15:52:14",
+  //     "addr": "\/\/",
+  //     "status": "1",
+  //     "is_show": ["1", "2"],
+  //     "companyArr": [{
+  //     	"companyNo": "GS2302231125079621",
+  //     	"companyName": "北京百辰荣达国际科贸有限公司",
+  //     	"info": [1,2]
+  //     }, {
+  //     	"companyNo": "GS2302231323386950",
+  //     	"companyName": "北京泓源广诚国际商贸有限公司",
+  //     	"info": [1,2]
+  //     }, {
+  //     	"companyNo": "GS2304031312553746",
+  //     	"companyName": "北京锦兴弘昌科技有限公司",
+  //     	"info": [1, 2]
+  //     }, {
+  //     	"companyNo": "GS2302231124114965",
+  //     	"companyName": "北京普润心堂商贸有限公司",
+  //     	"info": [1, 2]
+  //     }, {
+  //     	"companyNo": "GS2203161855277894",
+  //     	"companyName": "北京万宇恒通国际科贸有限公司",
+  //     	"info": [1, 2]
+  //     }],
+  //     "addtime": "2023-04-10 18:11:07",
+  //     "updatetime": "2023-05-09 16:22:33"
+  // 	}
+  // }
+  
+  switch(Number(result.code)){
+    case 0:
+      state.companine = result.data.companyArr.filter(({info = []}) => info.includes(2) || info.includes('2'))
+      state.hasPlatformDimension = (result.data.is_show || []).includes(2) || (result.data.is_show || []).includes('2')
+      break
+    default:
+      state.error = true
+      state.message = result.message
+      // openid && removeOpenid()
+      break
+  }
+
+  return state
+}

Some files were not shown because too many files changed in this diff