deming/pageB/sdetails/index.vue

153 lines
3.9 KiB
Vue
Raw Normal View History

2020-06-15 00:49:26 +00:00
<template>
<view class="sdetails">
<u-swiper :list="list" height="500" border-radius="0"></u-swiper>
<view class="info">
<view class="title">
2020-06-29 09:24:57 +00:00
<text>{{ goodsInfo.store_name }}</text>{{ goodsInfo.goods_name }}
2020-06-15 00:49:26 +00:00
</view>
<view class="pic">
2020-06-29 09:24:57 +00:00
<text>{{ goodsInfo.goods_price }}</text>
<s>{{ goodsInfo.goods_marketprice }}</s>
2020-06-15 00:49:26 +00:00
</view>
</view>
<view class="hr"></view>
2020-06-29 09:24:57 +00:00
<!-- <navs :value="领券"></navs> -->
2020-06-30 10:06:50 +00:00
<navs :value="'产品规格'"></navs>
<navs :value="'产品颜色'"></navs>
<navs :value="'选择尺码'"></navs>
2020-06-15 00:49:26 +00:00
<view class="xiangqing">
<view class="heng"></view>
<view class="title">商品详情</view>
<view class="heng"></view>
</view>
2020-06-29 09:24:57 +00:00
<view class="rich">
<rich-text :nodes="goodsInfo.mobile_body"></rich-text>
</view>
2020-07-07 06:45:57 +00:00
<tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="info"></tloos>
<u-toast ref="uToast" />
2020-06-15 00:49:26 +00:00
</view>
</template>
<script>
import navs from "../components/sdetails/navs"
import tloos from "../components/sdetails/tloos"
2020-07-07 06:45:57 +00:00
export default {
2020-06-15 00:49:26 +00:00
name:"sdetails",
2020-06-29 09:24:57 +00:00
data() {
return {
list: [],
2020-07-07 06:45:57 +00:00
goodsInfo: {},
info:{},
glist:[],
id:0
2020-06-29 09:24:57 +00:00
}
},
2020-06-15 00:49:26 +00:00
components:{
navs,
tloos
},
2020-06-29 09:24:57 +00:00
onLoad(option) {
2020-07-07 06:45:57 +00:00
this.getGoodsDetails(option.id);
2020-06-29 09:24:57 +00:00
},
methods: {
2020-07-07 06:45:57 +00:00
buy(info){
if(info.type == 2){
this.$u.api.addCart({
goods_id: this.id,
quantity: info.value,
}).then(res => {
this.$refs.uToast.show({
title: res.errCode[1],
type: res.errCode == 0 ? 'success' : 'warning',
})
})
}
},
2020-06-29 09:24:57 +00:00
getGoodsDetails(id) {
2020-07-07 06:45:57 +00:00
this.id = id;
2020-06-30 10:06:50 +00:00
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
2020-06-29 09:24:57 +00:00
if (res.errCode == 0) {
2020-07-15 08:21:43 +00:00
this.goodsInfo = res.data.goods;
let list = [];
res.data.goods_image[0].forEach(item => {
2020-06-29 09:24:57 +00:00
let temp = {
image: item
}
2020-07-15 08:21:43 +00:00
list.push(temp);
2020-06-29 09:24:57 +00:00
})
2020-07-15 08:21:43 +00:00
this.list = list;
2020-07-01 09:32:36 +00:00
// console.log(this.goodsInfo.mobile_body);
2020-06-29 09:24:57 +00:00
}
2020-07-07 06:45:57 +00:00
})
this.$u.api.goodsInfo({id}).then((res)=>{
console.log(res)
this.info = res.data.goods;
this.glist = res.data.spec_list;
})
},
xuanze(id){
console.log(id)
this.getGoodsDetails(this.glist[id])
}
2020-06-29 09:24:57 +00:00
},
2020-06-15 00:49:26 +00:00
}
</script>
<style lang="scss" scoped>
.sdetails{
2020-06-29 09:24:57 +00:00
padding-bottom: 98rpx;
2020-06-15 00:49:26 +00:00
.info{
padding: 30rpx;
.title{
flex-wrap: wrap;
2020-06-29 09:24:57 +00:00
margin-bottom: 30rpx;
2020-06-15 00:49:26 +00:00
>text{
padding: 13rpx;
font-size: 24rpx;
color:#fff;
margin-right: 13rpx;
background-color: #FF780F;
display: inline-block;
border-radius: 25rpx;
}
}
.pic{
>text{
font-size: 32rpx;
color: #FF3131;
}
>s{
font-size: 26rpx;
color: #999;
display: inline-block;
margin-left: 30rpx;
}
}
}
.hr{
width: 100%;
height: 20rpx;
background-color: #ececec;
}
.xiangqing{
display: flex;
height: 85rpx;
background-color: #ececec;
align-items: center;
justify-content: center;
.heng{
width: 79rpx;
height: 2rpx;
background-color: #a9a9a9;
}
font-size: 28rpx;
color: #999;
.title{
margin: 0 20rpx;
}
}
2020-06-29 09:24:57 +00:00
.rich {
width: 100%;
}
2020-06-15 00:49:26 +00:00
}
</style>