diff --git a/public/imgs/shop/10.png b/public/imgs/shop/10.png index 85ad068..17d14b4 100644 Binary files a/public/imgs/shop/10.png and b/public/imgs/shop/10.png differ diff --git a/public/imgs/shop/2.png b/public/imgs/shop/2.png index 85ad068..8e08786 100644 Binary files a/public/imgs/shop/2.png and b/public/imgs/shop/2.png differ diff --git a/public/imgs/shop/3.png b/public/imgs/shop/3.png index 85ad068..53958fb 100644 Binary files a/public/imgs/shop/3.png and b/public/imgs/shop/3.png differ diff --git a/public/imgs/shop/4.png b/public/imgs/shop/4.png index 85ad068..926e662 100644 Binary files a/public/imgs/shop/4.png and b/public/imgs/shop/4.png differ diff --git a/public/imgs/shop/5.png b/public/imgs/shop/5.png index 85ad068..a0023fa 100644 Binary files a/public/imgs/shop/5.png and b/public/imgs/shop/5.png differ diff --git a/public/imgs/shop/6.png b/public/imgs/shop/6.png index 85ad068..39de492 100644 Binary files a/public/imgs/shop/6.png and b/public/imgs/shop/6.png differ diff --git a/public/imgs/shop/7.png b/public/imgs/shop/7.png index 85ad068..ad0c261 100644 Binary files a/public/imgs/shop/7.png and b/public/imgs/shop/7.png differ diff --git a/public/imgs/shop/8.png b/public/imgs/shop/8.png index 85ad068..c1c3990 100644 Binary files a/public/imgs/shop/8.png and b/public/imgs/shop/8.png differ diff --git a/public/imgs/shop/9.png b/public/imgs/shop/9.png index 85ad068..81cab7d 100644 Binary files a/public/imgs/shop/9.png and b/public/imgs/shop/9.png differ diff --git a/public/imgs/shop/shumachanping/1.png b/public/imgs/shop/shumachanping/1.png new file mode 100644 index 0000000..ba92ffa Binary files /dev/null and b/public/imgs/shop/shumachanping/1.png differ diff --git a/public/imgs/shop/shumachanping/2.png b/public/imgs/shop/shumachanping/2.png new file mode 100644 index 0000000..5ac8d13 Binary files /dev/null and b/public/imgs/shop/shumachanping/2.png differ diff --git a/public/imgs/shop/shumachanping/3.png b/public/imgs/shop/shumachanping/3.png new file mode 100644 index 0000000..43ea79d Binary files /dev/null and b/public/imgs/shop/shumachanping/3.png differ diff --git a/public/imgs/shop/shumachanping/4.png b/public/imgs/shop/shumachanping/4.png new file mode 100644 index 0000000..106a6d5 Binary files /dev/null and b/public/imgs/shop/shumachanping/4.png differ diff --git a/public/imgs/shop/shumachanping/5.png b/public/imgs/shop/shumachanping/5.png new file mode 100644 index 0000000..5b76a16 Binary files /dev/null and b/public/imgs/shop/shumachanping/5.png differ diff --git a/public/imgs/shop/shumachanping/6.png b/public/imgs/shop/shumachanping/6.png new file mode 100644 index 0000000..3d19939 Binary files /dev/null and b/public/imgs/shop/shumachanping/6.png differ diff --git a/public/imgs/shop/shumachanping/7.png b/public/imgs/shop/shumachanping/7.png new file mode 100644 index 0000000..2a946b8 Binary files /dev/null and b/public/imgs/shop/shumachanping/7.png differ diff --git a/public/imgs/shop/shumachanping/8.png b/public/imgs/shop/shumachanping/8.png new file mode 100644 index 0000000..89308e1 Binary files /dev/null and b/public/imgs/shop/shumachanping/8.png differ diff --git a/public/imgs/shop/shumachanping/9.png b/public/imgs/shop/shumachanping/9.png new file mode 100644 index 0000000..f4cc15d Binary files /dev/null and b/public/imgs/shop/shumachanping/9.png differ diff --git a/public/imgs/shop/style-change.png b/public/imgs/shop/style-change.png new file mode 100644 index 0000000..76aec75 Binary files /dev/null and b/public/imgs/shop/style-change.png differ diff --git a/src/views/Distribution.vue b/src/views/Distribution.vue index ecad961..4a39658 100644 --- a/src/views/Distribution.vue +++ b/src/views/Distribution.vue @@ -189,8 +189,8 @@ const generateInviteLink = () => { const userId = userStore.user?.id || 'guest' console.log(userId) const baseUrl = `${window.location.origin}/frontend` - // return `${baseUrl}/register?inviter=${userId}`// 实施用 - return `http://192.168.1.250:5173/register?inviter=${userId}`// 测试用 + return `${baseUrl}/register?inviter=${userId}`// 实施用 + // return `http://192.168.1.250:5173/register?inviter=${userId}`// 测试用 } // 生成二维码 diff --git a/src/views/ProductCategory.vue b/src/views/ProductCategory.vue index c789e35..bbdd0d4 100644 --- a/src/views/ProductCategory.vue +++ b/src/views/ProductCategory.vue @@ -58,31 +58,31 @@ const barItems = ref([ name: '数码产品', relative: [{ name: '华为', - img: '' + img: '/imgs/shop/shumachanping/1.png' },{ name: '苹果', - img: '' + img: '/imgs/shop/shumachanping/2.png' },{ name: '小米', - img: '' + img: '/imgs/shop/shumachanping/3.png' },{ name: '荣耀', - img: '' + img: '/imgs/shop/shumachanping/4.png' },{ name: 'iqoo', - img: '' + img: '/imgs/shop/shumachanping/5.png' },{ name: 'realme', - img: '' + img: '/imgs/shop/shumachanping/6.png' },{ name: 'vivo', - img: '' + img: '/imgs/shop/shumachanping/7.png' },{ name: 'oppo', - img: '' + img: '/imgs/shop/shumachanping/8.png' },{ name: '三星', - img: '' + img: '/imgs/shop/shumachanping/9.png' }] },{ name: '食品饮料', @@ -94,31 +94,31 @@ const barItems = ref([ name: '手机', relative: [{ name: '华为', - img: '' + img: '/imgs/shop/shumachanping/1.png' },{ name: '苹果', - img: '' + img: '/imgs/shop/shumachanping/2.png' },{ name: '小米', - img: '' + img: '/imgs/shop/shumachanping/3.png' },{ name: '荣耀', - img: '' + img: '/imgs/shop/shumachanping/4.png' },{ name: 'iqoo', - img: '' + img: '/imgs/shop/shumachanping/5.png' },{ name: 'realme', - img: '' + img: '/imgs/shop/shumachanping/6.png' },{ name: 'vivo', - img: '' + img: '/imgs/shop/shumachanping/7.png' },{ name: 'oppo', - img: '' + img: '/imgs/shop/shumachanping/8.png' },{ name: '三星', - img: '' + img: '/imgs/shop/shumachanping/9.png' }] },{ name: '家装', @@ -361,7 +361,8 @@ onMounted(() => { .relative-bar { display: grid; - grid-template-columns: repeat(5, 40px); + grid-template-columns: repeat(5, 45px); + grid-template-rows: repeat(2, 66px); gap: 30px; margin-top: 5px; justify-content: center; @@ -386,7 +387,7 @@ onMounted(() => { .relative-img { width: 40px; - height: 40px; + height: 45px; margin-bottom: 8px; } diff --git a/src/views/ProductCategoryFinal.vue b/src/views/ProductCategoryFinal.vue index 8837aea..7d9dd6a 100644 --- a/src/views/ProductCategoryFinal.vue +++ b/src/views/ProductCategoryFinal.vue @@ -9,24 +9,39 @@ -
- 你有优惠券待领取 -
+
+
-
-
- -
-
- {{ product.name }} +
+
+ {{ filter.name }}
-
- -
{{ product.points_price }}
-
-
- 融豆 -
{{ product.rongdou_price }}
+
+ +
+ 改变 +
+
+ +
+ 你有优惠券待领取 +
+ +
+
+ +
+
+ {{ product.name }} +
+
+ +
{{ product.points_price }}
+
+
+ 融豆 +
{{ product.rongdou_price }}
+
@@ -50,6 +65,7 @@ const searchKeyword = ref(route.params.name) const sortBy = ref('') const products = ref([]) +const filteredProducts = ref([]) const loading = ref(false) const loadingMore = ref(false) const page = ref(1) @@ -58,6 +74,55 @@ const selectedCategory = ref('all') const couponExist = ref(false) +const isGridStyle = ref(false) + +const filters = ref([{ + name: '默认', + sort: 'null' +}, { + name: '价格高到低', + sort: 'price_desc' +}, { + name: '价格低到高', + sort: 'price_asc' +}, { + name: '销量', + sort: 'sales_desc' +}]) + +const switchFilter = (index) => { + filters.value.forEach((filter, i) => { + filter.active = i === index + }) + + const selectedFilter = filters.value[index] + sortProducts(selectedFilter.sort) +} + +const sortProducts = (sortType) => { + switch (sortType) { + case 'null': + filteredProducts.value = products.value + break + case 'price_desc': + filteredProducts.value = products.value.sort((a, b) => b.points_price - a.points_price) + break + case 'price_asc': + filteredProducts.value = products.value.sort((a, b) => a.points_price - b.points_price) + break + case 'sales_desc': + filteredProducts.value = products.value.sort((a, b) => b.sales - a.sales) + break + default: + filteredProducts.value = products.value + break + } +} + +const changeStyle = () => { + isGridStyle.value = !isGridStyle.value +} + const getProducts = async (isLoadMore = false) => { try { if (!isLoadMore) { @@ -98,6 +163,7 @@ const getProducts = async (isLoadMore = false) => { hasMore.value = data.data.hasMore page.value++ + filteredProducts.value = products.value } catch (error) { ElMessage.error('获取商品列表失败') console.error('获取商品列表失败:', error) @@ -144,6 +210,7 @@ watch(searchKeyword, (newVal, oldVal) => { onMounted(() => { isCouponExist() getProducts() + filters.value[0].active = true }) @@ -183,6 +250,40 @@ onMounted(() => { border-radius: 400px; } +.product-header { + display: flex; + align-items: center; +} + +.product-filter { + display: flex; + align-items: center; + gap: 10px; +} + +.filter { + font-size: 12px; + padding: 5px 10px; + border-radius: 20px; +} + +.filter.active { + color: #305DEF; +} + +.filter:hover { + color: #305DEF; +} + +.style-btn { + margin-left: auto; +} + +.img-style { + width: 12px; + height: 12px; +} + .coupon-announcer { width: 100%; text-align: center; @@ -195,12 +296,12 @@ onMounted(() => { padding-left: 10px; } -.product-list { +.product-list1 { display: flex; flex-wrap: wrap; } -.product-item { +.product-item1 { width: 200px; margin: 10px; display: flex; @@ -210,13 +311,13 @@ onMounted(() => { max-height: 110px; } -.product-image { +.product-image1 { width: 110px; height: 110px; flex-shrink: 0; } -.price-info { +.price-info1 { display: flex; align-items: flex-start; gap: 4px; @@ -225,18 +326,76 @@ onMounted(() => { flex: 1; } -.product-content-name { +.product-content-name1 { font-size: 16px; padding: 0 10px; } -.product-content-price { +.product-content-price1 { font-size: 12px; color: #ff6b00; } -.img-bean { +.img-bean1 { width: 16px; height: 16px; } + +.product-list2 { + display: grid; + grid-template-columns: repeat(2, 1fr); + column-gap: 26px; + row-gap: 14px; + justify-content: center; +} + +.product-item2 { + width: 100%; + height: 240px; + border-radius: 5px; + background-color: #fff; + display: flex; + flex-direction: column; + justify-self: center; +} + +.product-image2 { + width: 100%; + height: 153px; + border-radius: 5px 5px 0 0; + flex-shrink: 0; +} + +.product-content-name2 { + font-size: 12px; + text-align: left; + display: -webkit-box; + -webkit-line-clamp: 2; + line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + line-height: 1.4; + min-height: 2.8em; + padding: 3px 10px; +} + +.price-info2 { + display: flex; + align-items: center; + gap: 4px; + margin-top: auto; + padding: 0 10px; + padding-bottom: 5px; +} + +.product-content-price2 { + font-size: 12px; + color: #ff6b00; +} + +.img-bean2 { + width: 16px; + height: 16px; +} + diff --git a/src/views/Shop.vue b/src/views/Shop.vue index 1707c97..2ffdc57 100644 --- a/src/views/Shop.vue +++ b/src/views/Shop.vue @@ -63,15 +63,15 @@ const selectedCategory = ref('all') const shopBarItems = [ {name: '商品分类',img: '/imgs/shop/1.png',path: '/productCategory'}, - {name: '2',img: '/imgs/shop/2.png',path: ''}, - {name: '3',img: '/imgs/shop/3.png',path: ''}, - {name: '4',img: '/imgs/shop/4.png',path: ''}, - {name: '5',img: '/imgs/shop/5.png',path: ''}, - {name: '6',img: '/imgs/shop/6.png',path: ''}, - {name: '7',img: '/imgs/shop/7.png',path: ''}, - {name: '8',img: '/imgs/shop/8.png',path: ''}, - {name: '9',img: '/imgs/shop/9.png',path: ''}, - {name: '10',img: '/imgs/shop/10.png',path: ''}, + {name: '观看直播',img: '/imgs/shop/2.png',path: ''}, + {name: '违规通告',img: '/imgs/shop/3.png',path: ''}, + {name: '百亿补贴',img: '/imgs/shop/4.png',path: ''}, + {name: '现时秒杀',img: '/imgs/shop/5.png',path: ''}, + {name: '会员专区',img: '/imgs/shop/6.png',path: ''}, + {name: '商品收藏',img: '/imgs/shop/7.png',path: ''}, + {name: '充值缴费',img: '/imgs/shop/8.png',path: ''}, + {name: '资质认证',img: '/imgs/shop/9.png',path: ''}, + {name: '联系客服',img: '/imgs/shop/10.png',path: ''}, ] const getProducts = async (isLoadMore = false) => { diff --git a/vite.config.js b/vite.config.js index 4ce0d23..9e2c7bb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -11,15 +11,15 @@ export default defineConfig({ } }, server: { - host: '0.0.0.0', // 添加这一行 + host: '0.0.0.0', port: 5173, proxy: { '/api': { - target: 'http://localhost:3000', + target: 'http://192.168.0.26:3000', changeOrigin: true }, '/uploads': { - target: 'http://localhost:3000', + target: 'http://192.168.0.26:3000', changeOrigin: true } }