Blame view

antis-ncc-admin/src/views/lqInventory/index.vue 11.3 KB
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
1
  <template>
1138c09e   李宇   feat(LqLaundryFlo...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  	<div class="NCC-common-layout">
  		<div class="NCC-common-layout-center">
  			<!-- 产品查询条件 -->
  			<el-row class="NCC-common-search-box" :gutter="16">
  				<el-form @submit.native.prevent>
  					<el-col :span="6">
  						<el-form-item label="产品名称">
  							<el-input v-model="productQuery.productName" placeholder="产品名称" clearable />
  						</el-form-item>
  					</el-col>
  					<el-col :span="6">
  						<el-form-item label="产品类别">
  							<el-input v-model="productQuery.productCategory" placeholder="产品类别" clearable />
  						</el-form-item>
  					</el-col>
  					<el-col :span="6">
  						<el-form-item label="上架状态">
  							<el-select v-model="productQuery.onShelfStatus" placeholder="上架状态" clearable>
  								<el-option label="上架" :value="1" />
  								<el-option label="下架" :value="0" />
  							</el-select>
  						</el-form-item>
  					</el-col>
  					<el-col :span="6">
  						<el-form-item>
  							<el-button type="primary" icon="el-icon-search" @click="searchProduct()">查询</el-button>
  							<el-button icon="el-icon-refresh-right" @click="resetProduct()">重置</el-button>
  						</el-form-item>
  					</el-col>
  				</el-form>
  			</el-row>
  			<!-- 产品列表 -->
  			<div class="NCC-common-layout-main NCC-flex-main">
  				<div class="NCC-common-head">
  					<div>
  						<el-button type="primary" icon="el-icon-plus" @click="addProduct()">新增产品</el-button>
  						<el-button type="primary" icon="el-icon-plus" @click="addInventory()">添加库存</el-button>
  						<el-button type="primary" icon="el-icon-plus" @click="addUsage()">添加使用记录</el-button>
97151af6   李宇   feat(lqInventory)...
40
41
  						<el-button type="success" icon="el-icon-document" @click="viewApplicationList()">申请列表</el-button>
  						<el-button type="info" icon="el-icon-data-analysis" @click="viewStatistics()">门店领取统计</el-button>
4e2687f7   李宇   最新
42
  						<el-button type="primary" icon="el-icon-printer" @click="viewPendingDelivery()">待领取统计</el-button>
1138c09e   李宇   feat(LqLaundryFlo...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  					</div>
  					<div class="NCC-common-head-right">
  						<el-tooltip effect="dark" content="刷新" placement="top">
  							<el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
  								@click="initProductData()" />
  						</el-tooltip>
  						<screenfull isContainer />
  					</div>
  				</div>
  				<NCC-table v-loading="productLoading" :data="productList"
  					:header-cell-style="{ background: '#f5f7fa', color: '#606266' }">
  					<!-- <el-table-column label="产品ID" align="center">
  						<template slot-scope="scope">
  							<div class="product-id-info">
  								<i class="el-icon-postcard product-id-icon"></i>
  								<span class="text-nowrap">{{ scope.row.id || '无' }}</span>
  							</div>
  						</template>
  					</el-table-column> -->
  					<el-table-column label="产品名称" width="180" align="center" prop="productName"/>
  					<el-table-column label="价格" align="center">
  						<template slot-scope="scope">
  							<div class="price-info">
  								<i class="el-icon-coin price-icon"></i>
49077d84   李宇   最新
67
  								<span class="text-nowrap">¥{{ formatMoney(scope.row.averagePrice) }}</span>
1138c09e   李宇   feat(LqLaundryFlo...
68
69
70
71
72
73
74
75
76
77
78
79
  							</div>
  						</template>
  					</el-table-column>
  					<el-table-column label="库存" align="center" prop="currentInventory"/>
  					<el-table-column label="产品类别" align="center" prop="productCategory"/>
  					<el-table-column label="归属部门" align="center" prop="departmentName">
  						<template slot-scope="scope">
  							<div class="department-info">
  								<span class="text-nowrap">{{ scope.row.departmentName || '无' }}</span>
  							</div>
  						</template>
  					</el-table-column>
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
80
  
1138c09e   李宇   feat(LqLaundryFlo...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
  					<el-table-column label="标准单位" align="center" prop="standardUnit"/>
  					<el-table-column label="上架状态" align="center" prop="onShelfStatus">
  						<template slot-scope="scope">
  							<div class="shelf-status-info">
  								<el-tag :type="scope.row.onShelfStatus === 1 ? 'success' : 'info'" size="small">
  									{{ scope.row.onShelfStatus === 1 ? '上架' : '下架' }}
  								</el-tag>
  							</div>
  						</template>
  					</el-table-column>
  					<el-table-column label="统计分类" align="center" prop="statisticsCategory"/>
  					<el-table-column label="归属仓库" align="center" prop="warehouse">
  						<template slot-scope="scope">
  							<div class="warehouse-info">
  								<i class="el-icon-office-building warehouse-icon"></i>
  								<span class="text-nowrap">{{ scope.row.warehouse || '无' }}</span>
  							</div>
  						</template>
  					</el-table-column>
  					<el-table-column label="供应商名称" align="center" prop="supplierName"/>
  					<!-- <el-table-column label="合同签订日期" align="center" prop="contractSignDate"/>
  					<el-table-column label="合同结束日期" align="center" prop="contractEndDate"/>
  					<el-table-column label="备注" align="center" prop="remark"/> -->
  					<el-table-column label="操作" width="280" align="left" fixed="right">
  						<template slot-scope="scope">
  							<div class="action-buttons">
  								<el-button v-if="scope.row.onShelfStatus === 1" type="text" icon="el-icon-view" @click="viewDetail(scope.row)"
  									class="view-btn">
  									查看详情
  								</el-button>
  								<el-button type="text" @click="toggleShelf(scope.row)">
  									{{ scope.row.onShelfStatus === 1 ? '下架' : '上架' }}
  								</el-button>
  								<el-button v-if="scope.row.onShelfStatus === 1" type="text" icon="el-icon-edit" @click="editProduct(scope.row)"
  									class="edit-btn">
  									编辑
  								</el-button>
  							</div>
  						</template>
  					</el-table-column>
  				</NCC-table>
  				<pagination :total="productTotal" :page.sync="productQuery.currentPage"
  					:limit.sync="productQuery.pageSize" @pagination="initProductData" />
  			</div>
  		</div>
  		<!-- 产品表单弹窗 -->
  		<ProductForm v-if="productFormVisible" ref="ProductForm" @refresh="refreshProduct" />
  		<!-- 产品详情弹窗(库存和使用记录) -->
  		<ProductDetailDialog v-if="detailDialogVisible" ref="ProductDetailDialog" @refresh="refreshProduct" />
  		<!-- 添加使用记录弹窗(多产品) -->
  		<UsageMultiForm v-if="usageMultiFormVisible" ref="UsageMultiForm" @refresh="refreshProduct" />
  		<!-- 添加库存弹窗 -->
  		<InventoryForm v-if="inventoryFormVisible" ref="InventoryForm" @refresh="refreshProduct" />
  	</div>
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
135
136
137
  </template>
  
  <script>
384a1e80   李宇   ```
138
  import request from '@/utils/request'
1138c09e   李宇   feat(LqLaundryFlo...
139
140
141
142
143
  import ProductForm from './product-form.vue'
  import ProductDetailDialog from './product-detail-dialog.vue'
  import UsageMultiForm from './usage-multi-form.vue'
  import InventoryForm from './inventory-form.vue'
  
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
144
  export default {
1138c09e   李宇   feat(LqLaundryFlo...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  	components: { ProductForm, ProductDetailDialog, UsageMultiForm, InventoryForm },
  	data() {
  		return {
  			// 产品相关
  			productList: [],
  			productLoading: false,
  			productTotal: 0,
  			productQuery: {
  				currentPage: 1,
  				pageSize: 20,
  				productName: undefined,
  				productCategory: undefined,
  				onShelfStatus: undefined
  			},
  			productFormVisible: false,
  			detailDialogVisible: false,
  			usageMultiFormVisible: false,
  			inventoryFormVisible: false
  		}
  	},
  	created() {
  		this.initProductData()
  	},
  	methods: {
  		// 产品相关方法
  		initProductData() {
  			this.productLoading = true
  			let query = { ...this.productQuery }
  			// 移除空值
  			Object.keys(query).forEach(key => {
  				if (query[key] === undefined || query[key] === null || query[key] === '') {
  					delete query[key]
  				}
  			})
  			request({
  				url: '/api/Extend/LqProduct/GetList',
384a1e80   李宇   ```
181
  				method: 'GET',
1138c09e   李宇   feat(LqLaundryFlo...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
  				data: query
  			}).then(res => {
  				if (res.code == 200 && res.data) {
  					this.productList = res.data.list || []
  					this.productTotal = res.data.pagination ? res.data.pagination.total : 0
  				} else {
  					this.productList = []
  					this.productTotal = 0
  				}
  				this.productLoading = false
  			}).catch(() => {
  				this.productLoading = false
  				this.productList = []
  				this.productTotal = 0
  			})
  		},
  		searchProduct() {
  			this.productQuery.currentPage = 1
  			this.initProductData()
  		},
  		resetProduct() {
  			this.productQuery = {
  				currentPage: 1,
  				pageSize: 20,
  				productName: undefined,
  				productCategory: undefined,
  				onShelfStatus: undefined
  			}
  			this.initProductData()
  		},
  		addProduct() {
  			this.productFormVisible = true
  			this.$nextTick(() => {
  				this.$refs.ProductForm.init()
  			})
  		},
  		editProduct(row) {
  			this.productFormVisible = true
  			this.$nextTick(() => {
  				this.$refs.ProductForm.init(row.id)
  			})
  		},
  		viewDetail(row) {
  			this.detailDialogVisible = true
  			this.$nextTick(() => {
  				this.$refs.ProductDetailDialog.init(row.id, row)
86ade5ce   李宇   报表
228
  				this.$forceUpdate()
1138c09e   李宇   feat(LqLaundryFlo...
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
  			})
  		},
  		toggleShelf(row) {
  			const status = row.onShelfStatus === 1 ? 0 : 1
  			const statusText = status === 1 ? '上架' : '下架'
  			this.$confirm(`确定要${statusText}该产品吗?`, '提示', {
  				type: 'warning'
  			}).then(() => {
  				request({
  					url: '/api/Extend/LqProduct/ToggleShelf',
  					method: 'PUT',
  					data: {
  						productId: row.id,
  						onShelfStatus: status
  					}
  				}).then(res => {
  					this.$message({
  						type: 'success',
  						message: res.msg || `${statusText}成功`,
  						onClose: () => {
  							this.initProductData()
  						}
  					})
  				})
  			}).catch(() => { })
  		},
  		refreshProduct() {
  			this.productFormVisible = false
  			this.usageMultiFormVisible = false
  			this.inventoryFormVisible = false
  			this.initProductData()
  		},
  		addInventory() {
  			this.inventoryFormVisible = true
  			this.$nextTick(() => {
  				// 从列表页调用,不传产品ID,只显示上架产品
  				this.$refs.InventoryForm.init()
  			})
  		},
  		addUsage() {
  			this.usageMultiFormVisible = true
  			this.$nextTick(() => {
  				this.$refs.UsageMultiForm.init()
  			})
  		},
97151af6   李宇   feat(lqInventory)...
274
275
276
277
278
279
280
281
282
283
284
285
  		viewApplicationList() {
  			this.$router.push({
  				path: '/lqInventory/application-list',
  				query: {}
  			})
  		},
  		viewStatistics() {
  			this.$router.push({
  				path: '/lqInventory/store-receive-statistics',
  				query: {}
  			})
  		},
4e2687f7   李宇   最新
286
287
288
289
290
291
  		viewPendingDelivery() {
  			this.$router.push({
  				path: '/lqInventory/warehouse-pending-delivery',
  				query: {}
  			})
  		},
1138c09e   李宇   feat(LqLaundryFlo...
292
293
294
295
296
297
298
299
  		// 工具方法
  		formatMoney(amount) {
  			if (!amount && amount !== 0) return '0.00'
  			return Number(amount).toFixed(2)
  		}
  	}
  }
  </script>
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
300
  
1138c09e   李宇   feat(LqLaundryFlo...
301
302
303
304
305
306
307
308
  <style lang="scss" scoped>
  // 通用文本不换行样式
  .text-nowrap {
  	white-space: nowrap;
  	overflow: hidden;
  	text-overflow: ellipsis;
  	max-width: 100%;
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
309
  
1138c09e   李宇   feat(LqLaundryFlo...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  // 产品相关样式
  .product-id-info,
  .product-name-info,
  .price-info,
  .category-info,
  .unit-info,
  .shelf-status-info,
  .statistics-info,
  .warehouse-info,
  .supplier-info {
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	gap: 6px;
  }
  
  .product-id-icon,
  .product-name-icon {
  	color: #409EFF;
  	font-size: 16px;
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
331
  
1138c09e   李宇   feat(LqLaundryFlo...
332
333
334
335
  .price-icon {
  	color: #67C23A;
  	font-size: 16px;
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
336
  
1138c09e   李宇   feat(LqLaundryFlo...
337
338
339
340
341
342
  .category-icon,
  .unit-icon,
  .statistics-icon {
  	color: #909399;
  	font-size: 16px;
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
343
  
1138c09e   李宇   feat(LqLaundryFlo...
344
345
  .shelf-status-icon {
  	font-size: 16px;
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
346
  
1138c09e   李宇   feat(LqLaundryFlo...
347
348
349
  	&.status-on {
  		color: #67C23A;
  	}
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
350
  
1138c09e   李宇   feat(LqLaundryFlo...
351
352
353
354
  	&.status-off {
  		color: #909399;
  	}
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
355
  
1138c09e   李宇   feat(LqLaundryFlo...
356
357
358
359
360
  .warehouse-icon,
  .supplier-icon {
  	color: #409EFF;
  	font-size: 16px;
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
361
  
1138c09e   李宇   feat(LqLaundryFlo...
362
363
364
365
366
  // 操作按钮样式
  .action-buttons {
  	display: flex;
  	align-items: center;
  	gap: 8px;
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
367
  
1138c09e   李宇   feat(LqLaundryFlo...
368
369
  	.view-btn {
  		color: #409EFF;
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
370
  
1138c09e   李宇   feat(LqLaundryFlo...
371
372
373
374
  		&:hover {
  			color: #66b1ff;
  		}
  	}
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
375
  
1138c09e   李宇   feat(LqLaundryFlo...
376
377
  	.edit-btn {
  		color: #409EFF;
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
378
  
1138c09e   李宇   feat(LqLaundryFlo...
379
380
381
382
  		&:hover {
  			color: #66b1ff;
  		}
  	}
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
383
  }
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
384
  
1138c09e   李宇   feat(LqLaundryFlo...
385
386
387
  // 表格行悬停效果
  ::v-deep .el-table__row:hover {
  	background-color: #f5f7fa;
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
388
389
  }
  
1138c09e   李宇   feat(LqLaundryFlo...
390
391
392
393
394
395
396
397
398
  // 表格头部样式
  ::v-deep .el-table__header-wrapper {
  	.el-table__header {
  		th {
  			background-color: #f5f7fa;
  			color: #606266;
  			font-weight: 600;
  		}
  	}
f86c9c69   “wangming”   添加库存管理和学习班级管理功能
399
400
  }
  </style>