增加新功能
This commit is contained in:
+58
-65
@@ -16,20 +16,7 @@ const _sfc_main = {
|
||||
specificationShow: false,
|
||||
specificationShowType: "",
|
||||
// 弹框类型
|
||||
orderInfo: {
|
||||
id: 1,
|
||||
url: "/static/common/product_def.png",
|
||||
price: 87,
|
||||
oPrice: 199,
|
||||
couponPrice: 50,
|
||||
inventory: 100,
|
||||
// 库存
|
||||
quantity: 1,
|
||||
addressObj: {
|
||||
name: "李个",
|
||||
address: "郑州市金水区东风路街道白庙小区五号楼"
|
||||
}
|
||||
},
|
||||
orderInfo: {},
|
||||
specificationList: [],
|
||||
//规格
|
||||
selectSpecification: [],
|
||||
@@ -55,16 +42,21 @@ const _sfc_main = {
|
||||
// 返回的页面数,默认为1,返回到上一级
|
||||
});
|
||||
},
|
||||
jumpHome() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/home/home"
|
||||
});
|
||||
},
|
||||
// 分享
|
||||
jumpShare() {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/invite_friends/invite_friends"
|
||||
});
|
||||
jumpOther(type) {
|
||||
if (type === "home") {
|
||||
common_vendor.index.switchTab({
|
||||
// 首页
|
||||
url: "/pages/home/home"
|
||||
});
|
||||
} else if (type === "share") {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/invite_friends/invite_friends"
|
||||
});
|
||||
} else if (type === "cart") {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/shopping_cart/shopping_cart"
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 查询详细内容
|
||||
@@ -83,12 +75,13 @@ const _sfc_main = {
|
||||
data.quantity = 1;
|
||||
data.inventory = 0;
|
||||
this.orderInfo = data;
|
||||
this.getSpecification(data.specs);
|
||||
}
|
||||
},
|
||||
checkSpecification(val, type) {
|
||||
async checkSpecification(val, type) {
|
||||
if (val) {
|
||||
this.querySpecification();
|
||||
await this.querySpecification();
|
||||
const data = this.orderInfo;
|
||||
this.getSpecification(data.specs);
|
||||
} else {
|
||||
this.specificationList = [];
|
||||
this.selectSpecification = [];
|
||||
@@ -99,12 +92,10 @@ const _sfc_main = {
|
||||
},
|
||||
// 拆解规格
|
||||
getSpecification(specs) {
|
||||
common_vendor.index.__f__("log", "at pages/productInfo/productInfo.vue:296", "specs", specs);
|
||||
const optionArr = [];
|
||||
if (specs) {
|
||||
const arr = JSON.parse(specs);
|
||||
arr.map((item) => {
|
||||
common_vendor.index.__f__("log", "at pages/productInfo/productInfo.vue:301", "item", item);
|
||||
optionArr.push({
|
||||
type: item.type,
|
||||
items: item.items,
|
||||
@@ -173,18 +164,14 @@ const _sfc_main = {
|
||||
}
|
||||
this.orderInfo.quantity = currentQuantity;
|
||||
},
|
||||
/**
|
||||
* 立即购买,确定订单页面
|
||||
*/
|
||||
// 立即购买,确定订单页面
|
||||
byFun() {
|
||||
this.addCart();
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/order_submit/order_submit"
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 加入购入车
|
||||
*/
|
||||
// 加入购入车
|
||||
async addCart() {
|
||||
const selectTempl = this.selectSpecificationTempl;
|
||||
if (!selectTempl || Object.keys(selectTempl).length === 0) {
|
||||
@@ -247,7 +234,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
height: "30",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
f: common_vendor.o($options.jumpShare),
|
||||
f: common_vendor.o(_ctx.jumpShare),
|
||||
g: common_vendor.p({
|
||||
src: "/static/common/share_st.png",
|
||||
width: "30",
|
||||
@@ -291,46 +278,53 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
v: $data.orderInfo.detailInfo,
|
||||
w: common_vendor.o($options.jumpHome),
|
||||
w: common_vendor.o(($event) => $options.jumpOther("home")),
|
||||
x: common_vendor.p({
|
||||
src: "/static/product/home.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
y: common_vendor.o($options.jumpShare),
|
||||
y: common_vendor.o(($event) => $options.jumpOther("share")),
|
||||
z: common_vendor.p({
|
||||
src: "/static/product/kefu.png",
|
||||
width: "20",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
A: common_vendor.o(($event) => $options.checkSpecification(true, "addCart")),
|
||||
B: common_vendor.o(($event) => $options.checkSpecification(true, "buy")),
|
||||
C: common_vendor.p({
|
||||
A: common_vendor.o(($event) => $options.jumpOther("cart")),
|
||||
B: common_vendor.p({
|
||||
src: "/static/product/cart.png",
|
||||
width: "24",
|
||||
height: "20",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
C: common_vendor.o(($event) => $options.checkSpecification(true, "addCart")),
|
||||
D: common_vendor.o(($event) => $options.checkSpecification(true, "buy")),
|
||||
E: common_vendor.p({
|
||||
src: $data.orderInfo.mainGraph,
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
}),
|
||||
D: $data.selectSpecificationTempl && Object.keys($data.selectSpecificationTempl).length !== 0
|
||||
F: $data.selectSpecificationTempl && Object.keys($data.selectSpecificationTempl).length !== 0
|
||||
}, $data.selectSpecificationTempl && Object.keys($data.selectSpecificationTempl).length !== 0 ? {
|
||||
E: common_vendor.t($data.selectSpecificationTempl.price)
|
||||
G: common_vendor.t($data.selectSpecificationTempl.price)
|
||||
} : {
|
||||
F: common_vendor.t($data.orderInfo.minPrice),
|
||||
G: common_vendor.t($data.orderInfo.maxPrice)
|
||||
H: common_vendor.t($data.orderInfo.minPrice),
|
||||
I: common_vendor.t($data.orderInfo.maxPrice)
|
||||
}, {
|
||||
H: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
|
||||
J: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
|
||||
}, $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0 ? {
|
||||
I: common_vendor.t($data.orderInfo.couponPrice)
|
||||
K: common_vendor.t($data.orderInfo.couponPrice)
|
||||
} : {}, {
|
||||
J: common_vendor.t($data.orderInfo.adPrice),
|
||||
K: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
|
||||
L: common_vendor.t($data.orderInfo.adPrice),
|
||||
M: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
|
||||
}, $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0 ? {
|
||||
L: common_vendor.t($data.orderInfo.couponPrice)
|
||||
N: common_vendor.t($data.orderInfo.couponPrice)
|
||||
} : {}, {
|
||||
M: common_vendor.t($data.orderInfo.inventory || 0),
|
||||
N: common_vendor.f($data.specificationList, (item, index, i0) => {
|
||||
O: common_vendor.t($data.orderInfo.inventory || 0),
|
||||
P: common_vendor.f($data.specificationList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.type),
|
||||
b: common_vendor.f(item.items, (oItem, oIndex, i1) => {
|
||||
@@ -344,26 +338,25 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
c: item.id
|
||||
};
|
||||
}),
|
||||
O: common_vendor.o(($event) => $options.quantityFun("minus")),
|
||||
P: common_vendor.t($data.orderInfo.quantity),
|
||||
Q: common_vendor.o(($event) => $options.quantityFun("add")),
|
||||
R: $data.specificationShowType === "buy"
|
||||
Q: common_vendor.o(($event) => $options.quantityFun("minus")),
|
||||
R: common_vendor.t($data.orderInfo.quantity),
|
||||
S: common_vendor.o(($event) => $options.quantityFun("add")),
|
||||
T: $data.specificationShowType === "buy"
|
||||
}, $data.specificationShowType === "buy" ? {
|
||||
S: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
|
||||
U: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
|
||||
} : $data.specificationShowType === "addCart" ? {
|
||||
U: common_vendor.o((...args) => $options.addCart && $options.addCart(...args))
|
||||
W: common_vendor.o((...args) => $options.addCart && $options.addCart(...args))
|
||||
} : {
|
||||
V: common_vendor.o((...args) => $options.addCart && $options.addCart(...args)),
|
||||
W: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
|
||||
X: common_vendor.o((...args) => $options.addCart && $options.addCart(...args)),
|
||||
Y: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
|
||||
}, {
|
||||
T: $data.specificationShowType === "addCart",
|
||||
X: common_vendor.o(($event) => $data.specificationShow = $event),
|
||||
Y: common_vendor.p({
|
||||
V: $data.specificationShowType === "addCart",
|
||||
Z: common_vendor.p({
|
||||
show: $data.specificationShow,
|
||||
round: 10,
|
||||
closeOnClickOverlay: false,
|
||||
closeable: true,
|
||||
mode: "bottom",
|
||||
show: $data.specificationShow
|
||||
mode: "bottom"
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user