美客多(Meituan)是一家中國的在線零售平臺,提供各種商品和服務(wù)。前臺頁面是用戶與美客多進行交互的主要界面,通常包括搜索、購物車、訂單管理等功能。以下是一個簡單的美客多前臺頁面示例:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>美客多購物</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.search-bar {
margin-right: 20px;
}
.product-card {
border: 1px solid #ccc;
padding: 20px;
margin-bottom: 20px;
}
.product-card img {
width: 100%;
height: auto;
}
.product-info {
margin-top: 10px;
}
.cart-summary {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<input type="text" id="search-bar" placeholder="請輸入商品名稱或關(guān)鍵詞">
<button onclick="searchProduct()">搜索</button>
<div id="product-list"></div>
<div id="cart-summary"></div>
</div>
<script>
function searchProduct() {
const searchBar = document.getElementById('search-bar');
const productList = document.getElementById('product-list');
const cartSummary = document.getElementById('cart-summary');
// 獲取搜索結(jié)果
const searchResults = [];
for (let i = 0; i < 10; i++) { // 假設(shè)有10個商品
const product = {
name: `商品${i + 1}`,
price: Math.random() * 100, // 假設(shè)價格在1到100之間
image: `https://example.com/products/${i + 1}.jpg` // 假設(shè)圖片鏈接
};
searchResults.push(product);
}
// 清空搜索結(jié)果列表
productList.innerHTML = '';
searchResults.forEach(product => {
const productCard = document.createElement('div');
productCard.className = 'product-card';
productCard.innerHTML = `
<img src="${product.image}" alt="${product.name}">
<div class="product-info">
<h3>${product.name}</h3>
<p>價格:${product.price}元</p>
</div>
`;
productList.appendChild(productCard);
});
// 顯示購物車摘要
cartSummary.innerHTML = '<p>您的購物車中共有${searchResults.length}件商品</p>';
}
</script>
</body>
</html>
這個示例展示了一個簡單的美客多前臺頁面,包括搜索框、商品列表和購物車摘要。這只是一個基本的示例,實際應(yīng)用中可能需要根據(jù)具體需求進行調(diào)整。
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。