This commit is contained in:
Gdpao
2020-08-07 19:59:51 +08:00
22 changed files with 332 additions and 145 deletions

View File

@@ -27,10 +27,10 @@
<text>{{ goodsInfo.goods_price }}</text>
<s>{{ goodsInfo.goods_marketprice }}</s>
</view>
<view class="collect">
<u-icon name="star" color="#474747" size="28" v-if="1"></u-icon>
<view class="collect" @click="switchCollect(goodsInfo.goods_collect)">
<u-icon name="star" color="#474747" size="28" v-if="!goodsInfo.goods_collect"></u-icon>
<u-icon name="star-fill" color="#FF7807" size="28" v-else></u-icon>
<text>收藏</text>
<text>{{ !goodsInfo.goods_collect ? '收藏' : '已收藏' }}</text>
</view>
</view>
</view>
@@ -133,7 +133,7 @@
<guige @sel="self" ref="guige" v-for="(item,index) in goodsInfo.spec_value" :key="index" :title="goodsInfo.spec_name[index]" :item="item"></guige>
<view class="num">
<text>购买数量</text>
<u-number-box v-model="goodsNumber" @change="valChange"></u-number-box>
<u-number-box v-model="goodsNumber"></u-number-box>
</view>
<view style="height:100rpx"></view>
</view>
@@ -146,7 +146,7 @@
<image src="/static/image/common/18.png"></image>
店铺
</view>
<view class="navs" style="margin-right:30rpx" v-if="!showSpec">
<view class="navs" style="margin-right:30rpx" v-if="!showSpec" @click="customers()">
<image src="/static/image/common/19.png"></image>
客服
</view>
@@ -166,7 +166,7 @@
<image src="/static/image/common/18.png"></image>
<text>店铺</text>
</view>
<view>
<view @click="customers()">
<image src="/static/image/common/19.png"></image>
<text>客服</text>
</view>
@@ -211,6 +211,7 @@ export default {
sel: "", // 拼接的规格
quanxuan: false, // 规格是否选择
debounce: true,
storeid:0 //店铺id
}
},
components: {
@@ -227,9 +228,11 @@ export default {
onLoad(option) {
// this.init();
// console.log(option);
this.type = Number(option.type);
// this.type = Number(option.type);
// this.type = 1;
this.id = option.id;
this.setTitle();
// 先请求普通商品详情获取商品类型再渲染页面
this.ordinaryDetails(this.id);
},
onShow() {
this.debounce = true;
@@ -245,6 +248,34 @@ export default {
clearInterval(this.timer);
},
methods: {
customers(){
function Friend(uuid, name, avatar,time = "", text = "",date = "") {
this.uuid = uuid;
this.name = name;
this.avatar = avatar;
this.online = false;
this.unReadMessage = 0;
this.text = text;
this.time = time;
this.date = date
}
console.log(123)
this.$u.api.getAtwillUserInfo({
id:this.storeid
}).then((res)=>{
console.log(res)
let user = new Friend(res.data.member_id,res.data.member_nickname,res.data.member_avatar)
this.$u.route({
url:"/pageD/privateChat/privateChat",
params:{
id:JSON.stringify(user)
}
})
}).catch((err)=>{
console.log(err)
})
},
setSwiperList(list) {
let img = [];
list.forEach(item => {
@@ -305,10 +336,6 @@ export default {
case 3:
this.spikeGoodsDetails(id);
break;
case 4:
break;
default:
break;
}
@@ -316,13 +343,26 @@ export default {
// 普通商品详情
ordinaryDetails(id) {
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
console.log(res)
if (res.errCode == 0) {
this.evaluate = res.data.goods_evaluate_info;
this.goodsInfo = res.data.goods;
this.storeInfo = res.data.store;
this.setSwiperList(res.data.goods_image);
this.glist = res.data.spec_list;
this.storeid = res.data.store.store_id
// console.log(this.goodsInfo.mobile_body);
this.type = res.data.view_type;
this.setTitle();
if(this.type == 1) {
this.id = res.data.goods.goods_id;
} else if(this.type == 2) {
this.id = res.data.goods.pintuan_id;
this.getGoodsDetails(this.id);
} else if(this.type == 3) {
this.id = res.data.goods.groupbuy_id;
this.getGoodsDetails(this.id);
}
}
})
},
@@ -338,7 +378,7 @@ export default {
this.glist = res.data.data.spec_list;
this.user_suc = res.data.data.user_suc;
this.groupUser =res.data.data.user;
console.log(this.groupUser);
// console.log(this.groupUser);
}
})
},
@@ -348,6 +388,7 @@ export default {
groupbuy_id: id
}).then(res => {
if(res.errCode == 0) {
this.id = res.data.groupbuy_id;
this.groupbuyInfo = res.data.groupbuyInfo;
this.evaluate = res.data.goodsInfo.goods_evaluate_info;
this.goodsInfo = res.data.goodsInfo.goods;
@@ -361,7 +402,7 @@ export default {
this.$u.route({
url: '/pageB/triedDress/index',
params: {
id: this.id,
id: this.goodsInfo.goods_id,
}
})
},
@@ -412,9 +453,6 @@ export default {
this.showInvolvementUser = true;
// console.log(this.involvemenGroupInfo);
},
valChange(e) {
// console.log(this.value)
},
self(){
// console.log(this.$refs.guige)
let index = 0;
@@ -481,7 +519,32 @@ export default {
urls: arr,
current: arr[index]
})
}
},
switchCollect(status) {
if(status) {
this.removeFavorite();
} else {
this.addFavoriteGoods();
}
},
addFavoriteGoods() {
this.$u.api.addFavoriteGoods({ fid: this.goodsInfo.goods_id }).then(res => {
if(res.errCode == 0) {
this.getGoodsDetails(this.id);
} else {
this.$u.toast(res.message);
}
})
},
removeFavorite() {
this.$u.api.removeFavorite({ fid: this.goodsInfo.goods_id, type: 'goods' }).then(res => {
if(res.errCode == 0) {
this.getGoodsDetails(this.id);
} else {
this.$u.toast(res.message);
}
})
}
},
}
</script>