Просмотр исходного кода

【优化】参考价统一单位

xiangpengfei 1 год назад
Родитель
Сommit
c1157a04e6
1 измененных файлов с 329 добавлено и 284 удалено
  1. 329 284
      pages/warehouse/warehouse.vue

+ 329 - 284
pages/warehouse/warehouse.vue

@@ -1,307 +1,352 @@
1 1
 <template>
2
-	<view class="page">
3
-		<view class="navbar">
4
-			<view v-for="(item, index) in navList" :key="index" class="nav-item"
5
-				:class="{current: tabCurrentIndex === index}" @click="tabClick(index)">
6
-				{{item.text}}
7
-			</view>
8
-		</view>
9
-		<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
10
-			<swiper-item class="tab-content">
11
-				<scroll-view class="list-scroll-content" scroll-y>
12
-					<view class="warehouse-list">
13
-						<view v-for="(warehouseItem, index) in warehousesList" :key="index" class="warehouse-item" @click="goPage(warehouseItem)">
14
-							<view class="warehouse-header">
15
-								<view class="info-container">
16
-									<view class="warehouse-name">
17
-										<image src="../../static/icons/warehouse-ico.png" mode="widthFix"></image>
18
-										<text>仓房名称:{{ warehouseItem.cfmc }}</text>
19
-									</view>
20
-								</view>
21
-								<view class="select-button" v-if="sourcePage!='self'">
22
-									<checkbox :checked="warehouseItem.checked" @click.stop="handleCheck(index)" />
23
-								</view>
24
-							</view>
25
-							<view class="warehouse-details">
26
-								<view class="detail-row">
27
-									<text>仓库类型:{{ getDictLabelSync(DICT_TYPE.SYSTEM_CFLX, warehouseItem.cflx) }}</text>
28
-									<text>仓库状态:{{ getDictLabelSync(DICT_TYPE.SYSTEM_CAZT, warehouseItem.cazt) }}</text>
29
-								</view>
30
-								<view class="detail-row">
31
-									<text>设计仓容:{{ warehouseItem.sjcr }}</text>
32
-									<text>是否空仓:{{ warehouseItem.sfkc === 0 ? '否' : '是' }}</text>
33
-								</view>
34
-								<view class="detail-row">
35
-									<text>租仓参考价:{{ warehouseItem.zcckj }}</text>
36
-									<text>委托保管参考价:{{ warehouseItem.wtbgckj ? '1个' : '0个' }}</text>
37
-								</view>
38
-							</view>
39
-						</view>
40
-					</view>
41
-
42
-				</scroll-view>
43
-				<view class="button-container" v-if="sourcePage!='self'">
44
-					<view class="button-pad">
45
-						<button class="confirm" @click="confirmSelection">确认选择</button>
46
-					</view>
47
-				</view>
48
-			</swiper-item>
49
-			<swiper-item class="tab-content">
50
-				<scroll-view class="info-scroll-content" scroll-y>
51
-					<view class="warehouse-info">
52
-						<warehouse-info :kqInfo="kqInfo"></warehouse-info>
53
-					</view>
54
-				</scroll-view>
55
-			</swiper-item>
56
-		</swiper>
57
-
58
-	</view>
2
+  <view class="page">
3
+    <view class="navbar">
4
+      <view
5
+        v-for="(item, index) in navList"
6
+        :key="index"
7
+        class="nav-item"
8
+        :class="{ current: tabCurrentIndex === index }"
9
+        @click="tabClick(index)"
10
+      >
11
+        {{ item.text }}
12
+      </view>
13
+    </view>
14
+    <swiper
15
+      :current="tabCurrentIndex"
16
+      class="swiper-box"
17
+      duration="300"
18
+      @change="changeTab"
19
+    >
20
+      <swiper-item class="tab-content">
21
+        <scroll-view class="list-scroll-content" scroll-y>
22
+          <view class="warehouse-list">
23
+            <view
24
+              v-for="(warehouseItem, index) in warehousesList"
25
+              :key="index"
26
+              class="warehouse-item"
27
+              @click="goPage(warehouseItem)"
28
+            >
29
+              <view class="warehouse-header">
30
+                <view class="info-container">
31
+                  <view class="warehouse-name">
32
+                    <image
33
+                      src="../../static/icons/warehouse-ico.png"
34
+                      mode="widthFix"
35
+                    ></image>
36
+                    <text>仓房名称:{{ warehouseItem.cfmc }}</text>
37
+                  </view>
38
+                </view>
39
+                <view class="select-button" v-if="sourcePage != 'self'">
40
+                  <checkbox
41
+                    :checked="warehouseItem.checked"
42
+                    @click.stop="handleCheck(index)"
43
+                  />
44
+                </view>
45
+              </view>
46
+              <view class="warehouse-details">
47
+                <view class="detail-row">
48
+                  <text
49
+                    >仓库类型:{{
50
+                      getDictLabelSync(
51
+                        DICT_TYPE.SYSTEM_CFLX,
52
+                        warehouseItem.cflx
53
+                      )
54
+                    }}</text
55
+                  >
56
+                  <text
57
+                    >仓库状态:{{
58
+                      getDictLabelSync(
59
+                        DICT_TYPE.SYSTEM_CAZT,
60
+                        warehouseItem.cazt
61
+                      )
62
+                    }}</text
63
+                  >
64
+                </view>
65
+                <view class="detail-row">
66
+                  <text>设计仓容:{{ warehouseItem.sjcr }}</text>
67
+                  <text
68
+                    >是否空仓:{{
69
+                      warehouseItem.sfkc === 0 ? "否" : "是"
70
+                    }}</text
71
+                  >
72
+                </view>
73
+                <view class="detail-row">
74
+                  <text
75
+                    >租仓参考价:{{ warehouseItem.zcckj || "-" }}
76
+                    元/月
77
+                  </text>
78
+                  <text
79
+                    >委托保管参考价:{{
80
+                      warehouseItem.wtbgckj || "-"
81
+                    }}元/吨/月</text
82
+                  >
83
+                </view>
84
+              </view>
85
+            </view>
86
+          </view>
87
+        </scroll-view>
88
+        <view class="button-container" v-if="sourcePage != 'self'">
89
+          <view class="button-pad">
90
+            <button class="confirm" @click="confirmSelection">确认选择</button>
91
+          </view>
92
+        </view>
93
+      </swiper-item>
94
+      <swiper-item class="tab-content">
95
+        <scroll-view class="info-scroll-content" scroll-y>
96
+          <view class="warehouse-info">
97
+            <warehouse-info :kqInfo="kqInfo"></warehouse-info>
98
+          </view>
99
+        </scroll-view>
100
+      </swiper-item>
101
+    </swiper>
102
+  </view>
59 103
 </template>
