|
1 | 1 | <template>
|
2 | 2 | <div class="app-container">
|
3 | 3 | <!-- 搜索工作栏 -->
|
4 |
| - <el-form |
5 |
| - :model="queryParams" |
6 |
| - ref="queryForm" |
7 |
| - size="small" |
8 |
| - :inline="true" |
9 |
| - v-show="showSearch" |
10 |
| - label-width="68px" |
11 |
| - > |
| 4 | + <!-- TODO @Luowenfeng:参考界面;https://v5.niuteam.cn/shop/goods/lists.html |
| 5 | + 商品名称、商品编码、商品分类、商品品牌 |
| 6 | + 商品销量、商品价格 |
| 7 | + --> |
| 8 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
12 | 9 | <el-form-item label="商品名称" prop="name">
|
13 |
| - <el-input |
14 |
| - v-model="queryParams.name" |
15 |
| - placeholder="请输入商品名称" |
16 |
| - clearable |
17 |
| - @keyup.enter.native="handleQuery" |
18 |
| - /> |
| 10 | + <el-input v-model="queryParams.name" placeholder="请输入商品名称" clearable @keyup.enter.native="handleQuery"/> |
19 | 11 | </el-form-item>
|
20 | 12 | <el-form-item label="分类id" prop="categoryId">
|
21 |
| - <el-input |
22 |
| - v-model="queryParams.categoryId" |
23 |
| - placeholder="请输入分类id" |
24 |
| - clearable |
25 |
| - @keyup.enter.native="handleQuery" |
26 |
| - /> |
| 13 | + <el-input v-model="queryParams.categoryId" placeholder="请输入分类id" clearable @keyup.enter.native="handleQuery"/> |
27 | 14 | </el-form-item>
|
28 | 15 | <el-form-item label="状态" prop="status">
|
29 |
| - <el-select |
30 |
| - v-model="queryParams.status" |
31 |
| - placeholder="请选择上下架状态" |
32 |
| - clearable |
33 |
| - size="small" |
34 |
| - > |
| 16 | + <el-select v-model="queryParams.status" placeholder="请选择上下架状态" clearable size="small"> |
35 | 17 | <el-option label="请选择字典生成" value="" />
|
36 | 18 | <el-option label="上架" value="0" />
|
37 | 19 | <el-option label="下架" value="1" />
|
38 | 20 | </el-select>
|
39 | 21 | </el-form-item>
|
40 | 22 | <el-form-item label="创建时间">
|
41 |
| - <el-date-picker |
42 |
| - v-model="dateRangeCreateTime" |
43 |
| - style="width: 240px" |
44 |
| - value-format="yyyy-MM-dd" |
45 |
| - type="daterange" |
46 |
| - range-separator="-" |
47 |
| - start-placeholder="开始日期" |
48 |
| - end-placeholder="结束日期" |
49 |
| - /> |
| 23 | + <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" |
| 24 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/> |
50 | 25 | </el-form-item>
|
51 | 26 | <el-form-item>
|
52 |
| - <el-button type="primary" icon="el-icon-search" @click="handleQuery" |
53 |
| - >搜索</el-button |
54 |
| - > |
| 27 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
55 | 28 | <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
56 | 29 | </el-form-item>
|
57 | 30 | </el-form>
|
58 | 31 |
|
59 | 32 | <!-- 操作工具栏 -->
|
60 | 33 | <el-row :gutter="10" class="mb8">
|
61 | 34 | <el-col :span="1.5">
|
62 |
| - <el-button |
63 |
| - type="primary" |
64 |
| - plain |
65 |
| - icon="el-icon-plus" |
66 |
| - size="mini" |
67 |
| - @click="handleAdd" |
68 |
| - v-hasPermi="['product:spu:create']" |
69 |
| - >新增 |
70 |
| - </el-button> |
| 35 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" |
| 36 | + v-hasPermi="['product:spu:create']">新增</el-button> |
71 | 37 | </el-col>
|
72 |
| - <el-col :span="1.5"> |
73 |
| - <el-button |
74 |
| - type="warning" |
75 |
| - plain |
76 |
| - icon="el-icon-download" |
77 |
| - size="mini" |
78 |
| - @click="handleExport" |
79 |
| - :loading="exportLoading" |
80 |
| - v-hasPermi="['product:spu:export']" |
81 |
| - >导出 |
82 |
| - </el-button> |
83 |
| - </el-col> |
84 |
| - <right-toolbar |
85 |
| - :showSearch.sync="showSearch" |
86 |
| - @queryTable="getList" |
87 |
| - ></right-toolbar> |
| 38 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" /> |
88 | 39 | </el-row>
|
89 | 40 |
|
90 | 41 | <!-- 列表 -->
|
91 | 42 | <el-table v-loading="loading" :data="list">
|
| 43 | + <!-- |
| 44 | + TODO @Luowenfeng:参考界面; |
| 45 | + https://v5.niuteam.cn/shop/goods/lists.html |
| 46 | + 1. 字段:商品信息、价格、库存、销量、排序、创建时间、状态、操作; |
| 47 | + 2. tab 分成全部、销售中、仓库中、预警中 |
| 48 | + --> |
92 | 49 | <el-table-column label="主键" align="center" prop="id" />
|
93 | 50 | <el-table-column label="商品名称" align="center" prop="name" />
|
94 | 51 | <el-table-column label="分类id" align="center" prop="categoryId" />
|
|
111 | 68 | <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
|
112 | 69 | </template>
|
113 | 70 | </el-table-column>
|
114 |
| - <el-table-column |
115 |
| - label="创建时间" |
116 |
| - align="center" |
117 |
| - prop="createTime" |
118 |
| - width="180" |
119 |
| - > |
| 71 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
120 | 72 | <template slot-scope="scope">
|
121 | 73 | <span>{{ parseTime(scope.row.createTime) }}</span>
|
122 | 74 | </template>
|
123 | 75 | </el-table-column>
|
124 |
| - <el-table-column |
125 |
| - label="操作" |
126 |
| - align="center" |
127 |
| - class-name="small-padding fixed-width" |
128 |
| - > |
| 76 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
129 | 77 | <template slot-scope="scope">
|
130 |
| - <el-button |
131 |
| - size="mini" |
132 |
| - type="text" |
133 |
| - icon="el-icon-edit" |
134 |
| - @click="handleUpdate(scope.row)" |
135 |
| - v-hasPermi="['product:spu:update']" |
136 |
| - >修改 |
137 |
| - </el-button> |
138 |
| - <el-button |
139 |
| - size="mini" |
140 |
| - type="text" |
141 |
| - icon="el-icon-delete" |
142 |
| - @click="handleDelete(scope.row)" |
143 |
| - v-hasPermi="['product:spu:delete']" |
144 |
| - >删除 |
145 |
| - </el-button> |
| 78 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| 79 | + v-hasPermi="['product:spu:update']">修改</el-button> |
| 80 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| 81 | + v-hasPermi="['product:spu:delete']">删除</el-button> |
146 | 82 | </template>
|
147 | 83 | </el-table-column>
|
148 | 84 | </el-table>
|
149 | 85 | <!-- 分页组件 -->
|
150 |
| - <pagination |
151 |
| - v-show="total > 0" |
152 |
| - :total="total" |
153 |
| - :page.sync="queryParams.pageNo" |
154 |
| - :limit.sync="queryParams.pageSize" |
155 |
| - @pagination="getList" |
156 |
| - /> |
157 |
| - |
| 86 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
| 87 | + @pagination="getList"/> |
158 | 88 |
|
159 | 89 | <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body destroy-on-close :close-on-click-modal="false" >
|
160 | 90 | <save @closeDialog="closeDialog" :type="dialogType" :obj="dialogObj" v-if="open" />
|
|
166 | 96 | import {
|
167 | 97 | deleteSpu,
|
168 | 98 | getSpuPage,
|
169 |
| - exportSpuExcel, |
170 | 99 | } from "@/api/mall/product/spu";
|
171 | 100 |
|
172 | 101 | import Editor from "@/components/Editor";
|
173 | 102 | import ImageUpload from "@/components/ImageUpload";
|
174 | 103 | import save from "./save";
|
175 | 104 |
|
| 105 | +// 1. TODO @Luowenfeng:商品的添加、修改,走一个单独的页面,不走弹窗;https://v5.niuteam.cn/shop/goods/addgoods.html |
| 106 | +// 2. TODO |
| 107 | +
|
176 | 108 | export default {
|
177 | 109 | name: "Spu",
|
178 | 110 | components: {
|
@@ -306,27 +238,7 @@ export default {
|
306 | 238 | this.$modal.msgSuccess("删除成功");
|
307 | 239 | })
|
308 | 240 | .catch(() => {});
|
309 |
| - }, |
310 |
| - /** 导出按钮操作 */ |
311 |
| - handleExport() { |
312 |
| - // 处理查询参数 |
313 |
| - let params = { ...this.queryParams }; |
314 |
| - params.pageNo = undefined; |
315 |
| - params.pageSize = undefined; |
316 |
| - this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime"); |
317 |
| - // 执行导出 |
318 |
| - this.$modal |
319 |
| - .confirm("是否确认导出所有商品spu数据项?") |
320 |
| - .then(() => { |
321 |
| - this.exportLoading = true; |
322 |
| - return exportSpuExcel(params); |
323 |
| - }) |
324 |
| - .then((response) => { |
325 |
| - this.$download.excel(response, "商品spu.xls"); |
326 |
| - this.exportLoading = false; |
327 |
| - }) |
328 |
| - .catch(() => {}); |
329 |
| - }, |
| 241 | + } |
330 | 242 | },
|
331 | 243 | };
|
332 | 244 | </script>
|
|
0 commit comments