index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <div class="booth-page">
  3. <div class="booth-container">
  4. <!-- 操作栏(独立卡片) -->
  5. <div class="action-card">
  6. <el-button type="primary" icon="View" @click="handleViewProducts">查看推荐商品</el-button>
  7. </div>
  8. <!-- 商品展示区域(独立卡片) -->
  9. <div class="content-card" @mouseenter="stopAutoPlay" @mouseleave="startAutoPlay">
  10. <div class="product-display-area">
  11. <div class="carousel-viewport">
  12. <transition name="slide-fade" mode="out-in">
  13. <div class="product-grid" :key="currentPage">
  14. <div
  15. v-for="product in displayProducts"
  16. :key="product.id"
  17. class="product-card"
  18. >
  19. <el-icon class="delete-icon" @click="handleRemoveProduct(product.id)">
  20. <Close />
  21. </el-icon>
  22. <div class="product-image">
  23. <el-image
  24. :src="product.imageUrl"
  25. fit="cover"
  26. lazy
  27. class="image"
  28. >
  29. <template #error>
  30. <div class="image-slot">
  31. <el-icon><Picture /></el-icon>
  32. </div>
  33. </template>
  34. </el-image>
  35. </div>
  36. <div class="product-info">
  37. <p class="product-name">{{ product.name }}</p>
  38. <p class="product-price">¥{{ product.price }}</p>
  39. </div>
  40. </div>
  41. </div>
  42. </transition>
  43. </div>
  44. <!-- 导航箭头 -->
  45. <el-icon
  46. v-if="hasPrev"
  47. class="nav-arrow nav-arrow-left"
  48. @click="handlePrev"
  49. >
  50. <ArrowLeft />
  51. </el-icon>
  52. <el-icon
  53. v-if="hasNext"
  54. class="nav-arrow nav-arrow-right"
  55. @click="handleNext"
  56. >
  57. <ArrowRight />
  58. </el-icon>
  59. </div>
  60. <!-- 空状态 -->
  61. <el-empty v-if="displayProducts.length === 0" description="暂无商品,请点击查看推荐商品添加" />
  62. </div>
  63. </div>
  64. <!-- 已选商品对话框 -->
  65. <el-dialog
  66. v-model="dialog.visible"
  67. title="已选商品"
  68. width="900px"
  69. append-to-body
  70. destroy-on-close
  71. @close="handleDialogClose"
  72. >
  73. <!-- 操作按钮 -->
  74. <div class="dialog-actions mb-[10px]">
  75. <el-button type="primary" plain icon="Plus" @click="handleAddProduct">新增商品</el-button>
  76. <el-button type="primary" plain icon="Upload" @click="handleImportProduct">导入商品</el-button>
  77. </div>
  78. <!-- 商品表格 -->
  79. <el-table :data="selectedProducts" border max-height="450" style="width: 100%">
  80. <el-table-column label="商品编号" align="center" prop="id" width="100" />
  81. <el-table-column label="商品图片" align="center" width="80">
  82. <template #default="scope">
  83. <el-image
  84. :src="scope.row.imageUrl"
  85. fit="cover"
  86. style="width: 50px; height: 50px; border-radius: 4px"
  87. lazy
  88. >
  89. <template #error>
  90. <div class="image-slot-small">
  91. <el-icon><Picture /></el-icon>
  92. </div>
  93. </template>
  94. </el-image>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="商品名称" align="center" prop="name" :show-overflow-tooltip="true" min-width="180" />
  98. <el-table-column label="价格" align="center" width="90">
  99. <template #default="scope">
  100. <span class="price-text">¥{{ scope.row.price }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="排序" align="center" width="100">
  104. <template #default="scope">
  105. <el-input-number
  106. v-model="scope.row.sort"
  107. :min="0"
  108. :max="999"
  109. controls-position="right"
  110. size="small"
  111. style="width: 80px"
  112. @change="handleSortChange(scope.row)"
  113. />
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="操作" align="center" width="70">
  117. <template #default="scope">
  118. <span class="action-link danger" @click="handleDeleteProduct(scope.row.id)">删除</span>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <template #footer>
  123. <div class="dialog-footer">
  124. <el-button type="primary" @click="handleConfirm">确认</el-button>
  125. <el-button @click="handleDialogClose">取消</el-button>
  126. </div>
  127. </template>
  128. </el-dialog>
  129. <!-- 选择轮播商品对话框 -->
  130. <el-dialog
  131. v-model="selectDialog.visible"
  132. title="选择轮播商品"
  133. width="1200px"
  134. append-to-body
  135. @close="handleSelectDialogClose"
  136. >
  137. <!-- 搜索栏 -->
  138. <div class="search-bar mb-[10px]" style="display: flex; gap: 10px; align-items: center;">
  139. <el-input
  140. v-model="searchProductNo"
  141. placeholder="请输入商品编号"
  142. clearable
  143. style="width: 200px"
  144. @keyup.enter="handleSearchProducts"
  145. />
  146. <el-input
  147. v-model="searchProductName"
  148. placeholder="请输入商品名称"
  149. clearable
  150. style="width: 200px"
  151. @keyup.enter="handleSearchProducts"
  152. />
  153. <el-button type="primary" icon="Search" @click="handleSearchProducts">搜索</el-button>
  154. </div>
  155. <!-- 商品表格 -->
  156. <el-table
  157. ref="newProductTableRef"
  158. :data="filteredAvailableProducts"
  159. border
  160. max-height="500"
  161. @selection-change="handleSelectionChange"
  162. >
  163. <el-table-column type="selection" width="55" align="center" />
  164. <el-table-column label="轮播商品编号" align="center" prop="id" width="150" />
  165. <el-table-column label="轮播商品图片" align="center" width="120">
  166. <template #default="scope">
  167. <el-image
  168. :src="scope.row.imageUrl"
  169. fit="cover"
  170. style="width: 80px; height: 80px; border-radius: 4px"
  171. lazy
  172. >
  173. <template #error>
  174. <div class="image-slot-small">
  175. <el-icon><Picture /></el-icon>
  176. </div>
  177. </template>
  178. </el-image>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="轮播商品名称" align="center" prop="name" :show-overflow-tooltip="true" min-width="300" />
  182. <el-table-column label="价格" align="center" prop="price" width="120">
  183. <template #default="scope">
  184. <span class="price-text">¥{{ scope.row.price }}</span>
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. <!-- 分页 -->
  189. <pagination
  190. v-show="newProductPagination.total > 0"
  191. v-model:page="newProductPagination.pageNum"
  192. v-model:limit="newProductPagination.pageSize"
  193. :total="newProductPagination.total"
  194. @pagination="loadAvailableProducts"
  195. />
  196. <template #footer>
  197. <div class="dialog-footer">
  198. <el-button type="primary" @click="handleConfirmSelect">确认</el-button>
  199. <el-button @click="handleSelectDialogClose">取消</el-button>
  200. </div>
  201. </template>
  202. </el-dialog>
  203. <!-- 导入商品对话框 -->
  204. <el-dialog
  205. v-model="importDialog.visible"
  206. title="导入商品(商品编号逗号隔开)"
  207. width="600px"
  208. append-to-body
  209. destroy-on-close
  210. @close="handleImportDialogClose"
  211. >
  212. <el-form label-width="80px">
  213. <el-form-item label="商品编号:">
  214. <el-input
  215. v-model="importProductIds"
  216. type="textarea"
  217. :rows="6"
  218. placeholder="请输入内容"
  219. />
  220. </el-form-item>
  221. </el-form>
  222. <template #footer>
  223. <div class="dialog-footer">
  224. <el-button type="primary" @click="handleConfirmImport">确 认</el-button>
  225. <el-button @click="handleImportDialogClose">取 消</el-button>
  226. </div>
  227. </template>
  228. </el-dialog>
  229. </div>
  230. </template>
  231. <script setup name="IndustrialBooth" lang="ts">
  232. import { ref, reactive, computed, watch, nextTick, onMounted, onUnmounted } from 'vue';
  233. import { ElMessage, ElMessageBox } from 'element-plus';
  234. import { Close, Picture, ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
  235. import { listProduct } from '@/api/product/base';
  236. import { listRecommend, listRecommendLink, addRecommendLink, delRecommendLink } from '@/api/product/recommend';
  237. // 推荐位编号(工业装修-轮播展位商品)
  238. const recommendNo = 'industrial_booth';
  239. const recommendId = ref<number | null>(null);
  240. const loading = ref(false);
  241. // 对话框
  242. const dialog = reactive({
  243. visible: false
  244. });
  245. // 选择商品对话框
  246. const selectDialog = reactive({
  247. visible: false
  248. });
  249. // 导入商品对话框
  250. const importDialog = reactive({
  251. visible: false
  252. });
  253. // 导入商品编号
  254. const importProductIds = ref('');
  255. // 搜索关键词
  256. const searchProductNo = ref('');
  257. const searchProductName = ref('');
  258. // 可选商品列表(从接口获取)
  259. const availableProducts = ref<any[]>([]);
  260. // 选中的商品ID列表(用于新增商品标签页)
  261. const selectedProductIds = ref<string[]>([]);
  262. // 新增商品分页
  263. const newProductPagination = reactive({
  264. pageNum: 1,
  265. pageSize: 20,
  266. total: 0
  267. });
  268. // 当前页码(从0开始)
  269. const currentPage = ref(0);
  270. const pageSize = 5; // 每页显示5个商品
  271. // 自动轮播定时器
  272. let autoPlayTimer: ReturnType<typeof setInterval> | null = null;
  273. const autoPlayInterval = 3000; // 3秒切换一次
  274. // 已选商品列表(从接口获取)
  275. const selectedProducts = ref<any[]>([]);
  276. // 获取可选商品列表
  277. const loadAvailableProducts = async () => {
  278. try {
  279. const params: any = {
  280. pageNum: newProductPagination.pageNum,
  281. pageSize: newProductPagination.pageSize
  282. };
  283. if (searchProductNo.value) {
  284. params.productNo = searchProductNo.value;
  285. }
  286. if (searchProductName.value) {
  287. params.itemName = searchProductName.value;
  288. }
  289. const res: any = await listProduct(params);
  290. // 字段映射
  291. availableProducts.value = (res.rows || []).map((item: any) => ({
  292. id: item.id,
  293. productNo: item.productNo,
  294. name: item.itemName,
  295. imageUrl: item.productImageUrl || item.productImage,
  296. price: item.minSellingPrice || item.memberPrice || '0.00'
  297. }));
  298. newProductPagination.total = res.total || 0;
  299. } catch (error) {
  300. console.error('获取商品列表失败', error);
  301. availableProducts.value = [];
  302. }
  303. };
  304. // 获取推荐位ID
  305. const loadRecommendId = async () => {
  306. try {
  307. const res: any = await listRecommend({ recommendNo, pageSize: 1 });
  308. if (res.rows && res.rows.length > 0) {
  309. recommendId.value = res.rows[0].id;
  310. }
  311. } catch (error) {
  312. console.error('获取推荐位失败', error);
  313. }
  314. };
  315. // 获取已选商品列表(通过推荐关联)
  316. const loadSelectedProducts = async () => {
  317. loading.value = true;
  318. try {
  319. if (!recommendId.value) {
  320. await loadRecommendId();
  321. }
  322. if (!recommendId.value) {
  323. selectedProducts.value = [];
  324. return;
  325. }
  326. // 先获取推荐关联的商品ID列表
  327. const linkRes: any = await listRecommendLink({ recommendId: recommendId.value, pageSize: 100 });
  328. const links = linkRes.rows || [];
  329. if (links.length === 0) {
  330. selectedProducts.value = [];
  331. return;
  332. }
  333. // 获取商品详情
  334. const productIds = links.map((link: any) => link.productId);
  335. const productRes: any = await listProduct({ ids: productIds.join(','), pageSize: 100 });
  336. const productMap = new Map((productRes.rows || []).map((p: any) => [p.id, p]));
  337. // 组装数据
  338. selectedProducts.value = links.map((link: any, index: number) => {
  339. const product: any = productMap.get(link.productId) || {};
  340. return {
  341. id: product.id || link.productId,
  342. linkId: link.id, // 关联ID,用于删除
  343. productNo: product.productNo,
  344. name: product.itemName || `商品${link.productId}`,
  345. imageUrl: product.productImageUrl || product.productImage,
  346. price: product.minSellingPrice || product.memberPrice || '0.00',
  347. sort: links.length - index // 默认排序
  348. };
  349. });
  350. } catch (error) {
  351. console.error('获取已选商品失败', error);
  352. selectedProducts.value = [];
  353. } finally {
  354. loading.value = false;
  355. }
  356. };
  357. // 计算当前显示的商品(按排序值降序排列)
  358. const sortedProducts = computed(() => {
  359. return [...selectedProducts.value].sort((a, b) => b.sort - a.sort);
  360. });
  361. // 总页数
  362. const totalPages = computed(() => {
  363. return Math.ceil(sortedProducts.value.length / pageSize);
  364. });
  365. // 当前页显示的商品
  366. const displayProducts = computed(() => {
  367. const start = currentPage.value * pageSize;
  368. const end = start + pageSize;
  369. return sortedProducts.value.slice(start, end);
  370. });
  371. // 是否有上一页
  372. const hasPrev = computed(() => {
  373. return currentPage.value > 0;
  374. });
  375. // 是否有下一页
  376. const hasNext = computed(() => {
  377. return currentPage.value < totalPages.value - 1;
  378. });
  379. // 查看推荐商品
  380. const handleViewProducts = async () => {
  381. dialog.visible = true;
  382. // 每次打开都重新加载数据
  383. await loadSelectedProducts();
  384. };
  385. // 对话框关闭
  386. const handleDialogClose = () => {
  387. dialog.visible = false;
  388. };
  389. // 新增商品
  390. const handleAddProduct = () => {
  391. selectDialog.visible = true;
  392. selectedProductIds.value = [];
  393. searchProductNo.value = '';
  394. searchProductName.value = '';
  395. newProductPagination.pageNum = 1;
  396. // 加载可选商品列表
  397. loadAvailableProducts();
  398. // 等待DOM更新后,清除表格选中状态
  399. nextTick(() => {
  400. if (newProductTableRef.value) {
  401. newProductTableRef.value.clearSelection();
  402. }
  403. });
  404. };
  405. // 选择商品对话框关闭
  406. const handleSelectDialogClose = () => {
  407. selectDialog.visible = false;
  408. selectedProductIds.value = [];
  409. searchProductNo.value = '';
  410. searchProductName.value = '';
  411. // 清除表格选中状态
  412. if (newProductTableRef.value) {
  413. newProductTableRef.value.clearSelection();
  414. }
  415. };
  416. // 搜索商品
  417. const handleSearchProducts = () => {
  418. newProductPagination.pageNum = 1;
  419. loadAvailableProducts();
  420. };
  421. // 表格选择变化
  422. const newProductTableRef = ref();
  423. const handleSelectionChange = (selection: any[]) => {
  424. selectedProductIds.value = selection.map((item) => item.id);
  425. };
  426. // 确认选择商品
  427. const handleConfirmSelect = async () => {
  428. if (selectedProductIds.value.length === 0) {
  429. ElMessage.warning('请至少选择一个商品');
  430. return;
  431. }
  432. try {
  433. if (!recommendId.value) {
  434. await loadRecommendId();
  435. }
  436. if (!recommendId.value) {
  437. ElMessage.error('推荐位不存在,请先创建');
  438. return;
  439. }
  440. // 批量添加推荐关联,统计实际添加数量
  441. let addedCount = 0;
  442. let skippedCount = 0;
  443. for (const productId of selectedProductIds.value) {
  444. // 检查是否已存在
  445. if (selectedProducts.value.find((p) => String(p.id) === String(productId))) {
  446. skippedCount++;
  447. } else {
  448. await addRecommendLink({ recommendId: recommendId.value, productId });
  449. addedCount++;
  450. }
  451. }
  452. if (addedCount > 0) {
  453. ElMessage.success(`成功添加 ${addedCount} 个商品${skippedCount > 0 ? `,${skippedCount} 个已存在被跳过` : ''}`);
  454. } else {
  455. ElMessage.warning('所选商品均已存在');
  456. }
  457. handleSelectDialogClose();
  458. // 刷新已选列表
  459. await loadSelectedProducts();
  460. } catch (error) {
  461. ElMessage.error('添加失败');
  462. }
  463. };
  464. // 分页后的可选商品列表(过滤掉已选的商品)
  465. const filteredAvailableProducts = computed(() => {
  466. const selectedIds = selectedProducts.value.map((p) => String(p.id));
  467. return availableProducts.value.filter((item) => !selectedIds.includes(String(item.id)));
  468. });
  469. // 分页变化
  470. watch(
  471. () => [newProductPagination.pageNum, newProductPagination.pageSize],
  472. () => {
  473. if (selectDialog.visible) {
  474. loadAvailableProducts();
  475. }
  476. }
  477. );
  478. // 导入商品
  479. const handleImportProduct = () => {
  480. importDialog.visible = true;
  481. importProductIds.value = '';
  482. };
  483. // 导入对话框关闭
  484. const handleImportDialogClose = () => {
  485. importDialog.visible = false;
  486. importProductIds.value = '';
  487. };
  488. // 确认导入商品
  489. const handleConfirmImport = () => {
  490. if (!importProductIds.value.trim()) {
  491. ElMessage.warning('请输入商品编号');
  492. return;
  493. }
  494. // 解析商品编号(逗号隔开)
  495. const ids = importProductIds.value
  496. .split(/[,,]/)
  497. .map((id) => id.trim())
  498. .filter((id) => id);
  499. if (ids.length === 0) {
  500. ElMessage.warning('请输入有效的商品编号');
  501. return;
  502. }
  503. // 模拟导入逻辑(实际应调用接口查询商品信息)
  504. let addedCount = 0;
  505. ids.forEach((id) => {
  506. // 检查是否已存在
  507. if (!selectedProducts.value.find((p) => p.id === id)) {
  508. // 模拟添加商品(实际应从接口获取商品信息)
  509. selectedProducts.value.push({
  510. id: id,
  511. name: `商品${id}`,
  512. imageUrl: `https://via.placeholder.com/200x200/409EFF/FFFFFF?text=${id}`,
  513. price: '0.00',
  514. sort: Math.max(...selectedProducts.value.map((p) => p.sort), 0) + 1
  515. });
  516. addedCount++;
  517. }
  518. });
  519. if (addedCount > 0) {
  520. ElMessage.success(`成功导入 ${addedCount} 个商品`);
  521. } else {
  522. ElMessage.warning('所有商品编号已存在');
  523. }
  524. handleImportDialogClose();
  525. };
  526. // 删除商品
  527. const handleDeleteProduct = (id: string) => {
  528. const product = selectedProducts.value.find((item) => String(item.id) === String(id));
  529. ElMessageBox.confirm('是否确认删除该商品?', '提示', {
  530. confirmButtonText: '确定',
  531. cancelButtonText: '取消',
  532. type: 'warning'
  533. })
  534. .then(async () => {
  535. try {
  536. if (product?.linkId) {
  537. await delRecommendLink(product.linkId);
  538. }
  539. const index = selectedProducts.value.findIndex((item) => String(item.id) === String(id));
  540. if (index !== -1) {
  541. selectedProducts.value.splice(index, 1);
  542. }
  543. ElMessage.success('删除成功');
  544. // 调整页码确保不越界
  545. if (currentPage.value >= totalPages.value && currentPage.value > 0) {
  546. currentPage.value = totalPages.value - 1;
  547. }
  548. } catch (error) {
  549. ElMessage.error('删除失败');
  550. }
  551. })
  552. .catch(() => {});
  553. };
  554. // 排序改变
  555. const handleSortChange = (row: any) => {
  556. // 排序值改变后,重新计算显示的商品
  557. console.log('排序值改变:', row);
  558. };
  559. // 确认
  560. const handleConfirm = () => {
  561. ElMessage.success('保存成功');
  562. dialog.visible = false;
  563. };
  564. // 上一页
  565. const handlePrev = () => {
  566. if (hasPrev.value) {
  567. currentPage.value--;
  568. }
  569. };
  570. // 下一页
  571. const handleNext = () => {
  572. if (hasNext.value) {
  573. currentPage.value++;
  574. }
  575. };
  576. // 移除商品(从展示区域移除)
  577. const handleRemoveProduct = (id: string) => {
  578. const product = selectedProducts.value.find((item) => String(item.id) === String(id));
  579. ElMessageBox.confirm('是否确认从展示区域移除该商品?', '提示', {
  580. confirmButtonText: '确定',
  581. cancelButtonText: '取消',
  582. type: 'warning'
  583. })
  584. .then(async () => {
  585. try {
  586. if (product?.linkId) {
  587. await delRecommendLink(product.linkId);
  588. }
  589. const index = selectedProducts.value.findIndex((item) => String(item.id) === String(id));
  590. if (index !== -1) {
  591. selectedProducts.value.splice(index, 1);
  592. }
  593. ElMessage.success('移除成功');
  594. // 调整页码确保不越界
  595. if (currentPage.value >= totalPages.value && currentPage.value > 0) {
  596. currentPage.value = totalPages.value - 1;
  597. }
  598. } catch (error) {
  599. ElMessage.error('移除失败');
  600. }
  601. })
  602. .catch(() => {});
  603. };
  604. // 开始自动轮播
  605. const startAutoPlay = () => {
  606. stopAutoPlay();
  607. if (totalPages.value <= 1) return;
  608. autoPlayTimer = setInterval(() => {
  609. if (totalPages.value <= 1) {
  610. stopAutoPlay();
  611. return;
  612. }
  613. // 循环播放:1 -> 2 -> 1 -> 2
  614. if (currentPage.value >= totalPages.value - 1) {
  615. currentPage.value = 0;
  616. } else {
  617. currentPage.value++;
  618. }
  619. }, autoPlayInterval);
  620. };
  621. // 停止自动轮播
  622. const stopAutoPlay = () => {
  623. if (autoPlayTimer) {
  624. clearInterval(autoPlayTimer);
  625. autoPlayTimer = null;
  626. }
  627. };
  628. onMounted(() => {
  629. // 加载已选商品
  630. loadSelectedProducts();
  631. // 启动自动轮播
  632. startAutoPlay();
  633. });
  634. onUnmounted(() => {
  635. // 清理定时器
  636. stopAutoPlay();
  637. });
  638. </script>
  639. <style scoped lang="scss">
  640. .booth-page {
  641. min-height: 100vh;
  642. background: #f5f5f5;
  643. padding: 20px;
  644. }
  645. .booth-container {
  646. max-width: 1200px;
  647. margin: 0 auto;
  648. }
  649. .action-card {
  650. background: #fff;
  651. border-radius: 4px;
  652. padding: 15px 20px;
  653. margin-bottom: 12px;
  654. }
  655. .content-card {
  656. background: #fff;
  657. border-radius: 4px;
  658. padding: 20px;
  659. }
  660. .product-display-area {
  661. position: relative;
  662. min-height: 400px;
  663. padding: 20px 0;
  664. }
  665. .carousel-viewport {
  666. margin: 0 40px;
  667. }
  668. .product-grid {
  669. display: grid;
  670. grid-template-columns: repeat(5, 1fr);
  671. gap: 20px;
  672. }
  673. // 滑动过渡动画
  674. .slide-fade-enter-active {
  675. transition: all 0.4s ease-out;
  676. }
  677. .slide-fade-leave-active {
  678. transition: all 0.3s ease-in;
  679. }
  680. .slide-fade-enter-from {
  681. transform: translateX(30px);
  682. opacity: 0;
  683. }
  684. .slide-fade-leave-to {
  685. transform: translateX(-30px);
  686. opacity: 0;
  687. }
  688. .product-card {
  689. position: relative;
  690. background: #fff;
  691. border: 1px solid #ebeef5;
  692. border-radius: 8px;
  693. padding: 12px;
  694. cursor: pointer;
  695. transition: all 0.3s;
  696. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  697. &:hover {
  698. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  699. transform: translateY(-2px);
  700. }
  701. .delete-icon {
  702. position: absolute;
  703. top: 8px;
  704. right: 8px;
  705. font-size: 18px;
  706. color: #909399;
  707. cursor: pointer;
  708. z-index: 10;
  709. background: rgba(255, 255, 255, 0.8);
  710. border-radius: 50%;
  711. padding: 4px;
  712. transition: all 0.3s;
  713. &:hover {
  714. color: #f56c6c;
  715. background: rgba(255, 255, 255, 1);
  716. }
  717. }
  718. .product-image {
  719. width: 100%;
  720. height: 180px;
  721. margin-bottom: 12px;
  722. background: #f5f7fa;
  723. border-radius: 4px;
  724. overflow: hidden;
  725. .image {
  726. width: 100%;
  727. height: 100%;
  728. }
  729. .image-slot {
  730. display: flex;
  731. justify-content: center;
  732. align-items: center;
  733. width: 100%;
  734. height: 100%;
  735. background: #f5f7fa;
  736. color: #909399;
  737. font-size: 40px;
  738. }
  739. }
  740. .product-info {
  741. .product-name {
  742. margin: 0 0 8px 0;
  743. font-size: 13px;
  744. color: #303133;
  745. line-height: 1.5;
  746. overflow: hidden;
  747. text-overflow: ellipsis;
  748. display: -webkit-box;
  749. -webkit-line-clamp: 2;
  750. -webkit-box-orient: vertical;
  751. min-height: 39px;
  752. }
  753. .product-price {
  754. margin: 0;
  755. font-size: 18px;
  756. font-weight: 600;
  757. color: #f56c6c;
  758. }
  759. }
  760. }
  761. .nav-arrow {
  762. position: absolute;
  763. top: 50%;
  764. transform: translateY(-50%);
  765. font-size: 32px;
  766. color: #909399;
  767. cursor: pointer;
  768. background: rgba(255, 255, 255, 0.9);
  769. border-radius: 50%;
  770. padding: 8px;
  771. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  772. transition: all 0.3s;
  773. z-index: 10;
  774. &:hover {
  775. color: #409eff;
  776. background: #fff;
  777. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  778. }
  779. &.nav-arrow-left {
  780. left: 10px;
  781. }
  782. &.nav-arrow-right {
  783. right: 10px;
  784. }
  785. }
  786. .dialog-actions {
  787. display: flex;
  788. gap: 10px;
  789. }
  790. .image-slot-small {
  791. display: flex;
  792. justify-content: center;
  793. align-items: center;
  794. width: 100%;
  795. height: 100%;
  796. background: #f5f7fa;
  797. color: #909399;
  798. font-size: 20px;
  799. }
  800. .price-text {
  801. color: #f56c6c;
  802. font-weight: 600;
  803. }
  804. .search-bar {
  805. display: flex;
  806. align-items: center;
  807. }
  808. :deep(.el-dialog__body) {
  809. padding: 20px;
  810. }
  811. .action-link {
  812. cursor: pointer;
  813. font-size: 14px;
  814. &.danger {
  815. color: #f56c6c;
  816. &:hover {
  817. color: #f78989;
  818. }
  819. }
  820. }
  821. </style>