|
1 | 1 | <template>
|
2 |
| - <ContentWrap> |
3 |
| - <!-- 搜索工作栏 --> |
4 |
| - <el-form |
5 |
| - class="-mb-15px" |
6 |
| - :model="queryParams" |
7 |
| - ref="queryFormRef" |
8 |
| - :inline="true" |
9 |
| - label-width="68px" |
10 |
| - > |
11 |
| - <el-form-item label="商品名称" prop="name"> |
12 |
| - <el-input |
13 |
| - v-model="queryParams.name" |
14 |
| - placeholder="请输入商品名称" |
15 |
| - clearable |
16 |
| - @keyup.enter="handleQuery" |
17 |
| - class="!w-240px" |
18 |
| - /> |
19 |
| - </el-form-item> |
20 |
| - <el-form-item label="收藏时间" prop="createTime"> |
21 |
| - <el-date-picker |
22 |
| - v-model="queryParams.createTime" |
23 |
| - value-format="YYYY-MM-DD HH:mm:ss" |
24 |
| - type="daterange" |
25 |
| - start-placeholder="开始日期" |
26 |
| - end-placeholder="结束日期" |
27 |
| - :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
28 |
| - class="!w-240px" |
29 |
| - /> |
30 |
| - </el-form-item> |
31 |
| - <el-form-item> |
32 |
| - <el-button @click="handleQuery"> |
33 |
| - <Icon icon="ep:search" class="mr-5px" /> |
34 |
| - 搜索 |
35 |
| - </el-button> |
36 |
| - <el-button @click="resetQuery"> |
37 |
| - <Icon icon="ep:refresh" class="mr-5px" /> |
38 |
| - 重置 |
39 |
| - </el-button> |
40 |
| - </el-form-item> |
41 |
| - </el-form> |
42 |
| - </ContentWrap> |
43 |
| - |
44 | 2 | <!-- 列表 -->
|
45 | 3 | <ContentWrap>
|
46 | 4 | <el-table v-loading="loading" :data="list">
|
|
67 | 25 | <dict-tag :type="DICT_TYPE.PRODUCT_SPU_STATUS" :value="scope.row.status" />
|
68 | 26 | </template>
|
69 | 27 | </el-table-column>
|
70 |
| - <el-table-column align="center" fixed="right" label="操作" min-width="200"> |
71 |
| - <template #default="{ row }"> |
72 |
| - <el-button |
73 |
| - v-if="row.favoriteStatus === 0" |
74 |
| - v-hasPermi="['product:spu:delete']" |
75 |
| - link |
76 |
| - type="danger" |
77 |
| - @click="handleAdd(row)" |
78 |
| - > |
79 |
| - 收藏 |
80 |
| - </el-button> |
81 |
| - <el-button |
82 |
| - v-if="row.favoriteStatus === 1" |
83 |
| - v-hasPermi="['product:spu:delete']" |
84 |
| - link |
85 |
| - type="danger" |
86 |
| - @click="handleDelete(row)" |
87 |
| - > |
88 |
| - 取消收藏 |
89 |
| - </el-button> |
90 |
| - </template> |
91 |
| - </el-table-column> |
92 | 28 | </el-table>
|
93 | 29 | <!-- 分页 -->
|
94 | 30 | <Pagination
|
@@ -145,41 +81,6 @@ const resetQuery = () => {
|
145 | 81 | handleQuery()
|
146 | 82 | }
|
147 | 83 |
|
148 |
| -/** 取消收藏按钮操作 */ |
149 |
| -const handleDelete = async (row: object) => { |
150 |
| - try { |
151 |
| - console.log(row) |
152 |
| - // 取消的二次确认 |
153 |
| - await message.delStarConfirm() |
154 |
| - // 发起取消 |
155 |
| - await FavoriteApi.delFavorite({ userId: queryParams.userId, spuId: row.spuId }) |
156 |
| - message.success(t('common.delStarSuccess')) |
157 |
| - row.favoriteStatus = 0 |
158 |
| - // 刷新列表 |
159 |
| - // await getList() |
160 |
| - } catch {} |
161 |
| -} |
162 |
| -
|
163 |
| -/** 收藏按钮操作 */ |
164 |
| -const handleAdd = async (row: object) => { |
165 |
| - try { |
166 |
| - const data = { userId: queryParams.userId, spuId: row.spuId } |
167 |
| - // 发起收藏 |
168 |
| - const result = await FavoriteApi.exitsFavorite(data) |
169 |
| - if (result === false) { |
170 |
| - // 发起收藏 |
171 |
| - await FavoriteApi.createFavorite(data) |
172 |
| - message.success(t('common.starSuccess')) |
173 |
| - row.favoriteStatus = 1 |
174 |
| - // 刷新列表 |
175 |
| - // await getList() |
176 |
| - } else { |
177 |
| - message.warning(t('common.existStar')) |
178 |
| - row.favoriteStatus = 1 |
179 |
| - } |
180 |
| - } catch {} |
181 |
| -} |
182 |
| -
|
183 | 84 | const { userId } = defineProps({
|
184 | 85 | userId: {
|
185 | 86 | type: Number,
|
|
0 commit comments