商品详情
This commit is contained in:
@@ -23,18 +23,22 @@
|
||||
<view class="rich">
|
||||
<rich-text :nodes="goodsInfo.mobile_body"></rich-text>
|
||||
</view>
|
||||
<tloos :id="goodsInfo.goods_commonid"></tloos>
|
||||
<tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="info"></tloos>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import navs from "../components/sdetails/navs"
|
||||
import tloos from "../components/sdetails/tloos"
|
||||
export default {
|
||||
export default {
|
||||
name:"sdetails",
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
goodsInfo: {},
|
||||
goodsInfo: {},
|
||||
info:{},
|
||||
glist:[],
|
||||
id:0
|
||||
}
|
||||
},
|
||||
components:{
|
||||
@@ -42,10 +46,25 @@ export default {
|
||||
tloos
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getGoodsDetails(option.id);
|
||||
this.getGoodsDetails(option.id);
|
||||
|
||||
},
|
||||
methods: {
|
||||
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',
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
getGoodsDetails(id) {
|
||||
this.id = id;
|
||||
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
|
||||
if (res.errCode == 0) {
|
||||
this.goodsInfo = res.data;
|
||||
@@ -58,8 +77,17 @@ export default {
|
||||
// console.log(this.goodsInfo.mobile_body);
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
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])
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user