Commit d46d0a6e authored by 罗超's avatar 罗超

完善商品列表功能

parent 48892116
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
v-model="value" v-model="value"
:maskCloseAble="maskCloseAble" :maskCloseAble="maskCloseAble"
length="auto" length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom" :safeAreaInsetBottom="true"
@close="popupClose" @close="popupClose"
:z-index="9999" :z-index="9999"
close-icon="cross" close-icon="cross"
...@@ -58,25 +58,25 @@ ...@@ -58,25 +58,25 @@
@change="valChange" @change="valChange"
></u-number-box> ></u-number-box>
</view> </view>
</view> <view class="btn-box">
<view class="btn-box"> <view style="flex: 1;" v-if="optionType != 1">
<view style="flex: 1;" v-if="optionType != 1"> <u-button
<u-button @click="joinCar"
@click="joinCar" :ripple="true"
:ripple="true" :hair-line="false"
:hair-line="false" :custom-style="btn1"
:custom-style="btn1" >加入购物车</u-button
>加入购物车</u-button >
> </view>
</view> <view style="flex: 1;" v-if="optionType != 0">
<view style="flex: 1;" v-if="optionType != 0"> <u-button
<u-button @click="buy"
@click="buy" :ripple="true"
:ripple="true" :hair-line="false"
:hair-line="false" :custom-style="btn2"
:custom-style="btn2" >立即购买</u-button
>立即购买</u-button >
> </view>
</view> </view>
</view> </view>
</u-popup> </u-popup>
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
}, },
safeAreaInsetBottom: { safeAreaInsetBottom: {
type: Boolean, type: Boolean,
default: false, default: true,
}, },
good: { good: {
type: Object, type: Object,
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
this.goodamount = this.skuObj.stock; this.goodamount = this.skuObj.stock;
} else { } else {
this.goodimage = this.g.cover_pic; this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min; this.goodprice = this.g.price_min && this.g.price_min!="" ?this.g.price_min:this.g.price_content;
this.goodamount = this.g.goods_stock; this.goodamount = this.g.goods_stock;
} }
this.bian = this.$utils.is_biang; this.bian = this.$utils.is_biang;
...@@ -224,27 +224,29 @@ export default { ...@@ -224,27 +224,29 @@ export default {
}, },
buy() { buy() {
if (this.skuObj && this.skuObj.id) { if (this.skuObj && this.skuObj.id) {
let goods=[] let goods = [];
let g={ let g = {
id:this.skuObj.goods_id, id: this.skuObj.goods_id,
num:this.gc, num: this.gc,
cart_id:0, cart_id: 0,
goods_attr_id:this.skuObj.id, goods_attr_id: this.skuObj.id,
attr:[] attr: [],
} };
this.skuObj.attr_list.forEach(x=>{ this.skuObj.attr_list.forEach((x) => {
g.attr.push({ g.attr.push({
attr_id: x.attr_id, attr_id: x.attr_id,
attr_group_id: x.attr_group_id attr_group_id: x.attr_group_id,
}) });
}) });
goods.push(g) goods.push(g);
console.log(goods) console.log(goods);
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/order-submit?goods='+encodeURIComponent(JSON.stringify(goods)), url:
complete(res){ "/pages/order-submit/order-submit?goods=" +
console.log(res) encodeURIComponent(JSON.stringify(goods)),
} complete(res) {
console.log(res);
},
}); });
} else { } else {
uni.showToast({ uni.showToast({
...@@ -289,7 +291,7 @@ export default { ...@@ -289,7 +291,7 @@ export default {
this.sku = unchosen; this.sku = unchosen;
this.skuObj = null; this.skuObj = null;
this.goodimage = this.g.cover_pic; this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min; this.goodprice = this.g.price_min && this.g.price_min!="" ?this.g.price_min:this.g.price_content;
this.goodamount = this.g.goods_stock; this.goodamount = this.g.goods_stock;
} else { } else {
this.sku = chosen; this.sku = chosen;
...@@ -472,7 +474,7 @@ export default { ...@@ -472,7 +474,7 @@ export default {
width: 1px; width: 1px;
flex: 1; flex: 1;
} }
.btn-box { .goodsku .btn-box {
display: flex; display: flex;
background: #fff; background: #fff;
height: 60px; height: 60px;
......
...@@ -16,22 +16,29 @@ ...@@ -16,22 +16,29 @@
cx.price_content cx.price_content
}}</view> }}</view>
<view class="sell">{{ cx.sales }}</view> <view class="sell">{{ cx.sales }}</view>
<view class="cart"> <view class="cart" @click.stop="showSkuHandler(cx)">
<u-icon name="cart-o" size="40" :color="mainColor" /> <u-icon name="cart-o" size="40" :color="mainColor" />
</view> </view>
</view> </view>
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'
export default { export default {
components:{
goodSku
},
props: ["list"], props: ["list"],
data() { data() {
return { return {
g: [], g: [],
showSku:false,
sku:{}
}; };
}, },
mounted() { mounted() {
...@@ -52,6 +59,10 @@ export default { ...@@ -52,6 +59,10 @@ export default {
url: url, url: url,
}); });
}, },
showSkuHandler(g){
this.sku=g
this.showSku=true
}
}, },
}; };
</script> </script>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<span class="price" :style="{ color: mainColor }">{{ <span class="price" :style="{ color: mainColor }">{{
goodsInfo.showGoodsPrice ? item.price_content : "" goodsInfo.showGoodsPrice ? item.price_content : ""
}}</span> }}</span>
<span class="buy" v-if="goodsInfo.showBuyBtn"> <span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon
name="cart-o" name="cart-o"
size="40" size="40"
...@@ -84,16 +84,23 @@ ...@@ -84,16 +84,23 @@
</div> </div>
</div> </div>
</div> </div>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</div> </div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'
export default { export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeKey: 0, activeKey: 0,
showSku:false,
sku:{}
}; };
}, },
created() { created() {
...@@ -105,6 +112,10 @@ export default { ...@@ -105,6 +112,10 @@ export default {
url: url url: url
}); });
}, },
showSkuHandler(g){
this.sku=g
this.showSku=true
}
}, },
}; };
</script> </script>
......
...@@ -22,7 +22,11 @@ ...@@ -22,7 +22,11 @@
}" }"
> >
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="tips" v-if="goodsInfo.showGoodsTag">
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /> <image
:src="goodsInfo.goodsTagPicUrl"
mode="widthFix"
style="width: 100%;"
/>
</view> </view>
<view class="img-box"> <view class="img-box">
<view class="img-show"> <view class="img-show">
...@@ -42,11 +46,11 @@ ...@@ -42,11 +46,11 @@
{{ item.name }} {{ item.name }}
</view> </view>
<view class="good-price-info"> <view class="good-price-info">
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{ color: mainColor }">{{
goodsInfo.showGoodsPrice ? item.price_content : "" goodsInfo.showGoodsPrice ? item.price_content : ""
}}</view> }}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon
name="cart-o" name="cart-o"
size="40" size="40"
:color="mainColor" :color="mainColor"
...@@ -87,16 +91,29 @@ ...@@ -87,16 +91,29 @@
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
<good-sku
v-if="showSku"
:option-type="2"
borderRadius="20"
v-model="showSku"
:good="sku"
></good-sku>
</view> </view>
</template> </template>
<script> <script>
import goodSku from "../goods/goodsku";
export default { export default {
components: {
goodSku,
},
props: ["goodList", "goodsInfo"], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeKey: 0, activeKey: 0,
showSku: false,
sku: {},
}; };
}, },
created() { created() {
...@@ -105,9 +122,13 @@ export default { ...@@ -105,9 +122,13 @@ export default {
methods: { methods: {
openGood(url) { openGood(url) {
uni.navigateTo({ uni.navigateTo({
url: url url: url,
}); });
} },
showSkuHandler(g) {
this.sku = g;
this.showSku = true;
},
}, },
}; };
</script> </script>
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{'color':mainColor}">{{
goodsInfo.showGoodsPrice ? item.price_content : "" goodsInfo.showGoodsPrice ? item.price_content : ""
}}</view> }}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon
name="cart-o" name="cart-o"
size="40" size="40"
...@@ -87,16 +87,23 @@ ...@@ -87,16 +87,23 @@
</div> </div>
</u-col> </u-col>
</u-row> </u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
</div> </div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'
export default { export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeKey: 0, activeKey: 0,
showSku:false,
sku:{}
}; };
}, },
created() { created() {
...@@ -108,6 +115,10 @@ export default { ...@@ -108,6 +115,10 @@ export default {
url: url url: url
}); });
}, },
showSkuHandler(g){
this.sku=g
this.showSku=true
}
}, },
}; };
</script> </script>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<view class="price" :style="{'color':mainColor}">{{ <view class="price" :style="{'color':mainColor}">{{
goodsInfo.showGoodsPrice ? item.price_content : "" goodsInfo.showGoodsPrice ? item.price_content : ""
}}</view> }}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon
name="cart-o" name="cart-o"
size="40" size="40"
...@@ -76,16 +76,23 @@ ...@@ -76,16 +76,23 @@
</view> </view>
</view> </view>
</view> </view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'
export default { export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeKey: 0, activeKey: 0,
showSku:false,
sku:{}
}; };
}, },
created() { created() {
...@@ -97,6 +104,10 @@ export default { ...@@ -97,6 +104,10 @@ export default {
url: url url: url
}); });
}, },
showSkuHandler(g){
this.sku=g
this.showSku=true
}
}, },
}; };
</script> </script>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<view class="price" :style="{ color: mainColor }">{{ <view class="price" :style="{ color: mainColor }">{{
goodsInfo.showGoodsPrice ? item.price_content : "" goodsInfo.showGoodsPrice ? item.price_content : ""
}}</view> }}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon <u-icon
name="cart-o" name="cart-o"
size="40" size="40"
...@@ -79,16 +79,23 @@ ...@@ -79,16 +79,23 @@
</view> </view>
</view> </view>
<view style="color: rgba(0, 0, 0, 0); font-size: 12px;">0</view> <view style="color: rgba(0, 0, 0, 0); font-size: 12px;">0</view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'
export default { export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeKey: 0, activeKey: 0,
showSku:false,
sku:{}
}; };
}, },
created() { created() {
...@@ -100,6 +107,10 @@ export default { ...@@ -100,6 +107,10 @@ export default {
url: url, url: url,
}); });
}, },
showSkuHandler(g){
this.sku=g
this.showSku=true
}
}, },
}; };
</script> </script>
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
overflow: hidden; overflow: hidden;
z-index: 999; z-index: 999999999;
} }
.u-drawer-content { .u-drawer-content {
......
...@@ -63,9 +63,9 @@ ...@@ -63,9 +63,9 @@
<u-icon name="arrow" :size="32" color="#111"></u-icon> <u-icon name="arrow" :size="32" color="#111"></u-icon>
</view> </view>
</view> </view>
<view class="suk-item"> <view class="suk-item" style="flex-wrap:wrap">
<template v-if="skuimage.length > 0"> <template v-if="skuimage.length > 0">
<view v-for="(x, i) in skuimage" class="item img" :key="i"> <view v-for="(x, i) in skuimage" class="item img" style="margin-bottom:5px" :key="i">
<image :src="x" style="width: 100%; height: 100%;" /> <image :src="x" style="width: 100%; height: 100%;" />
</view> </view>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1" <view class="item" v-if="g.attr_groups[0].attr_list.length > 1"
...@@ -75,13 +75,12 @@ ...@@ -75,13 +75,12 @@
> >
</template> </template>
<template v-else> <template v-else>
<view <template v-for="(x, i) in g.attr_groups[0].attr_list">
v-for="(x, i) in g.attr_groups[0].attr_list" <view class="item" v-if="i<5" :key="i" style="margin-bottom:5px">
class="item" {{ x.attr_name }}
:key="i" </view>
> </template>
{{ x.attr_name }}
</view>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1" <view class="item" v-if="g.attr_groups[0].attr_list.length > 1"
>共{{ g.attr_groups[0].attr_list.length }}种{{ >共{{ g.attr_groups[0].attr_list.length }}种{{
g.attr_groups[0].attr_group_name g.attr_groups[0].attr_group_name
...@@ -226,7 +225,7 @@ export default { ...@@ -226,7 +225,7 @@ export default {
ot: 0, ot: 0,
currentSku: {}, currentSku: {},
isExsitGoods: true, isExsitGoods: true,
pageTitle:"商品详情" pageTitle: "商品详情",
}; };
}, },
components: { components: {
...@@ -240,7 +239,7 @@ export default { ...@@ -240,7 +239,7 @@ export default {
this.init(); this.init();
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
this.initPage() this.initPage();
}, },
methods: { methods: {
initPage() { initPage() {
...@@ -258,9 +257,9 @@ export default { ...@@ -258,9 +257,9 @@ export default {
title: this.pageTitle, title: this.pageTitle,
}); });
}, },
clickCommentHandler(){ clickCommentHandler() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/comment-list?id='+this.id url: "/pages/goods/comment-list?id=" + this.id,
}); });
}, },
init() { init() {
......
Markdown is supported
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