feat: 添加hgcart购物车模板+Drone部署同步
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- 解压default_npant.tar.gz到clientarea/cart/hgcart/ - .drone.yml增加hgcart同步到cart/template/pc/
This commit is contained in:
179
clientarea/cart/hgcart/js/goods.js
Normal file
179
clientarea/cart/hgcart/js/goods.js
Normal file
@@ -0,0 +1,179 @@
|
||||
var orignalSetItem = localStorage.setItem;
|
||||
localStorage.setItem = function (key, newValue) {
|
||||
var setItemEvent = new Event("setItemEvent");
|
||||
setItemEvent.newValue = newValue;
|
||||
window.dispatchEvent(setItemEvent);
|
||||
orignalSetItem.apply(this, arguments);
|
||||
};
|
||||
(function (window, undefined) {
|
||||
var old_onload = window.onload;
|
||||
window.onload = function () {
|
||||
const template = document.getElementsByClassName("goods")[0];
|
||||
Vue.prototype.lang = window.lang;
|
||||
window.addEventListener("setItemEvent", function (e) {
|
||||
if (e.newValue && String(e.newValue).indexOf("cartNum") !== -1) {
|
||||
vm._data.shoppingCarNum = e.newValue.split("-")[1] * 1;
|
||||
}
|
||||
});
|
||||
const vm = new Vue({
|
||||
components: {
|
||||
asideMenu,
|
||||
topMenu,
|
||||
pagination,
|
||||
},
|
||||
created() {
|
||||
const params = getUrlParams();
|
||||
if (params.token) {
|
||||
localStorage.setItem("jwt", params.token);
|
||||
}
|
||||
this.id = params.id;
|
||||
// 只获取 commonData 配置,不触发 getGoodDetail
|
||||
this.commonData = JSON.parse(
|
||||
localStorage.getItem("common_set_before")
|
||||
);
|
||||
},
|
||||
mounted() {
|
||||
if (window.self !== window.top) {
|
||||
this.isIfram = true;
|
||||
}
|
||||
// 先加载 content,完成后再加载 popover 数据,避免并发请求过多
|
||||
this.getList().then(() => {
|
||||
if (this.commonData.cart_change_product == 1) {
|
||||
this.getGoodDetail(this.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
updated() {
|
||||
// // 关闭loading
|
||||
document.getElementById("mainLoading").style.display = "none";
|
||||
document.getElementsByClassName("goods")[0].style.display = "block";
|
||||
},
|
||||
computed: {
|
||||
calcProductGroup() {
|
||||
// fillterKey 过滤关键字 secProductGroupList
|
||||
const fillterKey = this.fillterKey.trim().toLowerCase();
|
||||
const originList = JSON.parse(
|
||||
JSON.stringify(this.secProductGroupList)
|
||||
);
|
||||
const arr = originList
|
||||
.filter((item) => {
|
||||
return (
|
||||
item.goodsList.filter((i) => {
|
||||
return i.name.toLowerCase().indexOf(fillterKey) !== -1;
|
||||
}).length > 0
|
||||
);
|
||||
})
|
||||
.map((item) => {
|
||||
item.goodsList = item.goodsList.filter((i) => {
|
||||
return i.name.toLowerCase().indexOf(fillterKey) !== -1;
|
||||
});
|
||||
return item;
|
||||
});
|
||||
return arr;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: "",
|
||||
isIfram: false,
|
||||
shoppingCarNum: 0,
|
||||
fillterKey: "",
|
||||
params: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
pageSizes: [20, 50, 100],
|
||||
total: 200,
|
||||
orderby: "id",
|
||||
sort: "desc",
|
||||
keywords: "",
|
||||
},
|
||||
commonData: {},
|
||||
content: "",
|
||||
productInfo: {},
|
||||
secProductGroupList: [],
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
formateTime(time) {
|
||||
if (time && time !== 0) {
|
||||
return formateDate(time * 1000);
|
||||
} else {
|
||||
return "--";
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
try {
|
||||
const params = { id: this.id, flag: this.isIfram };
|
||||
const res = await getOrederConfig(params);
|
||||
this.$nextTick(() => {
|
||||
// 解决Jquery加载JS会在文件末尾添加时间戳的问题
|
||||
$.ajaxSetup({
|
||||
cache: true,
|
||||
});
|
||||
$(".config-box .content").html(res.data.data.content);
|
||||
});
|
||||
this.content = res.data.data.content;
|
||||
} catch (error) {}
|
||||
},
|
||||
handleCommand(id) {
|
||||
// 打开新页面 替换id
|
||||
location.href = `goods.htm?id=${id}`;
|
||||
},
|
||||
getGoodDetail(id) {
|
||||
apiProductDetail({ id }).then((res) => {
|
||||
this.productInfo = res.data.data.product;
|
||||
this.getProductGroup_second(
|
||||
this.productInfo.product_group_id_first
|
||||
);
|
||||
});
|
||||
},
|
||||
// 获取二级分类
|
||||
getProductGroup_second(id) {
|
||||
productGroupSecond(id).then((res) => {
|
||||
this.secProductGroupList = res.data.data.list.map((item) => {
|
||||
item.goodsList = [];
|
||||
return item;
|
||||
});
|
||||
this.getProductGoodList();
|
||||
});
|
||||
},
|
||||
// 获取商品列表
|
||||
getProductGoodList() {
|
||||
this.secProductGroupList.forEach((item) => {
|
||||
const params = {
|
||||
page: 1,
|
||||
limit: 999999,
|
||||
id: item.id,
|
||||
};
|
||||
productGoods(params).then((res) => {
|
||||
item.goodsList = res.data.data.list;
|
||||
});
|
||||
});
|
||||
},
|
||||
// 每页展示数改变
|
||||
sizeChange(e) {
|
||||
this.params.limit = e;
|
||||
this.params.page = 1;
|
||||
// 获取列表
|
||||
},
|
||||
// 当前页改变
|
||||
currentChange(e) {
|
||||
this.params.page = e;
|
||||
},
|
||||
|
||||
// 获取通用配置
|
||||
getCommonData() {
|
||||
this.commonData = JSON.parse(
|
||||
localStorage.getItem("common_set_before")
|
||||
);
|
||||
if (this.commonData.cart_change_product == 1) {
|
||||
this.getGoodDetail(this.id);
|
||||
}
|
||||
},
|
||||
},
|
||||
}).$mount(template);
|
||||
typeof old_onload == "function" && old_onload();
|
||||
};
|
||||
})(window);
|
||||
949
clientarea/cart/hgcart/js/goodsList.js
Normal file
949
clientarea/cart/hgcart/js/goodsList.js
Normal file
@@ -0,0 +1,949 @@
|
||||
(function (window, undefined) {
|
||||
var old_onload = window.onload;
|
||||
window.onload = function () {
|
||||
const template = document.getElementsByClassName("template")[0];
|
||||
Vue.prototype.lang = window.lang;
|
||||
new Vue({
|
||||
components: {
|
||||
asideMenu,
|
||||
topMenu,
|
||||
scrollText,
|
||||
},
|
||||
created() {
|
||||
window.addEventListener("scroll", this.scrollBottom);
|
||||
// 监听 页面点击事件 用于关闭 isShowSuffixBox
|
||||
document.addEventListener("click", (e) => {
|
||||
const classNameArr = [
|
||||
"suffix-list",
|
||||
"suffix-box",
|
||||
"suffix-item",
|
||||
"suffix-item suffix-active",
|
||||
"el-icon-arrow-down select-btn",
|
||||
];
|
||||
if (!classNameArr.includes(e.target.className)) {
|
||||
this.isShowSuffixBox = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.getCommonData();
|
||||
this.getCarList();
|
||||
|
||||
sessionStorage.removeItem("product_information");
|
||||
this.fpg_id = this.getQuery("fpg_id") * 1;
|
||||
this.spg_id = this.getQuery("spg_id") * 1;
|
||||
this.host_id = this.getQuery("host_id") * 1;
|
||||
this.domainInput = this.getQuery("domain");
|
||||
},
|
||||
mounted() {
|
||||
const addons_js_arr = JSON.parse(
|
||||
document.querySelector("#addons_js").getAttribute("addons_js")
|
||||
); // 插件列表
|
||||
const arr = addons_js_arr.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
if (arr.includes("EventPromotion")) {
|
||||
// 开启活动满减
|
||||
this.isShowFull = true;
|
||||
}
|
||||
this.initData();
|
||||
},
|
||||
updated() {
|
||||
// 关闭loading
|
||||
document.getElementById("mainLoading").style.display = "none";
|
||||
document.getElementsByClassName("template")[0].style.display = "block";
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener("scroll", this.scrollBottom);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowView: false,
|
||||
searchValue: "", // 搜索内容
|
||||
searchLoading: false,
|
||||
select_first_obj: {
|
||||
id: "", // 一级分组ID
|
||||
type: "", // 一级分组类型
|
||||
}, // 选中的一级分类对象
|
||||
select_second_obj: {
|
||||
id: "", // 二级分组ID
|
||||
type: "", // 二级分组类型
|
||||
description: "", // 二级分组描述
|
||||
}, // 选中的一级分类对象
|
||||
first_group_list: [], // 一级分类数组
|
||||
second_group_list: [], // 二级分类数组
|
||||
commonData: {},
|
||||
scrollDisabled: false,
|
||||
secondLoading: false, // 二级分类加载
|
||||
goodSLoading: false,
|
||||
goodsParmas: {
|
||||
keywords: "", // 关键字,搜索范围:商品ID,商品名,描述
|
||||
id: "", // 二级分组ID
|
||||
page: 1, // 页数
|
||||
limit: 12, // 每页条数
|
||||
},
|
||||
goodsList: [], // 商品列表数组
|
||||
regType: "1",
|
||||
domainInput: "",
|
||||
selectSuffix: "",
|
||||
isAllCheck: false,
|
||||
isShowFull: false,
|
||||
suffixList: [],
|
||||
domainList: [],
|
||||
isSearching: false,
|
||||
isShowSuffixBox: false,
|
||||
carList: [],
|
||||
checkList: [],
|
||||
product_id: "",
|
||||
isCarLoading: false,
|
||||
isIndeterminate: false,
|
||||
isBatchIndeterminate: false,
|
||||
isBatchAllCheck: false,
|
||||
batchLoading: false,
|
||||
addAllLoading: false,
|
||||
textarea2: "",
|
||||
batchCheckGroup: [],
|
||||
availList: [],
|
||||
unavailList: [],
|
||||
faillList: [],
|
||||
activeNames: [],
|
||||
domainConfig: {},
|
||||
isShowUpload: false,
|
||||
fileName: "",
|
||||
fileContent: "",
|
||||
originalPrice: 0.0,
|
||||
/* 传参搜索 */
|
||||
fpg_id: "",
|
||||
spg_id: "",
|
||||
host_id: "",
|
||||
isShowFilrer: false,
|
||||
selectFilterSuffix: [],
|
||||
};
|
||||
},
|
||||
filters: {
|
||||
formateTime(time) {
|
||||
if (time && time !== 0) {
|
||||
return formateDate(time * 1000);
|
||||
} else {
|
||||
return "--";
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 是否选中的分类为域名
|
||||
isDomain() {
|
||||
return this.select_second_obj.type === "domain";
|
||||
},
|
||||
// 计算购物车选中的商品的总价
|
||||
totalMoneyCalc() {
|
||||
let total = 0;
|
||||
this.carList.forEach((item) => {
|
||||
if (this.checkList.includes(item.positions)) {
|
||||
total += this.priceCalc(item) * 1000;
|
||||
}
|
||||
});
|
||||
const firstDiscount = this.carList.filter(
|
||||
(item) => this.checkList[0] === item.positions
|
||||
);
|
||||
let domainDiscount = 0;
|
||||
if (firstDiscount.length > 0) {
|
||||
domainDiscount = firstDiscount[0]?.priceArr[0]?.discount;
|
||||
}
|
||||
this.originalPrice = (total / 1000).toFixed(2);
|
||||
let temp = (total - domainDiscount * 1000) / 1000;
|
||||
if (isNaN(temp)) {
|
||||
temp = 0.0;
|
||||
}
|
||||
return temp;
|
||||
},
|
||||
showDomainList() {
|
||||
return (
|
||||
this.domainList.filter((item) => {
|
||||
return (
|
||||
item.avail === 0 ||
|
||||
(item.avail === 1 && item.priceArr.length > 0)
|
||||
);
|
||||
}) || []
|
||||
);
|
||||
},
|
||||
// 是否登录
|
||||
isLogin() {
|
||||
return window.localStorage.jwt ? true : false;
|
||||
},
|
||||
calcDomainList() {
|
||||
if (this.selectFilterSuffix.length === 0) {
|
||||
return this.showDomainList;
|
||||
} else {
|
||||
return this.showDomainList.filter((item) => {
|
||||
return this.selectFilterSuffix.includes(
|
||||
this.getDomainSuffix(item.name).suffix
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
fillterDomainSuffix() {
|
||||
// 根据域名后缀分类
|
||||
return [
|
||||
...new Set(
|
||||
this.showDomainList.map((item) => {
|
||||
return this.getDomainSuffix(item.name).suffix;
|
||||
})
|
||||
),
|
||||
];
|
||||
},
|
||||
showOriginal() {
|
||||
const firstDiscount = this.carList.filter(
|
||||
(item) => this.checkList[0] === item.positions
|
||||
);
|
||||
const domainDiscount = firstDiscount[0]?.priceArr[0]?.discount;
|
||||
if (this.checkList.length > 0 && domainDiscount > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openFilter() {
|
||||
this.isShowFilrer = !this.isShowFilrer;
|
||||
this.selectFilterSuffix = [];
|
||||
},
|
||||
handelFilterSuffix(item) {
|
||||
const index = this.selectFilterSuffix.indexOf(item);
|
||||
if (index !== -1) {
|
||||
this.selectFilterSuffix.splice(index, 1);
|
||||
} else {
|
||||
this.selectFilterSuffix.push(item);
|
||||
}
|
||||
},
|
||||
calcEvent(eventList) {},
|
||||
getQuery(name) {
|
||||
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
const r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return decodeURI(r[2]);
|
||||
return null;
|
||||
},
|
||||
goLogin() {
|
||||
sessionStorage.redirectUrl = "/cart/goodsList.htm";
|
||||
location.href = "/login.htm";
|
||||
},
|
||||
// 选择文件
|
||||
selectFile() {
|
||||
document.getElementById("upFile").click();
|
||||
// 监听文件上传
|
||||
document.getElementById("upFile").addEventListener("change", (e) => {
|
||||
// 获取文件
|
||||
const file = e.target.files[0];
|
||||
// 判断文件类型
|
||||
if (file.type !== "text/plain") {
|
||||
this.$message.warning(lang.template_text137);
|
||||
return;
|
||||
}
|
||||
// 读取文件名
|
||||
this.fileName = file.name;
|
||||
// 读取文件
|
||||
const reader = new FileReader();
|
||||
// 判断txt文件编码格式
|
||||
reader.readAsText(file, "utf-8");
|
||||
reader.onload = (e) => {
|
||||
const txtString = e.target.result;
|
||||
// utf-8 的 中文编码 正则表达式
|
||||
const patrn = /[\u4E00-\u9FA5]/gi;
|
||||
// 检测当前文本是否含有中文(如果没有,则当乱码处理)
|
||||
// 两个格式的英文编码一样,所以纯英文文件也当成乱码再处理一次
|
||||
if (!patrn.exec(txtString)) {
|
||||
let reader_gb2312 = new FileReader();
|
||||
// 再拿一次纯文本,这一次拿到的文本一定不会乱码
|
||||
reader_gb2312.readAsText(file, "gb2312");
|
||||
reader_gb2312.onload = (e2) => {
|
||||
this.fileContent = e2.target.result;
|
||||
};
|
||||
} else {
|
||||
this.fileContent = txtString;
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
confirmUpload() {
|
||||
// 解析输入框中的换行 把换行替换成\n 传字符串
|
||||
let params = this.fileContent
|
||||
.replace(/[\r\n]/g, ",")
|
||||
.split(",")
|
||||
.filter((item) => {
|
||||
return item !== "";
|
||||
});
|
||||
const maxLimt = this.domainConfig.number_limit || 500;
|
||||
if (params.length > maxLimt) {
|
||||
// 截取前500个
|
||||
params = params.slice(0, maxLimt);
|
||||
}
|
||||
this.textarea2 = params.join("\n");
|
||||
this.cancelUpload();
|
||||
},
|
||||
cancelUpload() {
|
||||
document.getElementById("upFile").value = "";
|
||||
document
|
||||
.getElementById("upFile")
|
||||
.removeEventListener("change", () => {});
|
||||
this.fileName = "";
|
||||
this.fileContent = "";
|
||||
this.isShowUpload = false;
|
||||
},
|
||||
// 获取域名设置
|
||||
getDomainSet() {
|
||||
domainSetting().then((res) => {
|
||||
this.domainConfig = res.data.data;
|
||||
this.selectSuffix = res.data.data.default_search_domain || "";
|
||||
const suffixArr = this.suffixList.reduce((all, cur) => {
|
||||
all.push(cur.suffix);
|
||||
return all;
|
||||
}, []);
|
||||
if (
|
||||
suffixArr.length > 0 &&
|
||||
!suffixArr.includes(this.selectSuffix)
|
||||
) {
|
||||
this.selectSuffix = this.suffixList[0].suffix;
|
||||
}
|
||||
// 官网跳转查询
|
||||
if (location.href.indexOf("suffix") !== -1) {
|
||||
this.selectSuffix = this.getQuery("suffix");
|
||||
this.handelDomainSearch();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 是否已经加入购物车
|
||||
isAddCart(item) {
|
||||
const isHave = this.carList.find((cartItem) => {
|
||||
return cartItem.config_options.domain === item.name;
|
||||
});
|
||||
return Boolean(isHave);
|
||||
},
|
||||
// 价格计算
|
||||
priceCalc(item) {
|
||||
if (item.priceArr.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
const price =
|
||||
item.priceArr.find((priceItem) => {
|
||||
return priceItem.buyyear === item.selectYear;
|
||||
}) || [];
|
||||
return price.buyprice;
|
||||
},
|
||||
goBuyDomain() {
|
||||
if (this.checkList.length === 0) {
|
||||
this.$message.warning(lang.template_text138);
|
||||
return;
|
||||
}
|
||||
if (!this.isLogin) {
|
||||
this.$message.warning(lang.template_text139);
|
||||
sessionStorage.redirectUrl = "/cart/goodsList.htm";
|
||||
this.goLogin();
|
||||
return;
|
||||
}
|
||||
sessionStorage.setItem(
|
||||
"buyDomainPosition",
|
||||
JSON.stringify(this.checkList)
|
||||
);
|
||||
if (this.host_id) {
|
||||
location.href = `/plugin/${getPluginId(
|
||||
"IdcsmartDomain"
|
||||
)}/buyDomain.htm?host_id=${this.host_id}`;
|
||||
} else {
|
||||
location.href = `/plugin/${getPluginId(
|
||||
"IdcsmartDomain"
|
||||
)}/buyDomain.htm`;
|
||||
}
|
||||
},
|
||||
// 批量查询域名
|
||||
batchSearchDomain() {
|
||||
if (!this.textarea2) {
|
||||
this.$message.warning(lang.template_text140);
|
||||
return;
|
||||
}
|
||||
// 解析输入框中的换行 把换行替换成\n 传字符串
|
||||
const params = this.textarea2
|
||||
.replace(/[\r\n]/g, ",")
|
||||
.split(",")
|
||||
.filter((item) => {
|
||||
return item !== "";
|
||||
})
|
||||
.join(",");
|
||||
const maxLimt = this.domainConfig.number_limit || 500;
|
||||
if (params.split(",").length - 1 >= maxLimt) {
|
||||
this.$message.warning(
|
||||
`${lang.template_text141}${maxLimt}${lang.template_text142}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.batchLoading = true;
|
||||
domainBatch({domains: params})
|
||||
.then((res) => {
|
||||
this.availList = res.data.data.avail.map((item) => {
|
||||
item.priceArr = [];
|
||||
item.showPrice = 0;
|
||||
item.priceLoading = true;
|
||||
return item;
|
||||
});
|
||||
// 查询可注册的域名价格
|
||||
this.availList.forEach((item) => {
|
||||
domainPrice({name: item.name, host_id: this.host_id})
|
||||
.then((res) => {
|
||||
item.priceArr = res.data.data || [];
|
||||
item.showPrice = res.data.data[0]?.buyprice || 0;
|
||||
})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
});
|
||||
});
|
||||
this.unavailList = res.data.data.unavail;
|
||||
this.faillList = res.data.data.fail;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.batchLoading = false;
|
||||
});
|
||||
},
|
||||
handleBatchChange(val) {
|
||||
let checkedCount = val.length;
|
||||
this.isBatchAllCheck = checkedCount === this.availList.length;
|
||||
this.isBatchIndeterminate =
|
||||
checkedCount > 0 && checkedCount < this.availList.length;
|
||||
},
|
||||
handleBatchCheckAllChange(val) {
|
||||
this.batchCheckGroup = val
|
||||
? this.availList.map((item) => {
|
||||
return item.name;
|
||||
})
|
||||
: [];
|
||||
this.isBatchIndeterminate = false;
|
||||
},
|
||||
// 购物车列表
|
||||
getCarList() {
|
||||
this.isCarLoading = true;
|
||||
cartList().then((res) => {
|
||||
const arr = res.data.data.list
|
||||
.map((item, index) => {
|
||||
return {
|
||||
...item,
|
||||
positions: index,
|
||||
selectYear: item.config_options.year,
|
||||
priceArr: [],
|
||||
showPrice: 0,
|
||||
priceLoading: true,
|
||||
};
|
||||
})
|
||||
.filter((item) => {
|
||||
return item.customfield.is_domain === 1;
|
||||
});
|
||||
// 拉取价格
|
||||
this.carList = arr;
|
||||
this.isCarLoading = false;
|
||||
this.carList.forEach((item) => {
|
||||
domainPrice({
|
||||
name: item.config_options.domain,
|
||||
host_id: this.host_id,
|
||||
})
|
||||
.then((res) => {
|
||||
item.priceArr = res.data.data || [];
|
||||
item.showPrice = res.data.data[0]?.buyprice || 0;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
handleCheckAllChange(val) {
|
||||
this.checkList = val
|
||||
? this.carList.map((item) => {
|
||||
return item.positions;
|
||||
})
|
||||
: [];
|
||||
this.isIndeterminate = false;
|
||||
},
|
||||
handleCheckedCitiesChange(value) {
|
||||
let checkedCount = value.length;
|
||||
this.isAllCheck = checkedCount === this.carList.length;
|
||||
this.isIndeterminate =
|
||||
checkedCount > 0 && checkedCount < this.carList.length;
|
||||
},
|
||||
// 加入购物车
|
||||
addCart(item) {
|
||||
if (this.isAddCart(item)) {
|
||||
return;
|
||||
}
|
||||
this.isCarLoading = true;
|
||||
const params = {
|
||||
product_id: this.product_id,
|
||||
config_options: {
|
||||
domain: item.name,
|
||||
year: 1,
|
||||
},
|
||||
qty: 1,
|
||||
customfield: {
|
||||
is_domain: 1, // 是否域名商品
|
||||
},
|
||||
};
|
||||
addToCart(params)
|
||||
.then((res) => {
|
||||
if (res.data.status === 200) {
|
||||
this.getCarList();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(err.data.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isCarLoading = false;
|
||||
});
|
||||
},
|
||||
// 批量加入购物车
|
||||
addAllCart() {
|
||||
// 判断是否有选中的域名
|
||||
if (this.batchCheckGroup.length === 0) {
|
||||
this.$message.warning(lang.template_text138);
|
||||
return;
|
||||
}
|
||||
if (this.addAllLoading) {
|
||||
return;
|
||||
}
|
||||
this.addAllLoading = true;
|
||||
// 筛选出选中的域名
|
||||
const arr = this.availList.filter((item) => {
|
||||
return this.batchCheckGroup.includes(item.name);
|
||||
});
|
||||
// 循环调用加入购物车接口
|
||||
const productsArr = [];
|
||||
arr.forEach((item) => {
|
||||
const params = {
|
||||
product_id: this.product_id,
|
||||
config_options: {
|
||||
domain: item.name,
|
||||
year: 1,
|
||||
},
|
||||
qty: 1,
|
||||
customfield: {
|
||||
is_domain: 1, // 是否域名商品
|
||||
},
|
||||
};
|
||||
productsArr.push(params);
|
||||
});
|
||||
addToCart({products: productsArr})
|
||||
.then((res) => {
|
||||
if (res.data.status === 200) {
|
||||
this.getCarList();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(err.data.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
this.addAllLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
// 修改购物车
|
||||
changeCart(val, item) {
|
||||
const params = {
|
||||
position: item.positions,
|
||||
product_id: item.product_id,
|
||||
qty: 1,
|
||||
config_options: {
|
||||
domain: item.config_options.domain,
|
||||
year: val,
|
||||
},
|
||||
customfield: {
|
||||
is_domain: 1, // 是否域名商品
|
||||
},
|
||||
};
|
||||
updateCart(params)
|
||||
.then((res) => {
|
||||
if (res.data.status === 200) {
|
||||
// this.getCarList()
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(err.data.msg);
|
||||
});
|
||||
},
|
||||
|
||||
// 删除购物车
|
||||
async deleteCart(item) {
|
||||
this.isCarLoading = true;
|
||||
const params = {
|
||||
position: item.positions,
|
||||
};
|
||||
const res = await deleteCart(params);
|
||||
if (res.data.status === 200) {
|
||||
this.isCarLoading = false;
|
||||
this.getCarList();
|
||||
}
|
||||
},
|
||||
// 批量删除购物车
|
||||
async deleteClearCart() {
|
||||
if (this.carList.length === 0) {
|
||||
return;
|
||||
}
|
||||
this.isCarLoading = true;
|
||||
const params = {
|
||||
positions: this.carList.map((item) => {
|
||||
return item.positions;
|
||||
}),
|
||||
};
|
||||
const res = await deleteCartBatch(params);
|
||||
if (res.data.status === 200) {
|
||||
this.isCarLoading = false;
|
||||
this.getCarList();
|
||||
}
|
||||
},
|
||||
// 获取后缀
|
||||
async getSuffix() {
|
||||
// DA购买域名需要传入产品ID筛选对于的后缀
|
||||
try {
|
||||
const res = await domainSuffix(this.host_id);
|
||||
this.suffixList = res.data.data || [];
|
||||
this.getDomainSet();
|
||||
} catch (error) {
|
||||
this.getDomainSet();
|
||||
}
|
||||
},
|
||||
// 选择后缀
|
||||
handelSelectSuffix(item) {
|
||||
this.selectSuffix = item;
|
||||
},
|
||||
// 域名截断 return domain suffix baidu.com => baidu .com
|
||||
getDomainSuffix(str) {
|
||||
const domainStr = str.trim();
|
||||
const domainRegex = /^[^.]+(\.[^.]+)+$/;
|
||||
const domainData = {
|
||||
domain: domainStr,
|
||||
suffix: "",
|
||||
};
|
||||
if (domainRegex.test(domainStr)) {
|
||||
const parts = domainStr.split(".");
|
||||
domainData.domain = parts[0];
|
||||
domainData.suffix =
|
||||
parts.length >= 2 ? "." + parts.slice(1).join(".") : "";
|
||||
}
|
||||
return domainData;
|
||||
},
|
||||
handelDomainSearch() {
|
||||
// 去除前后空格
|
||||
this.domainInput = this.domainInput.trim();
|
||||
if (!this.domainInput) {
|
||||
this.$message.warning(lang.template_text140);
|
||||
return;
|
||||
}
|
||||
const suffix = this.getDomainSuffix(this.domainInput).suffix;
|
||||
if (
|
||||
suffix &&
|
||||
this.suffixList.find((item) => item.suffix === suffix)
|
||||
) {
|
||||
this.selectSuffix = suffix;
|
||||
}
|
||||
this.isShowSuffixBox = false;
|
||||
this.isSearching = true;
|
||||
this.domainList = [];
|
||||
this.domainInput = this.getDomainSuffix(this.domainInput).domain;
|
||||
domainSearch({
|
||||
domain: this.domainInput,
|
||||
suffix: this.selectSuffix,
|
||||
host_id: this.host_id,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.status === 200) {
|
||||
const list = res.data.data;
|
||||
this.domainList = list.map((item) => {
|
||||
item.priceArr = [];
|
||||
item.showPrice = 0;
|
||||
item.priceLoading = true;
|
||||
|
||||
return item;
|
||||
});
|
||||
this.isSearching = false;
|
||||
this.domainList.forEach((item) => {
|
||||
if (item.avail === 1) {
|
||||
domainPrice({name: item.name, host_id: this.host_id})
|
||||
.then((res) => {
|
||||
item.priceArr = res.data.data || [];
|
||||
item.showPrice = res.data.data[0]?.buyprice || 0;
|
||||
})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
// 判断当前选中的域名后缀是否支持中文
|
||||
const isChinese =
|
||||
this.suffixList.find((item) => {
|
||||
return item.suffix === this.selectSuffix;
|
||||
}).allow_zh === 0;
|
||||
// 判断输入的是否是中文
|
||||
const chineseReg = /[\u4e00-\u9fa5]/g;
|
||||
if (isChinese && chineseReg.test(this.domainInput)) {
|
||||
this.domainList.unshift({
|
||||
// 添加一条不支持中文的提示
|
||||
name: this.domainInput + this.selectSuffix,
|
||||
avail: -2,
|
||||
description: lang.template_text143,
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isSearching = false;
|
||||
});
|
||||
},
|
||||
// 获取域名价格
|
||||
getDomainPrice() {},
|
||||
goWhois(item) {
|
||||
window.open(
|
||||
`/plugin/${getPluginId("IdcsmartDomain")}/whois.htm?domain=${
|
||||
item.name
|
||||
}`
|
||||
);
|
||||
},
|
||||
getRule(arr) {
|
||||
let isHave = this.showFun(arr, "CartController::index");
|
||||
if (isHave) {
|
||||
this.isShowView = true;
|
||||
}
|
||||
if (!this.isShowView) {
|
||||
// 没有权限
|
||||
location.href = "/noPermissions.htm";
|
||||
}
|
||||
},
|
||||
showFun(arr, str) {
|
||||
if (typeof arr == "string") {
|
||||
return true;
|
||||
} else {
|
||||
let isShow = "";
|
||||
isShow = arr.find((item) => {
|
||||
let isHave = item.includes(str);
|
||||
if (isHave) {
|
||||
return isHave;
|
||||
}
|
||||
});
|
||||
return isShow;
|
||||
}
|
||||
},
|
||||
// 获取一级分类
|
||||
getProductGroup_first() {
|
||||
productGroupFirst().then((res) => {
|
||||
this.first_group_list = res.data.data.list;
|
||||
});
|
||||
},
|
||||
// 搜索
|
||||
searchGoods() {
|
||||
this.searchLoading = true;
|
||||
this.goodsParmas.keywords = this.searchValue;
|
||||
this.goodsParmas.id = "";
|
||||
this.goodsParmas.page = 1;
|
||||
this.goodsList = [];
|
||||
this.getProductGoodList();
|
||||
},
|
||||
// 获取二级分类
|
||||
getProductGroup_second(id) {
|
||||
productGroupSecond(id).then((res) => {
|
||||
this.secondLoading = false;
|
||||
this.second_group_list = res.data.data.list;
|
||||
if (res.data.data.list[0]) {
|
||||
this.select_second_obj.id = res.data.data.list[0].id;
|
||||
this.select_second_obj.type = res.data.data.list[0].type;
|
||||
this.select_second_obj.description =
|
||||
res.data.data.list[0]?.description;
|
||||
this.goodsParmas.id = this.select_second_obj.id;
|
||||
if (this.select_second_obj.type === "domain") {
|
||||
this.getSuffix();
|
||||
}
|
||||
this.getProductGoodList();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取商品列表
|
||||
getProductGoodList() {
|
||||
this.goodSLoading = true;
|
||||
productGoods(this.goodsParmas).then((res) => {
|
||||
if (
|
||||
this.select_second_obj.type === "domain" &&
|
||||
res.data.data.list[0]
|
||||
) {
|
||||
this.product_id = res.data.data.list[0].id;
|
||||
}
|
||||
this.searchLoading = false;
|
||||
const list = res.data.data.list.map((item) => {
|
||||
item.activeList = [];
|
||||
return item;
|
||||
});
|
||||
if (this.isShowFull) {
|
||||
list.forEach((item) => {
|
||||
eventPromotion({id: item.id}).then((res) => {
|
||||
item.activeList = res.data.list;
|
||||
});
|
||||
});
|
||||
}
|
||||
this.goodsList = this.goodsList.concat(list);
|
||||
this.goodSLoading = false;
|
||||
this.scrollDisabled =
|
||||
res.data.data.list.length < this.goodsParmas.limit;
|
||||
this.$nextTick(() => {
|
||||
// 判断当前列表是否达到滚动加载的条件
|
||||
this.needScroll();
|
||||
});
|
||||
});
|
||||
},
|
||||
needScroll() {
|
||||
const scrollTop =
|
||||
document.documentElement.scrollTop || document.body.scrollTop;
|
||||
const clientHeight = document.documentElement.clientHeight;
|
||||
const scrollHeight = document.documentElement.scrollHeight;
|
||||
if (
|
||||
scrollTop + clientHeight >= scrollHeight &&
|
||||
!this.scrollDisabled
|
||||
) {
|
||||
this.goodsParmas.page++;
|
||||
this.getProductGoodList();
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
async initData() {
|
||||
// 获取一级分类
|
||||
await productGroupFirst().then((res) => {
|
||||
this.first_group_list = res.data.data.list;
|
||||
});
|
||||
if (this.first_group_list[0]) {
|
||||
this.select_first_obj.id =
|
||||
this.fpg_id || this.first_group_list[0].id;
|
||||
this.secondLoading = true;
|
||||
// 获取二级分类
|
||||
await productGroupSecond(this.select_first_obj.id).then((ress) => {
|
||||
this.second_group_list = ress.data.data.list;
|
||||
});
|
||||
if (this.second_group_list[0]) {
|
||||
this.select_second_obj.id =
|
||||
this.spg_id || this.second_group_list[0].id;
|
||||
const selectItem = this.second_group_list.find(
|
||||
(item) => item.id === this.select_second_obj.id
|
||||
);
|
||||
this.select_second_obj.type = selectItem?.type;
|
||||
this.select_second_obj.description = selectItem?.description;
|
||||
this.goodsParmas.page = 1;
|
||||
this.goodsParmas.id = this.spg_id || this.second_group_list[0].id;
|
||||
this.secondLoading = false;
|
||||
if (this.select_second_obj.type === "domain") {
|
||||
this.getSuffix();
|
||||
}
|
||||
this.getProductGoodList();
|
||||
} else {
|
||||
this.goodSLoading = false;
|
||||
this.goodsList = [];
|
||||
}
|
||||
} else {
|
||||
this.goodSLoading = false;
|
||||
this.goodsList = [];
|
||||
}
|
||||
},
|
||||
// 点击一级分类
|
||||
selectFirstType(val) {
|
||||
this.select_first_obj.id = val;
|
||||
this.secondLoading = true;
|
||||
this.goodsParmas.page = 1;
|
||||
this.second_group_list = [];
|
||||
this.select_second_obj = {
|
||||
id: "",
|
||||
type: "",
|
||||
description: "",
|
||||
};
|
||||
this.getProductGroup_second(val);
|
||||
this.goodsList = [];
|
||||
},
|
||||
// 点击二级分类
|
||||
selectSecondType(val) {
|
||||
this.select_second_obj.id = val;
|
||||
const clickItem = this.second_group_list.find((item) => {
|
||||
return item.id === val;
|
||||
});
|
||||
this.select_second_obj.type = clickItem?.type;
|
||||
this.select_second_obj.description = clickItem?.description;
|
||||
this.goodsList = [];
|
||||
this.goodsParmas.page = 1;
|
||||
this.goodsParmas.id = val;
|
||||
if (this.select_second_obj.type === "domain") {
|
||||
this.getSuffix();
|
||||
}
|
||||
this.getProductGoodList();
|
||||
},
|
||||
// 获取通用配置
|
||||
getCommonData() {
|
||||
getCommon().then((res) => {
|
||||
this.commonData = res.data.data;
|
||||
localStorage.setItem(
|
||||
"common_set_before",
|
||||
JSON.stringify(res.data.data)
|
||||
);
|
||||
document.title =
|
||||
this.commonData.website_name + "-" + lang.common_cloud_text301;
|
||||
});
|
||||
},
|
||||
// 点击购买
|
||||
goOrder(item) {
|
||||
if (
|
||||
Boolean(
|
||||
(JSON.parse(localStorage.getItem("common_set_before")) || {})
|
||||
.custom_fields?.before_settle === 1
|
||||
)
|
||||
) {
|
||||
window.open("/account.htm");
|
||||
return;
|
||||
}
|
||||
// 新窗口打开
|
||||
window.open(`goods.htm?id=${item.id}`);
|
||||
},
|
||||
// 滚动计算
|
||||
scrollBottom() {
|
||||
if (this.select_second_obj.type === "domain") {
|
||||
return;
|
||||
}
|
||||
const scrollTop =
|
||||
document.documentElement.scrollTop || document.body.scrollTop;
|
||||
const clientHeight = document.documentElement.clientHeight;
|
||||
const scrollHeight = document.documentElement.scrollHeight;
|
||||
if (scrollTop + clientHeight >= scrollHeight) {
|
||||
if (this.scrollDisabled) {
|
||||
} else {
|
||||
this.goodsParmas.page++;
|
||||
this.getProductGoodList();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
"select_first_obj.id": function (val) {
|
||||
// 更改url 中fpg_id 和 spg_id 参数
|
||||
const url = window.location.href;
|
||||
// 拿到当前url中的参数
|
||||
const params = new URLSearchParams(url.split("?")[1]);
|
||||
// 改变参数
|
||||
params.set("fpg_id", val);
|
||||
// 重新组装url
|
||||
const newUrl = `${url.split("?")[0]}?${params.toString()}`;
|
||||
// 替换当前url
|
||||
window.history.replaceState({}, "", newUrl);
|
||||
},
|
||||
"select_second_obj.id": function (val) {
|
||||
// 更改url 中fpg_id 和 spg_id 参数
|
||||
const url = window.location.href;
|
||||
// 拿到当前url中的参数
|
||||
const params = new URLSearchParams(url.split("?")[1]);
|
||||
// 改变参数
|
||||
params.set("spg_id", val);
|
||||
// 重新组装url
|
||||
const newUrl = `${url.split("?")[0]}?${params.toString()}`;
|
||||
// 替换当前url
|
||||
window.history.replaceState({}, "", newUrl);
|
||||
},
|
||||
},
|
||||
}).$mount(template);
|
||||
typeof old_onload == "function" && old_onload();
|
||||
};
|
||||
})(window);
|
||||
367
clientarea/cart/hgcart/js/settlement.js
Normal file
367
clientarea/cart/hgcart/js/settlement.js
Normal file
@@ -0,0 +1,367 @@
|
||||
(function (window, undefined) {
|
||||
var old_onload = window.onload;
|
||||
window.onload = function () {
|
||||
const template = document.getElementsByClassName("template")[0];
|
||||
Vue.prototype.lang = window.lang;
|
||||
const host = location.host;
|
||||
const fir = location.pathname.split("/")[1];
|
||||
const str = `${host}/${fir}/`;
|
||||
new Vue({
|
||||
components: {
|
||||
asideMenu,
|
||||
topMenu,
|
||||
payDialog,
|
||||
eventCode,
|
||||
},
|
||||
created() {
|
||||
localStorage.frontMenusActiveId = "";
|
||||
const temp = this.getQuery(location.search);
|
||||
if (temp.cart) {
|
||||
// 购物车过来
|
||||
this.selectGoodsList = JSON.parse(sessionStorage.shoppingCartList);
|
||||
this.isFormShoppingCart = true;
|
||||
} else {
|
||||
const obj = sessionStorage.product_information
|
||||
? JSON.parse(sessionStorage.product_information)
|
||||
: sessionStorage.settleItem
|
||||
? JSON.parse(sessionStorage.settleItem)
|
||||
: {};
|
||||
sessionStorage.settleItem = sessionStorage.product_information;
|
||||
sessionStorage.removeItem("product_information");
|
||||
this.isFormShoppingCart = false;
|
||||
this.productObj = {
|
||||
product_id: temp.id ? temp.id : obj.id ? obj.id : "",
|
||||
config_options: obj.config_options,
|
||||
qty: Number(obj.qty),
|
||||
customfield: obj.customfield,
|
||||
self_defined_field: obj.self_defined_field,
|
||||
};
|
||||
productDetail(this.productObj.product_id).then((res) => {
|
||||
this.productObj.name = res.data.data.product.name;
|
||||
});
|
||||
}
|
||||
this.getCommonData();
|
||||
// this.getPayLisy();
|
||||
},
|
||||
mounted() {
|
||||
this.addons_js_arr = JSON.parse(
|
||||
document.querySelector("#addons_js").getAttribute("addons_js")
|
||||
); // 插件列表
|
||||
const arr = this.addons_js_arr.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
if (arr.includes("PromoCode")) {
|
||||
// 开启了优惠码插件
|
||||
this.isShowPromo = true;
|
||||
}
|
||||
if (arr.includes("IdcsmartClientLevel")) {
|
||||
// 开启了等级优惠
|
||||
this.isShowLevel = true;
|
||||
}
|
||||
if (arr.includes("EventPromotion")) {
|
||||
// 开启活动满减
|
||||
this.isShowFull = true;
|
||||
}
|
||||
this.getCartList();
|
||||
},
|
||||
updated() {
|
||||
// 关闭loading
|
||||
document.getElementById("mainLoading").style.display = "none";
|
||||
document.getElementsByClassName("template")[0].style.display = "block";
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
initArr: [],
|
||||
commonData: {}, // 公告接口数据
|
||||
addons_js_arr: [],
|
||||
showPayBtn: false,
|
||||
|
||||
totalPriceLoading: false,
|
||||
|
||||
goodIdList: [],
|
||||
isUseDiscountCode: false,
|
||||
productObj: {
|
||||
customfield: {},
|
||||
}, // 单独结算的商品对象
|
||||
shoppingList: [], // 所有购物车列表
|
||||
listLoading: false,
|
||||
selectGoodsList: [],
|
||||
isFormShoppingCart: true, // 是否从购物车页面结算
|
||||
showGoodsList: [], // 展示的列表
|
||||
payTypeList: [], // 支付渠道数组
|
||||
payType: "", // 选择的支付渠道
|
||||
checked: false, // 勾选隐私协议
|
||||
isShowPromo: false, // 是否开启优惠码
|
||||
isShowLevel: false, // 是否开启等级优惠
|
||||
isShowFull: false,
|
||||
subBtnLoading: false, // 提交按钮loading
|
||||
};
|
||||
},
|
||||
|
||||
filters: {
|
||||
formateTime(time) {
|
||||
if (time && time !== 0) {
|
||||
return formateDate(time * 1000);
|
||||
} else {
|
||||
return "--";
|
||||
}
|
||||
},
|
||||
filterMoney(money) {
|
||||
if (isNaN(money) || money * 1 < 0) {
|
||||
return "0.00";
|
||||
} else {
|
||||
return formatNuberFiexd(money);
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
finallyPrice() {
|
||||
return this.totalPrice;
|
||||
},
|
||||
totalLevelDiscount() {
|
||||
return formatNuberFiexd(
|
||||
this.showGoodsList.reduce((pre, cur) => {
|
||||
return pre + cur.level_discount * 1;
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
totalPrice() {
|
||||
return formatNuberFiexd(
|
||||
this.showGoodsList.reduce((pre, cur) => {
|
||||
return pre + cur.calcItemPrice * 1;
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
orginPrice() {
|
||||
return formatNuberFiexd(
|
||||
this.showGoodsList.reduce((pre, cur) => {
|
||||
return pre + cur.price * 1;
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
totalCodelDiscount() {
|
||||
return formatNuberFiexd(
|
||||
this.showGoodsList.reduce((pre, cur) => {
|
||||
return pre + cur.code_discount * 1;
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
totalFullDiscount() {
|
||||
return formatNuberFiexd(
|
||||
this.showGoodsList.reduce((pre, cur) => {
|
||||
return pre + cur.eventDiscount * 1;
|
||||
}, 0)
|
||||
);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getRule(arr) {
|
||||
let isHave = this.showFun(arr, "PayController::pay");
|
||||
if (isHave) {
|
||||
this.showPayBtn = true;
|
||||
}
|
||||
},
|
||||
showFun(arr, str) {
|
||||
if (typeof arr == "string") {
|
||||
return true;
|
||||
} else {
|
||||
let isShow = "";
|
||||
isShow = arr.find((item) => {
|
||||
let isHave = item.includes(str);
|
||||
if (isHave) {
|
||||
return isHave;
|
||||
}
|
||||
});
|
||||
return isShow;
|
||||
}
|
||||
},
|
||||
// 获取购物车列表
|
||||
async getCartList() {
|
||||
this.listLoading = true;
|
||||
this.initArr = [];
|
||||
if (this.isFormShoppingCart) {
|
||||
// 从购物车结算
|
||||
await cartList().then((res) => {
|
||||
this.shoppingList = res.data.data.list;
|
||||
this.selectGoodsList.forEach((item) => {
|
||||
const obj = this.shoppingList[item];
|
||||
this.initArr.push(obj);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// 从商品详情结算
|
||||
this.initArr.push(this.productObj);
|
||||
}
|
||||
|
||||
this.initArr.forEach((item) => {
|
||||
item.isLoading = true;
|
||||
item.priceLoading = false;
|
||||
item.price = 0; // 商品单价
|
||||
item.code_discount = 0; // 商品优惠码抵扣金额
|
||||
item.isUseDiscountCode = false;
|
||||
item.level_discount = 0; // 商品等级优惠折扣金额
|
||||
item.eventDiscount = 0;
|
||||
item.calcItemPrice = 0;
|
||||
this.goodIdList.push(item.product_id);
|
||||
this.getConfigOption(item);
|
||||
});
|
||||
this.showGoodsList = [...this.initArr];
|
||||
this.listLoading = false;
|
||||
},
|
||||
// 获取商品配置项价格
|
||||
getConfigOption(item) {
|
||||
const params = {
|
||||
config_options: {
|
||||
...item.config_options,
|
||||
promo_code: item.customfield.promo_code,
|
||||
event_promotion: item.customfield.event_promotion,
|
||||
},
|
||||
qty: item.qty,
|
||||
};
|
||||
item.priceLoading = true;
|
||||
configOption(item.product_id, params)
|
||||
.then(async (res) => {
|
||||
item.info = res.data.data;
|
||||
const son_previews = [];
|
||||
if (res.data.data.other && res.data.data.other.son_previews) {
|
||||
res.data.data.other.son_previews.forEach((i) => {
|
||||
i.forEach((items) => {
|
||||
son_previews.push(items);
|
||||
});
|
||||
});
|
||||
}
|
||||
if (res.data.data.sub_host && res.data.data.sub_host.length > 0) {
|
||||
res.data.data.sub_host.forEach((i) => {
|
||||
i.preview.forEach((items) => {
|
||||
son_previews.push(items);
|
||||
});
|
||||
});
|
||||
}
|
||||
item.preview = res.data.data.preview.concat(son_previews);
|
||||
item.price = res.data.data.price * 1;
|
||||
item.calcItemPrice = res.data.data.price_total * 1;
|
||||
item.level_discount =
|
||||
res.data.data.price_client_level_discount * 1 || 0;
|
||||
item.code_discount =
|
||||
res.data.data.price_promo_code_discount * 1 || 0;
|
||||
item.eventDiscount =
|
||||
res.data.data.price_event_promotion_discount * 1 || 0;
|
||||
})
|
||||
.catch((err) => {
|
||||
item.preview = [];
|
||||
})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
item.isLoading = false;
|
||||
this.showGoodsList = [...this.initArr];
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
|
||||
goPay() {
|
||||
if (!this.checked) {
|
||||
this.$message.warning(lang.shoppingCar_tip_text6);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
Boolean(
|
||||
(JSON.parse(localStorage.getItem("common_set_before")) || {})
|
||||
.custom_fields?.before_settle === 1
|
||||
)
|
||||
) {
|
||||
window.open("/account.htm");
|
||||
return;
|
||||
}
|
||||
this.subBtnLoading = true;
|
||||
const settleApi = this.isFormShoppingCart
|
||||
? cart_settle
|
||||
: product_settle;
|
||||
const params = this.isFormShoppingCart
|
||||
? {
|
||||
positions: this.selectGoodsList,
|
||||
}
|
||||
: {
|
||||
product_id: this.productObj.product_id,
|
||||
config_options: this.productObj.config_options,
|
||||
customfield: this.productObj.customfield,
|
||||
self_defined_field: this.productObj.self_defined_field,
|
||||
qty: this.productObj.qty,
|
||||
};
|
||||
settleApi(params)
|
||||
.then((res) => {
|
||||
this.$refs.payDialog.showPayDialog(
|
||||
res.data.data.order_id,
|
||||
res.data.data.amount,
|
||||
this.payType
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.data?.data?.certification === 0) {
|
||||
this.$message.error({
|
||||
duration: 0,
|
||||
showClose: true,
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: `${err.data.msg}
|
||||
<a style="margin-left:5px;" target="_blank" href="/plugin/${getPluginId(
|
||||
"IdcsmartCertification"
|
||||
)}/authentication_select.htm">${lang.wx_tip7}</a>
|
||||
`,
|
||||
type: "error",
|
||||
});
|
||||
} else {
|
||||
this.$message.error(err.data.msg);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.subBtnLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
// 支付成功回调
|
||||
paySuccess(e) {
|
||||
location.href = "/finance.htm";
|
||||
},
|
||||
// 取消支付回调
|
||||
payCancel(e) {
|
||||
location.href = "/finance.htm";
|
||||
},
|
||||
getPayLisy() {
|
||||
payLisy().then((res) => {
|
||||
this.payTypeList = res.data.data.list;
|
||||
this.payType = res.data.data.list[0].name;
|
||||
});
|
||||
},
|
||||
// 解析url
|
||||
getQuery(url) {
|
||||
const str = url.substr(url.indexOf("?") + 1);
|
||||
const arr = str.split("&");
|
||||
const res = {};
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const item = arr[i].split("=");
|
||||
res[item[0]] = item[1];
|
||||
}
|
||||
return res;
|
||||
},
|
||||
goTermsServiceUrl() {
|
||||
window.open(this.commonData.terms_service_url);
|
||||
},
|
||||
goTermsPrivacUrl() {
|
||||
window.open(this.commonData.terms_privacy_url);
|
||||
},
|
||||
goHelpUrl(url) {
|
||||
window.open(this.commonData[url]);
|
||||
},
|
||||
|
||||
// 获取通用配置
|
||||
getCommonData() {
|
||||
this.commonData = JSON.parse(
|
||||
localStorage.getItem("common_set_before")
|
||||
);
|
||||
document.title =
|
||||
this.commonData.website_name + "-" + lang.shoppingCar_tip_text7;
|
||||
},
|
||||
},
|
||||
}).$mount(template);
|
||||
typeof old_onload == "function" && old_onload();
|
||||
};
|
||||
})(window);
|
||||
510
clientarea/cart/hgcart/js/shoppingCar.js
Normal file
510
clientarea/cart/hgcart/js/shoppingCar.js
Normal file
@@ -0,0 +1,510 @@
|
||||
(function (window, undefined) {
|
||||
var old_onload = window.onload;
|
||||
window.onload = function () {
|
||||
const template = document.getElementsByClassName("template")[0];
|
||||
Vue.prototype.lang = window.lang;
|
||||
new Vue({
|
||||
components: {
|
||||
asideMenu,
|
||||
topMenu,
|
||||
discountCode,
|
||||
eventCode,
|
||||
},
|
||||
created() {
|
||||
localStorage.frontMenusActiveId = "";
|
||||
this.getCommonData();
|
||||
},
|
||||
mounted() {
|
||||
this.addons_js_arr = JSON.parse(
|
||||
document.querySelector("#addons_js").getAttribute("addons_js")
|
||||
); // 插件列表
|
||||
const arr = this.addons_js_arr.map((item) => {
|
||||
return item.name;
|
||||
});
|
||||
if (arr.includes("PromoCode")) {
|
||||
// 开启了优惠码插件
|
||||
this.isShowPromo = true;
|
||||
}
|
||||
if (arr.includes("IdcsmartClientLevel")) {
|
||||
// 开启了等级优惠
|
||||
this.isShowLevel = true;
|
||||
}
|
||||
if (arr.includes("EventPromotion")) {
|
||||
// 开启活动满减
|
||||
this.isShowFull = true;
|
||||
}
|
||||
this.getCartList();
|
||||
},
|
||||
updated() {
|
||||
// 关闭loading
|
||||
document.getElementById("mainLoading").style.display = "none";
|
||||
document.getElementsByClassName("template")[0].style.display = "block";
|
||||
},
|
||||
destroyed() { },
|
||||
data() {
|
||||
return {
|
||||
timer1: null,
|
||||
listLoding: false,
|
||||
commonData: {},
|
||||
searchVal: "",
|
||||
checkedCities: [],
|
||||
checkAll: false, // 是否全选
|
||||
visible: false,
|
||||
showList: [],
|
||||
addons_js_arr: [], // 插件列表
|
||||
shoppingList: [],
|
||||
isShowPromo: false, // 是否开启优惠码
|
||||
isShowLevel: false, // 是否开启等级优惠
|
||||
isShowFull: false, // 是否开启满减优惠
|
||||
settleLoading: false,
|
||||
};
|
||||
},
|
||||
|
||||
filters: {
|
||||
formateTime(time) {
|
||||
if (time && time !== 0) {
|
||||
return formateDate(time * 1000);
|
||||
} else {
|
||||
return "--";
|
||||
}
|
||||
},
|
||||
filterMoney(money) {
|
||||
if (isNaN(money) || money * 1 < 0) {
|
||||
return "0.00";
|
||||
} else {
|
||||
return formatNuberFiexd(money);
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
totalPrice() {
|
||||
return this.showList
|
||||
.filter((item) => {
|
||||
return this.checkedCities.includes(item.position);
|
||||
})
|
||||
.reduce((pre, cur) => {
|
||||
return pre + cur.calcItemPrice * 1;
|
||||
}, 0);
|
||||
},
|
||||
nowList() {
|
||||
if (this.searchVal !== "") {
|
||||
return this.showList.filter((item) =>
|
||||
item.name.includes(this.searchVal)
|
||||
);
|
||||
} else {
|
||||
return this.showList;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 获取购物车列表
|
||||
getCartList() {
|
||||
this.listLoding = true;
|
||||
cartList()
|
||||
.then((res) => {
|
||||
this.shoppingList = res.data.data.list.map((item, index) => {
|
||||
item.price = 0; // 商品单价
|
||||
item.calcItemPrice = 0;
|
||||
item.code_discount = 0; // 商品优惠码抵扣金额
|
||||
item.level_discount = 0; // 商品等级优惠折扣金额
|
||||
item.eventDiscount = 0; // 商品活动优惠金额
|
||||
item.isUseDiscountCode = false; // 商品是否使用优惠码
|
||||
item.position = index; // 商品所在购物车位置
|
||||
item.isShowTips = false; // 是否提示商品库存不足
|
||||
item.priceLoading = true; // 商品价格loading
|
||||
if (item.stock_control === 1 && item.qty > item.stock_qty) {
|
||||
item.isShowTips = true;
|
||||
item.qty = item.stock_qty;
|
||||
}
|
||||
item.isLoading = true; // 商品loading
|
||||
return item;
|
||||
});
|
||||
const arr = this.shoppingList.filter((arritem) => {
|
||||
return arritem.customfield?.is_domain !== 1;
|
||||
});
|
||||
this.listLoding = false;
|
||||
this.showList = [...arr];
|
||||
this.showList.forEach((item) => {
|
||||
this.getConfigOption(item);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
this.listLoding = false;
|
||||
});
|
||||
},
|
||||
// 获取商品配置项价格
|
||||
getConfigOption(item) {
|
||||
const params = {
|
||||
config_options: {
|
||||
...item.config_options,
|
||||
promo_code: item.customfield.promo_code,
|
||||
event_promotion: item.customfield.event_promotion,
|
||||
},
|
||||
qty: item.qty,
|
||||
};
|
||||
item.priceLoading = true;
|
||||
configOption(item.product_id, params)
|
||||
.then(async (res) => {
|
||||
item.info = res.data.data;
|
||||
const son_previews = [];
|
||||
if (res.data.data.other && res.data.data.other.son_previews) {
|
||||
res.data.data.other.son_previews.forEach((i) => {
|
||||
i.forEach((items) => {
|
||||
son_previews.push(items);
|
||||
});
|
||||
});
|
||||
}
|
||||
if (res.data.data.sub_host && res.data.data.sub_host.length > 0) {
|
||||
res.data.data.sub_host.forEach((i) => {
|
||||
i.preview.forEach((items) => {
|
||||
son_previews.push(items);
|
||||
});
|
||||
});
|
||||
}
|
||||
item.preview = res.data.data.preview.concat(son_previews);
|
||||
item.price = res.data.data.price * 1;
|
||||
item.base_price = res.data.data.base_price * 1;
|
||||
item.calcItemPrice = res.data.data.price_total * 1;
|
||||
item.level_discount =
|
||||
res.data.data.price_client_level_discount * 1 || 0;
|
||||
item.code_discount =
|
||||
res.data.data.price_promo_code_discount * 1 || 0;
|
||||
item.eventDiscount =
|
||||
res.data.data.price_event_promotion_discount * 1 || 0;
|
||||
})
|
||||
.catch((err) => {
|
||||
item.preview = [];
|
||||
})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
item.isLoading = false;
|
||||
this.showList = [...this.showList];
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
// 更改活动
|
||||
changeEventCode(priceObj, item) {
|
||||
if (item.customfield.event_promotion == priceObj.id) {
|
||||
return;
|
||||
}
|
||||
item.customfield.event_promotion = priceObj.id;
|
||||
const params = {
|
||||
position: item.position,
|
||||
product_id: item.product_id,
|
||||
config_options: item.config_options, // 配置信息
|
||||
qty: item.qty, // 商品数量
|
||||
customfield: item.customfield,
|
||||
self_defined_field: item.self_defined_field,
|
||||
};
|
||||
updateCart(params).then((res) => {
|
||||
this.getConfigOption(item);
|
||||
});
|
||||
},
|
||||
// 使用优惠码
|
||||
getDiscount(data) {
|
||||
this.showList.forEach((item) => {
|
||||
if (item.position === data[2]) {
|
||||
item.customfield.promo_code = data[1];
|
||||
item.isUseDiscountCode = true;
|
||||
const params = {
|
||||
position: data[2],
|
||||
product_id: item.product_id,
|
||||
config_options: item.config_options, // 配置信息
|
||||
qty: item.qty, // 商品数量
|
||||
customfield: item.customfield,
|
||||
self_defined_field: item.self_defined_field,
|
||||
};
|
||||
updateCart(params).then((res) => {
|
||||
this.getConfigOption(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除优惠码
|
||||
removeDiscountCode(item) {
|
||||
item.customfield.promo_code = "";
|
||||
item.isUseDiscountCode = false;
|
||||
let i;
|
||||
this.showList.forEach((items, index) => {
|
||||
if (items.position === item.position) {
|
||||
i = index;
|
||||
}
|
||||
});
|
||||
const params = {
|
||||
position: i,
|
||||
product_id: item.product_id,
|
||||
config_options: item.config_options, // 配置信息
|
||||
qty: item.qty, // 商品数量
|
||||
customfield: item.customfield,
|
||||
self_defined_field: item.self_defined_field,
|
||||
};
|
||||
updateCart(params).then((res) => {
|
||||
this.getConfigOption(item);
|
||||
});
|
||||
},
|
||||
// 搜索
|
||||
searchValChange(value) {
|
||||
this.checkedCities = [];
|
||||
this.checkAll = false;
|
||||
},
|
||||
// 点击全选按钮
|
||||
handleCheckAllChange(val) {
|
||||
const arr = this.showList.filter((item) => {
|
||||
return item.info;
|
||||
});
|
||||
const arrr = arr.map((item) => {
|
||||
return item.position;
|
||||
});
|
||||
this.checkedCities = val ? arrr : [];
|
||||
},
|
||||
// 编辑商品数量
|
||||
handelEditGoodsNum(index, num) {
|
||||
return editGoodsNum(index, num);
|
||||
},
|
||||
// 编辑商品
|
||||
goGoods(item) {
|
||||
if (item.info) {
|
||||
const obj = {
|
||||
config_options: item.config_options, // 配置信息
|
||||
position: item.position, // 修改接口要用的位置信息
|
||||
qty: item.qty, // 商品数量
|
||||
customfield: item.customfield,
|
||||
self_defined_field: item.self_defined_field,
|
||||
};
|
||||
sessionStorage.setItem("product_information", JSON.stringify(obj));
|
||||
}
|
||||
location.href = `goods.htm?id=${item.product_id}&change=true&name=${item.name}`;
|
||||
},
|
||||
// 监听购物车选择数量变化
|
||||
handleCheckedCitiesChange(value) {
|
||||
this.checkAll = value.length === this.showList.length;
|
||||
},
|
||||
// 删除商品函数
|
||||
deleteGoodsList(arr) {
|
||||
deleteGoods(arr)
|
||||
.then((res) => {
|
||||
if (res.data.status === 200) {
|
||||
this.$message.success(res.data.msg);
|
||||
this.getCartList();
|
||||
this.$refs.topMenu.getCartList();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
err.data.msg && this.$message.error(err.data.msg);
|
||||
})
|
||||
.finally(() => { });
|
||||
},
|
||||
// 点击删除按钮
|
||||
handelDeleteGoods(item) {
|
||||
// 调用删除接口
|
||||
const p = item.position;
|
||||
let shoppingList_index = 0;
|
||||
let checkedCities_index = 0;
|
||||
let show_index = 0;
|
||||
// 删除列表中对应的商品
|
||||
this.shoppingList.forEach((listItem, index) => {
|
||||
if (listItem.position === p) {
|
||||
shoppingList_index = index;
|
||||
}
|
||||
});
|
||||
this.checkedCities.forEach((listItem, index) => {
|
||||
if (listItem === p) {
|
||||
checkedCities_index = index;
|
||||
}
|
||||
});
|
||||
this.showList.forEach((listItem, index) => {
|
||||
if (listItem === p) {
|
||||
show_index = index;
|
||||
}
|
||||
});
|
||||
this.showList.splice(show_index, 1);
|
||||
this.checkedCities.splice(checkedCities_index, 1);
|
||||
this.deleteGoodsList([item.position]);
|
||||
},
|
||||
// 删除选中的商品
|
||||
deleteCheckGoods() {
|
||||
if (this.checkedCities.length === 0) {
|
||||
this.$message.warning(lang.referral_status9);
|
||||
return;
|
||||
} else {
|
||||
this.deleteGoodsList(this.checkedCities);
|
||||
this.checkedCities = [];
|
||||
}
|
||||
},
|
||||
// 商品数量增加减少
|
||||
handleChange(n, o, item) {
|
||||
if (item.stock_control === 1 && n >= item.stock_qty) {
|
||||
this.$message.error(lang.referral_status10);
|
||||
return;
|
||||
}
|
||||
// 节个流
|
||||
if (this.timer1) {
|
||||
clearTimeout(this.timer1);
|
||||
this.timer1 = null;
|
||||
}
|
||||
item.priceLoading = true;
|
||||
|
||||
this.timer1 = setTimeout(() => {
|
||||
this.handelEditGoodsNum(item.position, n)
|
||||
.then(async () => {
|
||||
this.getConfigOption(item);
|
||||
})
|
||||
.catch((err) => {
|
||||
err.data.msg && this.$message.error(err.data.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
item.priceLoading = false;
|
||||
clearTimeout(this.timer1);
|
||||
this.timer1 = null;
|
||||
});
|
||||
this.syncBindTool(item);
|
||||
}, 500);
|
||||
},
|
||||
// 同步绑定工具函数
|
||||
syncBindTool(item) {
|
||||
if (
|
||||
item.customfield.product_related_limit &&
|
||||
item.customfield.product_related_limit?.related.length > 0
|
||||
) {
|
||||
const arr = item.customfield.product_related_limit.related || [];
|
||||
// 循环判断是否有关联商品
|
||||
// 过滤出关联商品
|
||||
const relatedList = this.showList.filter((items) => {
|
||||
return (
|
||||
arr.includes(items.product_id * 1) ||
|
||||
arr.includes(String(items.product_id))
|
||||
);
|
||||
});
|
||||
// 过滤出和当前商品ID一样的列表
|
||||
const someList = this.showList.filter((items) => {
|
||||
return items.product_id == item.product_id;
|
||||
});
|
||||
// 对比关联商品和当前商品的数量
|
||||
const relatedNum = relatedList.reduce((pre, cur) => {
|
||||
return pre + cur.qty;
|
||||
}, 0);
|
||||
const someNum = someList.reduce((pre, cur) => {
|
||||
return pre + cur.qty;
|
||||
}, 0);
|
||||
if (relatedNum != someNum && relatedNum !== 0) {
|
||||
if (someNum > relatedNum) {
|
||||
// 如果关联商品数量小于当前商品数量 给筛选出来的关联商品加1
|
||||
this.handelEditGoodsNum(
|
||||
relatedList[0].position,
|
||||
relatedList[0].qty + (someNum - relatedNum)
|
||||
).then(async () => {
|
||||
this.showList.forEach((items) => {
|
||||
if (items.position == relatedList[0].position) {
|
||||
items.qty = relatedList[0].qty + (someNum - relatedNum);
|
||||
this.getConfigOption(items);
|
||||
this.$forceUpdate();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// 如果关联商品数量大于当前商品数量 给当前商品加1
|
||||
this.handelEditGoodsNum(
|
||||
relatedList[0].position,
|
||||
relatedList[0].qty > relatedNum - someNum
|
||||
? relatedList[0].qty - (relatedNum - someNum)
|
||||
: 1
|
||||
).then(async () => {
|
||||
this.showList.forEach((items) => {
|
||||
if (items.position == relatedList[0].position) {
|
||||
items.qty =
|
||||
relatedList[0].qty > relatedNum - someNum
|
||||
? relatedList[0].qty - (relatedNum - someNum)
|
||||
: 1;
|
||||
this.getConfigOption(items);
|
||||
this.$forceUpdate();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
checkBindFun(selctedArr) {
|
||||
let flag = true;
|
||||
selctedArr.forEach((item) => {
|
||||
if (
|
||||
item.customfield.product_related_limit &&
|
||||
item.customfield.product_related_limit?.related.length > 0
|
||||
) {
|
||||
const arr = item.customfield.product_related_limit.related || [];
|
||||
// 循环判断是否有关联商品
|
||||
// 过滤出关联商品
|
||||
const relatedList = selctedArr.filter((items) => {
|
||||
return (
|
||||
arr.includes(items.product_id * 1) ||
|
||||
arr.includes(String(items.product_id))
|
||||
);
|
||||
});
|
||||
// 过滤出和当前商品ID一样的列表
|
||||
const someList = selctedArr.filter((items) => {
|
||||
return items.product_id == item.product_id;
|
||||
});
|
||||
// 对比关联商品和当前商品的数量
|
||||
const relatedNum = relatedList.reduce((pre, cur) => {
|
||||
return pre + cur.qty;
|
||||
}, 0);
|
||||
const someNum = someList.reduce((pre, cur) => {
|
||||
return pre + cur.qty;
|
||||
}, 0);
|
||||
if (relatedNum != someNum) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
return flag;
|
||||
},
|
||||
// 结算
|
||||
goSettle() {
|
||||
// 判断是否需要先设置账户,如果需要则跳转到设置账户页面
|
||||
if (
|
||||
Boolean(
|
||||
(JSON.parse(localStorage.getItem("common_set_before")) || {})
|
||||
.custom_fields?.before_settle === 1
|
||||
)
|
||||
) {
|
||||
window.open("/account.htm");
|
||||
return;
|
||||
}
|
||||
if (this.checkedCities.length === 0) {
|
||||
this.$message.warning(lang.referral_status11);
|
||||
return;
|
||||
}
|
||||
const arr = []; // 装的是被选中的商品在购物位置的索引
|
||||
this.showList.forEach((item) => {
|
||||
this.checkedCities.forEach((items) => {
|
||||
if (items == item.position) {
|
||||
arr.push(item);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!this.checkBindFun(arr)) {
|
||||
this.$message.warning(lang.cart_tip_text14);
|
||||
return;
|
||||
}
|
||||
this.settleLoading = true;
|
||||
sessionStorage.shoppingCartList = JSON.stringify(this.checkedCities);
|
||||
setTimeout(() => {
|
||||
location.href = `/cart/settlement.htm?cart=1`;
|
||||
this.settleLoading = false;
|
||||
}, 500);
|
||||
},
|
||||
|
||||
// 获取通用配置
|
||||
getCommonData() {
|
||||
this.commonData = JSON.parse(
|
||||
localStorage.getItem("common_set_before")
|
||||
);
|
||||
document.title =
|
||||
this.commonData.website_name + "-" + lang.shoppingCar_title;
|
||||
},
|
||||
},
|
||||
}).$mount(template);
|
||||
typeof old_onload == "function" && old_onload();
|
||||
};
|
||||
})(window);
|
||||
Reference in New Issue
Block a user