|
|
@ -1,260 +1,157 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<!-- 商品详情 -->
|
|
|
|
<!-- 商品详情页面容器 -->
|
|
|
|
<view class="container">
|
|
|
|
<view class="container">
|
|
|
|
<!-- 轮播图 -->
|
|
|
|
<!-- 轮播图组件,用于展示商品图片 -->
|
|
|
|
<swiper
|
|
|
|
<swiper :indicator-dots="indicatorDots" <!-- 是否显示指示点 -->
|
|
|
|
:indicator-dots="indicatorDots"
|
|
|
|
:autoplay="autoplay" <!-- 是否自动播放 -->
|
|
|
|
:autoplay="autoplay"
|
|
|
|
:indicator-color="indicatorColor" <!-- 未选中指示点的颜色 -->
|
|
|
|
:indicator-color="indicatorColor"
|
|
|
|
:interval="interval" <!-- 自动切换时间间隔 -->
|
|
|
|
:interval="interval"
|
|
|
|
:duration="duration" <!-- 滑动动画时长 -->
|
|
|
|
:duration="duration"
|
|
|
|
:indicator-active-color="indicatorActiveColor" <!-- 当前选中指示点颜色 -->
|
|
|
|
:indicator-active-color="indicatorActiveColor"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<!-- 循环生成轮播项 -->
|
|
|
|
<block
|
|
|
|
<block v-for="(item, index) in imgs" :key="index">
|
|
|
|
v-for="(item, index) in imgs"
|
|
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<swiper-item>
|
|
|
|
<swiper-item>
|
|
|
|
<image :src="item" />
|
|
|
|
<image :src="item" /> <!-- 显示每一张商品图片 -->
|
|
|
|
</swiper-item>
|
|
|
|
</swiper-item>
|
|
|
|
</block>
|
|
|
|
</block>
|
|
|
|
</swiper>
|
|
|
|
</swiper>
|
|
|
|
<!-- end 轮播图 -->
|
|
|
|
<!-- end 轮播图 -->
|
|
|
|
<!-- 商品信息 -->
|
|
|
|
<!-- 商品信息展示区 -->
|
|
|
|
<view class="prod-info">
|
|
|
|
<view class="prod-info">
|
|
|
|
|
|
|
|
<!-- 标题与收藏按钮 -->
|
|
|
|
<view class="tit-wrap">
|
|
|
|
<view class="tit-wrap">
|
|
|
|
<view class="prod-tit">
|
|
|
|
<view class="prod-tit">{{ prodName }}</view> <!-- 商品名称 -->
|
|
|
|
{{ prodName }}
|
|
|
|
<view class="col" @tap="addOrCannelCollection">
|
|
|
|
</view>
|
|
|
|
<!-- 收藏/取消收藏按钮 -->
|
|
|
|
<view
|
|
|
|
<image v-if="!isCollection" src="@/static/images/icon/prod-col.png" /> <!-- 未收藏图标 -->
|
|
|
|
class="col"
|
|
|
|
<image v-if="isCollection" src="@/static/images/icon/prod-col-red.png" /> <!-- 已收藏图标 -->
|
|
|
|
@tap="addOrCannelCollection"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<image
|
|
|
|
|
|
|
|
v-if="!isCollection"
|
|
|
|
|
|
|
|
src="@/static/images/icon/prod-col.png"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<image
|
|
|
|
|
|
|
|
v-if="isCollection"
|
|
|
|
|
|
|
|
src="@/static/images/icon/prod-col-red.png"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
收藏
|
|
|
|
收藏
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="sales-p">
|
|
|
|
<view class="sales-p">{{ brief }}</view> <!-- 商品简短描述 -->
|
|
|
|
{{ brief }}
|
|
|
|
<!-- 商品价格信息 -->
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="prod-price">
|
|
|
|
<view class="prod-price">
|
|
|
|
<text
|
|
|
|
<text v-if="defaultSku && defaultSku.price" class="price">
|
|
|
|
v-if="defaultSku && defaultSku.price"
|
|
|
|
<!-- 当前售价 -->
|
|
|
|
class="price"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
¥
|
|
|
|
¥
|
|
|
|
<text class="price-num">
|
|
|
|
<text class="price-num">{{ wxs.parsePrice(defaultSku.price)[0] }}</text> <!-- 整数部分 -->
|
|
|
|
{{ wxs.parsePrice(defaultSku.price)[0] }}
|
|
|
|
.{{ wxs.parsePrice(defaultSku.price)[1] }} <!-- 小数部分 -->
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
.{{ wxs.parsePrice(defaultSku.price)[1] }}
|
|
|
|
<text v-if="defaultSku && defaultSku.oriPrice" class="ori-price">
|
|
|
|
</text>
|
|
|
|
<!-- 原价 -->
|
|
|
|
<text
|
|
|
|
|
|
|
|
v-if="defaultSku && defaultSku.oriPrice"
|
|
|
|
|
|
|
|
class="ori-price"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
¥{{ wxs.parsePrice(defaultSku.oriPrice)[0] }}.{{ wxs.parsePrice(defaultSku.oriPrice)[1] }}
|
|
|
|
¥{{ wxs.parsePrice(defaultSku.oriPrice)[0] }}.{{ wxs.parsePrice(defaultSku.oriPrice)[1] }}
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
<text class="sales" />
|
|
|
|
<text class="sales"></text> <!-- 销量等其他信息预留 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 已选规格 -->
|
|
|
|
|
|
|
|
<view
|
|
|
|
<!-- 已选规格展示 -->
|
|
|
|
class="sku"
|
|
|
|
<view class="sku" @tap="showSku">
|
|
|
|
@tap="showSku"
|
|
|
|
<view class="sku-tit">已选</view>
|
|
|
|
>
|
|
|
|
<view class="sku-con">{{ selectedProp.length > 0 ? selectedProp + ',' : '' }}{{ prodNum }}件</view> <!-- 展示已选择的规格和数量 -->
|
|
|
|
<view class="sku-tit">
|
|
|
|
<view class="more">...</view> <!-- 更多选项提示 -->
|
|
|
|
已选
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="sku-con">
|
|
|
|
|
|
|
|
{{ selectedProp.length > 0 ? selectedProp + ',' : '' }}{{ prodNum }}件
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="more">
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 评价 -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 评价区域 -->
|
|
|
|
<view class="cmt-wrap">
|
|
|
|
<view class="cmt-wrap">
|
|
|
|
<view
|
|
|
|
<!-- 评价标题 -->
|
|
|
|
class="cmt-tit"
|
|
|
|
<view class="cmt-tit" @tap="showComment">
|
|
|
|
@tap="showComment"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="cmt-t">
|
|
|
|
<view class="cmt-t">
|
|
|
|
评价
|
|
|
|
评价
|
|
|
|
<text class="cmt-good">
|
|
|
|
<text class="cmt-good">好评{{ prodCommData.positiveRating }}%</text> <!-- 好评率 -->
|
|
|
|
好评{{ prodCommData.positiveRating }}%
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="cmt-count">
|
|
|
|
|
|
|
|
共{{ prodCommData.number }}条
|
|
|
|
|
|
|
|
<text class="cmt-more" />
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="cmt-count">共{{ prodCommData.number }}条<text class="cmt-more"></text></view> <!-- 评价总数 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 评价标签和列表 -->
|
|
|
|
<view class="cmt-cont">
|
|
|
|
<view class="cmt-cont">
|
|
|
|
<view
|
|
|
|
<view class="cmt-tag" @tap="showComment">
|
|
|
|
class="cmt-tag"
|
|
|
|
|
|
|
|
@tap="showComment"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<text>全部({{ prodCommData.number }})</text>
|
|
|
|
<text>全部({{ prodCommData.number }})</text>
|
|
|
|
<text>好评({{ prodCommData.praiseNumber }})</text>
|
|
|
|
<text>好评({{ prodCommData.praiseNumber }})</text>
|
|
|
|
<text>中评({{ prodCommData.secondaryNumber }})</text>
|
|
|
|
<text>中评({{ prodCommData.secondaryNumber }})</text>
|
|
|
|
<text>差评({{ prodCommData.negativeNumber }})</text>
|
|
|
|
<text>差评({{ prodCommData.negativeNumber }})</text>
|
|
|
|
<text>有图({{ prodCommData.picNumber }})</text>
|
|
|
|
<text>有图({{ prodCommData.picNumber }})</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 评价内容列表 -->
|
|
|
|
<view class="cmt-items">
|
|
|
|
<view class="cmt-items">
|
|
|
|
<view
|
|
|
|
<view v-for="(item, index) in littleCommPage" :key="index" class="cmt-item">
|
|
|
|
v-for="(item, index) in littleCommPage"
|
|
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
|
|
class="cmt-item"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="cmt-user">
|
|
|
|
<view class="cmt-user">
|
|
|
|
<text class="date">
|
|
|
|
<text class="date">{{ item.recTime }}</text> <!-- 评价时间 -->
|
|
|
|
{{ item.recTime }}
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<view class="cmt-user-info">
|
|
|
|
<view class="cmt-user-info">
|
|
|
|
<image
|
|
|
|
<image class="user-img" :src="item.pic" /> <!-- 用户头像 -->
|
|
|
|
class="user-img"
|
|
|
|
<view class="nickname">{{ item.nickName }}</view> <!-- 用户昵称 -->
|
|
|
|
:src="item.pic"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<view class="nickname">
|
|
|
|
|
|
|
|
{{ item.nickName }}
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="cmt-cnt">
|
|
|
|
<view class="cmt-cnt">{{ item.content }}</view> <!-- 评价内容 -->
|
|
|
|
{{ item.content }}
|
|
|
|
<!-- 如果有图片,则显示图片滚动视图 -->
|
|
|
|
</view>
|
|
|
|
<scroll-view v-if="item.pics.length" class="cmt-attr" scroll-x="true">
|
|
|
|
<scroll-view
|
|
|
|
<image v-for="(commPic, index2) in item.pics" :key="index2" :src="commPic" />
|
|
|
|
v-if="item.pics.length"
|
|
|
|
|
|
|
|
class="cmt-attr"
|
|
|
|
|
|
|
|
scroll-x="true"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<image
|
|
|
|
|
|
|
|
v-for="(commPic, index2) in item.pics"
|
|
|
|
|
|
|
|
:key="index2"
|
|
|
|
|
|
|
|
:src="commPic"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</scroll-view>
|
|
|
|
</scroll-view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
<!-- 如果评价超过2条,显示查看更多 -->
|
|
|
|
v-if="prodCommPage.records.length > 2"
|
|
|
|
<view v-if="prodCommPage.records.length > 2" class="cmt-more-v">
|
|
|
|
class="cmt-more-v"
|
|
|
|
<text @tap="showComment">查看全部评价</text>
|
|
|
|
>
|
|
|
|
|
|
|
|
<text @tap="showComment">
|
|
|
|
|
|
|
|
查看全部评价
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 商品详情 -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 商品详情内容 -->
|
|
|
|
<view class="prod-detail">
|
|
|
|
<view class="prod-detail">
|
|
|
|
<view>
|
|
|
|
<view>
|
|
|
|
<rich-text :nodes="content" />
|
|
|
|
<rich-text :nodes="content"></rich-text> <!-- 使用富文本渲染商品详情 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- end 商品详情 -->
|
|
|
|
<!-- end 商品详情 -->
|
|
|
|
|
|
|
|
<!-- 底部操作栏 -->
|
|
|
|
<!-- 底部按钮 -->
|
|
|
|
|
|
|
|
<view class="cart-footer">
|
|
|
|
<view class="cart-footer">
|
|
|
|
<view
|
|
|
|
<!-- 首页按钮 -->
|
|
|
|
class="btn icon"
|
|
|
|
<view class="btn icon" @tap="toHomePage">
|
|
|
|
@tap="toHomePage"
|
|
|
|
<image src="@/static/images/tabbar/homepage.png" />首页
|
|
|
|
>
|
|
|
|
|
|
|
|
<image src="@/static/images/tabbar/homepage.png" />
|
|
|
|
|
|
|
|
首页
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
class="btn icon"
|
|
|
|
|
|
|
|
@tap="toCartPage"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<image src="@/static/images/tabbar/basket.png" />
|
|
|
|
|
|
|
|
购物车
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
v-if="totalCartNum>0"
|
|
|
|
|
|
|
|
class="badge badge-1"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ totalCartNum }}
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
<!-- 购物车按钮 -->
|
|
|
|
class="btn cart"
|
|
|
|
<view class="btn icon" @tap="toCartPage">
|
|
|
|
@tap="showSku"
|
|
|
|
<image src="@/static/images/tabbar/basket.png" />购物车
|
|
|
|
>
|
|
|
|
<view v-if="totalCartNum>0" class="badge badge-1">{{ totalCartNum }}</view> <!-- 购物车商品数量 -->
|
|
|
|
<text>加入购物车</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
class="btn buy"
|
|
|
|
|
|
|
|
@tap="showSku"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<text>立即购买</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 加入购物车按钮 -->
|
|
|
|
|
|
|
|
<view class="btn cart" @tap="showSku"><text>加入购物车</text></view>
|
|
|
|
|
|
|
|
<!-- 立即购买按钮 -->
|
|
|
|
|
|
|
|
<view class="btn buy" @tap="showSku"><text>立即购买</text></view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- end 底部按钮 -->
|
|
|
|
<!-- end 底部按钮 -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 规格弹窗 -->
|
|
|
|
<!-- 规格弹窗 -->
|
|
|
|
<view
|
|
|
|
<view v-if="skuShow" class="pup-sku">
|
|
|
|
v-if="skuShow"
|
|
|
|
|
|
|
|
class="pup-sku"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="pup-sku-main">
|
|
|
|
<view class="pup-sku-main">
|
|
|
|
|
|
|
|
<!-- 弹窗头部 -->
|
|
|
|
<view class="pup-sku-header">
|
|
|
|
<view class="pup-sku-header">
|
|
|
|
<image
|
|
|
|
<image class="pup-sku-img" :src="defaultSku.pic?defaultSku.pic:pic" /> <!-- 商品图片 -->
|
|
|
|
class="pup-sku-img"
|
|
|
|
|
|
|
|
:src="defaultSku.pic?defaultSku.pic:pic"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<view class="pup-sku-price">
|
|
|
|
<view class="pup-sku-price">
|
|
|
|
|
|
|
|
<!-- 商品价格 -->
|
|
|
|
¥
|
|
|
|
¥
|
|
|
|
<text
|
|
|
|
<text v-if="defaultSku && defaultSku.price" class="pup-sku-price-int">{{ wxs.parsePrice(defaultSku.price)[0] }}</text>
|
|
|
|
v-if="defaultSku && defaultSku.price"
|
|
|
|
|
|
|
|
class="pup-sku-price-int"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ wxs.parsePrice(defaultSku.price)[0] }}
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
.{{ wxs.parsePrice(defaultSku.price)[1] }}
|
|
|
|
.{{ wxs.parsePrice(defaultSku.price)[1] }}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="pup-sku-prop">
|
|
|
|
<view class="pup-sku-prop">
|
|
|
|
<text>已选</text>
|
|
|
|
<!-- 已选规格 -->
|
|
|
|
{{ selectedProp.length > 0 ? selectedProp + ',' : '' }}{{ prodNum }}件
|
|
|
|
<text>已选</text>{{ selectedProp.length > 0 ? selectedProp + ',' : '' }}{{ prodNum }}件
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
<view class="close" @tap="closePopup"></view> <!-- 关闭按钮 -->
|
|
|
|
class="close"
|
|
|
|
|
|
|
|
@tap="closePopup"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 弹窗主体 -->
|
|
|
|
<view class="pup-sku-body">
|
|
|
|
<view class="pup-sku-body">
|
|
|
|
|
|
|
|
<!-- 规格选择区 -->
|
|
|
|
<view class="pup-sku-area">
|
|
|
|
<view class="pup-sku-area">
|
|
|
|
<view
|
|
|
|
<view v-if="skuList.length" class="sku-box">
|
|
|
|
v-if="skuList.length"
|
|
|
|
<block v-for="(skuGroupItem, skuGroupItemIndex) in skuGroupList" :key="skuGroupItemIndex">
|
|
|
|
class="sku-box"
|
|
|
|
<view v-for="(skuLine, key) in skuGroupItem" :key="key" class="items sku-text">
|
|
|
|
>
|
|
|
|
<text class="sku-kind">{{ key }}</text> <!-- 规格类型 -->
|
|
|
|
<block
|
|
|
|
|
|
|
|
v-for="(skuGroupItem, skuGroupItemIndex) in skuGroupList"
|
|
|
|
|
|
|
|
:key="skuGroupItemIndex"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
v-for="(skuLine, key) in skuGroupItem"
|
|
|
|
|
|
|
|
:key="key"
|
|
|
|
|
|
|
|
class="items sku-text"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<text class="sku-kind">
|
|
|
|
|
|
|
|
{{ key }}
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<view class="con">
|
|
|
|
<view class="con">
|
|
|
|
<text
|
|
|
|
<!-- 循环展示每一个规格选项 -->
|
|
|
|
v-for="skuLineItem in skuLine"
|
|
|
|
<text v-for="skuLineItem in skuLine" :key="skuLineItem" class="sku-choose-item"
|
|
|
|
:key="skuLineItem"
|
|
|
|
|
|
|
|
class="sku-choose-item"
|
|
|
|
|
|
|
|
:class="[selectedPropList.indexOf(key + ':' + skuLineItem) !== -1?'active':'',
|
|
|
|
:class="[selectedPropList.indexOf(key + ':' + skuLineItem) !== -1?'active':'',
|
|
|
|
isSkuLineItemNotOptional(allProperties,selectedPropObj,key,skuLineItem,propKeys)? 'dashed' : '']"
|
|
|
|
isSkuLineItemNotOptional(allProperties,selectedPropObj,key,skuLineItem,propKeys)? 'dashed' : '']"
|
|
|
|
@click="toChooseItem(skuGroupItemIndex, skuLineItem, key)"
|
|
|
|
@click="toChooseItem(skuGroupItemIndex, skuLineItem, key)">
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ skuLineItem }}
|
|
|
|
{{ skuLineItem }}
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -262,167 +159,148 @@
|
|
|
|
</block>
|
|
|
|
</block>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 数量选择 -->
|
|
|
|
<view class="pup-sku-count">
|
|
|
|
<view class="pup-sku-count">
|
|
|
|
<view class="num-wrap">
|
|
|
|
<view class="num-wrap">
|
|
|
|
<view
|
|
|
|
<view class="minus" @tap="onCountMinus"><text class="row"></text></view> <!-- 减少数量 -->
|
|
|
|
class="minus"
|
|
|
|
<view class="text-wrap"><input type="number" :value="prodNum" disabled></view> <!-- 显示数量 -->
|
|
|
|
@tap="onCountMinus"
|
|
|
|
<view class="plus" @tap="onCountPlus"><text class="row"></text><text class="col"></text></view> <!-- 增加数量 -->
|
|
|
|
>
|
|
|
|
|
|
|
|
<text class="row" />
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="text-wrap">
|
|
|
|
<view class="count-name">数量</view>
|
|
|
|
<input
|
|
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
|
|
:value="prodNum"
|
|
|
|
|
|
|
|
disabled
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
|
|
|
|
class="plus"
|
|
|
|
|
|
|
|
@tap="onCountPlus"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<text class="row" />
|
|
|
|
|
|
|
|
<text class="col" />
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 弹窗底部 -->
|
|
|
|
|
|
|
|
<view class="pup-sku-footer">
|
|
|
|
|
|
|
|
<view class="btn cart" @tap="addToCart">加入购物车</view> <!-- 加入购物车按钮 -->
|
|
|
|
|
|
|
|
<view class="btn buy" @tap="buyNow">立即购买</view> <!-- 立即购买按钮 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="count-name">
|
|
|
|
|
|
|
|
数量
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 评价弹窗 -->
|
|
|
|
|
|
|
|
<view v-if="commentShow" class="cmt-popup">
|
|
|
|
|
|
|
|
<view class="cmt-tit">
|
|
|
|
|
|
|
|
<view class="cmt-t">
|
|
|
|
|
|
|
|
商品评价
|
|
|
|
|
|
|
|
<text class="cmt-good">好评度{{ prodCommData.positiveRating }}%</text> <!-- 好评率 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="pup-sku-footer">
|
|
|
|
<text class="close" @tap="closePopup"></text> <!-- 关闭按钮 -->
|
|
|
|
<view
|
|
|
|
|
|
|
|
class="btn cart"
|
|
|
|
|
|
|
|
@tap="addToCart"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
加入购物车
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
<view class="cmt-cont">
|
|
|
|
class="btn buy"
|
|
|
|
<!-- 评价筛选标签 -->
|
|
|
|
@tap="buyNow"
|
|
|
|
<view class="cmt-tag">
|
|
|
|
>
|
|
|
|
<text data-evaluate="-1" :class="evaluate==-1?'selected':''" @tap="getProdCommPage">全部({{ prodCommData.number }})</text>
|
|
|
|
立即购买
|
|
|
|
<text data-evaluate="0" :class="evaluate==0?'selected':''" @tap="getProdCommPage">好评({{ prodCommData.praiseNumber }})</text>
|
|
|
|
|
|
|
|
<text data-evaluate="1" :class="evaluate==1?'selected':''" @tap="getProdCommPage">中评({{ prodCommData.secondaryNumber }})</text>
|
|
|
|
|
|
|
|
<text data-evaluate="2" :class="evaluate==2?'selected':''" @tap="getProdCommPage">差评({{ prodCommData.negativeNumber }})</text>
|
|
|
|
|
|
|
|
<text data-evaluate="3" :class="evaluate==3?'selected':''" @tap="getProdCommPage">有图({{ prodCommData.picNumber }})</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 评价内容列表 -->
|
|
|
|
|
|
|
|
<view class="cmt-items">
|
|
|
|
|
|
|
|
<block v-if="prodCommPage.records.length">
|
|
|
|
|
|
|
|
<view v-for="(item, index) in prodCommPage.records" :key="index" class="cmt-item">
|
|
|
|
|
|
|
|
<view class="cmt-user">
|
|
|
|
|
|
|
|
<text class="date">{{ item.recTime }}</text> <!-- 评价时间 -->
|
|
|
|
|
|
|
|
<view class="cmt-user-info">
|
|
|
|
|
|
|
|
<image class="user-img" :src="item.pic" /> <!-- 用户头像 -->
|
|
|
|
|
|
|
|
<view class="nickname">{{ item.nickName }}</view> <!-- 用户昵称 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="cmt-cnt">{{ item.content }}</view> <!-- 评价内容 -->
|
|
|
|
|
|
|
|
<!-- 如果有图片,则显示图片滚动视图 -->
|
|
|
|
|
|
|
|
<scroll-view v-if="item.pics.length" class="cmt-attr" scroll-x="true">
|
|
|
|
|
|
|
|
<image v-for="(commPic, index2) in item.pics" :key="index2" :src="commPic" />
|
|
|
|
|
|
|
|
</scroll-view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</block>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
<!-- 评价弹窗 -->
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
</view>
|
|
|
|
v-if="commentShow"
|
|
|
|
<!-- 评价弹窗组件,当commentShow为true时显示 -->
|
|
|
|
class="cmt-popup"
|
|
|
|
<view v-if="commentShow" class="cmt-popup">
|
|
|
|
>
|
|
|
|
<!-- 弹窗标题栏 -->
|
|
|
|
<view class="cmt-tit">
|
|
|
|
<view class="cmt-tit">
|
|
|
|
<view class="cmt-t">
|
|
|
|
<view class="cmt-t">
|
|
|
|
商品评价
|
|
|
|
商品评价 <!-- 标题文本 -->
|
|
|
|
<text class="cmt-good">
|
|
|
|
<text class="cmt-good">好评度{{ prodCommData.positiveRating }}%</text> <!-- 显示商品的好评率 -->
|
|
|
|
好评度{{ prodCommData.positiveRating }}%
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<text
|
|
|
|
<text class="close" @tap="closePopup" /> <!-- 关闭按钮,点击时调用closePopup方法关闭弹窗 -->
|
|
|
|
class="close"
|
|
|
|
|
|
|
|
@tap="closePopup"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 弹窗内容区 -->
|
|
|
|
<view class="cmt-cont">
|
|
|
|
<view class="cmt-cont">
|
|
|
|
|
|
|
|
<!-- 评价筛选标签 -->
|
|
|
|
<view class="cmt-tag">
|
|
|
|
<view class="cmt-tag">
|
|
|
|
<text
|
|
|
|
<!-- 动态生成评价筛选选项 -->
|
|
|
|
data-evaluate="-1"
|
|
|
|
<text data-evaluate="-1"
|
|
|
|
:class="evaluate == -1 ? 'selected' : ''"
|
|
|
|
:class="evaluate == -1 ? 'selected' : ''"
|
|
|
|
@tap="getProdCommPage"
|
|
|
|
@tap="getProdCommPage">
|
|
|
|
>
|
|
|
|
|
|
|
|
全部({{ prodCommData.number }})
|
|
|
|
全部({{ prodCommData.number }})
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
<text
|
|
|
|
<text data-evaluate="0"
|
|
|
|
data-evaluate="0"
|
|
|
|
|
|
|
|
:class="evaluate == 0 ? 'selected' : ''"
|
|
|
|
:class="evaluate == 0 ? 'selected' : ''"
|
|
|
|
@tap="getProdCommPage"
|
|
|
|
@tap="getProdCommPage">
|
|
|
|
>
|
|
|
|
|
|
|
|
好评({{ prodCommData.praiseNumber }})
|
|
|
|
好评({{ prodCommData.praiseNumber }})
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
<text
|
|
|
|
<text data-evaluate="1"
|
|
|
|
data-evaluate="1"
|
|
|
|
|
|
|
|
:class="evaluate == 1 ? 'selected' : ''"
|
|
|
|
:class="evaluate == 1 ? 'selected' : ''"
|
|
|
|
@tap="getProdCommPage"
|
|
|
|
@tap="getProdCommPage">
|
|
|
|
>
|
|
|
|
|
|
|
|
中评({{ prodCommData.secondaryNumber }})
|
|
|
|
中评({{ prodCommData.secondaryNumber }})
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
<text
|
|
|
|
<text data-evaluate="2"
|
|
|
|
data-evaluate="2"
|
|
|
|
|
|
|
|
:class="evaluate == 2 ? 'selected' : ''"
|
|
|
|
:class="evaluate == 2 ? 'selected' : ''"
|
|
|
|
@tap="getProdCommPage"
|
|
|
|
@tap="getProdCommPage">
|
|
|
|
>
|
|
|
|
|
|
|
|
差评({{ prodCommData.negativeNumber }})
|
|
|
|
差评({{ prodCommData.negativeNumber }})
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
<text
|
|
|
|
<text data-evaluate="3"
|
|
|
|
data-evaluate="3"
|
|
|
|
|
|
|
|
:class="evaluate == 3 ? 'selected' : ''"
|
|
|
|
:class="evaluate == 3 ? 'selected' : ''"
|
|
|
|
@tap="getProdCommPage"
|
|
|
|
@tap="getProdCommPage">
|
|
|
|
>
|
|
|
|
|
|
|
|
有图({{ prodCommData.picNumber }})
|
|
|
|
有图({{ prodCommData.picNumber }})
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<!-- 每个文本元素都有一个data-evaluate属性用于标识评价类型,并根据evaluate值来决定是否添加'selected'类名以高亮当前选中的筛选条件 -->
|
|
|
|
|
|
|
|
<!-- 点击任一文本元素时会触发getProdCommPage方法,加载对应的评价数据 -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 评价列表 -->
|
|
|
|
<view class="cmt-items">
|
|
|
|
<view class="cmt-items">
|
|
|
|
|
|
|
|
<!-- 如果存在评价记录,则循环渲染每个评价项 -->
|
|
|
|
<block v-if="prodCommPage.records.length">
|
|
|
|
<block v-if="prodCommPage.records.length">
|
|
|
|
<view
|
|
|
|
<view v-for="(item, index) in prodCommPage.records"
|
|
|
|
v-for="(item, index) in prodCommPage.records"
|
|
|
|
|
|
|
|
:key="index"
|
|
|
|
:key="index"
|
|
|
|
class="cmt-item"
|
|
|
|
class="cmt-item">
|
|
|
|
>
|
|
|
|
<!-- 用户信息 -->
|
|
|
|
<view class="cmt-user">
|
|
|
|
<view class="cmt-user">
|
|
|
|
<text class="date">
|
|
|
|
<text class="date">{{ item.recTime }}</text> <!-- 评价时间 -->
|
|
|
|
{{ item.recTime }}
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<view class="cmt-user-info">
|
|
|
|
<view class="cmt-user-info">
|
|
|
|
<image
|
|
|
|
<image class="user-img" :src="item.pic" /> <!-- 用户头像 -->
|
|
|
|
class="user-img"
|
|
|
|
<view class="nickname">{{ item.nickName }}</view> <!-- 用户昵称 -->
|
|
|
|
:src="item.pic"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<view class="nickname">
|
|
|
|
|
|
|
|
{{ item.nickName }}
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="cmt-cnt">
|
|
|
|
<!-- 评价内容 -->
|
|
|
|
{{ item.content }}
|
|
|
|
<view class="cmt-cnt">{{ item.content }}</view>
|
|
|
|
</view>
|
|
|
|
<!-- 如果评价中有图片,则展示图片滚动视图 -->
|
|
|
|
<scroll-view
|
|
|
|
<scroll-view v-if="item.pics.length" class="cmt-attr" scroll-x="true">
|
|
|
|
v-if="item.pics.length"
|
|
|
|
<image v-for="(commPic, index2) in item.pics"
|
|
|
|
class="cmt-attr"
|
|
|
|
|
|
|
|
scroll-x="true"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<image
|
|
|
|
|
|
|
|
v-for="(commPic, index2) in item.pics"
|
|
|
|
|
|
|
|
:key="index2"
|
|
|
|
:key="index2"
|
|
|
|
:src="commPic"
|
|
|
|
:src="commPic" />
|
|
|
|
/>
|
|
|
|
|
|
|
|
</scroll-view>
|
|
|
|
</scroll-view>
|
|
|
|
<view
|
|
|
|
<!-- 店铺回复,如果有的话 -->
|
|
|
|
v-if="item.replyContent"
|
|
|
|
<view v-if="item.replyContent" class="cmt-reply">
|
|
|
|
class="cmt-reply"
|
|
|
|
<text class="reply-tit">店铺回复:</text>
|
|
|
|
>
|
|
|
|
|
|
|
|
<text class="reply-tit">
|
|
|
|
|
|
|
|
店铺回复:
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
{{ item.replyContent }}
|
|
|
|
{{ item.replyContent }}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</block>
|
|
|
|
</block>
|
|
|
|
<view
|
|
|
|
<!-- 如果没有评价记录,则显示提示信息 -->
|
|
|
|
v-if="!prodCommPage.records.length"
|
|
|
|
<view v-if="!prodCommPage.records.length" class="empty">
|
|
|
|
class="empty"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
暂无评价
|
|
|
|
暂无评价
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view
|
|
|
|
|
|
|
|
v-if="prodCommPage.pages > prodCommPage.current"
|
|
|
|
<!-- 加载更多按钮,当还有未加载的评价页时显示 -->
|
|
|
|
class="load-more"
|
|
|
|
<view v-if="prodCommPage.pages > prodCommPage.current" class="load-more">
|
|
|
|
>
|
|
|
|
<text @tap="getMoreCommPage">点击加载更多</text> <!-- 点击时调用getMoreCommPage方法加载下一页评价 -->
|
|
|
|
<text @tap="getMoreCommPage">
|
|
|
|
|
|
|
|
点击加载更多
|
|
|
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|