var tongDonHang = 0; var tongTienDuocGiamMggShopee=0; var tongTienDuocGiamMggShopeeShop=0; var tongTienChiTieu = 0;/*Gồm +ship*/ var tongTienHangGiamGia = 0;/*Chưa +ship*/ var tongTienHang=0;/*Chưa +ship +chưa discount*/ var tongTienTietKiem=0; var tongTienVanChuyenChuaGiam = 0; var tongTienVanChuyenDuocGiam = 0; var tongSanPhamDaMua = 0; var trangThaiDonHangConKhong = true; var offset = 0; var si = 8; var tongTienVanChuyenPhaiTra=0; function xemBaoCaoThongKe() { var orders = []; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { orders = JSON.parse(this.responseText)['data']['details_list']; if(orders!=undefined){ tongDonHang += orders.length; trangThaiDonHangConKhong = orders.length <= si; orders.forEach(order => { tongTienChiTieu +=order['info_card']['final_total'] / 100000; order['info_card']['order_list_cards'].forEach(item => { let _items=item['product_info']['item_groups'][0]; _items['items'].forEach(data => { tongSanPhamDaMua += data["amount"]; tongTienHangGiamGia+=(data['order_price']/ 100000)*data["amount"]; if(data['price_before_discount']!=undefined){ tongTienHang+=(data['price_before_discount']/ 100000)*data["amount"]; }else{ tongTienHang+=(data['order_price']/ 100000)*data["amount"]; } }); }); }); offset += si; console.log('Đã thống kê được: ' + tongDonHang + ' đơn hàng'); }else{ trangThaiDonHangConKhong=false; } if(trangThaiDonHangConKhong) { console.log('Đợi chút polyxgo đang xử lý...'); xemBaoCaoThongKe(); } else { console.clear(); tongTienHangTietKiem=tongTienHang-tongTienHangGiamGia; tongTienVanChuyenPhaiTra=tongTienChiTieu-tongTienHangGiamGia; tongTienChiTieuX=pxgPrice(tongTienChiTieu); console.log("================================"); console.log("%c"+PXGCert(tongTienChiTieuX), "font-size:26px;"); console.log("%cHết có: "+"%c"+tongTienChiTieuX+" vnđ%c chứ nhiêu hì hì", "font-size: 20px;","font-size: 26px; color:red;font-weigth:700", "font-size: 20px;"); console.log("================================"); console.log("%cTổng đơn hàng đã giao: "+"%c"+pxgPrice(tongDonHang)+" đơn hàng", "font-size: 26px;","font-size: 26px; color:green"); console.log("%cTổng sản phẩm đã đặt: " + "%c" + pxgPrice(tongSanPhamDaMua)+" sản phẩm", "font-size: 20px;","font-size: 20px; color:#fc0000"); console.log("%c💲Tổng tiền hàng: "+"%c"+pxgPrice(tongTienHangGiamGia)+" vnđ", "font-size: 20px;","font-size: 20px; color:#fc0000"); console.log("%c💰Tổng tiền hàng tiết kiệm: "+"%c"+pxgPrice(tongTienHangTietKiem)+" vnđ", "font-size: 20px;","font-size: 26px; color:green"); console.log("%c💲Tổng tiền vận chuyển đã trả: "+"%c"+pxgPrice(tongTienVanChuyenPhaiTra)+" vnđ", "font-size: 20px;","font-size: 20px; color:#fc0000"); console.log("%c💲Tổng tiền hàng + tiền ship: "+"%c"+tongTienChiTieuX+" vnđ", "font-size: 26px;","font-size: 26px; color:#fc0000"); console.log("================================"); console.log("%c🔴Nhận mã giảm giá "+getDate()+"🔥", "font-size: 26px;"); console.log("%c👉Shopee khung giờ: "+"%chttps://polyxgo.com/ma-giam-gia/shopee/", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Lazada: "+"%chttps://polyxgo.com/ma-giam-gia/lazada/", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Tiki: "+"%chttps://polyxgo.com/ma-giam-gia/tiki/", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Fahasa: "+"%chttps://magiamgiafahasa.com", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Điện Máy XANH: "+"%chttps://magiamgiadienmayxanh.com", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Thế Giới Di Động: "+"%chttps://magiamgiathegioididong.com", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("================================"); console.log("%c✅Xem lịch sử giá sản phẩm tăng/ giảm", "font-size: 26px;"); console.log("%c👉LichSuGia.vn: "+"%chttps://lichsugia.vn", "font-size: 18px;","font-size: 18px; color:#fc0000"); console.log("%c👉Tiện ích tra Lịch Sử Giá VN: "+"%chttps://chromewebstore.google.com/detail/lichsugiavn/alkalmfopmpfpapcdbimlihfoiilhlaf?hl=vi", "font-size: 18px;","font-size: 18px; color:#fc0000"); } } }; xhttp.open("GET", "https://shopee.vn/api/v4/order/get_order_list?list_type=3&offset="+offset+"&limit="+si,true); xhttp.send(); } const getDate = () => { const newDate = new Date(); const year = newDate.getFullYear(); const month = newDate.getMonth() + 1; const d = newDate.getDate(); return `${d.toString()}/${month.toString()}/${year}`; } function PXGCert(pri){ if(pri<=10000000){ return "Bạn mua sắm cũng THƯỜNG ha"; }else if(pri>10000000 &&pri<=50000000){ return "Bạn mua sắm cũng TÀM TẠM ha"; }else if(pri>50000000 &&pri<80000000){ return "Bạn mua sắm hơi bị KINH ĐÓ hơ"; }else{ return "Bạn là bậc thầy mua sắm, là THÁNH SHOPEE kaka"; } } function pxgPrice(number, fixed=0) { if(isNaN(number)) return 0; number = number.toFixed(fixed); let delimeter = ','; number += ''; let rgx = /(\d+)(\d{3})/; while (rgx.test(number)) { number = number.replace(rgx, '$1' + delimeter + '$2'); } return number; } xemBaoCaoThongKe();