Commit 5b78347a551bd168fdb22c6ce5782b59785d9fc5

Authored by 史婷婷
1 parent 5e3ecbbc

feat: 首页-任务数量统计 接口联调

Showing 1 changed file with 117 additions and 107 deletions
@@ -18,19 +18,19 @@ @@ -18,19 +18,19 @@
18 <image class="card-bg" src="/static/images/index/card_wait.png" mode="aspectFill" /> 18 <image class="card-bg" src="/static/images/index/card_wait.png" mode="aspectFill" />
19 <view class="card-content"> 19 <view class="card-content">
20 <text class="card-title">待审批的</text> 20 <text class="card-title">待审批的</text>
21 - <text class="card-num">24</text> 21 + <text class="card-num">{{ todoCount }}</text>
22 </view> 22 </view>
23 </view> 23 </view>
24 <view class="stat-card" @click="navigateTo('/pages/flow/myflow')"> 24 <view class="stat-card" @click="navigateTo('/pages/flow/myflow')">
25 <image class="card-bg" src="/static/images/index/card_launch.png" mode="aspectFill" /> 25 <image class="card-bg" src="/static/images/index/card_launch.png" mode="aspectFill" />
26 <view class="card-content"> 26 <view class="card-content">
27 <text class="card-title">我发起的</text> 27 <text class="card-title">我发起的</text>
28 - <text class="card-num">87</text> 28 + <text class="card-num">{{ myCreateCount }}</text>
29 </view> 29 </view>
30 </view> 30 </view>
31 </view> 31 </view>
32 <!-- 分组入口 --> 32 <!-- 分组入口 -->
33 - <view class="section" v-for="(it, index) in sectionList" :key="index"> 33 + <view class="section" v-for="(it, index) in sectionList" :key="index">
34 <text class="section-title">{{ it.title }}</text> 34 <text class="section-title">{{ it.title }}</text>
35 <view class="grid"> 35 <view class="grid">
36 <view class="grid-item" v-for="(g, idx) in it.items" :key="idx" @click="navigateTo(g.link)"> 36 <view class="grid-item" v-for="(g, idx) in it.items" :key="idx" @click="navigateTo(g.link)">
@@ -43,79 +43,87 @@ @@ -43,79 +43,87 @@
43 </template> 43 </template>
44 44
45 <script> 45 <script>
  46 + import {
  47 + statisticsCountApi
  48 + } from '@/api/flow.js'
