...
|
...
|
@@ -3,7 +3,8 @@ |
|
|
<view class="goodtailtop">
|
|
|
<image :src="goodtail.image" mode=""></image>
|
|
|
</view>
|
|
|
<view class="tailbox boxsizing" v-if="type==1">
|
|
|
<view v-if="type==1">
|
|
|
<view class="tailbox boxsizing" v-if="goodtail.is_seckill==2">
|
|
|
<view class="tailname">
|
|
|
{{goodtail.name}}
|
|
|
</view>
|
...
|
...
|
@@ -19,30 +20,16 @@ |
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tailbox boxsizing" v-else-if="type==2">
|
|
|
<view class="tailname">
|
|
|
{{goodtail.name}}
|
|
|
</view>
|
|
|
<view class="tailhezi flextwo">
|
|
|
<view class="tailhezileft flexone">
|
|
|
<view class="saleprice">¥{{goodtail.score_goods_spec.goods_price}}</view>
|
|
|
<!-- <view class="huiyuanprice">会员价:¥{{goodtail.vip_price}}</view> -->
|
|
|
</view>
|
|
|
<view class="heziright flexone">
|
|
|
<view class="heziprice stock">库存:{{goodtail.score_goods_spec.stock_num}}件</view>
|
|
|
<view class="heziprice">已售{{goodtail.sales}}件</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<view class="tailbox boxsizing" v-else>
|
|
|
<view class="tailname">
|
|
|
<text class='miaobox'>限时秒杀</text>
|
|
|
商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
|
|
|
{{goodtail.name}}
|
|
|
</view>
|
|
|
<view class="tailhezi flextwo">
|
|
|
<view class="tailhezileft flexone">
|
|
|
<view class="saleprice">¥288</view>
|
|
|
<view class="oldprice">¥450</view>
|
|
|
<view class="saleprice">¥{{item.seckill_price}}</view>
|
|
|
<view class="oldprice">¥{{item.goods_price}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class='miaodu flextwo'>
|
...
|
...
|
@@ -62,6 +49,41 @@ |
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
<view class="tailbox boxsizing" v-else-if="type==2">
|
|
|
<view class="tailname">
|
|
|
{{goodtail.name}}
|
|
|
</view>
|
|
|
<view class="tailhezi flextwo">
|
|
|
<view class="tailhezileft flexone">
|
|
|
<view class="saleprice">¥{{goodtail.score_goods_spec.goods_price}}</view>
|
|
|
<!-- <view class="huiyuanprice">会员价:¥{{goodtail.vip_price}}</view> -->
|
|
|
</view>
|
|
|
<view class="heziright flexone">
|
|
|
<view class="heziprice stock">库存:{{goodtail.score_goods_spec.stock_num}}件</view>
|
|
|
<view class="heziprice">已售{{goodtail.sales}}件</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<view class="tailbox boxsizing" v-else-if="type==3">
|
|
|
<view class="tailname">
|
|
|
{{goodtail.name}}
|
|
|
</view>
|
|
|
<view class="tailhezi flextwo">
|
|
|
<view class="tailhezileft flexone">
|
|
|
<view class="saleprice">¥{{goodtail.goods_price}}</view>
|
|
|
<!-- <view class="huiyuanprice">会员价:¥{{goodtail.vip_price}}</view> -->
|
|
|
</view>
|
|
|
<view class="heziright flexone">
|
|
|
<!-- <view class="heziprice stock">库存:{{goodtail.score_goods_spec.stock_num}}件</view> -->
|
|
|
<view class="heziprice">已售{{goodtail.sales}}件</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<view class="send">
|
|
|
{{goodtail.postage}}
|
|
|
<!-- 包邮 店铺满100元包邮 -->
|
...
|
...
|
@@ -76,12 +98,11 @@ |
|
|
</view>
|
|
|
<view class="goodcomment" v-else>
|
|
|
<view class="goodcommentop flexone">
|
|
|
<view class="topitem">全部(60万)</view>
|
|
|
<view class="topitem">好评(16万)</view>
|
|
|
<view class="topitem">中评(10万)</view>
|
|
|
<view class="topitem">差评(600)</view>
|
|
|
<view class="topitem" @click="commenttype" :data-id="0">全部(60万)</view>
|
|
|
<view class="topitem" @click="commenttype" :data-id="1">好评(16万)</view>
|
|
|
<view class="topitem" @click="commenttype" :data-id="2">中评(10万)</view>
|
|
|
<view class="topitem" @click="commenttype" :data-id="3">差评(600)</view>
|
|
|
</view>
|
|
|
|
|
|
<view class="commentlist">
|
|
|
<view class="jianintro photobox" bindtap="comdetail">
|
|
|
<view class="comtop flextwo">
|
...
|
...
|
@@ -178,12 +199,13 @@ |
|
|
<view class="saleprice" v-if="type==2">¥{{goodtail.score_goods_spec.goods_price}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-for="(item,parindex) in specarr" :key="parindex" >
|
|
|
<view v-for="(item,parindex) in specarr" :key="parindex">
|
|
|
<view class="weightbox">
|
|
|
<view class="weight">{{item.spec_name}}</view>
|
|
|
<view class="weightlsit flexone">
|
|
|
<!-- witemactive -->
|
|
|
<view class="weightlsititem" :class="item.selindex==childindex?'witemactive':''" v-for="(itemk,childindex) in item.spec_value" :key="childindex" @click.stop="selspec(parindex,childindex)" >{{itemk.spec_value}}</view>
|
|
|
<view class="weightlsititem" :class="item.selindex==childindex?'witemactive':''" v-for="(itemk,childindex) in item.spec_value"
|
|
|
:key="childindex" @click.stop="selspec(parindex,childindex)">{{itemk.spec_value}}</view>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
...
|
...
|
@@ -214,65 +236,109 @@ |
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
footersel:1,
|
|
|
footersel: 1,
|
|
|
sel: 2,
|
|
|
shuwrap:false,
|
|
|
goodid:'',
|
|
|
type:"", //type 1 面访商城 2 积分商城
|
|
|
goodtail:'',
|
|
|
tapnavactive:'',
|
|
|
selnav:1,
|
|
|
shuwrap: false,
|
|
|
goodid: '',
|
|
|
type: "", //type 1 面访商城 2 积分商城
|
|
|
goodtail: '',
|
|
|
tapnavactive: '',
|
|
|
selnav: 1,
|
|
|
|
|
|
// 商品规格
|
|
|
specarr:[],
|
|
|
specarr: [],
|
|
|
// 商品规格id
|
|
|
spec_sku_id:[],
|
|
|
addtype:'',//1 加入购物车 2立即购买
|
|
|
cartnumber:1,
|
|
|
arr:[],
|
|
|
spec_sku_id: [],
|
|
|
addtype: '', //1 加入购物车 2立即购买
|
|
|
cartnumber: 1,
|
|
|
arr: [],
|
|
|
page:1,
|
|
|
star_type:'',
|
|
|
// 评论列表
|
|
|
commentlist:[]
|
|
|
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
console.log(options)
|
|
|
this.goodid=options.id,
|
|
|
this.type=options.type;
|
|
|
if(this.type==1){
|
|
|
this.goodid = options.id,
|
|
|
this.type = options.type;
|
|
|
if (this.type == 1) {
|
|
|
this.getgoodtail();
|
|
|
}else{
|
|
|
} else if (this.type == 2) {
|
|
|
this.getjifengoodtail();
|
|
|
} else {
|
|
|
this.getshopgoodtail()
|
|
|
}
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
hideshu(){
|
|
|
this.shuwrap=false
|
|
|
hideshu() {
|
|
|
this.shuwrap = false
|
|
|
},
|
|
|
// 评论切换
|
|
|
commenttype(e){
|
|
|
this.star_type=e.currentTarget.dataset.id;
|
|
|
},
|
|
|
// 顶部导航切换
|
|
|
navtap(e){
|
|
|
this.selnav=e.currentTarget.dataset.id
|
|
|
navtap(e) {
|
|
|
this.selnav = e.currentTarget.dataset.id;
|
|
|
if(this.selnav==1){
|
|
|
if (this.type == 1) {
|
|
|
this.getgoodtail();
|
|
|
} else if (this.type == 2) {
|
|
|
this.getjifengoodtail();
|
|
|
} else {
|
|
|
this.getshopgoodtail()
|
|
|
}
|
|
|
}else{
|
|
|
this.page=1;
|
|
|
this.commentlist=[];
|
|
|
this.getcommentlist();
|
|
|
}
|
|
|
},
|
|
|
// 数量加减
|
|
|
reducenum(){
|
|
|
this.cartnumber=this.cartnumber-1;
|
|
|
if(this.cartnumber==0){
|
|
|
reducenum() {
|
|
|
this.cartnumber = this.cartnumber - 1;
|
|
|
if (this.cartnumber == 0) {
|
|
|
uni.showToast({
|
|
|
title:'不能再减少了',
|
|
|
icon:"none"
|
|
|
title: '不能再减少了',
|
|
|
icon: "none"
|
|
|
})
|
|
|
this.cartnumber=1
|
|
|
}else{
|
|
|
this.cartnumber=this.cartnumber
|
|
|
this.cartnumber = 1
|
|
|
} else {
|
|
|
this.cartnumber = this.cartnumber
|
|
|
}
|
|
|
|
|
|
},
|
|
|
addnum(){
|
|
|
this.cartnumber=this.cartnumber+1;
|
|
|
addnum() {
|
|
|
this.cartnumber = this.cartnumber + 1;
|
|
|
console.log(this.cartnumber)
|
|
|
this.cartnumber=this.cartnumber
|
|
|
this.cartnumber = this.cartnumber
|
|
|
},
|
|
|
|
|
|
// 获取评论列表
|
|
|
getcommentlist(){
|
|
|
let that = this;
|
|
|
var url = 'goods_comments/get_list';
|
|
|
var params = {
|
|
|
type:that.type,
|
|
|
goods_id:that.goodid,
|
|
|
star_type:that.star_type,
|
|
|
page:that.page,
|
|
|
pageNum:10
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.commentlist=that.commentlist.concat(res.data.data)
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//获取面坊商品详情
|
|
|
getgoodtail(){
|
|
|
getgoodtail() {
|
|
|
let that = this;
|
|
|
var url = 'flour_goods/get_flour_goods_detail';
|
|
|
var params = {
|
...
|
...
|
@@ -280,15 +346,14 @@ |
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.goodtail=res.data.data
|
|
|
that.goodtail = res.data.data
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
// 获取积分商城商品详情
|
|
|
getjifengoodtail(){
|
|
|
|
|
|
getjifengoodtail() {
|
|
|
let that = this;
|
|
|
var url = 'score_goods/get_score_goods_detail';
|
|
|
var params = {
|
...
|
...
|
@@ -297,27 +362,43 @@ |
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.goodtail=res.data.data
|
|
|
that.goodtail = res.data.data
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
|
|
|
})
|
|
|
},
|
|
|
// 获取店铺商品详情
|
|
|
getshopgoodtail() {
|
|
|
let that = this;
|
|
|
var url = 'store_goods/get_store_goods_detail';
|
|
|
var params = {
|
|
|
store_goods_id: that.goodid,
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.goodtail = res.data.data
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
},
|
|
|
// 加入购物车
|
|
|
addcart(){
|
|
|
this.shuwrap=true;
|
|
|
addcart() {
|
|
|
this.shuwrap = true;
|
|
|
this.getspecs();
|
|
|
this.addtype=1
|
|
|
this.addtype = 1
|
|
|
},
|
|
|
// 立即购买
|
|
|
buynow(){
|
|
|
this.shuwrap=true;
|
|
|
buynow() {
|
|
|
this.shuwrap = true;
|
|
|
this.getspecs();
|
|
|
this.addtype=2
|
|
|
this.addtype = 2
|
|
|
},
|
|
|
//获取商品规格
|
|
|
getspecs(){
|
|
|
getspecs() {
|
|
|
let that = this;
|
|
|
var url = 'score_goods/get_spec_sku1';
|
|
|
var params = {
|
...
|
...
|
@@ -326,104 +407,104 @@ |
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.specarr=res.data.data;
|
|
|
that.specarr.forEach(function(value,index,array){
|
|
|
value.selindex=0;
|
|
|
that.specarr = res.data.data;
|
|
|
that.specarr.forEach(function(value, index, array) {
|
|
|
value.selindex = 0;
|
|
|
|
|
|
value.spec_value.forEach(function(valuek,indexk,arrayk){
|
|
|
if(indexk==0){
|
|
|
value.selid=valuek.id;
|
|
|
value.spec_value.forEach(function(valuek, indexk, arrayk) {
|
|
|
if (indexk == 0) {
|
|
|
value.selid = valuek.id;
|
|
|
}
|
|
|
valuek.sel=false
|
|
|
valuek.sel = false
|
|
|
})
|
|
|
})
|
|
|
|
|
|
that.specarr=that.specarr;
|
|
|
that.specarr = that.specarr;
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
},
|
|
|
// 选择商品规格
|
|
|
selspec(parindex,childindex){
|
|
|
let newspecarr=this.specarr;
|
|
|
selspec(parindex, childindex) {
|
|
|
let newspecarr = this.specarr;
|
|
|
|
|
|
newspecarr[parindex].spec_value[childindex].sel=!newspecarr[parindex].spec_value[childindex].sel;
|
|
|
newspecarr[parindex].selindex=childindex;
|
|
|
newspecarr[parindex].selid=newspecarr[parindex].spec_value[childindex].id
|
|
|
newspecarr[parindex].spec_value[childindex].sel = !newspecarr[parindex].spec_value[childindex].sel;
|
|
|
newspecarr[parindex].selindex = childindex;
|
|
|
newspecarr[parindex].selid = newspecarr[parindex].spec_value[childindex].id
|
|
|
this.arr.push(newspecarr[parindex].spec_value[childindex].id);
|
|
|
// console.log(this.spec_sku_id)
|
|
|
this.specarr=newspecarr;
|
|
|
this.specarr = newspecarr;
|
|
|
|
|
|
// console.log(this.specarr[parindex].spec_value[childindex].sel)
|
|
|
console.log(JSON.stringify(this.specarr))
|
|
|
this.changspec()
|
|
|
},
|
|
|
// 更换商品的图片和价格
|
|
|
changspec(){
|
|
|
changspec() {
|
|
|
let that = this;
|
|
|
let newspec_sku_id=[]
|
|
|
let newspec_sku_id = []
|
|
|
|
|
|
that.specarr.forEach(function(value,index,array){
|
|
|
that.specarr.forEach(function(value, index, array) {
|
|
|
newspec_sku_id.push(value.selid)
|
|
|
})
|
|
|
that.spec_sku_id=newspec_sku_id
|
|
|
that.spec_sku_id = newspec_sku_id
|
|
|
var url = 'score_goods/get_spec_sku2';
|
|
|
var params = {
|
|
|
score_goods_id:that.goodid,
|
|
|
spec_sku_id:that.spec_sku_id.join("_")
|
|
|
score_goods_id: that.goodid,
|
|
|
spec_sku_id: that.spec_sku_id.join("_")
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
if(that.type==1){
|
|
|
that.goodtail.flour_goods_spec=res.data.data;
|
|
|
that.goodtail.price=res.data.data.price;
|
|
|
}else if(that.type==2){
|
|
|
that.goodtail.score_goods_spec=res.data.data
|
|
|
if (that.type == 1) {
|
|
|
that.goodtail.flour_goods_spec = res.data.data;
|
|
|
that.goodtail.price = res.data.data.price;
|
|
|
} else if (that.type == 2) {
|
|
|
that.goodtail.score_goods_spec = res.data.data
|
|
|
}
|
|
|
that.goodtail=that.goodtail;
|
|
|
that.goodtail = that.goodtail;
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
|
|
|
})
|
|
|
},
|
|
|
sure(){
|
|
|
if(this.addtype==1){
|
|
|
sure() {
|
|
|
if (this.addtype == 1) {
|
|
|
this.addcartk();
|
|
|
}else{
|
|
|
} else {
|
|
|
this.buynowk()
|
|
|
}
|
|
|
},
|
|
|
// 加入购物车
|
|
|
addcartk(){
|
|
|
addcartk() {
|
|
|
let that = this;
|
|
|
let newspec_sku_id=[]
|
|
|
let newspec_sku_id = []
|
|
|
|
|
|
that.specarr.forEach(function(value,index,array){
|
|
|
that.specarr.forEach(function(value, index, array) {
|
|
|
newspec_sku_id.push(value.selid)
|
|
|
})
|
|
|
that.spec_sku_id=newspec_sku_id
|
|
|
that.spec_sku_id = newspec_sku_id
|
|
|
var url = 'car/join_car';
|
|
|
var params = {
|
|
|
type:this.type,
|
|
|
goods_id:this.goodid,
|
|
|
spec_sku_id:that.spec_sku_id.join("_"),
|
|
|
type: this.type,
|
|
|
goods_id: this.goodid,
|
|
|
spec_sku_id: that.spec_sku_id.join("_"),
|
|
|
number: that.cartnumber,
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
uni.showToast({
|
|
|
title:"加入购物车成功",
|
|
|
icon:'none'
|
|
|
title: "加入购物车成功",
|
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
setTimeout(function(){
|
|
|
setTimeout(function() {
|
|
|
uni.navigateTo({
|
|
|
url:'/pages/nearshop/cartlist'
|
|
|
url: '/pages/nearshop/cartlist'
|
|
|
})
|
|
|
},1500)
|
|
|
}, 1500)
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
...
|
...
|
@@ -432,20 +513,20 @@ |
|
|
})
|
|
|
},
|
|
|
// 立即购买
|
|
|
buynowk(){
|
|
|
buynowk() {
|
|
|
let that = this;
|
|
|
let newspec_sku_id=[]
|
|
|
let newspec_sku_id = []
|
|
|
|
|
|
that.specarr.forEach(function(value,index,array){
|
|
|
that.specarr.forEach(function(value, index, array) {
|
|
|
newspec_sku_id.push(value.selid)
|
|
|
})
|
|
|
that.spec_sku_id=newspec_sku_id
|
|
|
that.spec_sku_id = newspec_sku_id
|
|
|
|
|
|
var url = 'car/join_car';
|
|
|
var params = {
|
|
|
type:this.type,
|
|
|
goods_id:this.goodid,
|
|
|
spec_sku_id:that.spec_sku_id.join(","),
|
|
|
type: this.type,
|
|
|
goods_id: this.goodid,
|
|
|
spec_sku_id: that.spec_sku_id.join(","),
|
|
|
number: that.cartnumber,
|
|
|
}
|
|
|
console.log(params)
|
...
|
...
|
|