snow hai 4 días
pai
achega
cd9b0b3c0c
Modificáronse 1 ficheiros con 195 adicións e 89 borrados
  1. 195 89
      src/pages/invData.vue

+ 195 - 89
src/pages/invData.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="new-report" v-loading="state.loading" style="min-height:300px">
     <div v-if="!state.error && isShow">
-
       <div style="
         color:red;
         display: flex;
@@ -9,7 +8,7 @@
         justify-content: space-between;
         width:100%;
         padding:5px 10px;
-        box-sizing:border-box;
+        box-sizing: border-box;
         position: fixed;
         top:0px;
         left:5px;
@@ -39,7 +38,23 @@
           </div>
         </div>
         <el-table size="small" border :data="dayCompany">
-          <el-table-column label="业务公司" prop="companyName" width="70px" show-overflow-tooltip fixed="left" />
+          <el-table-column label="业务公司" prop="companyName" width="70px" show-overflow-tooltip fixed="left">
+            <template slot-scope="scope">
+              <div v-if="scope.row.companyName.indexOf('普润') === -1">
+                {{ scope.row.companyName }}
+              </div>
+
+              <div v-else>
+                <el-popover placement="right" width="200" trigger="hover" content="普润&锦兴&知事">
+                  <template #reference>
+                    <i class="el-icon-warning-outline" style="font-size:14px;cursor:pointer"></i>
+                    普润
+                  </template>
+                </el-popover>
+              </div>
+            </template>
+          </el-table-column>
+          
           <el-table-column label="当日开票收入" min-width="100px" prop="invDay" show-overflow-tooltip>
             <template slot-scope="scope">
               {{ unit2TenThousand(scope.row.invDay, isTenThound) }}
