|
4 | 4 | <el-form-item label="商品名称" prop="name">
|
5 | 5 | <el-input v-model="queryParams.name" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery"/>
|
6 | 6 | </el-form-item>
|
7 |
| - |
8 | 7 | <el-form-item label="商品编码" prop="code">
|
9 | 8 | <el-input v-model="queryParams.code" placeholder="请输入商品编码" clearable @keyup.enter.native="handleQuery"/>
|
10 | 9 | </el-form-item>
|
11 |
| - |
12 | 10 | <el-form-item label="商品分类" prop="categoryIds">
|
13 | 11 | <el-cascader v-model="queryParams.categoryIds" placeholder="请输入商品分类"
|
14 | 12 | :options="categoryList" :props="propName" clearable ref="category"/>
|
15 | 13 | </el-form-item>
|
16 |
| - |
17 | 14 | <el-form-item label="商品品牌" prop="brandId">
|
18 | 15 | <el-select v-model="queryParams.brandId" placeholder="请输入商品品牌" clearable @keyup.enter.native="handleQuery">
|
19 | 16 | <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"/>
|
20 | 17 | </el-select>
|
21 | 18 | </el-form-item>
|
22 |
| - |
| 19 | + <!-- TODO 待实现:商品类型 --> |
| 20 | + <!-- TODO 待实现:商品标签 --> |
| 21 | + <!-- TODO 待实现:营销活动 --> |
| 22 | + <!-- TODO 前端优化:商品销量、商品价格,排的整齐一点 --> |
23 | 23 | <el-form-item label="商品销量">
|
24 |
| - <el-col |
25 |
| - :span="6" |
26 |
| - style="padding-left:0" |
27 |
| - > |
| 24 | + <el-col :span="7" style="padding-left:0"> |
28 | 25 | <el-form-item prop="salesCountMin">
|
29 |
| - <el-input v-model="queryParams.salesCountMin" placeholder="最小值" clearable |
30 |
| - @keyup.enter.native="handleQuery"/> |
| 26 | + <el-input v-model="queryParams.salesCountMin" placeholder="最低销量" clearable @keyup.enter.native="handleQuery"/> |
31 | 27 | </el-form-item>
|
32 | 28 | </el-col>
|
33 |
| - <el-col |
34 |
| - :span="1" |
35 |
| - > |
36 |
| - - |
37 |
| - </el-col> |
38 |
| - <el-col |
39 |
| - :span="6" |
40 |
| - style="padding-left:0" |
41 |
| - > |
| 29 | + <el-col :span="1">-</el-col> |
| 30 | + <el-col :span="7" style="padding-left:0"> |
42 | 31 | <el-form-item prop="salesCountMax">
|
43 |
| - <el-input v-model="queryParams.salesCountMax" placeholder="最大值" clearable |
44 |
| - @keyup.enter.native="handleQuery"/> |
| 32 | + <el-input v-model="queryParams.salesCountMax" placeholder="最高销量" clearable @keyup.enter.native="handleQuery"/> |
45 | 33 | </el-form-item>
|
46 | 34 | </el-col>
|
47 | 35 | </el-form-item>
|
48 |
| - |
49 | 36 | <el-form-item label="商品价格" prop="code">
|
50 |
| - <el-col |
51 |
| - :span="6" |
52 |
| - style="padding-left:0" |
53 |
| - > |
| 37 | + <el-col :span="7" style="padding-left:0"> |
54 | 38 | <el-form-item prop="marketPriceMin">
|
55 |
| - <el-input v-model="queryParams.marketPriceMin" placeholder="最小值" clearable |
56 |
| - @keyup.enter.native="handleQuery"/> |
| 39 | + <el-input v-model="queryParams.marketPriceMin" placeholder="最低价格" clearable @keyup.enter.native="handleQuery"/> |
57 | 40 | </el-form-item>
|
58 | 41 | </el-col>
|
59 |
| - <el-col |
60 |
| - :span="1" |
61 |
| - > |
62 |
| - - |
63 |
| - </el-col> |
64 |
| - <el-col |
65 |
| - :span="6" |
66 |
| - style="padding-left:0" |
67 |
| - > |
| 42 | + <el-col :span="1">-</el-col> |
| 43 | + <el-col :span="7" style="padding-left:0"> |
68 | 44 | <el-form-item prop="marketPriceMax">
|
69 |
| - <el-input v-model="queryParams.marketPriceMax" placeholder="最大值" clearable |
70 |
| - @keyup.enter.native="handleQuery"/> |
| 45 | + <el-input v-model="queryParams.marketPriceMax" placeholder="最高价格" clearable @keyup.enter.native="handleQuery"/> |
71 | 46 | </el-form-item>
|
72 | 47 | </el-col>
|
73 | 48 | </el-form-item>
|
74 |
| - |
75 | 49 | <el-form-item>
|
76 | 50 | <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
77 | 51 | <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
82 | 56 | <el-row :gutter="10" class="mb8">
|
83 | 57 | <el-col :span="1.5">
|
84 | 58 | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
85 |
| - v-hasPermi="['product:spu:create']">新增 |
86 |
| - </el-button> |
| 59 | + v-hasPermi="['product:spu:create']">添加商品</el-button> |
87 | 60 | </el-col>
|
88 | 61 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"/>
|
89 | 62 | </el-row>
|
|
96 | 69 | <el-table-column label="商品信息" align="center" width="260">
|
97 | 70 | <template slot-scope="scope">
|
98 | 71 | <div class="product-info">
|
99 |
| - <img |
100 |
| - v-if="scope.row.picUrls" |
101 |
| - :src="scope.row.picUrls[0]" |
102 |
| - alt="分类图片" |
103 |
| - class="img-height" |
104 |
| - /> |
| 72 | + <img v-if="scope.row.picUrls" :src="scope.row.picUrls[0]" alt="分类图片" class="img-height" /> |
105 | 73 | <div class="message">{{ scope.row.name }}</div>
|
106 | 74 | </div>
|
107 | 75 | </template>
|
| 76 | + <!-- TODO 前端优化:可以有个 + 号,点击后,展示每个 sku --> |
108 | 77 | </el-table-column>
|
109 |
| - <el-table-column label="价格" align="center" prop="marketPrice" :formatter="unitConversion"/> |
| 78 | + <el-table-column label="价格" align="center" prop="marketPrice" :formatter="formatPrice"/> |
110 | 79 | <el-table-column label="库存" align="center" prop="totalStock"/>
|
111 | 80 | <el-table-column label="销量" align="center" prop="salesCount"/>
|
112 | 81 | <el-table-column label="排序" align="center" prop="sort"/>
|
|
117 | 86 | </el-table-column>
|
118 | 87 | <el-table-column label="状态" align="center" prop="status">
|
119 | 88 | <template slot-scope="scope">
|
120 |
| - <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
| 89 | + <dict-tag :type="DICT_TYPE.PRODUCT_SPU_STATUS" :value="scope.row.status"/> |
121 | 90 | </template>
|
122 | 91 | </el-table-column>
|
123 |
| - |
124 | 92 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
125 | 93 | <template slot-scope="scope">
|
126 | 94 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
127 |
| - v-hasPermi="['product:spu:update']">修改 |
128 |
| - </el-button> |
| 95 | + v-hasPermi="['product:spu:update']">修改</el-button> |
129 | 96 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
130 |
| - v-hasPermi="['product:spu:delete']">删除 |
131 |
| - </el-button> |
| 97 | + v-hasPermi="['product:spu:delete']">删除</el-button> |
132 | 98 | </template>
|
133 | 99 | </el-table-column>
|
134 | 100 | </el-table>
|
|
141 | 107 | <el-table-column label="商品信息" align="center" width="260">
|
142 | 108 | <template slot-scope="scope">
|
143 | 109 | <div class="product-info">
|
144 |
| - <img |
145 |
| - v-if="scope.row.picUrls" |
146 |
| - :src="scope.row.picUrls[0]" |
147 |
| - alt="分类图片" |
148 |
| - class="img-height" |
149 |
| - /> |
| 110 | + <img v-if="scope.row.picUrls" :src="scope.row.picUrls[0]" alt="分类图片" class="img-height"/> |
150 | 111 | <div class="message">{{ scope.row.name }}</div>
|
151 | 112 | </div>
|
152 | 113 | </template>
|
153 | 114 | </el-table-column>
|
154 |
| - <el-table-column label="价格" align="center" prop="marketPrice" :formatter="unitConversion"/> |
| 115 | + <el-table-column label="价格" align="center" prop="marketPrice" :formatter="formatPrice"/> |
155 | 116 | <el-table-column label="库存" align="center" prop="totalStock"/>
|
156 | 117 | <el-table-column label="销量" align="center" prop="salesCount"/>
|
157 | 118 | <el-table-column label="排序" align="center" prop="sort"/>
|
|
162 | 123 | </el-table-column>
|
163 | 124 | <el-table-column label="状态" align="center" prop="status">
|
164 | 125 | <template slot-scope="scope">
|
165 |
| - <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
| 126 | + <dict-tag :type="DICT_TYPE.PRODUCT_SPU_STATUS" :value="scope.row.status"/> |
166 | 127 | </template>
|
167 | 128 | </el-table-column>
|
168 |
| - |
169 | 129 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
170 | 130 | <template slot-scope="scope">
|
171 | 131 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
172 |
| - v-hasPermi="['product:spu:update']">修改 |
173 |
| - </el-button> |
| 132 | + v-hasPermi="['product:spu:update']">修改</el-button> |
174 | 133 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
175 |
| - v-hasPermi="['product:spu:delete']">删除 |
176 |
| - </el-button> |
| 134 | + v-hasPermi="['product:spu:delete']">删除</el-button> |
177 | 135 | </template>
|
178 | 136 | </el-table-column>
|
179 | 137 | </el-table>
|
|
186 | 144 | <el-table-column label="商品信息" align="center" width="260">
|
187 | 145 | <template slot-scope="scope">
|
188 | 146 | <div class="product-info">
|
189 |
| - <img |
190 |
| - v-if="scope.row.picUrls" |
191 |
| - :src="scope.row.picUrls[0]" |
192 |
| - alt="分类图片" |
193 |
| - class="img-height" |
194 |
| - /> |
| 147 | + <img v-if="scope.row.picUrls" :src="scope.row.picUrls[0]" alt="分类图片" class="img-height"/> |
195 | 148 | <div class="message">{{ scope.row.name }}</div>
|
196 | 149 | </div>
|
197 | 150 | </template>
|
198 | 151 | </el-table-column>
|
199 |
| - <el-table-column label="价格" align="center" prop="marketPrice" :formatter="unitConversion"/> |
| 152 | + <el-table-column label="价格" align="center" prop="marketPrice" :formatter="formatPrice"/> |
200 | 153 | <el-table-column label="库存" align="center" prop="totalStock"/>
|
201 | 154 | <el-table-column label="销量" align="center" prop="salesCount"/>
|
202 | 155 | <el-table-column label="排序" align="center" prop="sort"/>
|
|
207 | 160 | </el-table-column>
|
208 | 161 | <el-table-column label="状态" align="center" prop="status">
|
209 | 162 | <template slot-scope="scope">
|
210 |
| - <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
| 163 | + <dict-tag :type="DICT_TYPE.PRODUCT_SPU_STATUS" :value="scope.row.status"/> |
211 | 164 | </template>
|
212 | 165 | </el-table-column>
|
213 |
| - |
214 | 166 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
215 | 167 | <template slot-scope="scope">
|
216 | 168 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
217 |
| - v-hasPermi="['product:spu:update']">修改 |
218 |
| - </el-button> |
| 169 | + v-hasPermi="['product:spu:update']">修改</el-button> |
219 | 170 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
220 |
| - v-hasPermi="['product:spu:delete']">删除 |
221 |
| - </el-button> |
| 171 | + v-hasPermi="['product:spu:delete']">删除</el-button> |
222 | 172 | </template>
|
223 | 173 | </el-table-column>
|
224 | 174 | </el-table>
|
|
231 | 181 | <el-table-column label="商品信息" align="center" width="260">
|
232 | 182 | <template slot-scope="scope">
|
233 | 183 | <div class="product-info">
|
234 |
| - <img |
235 |
| - v-if="scope.row.picUrls" |
236 |
| - :src="scope.row.picUrls[0]" |
237 |
| - alt="分类图片" |
238 |
| - class="img-height" |
239 |
| - /> |
| 184 | + <img v-if="scope.row.picUrls" :src="scope.row.picUrls[0]" alt="分类图片" class="img-height"/> |
240 | 185 | <div class="message">{{ scope.row.name }}</div>
|
241 | 186 | </div>
|
242 | 187 | </template>
|
243 | 188 | </el-table-column>
|
244 |
| - <el-table-column label="价格" align="center" prop="marketPrice" :formatter="unitConversion"/> |
| 189 | + <el-table-column label="价格" align="center" prop="marketPrice" :formatter="formatPrice"/> |
245 | 190 | <el-table-column label="库存" align="center" prop="totalStock"/>
|
246 | 191 | <el-table-column label="销量" align="center" prop="salesCount"/>
|
247 | 192 | <el-table-column label="排序" align="center" prop="sort"/>
|
|
252 | 197 | </el-table-column>
|
253 | 198 | <el-table-column label="状态" align="center" prop="status">
|
254 | 199 | <template slot-scope="scope">
|
255 |
| - <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
| 200 | + <dict-tag :type="DICT_TYPE.PRODUCT_SPU_STATUS" :value="scope.row.status"/> |
256 | 201 | </template>
|
257 | 202 | </el-table-column>
|
258 |
| - |
259 | 203 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
260 | 204 | <template slot-scope="scope">
|
261 | 205 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
262 |
| - v-hasPermi="['product:spu:update']">修改 |
263 |
| - </el-button> |
| 206 | + v-hasPermi="['product:spu:update']">修改</el-button> |
264 | 207 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
265 |
| - v-hasPermi="['product:spu:delete']">删除 |
266 |
| - </el-button> |
| 208 | + v-hasPermi="['product:spu:delete']">删除</el-button> |
267 | 209 | </template>
|
268 | 210 | </el-table-column>
|
269 | 211 | </el-table>
|
270 | 212 | </el-tab-pane>
|
271 | 213 | </el-tabs>
|
| 214 | + |
272 | 215 | <!-- 分页组件 -->
|
273 | 216 | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
274 | 217 | @pagination="getList"/>
|
275 |
| - |
276 | 218 | </div>
|
277 | 219 | </template>
|
278 | 220 |
|
@@ -353,9 +295,6 @@ export default {
|
353 | 295 | this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
|
354 | 296 | // 执行查询
|
355 | 297 | getSpuPage(params).then((response) => {
|
356 |
| - response.data.list.forEach(element => { |
357 |
| - element.price = this.divide(element.minPrice, 100) + "~" + this.divide(element.maxPrice, 100) |
358 |
| - }); |
359 | 298 | this.list = response.data.list;
|
360 | 299 | this.total = response.data.total;
|
361 | 300 | this.loading = false;
|
@@ -390,18 +329,16 @@ export default {
|
390 | 329 | .confirm('是否确认删除商品spu编号为"' + id + '"的数据项?')
|
391 | 330 | .then(function () {
|
392 | 331 | return deleteSpu(id);
|
393 |
| - }) |
394 |
| - .then(() => { |
| 332 | + }).then(() => { |
395 | 333 | this.getList();
|
396 | 334 | this.$modal.msgSuccess("删除成功");
|
397 |
| - }) |
398 |
| - .catch(() => { |
| 335 | + }).catch(() => { |
399 | 336 | });
|
400 | 337 | },
|
401 |
| - unitConversion(row, column, cellValue) { |
402 |
| - return this.divide(cellValue, 100); |
| 338 | + formatPrice(row, column, cellValue) { |
| 339 | + return '¥' + this.divide(cellValue, 100); |
403 | 340 | },
|
404 |
| - // 选中tab |
| 341 | + // 选中 tab |
405 | 342 | handleClick(val) {
|
406 | 343 | if (val.name === "all") {
|
407 | 344 | this.queryParams.tabStatus = null;
|
|
0 commit comments