60 104
 
61 105
 <script setup>
62
-	import { ref, reactive, onMounted } from 'vue';
63
-	import { onLoad } from '@dcloudio/uni-app';
64
-	import { getDictOptions, DICT_TYPE, getDictLabelSync } from "@/utils/dict.js";
65
-	import { getCaxxByKqIdForClr, getKqxxByKqId, getStoreroom } from "@/api/grainDepositor";
66
-	import warehouseInfo from "./components/warehouseInfo/warehouseInfo.vue";
67
-	const sourcePage = ref('all')
68
-	const navList = [{
69
-			state: 0,
70
-			text: '仓房基本信息',
71
-			loadingType: 'more',
72
-			orderList: []
73
-		},
74
-		{
75
-			state: 1,
76
-			text: '库区基本信息',
77
-			loadingType: 'more',
78
-			orderList: []
79
-		}
80
-	]
81
-	const tabCurrentIndex = ref(0)
82
-	const tabClick = (index) => {
83
-		tabCurrentIndex.value = index;
84
-	}
85
-	const detailkqId = ref(null);
86
-	const warehousesList = ref([]);
87
-	const kqInfo = ref({})
88
-	
89
-	
90
-	onLoad(async (options) => {
91
-	  if (options && options.kqId) {
92
-		sourcePage.value = options.source
93
-		detailkqId.value = options.kqId;
94
-		
95
-		let postData = {
96
-			'listType': 3,
97
-			'kqId': detailkqId.value,
98
-		}
99
-		if(sourcePage.value === 'self'){
100
-			postData.listType = 4
101
-		}
102
-		const getData = await getCaxxByKqIdForClr(postData);
103
-		warehousesList.value = getData.data
104
-		
105
-		const getKqxx = await getKqxxByKqId({'kqId': detailkqId.value });
106
-		kqInfo.value = getKqxx.data
107
-		
108
-	    console.log('接收到的 id:', JSON.stringify(getData));
109
-	  } else {
110
-	    console.warn('没有接收到 id 参数');
111
-	  }
112
-	});
113
-	
114
-	const handleCheck = (index) => {
115
-		warehousesList.value[index].checked = !warehousesList.value[index].checked;
116
-	};
117
-	
118
-	const changeTab = () => {
106
+import { ref, reactive, onMounted } from "vue";
107
+import { onLoad } from "@dcloudio/uni-app";
108
+import { getDictOptions, DICT_TYPE, getDictLabelSync } from "@/utils/dict.js";
109
+import {
110
+  getCaxxByKqIdForClr,
111
+  getKqxxByKqId,
112
+  getStoreroom,
113
+} from "@/api/grainDepositor";
114
+import warehouseInfo from "./components/warehouseInfo/warehouseInfo.vue";
115
+const sourcePage = ref("all");
116
+const navList = [
117
+  {
118
+    state: 0,
119
+    text: "仓房基本信息",
120
+    loadingType: "more",
121
+    orderList: [],
122
+  },
123
+  {
124
+    state: 1,
125
+    text: "库区基本信息",
126
+    loadingType: "more",
127
+    orderList: [],
128
+  },
129
+];
130
+const tabCurrentIndex = ref(0);
131
+const tabClick = (index) => {
132
+  tabCurrentIndex.value = index;
133
+};
134
+const detailkqId = ref(null);
135
+const warehousesList = ref([]);
136
+const kqInfo = ref({});
137
+
138
+onLoad(async (options) => {
139
+  if (options && options.kqId) {
140
+    sourcePage.value = options.source;
141
+    detailkqId.value = options.kqId;
142
+
143
+    let postData = {
144
+      listType: 3,
145
+      kqId: detailkqId.value,
146
+    };
147
+    if (sourcePage.value === "self") {
148
+      postData.listType = 4;
149
+    }
150
+    const getData = await getCaxxByKqIdForClr(postData);
151
+    warehousesList.value = getData.data;
152
+
153
+    const getKqxx = await getKqxxByKqId({ kqId: detailkqId.value });
154
+    kqInfo.value = getKqxx.data;
155
+
156
+    console.log("接收到的 id:", JSON.stringify(getData));
157
+  } else {
158
+    console.warn("没有接收到 id 参数");
159
+  }
160
+});
119 161
 
120
-	};
121
-	const confirmSelection = async () => {
122
-		const selIds = warehousesList.value
123
-		  .filter(item => item.checked) // 筛选出checked为true的项
124
-		  .map(item => item.caId);       // 提取每个项的caId
125
-		
126
-		  if (selIds.length > 0) {
127
-		    try {
128
-		      const getData = await getStoreroom({ caIds: selIds });
129
-			  uni.navigateTo({
130
-			    url: `/pages/grainDepositor/grainDepositorLayout?tabIndex=1`
131
-			  });
132
-		    } catch (error) {
133
-		      console.error('请求失败:', error);
134
-		    }
135
-		  } else {
136
-			  uni.navigateTo({
137
-			    url: `/pages/grainDepositor/grainDepositorLayout?tabIndex=1`
138
-			  });
139
-		    console.warn('未选择任何仓库');
140
-		  }
141
-	};
142
-	const goPage = async (warehouseItem) => {
143
-		if(sourcePage.value === 'self'){
144
-			uni.navigateTo({
145
-			  url: `/pages/infoDetails/infoDetailsLayout?caId=${warehouseItem.caId}`
146
-			});
147
-		}
148
-	};
149
-	// 组件挂载时预加载需要的字典
150
-	onMounted(async () => {
151
-	  await getDictOptions(DICT_TYPE.SYSTEM_CAZT);
152
-	  await getDictOptions(DICT_TYPE.SYSTEM_CFLX);
153
-	});
162
+const handleCheck = (index) => {
163
+  warehousesList.value[index].checked = !warehousesList.value[index].checked;
164
+};
165
+
166
+const changeTab = () => {};
167
+const confirmSelection = async () => {
168
+  const selIds = warehousesList.value
169
+    .filter((item) => item.checked) // 筛选出checked为true的项
170
+    .map((item) => item.caId); // 提取每个项的caId
171
+
172
+  if (selIds.length > 0) {
173
+    try {
174
+      const getData = await getStoreroom({ caIds: selIds });
175
+      uni.navigateTo({
176
+        url: `/pages/grainDepositor/grainDepositorLayout?tabIndex=1`,
177
+      });
178
+    } catch (error) {
179
+      console.error("请求失败:", error);
180
+    }
181
+  } else {
182
+    uni.navigateTo({
183
+      url: `/pages/grainDepositor/grainDepositorLayout?tabIndex=1`,
184
+    });
185
+    console.warn("未选择任何仓库");
186
+  }
187
+};
188
+const goPage = async (warehouseItem) => {
189
+  if (sourcePage.value === "self") {
190
+    uni.navigateTo({
191
+      url: `/pages/infoDetails/infoDetailsLayout?caId=${warehouseItem.caId}`,
192
+    });
193
+  }
194
+};
195
+// 组件挂载时预加载需要的字典
196
+onMounted(async () => {
197
+  await getDictOptions(DICT_TYPE.SYSTEM_CAZT);
198
+  await getDictOptions(DICT_TYPE.SYSTEM_CFLX);
199
+});
154 200
 </script>