46 export default { 49 export default {
47 data() { 50 data() {
48 return { 51 return {
49 - sectionList: [  
50 - {  
51 - title: '客户开发管理',  
52 - items: [  
53 - {  
54 - text: '开发管理',  
55 - icon: '/static/images/index/dev_manage.png',  
56 - link: '/pages/dev_manage/index'  
57 - }  
58 - ]  
59 - },  
60 - {  
61 - title: '客户资信管理',  
62 - items: [  
63 - {  
64 - text: '资信管理',  
65 - icon: '/static/images/index/credit_manage.png',  
66 - link: '/pages/credit_manage/index'  
67 - }  
68 - ]  
69 - },  
70 - {  
71 - title: '合同管理',  
72 - items: [  
73 - {  
74 - text: '框架合同',  
75 - icon: '/static/images/index/contract_framework.png',  
76 - link: '/pages/contract_framework/index'  
77 - },  
78 - {  
79 - text: '经销标准合同',  
80 - icon: '/static/images/index/contract_retail.png',  
81 - link: '/pages/contract_retail/index'  
82 - },  
83 - {  
84 - text: '经销库存合同',  
85 - icon: '/static/images/index/contract_stock.png',  
86 - link: '/pages/contract_stock/index'  
87 - },  
88 - {  
89 - text: '经销未锁规合同',  
90 - icon: '/static/images/index/contract_unplan.png',  
91 - link: '/pages/contract_unplan/index'  
92 - },  
93 - {  
94 - text: '加工标准合同',  
95 - icon: '/static/images/index/contract_process.png',  
96 - link: '/pages/contract_process/index'  
97 - },  
98 - {  
99 - text: '外贸标准合同',  
100 - icon: '/static/images/index/contract_foreign_std.png',  
101 - link: '/pages/contract_foreign_std/index'  
102 - },  
103 - {  
104 - text: '外贸库存合同',  
105 - icon: '/static/images/index/contract_foreign_stock.png',  
106 - link: '/pages/contract_foreign_stock/index'  
107 - },  
108 - {  
109 - text: '外贸未锁规合同',  
110 - icon: '/static/images/index/contract_foreign_unplan.png',  
111 - link: '/pages/contract_foreign_unplan/index'  
112 - },  
113 - ],  
114 - }  
115 - ] 52 + todoCount: '',
  53 + myCreateCount: '',
  54 + sectionList: [{
  55 + title: '客户开发管理',
  56 + items: [{
  57 + text: '开发管理',
  58 + icon: '/static/images/index/dev_manage.png',
  59 + link: '/pages/dev_manage/index'
  60 + }]
  61 + },
  62 + {
  63 + title: '客户资信管理',
  64 + items: [{
  65 + text: '资信管理',
  66 + icon: '/static/images/index/credit_manage.png',
  67 + link: '/pages/credit_manage/index'
  68 + }]
  69 + },
  70 + {
  71 + title: '合同管理',
  72 + items: [{
  73 + text: '框架合同',
  74 + icon: '/static/images/index/contract_framework.png',
  75 + link: '/pages/contract_framework/index'
  76 + },
  77 + {
  78 + text: '经销标准合同',
  79 + icon: '/static/images/index/contract_retail.png',
  80 + link: '/pages/contract_retail/index'
  81 + },
  82 + {
  83 + text: '经销库存合同',
  84 + icon: '/static/images/index/contract_stock.png',
  85 + link: '/pages/contract_stock/index'
  86 + },
  87 + {
  88 + text: '经销未锁规合同',
  89 + icon: '/static/images/index/contract_unplan.png',
  90 + link: '/pages/contract_unplan/index'
  91 + },
  92 + {
  93 + text: '加工标准合同',
  94 + icon: '/static/images/index/contract_process.png',
  95 + link: '/pages/contract_process/index'
  96 + },
  97 + {
  98 + text: '外贸标准合同',
  99 + icon: '/static/images/index/contract_foreign_std.png',
  100 + link: '/pages/contract_foreign_std/index'
  101 + },
  102 + {
  103 + text: '外贸库存合同',
  104 + icon: '/static/images/index/contract_foreign_stock.png',
  105 + link: '/pages/contract_foreign_stock/index'
  106 + },
  107 + {
  108 + text: '外贸未锁规合同',
  109 + icon: '/static/images/index/contract_foreign_unplan.png',
  110 + link: '/pages/contract_foreign_unplan/index'
  111 + },
  112 + ],
  113 + }
  114 + ]
116 } 115 }
117 }, 116 },
  117 + created() {
  118 + this.getStatisticsFun()
  119 + },
118 methods: { 120 methods: {
  121 + getStatisticsFun() {
  122 + statisticsCountApi().then((res) => {
  123 + this.todoCount = res.data.todoCount || '';
  124 + this.myCreateCount = res.data.myCreateCount || '';
  125 + });
  126 + },
119 // 普通页面 127 // 普通页面
120 navigateTo(link) { 128 navigateTo(link) {
121 if (!link || link === '#') { 129 if (!link || link === '#') {
@@ -123,12 +131,15 @@ @@ -123,12 +131,15 @@
123 } 131 }
124 // 规范化路径,确保以斜杠开头 132 // 规范化路径,确保以斜杠开头
125 const url = link.startsWith('/') ? link : `/${link}`; 133 const url = link.startsWith('/') ? link : `/${link}`;
126 - 134 +
127 // 普通页面使用 navigateTo 135 // 普通页面使用 navigateTo
128 uni.navigateTo({ 136 uni.navigateTo({
129 url, 137 url,
130 fail: () => { 138 fail: () => {
131 - uni.showToast({ title: '页面暂未开放', icon: 'none' }); 139 + uni.showToast({
  140 + title: '页面暂未开放',
  141 + icon: 'none'
  142 + });
132 } 143 }
133 }); 144 });
134 } 145 }
@@ -143,7 +154,7 @@ @@ -143,7 +154,7 @@
143 154
144 .home-page { 155 .home-page {
145 padding: 0 32rpx 32rpx; 156 padding: 0 32rpx 32rpx;
146 - padding-top: 96rpx; 157 + padding-top: 96rpx;
147 } 158 }
148 159
149 /* 自定义头部 */ 160 /* 自定义头部 */
@@ -152,12 +163,12 @@ @@ -152,12 +163,12 @@
152 display: flex; 163 display: flex;
153 align-items: center; 164 align-items: center;
154 justify-content: space-between; 165 justify-content: space-between;
155 - position: fixed;  
156 - top: 0;  
157 - left: 0;  
158 - right: 0;  
159 - z-index: 1000;  
160 - background-color: #fff; 166 + position: fixed;
  167 + top: 0;
  168 + left: 0;
  169 + right: 0;
  170 + z-index: 1000;
  171 + background-color: #fff;
161 padding: 0 32rpx; 172 padding: 0 32rpx;
162 173
163 .header-left { 174 .header-left {
@@ -236,14 +247,14 @@ @@ -236,14 +247,14 @@
236 .card-title { 247 .card-title {
237 color: rgba(0, 0, 0, 0.9); 248 color: rgba(0, 0, 0, 0.9);
238 font-size: 32rpx; 249 font-size: 32rpx;
239 - line-height: 44rpx; 250 + line-height: 44rpx;
240 } 251 }
241 252
242 .card-num { 253 .card-num {
243 - color: rgba(0,0,0,0.4); 254 + color: rgba(0, 0, 0, 0.4);
244 font-size: 32rpx; 255 font-size: 32rpx;
245 font-weight: 600; 256 font-weight: 600;
246 - line-height: 44rpx; 257 + line-height: 44rpx;
247 } 258 }
248 } 259 }
249 260
@@ -251,40 +262,39 @@ @@ -251,40 +262,39 @@
251 /* 分组入口 */ 262 /* 分组入口 */
252 .section { 263 .section {
253 margin-top: 32rpx; 264 margin-top: 32rpx;
254 - .section-title {  
255 - font-size: 32rpx;  
256 - font-weight: 600;  
257 - color: rgba(0, 0, 0, 0.9);  
258 - line-height: 44rpx;  
259 - }  
260 265
261 - .grid {  
262 - margin-top: 28rpx;  
263 - display: grid;  
264 - grid-template-columns: repeat(4, 1fr);  
265 - gap: 32rpx;  
266 - } 266 + .section-title {
  267 + font-size: 32rpx;
  268 + font-weight: 600;
  269 + color: rgba(0, 0, 0, 0.9);
  270 + line-height: 44rpx;
  271 + }
267 272
268 - .grid-item {  
269 - display: flex;  
270 - flex-direction: column;  
271 - align-items: center;  
272 - } 273 + .grid {
  274 + margin-top: 28rpx;
  275 + display: grid;
  276 + grid-template-columns: repeat(4, 1fr);
  277 + gap: 32rpx;
  278 + }
273 279
274 - .grid-icon {  
275 - width: 96rpx;  
276 - height: 96rpx;  
277 - border-radius: 24rpx;  
278 - } 280 + .grid-item {
  281 + display: flex;
  282 + flex-direction: column;
  283 + align-items: center;
  284 + }
  285 +
  286 + .grid-icon {
  287 + width: 96rpx;
  288 + height: 96rpx;
  289 + border-radius: 24rpx;
  290 + }
279 291
280 .grid-text { 292 .grid-text {
281 margin-top: 16rpx; 293 margin-top: 16rpx;
282 font-size: 24rpx; 294 font-size: 24rpx;
283 - color: rgba(0,0,0,0.6); 295 + color: rgba(0, 0, 0, 0.6);
284 text-align: center; 296 text-align: center;
285 } 297 }
286 298
287 } 299 }
288 -  
289 -  
290 </style> 300 </style>