新增首页、详情页分享、修改会员价颜色、修改分类列表样式bug

master
chen 2022-05-20 11:22:15 +08:00
parent 4cae7f7aef
commit a863748a1b
5 changed files with 86 additions and 76 deletions

View File

@ -19,5 +19,6 @@
min-height: 100vh; min-height: 100vh;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.colorff0{color: #FF0000;}
/*每个页面公共css */ /*每个页面公共css */
</style> </style>

View File

@ -70,16 +70,21 @@
this.customBar=customBar+100+"rpx" this.customBar=customBar+100+"rpx"
console.log( this.customBar)
uni.setStorageSync('customBar',customBar+100); uni.setStorageSync('customBar',customBar+100);
} }
}) })
}, },
methods: { methods: {
navigateBackFun(){ navigateBackFun(){
uni.navigateBack() // uni.navigateBack()
uni.navigateBack({
delta:1,
success: (res) => {},fail: (err) => {
uni.reLaunch({
url:'/pages/index/index'
})
}
})
}, },

View File

@ -12,14 +12,11 @@
</view> </view>
<view class="classifyCon"> <view class="classifyCon">
<view class="navClassify"> <view class="navClassify">
<view class="navClassifyCon"> <scroll-view scroll-x>
<view @click="navStateTow(index)" v-for="(item,index) in classifyConData" class="text" <view style="width: 120rpx;display: flex;">
:class="item.state?'on':''"> <view @click="navStateTow(index)" v-for="(item,index) in classifyConData" class="text" :class="item.state?'on':''">{{item.title}}</view>
{{item.title}} </view>
</view> </scroll-view>
</view>
</view> </view>
<scroll-view scroll-y="true" lower-threshold="100rpx" class="classifyConList" @scrolltolower="lower"> <scroll-view scroll-y="true" lower-threshold="100rpx" class="classifyConList" @scrolltolower="lower">
<view class="classifyConListCon"> <view class="classifyConListCon">
@ -39,7 +36,7 @@
</view> </view>
</view> </view>
<view class="memberPrice" v-if="ifMember && ifMemberPrice && item.vip_price"> <view class="memberPrice" v-if="ifMember && ifMemberPrice && item.vip_price">
会员价{{item.vip_price}} 会员价<text class="colorff0">{{item.vip_price}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -74,7 +71,8 @@
is_home: 0, is_home: 0,
}, },
ifMember:false, ifMember:false,
ifMemberPrice:false ifMemberPrice:false,
windowWidth:uni.getSystemInfoSync().screenWidth - 80
} }
}, },
onLoad() { onLoad() {
@ -204,7 +202,13 @@
</script> </script>
<style> <style>
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.navList { .navList {
flex-shrink: 0;
width: 128rpx; width: 128rpx;
height: 88vh; height: 88vh;
background-color: #FFFFFF; background-color: #FFFFFF;
@ -251,25 +255,22 @@
} }
.classifyCon { .classifyCon {
flex: 1; width: 100%;
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
} }
.navClassify { .navClassify {
margin: auto;
overflow-x: auto;
padding-top: 30rpx; padding-top: 30rpx;
z-index: 3; z-index: 3;
padding-bottom: 30rpx; padding-bottom: 30rpx;
position: absolute;
background-color: #f6f6f6; background-color: #f6f6f6;
} }
.navClassifyCon { .navClassifyCon {
display: flex; display: flex;
overflow-x: auto; /* overflow-x: auto; */
} }
@ -304,11 +305,8 @@
.classifyConList { .classifyConList {
height: 88vh; height: 88vh;
overflow-x: auto;
padding-bottom: 119rpx; padding-bottom: 119rpx;
box-sizing: border-box; box-sizing: border-box;
padding-top: 100rpx;
} }
@ -321,7 +319,7 @@
.classifyConList .list { .classifyConList .list {
width: 276rpx; width: 276rpx;
/* height: 373rpx; */ /* height: 373rpx; */
margin-top: 30rpx; margin-bottom: 30rpx;
margin-right: 28rpx; margin-right: 28rpx;
position: relative; position: relative;
border-radius: 30rpx; border-radius: 30rpx;

View File

@ -3,7 +3,7 @@
<page-head text="详情" navState="true"></page-head> <page-head text="详情" navState="true"></page-head>
<swiper class="swiper" indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)" <swiper class="swiper" indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)"
:indicator-dots="indicatorDots"> :indicator-dots="indicatorDots">
<swiper-item v-for="(item,index) in commodityData.detail.images"> <swiper-item v-for="(item,index) in commodityData.detail.images" :key="index">
<view class="swiper-item uni-bg-red"> <view class="swiper-item uni-bg-red">
<image class="img" :src="item" mode="aspectFill"></image> <image class="img" :src="item" mode="aspectFill"></image>
</view> </view>
@ -50,9 +50,7 @@
<view class="p">面料材质其它 </view> <view class="p">面料材质其它 </view>
<view class="p">沙发骨架材质实木 是否带储物空间不带储物空间 沙发 <view class="p">沙发骨架材质实木 是否带储物空间不带储物空间 沙发
</view> --> </view> -->
</view> </view>
</view> </view>
<view class="similarity"> <view class="similarity">
<view class="title"> <view class="title">
@ -60,33 +58,18 @@
</view> </view>
</view> </view>
<view class="classifyConList"> <view class="classifyConList">
<view class="list" v-for="(item,index) in commodityData.similarGoods" @click="details(item.id)"> <view class="list" v-for="(item,index) in commodityData.similarGoods" :key="index" @click="details(item.id)">
<image class="img" :src="item.cover" mode="aspectFill"></image> <image class="img" :src="item.cover" mode="aspectFill"></image>
<view class="text"> <view class="text">{{item.name}}</view>
{{item.name}}
</view>
<view class="textA"> <view class="textA">
<view class="money"> <view class="money"><text ></text>{{item.price}}</view>
<text ></text>{{item.price}} <view class="btn" v-if="item.customized==1"></view>
</view>
<view class="btn" v-if="item.customized==1">
可定制
</view>
</view> </view>
<view class="memberPrice" v-if="ifMember && ifMemberPrice && item.vip_price"> <view class="memberPrice" v-if="ifMember && ifMemberPrice && item.vip_price">{{item.vip_price}}</view>
会员价{{item.vip_price}}
</view>
</view> </view>
</view> </view>
<view class="subscriptionButton" @click="makePhoneCallFun()"></view>
<view class="subscriptionButton" @click="makePhoneCallFun()"> <view class="make" :class="popupState?'makedis':''"></view>
立即订购
</view>
<view class="make" :class="popupState?'makedis':''">
</view>
<view class="popup" :class="popupState?'popupB':''"> <view class="popup" :class="popupState?'popupB':''">
<image class="imgGb" @click="specificationFunState()" src="../../static/47.png" mode=""></image> <image class="imgGb" @click="specificationFunState()" src="../../static/47.png" mode=""></image>
<view class="popupTitle"> <view class="popupTitle">
@ -95,28 +78,15 @@
<text ></text> {{money}} <text ></text> {{money}}
<view v-if="ifMember && ifMemberPrice && vip_price" style="margin-left: 40rpx;margin-bottom: 10rpx;"><text ></text> {{vip_price}}</view> <view v-if="ifMember && ifMemberPrice && vip_price" style="margin-left: 40rpx;margin-bottom: 10rpx;"><text ></text> {{vip_price}}</view>
</view> </view>
<view class="money textmoney" v-else> <view class="money textmoney" v-else></view>
暂无报价 <view class="text">点击上方封面可查看大图</view>
</view>
<view class="text">
点击上方封面可查看大图
</view>
</view> </view>
<view class="popupList"> <view class="popupList">
<view class="tit"> <view class="tit">规格</view>
规格
</view>
<view class="" style="height: 460rpx;overflow: hidden;overflow-y: scroll;margin-top: 20rpx;"> <view class="" style="height: 460rpx;overflow: hidden;overflow-y: scroll;margin-top: 20rpx;">
<view class="list" @click="popupListFun(index)" :class="item.state?'on':''" v-for="(item,index) in commodityData.sku"> <view class="list" @click="popupListFun(index)" :class="item.state?'on':''" v-for="(item,index) in commodityData.sku" :key="index">{{item.title}}</view>
{{item.title}}
</view>
</view>
<view class="button" @click="makePhoneCallFun()">
立即订购
</view> </view>
<view class="button" @click="makePhoneCallFun()"></view>
</view> </view>
</view> </view>
@ -134,7 +104,7 @@
popupState:false, popupState:false,
ifMember:false, ifMember:false,
ifMemberPrice:false, ifMemberPrice:false,
current:0 current:0,
} }
}, },
onShow() { onShow() {
@ -143,8 +113,43 @@
}, },
onLoad(option) { onLoad(option) {
this.id=option.id this.id=option.id
this.getData() this.getData()
if(!uni.getStorageSync('userData')) {
uni.login({
success:(res)=> {
this.request({
url: this.host + "/api/user/login",
type:"POST",
data: {
code: res.code,
},
success:(data)=>{
if(data.data.code!=4003) {
uni.setStorageSync('userData',data.data.data);
this.request({
url: this.host + "/api/user/info",
type: "post",
success: (res) => {
res.data.data.is_vip ? this.ifMember = true : this.ifMember = false;
uni.setStorageSync('ifMember',this.ifMember);
res.data.data.vip_switch ? this.ifMemberPrice = true : this.ifMemberPrice = false;
uni.setStorageSync('ifMemberPrice',this.ifMemberPrice);
}
})
}
}
})
}
})
}
}, },
onShareAppMessage() {
return {
title: this.commodityData.detail.name,
page: `/pages/commodity/commodity?id=${this.commodityData.detail.id}`,
image:''
}
},
methods: { methods: {
makePhoneCallFun(){ makePhoneCallFun(){
uni.makePhoneCall({ uni.makePhoneCall({

View File

@ -7,7 +7,7 @@
</navigator> </navigator>
<swiper class="swiper" indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)" <swiper class="swiper" indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)"
:indicator-dots="indicatorDots"> :indicator-dots="indicatorDots">
<swiper-item v-for="(item,index) in bannerData "> <swiper-item v-for="(item,index) in bannerData " :key="index">
<view @click="navD(item.spu_id)" class="swiper-item uni-bg-red"> <view @click="navD(item.spu_id)" class="swiper-item uni-bg-red">
<image class="img" :src="item.src" mode=""></image> <image class="img" :src="item.src" mode=""></image>
</view> </view>
@ -21,14 +21,14 @@
<view class="navList"> <view class="navList">
<view class="navListCon"> <view class="navListCon">
<view v-for="(item,index) in navData" class="text" @click="navState(index)" :class="item.state?'on':''"> <view v-for="(item,index) in navData" :key="index" class="text" @click="navState(index)" :class="item.state?'on':''">
{{item.title}} {{item.title}}
</view> </view>
</view> </view>
</view> </view>
<view class="list"> <view class="list">
<view class="listCon" v-for="(item,index) in HomeData" @click="details(item.id)"> <view class="listCon" v-for="(item,index) in HomeData" :key="index" @click="details(item.id)">
<image :src="item.cover" class="img" mode=""></image> <image :src="item.cover" class="img" mode=""></image>
<view class="text"> <view class="text">
{{item.name}} {{item.name}}
@ -38,7 +38,7 @@
<view class="moneyNum" style="display: flex;"> <view class="moneyNum" style="display: flex;">
<text ></text>{{item.price}} <text ></text>{{item.price}}
<view v-if="ifMember && ifMemberPrice && item.vip_price"> <view v-if="ifMember && ifMemberPrice && item.vip_price">
<text style="margin-left: 40rpx;">会员价</text>{{item.vip_price}} <text style="margin-left: 40rpx;">会员价</text> <text class="colorff0">{{item.vip_price}}</text>
</view> </view>
</view> </view>
<view class="btn" v-if="item.customized==1"> <view class="btn" v-if="item.customized==1">
@ -79,7 +79,7 @@
is_home: 1, is_home: 1,
}, },
ifMember:false, ifMember:false,
ifMemberPrice:false ifMemberPrice:false,
} }
}, },
onShow() { onShow() {
@ -104,10 +104,12 @@
this.moreState="no-more" this.moreState="no-more"
} }
}else{ }else{
console.log(123)
this.moreState="no-more" this.moreState="no-more"
} }
}, },
onShareAppMessage() {
},
methods: { methods: {
getUserData(){ getUserData(){
if(!uni.getStorageSync('userData')) { if(!uni.getStorageSync('userData')) {
@ -129,8 +131,7 @@
success: (res) => { success: (res) => {
res.data.data.is_vip ? this.ifMember = true : this.ifMember = false; res.data.data.is_vip ? this.ifMember = true : this.ifMember = false;
uni.setStorageSync('ifMember',this.ifMember); uni.setStorageSync('ifMember',this.ifMember);
res.data.data.vip_switch ? this.ifSwitchMember = true : this.ifSwitchMember = false; uni.setStorageSync('ifMemberPrice',res.data.data.vip_switch ? true : false);
uni.setStorageSync('ifMemberPrice',this.ifSwitchMember);
} }
}) })
} }