Commit 10bd72ba authored by zhengke's avatar zhengke

修改

parent 0996b060
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
</view> </view>
<view class="amount">库存 {{ goodamount }} {{ g.unit }}</view> <view class="amount">库存 {{ goodamount }} {{ g.unit }}</view>
<view class="sku">{{ skuObj ? '已选择' : '选择' }} {{ sku }}</view> <view class="sku">{{ skuObj ? '已选择' : '选择' }} {{ sku }}</view>
<view class="sku_close"> <view class="sku_close"><u-icon name="cross" color="#9F9F9F" @click="cloGood()" size="40" /></view>
<u-icon name="cross" color="#9F9F9F" @click="cloGood()" size="40"/>
</view>
</view> </view>
</view> </view>
<view class="sku-box"> <view class="sku-box">
...@@ -175,8 +173,8 @@ export default { ...@@ -175,8 +173,8 @@ export default {
this.g.attr_groups.forEach(x => { this.g.attr_groups.forEach(x => {
if (!this.skuObj) { if (!this.skuObj) {
//(x.checkId = 0), (x.checkName = x.attr_group_name); //(x.checkId = 0), (x.checkName = x.attr_group_name);
(x.checkId = 0), (x.checkName = x.attr_list[0].attr_name); (x.checkId = 0), (x.checkName = x.attr_list[0].attr_name);
x.checkId = x.attr_list[0].attr_id; x.checkId = x.attr_list[0].attr_id;
} else { } else {
let sign = `:${this.skuObj.sign_id}:`; let sign = `:${this.skuObj.sign_id}:`;
x.attr_list.forEach(y => { x.attr_list.forEach(y => {
...@@ -204,7 +202,7 @@ export default { ...@@ -204,7 +202,7 @@ export default {
GoodsId: this.skuObj.goods_id, GoodsId: this.skuObj.goods_id,
SpecificationSort: this.skuObj.sign_id, SpecificationSort: this.skuObj.sign_id,
Number: this.gc == 0 ? 1 : this.gc Number: this.gc == 0 ? 1 : this.gc
}, }
}, },
res => { res => {
uni.showToast({ uni.showToast({
...@@ -225,38 +223,27 @@ export default { ...@@ -225,38 +223,27 @@ export default {
} }
}, },
buy() { buy() {
let ShoppingCartIdList=[]; let ShoppingCartIdList = [];
if (this.skuObj && this.skuObj.id) { if (this.skuObj && this.skuObj.id) {
let good = { let good = {
DetailList: [], DetailList: [],
Use_Integral: 0, Use_Integral: 0,
User_Coupon_Id: 0, User_Coupon_Id: 0,
DeliveryMethod:0, DeliveryMethod: 0,
AddressId:0, AddressId: 0
}; };
let g = { let g = {
GoodsId: this.skuObj.goods_id, GoodsId: this.skuObj.goods_id,
Number: this.gc, Number: this.gc,
SpecificationSort: this.skuObj.sign_id, SpecificationSort: this.skuObj.sign_id
}; };
good.DetailList.push(g); good.DetailList.push(g);
// let g = {
// id: this.skuObj.goods_id,
// num: this.gc,
// cart_id: 0,
// goods_attr_id: this.skuObj.id,
// attr: []
// };
// this.skuObj.attr_list.forEach(x => {
// g.attr.push({
// attr_id: x.attr_id,
// attr_group_id: x.attr_group_id
// });
// });
// this.forms.list[0].goods_list.push(g);
// this.forms.list[0].mch_id = this.g.mch_id;
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(good))+'&IsFormShoppingCart=2&ShoppingCartIdList='+JSON.stringify(ShoppingCartIdList), url:
'/pages/order-submit/order-submit?formData=' +
encodeURIComponent(JSON.stringify(good)) +
'&IsFormShoppingCart=2&ShoppingCartIdList=' +
JSON.stringify(ShoppingCartIdList),
complete(res) { complete(res) {
console.log(res); console.log(res);
} }
...@@ -423,7 +410,7 @@ export default { ...@@ -423,7 +410,7 @@ export default {
width: 1px; width: 1px;
position: relative; position: relative;
} }
.goodsku .chosen-info .sku_close{ .goodsku .chosen-info .sku_close {
position: absolute; position: absolute;
right: 4px; right: 4px;
top: 5px; top: 5px;
......
<template> <template>
<div <div
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<div <div
v-for="(item, gli) in goodList" v-for="(item, gli) in goodList"
:key="gli" :key="gli"
class="good-one" class="good-one"
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '', }"
}" >
> <div class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></div>
<div class="tips" v-if="goodsInfo.showGoodsTag"> <image
<image style="width: calc(100vw - 24px); height: 66vw;"
:src="goodsInfo.goodsTagPicUrl" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
mode="widthFix" :src="item.picUrl"
style="width: 100%;" v-if="goodsInfo.goodsCoverProportion == '3-2'"
/> />
</div> <image
<image style="
style="width: calc(100vw - 24px); height: 66vw;"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl"
v-if="goodsInfo.goodsCoverProportion == '3-2'"
/>
<image
style="
width: calc(100vw - 24px); width: calc(100vw - 24px);
height: 100vw; height: 100vw;
border-radius: 10rpx 10rpx 0 0; border-radius: 10rpx 10rpx 0 0;
" "
v-if="goodsInfo.goodsCoverProportion == '1-1'" v-if="goodsInfo.goodsCoverProportion == '1-1'"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl" :src="item.picUrl"
/> />
<div class="good-info"> <div class="good-info">
<div class="good-name" v-if="goodsInfo.showGoodsName"> <div class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</div>
{{ item.name }} <div class="good-price-info">
</div> <span class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</span>
<div class="good-price-info"> <span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<span class="price" :style="{ color: mainColor }">{{ <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
}}</span> <u-button
<span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> type="primary"
<u-icon size="mini"
name="cart-o" :ripple="true"
size="40" :color="goodsInfo.buttonColor"
:color="mainColor" :custom-style="
v-if="goodsInfo.buyBtn == 'cart'" `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
/> "
<u-icon :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
name="add-o" :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
size="40" v-else
:color="mainColor" >
v-else-if="goodsInfo.buyBtn == 'add'" {{ goodsInfo.buyBtnText }}
/> </u-button>
<u-button </span>
type="primary" </div>
size="mini" </div>
:ripple="true" </div>
:color="goodsInfo.buttonColor" <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${ <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 </div>
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</span>
</div>
</div>
</div>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
}, auth
props: ["goodList", "goodsInfo"], },
data() { props: ['goodList', 'goodsInfo'],
return { data() {
mainColor: "", return {
activeKey: 0, mainColor: '',
showSku:false, activeKey: 0,
sku:{} showSku: false,
}; sku: {},
}, showAuth: false,
created() { u: {}
this.mainColor = this.$uiConfig.mainColor; };
}, },
methods: { created() {
openGood(item) { this.mainColor = this.$uiConfig.mainColor;
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); },
}, methods: {
showSkuHandler(g){ openGood(item) {
this.sku=g uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
this.showSku=true },
} showSkuHandler(g) {
}, this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
<style> <style>
.good-one { .good-one {
margin: 12px; margin: 12px;
position: relative; position: relative;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
overflow: hidden; overflow: hidden;
} }
.good-one .tips { .good-one .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.good-one .guding { .good-one .guding {
position: relative; position: relative;
} }
.good-one .guding .img-box { .good-one .guding .img-box {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
} }
.good-one .good-info { .good-one .good-info {
padding: 12rpx; padding: 12rpx;
padding-bottom: 0; padding-bottom: 0;
margin-top: -5px; margin-top: -5px;
} }
.good-one .good-info .good-name { .good-one .good-info .good-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin-bottom: 13px; margin-bottom: 13px;
} }
.good-one .good-info .good-price-info { .good-one .good-info .good-price-info {
display: flex; display: flex;
} }
.good-one .good-info .good-price-info .price { .good-one .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
font-size: 14px; font-size: 14px;
flex: 1; flex: 1;
} }
.good-one .good-info .good-price-info .buy { .good-one .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
<template> <template>
<view <view
style="padding: 12px; padding-bottom: 0;" style="padding: 12px; padding-bottom: 0;"
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<u-row gutter="24"> <u-row gutter="24">
<u-col span="6" v-for="(item, gli) in goodList" :key="gli"> <u-col span="6" v-for="(item, gli) in goodList" :key="gli">
<view <view
class="good-two" class="good-two"
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
background: }"
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 >
? '#FFF' <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></view>
: '', <view class="img-box">
}" <view class="img-show">
> <image
<view class="tips" v-if="goodsInfo.showGoodsTag"> style="
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" />
</view>
<view class="img-box">
<view class="img-show">
<image
style="
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 10rpx 10rpx 0 0; border-radius: 10rpx 10rpx 0 0;
" "
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl" :src="item.picUrl"
/> />
</view> </view>
</view> </view>
<view class="good-info"> <view class="good-info">
<view class="good-name" v-if="goodsInfo.showGoodsName"> <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
{{ item.name }} <view class="good-price-info">
</view> <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
<view class="good-price-info"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<view class="price" :style="{'color':mainColor}">{{ <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
}}</view> <u-button
<view class="buy" v-if="goodsInfo.showBuyBtn"> type="primary"
<u-icon size="mini"
name="cart-o" :ripple="true"
size="40" :color="goodsInfo.buttonColor"
:color="mainColor" :custom-style="
v-if="goodsInfo.buyBtn == 'cart'" `backgroundColor:${goodsInfo.buttonColor},color:${
/> goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'
<u-icon }`
name="add-o" "
size="40" :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:color="mainColor" :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else-if="goodsInfo.buyBtn == 'add'" v-else
/> >
<u-button {{ goodsInfo.buyBtnText }}
type="primary" </u-button>
size="mini" </view>
:ripple="true" </view>
:color="goodsInfo.buttonColor" </view>
:custom-style="`backgroundColor:${ </view>
goodsInfo.buttonColor </u-col>
},color:${ </u-row>
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</view>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view>
</template>
<script> <script>
import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
props: ["goodList", "goodsInfo"], components: {
data() { goodSku,
return { auth
mainColor: "", },
activeKey: 0, props: ['goodList', 'goodsInfo'],
}; data() {
}, return {
created() { mainColor: '',
this.mainColor = this.$uiConfig.mainColor; activeKey: 0,
}, showSku: false,
methods: { sku: {},
openGood(item) { showAuth: false,
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); u: {}
}, };
}, },
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
<style> <style>
.good-two { .good-two {
position: relative; position: relative;
margin-bottom: 12px; margin-bottom: 12px;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden; overflow: hidden;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.good-two .tips { .good-two .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.good-two .img-box { .good-two .img-box {
width: 100%; width: 100%;
height: 0; height: 0;
padding-top: 100%; padding-top: 100%;
position: relative; position: relative;
} }
.good-two .img-box .img-show { .good-two .img-box .img-show {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
.good-two .guding { .good-two .guding {
position: relative; position: relative;
} }
.good-two .guding .img-box { .good-two .guding .img-box {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
} }
.good-two .good-info { .good-two .good-info {
padding: 6rpx; padding: 6rpx;
margin-top: -5px; margin-top: -5px;
padding-bottom: 0; padding-bottom: 0;
} }
.good-two .good-info .good-name { .good-two .good-info .good-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin: 3px 0; margin: 3px 0;
font-size: 13px; font-size: 13px;
min-height:35px; min-height: 35px;
} }
.good-two .good-info .good-price-info { .good-two .good-info .good-price-info {
display: flex; display: flex;
} }
.good-two .good-info .good-price-info .price { .good-two .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
} }
.good-two .good-info .good-price-info .buy { .good-two .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
<template> <template>
<div <div
style="padding: 12px; padding-bottom: 0;" style="padding: 12px; padding-bottom: 0;"
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<u-row gutter="24"> <u-row gutter="24">
<u-col <u-col span="4" v-for="(item, gli) in goodList" :key="gli">
span="4" <div
v-for="(item, gli) in goodList" class="good-three"
:key="gli" @click="openGood(item)"
> :style="{
<div class="good-three" @click="openGood(item)" :style="{ border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
border: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', }"
background: >
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 <div class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></div>
? '#FFF' <div class="img-box">
: '', <div class="img-show">
}"> <image
<div class="tips" v-if="goodsInfo.showGoodsTag"> style="
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" />
</div>
<div class="img-box">
<div class="img-show">
<image
style="
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 10rpx 10rpx 0 0; border-radius: 10rpx 10rpx 0 0;
" "
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl" :src="item.picUrl"
/> />
</div> </div>
</div> </div>
<div class="good-info"> <div class="good-info">
<div class="good-name" v-if="goodsInfo.showGoodsName"> <div class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</div>
{{ item.name }} <div class="good-price-info">
</div> <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
<div class="good-price-info"> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<view class="price" :style="{'color':mainColor}">{{ <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
}}</view> <u-button
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> type="primary"
<u-icon size="mini"
name="cart-o" :ripple="true"
size="40" :color="goodsInfo.buttonColor"
:color="mainColor" :custom-style="
v-if="goodsInfo.buyBtn == 'cart'" `backgroundColor:${goodsInfo.buttonColor},color:${
/> goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'
<u-icon }`
name="add-o" "
size="40" :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:color="mainColor" :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
v-else-if="goodsInfo.buyBtn == 'add'" v-else
/> >
<u-button {{ goodsInfo.buyBtnText }}
type="primary" </u-button>
size="mini" </view>
:ripple="true" </div>
:color="goodsInfo.buttonColor" </div>
:custom-style="`backgroundColor:${ </div>
goodsInfo.buttonColor </u-col>
},color:${ </u-row>
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 <good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
? goodsInfo.buttonColor <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
: '#FFF' </div>
}`"
:plain="
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</div>
</div>
</div>
</u-col>
</u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
</div>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
}, auth
props: ["goodList", "goodsInfo"], },
data() { props: ['goodList', 'goodsInfo'],
return { data() {
mainColor: "", return {
activeKey: 0, mainColor: '',
showSku:false, activeKey: 0,
sku:{} showSku: false,
}; sku: {},
}, showAuth: false,
created() { u: {}
this.mainColor = this.$uiConfig.mainColor; };
}, },
methods: { created() {
openGood(item) { this.mainColor = this.$uiConfig.mainColor;
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); },
}, methods: {
showSkuHandler(g){ openGood(item) {
this.sku=g uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
this.showSku=true },
} showSkuHandler(g) {
}, this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
<style> <style>
.good-three { .good-three {
position: relative; position: relative;
margin-bottom: 12px; margin-bottom: 12px;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden; overflow: hidden;
padding-bottom: 5px; padding-bottom: 5px;
} }
.good-three .tips { .good-three .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.good-three .img-box { .good-three .img-box {
width: 100%; width: 100%;
height: 0; height: 0;
padding-top: 100%; padding-top: 100%;
position: relative; position: relative;
} }
.good-three .img-box .img-show { .good-three .img-box .img-show {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
.good-three .guding { .good-three .guding {
position: relative; position: relative;
} }
.good-three .guding .img-box { .good-three .guding .img-box {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
} }
.good-three .good-info { .good-three .good-info {
padding: 6rpx; padding: 6rpx;
margin-top: -5px; margin-top: -5px;
padding-bottom: 0; padding-bottom: 0;
} }
.good-three .good-info .good-name { .good-three .good-info .good-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin: 3px 0; margin: 3px 0;
font-size: 13px; font-size: 13px;
word-break:break-all; word-break: break-all;
min-height:34px; min-height: 34px;
} }
.good-three .good-info .good-price-info { .good-three .good-info .good-price-info {
display: flex; display: flex;
justify-items: center; justify-items: center;
align-items: center; align-items: center;
} }
.good-three .good-info .good-price-info .price { .good-three .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.good-three .good-info .good-price-info .buy { .good-three .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
<template> <template>
<view <view
style="padding: 12px; padding-bottom: 0;width:100%;min-height:450rpx;" style="padding: 12px; padding-bottom: 0;width:100%;min-height:450rpx;"
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
class="good-four" class="good-four"
v-for="(item, gli) in goodList" v-for="(item, gli) in goodList"
:key="gli" :key="gli"
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '', }"
}" >
> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></view>
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="img-box"><image style="width: 100%; height: 100%;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" /></view>
<image <view class="good-info">
:src="goodsInfo.goodsTagPicUrl" <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
mode="widthFix" <view class="good-price-info">
style="width: 100%;" <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
/> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
</view> <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
<view class="img-box"> <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
<image <u-button
style="width: 100%; height: 100%;" type="primary"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" size="mini"
:src="item.picUrl" :ripple="true"
/> :color="goodsInfo.buttonColor"
</view> :custom-style="
<view class="good-info"> `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ "
item.name :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
}}</view> :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
<view class="good-price-info"> v-else
<view class="price" :style="{'color':mainColor}">{{ >
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" {{ goodsInfo.buyBtnText }}
}}</view> </u-button>
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> </view>
<u-icon </view>
name="cart-o" </view>
size="40" </view>
:color="mainColor" <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
v-if="goodsInfo.buyBtn == 'cart'" <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
/> </view>
<u-icon
name="add-o"
size="40"
:color="mainColor"
v-else-if="goodsInfo.buyBtn == 'add'"
/>
<u-button
type="primary"
size="mini"
:ripple="true"
:color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</view>
</view>
</view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
}, auth
props: ["goodList", "goodsInfo"], },
data() { props: ['goodList', 'goodsInfo'],
return { data() {
mainColor: "", return {
activeKey: 0, mainColor: '',
showSku:false, activeKey: 0,
sku:{} showSku: false,
}; sku: {},
}, showAuth: false,
created() { u: {}
this.mainColor = this.$uiConfig.mainColor; };
}, },
methods: { created() {
openGood(item) { this.mainColor = this.$uiConfig.mainColor;
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); },
}, methods: {
showSkuHandler(g){ openGood(item) {
this.sku=g uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
this.showSku=true },
}, showSkuHandler(g) {
//格式化价格添加.00 this.sku = g;
// getPrice(value){ this.u = uni.getStorageSync('mall_UserInfo');
// var html,_val; if (!this.u) {
// value =Number(value).toFixed(2); this.u = {
// if(value==0){ nickName: '未登录',
// value=0; avatarUrl: ''
// return html = "¥0"; };
// }else if(value.split('.')[1].substring(1)==0){ this.showAuth = true;
// value = Number(value).toFixed(2); } else {
// } this.showSku = true;
// _val = value.split('.'); }
// return html = '¥'+_val[0]+'.'+_val[1]; },
// } reloadUserinfo() {
}, this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
//格式化价格添加.00
// getPrice(value){
// var html,_val;
// value =Number(value).toFixed(2);
// if(value==0){
// value=0;
// return html = "¥0";
// }else if(value.split('.')[1].substring(1)==0){
// value = Number(value).toFixed(2);
// }
// _val = value.split('.');
// return html = '¥'+_val[0]+'.'+_val[1];
// }
}
}; };
</script> </script>
<style> <style>
.good-four { .good-four {
position: relative; position: relative;
margin-bottom: 14px; margin-bottom: 14px;
display: flex; display: flex;
height: 102px; height: 102px;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 1px 1px 0; padding: 0 1px 1px 0;
overflow: hidden; overflow: hidden;
} }
.good-four .tips { .good-four .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.good-four .img-box { .good-four .img-box {
width: 100px; width: 100px;
height: 100px; height: 100px;
} }
.good-four .good-info { .good-four .good-info {
padding: 12px; padding: 12px;
flex: 1; flex: 1;
width: 1rpx; width: 1rpx;
border: 10rpx; border: 10rpx;
padding-bottom: 0; padding-bottom: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/* width:20%; */ /* width:20%; */
} }
.good-four .good-info .good-name { .good-four .good-info .good-name {
font-size: 13px; font-size: 13px;
height: 34px; height: 34px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.good-four .good-info .good-price-info { .good-four .good-info .good-price-info {
display: flex; display: flex;
justify-items: center; justify-items: center;
align-items: flex-end; align-items: flex-end;
height: 22px; height: 22px;
flex: 1; flex: 1;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.good-four .good-info .good-price-info .price { .good-four .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.good-four .good-info .good-price-info .buy { .good-four .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
<template> <template>
<view <view
class="her-scoller" class="her-scoller"
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
class="good-five" class="good-five"
@click="openGood(item)" @click="openGood(item)"
v-for="(item, gli) in goodList" v-for="(item, gli) in goodList"
:key="gli" :key="gli"
:style="{ :style="{
'border': goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 }"
? '#FFF' >
: '', <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /></view>
}" <view class="img-box">
> <view class="img-show">
<view class="tips" v-if="goodsInfo.showGoodsTag"> <image style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" />
<image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width:100%" /> </view>
</view> </view>
<view class="img-box"> <view class="good-info">
<view class="img-show"> <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
<image <view class="good-price-info">
style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;" <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
:src="item.picUrl" <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
/> <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
</view> <u-button
</view> type="primary"
<view size="mini"
class="good-info" :ripple="true"
> :color="goodsInfo.buttonColor"
<view class="good-name" v-if="goodsInfo.showGoodsName"> :custom-style="
{{ item.name }} `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
</view> "
<view class="good-price-info"> :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
<view class="price" :style="{'color':mainColor}">{{ :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" v-else
}}</view> >
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> {{ goodsInfo.buyBtnText }}
<u-icon </u-button>
name="cart-o" </view>
size="40" </view>
:color="mainColor" </view>
v-if="goodsInfo.buyBtn == 'cart'" </view>
/> <good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
<u-icon <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
name="add-o" </view>
size="40"
:color="mainColor"
v-else-if="goodsInfo.buyBtn == 'add'"
/>
<u-button
type="primary"
size="mini"
:ripple="true"
:color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</view>
</view>
</view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku' import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
components:{ components: {
goodSku goodSku,
}, auth
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: "",
activeKey: 0,
showSku:false,
sku:{}
};
},
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id});
},
showSkuHandler(g){
this.sku=g
this.showSku=true
}, },
}, props: ['goodList', 'goodsInfo'],
data() {
return {
mainColor: '',
activeKey: 0,
showSku: false,
sku: {},
showAuth: false,
u: {}
};
},
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
<style> <style>
.her-scoller { .her-scoller {
overflow-x: auto !important; overflow-x: auto !important;
padding: 12px; padding: 12px;
display: flex; display: flex;
white-space: nowrap; white-space: nowrap;
} }
/* .her-scoller::after { /* .her-scoller::after {
clear: both; clear: both;
...@@ -124,78 +116,78 @@ export default { ...@@ -124,78 +116,78 @@ export default {
display: block; display: block;
} */ } */
.her-scoller .good-five { .her-scoller .good-five {
position: relative; position: relative;
margin-right: 12px; margin-right: 12px;
width: 30%; width: 30%;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
/* float: left; */ /* float: left; */
} }
.her-scoller .good-five .tips { .her-scoller .good-five .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.her-scoller .good-five .img-box { .her-scoller .good-five .img-box {
width: 100%; width: 100%;
height: 0; height: 0;
padding-top: 100%; padding-top: 100%;
position: relative; position: relative;
} }
.her-scoller .good-five .img-box .img-show { .her-scoller .good-five .img-box .img-show {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
z-index: 2; z-index: 2;
} }
.her-scoller .good-five .guding { .her-scoller .good-five .guding {
position: relative; position: relative;
} }
.her-scoller .good-five .guding .img-box { .her-scoller .good-five .guding .img-box {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
} }
.her-scoller .good-five .good-info { .her-scoller .good-five .good-info {
padding: 6rpx; padding: 6rpx;
padding-bottom: 0; padding-bottom: 0;
} }
.her-scoller .good-five .good-info .good-name { .her-scoller .good-five .good-info .good-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: block; display: block;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin-bottom: 4rpx; margin-bottom: 4rpx;
font-size: 13px; font-size: 13px;
width: 100%; width: 100%;
} }
.her-scoller .good-five .good-info .good-price-info { .her-scoller .good-five .good-info .good-price-info {
display: flex; display: flex;
justify-items: center; justify-items: center;
align-items: center; align-items: center;
} }
.her-scoller .good-five .good-info .good-price-info .price { .her-scoller .good-five .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.her-scoller .good-five .good-info .good-price-info .buy { .her-scoller .good-five .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
<template> <template>
<view <view
style="padding: 12px; padding-bottom: 0;width:100%;" style="padding: 12px; padding-bottom: 0;width:100%;"
:style="{ :style="{
'background-color': goodsInfo.backgroundColor, 'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl, 'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '', 'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
}" }"
> >
<view <view
class="good-four" class="good-four"
v-for="(item, gli) in goodList" v-for="(item, gli) in goodList"
:key="gli" :key="gli"
@click="openGood(item)" @click="openGood(item)"
:style="{ :style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '', border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background: background: goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : ''
goodsInfo.goodsStyle == 1 || goodsInfo.goodsStyle == 2 ? '#FFF' : '', }"
}" >
> <view class="tips" v-if="goodsInfo.showGoodsTag"><image :src="goodsInfo.goodsTagPicUrl" mode="widthFix" style="width: 100%;" /></view>
<view class="tips" v-if="goodsInfo.showGoodsTag"> <view class="img-box"><image style="width: 100%; height: 100%;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" /></view>
<image <view class="good-info">
:src="goodsInfo.goodsTagPicUrl" <view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
mode="widthFix" <view class="good-price-info">
style="width: 100%;" <view class="price" :style="{ color: mainColor }">{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}</view>
/> <view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
</view> <u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" />
<view class="img-box"> <u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" />
<image <u-button
style="width: 100%; height: 100%;" type="primary"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" size="mini"
:src="item.picUrl" :ripple="true"
/> :color="goodsInfo.buttonColor"
</view> :custom-style="
<view class="good-info"> `backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}`
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ "
item.name :plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
}}</view> :shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'"
<view class="good-price-info"> v-else
<view class="price" :style="{'color':mainColor}">{{ >
goodsInfo.showGoodsPrice ? getPrice(item.price) : "" {{ goodsInfo.buyBtnText }}
}}</view> </u-button>
<view class="buy" v-if="goodsInfo.showBuyBtn"> </view>
<u-icon </view>
name="cart-o" </view>
size="40" </view>
:color="mainColor" <good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
v-if="goodsInfo.buyBtn == 'cart'" <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
/> </view>
<u-icon
name="add-o"
size="40"
:color="mainColor"
v-else-if="goodsInfo.buyBtn == 'add'"
/>
<u-button
type="primary"
size="mini"
:ripple="true"
:color="goodsInfo.buttonColor"
:custom-style="`backgroundColor:${goodsInfo.buttonColor},color:${
goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4
? goodsInfo.buttonColor
: '#FFF'
}`"
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>{{ goodsInfo.buyBtnText }}</u-button
>
</view>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
export default { export default {
props: ["goodList", "goodsInfo"], components: {
data() { goodSku,
return { auth
mainColor: "", },
activeKey: 0, props: ['goodList', 'goodsInfo'],
}; data() {
}, return {
created() { mainColor: '',
this.mainColor = this.$uiConfig.mainColor; activeKey: 0,
}, showSku: false,
methods: { sku: {},
openGood(item) { showAuth: false,
uni.navigateTo({ url: '/pages/goods/goods?GoodsId='+item.id}); u: {}
}, };
}, },
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(item) {
uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.showSku = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
}; };
</script> </script>
<style> <style>
.good-four { .good-four {
position: relative; position: relative;
margin-bottom: 14px; margin-bottom: 14px;
display: flex; display: flex;
height: 102px; height: 102px;
border: 1rpx solid transparent; border: 1rpx solid transparent;
border-radius: 10rpx; border-radius: 10rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 1px 1px 0; padding: 0 1px 1px 0;
overflow: hidden; overflow: hidden;
} }
.good-four .tips { .good-four .tips {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 4; z-index: 4;
} }
.good-four .img-box { .good-four .img-box {
width: 100px; width: 100px;
height: 100px; height: 100px;
} }
.good-four .good-info { .good-four .good-info {
padding: 12px; padding: 12px;
flex: 1; flex: 1;
width: 1rpx; width: 1rpx;
border: 10rpx; border: 10rpx;
padding-bottom: 0; padding-bottom: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/* width:20%; */ /* width:20%; */
} }
.good-four .good-info .good-name { .good-four .good-info .good-name {
font-size: 13px; font-size: 13px;
height: 34px; height: 34px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.good-four .good-info .good-price-info { .good-four .good-info .good-price-info {
display: flex; display: flex;
justify-items: center; justify-items: center;
align-items: flex-end; align-items: flex-end;
height: 22px; height: 22px;
flex: 1; flex: 1;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.good-four .good-info .good-price-info .price { .good-four .good-info .good-price-info .price {
color: #ff4544; color: #ff4544;
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.good-four .good-info .good-price-info .buy { .good-four .good-info .good-price-info .buy {
width: 24px; width: 24px;
text-align: right; text-align: right;
} }
</style> </style>
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