Commit 54f91e53 authored by 罗超's avatar 罗超

1

parent 3a8a3a32
<template> <template>
<div class="goods-box" :class="{ flex: goods.catPosition == 'left' }"> <div class="goods-box" :class="goods.catPosition == 'left' ? 'flex' : ''">
<view :style="{ margin: goods.catStyle == 1 ? '0px' : '10px 5px' }"> <view :style="{ margin: goods.catStyle == 1 ? '0px' : '10px 5px' }">
<u-tabs v-if="goods.showCat && goods.catPosition == 'top' && goods.catList.length > 1" name="menuName" :list="goods.catList" <u-tabs
:is-scroll="true" :active-color="mainColor" :current="activeKey" :show-bar="goods.catStyle == 1" :bold="false" v-if="
:type-style="goods.catStyle" :height="goods.catStyle == 1 ? '88' : '44'" @change="tabChangeHandler"></u-tabs> goods.showCat &&
</view> goods.catPosition == 'top' &&
<div :class="{ 'right-slider': goods.catPosition == 'top' }"> goods.catList.length > 1
<!-- 有分类 --> "
<template v-if="goods.showCat"> name="menuName"
<template v-if="goods.catPosition == 'top'"> :list="goods.catList"
<!-- 一行一个 --> :is-scroll="true"
<style1 v-if="goods.listStyle == 1" :goods-info="goods" :good-list="currentList"></style1> :active-color="mainColor"
<!-- 一行两个 --> :current="activeKey"
<style2 v-if="goods.listStyle == 2" :goods-info="goods" :good-list="currentList"></style2> :show-bar="goods.catStyle == 1"
<!-- 一行三个 --> :bold="false"
<style3 v-if="goods.listStyle == 3" :goods-info="goods" :good-list="currentList"></style3> :type-style="goods.catStyle"
<!-- 左右滚动 --> :height="goods.catStyle == 1 ? '88' : '44'"
<style5 v-if="goods.listStyle == 0" :goods-info="goods" :good-list="currentList"></style5> @change="tabChangeHandler"
<!--列表模式--> ></u-tabs>
<style6 v-if="goods.listStyle == -1" :goods-info="goods" :good-list="currentList"></style6> </view>
<!-- 教育有星星模式 --> <div :class="goods.catPosition == 'top' ? 'right-slider' : ''">
<style7 v-if="goods.listStyle == 4" :goods-info="goods" :good-list="currentList"></style7> <!-- 有分类 -->
</template> <template v-if="goods.showCat">
<template v-else-if="goods.catPosition == 'left'"> <template v-if="goods.catPosition == 'top'">
<!-- 左侧分类 --> <!-- 一行一个 -->
<view> <style1
<view class="left-slider"> v-if="goods.listStyle == 1"
<sidebar :active="activeKey" v-if="goods.showCat && goods.catPosition == 'left'" :list="goods.catList" name="menuName" :goods-info="goods"
:active-color="mainColor" :border="false" @change="tabChangeHandler"></sidebar> :good-list="currentList"
</view> ></style1>
<!-- 右侧列表 --> <!-- 一行两个 -->
<view class="style4View"> <style2
<style4 :goods-info="goods" :good-list="currentList"></style4> v-if="goods.listStyle == 2"
</view> :goods-info="goods"
</view> :good-list="currentList"
</template> ></style2>
</template> <!-- 一行三个 -->
<!-- 只是商品 --> <style3
<template v-else> v-if="goods.listStyle == 3"
<!--一行一个--> :goods-info="goods"
<style1 v-if="goods.listStyle == 1" :goods-info="goods" :good-list="currentList"></style1> :good-list="currentList"
<!--一行两个--> ></style3>
<style2 v-if="goods.listStyle == 2" :goods-info="goods" :good-list="currentList"></style2> <!-- 左右滚动 -->
<!--一行三个--> <style5
<style3 v-if="goods.listStyle == 3" :goods-info="goods" :good-list="currentList"></style3> v-if="goods.listStyle == 0"
<!--左右滚动--> :goods-info="goods"
<style5 v-if="goods.listStyle == 0" :goods-info="goods" :good-list="currentList"></style5> :good-list="currentList"
<!--列表模式--> ></style5>
<style6 v-if="goods.listStyle == -1" :goods-info="goods" :good-list="currentList"></style6> <!--列表模式-->
<!-- 教育有星星模式 --> <style6
<style7 v-if="goods.listStyle == 4" :goods-info="goods" :good-list="currentList"></style7> v-if="goods.listStyle == -1"
</template> :goods-info="goods"
</div> :good-list="currentList"
</div> ></style6>
<!-- 教育有星星模式 -->
<style7
v-if="goods.listStyle == 4"
:goods-info="goods"
:good-list="currentList"
></style7>
</template>
<template v-else-if="goods.catPosition == 'left'">
<!-- 左侧分类 -->
<view>
<view class="left-slider">
<sidebar
:active="activeKey"
v-if="goods.showCat && goods.catPosition == 'left'"
:list="goods.catList"
name="menuName"
:active-color="mainColor"
:border="false"
@change="tabChangeHandler"
></sidebar>
</view>
<!-- 右侧列表 -->
<view class="style4View">
<style4 :goods-info="goods" :good-list="currentList"></style4>
</view>
</view>
</template>
</template>
<!-- 只是商品 -->
<template v-else>
<!--一行一个-->
<style1
v-if="goods.listStyle == 1"
:goods-info="goods"
:good-list="currentList"
></style1>
<!--一行两个-->
<style2
v-if="goods.listStyle == 2"
:goods-info="goods"
:good-list="currentList"
></style2>
<!--一行三个-->
<style3
v-if="goods.listStyle == 3"
:goods-info="goods"
:good-list="currentList"
></style3>
<!--左右滚动-->
<style5
v-if="goods.listStyle == 0"
:goods-info="goods"
:good-list="currentList"
></style5>
<!--列表模式-->
<style6
v-if="goods.listStyle == -1"
:goods-info="goods"
:good-list="currentList"
></style6>
<!-- 教育有星星模式 -->
<style7
v-if="goods.listStyle == 4"
:goods-info="goods"
:good-list="currentList"
></style7>
</template>
</div>
</div>
</template> </template>
<script> <script>
import style1 from './style1'; import style1 from "./style1";
import style2 from './style2'; import style2 from "./style2";
import style3 from './style3'; import style3 from "./style3";
import style4 from './style4'; import style4 from "./style4";
import style5 from './style5'; import style5 from "./style5";
import style6 from './style6'; import style6 from "./style6";
import style7 from './style7'; import style7 from "./style7";
import sidebar from '../sidebar/index'; import sidebar from "../sidebar/index";
export default { export default {
props: ['goods'], props: ["goods"],
components: { components: {
style1, style1,
style2, style2,
style3, style3,
style4, style4,
style5, style5,
style6, style6,
style7, style7,
sidebar sidebar,
}, },
data() { data() {
return { return {
mainColor: '', mainColor: "",
activeKey: 0, activeKey: 0,
currentList: [] currentList: [],
}; };
}, },
created() { created() {
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
if (this.goods.showCat) { if (this.goods.showCat) {
this.currentList = this.goods.catList[0].goodsList; this.currentList = this.goods.catList[0].goodsList;
} else { } else {
this.currentList = this.goods.list; this.currentList = this.goods.list;
} }
}, },
methods: { methods: {
tabChangeHandler(i) { tabChangeHandler(i) {
this.currentList = this.goods.catList[i].goodsList; this.currentList = this.goods.catList[i].goodsList;
this.activeKey = i; this.activeKey = i;
} },
} },
}; };
</script> </script>
<style> <style>
.style4View { .style4View {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
padding-left: 80px; padding-left: 80px;
box-sizing: border-box; box-sizing: border-box;
} }
.goods-box { .goods-box {
/* margin: 20rpx 0; */ /* margin: 20rpx 0; */
} }
.goods-box .tips { .goods-box .tips {
z-index: 50 !important; z-index: 50 !important;
} }
.goods-box.flex { .goods-box .flex {
display: flex; display: flex;
} }
.goods-box.flex .left-slider { .goods-box.flex .left-slider {
width: 80px; width: 80px;
position: absolute; position: absolute;
} }
.goods-box.flex .right-slider { .goods-box.flex .right-slider {
flex: 1; flex: 1;
width: 1rpx; width: 1rpx;
} }
.defaultz .van-sticky { .defaultz .van-sticky {
z-index: 1 !important; z-index: 1 !important;
} }
.goods-box .van-tabs__scroll { .goods-box .van-tabs__scroll {
background: none; background: none;
} }
.goods-box ._div { .goods-box ._div {
width: 100%; width: 100%;
} }
</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: 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="tips" v-if="goodsInfo.showGoodsTag"
<view class="img-show"> ><image
<image style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" /> :src="goodsInfo.goodsTagPicUrl"
</view> mode="widthFix"
</view> style="width: 100%"
<view class="good-info"> /></view>
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view> <view class="img-box-style5">
<view class="good-sub-name" style="height:35rpx;"> <image
<template v-if="item.subname">{{item.subname}}</template> style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0"
</view> :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
<view class="good-price-info"> :src="item.picUrl"
<view class="price" :style="{ color: mainColor }"> />
<view class="good-sub-name" style="flex:1;">{{item.thirdname}}</view> </view>
<span style="color: #111;"> <view class="good-info">
{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }} <view class="good-name" v-if="goodsInfo.showGoodsName">{{
</span> item.name
<!-- <span style='text-decoration: line-through;font-size: 10px;color: gray;font-family: aa;'>原价:{{goodsInfo.showGoodsPrice ? getPrice(item.OriginalPrice) : ''}}</span> --> }}</view>
</view> <view class="good-sub-name" style="height: 35rpx">
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)"> <template v-if="item.subname">{{ item.subname }}</template>
<u-icon name="cart-o" size="40" :color="mainColor" v-if="goodsInfo.buyBtn == 'cart'" /> </view>
<u-icon name="add-o" size="40" :color="mainColor" v-else-if="goodsInfo.buyBtn == 'add'" /> <view class="good-price-info">
<u-button <view class="price" :style="{ color: mainColor }">
type="primary" <view class="good-sub-name" style="flex: 1">{{
size="mini" item.thirdname
:ripple="true" }}</view>
:color="goodsInfo.buttonColor" <span style="color: #111">
:custom-style=" {{ goodsInfo.showGoodsPrice ? getPrice(item.price) : "" }}
`backgroundColor:${goodsInfo.buttonColor},color:${goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4 ? goodsInfo.buttonColor : '#FFF'}` </span>
" <!-- <span style='text-decoration: line-through;font-size: 10px;color: gray;font-family: aa;'>原价:{{goodsInfo.showGoodsPrice ? getPrice(item.OriginalPrice) : ''}}</span> -->
:plain="goodsInfo.buyBtnStyle == 2 || goodsInfo.buyBtnStyle == 4" </view>
:shape="goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4 ? 'circle' : 'square'" <view
v-else class="buy"
> v-if="goodsInfo.showBuyBtn"
{{ goodsInfo.buyBtnText }} @click.stop="showSkuHandler(item)"
</u-button> >
</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>
<auth
v-if="showAuth"
@changeuserinfo="reloadUserinfo"
@gbAuth="gbAuth"
></auth>
</view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'; import goodSku from "../goods/goodsku";
import auth from '@/components/auth/index.vue'; import auth from "@/components/auth/index.vue";
export default { export default {
components: { components: {
goodSku, goodSku,
auth auth,
}, },
props: ['goodList', 'goodsInfo'], props: ["goodList", "goodsInfo"],
data() { data() {
return { return {
mainColor: '', mainColor: "",
activeKey: 0, activeKey: 0,
showSku: false, showSku: false,
sku: {}, sku: {},
showAuth: false, showAuth: false,
u: {} u: {},
}; };
}, },
created() { created() {
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
}, },
methods: { methods: {
openGood(item) { openGood(item) {
//线路 //线路
if (item.goodType == 4) { if (item.goodType == 4) {
var url="/pages/jiuzhai/jz_LineDetail?tcid=" + item.id + '&configId=' + item.subid; var url =
console.log("url5",url) "/pages/jiuzhai/jz_LineDetail?tcid=" +
uni.navigateTo({ item.id +
url: url "&configId=" +
}); item.subid;
} console.log("url5", url);
//酒店 uni.navigateTo({
else if (item.goodType == 1) { url: url,
uni.navigateTo({ });
url: "/pages/hotel/detail?id=" + item.id }
}); //酒店
} else if (item.goodType == 1) {
//餐食 uni.navigateTo({
else if (item.goodType == 2) { url: "/pages/hotel/detail?id=" + item.id,
uni.navigateTo({ });
url: '/pages/restaurant/detail?id=' + item.id }
}); //餐食
} else if (item.goodType == 2) {
//景点 uni.navigateTo({
else if (item.goodType == 3) { url: "/pages/restaurant/detail?id=" + item.id,
uni.navigateTo({ });
url: '/pages/ticketCoupons/detail?id=' + item.id }
}); //景点
} else if (item.goodType == 3) {
}, uni.navigateTo({
showSkuHandler(g) { url: "/pages/ticketCoupons/detail?id=" + item.id,
this.sku = g; });
this.u = uni.getStorageSync('mall_UserInfo'); }
if (!this.u) { },
this.u = { showSkuHandler(g) {
nickName: '未登录', this.sku = g;
avatarUrl: '' this.u = uni.getStorageSync("mall_UserInfo");
}; if (!this.u) {
this.showAuth = true; this.u = {
} else { nickName: "未登录",
this.showSku = true; avatarUrl: "",
} };
}, this.showAuth = true;
reloadUserinfo() { } else {
this.u = uni.getStorageSync('mall_UserInfo'); this.showSku = true;
// this.showAuth = false; }
}, },
//关闭登录窗口 reloadUserinfo() {
gbAuth() { this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth = false; // 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;
...@@ -150,98 +196,69 @@ export default { ...@@ -150,98 +196,69 @@ export default {
display: block; display: block;
} */ } */
.her-scoller .good-five { .her-scoller .good-five {
position: relative; position: relative;
margin-right: 30rpx; margin-right: 30rpx;
/* width: 30%; */ display: inline-block;
/* border: 1rpx solid transparent; width: 560rpx;
border-radius: 10rpx; box-shadow: 0px 10px 30px 0px rgba(36, 36, 36, 0.2);
padding-bottom: 10rpx; */ border-radius: 20rpx;
display:inline-block;
width: 560rpx;
box-shadow: 0px 10px 30px 0px rgba(36, 36, 36, 0.2);
border-radius: 20rpx;
/* 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-style5 {
width: 100%; width: 100%;
/* height: 0; height: 224rpx;
padding-top: 100%; */ border-radius: 20rpx;
position: relative; overflow: hidden;
height: 224rpx;
border-radius: 20rpx;
overflow: hidden;
}
.her-scoller .good-five .img-box .img-show {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 2;
}
.her-scoller .good-five .guding {
position: relative;
}
.her-scoller .good-five .guding .img-box {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
} }
.her-scoller .good-five .good-info { .her-scoller .good-five .good-info {
padding: 30rpx; padding: 30rpx;
} }
.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; */
white-space: nowrap; white-space: nowrap;
margin-bottom: 10rpx; margin-bottom: 10rpx;
font-size: 26rpx; font-size: 26rpx;
width: 100%; width: 100%;
font-weight: 600; font-weight: 600;
} }
.her-scoller .good-five .good-info .good-sub-name{ .her-scoller .good-five .good-info .good-sub-name {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: block; display: block;
white-space: nowrap; white-space: nowrap;
font-size: 22rpx; font-size: 22rpx;
color: #999999; color: #999999;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.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;
display: flex; display: flex;
/* flex-direction: column; */ /* flex-direction: column; */
} }
.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>
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