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

1

parent 3a8a3a32
<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' }">
<u-tabs v-if="goods.showCat && goods.catPosition == 'top' && goods.catList.length > 1" name="menuName" :list="goods.catList"
:is-scroll="true" :active-color="mainColor" :current="activeKey" :show-bar="goods.catStyle == 1" :bold="false"
:type-style="goods.catStyle" :height="goods.catStyle == 1 ? '88' : '44'" @change="tabChangeHandler"></u-tabs>
<u-tabs
v-if="
goods.showCat &&
goods.catPosition == 'top' &&
goods.catList.length > 1
"
name="menuName"
:list="goods.catList"
:is-scroll="true"
:active-color="mainColor"
:current="activeKey"
:show-bar="goods.catStyle == 1"
:bold="false"
:type-style="goods.catStyle"
:height="goods.catStyle == 1 ? '88' : '44'"
@change="tabChangeHandler"
></u-tabs>
</view>
<div :class="{ 'right-slider': goods.catPosition == 'top' }">
<div :class="goods.catPosition == 'top' ? 'right-slider' : ''">
<!-- 有分类 -->
<template v-if="goods.showCat">
<template v-if="goods.catPosition == 'top'">
<!-- 一行一个 -->
<style1 v-if="goods.listStyle == 1" :goods-info="goods" :good-list="currentList"></style1>
<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>
<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>
<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>
<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>
<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>
<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>
<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">
......@@ -39,33 +84,57 @@
<!-- 只是商品 -->
<template v-else>
<!--一行一个-->
<style1 v-if="goods.listStyle == 1" :goods-info="goods" :good-list="currentList"></style1>
<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>
<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>
<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>
<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>
<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>
<style7
v-if="goods.listStyle == 4"
:goods-info="goods"
:good-list="currentList"
></style7>
</template>
</div>
</div>
</template>
<script>
import style1 from './style1';
import style2 from './style2';
import style3 from './style3';
import style4 from './style4';
import style5 from './style5';
import style6 from './style6';
import style7 from './style7';
import sidebar from '../sidebar/index';
export default {
props: ['goods'],
import style1 from "./style1";
import style2 from "./style2";
import style3 from "./style3";
import style4 from "./style4";
import style5 from "./style5";
import style6 from "./style6";
import style7 from "./style7";
import sidebar from "../sidebar/index";
export default {
props: ["goods"],
components: {
style1,
style2,
......@@ -74,13 +143,13 @@
style5,
style6,
style7,
sidebar
sidebar,
},
data() {
return {
mainColor: '',
mainColor: "",
activeKey: 0,
currentList: []
currentList: [],
};
},
created() {
......@@ -95,50 +164,50 @@
tabChangeHandler(i) {
this.currentList = this.goods.catList[i].goodsList;
this.activeKey = i;
}
}
};
},
},
};
</script>
<style>
.style4View {
.style4View {
display: inline-block;
width: 100%;
padding-left: 80px;
box-sizing: border-box;
}
}
.goods-box {
.goods-box {
/* margin: 20rpx 0; */
}
}
.goods-box .tips {
.goods-box .tips {
z-index: 50 !important;
}
}
.goods-box.flex {
.goods-box .flex {
display: flex;
}
}
.goods-box.flex .left-slider {
.goods-box.flex .left-slider {
width: 80px;
position: absolute;
}
}
.goods-box.flex .right-slider {
.goods-box.flex .right-slider {
flex: 1;
width: 1rpx;
}
}
.defaultz .van-sticky {
.defaultz .van-sticky {
z-index: 1 !important;
}
}
.goods-box .van-tabs__scroll {
.goods-box .van-tabs__scroll {
background: none;
}
}
.goods-box ._div {
.goods-box ._div {
width: 100%;
}
}
</style>
......@@ -4,7 +4,7 @@
:style="{
'background-color': goodsInfo.backgroundColor,
'background-image': goodsInfo.backgroundPicUrl,
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : ''
'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '',
}"
>
<view
......@@ -14,41 +14,73 @@
:key="gli"
:style="{
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="img-show">
<image style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0;" :mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'" :src="item.picUrl" />
</view>
<view class="tips" v-if="goodsInfo.showGoodsTag"
><image
:src="goodsInfo.goodsTagPicUrl"
mode="widthFix"
style="width: 100%"
/></view>
<view class="img-box-style5">
<image
style="width: 100%; height: 100%; border-radius: 10rpx 10rpx 0 0"
:mode="goodsInfo.fill == 1 ? 'aspectFill' : 'aspectFit'"
:src="item.picUrl"
/>
</view>
<view class="good-info">
<view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
<view class="good-sub-name" style="height:35rpx;">
<template v-if="item.subname">{{item.subname}}</template>
<view class="good-name" v-if="goodsInfo.showGoodsName">{{
item.name
}}</view>
<view class="good-sub-name" style="height: 35rpx">
<template v-if="item.subname">{{ item.subname }}</template>
</view>
<view class="good-price-info">
<view class="price" :style="{ color: mainColor }">
<view class="good-sub-name" style="flex:1;">{{item.thirdname}}</view>
<span style="color: #111;">
{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : '' }}
<view class="good-sub-name" style="flex: 1">{{
item.thirdname
}}</view>
<span style="color: #111">
{{ goodsInfo.showGoodsPrice ? getPrice(item.price) : "" }}
</span>
<!-- <span style='text-decoration: line-through;font-size: 10px;color: gray;font-family: aa;'>原价:{{goodsInfo.showGoodsPrice ? getPrice(item.OriginalPrice) : ''}}</span> -->
</view>
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<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
class="buy"
v-if="goodsInfo.showBuyBtn"
@click.stop="showSkuHandler(item)"
>
<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'"
/>
<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'}`
"
: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'"
:shape="
goodsInfo.buyBtnStyle == 3 || goodsInfo.buyBtnStyle == 4
? 'circle'
: 'square'
"
v-else
>
{{ goodsInfo.buyBtnText }}
......@@ -57,27 +89,37 @@
</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>
<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>
<script>
import goodSku from '../goods/goodsku';
import auth from '@/components/auth/index.vue';
import goodSku from "../goods/goodsku";
import auth from "@/components/auth/index.vue";
export default {
components: {
goodSku,
auth
auth,
},
props: ['goodList', 'goodsInfo'],
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: '',
mainColor: "",
activeKey: 0,
showSku: false,
sku: {},
showAuth: false,
u: {}
u: {},
};
},
created() {
......@@ -87,38 +129,42 @@ export default {
openGood(item) {
//线路
if (item.goodType == 4) {
var url="/pages/jiuzhai/jz_LineDetail?tcid=" + item.id + '&configId=' + item.subid;
console.log("url5",url)
var url =
"/pages/jiuzhai/jz_LineDetail?tcid=" +
item.id +
"&configId=" +
item.subid;
console.log("url5", url);
uni.navigateTo({
url: url
url: url,
});
}
//酒店
else if (item.goodType == 1) {
uni.navigateTo({
url: "/pages/hotel/detail?id=" + item.id
url: "/pages/hotel/detail?id=" + item.id,
});
}
//餐食
else if (item.goodType == 2) {
uni.navigateTo({
url: '/pages/restaurant/detail?id=' + item.id
url: "/pages/restaurant/detail?id=" + item.id,
});
}
//景点
else if (item.goodType == 3) {
uni.navigateTo({
url: '/pages/ticketCoupons/detail?id=' + item.id
url: "/pages/ticketCoupons/detail?id=" + item.id,
});
}
},
showSkuHandler(g) {
this.sku = g;
this.u = uni.getStorageSync('mall_UserInfo');
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
nickName: "未登录",
avatarUrl: "",
};
this.showAuth = true;
} else {
......@@ -126,14 +172,14 @@ export default {
}
},
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.u = uni.getStorageSync("mall_UserInfo");
// this.showAuth = false;
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
}
}
},
},
};
</script>
......@@ -152,16 +198,10 @@ export default {
.her-scoller .good-five {
position: relative;
margin-right: 30rpx;
/* width: 30%; */
/* border: 1rpx solid transparent;
border-radius: 10rpx;
padding-bottom: 10rpx; */
display:inline-block;
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 {
width: 64rpx;
......@@ -171,36 +211,13 @@ export default {
left: 0;
z-index: 4;
}
.her-scoller .good-five .img-box {
.her-scoller .good-five .img-box-style5 {
width: 100%;
/* height: 0;
padding-top: 100%; */
position: relative;
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 {
padding: 30rpx;
}
......@@ -216,7 +233,7 @@ export default {
width: 100%;
font-weight: 600;
}
.her-scoller .good-five .good-info .good-sub-name{
.her-scoller .good-five .good-info .good-sub-name {
overflow: hidden;
text-overflow: ellipsis;
display: block;
......
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