11:40 29/12/2023
This commit is contained in:
22
dist/data.js
vendored
22
dist/data.js
vendored
@@ -2,7 +2,7 @@
|
||||
//
|
||||
const List_product = [
|
||||
{
|
||||
productId: 1,
|
||||
productId: 22,
|
||||
product_name: 'Combo Bàn phím và Chuột không dây MOFII CANDY Milk Tea',
|
||||
productUrl: '/',
|
||||
image: 'https://mygear.vn/media/product/589-1.jpg',
|
||||
@@ -89,7 +89,7 @@ const List_product = [
|
||||
quantity: 30,
|
||||
sale_quantity: 10,
|
||||
quantity_member: 5,
|
||||
from_time: 1703696400000,
|
||||
from_time: 1703782800000,
|
||||
to_time: 1703955600000,
|
||||
status: 'coming',
|
||||
category_info: [
|
||||
@@ -150,7 +150,7 @@ const User = [
|
||||
{
|
||||
group_id: 1,
|
||||
name_group: 'Hura săn sale',
|
||||
product_id: 1,
|
||||
product_id: 33,
|
||||
productUrl: '/',
|
||||
product_image: 'https://mygear.vn/media/product/589-1.jpg',
|
||||
product_name: 'Combo Bàn phím và Chuột không dây MOFII CANDY Milk Tea',
|
||||
@@ -159,7 +159,7 @@ const User = [
|
||||
quantity: 20,
|
||||
sale_quantity: 10,
|
||||
quantity_member: 5,
|
||||
to_time: 1703955600000,
|
||||
to_time: 1703955500000,
|
||||
list_member: [
|
||||
{
|
||||
id_member: 1,
|
||||
@@ -304,7 +304,7 @@ const ShareGroupTemplate = `
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0)" class="btn-add-member" onclick="showContentPopup('waiting_join')">
|
||||
<a href="javascript:void(0)" class="btn-add-member" onclick="ShowPopupGlobal('waiting_join')">
|
||||
Gửi email thông báo
|
||||
</a>
|
||||
</div>
|
||||
@@ -429,3 +429,15 @@ const InfoPayProductTemplate = `
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
const OutTimeJoinTpl = `
|
||||
<a href="javascript:void(0)" class="btn-close"
|
||||
onclick="$('.global-popup').removeClass('active');closeBackground()">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
<div class="content">
|
||||
<h2 class="title">Thời gian tham gia nhóm Hurasoft săn sale Noel đã hết hạn!</h2>
|
||||
<div class="note">Bạn vui lòng tham gia nhóm khác hoặc tự tạo nhóm để mua sản phẩm chuột máy tính ABC với giá ưu đãi nha</div>
|
||||
</div>
|
||||
`;
|
||||
function XayHtmlPopup() {
|
||||
}
|
||||
|
||||
68
dist/main.js
vendored
68
dist/main.js
vendored
@@ -25,7 +25,6 @@ function goi_sp_user_tu_api() {
|
||||
function hienthi_nhomsp() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const lay_sp_user_tu_api = yield goi_sp_user_tu_api();
|
||||
console.log(lay_sp_user_tu_api);
|
||||
DisplayListProductGroup(lay_sp_user_tu_api, 'js-holder-product-group');
|
||||
});
|
||||
}
|
||||
@@ -33,7 +32,6 @@ function hienthi_sp() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const lay_sp_tu_api = yield goi_sp_tu_api();
|
||||
// code hien thi danh sach dang dien ra
|
||||
console.log(lay_sp_tu_api);
|
||||
showListProductHome(lay_sp_tu_api, 'out_stock', 'js-holder-list-out-stock');
|
||||
showListProductHome(lay_sp_tu_api, 'started', 'js-holder-list-started');
|
||||
showListProductHome(lay_sp_tu_api, 'coming', 'js-holder-list-coming');
|
||||
@@ -73,14 +71,13 @@ function xayhtml(product) {
|
||||
item.list_member.forEach((user, index) => {
|
||||
var more_qnt_member = product.quantity_member - index - 1;
|
||||
const isLastMember = index > product.quantity_member;
|
||||
console.log(isLastMember);
|
||||
HtmlListMember += `
|
||||
<a href="javascript:void(0)" class="item${isLastMember ? 'add' : ''}">
|
||||
${formatName(user.name_member)}
|
||||
</a>
|
||||
`;
|
||||
addMember = isLastMember ? `<a href="javascript:void(0)" class="item add">+</a>` : '';
|
||||
noteMember = isLastMember ? `Cần thêm <b style="color: var(--color-global);">${more_qnt_member}</b> thành viên` : '';
|
||||
addMember = isLastMember ? '' : '<a href="javascript:void(0)" class="item add">+</a>';
|
||||
noteMember = isLastMember ? '' : `Cần thêm <b style="color: var(--color-global);">${more_qnt_member}</b> thành viên`;
|
||||
});
|
||||
});
|
||||
htmlCheckGroup = `
|
||||
@@ -203,6 +200,9 @@ function DisplayListProductGroup(ProductUser, holderId) {
|
||||
const holder = document.getElementById(holderId);
|
||||
ProductUser.forEach(function (product, keyIndex) {
|
||||
html.push(xayhtmlProductGroup(product));
|
||||
product.list_group.forEach((Item) => {
|
||||
countDown(`js-deal-time-${Item.product_id}`, Item.to_time);
|
||||
});
|
||||
});
|
||||
if (holder) {
|
||||
holder.innerHTML = html.join('');
|
||||
@@ -222,31 +222,15 @@ function xayhtmlProductGroup(product) {
|
||||
HtmlSl_nhom = `<span class="soluongnhom">${Item.quantity / Item.quantity_member} nhóm duy nhất</span>`;
|
||||
}
|
||||
Item.list_member.forEach((user, index) => {
|
||||
if (index > Item.quantity_member) {
|
||||
HtmlListMember += `
|
||||
<a href="javascript:void(0)" class="item">
|
||||
${formatName(user.name_member)}
|
||||
</a>
|
||||
`;
|
||||
addMember = ``;
|
||||
noteMember = ``;
|
||||
}
|
||||
else {
|
||||
var more_qnt_member = Item.quantity_member - index - 1;
|
||||
HtmlListMember += `
|
||||
<a href="javascript:void(0)" class="item">
|
||||
${formatName(user.name_member)}
|
||||
</a>
|
||||
`;
|
||||
addMember = `
|
||||
<a href="javascript:void(0)" class="item add">
|
||||
+
|
||||
</a>
|
||||
`;
|
||||
noteMember = `
|
||||
Cần thêm <b style="color: var(--color-global);">${more_qnt_member}</b> thành viên
|
||||
`;
|
||||
}
|
||||
var more_qnt_member = Item.quantity_member - index - 1;
|
||||
const isLastMember = index > Item.quantity_member;
|
||||
HtmlListMember += `
|
||||
<a href="javascript:void(0)" class="item${isLastMember ? 'add' : ''}">
|
||||
${formatName(user.name_member)}
|
||||
</a>
|
||||
`;
|
||||
addMember = isLastMember ? '' : '<a href="javascript:void(0)" class="item add">+</a>';
|
||||
noteMember = isLastMember ? '' : `Cần thêm <b style="color: var(--color-global);">${more_qnt_member}</b> thành viên`;
|
||||
});
|
||||
HtmlProductItem += `
|
||||
<div class="product-item d-flex">
|
||||
@@ -283,7 +267,7 @@ function xayhtmlProductGroup(product) {
|
||||
<div class="product-time-holder js-deal-time-${Item.product_id}" data-time="${Item.to_time}">
|
||||
</div>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="add-member">
|
||||
<a href="javascript:void(0)" class="add-member" onclick="ShowPopupGlobal('AddMember')">
|
||||
<i class="fa fa-plus"></i>
|
||||
Mời thêm bạn
|
||||
</a>
|
||||
@@ -371,8 +355,28 @@ function ShowPopupGlobal(key) {
|
||||
else if (key == 'AddMember') {
|
||||
holderPupop.innerHTML = ShareGroupTemplate;
|
||||
}
|
||||
else if (key == 'waiting_join') {
|
||||
holderPupop.innerHTML = JoinProductTemplate;
|
||||
CountdownJoin();
|
||||
}
|
||||
}
|
||||
function changeTab(contentId) {
|
||||
// Xóa lớp 'active' khỏi tất cả các tab
|
||||
const tabItems = document.querySelectorAll('.tab-list .item');
|
||||
tabItems.forEach(item => item.classList.remove('active'));
|
||||
// Thêm lớp 'active' vào tab được nhấp chuột
|
||||
const selectedTabItem = event.currentTarget.parentElement; // Lấy phần tử cha của <a> (li.item)
|
||||
// Lấy phần tử cha của <a> (li.item)
|
||||
selectedTabItem.classList.add('active');
|
||||
// Xóa lớp 'active' khỏi tất cả nội dung của tab
|
||||
const tabPanes = document.querySelectorAll('.box-list-product');
|
||||
tabPanes.forEach(pane => pane.classList.remove('active'));
|
||||
// Thêm lớp 'active' vào nội dung của tab tương ứng
|
||||
const selectedTabPane = document.querySelector(contentId);
|
||||
if (selectedTabPane) {
|
||||
selectedTabPane.classList.add('active');
|
||||
}
|
||||
}
|
||||
// run function
|
||||
hienthi_sp();
|
||||
hienthi_nhomsp();
|
||||
CountdownJoin();
|
||||
|
||||
Reference in New Issue
Block a user