Browse Source

首页数量优化

xiaohaizhao 6 months ago
parent
commit
10dc9559be
3 changed files with 33 additions and 13 deletions
  1. 30 7
      pages/index/home.vue
  2. 1 1
      pages/workOrder/snatchingOrders.vue
  3. 2 5
      utils/Http.js

+ 30 - 7
pages/index/home.vue

@@ -31,6 +31,7 @@
 <script setup>
 import { ref, getCurrentInstance, computed } from 'vue'
 import { onLoad, onShow } from '@dcloudio/uni-app';
+import { promise } from '../../uni_modules/uview-plus/libs/function/test';
 const { $Http } = getCurrentInstance().proxy;
 const banner = ref([]);
 const enterprisename = ref('');
@@ -105,13 +106,35 @@ onLoad(() => {
 
 function uploadNumber() {
 	itemList.value.forEach((item) => {
-		$Http.basic({ "id": "20230208140203", "content": { "pageNumber": 1, "pageSize": 0, "where": { "status": item.label == '抢单中心' ? '' : item.label, "condition": "", ispublic: item.label == '抢单中心' ? '1' : '' } } }).then(res => {
-			if (res.code !== 0) {
-				item.badge = res.total;
-			} else {
-				item.badge = 0;
-			}
-		})
+		if (item.label == '进行中') {
+			Promise.all(
+				['待开始', '进行中', '已提交'].map(v =>
+					$Http.basic({
+						"id": "20230208140203", "content":
+							{ "pageNumber": 1, "pageSize": 0, "where": { "status": v, "condition": "" } }
+					})
+				)
+			).then(res => {
+				let total = 0;
+				res.forEach(r => {
+					if (r.code !== 0) {
+						total += r.total;
+					}
+				})
+				item.badge = total;
+			})
+		} else {
+			$Http.basic({
+				"id": "20230208140203", "content":
+					{ "pageNumber": 1, "pageSize": 0, isadmin: item.label == '抢单中心' ? '1' : '', "where": { "status": item.label == '抢单中心' ? '' : item.label, "condition": "", ispublic: item.label == '抢单中心' ? '1' : '' } }
+			}).then(res => {
+				if (res.code !== 0) {
+					item.badge = res.total;
+				} else {
+					item.badge = 0;
+				}
+			})
+		}
 	});
 	welcomeText.getter()
 }

+ 1 - 1
pages/workOrder/snatchingOrders.vue

@@ -42,7 +42,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
 const listBox = ref(null);
 const content = reactive({
     loading: false,
-    isadmin: 0,
+    isadmin: 1,
     "pageNumber": 1,
     "pageSize": 20,
     "where": {

+ 2 - 5
utils/Http.js

@@ -1,14 +1,11 @@
 class HTTP {
     constructor() {
         this.urls = [{
-            name: '测试',
+            name: '正式',
             url: "https://crm.meida.com:16691"
         }, {
             name: '8300',
             url: "http://61.164.207.46:8300"
-        }, {
-            name: "楚楚",
-            url: "https://cucu.cnyunl.com:8079"
         }];
         this.updateList = (content, getList) => {
             content.copyContent = JSON.parse(JSON.stringify(content));
@@ -38,7 +35,7 @@ class HTTP {
         if (process.env.NODE_ENV === 'development') {
             this.baseUrl = this.urls[0].url;
         } else {
-            this.baseUrl = this.urls[1].url;
+            this.baseUrl = this.urls[0].url;
         }
 
         // 从本地存储加载JSESSIONID