yurong/.svn/pristine/5e/5e83ad1b1c36a501943b92d4806...

192 lines
5.8 KiB
Plaintext

<template>
<view>
<swiper class="w-750 h-478 bgf5f7ff br-20 relative one_overflow"
:interval="5000"
:autoplay="true">
<swiper-item v-for="(item,index) in shopDet.images" :key="index ">
<image :src="URL + item" class="w-750 h-500" mode="aspectFill"></image>
</swiper-item>
</swiper>
<view class="p-all-20 bgff">
<view class="rowsb rowsm">
<view class="fs-40 fw-600">{{ shopDet.price || '120' }}<text class="fs-26">农分</text></view>
<view class="fs-24 col999">销量:{{ shopDet.sales_volume || '599' }}</view>
</view>
<view class="fs-30 col333 pt-16 pb-18 two_overflow">{{ shopDet.name || '欧诗漫珍珠源沁白珍珠源沁白亮肤水' }}</view>
<view class="rows fs-24">
<view class="br-4" style="background: #ffeceb;padding: 6rpx 24rpx; color: #FA3326;">包邮</view>
</view>
</view>
<view class="mt-20 bgff w-710 ml-20 br-20">
<view class="rowsb rowsm h-100 pl-30 pr-30 fs-28">
<view class="col000 fw-600">商品评价</view>
<view @tap="goNext('allComment')" class="rows rowsm fs-22 col999">
<text>查看全部</text>
<uni-icons type="right" color="#999"></uni-icons>
</view>
</view>
<view v-if="comment && comment[0]">
<view class="pb-16" v-for="(item,index) in comment" :key="index">
<view class="rows rowsm pl-20 pr-20 pt-24 pb-16">
<image src="/static/wd_gr.png" class="h-68 w-68"></image>
<view class="fs-28 pl-20">王唤七</view>
</view>
<view class="pl-20 pr-20 fs-26 col333">我是评价信息,我是评价信息,我是评价信息,我是评价信息,我是评价信息,我是评价信息,我是评价信息。</view>
</view>
</view>
<view class="pt-130 pb-130 bgff tct fs-26 col999">暂无相关评论信息</view>
</view>
<view class="h-94 rowsc rowsm">
<view class="h-4 w-184 bgee"></view>
<text class="pl-20 pr-20 fs-26 col999">产品详情</text>
<view class="h-4 w-184 bgee"></view>
</view>
<image :src="URL + item" v-for="(item,index) in shopDet.detail_drawing_images" :key="index" class="w-750 " mode="widthFix"></image>
<view class="h-154 w-750"></view>
<view class="h-134 w-750 p-all-20 rowsb rowsm tct bgff fixed" style="bottom: 0;">
<view class="rows pl-20">
<view class="mr-50 tct">
<image src="/static/shoduyhgshd.png" class="w-38 h-38"></image>
<view class="fs-22 col666">首页</view>
</view>
<view @tap="goShoppingCat()" class="tct">
<image src="/static/shjouycjbsjdf.png" class="w-38 h-38"></image>
<view class="fs-22 col666">收藏</view>
</view>
</view>
<view @tap="goNext('confirmOrder')" class="w-476 h-96 rowsc rowsm br-48 colfff bg fs-28">立即兑换</view>
</view>
</view>
</template>
<script>
const app = getApp().globalData
export default {
data() {
return {
onIndex: 0,
selectIndex: 0,
onId: null, //商品ID
shopDet: {
spec: {
item: [{
stock: ''
}]
},
}, //商品详情
number: 1, //下单数量
comment: [], //商品评论
shopModel: 0, //下单类型 0=加入购物车 1=直接下单
mobile: '',
type: -1,
activeIndexArr: [],
}
},
onLoad(option) {
this.type = option.type
this.onId = option.id
this.getShopDet()
this.getComment()
},
computed: {
onSpec() {
let key = this.activeIndexArr.join('_')
if (key) {
return this.shopDet.spec.products[key]
}
return {}
},
specInfo() {
let goods = this.shopDet.spec
if (goods && goods.item) return goods.item
else return {}
},
isStock() { //判断是否有货
return this.specInfo.stock > 0
}
},
methods: {
swtichSpec(index,id) { //切换规格
this.$set(this.activeIndexArr, index, id)
},
numberChnge(value, index) { //修改下单数量
this.number = value
},
openPop(type) { //打开下单弹窗
this.shopModel = type
this.$refs.spec.open('bottom')
},
closePop() { //打开下单弹窗
this.$refs.spec.close('bottom')
},
ifModel() { //判断是加入购物车还是下单
this.$refs.spec.close()
if (this.shopModel === 0) {
this.getShopCatPush()
} else {
this.goConfirmOrder()
}
},
//加入购物车
getShopCatPush() {
this.$tools.axiosFromToken('POST', 'shop_cart/addCart', {
count: this.number,
skuId: this.onSpec.id
}).then(res => {
if (res.code == 1) {
this.$refs.spec.close()
this.$tools.showtt('加入购物车成功')
} else this.$tools.showtt(res.msg)
})
},
goConfirmOrder() { //确认订单
app.orderShop = this.shopDet
app.specInfo = this.onSpec
this.goNext(`confirmOrder?type=${this.type}&num=${this.number}`)
},
//页面跳转
goShoppingCat() { //购物车
this.$tools.goNext('/pages/me/pagesOne/cart/cart')
},
goCommentTap() { //全部评论
this.$tools.goNext(`/pagesOne/index/seckill/seckillComment/seckillComment?id=${this.onId}`)
},
// 网络请求
getShopDet() { //商品详情
this.$tools.axiosFromToken('POST', 'platform_mall/getDetails', {
id: this.onId
}, '加载中').then(res => {
this.shopDet = res.data || {}
this.activeIndexArr = new Array(res.data.spec.item.length)
res.data.spec.item.forEach((val,ind) => {
if (val.sku_items && val.sku_items[0]) {
this.activeIndexArr[ind] = val.sku_items[0].id
}
})
})
},
getComment() { //评论
this.$tools.axiosFromToken('POST', 'product/getGoodEvaluate', {
good_id: this.onId,
user_token: app.token
}, '加载中').then(res => {
this.comment = res.data
console.log(this.comment)
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f7f6fa;
}
.active {
background: #fff7f0;
color: #FF7000;
border: 2rpx solid #FF7000 !important;
}
</style>