@@ -282,11 +297,26 @@ export default {
   },
   mounted() {
     document.title = "数据统计"
-    this.dayDate = dayjs(new Date()).format("YYYY-MM-DD")
-    this.blDayDate = dayjs(new Date()).format("YYYY-MM-DD")
+
+    const date = dayjs(new Date()).format('YYYY-MM-DD')
+    const datetime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
+
+
+    let newDate = ''
+
+    if (!dayjs(date + ' 20:00:00').isBefore(datetime)){
+      newDate = dayjs(new Date()).subtract(1, 'day').format('YYYY-MM-DD')
+    } else {
+      newDate = dayjs(new Date()).format('YYYY-MM-DD')
+    }
+
+    this.dayDate = newDate
+    this.blDayDate = newDate
+    this.companyDayDate = newDate
+
     this.monthDate = dayjs(new Date()).format("YYYY")
-    this.companyDayDate = dayjs(new Date()).format("YYYY-MM-DD")
     this.companyMonthDate = dayjs(new Date()).format("YYYY")
+
     if(!getParameterByName('code')){ this.login() }else{
       this.requestUserinfo()
     }
@@ -308,48 +338,75 @@ export default {
     },
 
     async requestCompanyMonth() {
-      this.companyMonthLoading = true
-      const { data, code } = await asyncRequest.everyCompanMonth({ year: this.companyMonthDate, companyNo: this.monthCompanyNo })
-      this.companyMonthLoading = false
+      if (!this.monthCompanyNo){
+        this.companyMonthLoading = true
+        const zs = await asyncRequest.everyCompanMonth({ year: this.companyMonthDate, companyNo: 'GS2401181650538135' });
+        const pr = await asyncRequest.everyCompanMonth({ year: this.companyMonthDate, companyNo: 'GS2302231124114965' });
+        const jx = await asyncRequest.everyCompanMonth({ year: this.companyMonthDate, companyNo: 'GS2304031312553746' });
+
+        const item = {
+          month: '',
+          invMonth: '',
+          cost_tips: '',
+          inv_tips: '',
+          monthInvRate: '',
+          costMonth: '',
+          costMonthRate: ''
+        }
 
-      if (code === 1) {
-        const list = []
-        for(const item of data){
-          const { cost_tips, inv_tips, year, month } = item
-          const invMonth = subtraction(item.month_info.month_inv_fee, item.month_info.month_return_inv_fee)
-          const costMonth = subtraction(invMonth, subtraction(item.month_info.month_cost_fee, item.month_info.month_return_cost_fee))
-          const monthInvRate = this.calcBl(invMonth, inv_tips)
-          const costMonthRate = this.calcBl(costMonth, cost_tips)
 
-          list.push({
-            month: month,
-            invMonth,
-            cost_tips,
-            inv_tips,
-            monthInvRate,
-            costMonth,
-            costMonthRate,
-          })
-        }
 
-        const totalItem = list.reduce((prev, current) => ({
-          invMonth: addition(prev.invMonth, current.invMonth),
-          cost_tips: addition(prev.cost_tips, current.cost_tips),
-          inv_tips: addition(prev.inv_tips, current.inv_tips),
-          costMonth: addition(prev.costMonth, current.costMonth),
-        }), {
-          invMonth: 0,
-          cost_tips: 0,
-          inv_tips: 0,
-          costMonth: 0,
-        })
+        ([zs, pr, jx]).forEach(item => {
+          const { data } = item
+          console.log(data, '🚀~~')
+        });
+
+        this.companyMonthLoading = false
 
+      }else {
+        this.companyMonthLoading = true
+        const { data, code } = await asyncRequest.everyCompanMonth({ year: this.companyMonthDate, companyNo: this.monthCompanyNo })
+        this.companyMonthLoading = false
 
-        totalItem.month = '合计'
-        totalItem.monthInvRate = this.calcBl(totalItem.invMonth, totalItem.inv_tips)
-        totalItem.costMonthRate = this.calcBl(totalItem.costMonth, totalItem.cost_tips)
-        list.push(totalItem)
-        this.monthCompany = list
+        if (code === 1) {
+          const list = []
+          for (const item of data) {
+            const { cost_tips, inv_tips, month } = item
+            const invMonth = subtraction(item.month_info.month_inv_fee, item.month_info.month_return_inv_fee)
+            const costMonth = subtraction(invMonth, subtraction(item.month_info.month_cost_fee, item.month_info.month_return_cost_fee))
+            const monthInvRate = this.calcBl(invMonth, inv_tips)
+            const costMonthRate = this.calcBl(costMonth, cost_tips)
+
+            list.push({
+              month: month,
+              invMonth,
+              cost_tips,
+              inv_tips,
+              monthInvRate,
+              costMonth,
+              costMonthRate,
+            })
+          }
+
+          const totalItem = list.reduce((prev, current) => ({
+            invMonth: addition(prev.invMonth, current.invMonth),
+            cost_tips: addition(prev.cost_tips, current.cost_tips),
+            inv_tips: addition(prev.inv_tips, current.inv_tips),
+            costMonth: addition(prev.costMonth, current.costMonth),
+          }), {
+            invMonth: 0,
+            cost_tips: 0,
+            inv_tips: 0,
+            costMonth: 0,
+          })
+
+
+          totalItem.month = '合计'
+          totalItem.monthInvRate = this.calcBl(totalItem.invMonth, totalItem.inv_tips)
+          totalItem.costMonthRate = this.calcBl(totalItem.costMonth, totalItem.cost_tips)
+          list.push(totalItem)
+          this.monthCompany = list
+        }
       }
     },
 
@@ -457,18 +514,52 @@ export default {
         }
 
 
-        const _list = list.filter(item => !['预订单E企购', '结算单E企购'].includes(item.companyName))
+        const _list = list.filter(item => !['预订单E企购', '结算单E企购', '泓源', '万宇'].includes(item.companyName))
+        const cclist = ['百辰', '泓源', '普润', '锦兴', '知事', '万宇', '泰文创']
+
+        const sets = ['普润', '锦兴', '知事']
 
+        const totals= _list.filter(item => sets.includes(item.companyName))        
+
+
+
+        const item = totals.reduce((prev, current) => ({
+          companyName: '普润&锦兴&知事',
+          invDay: addition(prev.invDay, current.invDay),
+          invMonth: addition(prev.invMonth, current.invMonth),
+          inv_tips: current.inv_tips,
+          cost_tips: current.cost_tips,
+          monthInvRate: '0',
+          costMonth: addition(prev.invMonth, current.invMonth),
+          costRate: '0'
+        }), {
+          companyName: '普润&锦兴&知事',
+          invDay: '',
+          invMonth: '',
+          inv_tips: '',
+          cost_tips: '',
+          monthInvRate: '',
+          costMonth: '',
+          costRate: ''
+        })
 
-        const cclist = ['百辰', '泓源', '普润', '锦兴', '知事', '万宇', '泰文创']
+
+
+        let isHas = false
+        item.monthInvRate = this.calcBl(item.invMonth, item.inv_tips)
+        item.costRate = this.calcBl(subtraction(item.invMonth, item.costMonth), item.cost_tips)
 
         const _cp_list = []
         for (const _item of cclist) {
           const index = _list.findIndex(item => item.companyName === _item)
 
-          if (index >= 0) {
+          if (sets.includes(_item) && !isHas){
+            _cp_list.push(item)
+            isHas = true
+          } else if (index >= 0 && !sets.includes(_item)) {
             _cp_list.push(_list[index])
           }
+          
         }
 
 
@@ -599,47 +690,53 @@ export default {
        this.state.loading = true;
        const openid = getOpenid()
        const code = getParameterByName('code')
-       const result = await userRequest.userinfo({  ...( openid ? { openid } :  { 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", "4", "10"],
-      //    "companyArr": [{
-      //      "companyNo": "GS2304031312553746",
-      //      "companyName": "北京锦兴弘昌科技有限公司",
-      //      "info": [1, 2, 10]
-      //    },{
-		  //      	"companyNo": "GS2302231125079621",
-		  //      	"companyName": "北京百辰荣达国际科贸有限公司",
-		  //      	"info": [1,2, 10]
-		  //      }, {
-		  //      	"companyNo": "GS2302231323386950",
-		  //      	"companyName": "北京泓源广诚国际商贸有限公司",
-		  //      	"info": [1,2, 10]
-		  //      }, {
-		  //      	"companyNo": "GS2302231124114965",
-		  //      	"companyName": "北京普润心堂商贸有限公司",
-		  //      	"info": [1, 2, 10]
-		  //      }, {
-		  //      	"companyNo": "GS2203161855277894",
-		  //      	"companyName": "北京万宇恒通国际科贸有限公司",
-		  //      	"info": [1, 2, 10]
-		  //      }],
-		  //      "addtime": "2023-04-10 18:11:07",
-		  //      "updatetime": "2023-05-09 16:22:33"
-      //  	}
-      //  }
+       // const result = await userRequest.userinfo({  ...( openid ? { openid } :  { 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", "4", "10"],
+          "companyArr": [
+            {
+            "companyNo": "GS2304031312553746",
+            "companyName": "北京锦兴弘昌科技有限公司",
+            "info": [1, 2, 10]
+          },
+          {
+		        	"companyNo": "GS2302231125079621",
+		        	"companyName": "北京百辰荣达国际科贸有限公司",
+		        	"info": [1,2, 10]
+		        }, {
+		        	"companyNo": "GS2302231323386950",
+		        	"companyName": "北京泓源广诚国际商贸有限公司",
+		        	"info": [1,2, 10]
+		        }, {
+		        	"companyNo": "GS2302231124114965",
+		        	"companyName": "北京普润心堂商贸有限公司",
+		        	"info": [1, 2, 10]
+		        }, {
+		        	"companyNo": "GS2203161855277894",
+		        	"companyName": "北京万宇恒通国际科贸有限公司",
+		        	"info": [1, 2, 10]
+            }, {
+            "companyNo": "GS2401181650538135",
+            "companyName": "北京知事文化产业发展有限公司",
+              "info": [1, 2, 10]
+            }],
+		        "addtime": "2023-04-10 18:11:07",
+		        "updatetime": "2023-05-09 16:22:33"
+        	}
+        }
 
       const mapCompany = {
         "北京百辰荣达国际科贸有限公司": "百辰",
@@ -668,16 +765,25 @@ export default {
             }, []).map(item => ({
               ...item,
               companyName: mapCompany[item.companyName]
-            })).filter(item => !['预订单E企购', '结算单E企购'].includes(item.companyName))
+            })).filter(item => !['预订单E企购', '结算单E企购', '泓源', '万宇'].includes(item.companyName))
+
+
+
+            const sets = ['普润', '锦兴', '知事']
+
 
 
+            let isHas = false
 
 
             const _cp_list = []
             for(const _item of list){
               const index = companies.findIndex(item => item.companyName === _item)
 
-              if(index >= 0){
+              if (sets.includes(_item) && !isHas){
+                _cp_list.push({ companyName: '普润&锦兴&知事', companyNo: '' })
+                isHas = true
+              } else if(index >= 0 && !sets.includes(_item)){
                 _cp_list.push(companies[index])
               }
             }