155 201
 
156 202
 <style lang="scss" scoped>
157
-	.page {
158
-		position: relative; // 确保伪元素相对于 .page 定位
159
-	}
203
+.page {
204
+  position: relative; // 确保伪元素相对于 .page 定位
205
+}
206
+
207
+.page::before {
208
+  content: "";
209
+  position: absolute;
210
+  top: 0;
211
+  left: 0;
212
+  width: 100%;
213
+  height: 200rpx; // 设置渐变的高度
214
+  background: linear-gradient(180deg, #cfddfc, #eff2f5);
215
+  z-index: -1; // 确保它在内容之下
216
+}
217
+
218
+.warehouse-list {
219
+  padding: 40rpx 20rpx 20rpx;
220
+
221
+  .warehouse-item {
222
+    background: linear-gradient(180deg, #ffffff, #f5f8ff);
223
+    border-radius: 10px;
224
+    padding: 20px 15px 10px;
225
+    margin-bottom: 25rpx;
226
+    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
227
+
228
+    .warehouse-header {
229
+      display: flex;
230
+      justify-content: space-between;
231
+      align-items: flex-start; // 对齐到顶部
232
+      padding-bottom: 30rpx;
233
+      border-bottom: 1px solid #e7e8ea;
234
+      font-size: 35rpx;
235
+      color: #00122f;
160 236
 
161
-	.page::before {
162
-		content: '';
163
-		position: absolute;
164
-		top: 0;
165
-		left: 0;
166
-		width: 100%;
167
-		height: 200rpx; // 设置渐变的高度
168
-		background: linear-gradient(180deg, #cfddfc, #eff2f5);
169
-		z-index: -1; // 确保它在内容之下
170
-	}
237
+      .info-container {
238
+        flex-grow: 1;
171 239
 
172
-	.warehouse-list {
173
-		padding: 40rpx 20rpx 20rpx;
240
+        .warehouse-name,
241
+        .warehouse-address {
242
+          display: flex;
243
+          align-items: center;
244
+          margin-bottom: 5px;
174 245
 
175
-		.warehouse-item {
176
-			background: linear-gradient(180deg, #ffffff, #F5F8FF);
177
-			border-radius: 10px;
178
-			padding: 20px 15px 10px;
179
-			margin-bottom: 25rpx;
180
-			box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
246
+          &:last-child {
247
+            margin-bottom: 0;
248
+          }
181 249
 
182
-			.warehouse-header {
183
-				display: flex;
184
-				justify-content: space-between;
185
-				align-items: flex-start; // 对齐到顶部
186
-				padding-bottom: 30rpx;
187
-				border-bottom: 1px solid #E7E8EA;
188
-				font-size: 35rpx;
189
-				color: #00122F;
250
+          image {
251
+            width: 20px;
252
+            height: 20px;
253
+            margin-right: 10px;
254
+          }
255
+        }
256
+      }
190 257
 
191
-				.info-container {
192
-					flex-grow: 1;
258
+      .select-button {
259
+        display: flex;
260
+        align-items: flex-start;
261
+        margin-left: 10px;
262
+      }
263
+    }
193 264
 
194
-					.warehouse-name,
195
-					.warehouse-address {
196
-						display: flex;
197
-						align-items: center;
198
-						margin-bottom: 5px;
265
+    .warehouse-details {
266
+      padding-top: 30rpx;
267
+      font-size: 30rpx;
268
+      color: #747476;
199 269
 
200
-						&:last-child {
201
-							margin-bottom: 0;
202
-						}
270
+      .detail-row {
271
+        display: flex;
272
+        margin-bottom: 10px;
273
+        text {
274
+          flex: 1;
275
+        }
276
+      }
277
+    }
278
+  }
279
+}
280
+.button-container {
281
+  position: fixed;
282
+  bottom: 0;
283
+  background-color: #ffffff;
284
+  width: 100vw;
285
+  padding: 40rpx 0;
203 286
 
204
-						image {
205
-							width: 20px;
206
-							height: 20px;
207
-							margin-right: 10px;
208
-						}
209
-					}
210
-				}
287
+  .button-pad {
288
+    padding: 0 40rpx;
289
+    display: flex;
290
+    justify-content: space-between;
291
+  }
211 292
 
212
-				.select-button {
213
-					display: flex;
214
-					align-items: flex-start;
215
-					margin-left: 10px;
216
-				}
217
-			}
293
+  .confirm {
294
+    width: 88%;
295
+    height: 70rpx;
296
+    line-height: 70rpx;
297
+    border-radius: 10rpx;
298
+    background-color: #1e5fdf;
299
+    color: #fff;
300
+    font-size: 28rpx;
301
+    text-align: center;
302
+  }
303
+}
218 304
 
219
-			.warehouse-details {
220
-				padding-top: 30rpx;
221
-				font-size: 30rpx;
222
-				color: #747476;
305
+.warehouse-info {
306
+  padding-top: 20rpx;
307
+}
223 308
 
224
-				.detail-row {
225
-					display: flex;
226
-					margin-bottom: 10px;
227
-					text {
228
-						flex: 1;
229
-					}
230
-				}
231
-			}
232
-		}
233
-	}
234
-	.button-container {
235
-		position: fixed;
236
-		bottom: 0;
237
-		background-color: #ffffff;
238
-		width: 100vw;
239
-		padding: 40rpx 0;
309
+.navbar {
310
+  display: flex;
311
+  height: 40px;
312
+  padding: 0 5px;
313
+  position: relative;
314
+  z-index: 10;
240 315
 
241
-		.button-pad {
242
-			padding: 0 40rpx;
243
-			display: flex;
244
-			justify-content: space-between;
245
-		}
316
+  .nav-item {
317
+    flex: 1;
318
+    display: flex;
319
+    justify-content: center;
320
+    align-items: center;
321
+    height: 100%;
322
+    font-size: 35rpx;
323
+    position: relative;
324
+    color: #334b68;
246 325
 
247
-		.confirm {
248
-			width: 88%;
249
-			height: 70rpx;
250
-			line-height: 70rpx;
251
-			border-radius: 10rpx;
252
-			background-color: #1E5FDF;
253
-			color: #fff;
254
-			font-size: 28rpx;
255
-			text-align: center;
326
+    &.current {
327
+      color: #0f2239;
328
+      &:after {
329
+        content: "";
330
+        position: absolute;
331
+        left: 50%;
332
+        bottom: 0;
333
+        transform: translateX(-50%);
334
+        width: 60%;
335
+        height: 0;
336
+        border-bottom: 4px solid #789fec;
337
+      }
338
+    }
339
+  }
340
+}
256 341
 
257
-		}
258
-	}
259
-	
260
-	.warehouse-info{
261
-		padding-top: 20rpx;
262
-	}
342
+.swiper-box {
343
+  height: calc(100vh - 80rpx);
344
+}
263 345
 
264
-	.navbar {
265
-		display: flex;
266
-		height: 40px;
267
-		padding: 0 5px;
268
-		position: relative;
269
-		z-index: 10;
270
-	
271
-		.nav-item {
272
-			flex: 1;
273
-			display: flex;
274
-			justify-content: center;
275
-			align-items: center;
276
-			height: 100%;
277
-			font-size: 35rpx;
278
-			position: relative;
279
-			color: #334b68;
280
-	
281
-			&.current {
282
-				color: #0f2239;
283
-				&:after {
284
-					content: '';
285
-					position: absolute;
286
-					left: 50%;
287
-					bottom: 0;
288
-					transform: translateX(-50%);
289
-					width: 60%;
290
-					height: 0;
291
-					border-bottom: 4px solid #789fec;
292
-				}
293
-			}
294
-		}
295
-	}
296
-	
297
-	.swiper-box {
298
-		height: calc(100vh - 80rpx);
299
-	}
300
-	
301
-	.list-scroll-content {
302
-		height: calc(100vh - 200rpx);
303
-	}
304
-	.info-scroll-content{
305
-		height: calc(100vh - 120rpx);
306
-	}
307
-</style>
346
+.list-scroll-content {
347
+  height: calc(100vh - 200rpx);
348
+}
349
+.info-scroll-content {
350
+  height: calc(100vh - 120rpx);
351
+}
352
+</style>