Commit 4756f016 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-vue]: 样式微调

parent 36085337
...@@ -83,13 +83,13 @@ export default { ...@@ -83,13 +83,13 @@ export default {
goods: { goods: {
userHasCollect: 0, userHasCollect: 0,
info: { info: {
gallery:[] gallery: []
} }
}, },
sku: { sku: {
tree: [], tree: [],
list: [], list: [],
price: '1.00', // 默认价格(单位元) price: '1.00' // 默认价格(单位元)
}, },
skuGoods: { skuGoods: {
// 商品标题 // 商品标题
...@@ -109,8 +109,7 @@ export default { ...@@ -109,8 +109,7 @@ export default {
}; };
}, },
computed: {
computed: {
props_str() { props_str() {
let props_arr = []; let props_arr = [];
_.each(this.goods.attribute, json => { _.each(this.goods.attribute, json => {
...@@ -129,17 +128,14 @@ computed: { ...@@ -129,17 +128,14 @@ computed: {
this.showSku = true; this.showSku = true;
}, },
initData() { initData() {
goodsDetail({id: this.itemId}).then( goodsDetail({ id: this.itemId }).then(res => {
res => {
this.goods = res.data.data; this.goods = res.data.data;
this.skuAdapter(); this.skuAdapter();
} });
);
cartGoodsCount().then(res => { cartGoodsCount().then(res => {
this.cartInfo = res.data.data; this.cartInfo = res.data.data;
}); });
}, },
toCart() { toCart() {
this.$router.push({ this.$router.push({
...@@ -147,18 +143,16 @@ computed: { ...@@ -147,18 +143,16 @@ computed: {
}); });
}, },
addCollect() { addCollect() {
collectAddOrDelete({valueId: this.itemId, type: 0}).then(res => { collectAddOrDelete({ valueId: this.itemId, type: 0 }).then(res => {
if(this.goods.userHasCollect === 1){ if (this.goods.userHasCollect === 1) {
this.goods.userHasCollect = 0 this.goods.userHasCollect = 0;
} } else {
else{ this.goods.userHasCollect = 1;
this.goods.userHasCollect = 1
this.$toast({ this.$toast({
message: '收藏成功', message: '收藏成功',
duration: 1500 duration: 1500
}); });
} }
}); });
}, },
getProductId(s1, s2) { getProductId(s1, s2) {
...@@ -169,8 +163,7 @@ computed: { ...@@ -169,8 +163,7 @@ computed: {
_.each(specification.valueList, specValue => { _.each(specification.valueList, specValue => {
if (specValue.id === s1) { if (specValue.id === s1) {
s1_name = specValue.value; s1_name = specValue.value;
} } else if (specValue.id === s2) {
else if (specValue.id === s2) {
s2_name = specValue.value; s2_name = specValue.value;
} }
}); });
...@@ -216,16 +209,14 @@ computed: { ...@@ -216,16 +209,14 @@ computed: {
message: '目前仅支持两规格', message: '目前仅支持两规格',
duration: 1500 duration: 1500
}); });
return return;
} } else if (_.has(data.selectedSkuComb, 's2')) {
else if (_.has(data.selectedSkuComb, 's2')) {
params.productId = this.getProductId( params.productId = this.getProductId(
data.selectedSkuComb.s1, data.selectedSkuComb.s1,
data.selectedSkuComb.s2 data.selectedSkuComb.s2
); );
} } else {
else { params.productId = this.getProductIdByOne(data.selectedSkuComb.s1);
params.productId = this.getProductIdByOne(data.selectedSkuComb.s1)
} }
cartAdd(params).then(() => { cartAdd(params).then(() => {
this.cartInfo = this.cartInfo + data.selectedNum; this.cartInfo = this.cartInfo + data.selectedNum;
...@@ -248,22 +239,20 @@ computed: { ...@@ -248,22 +239,20 @@ computed: {
message: '目前仅支持两规格', message: '目前仅支持两规格',
duration: 1500 duration: 1500
}); });
return return;
} } else if (_.has(data.selectedSkuComb, 's2')) {
else if (_.has(data.selectedSkuComb, 's2')) {
params.productId = this.getProductId( params.productId = this.getProductId(
data.selectedSkuComb.s1, data.selectedSkuComb.s1,
data.selectedSkuComb.s2 data.selectedSkuComb.s2
); );
} } else {
else { params.productId = this.getProductIdByOne(data.selectedSkuComb.s1);
params.productId = this.getProductIdByOne(data.selectedSkuComb.s1)
} }
cartFastAdd(params).then(res => { cartFastAdd(params).then(res => {
let cartId = res.data.data; let cartId = res.data.data;
setLocalStorage({CartId: cartId}) setLocalStorage({ CartId: cartId });
that.showSku = false; that.showSku = false;
this.$router.push({ name: 'placeOrderEntity'}); this.$router.push({ name: 'placeOrderEntity' });
}); });
}, },
skuAdapter() { skuAdapter() {
...@@ -284,16 +273,16 @@ computed: { ...@@ -284,16 +273,16 @@ computed: {
this.skuGoods = { this.skuGoods = {
title: this.goods.info.name, title: this.goods.info.name,
picture: this.goods.info.picUrl picture: this.goods.info.picUrl
} };
}, },
setSkuList() { setSkuList() {
var sku_list = []; var sku_list = [];
_.each(this.goods.productList, v => { _.each(this.goods.productList, v => {
var sku_list_obj = {}; var sku_list_obj = {};
_.each(v.specifications, (specificationName, index) => { _.each(v.specifications, (specificationName, index) => {
sku_list_obj[ sku_list_obj['s' + (~~index + 1)] = this.findSpecValueIdByName(
's' + (~~index + 1) specificationName
] = this.findSpecValueIdByName(specificationName); );
}); });
sku_list_obj.price = v.price * 100; sku_list_obj.price = v.price * 100;
...@@ -312,7 +301,7 @@ computed: { ...@@ -312,7 +301,7 @@ computed: {
return; return;
} }
}); });
if(id !== 0){ if (id !== 0) {
return; return;
} }
}); });
...@@ -329,7 +318,7 @@ computed: { ...@@ -329,7 +318,7 @@ computed: {
id: vv.id, id: vv.id,
name: vv.value, name: vv.value,
imUrl: vv.picUrl imUrl: vv.picUrl
}) });
}); });
specifications.push({ specifications.push({
...@@ -353,7 +342,7 @@ computed: { ...@@ -353,7 +342,7 @@ computed: {
[GoodsActionIcon.name]: GoodsActionIcon, [GoodsActionIcon.name]: GoodsActionIcon,
[popupProps.name]: popupProps [popupProps.name]: popupProps
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -402,8 +391,10 @@ computed: { ...@@ -402,8 +391,10 @@ computed: {
.item_desc { .item_desc {
background-color: #fff; background-color: #fff;
p { /deep/ p {
padding: 0 10px; padding: 0 10px;
margin-block-start: 0 !important;
margin-block-end: 0 !important;
} }
/deep/ img { /deep/ img {
max-width: 100%; max-width: 100%;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment