feature/comment-0620-ch
ch 2 years ago
parent 8f0bc44425
commit dd0b6345d5

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-05 14:40:00 * @Date: 2022-05-05 14:40:00
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-22 17:26:10 * @LastEditTime: 2022-06-28 10:59:13
* @Description: 根据git分支生成对应环境的环境变量 * @Description: 根据git分支生成对应环境的环境变量
* 开发时如果环境变量换了可以不用重启服务直接运行node env.config.js即可 * 开发时如果环境变量换了可以不用重启服务直接运行node env.config.js即可
*/ */
@ -12,8 +12,8 @@ const path = require('path');
const envConfig = { const envConfig = {
dev : { dev : {
// baseUrl: 'https://you-gateway.mashibing.com', // baseUrl: 'https://you-gateway.mashibing.com',
// baseUrl: 'https://k8s-horse-gateway.mashibing.cn', baseUrl: 'https://k8s-horse-gateway.mashibing.cn',
baseUrl: '', // baseUrl: '',
staticUrl : 'https://k8s-shop-app.mashibing.cn', staticUrl : 'https://k8s-shop-app.mashibing.cn',
// imUrl : 'ws://192.168.10.94:8090' // imUrl : 'ws://192.168.10.94:8090'
imUrl : 'wss://k8s-horse-gateway.mashibing.cn' imUrl : 'wss://k8s-horse-gateway.mashibing.cn'

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 11:10:23 * @Date: 2022-06-20 11:10:23
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-22 18:05:27 * @LastEditTime: 2022-06-28 16:33:25
* @Description: file content * @Description: file content
*/ */
export default { export default {
@ -28,5 +28,6 @@ export default {
IS_DEFAULT_COMMENT: { IS_DEFAULT_COMMENT: {
YES: 1, YES: 1,
NOT : 0 NOT : 0
} },
RATE_LABEL : ['非常不满意','不满意','一般','满意','非常满意']
} }

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 17:42:32 * @Date: 2022-03-17 17:42:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-14 17:33:14 * @LastEditTime: 2022-06-28 11:38:02
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法 * @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/ */
@ -82,7 +82,6 @@ const clearRepeat = (option) =>{
// 不需要token的接口封装 // 不需要token的接口封装
const MsbRequest = new MsbUniRequest(); const MsbRequest = new MsbUniRequest();
console.log(process.env,'process.envprocess.envprocess.env');
MsbRequest.baseUrl = ENV.baseUrl; MsbRequest.baseUrl = ENV.baseUrl;
MsbRequest.use('request', (option) => { MsbRequest.use('request', (option) => {

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 14:30:45 * @Date: 2022-06-20 14:30:45
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 16:26:33 * @LastEditTime: 2022-06-28 14:45:00
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -47,11 +47,13 @@ export default {
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
white-space: nowrap; white-space: nowrap;
padding-right: 30rpx;
} }
&--footer{ &--footer{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-right: 30rpx;
} }
&--sku{ &--sku{
font-size: 24rpx; font-size: 24rpx;

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 15:50:01 * @Date: 2022-06-21 15:50:01
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-22 17:49:10 * @LastEditTime: 2022-06-28 11:30:06
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -23,6 +23,10 @@ export default {
commentDetail : { commentDetail : {
type : Object, type : Object,
default : () => ({}) default : () => ({})
},
imgPreview : {
type: Boolean,
default : true
} }
}, },
data:{ data:{
@ -36,6 +40,9 @@ export default {
}, },
methods:{ methods:{
preview(idx){ preview(idx){
if(!this.imgPreview){
return false
}
this.$store.commit('SET_COMMENT_PREVIEW', this.commentDetail); this.$store.commit('SET_COMMENT_PREVIEW', this.commentDetail);
this.$Router.push({ this.$Router.push({
path : '/goodsCommentPreview', path : '/goodsCommentPreview',

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 16:36:14 * @Date: 2022-06-20 16:36:14
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 16:56:09 * @LastEditTime: 2022-06-28 16:33:46
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -10,7 +10,7 @@
<view class="rate" v-if="type === COMMENT.TYPE.COMMENT"> <view class="rate" v-if="type === COMMENT.TYPE.COMMENT">
<text class="rate--title">满意度评分</text> <text class="rate--title">满意度评分</text>
<u-rate :count="5" v-model="rate" size="47rpx" activeColor="#FFA35B" inactiveColor="#DDD"></u-rate> <u-rate :count="5" v-model="rate" size="47rpx" activeColor="#FFA35B" inactiveColor="#DDD"></u-rate>
<text class="rate--desc">满意</text> <text class="rate--desc">{{rateDesc}}</text>
</view> </view>
<textarea class="textarea" placeholder="从多个维度评价,可以帮助更多想买的人哦~" <textarea class="textarea" placeholder="从多个维度评价,可以帮助更多想买的人哦~"
:maxlength="500" v-model="commentContent"></textarea> :maxlength="500" v-model="commentContent"></textarea>
@ -27,7 +27,7 @@
import UiButton from '@/components/UiButton.vue'; import UiButton from '@/components/UiButton.vue';
import {ApiPostComment} from '@/common/api/comment'; import {ApiPostComment} from '@/common/api/comment';
import COMMENT from '@/common/dicts/comment'; import COMMENT from '@/common/dicts/comment';
import {uploadFileOss} from '@/common/utils'; import {uploadFileOss, HandleApiError} from '@/common/utils';
export default { export default {
components: { UiButton }, components: { UiButton },
props:{ props:{
@ -43,7 +43,7 @@ export default {
data(){ data(){
return { return {
COMMENT, COMMENT,
rate : 0, rate : 5,
commentContent : '', commentContent : '',
fileList : [] fileList : []
} }
@ -51,13 +51,16 @@ export default {
computed:{ computed:{
isVerify(){ isVerify(){
if(this.type === COMMENT.TYPE.COMMENT){ if(this.type === COMMENT.TYPE.COMMENT){
return !this.rate; return !this.rate || !this.commentContent;
}else{ }else{
return !this.commentContent; return !this.commentContent;
} }
}, },
isEdit (){ isEdit (){
return (this.rate || this.commentContent || this.fileList.length > 0) ? true : false return (this.rate || this.commentContent || this.fileList.length > 0) ? true : false
},
rateDesc(){
return COMMENT.RATE_LABEL[this.rate-1];
} }
}, },
watch:{ watch:{
@ -80,11 +83,9 @@ export default {
data.originId = data.parentId = this.commentDetail.id; data.originId = data.parentId = this.commentDetail.id;
} }
const {error, result} = await ApiPostComment(data); const {error, result} = await ApiPostComment(data);
if(error){ if(!HandleApiError(error)){
uni.$u.toast(error.message); this.$emit('submit',result);
return false;
} }
this.$emit('submit',result);
}, },
async handleUpdateImg(val){ async handleUpdateImg(val){
const {error, result} = await uploadFileOss(val.file, { const {error, result} = await uploadFileOss(val.file, {

@ -62,16 +62,14 @@
"path": "pages/goods/comment/list", "path": "pages/goods/comment/list",
"aliasPath" : "/goodsCommentList", "aliasPath" : "/goodsCommentList",
"style": { "style": {
"navigationStyle" : "custom", "navigationBarTitleText": "全部评价"
"navigationBarTitleText": "马士兵严选"
} }
}, },
{ {
"path": "pages/goods/comment/otherList", "path": "pages/goods/comment/otherList",
"aliasPath" : "/goodsCommentOtherList", "aliasPath" : "/goodsCommentOtherList",
"style": { "style": {
"navigationStyle" : "custom", "navigationBarTitleText": "全部评价"
"navigationBarTitleText": "马士兵严选"
} }
}, },
{ {
@ -86,8 +84,7 @@
"path": "pages/goods/comment/detail", "path": "pages/goods/comment/detail",
"aliasPath" : "/goodsCommentDetail", "aliasPath" : "/goodsCommentDetail",
"style": { "style": {
"navigationStyle" : "custom", "navigationBarTitleText": "全部评价"
"navigationBarTitleText": "马士兵严选"
} }
}, },
{ {

@ -3,7 +3,7 @@
components: { UiCell },: ch components: { UiCell },: ch
* @Date: 2019-08-22 19:41:20 * @Date: 2019-08-22 19:41:20
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-24 09:58:19 * @LastEditTime: 2022-06-28 16:38:33
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -39,7 +39,7 @@
<view>待收货</view> <view>待收货</view>
</view> </view>
<view class="order-tabs--item" @click="$Router.push('/orderList?tab=5')"> <view class="order-tabs--item" @click="$Router.push('/orderList?tab=5')">
<u-badge class="item-badge" max="99" :value="statistic.deliveredCount"></u-badge> <u-badge class="item-badge" max="99" :value="statistic.waitComment"></u-badge>
<image class="item-icon" src="@/static/account/pj.png"/> <image class="item-icon" src="@/static/account/pj.png"/>
<view>待评价</view> <view>待评价</view>
</view> </view>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 18:19:13 * @Date: 2022-06-21 18:19:13
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 16:10:21 * @LastEditTime: 2022-06-28 16:21:32
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -11,7 +11,9 @@
<BsCommentUserInfo :userData="detail"/> <BsCommentUserInfo :userData="detail"/>
<BsCommentInfo :commentDetail="detail"/> <BsCommentInfo :commentDetail="detail"/>
<BsCommentFollowInfo v-if="detail.followComment" :followComment="detail.followComment" :commentTime="detail.createTime"/> <BsCommentFollowInfo v-if="detail.followComment" :followComment="detail.followComment" :commentTime="detail.createTime"/>
<BsCommentGoodsInfo class="goods-info" :goods="detail"/> <BsCommentGoodsInfo class="goods-info" :goods="detail" />
<!-- <u-icon slot="btns" name="shopping-cart" size="30" color="#FF875B"></u-icon> -->
<!-- </BsCommentGoodsInfo> -->
</view> </view>
<view class="reply-title">全部评论( {{answerCount}})</view> <view class="reply-title">全部评论( {{answerCount}})</view>
<view class="reply"> <view class="reply">
@ -29,17 +31,26 @@
<BsEmpty v-else tips="还没有人评论哦,快来抢沙发~"/> <BsEmpty v-else tips="还没有人评论哦,快来抢沙发~"/>
</view> </view>
<view class="footer"> <view class="footer">
<view v-if="!detail.followComment && detail.userId === $store.state.userInfo.id" <view class="footer--item" v-if="!detail.followComment && detail.userId === $store.state.userInfo.id"
@click="$Router.push(`/commentSubmitFollow?id=${commentId}`)">追评</view> @click="$Router.push(`/comment?commentId=${commentId}`)">
<view @click="isShowAnswer = true">评论</view> <u-icon name="chat" size="28rpx"></u-icon>
<view>有用</view> 追评
</view>
<view class="footer--item" @click="isShowAnswer = true">
<u-icon name="chat" size="28rpx"></u-icon>
评论
</view>
<view class="footer--item" :class="{'footer--item__active' : isLike}" @click="handleUseful">
<u-icon name="thumb-up" size="28rpx" :color="isLike ? '#FF875B' : ''"></u-icon>
有用<template v-if="detail.usefulCount">({{detail.usefulCount}})</template>
</view>
</view> </view>
<template v-if="isShowAnswer" > <template v-if="isShowAnswer" >
<view class="reply-comment--bg" @click="handleHideAnswer"></view> <view class="reply-comment--bg" @click="handleHideAnswer"></view>
<view class="reply-comment"> <view class="reply-comment">
<view class="reply-comment--box"> <view class="reply-comment--box">
<input class="reply-comment--input" maxlength="500" v-model="commentContent" :placeholder="placeholder" /> <input class="reply-comment--input" maxlength="500" v-model="commentContent" :placeholder="placeholder" />
<UiButton type="gradual" @click="handleSubmit"></UiButton> <UiButton type="gradual" :disable="!commentContent" @click="handleSubmit"></UiButton>
</view> </view>
</view> </view>
</template> </template>
@ -50,8 +61,8 @@ import BsCommentGoodsInfo from '../../../components/BsCommentGoodsInfo.vue'
import BsCommentInfo from '../../../components/BsCommentInfo.vue' import BsCommentInfo from '../../../components/BsCommentInfo.vue'
import BsCommentUserInfo from '../../../components/BsCommentUserInfo.vue' import BsCommentUserInfo from '../../../components/BsCommentUserInfo.vue'
import UiButton from '../../../components/UiButton.vue' import UiButton from '../../../components/UiButton.vue'
import {ApiGetCommentDetail, ApiPostComment} from '@/common/api/comment' import {ApiGetCommentDetail, ApiPostComment, ApiPutCommentUseful} from '@/common/api/comment'
import {HandleApiError} from '@/common/utils' import {HandleApiError, Debounce} from '@/common/utils'
import COMMENT from '@/common/dicts/comment' import COMMENT from '@/common/dicts/comment'
import BsEmpty from '../../../components/BsEmpty.vue' import BsEmpty from '../../../components/BsEmpty.vue'
import BsCommentFollowInfo from '../../../components/BsCommentFollowInfo.vue' import BsCommentFollowInfo from '../../../components/BsCommentFollowInfo.vue'
@ -63,7 +74,8 @@ export default {
answer : null, answer : null,
commentId : this.$Route.query.id, commentId : this.$Route.query.id,
detail : {}, detail : {},
commentContent : '' commentContent : '',
isLike : false
} }
}, },
computed:{ computed:{
@ -85,25 +97,26 @@ export default {
}); });
if(!HandleApiError(error,'getDetail')){ if(!HandleApiError(error,'getDetail')){
this.detail = result; this.detail = result;
this.isLike = result.isLike || false;
this.detail.usefulCount = this.detail.usefulCount || 0
} }
}, },
async handleSubmit(){ async handleSubmit(){
let data = { let data = {
commentContent : this.commentContent, commentContent : this.commentContent,
commentType : COMMENT.TYPE.ANSWER, commentType : COMMENT.TYPE.ANSWER,
// orderProductId : this.detail.orderProductId,
originId : this.detail.id, originId : this.detail.id,
parentId : this.answer ? this.answer.id : this.detail.id parentId : this.answer ? this.answer.id : this.detail.id
} }
const {error, result} = await ApiPostComment(data); const {error, result} = await ApiPostComment(data);
if(!HandleApiError(error,'getDetail')){ if(!HandleApiError(error)){
this.detail.answerCommentList.push({ this.detail.answerCommentList.push({
...result, ...result,
userName : this.$store.state.userInfo.nickname, userName : this.$store.state.userInfo.nickname,
parentName: this.answer ? this.answer.userName : '' parentName: this.answer ? this.answer.userName : ''
}); });
this.commentContent = ''; this.commentContent = '';
uni.$u.toast('评论成功!') uni.$u.toast('评论成功!');
} }
}, },
handleAnswer(item){ handleAnswer(item){
@ -113,6 +126,29 @@ export default {
handleHideAnswer(...e){ handleHideAnswer(...e){
this.isShowAnswer = false; this.isShowAnswer = false;
this.answer = null; this.answer = null;
},
handleUseful(){
this.isLike = !this.isLike
if(this.isLike){
this.detail.usefulCount++;
}else{
this.detail.usefulCount--;
}
if(!this.debounce){
this.debounce = Debounce(this.updateUseFul, 500);
}
this.debounce();
},
async updateUseFul(){
if(this.isLike === this.detail.isLike){
return false
}
const {error, result} = await ApiPutCommentUseful({
commentId : this.detail.id,
isLike : this.isLike
});
} }
} }
} }
@ -171,7 +207,13 @@ page{
align-items: center; align-items: center;
background: #fff; background: #fff;
border-top: 1px solid #f8f8f8; border-top: 1px solid #f8f8f8;
&--item{
display: flex;
align-items: center;
&__active{
color: $color-yellow3;
}
}
} }
.reply-comment--bg{ .reply-comment--bg{
position: fixed; position: fixed;

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 16:51:03 * @Date: 2022-06-21 16:51:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-24 11:12:05 * @LastEditTime: 2022-06-28 15:49:47
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -30,6 +30,7 @@
<u-loadmore :status="loadingStatus" v-if="loadingStatus === 'loading'"/> <u-loadmore :status="loadingStatus" v-if="loadingStatus === 'loading'"/>
<view class="other" v-if="otherCount" @click="$Router.push(`/goodsCommentOtherList?id=${productId}`)"> <view class="other" v-if="otherCount" @click="$Router.push(`/goodsCommentOtherList?id=${productId}`)">
已折叠{{otherCount}}条帮助不大的评价 已折叠{{otherCount}}条帮助不大的评价
<u-icon name="arrow-right" color="#999" size="15"></u-icon>
</view> </view>
</view> </view>
@ -75,7 +76,7 @@ export default {
async getList(){ async getList(){
this.loadingStatus = 'loading'; this.loadingStatus = 'loading';
const {error, result} = await ApiGetCommentList({ const {error, result} = await ApiGetCommentList({
pageIndex : 1, pageIndex : this.pageIndex,
length : this.pageSize, length : this.pageSize,
productId : this.productId, productId : this.productId,
commentLabel : this.tabActive == -1 ? null : this.tabActive, commentLabel : this.tabActive == -1 ? null : this.tabActive,
@ -95,7 +96,7 @@ export default {
productId : this.productId productId : this.productId
}); });
if(!HandleApiError(error, 'getTabCount')){ if(!HandleApiError(error, 'getTabCount')){
this.tabs = this.tabs.concat(result); this.tabs = this.tabs.concat(result.filter(i => i.commentCount > 0));
} }
}, },
async getCount(){ async getCount(){
@ -184,11 +185,11 @@ page{
} }
} }
.other{ .other{
text-align: center; display: flex;
align-items: center;
color: #999; color: #999;
margin: 40rpx 0 20rpx; width: 360rpx;
margin: 20rpx auto;
height: 100rpx; height: 100rpx;
background:url('@/static/common/arrow.png') no-repeat right center;
background-size: 10rpx;
} }
</style> </style>

@ -2,12 +2,12 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 16:51:03 * @Date: 2022-06-21 16:51:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 10:52:02 * @LastEditTime: 2022-06-28 15:27:33
* @Description: file content * @Description: file content
--> -->
<template> <template>
<view> <view>
<view class="comment" v-for="item in list" :key="item.id" @click="$Router.push(`/goodsCommentDetail?id${item.id}`)"> <view class="comment" v-for="item in list" :key="item.id" @click="$Router.push(`/goodsCommentDetail?id=${item.id}`)">
<BsCommentUserInfo :userData="item"/> <BsCommentUserInfo :userData="item"/>
<BsCommentInfo :commentDetail="item"/> <BsCommentInfo :commentDetail="item"/>
<BsCommentThumbup :commentDetail="item"/> <BsCommentThumbup :commentDetail="item"/>
@ -21,15 +21,16 @@ import BsCommentInfo from '../../../components/BsCommentInfo.vue'
import BsCommentUserInfo from '../../../components/BsCommentUserInfo.vue' import BsCommentUserInfo from '../../../components/BsCommentUserInfo.vue'
import {ApiGetCommentList, ApiGetCommentCount, ApiGetCommentTabCount} from '@/common/api/comment'; import {ApiGetCommentList, ApiGetCommentCount, ApiGetCommentTabCount} from '@/common/api/comment';
import {HandleApiError} from '@/common/utils' import {HandleApiError} from '@/common/utils'
import BsCommentThumbup from '../../../components/BsCommentThumbup.vue';
export default { export default {
components: { BsCommentInfo, BsCommentUserInfo }, components: { BsCommentInfo, BsCommentUserInfo, BsCommentThumbup },
data (){ data (){
return { return {
list : [], list : [],
pageIndex : 1, pageIndex : 1,
pageSize : 10, pageSize : 10,
productId : this.$Route.query.id, productId : this.$Route.query.id,
loadingStatus : 'loading' loadingStatus : ''
} }
}, },
@ -41,6 +42,9 @@ export default {
}, },
methods:{ methods:{
async getList(){ async getList(){
if(this.loadingStatus === 'loading'){
return false
}
this.loadingStatus = 'loading'; this.loadingStatus = 'loading';
const {error, result} = await ApiGetCommentList({ const {error, result} = await ApiGetCommentList({
pageIndex : 1, pageIndex : 1,

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 16:23:27 * @Date: 2022-06-21 16:23:27
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 14:30:28 * @LastEditTime: 2022-06-28 11:31:02
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -13,18 +13,21 @@
<text class="comment-title--right">查看全部</text> <text class="comment-title--right">查看全部</text>
</view> </view>
<view class="comment-ctx" v-if="commentList && commentList.length"> <view class="comment-ctx" v-if="commentList && commentList.length">
<BsCommentInfo class="comment-ctx--item" v-for="item in commentList" <view v-for="item in commentList" :key="item.id">
:commentDetail="item" :key="item.id"/> <BsCommentUserInfo :userData="item"/>
<BsCommentInfo class="comment-ctx--item" :commentDetail="item" :imgPreview="false"/>
</view>
</view> </view>
</UiWhiteBox> </UiWhiteBox>
</template> </template>
<script> <script>
import BsCommentInfo from '../../../../components/BsCommentInfo.vue' import BsCommentInfo from '../../../../components/BsCommentInfo.vue'
import BsCommentUserInfo from '../../../../components/BsCommentUserInfo.vue'
import UiCell from '../../../../components/UiCell.vue' import UiCell from '../../../../components/UiCell.vue'
import UiWhiteBox from '../../../../components/UiWhiteBox.vue' import UiWhiteBox from '../../../../components/UiWhiteBox.vue'
export default { export default {
components: { BsCommentInfo, UiCell, UiWhiteBox }, components: { BsCommentInfo, UiCell, UiWhiteBox, BsCommentUserInfo },
props : { props : {
count : { count : {
type : Number, type : Number,

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 14:55:54 * @Date: 2022-06-20 14:55:54
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 17:13:29 * @LastEditTime: 2022-06-28 16:50:14
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -18,7 +18,7 @@
<BsCommentInfo :commentDetail="item"/> <BsCommentInfo :commentDetail="item"/>
<SubmitFollowComment :commentDetail="item" <SubmitFollowComment :commentDetail="item"
@submit="submitFollowComment($event, idx)" @submit="submitFollowComment($event, idx)"
@editChange="editChange($event, idx)" /> @editChange="editChange($event, idx)" :type="getFollowType(item)"/>
<BsCommentMerchant v-if="item.merchantComment" :merchantComment="item.merchantComment"/> <BsCommentMerchant v-if="item.merchantComment" :merchantComment="item.merchantComment"/>
<BsCommentThumbup :commentDetail="item"/> <BsCommentThumbup :commentDetail="item"/>
</template> </template>
@ -26,7 +26,7 @@
</view> </view>
</template> </template>
<script> <script>
import { ApiGetOrderCommentDetail } from "@/common/api/comment"; import { ApiGetOrderCommentDetail,ApiGetCommentDetail } from "@/common/api/comment";
import UiWhiteBox from "@/components/UiWhiteBox.vue"; import UiWhiteBox from "@/components/UiWhiteBox.vue";
import UiButton from "@/components/UiButton.vue"; import UiButton from "@/components/UiButton.vue";
import BsCommentSubmit from "@/components/BsCommentSubmit.vue"; import BsCommentSubmit from "@/components/BsCommentSubmit.vue";
@ -52,32 +52,20 @@ export default {
COMMENT, COMMENT,
list: [], list: [],
orderId: this.$Route.query.orderId, orderId: this.$Route.query.orderId,
showFollowComment: false, commentId : this.$Route.query.commentId
}; };
}, },
onShow() { onShow() {
this.getCommentDetail(); console.log(this.orderId, this.commentId);
}, if(this.orderId){
onBackPress(){ this.getOrderCommentDetail();
alert(2222) }else if(this.commentId){
const flag = this.list.find(i => i.isEdit == true); this.getCommentDetail()
alert(1111)
if(flag){
uni.showModal({
content : '您正在进行商品评价,退出后评价的内容将不保存',
cancelTxt : '我再想想',
cancelColor : '#999',
confirmColor : '#3A83FB',
success: async ({confirm}) => {
if(confirm){
}
}
})
} }
}, },
methods: { methods: {
async getCommentDetail() { async getOrderCommentDetail() {
const { error, result } = await ApiGetOrderCommentDetail({ const { error, result } = await ApiGetOrderCommentDetail({
orderId: this.orderId, orderId: this.orderId,
}); });
@ -87,8 +75,34 @@ export default {
} }
this.list = result; this.list = result;
}, },
/**
* 按评论查询追评时用
*/
async getCommentDetail(){
const {error, result} = await ApiGetCommentDetail({
commentId : this.commentId
});
if (error) {
uni.$u.toast(error.message);
return false;
}
this.list = [result];
},
getFollowType(item){
let type= 'info'
if(this.commentId && !item.followComment){
type = 'form'
}
return type;
},
submitComment(result, idx){ submitComment(result, idx){
this.$set(this.list, idx, {...this.list[idx],...result}); this.$set(this.list, idx, {...this.list[idx],...result});
if(this.list.findIndex(i => !i.id) > 0){
uni.$u.toast('评论成功~');
}else{
this.$Router.replace('/commentSuccess');
}
}, },
editChange(isEdit, idx){ editChange(isEdit, idx){
this.$set(this.list[idx], 'isEdit', isEdit); this.$set(this.list[idx], 'isEdit', isEdit);
@ -99,9 +113,6 @@ export default {
...result ...result
}); });
},
beforeRouteLeave(to, from, next){
console.log(to,from,'beforeRouteLeavebeforeRouteLeave')
} }
}, },
}; };

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 16:36:41 * @Date: 2022-06-20 16:36:41
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 16:46:04 * @LastEditTime: 2022-06-28 15:25:46
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -29,11 +29,15 @@ export default {
commentDetail : { commentDetail : {
type : Object, type : Object,
default : () => ({}) default : () => ({})
},
type : {
type : String,
default : 'info' //info form
} }
}, },
data(){ data(){
return { return {
showInput : false, showInput : this.type === 'info' ? false : true,
COMMENT, COMMENT,
} }
}, },

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-21 15:32:28 * @Date: 2022-06-21 15:32:28
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-23 16:56:34 * @LastEditTime: 2022-06-28 16:12:43
* @Description: file content * @Description: file content
--> -->
@ -13,10 +13,13 @@
<view class="btns"> <view class="btns">
<UiButton class="btn" @click="$Router.back()"></UiButton> <UiButton class="btn" @click="$Router.back()"></UiButton>
</view> </view>
<view class="await"> <view class="await" v-if="goodsList.length">
<view class="await--title">这些宝贝还在等你的评价哦~</view> <view class="await--title">这些宝贝还在等你的评价哦~</view>
<BsCommentGoodsInfo class="await--goods" :goods="item" v-for="item in goodsList" :key="item.productId"> <BsCommentGoodsInfo class="await--goods" :goods="item" v-for="item in goodsList" :key="item.productId">
<UiButton slot="btns" size="small" type="primaryLine">评价</UiButton> <UiButton slot="btns" size="small" type="primaryLine"
@click="$Router.push(`/comment?commentId=${item.orderId}`)">
{{item.commentStatus == 1 ? '评价' : '追评'}}
</UiButton>
</BsCommentGoodsInfo> </BsCommentGoodsInfo>
</view> </view>
<view class="recommend-title">为您推荐</view> <view class="recommend-title">为您推荐</view>
@ -46,11 +49,13 @@ export default {
pageIndex : 1 pageIndex : 1
}); });
if(!HandleApiError(error, 'getAwaitGoodsList')){ if(!HandleApiError(error, 'getAwaitGoodsList')){
this.goodsList = result.map(item => { this.goodsList = result.records.map(item => {
return { return {
productPicture : item.productImageUrl, productPicture : item.productImageUrl,
productName : item.productName, productName : item.productName,
skuName : item.skuDescribe || '第三课时' skuName : item.skuDescribe,
commentStatus : item.commentStatus,
orderId : item.orderId
} }
}); });
} }

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-04-15 17:46:10 * @Date: 2022-04-15 17:46:10
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-27 11:13:24 * @LastEditTime: 2022-06-28 16:43:57
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -13,6 +13,13 @@
<UiButton class="footer--btn" v-if="orderInfo.orderStatus === 2" @click="service"></UiButton> <UiButton class="footer--btn" v-if="orderInfo.orderStatus === 2" @click="service"></UiButton>
<!-- 已发货可以确认收货 --> <!-- 已发货可以确认收货 -->
<UiButton class="footer--btn" v-if="orderInfo.orderStatus === 4" type="gradual" @click="receive"></UiButton> <UiButton class="footer--btn" v-if="orderInfo.orderStatus === 4" type="gradual" @click="receive"></UiButton>
<UiButton class="footer--btn" type="primaryLine" v-if="orderInfo.orderStatus === ORDER.STATUS.FINISH_TAKE_GOODS"
@click="$Router.push(`/comment?orderId=${orderInfo.orderId}`)">去评价</UiButton>
<UiButton size="min" type="primaryLine" v-if="orderInfo.orderStatus === ORDER.STATUS.FINISH"
@click="$Router.push(`/comment?commentId=${orderInfo.orderId}`)">去追评</UiButton>
<!-- 待支付可以取消支付订单 --> <!-- 待支付可以取消支付订单 -->
<template v-if="orderInfo.orderStatus === 1"> <template v-if="orderInfo.orderStatus === 1">
<UiButton class="footer--btn" @click="cancelShow = true">取消订单</UiButton> <UiButton class="footer--btn" @click="cancelShow = true">取消订单</UiButton>
@ -49,7 +56,8 @@
import UiButton from '@/components/UiButton.vue' import UiButton from '@/components/UiButton.vue'
import UiCell from '@/components/UiCell.vue' import UiCell from '@/components/UiCell.vue'
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order' import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/common/api/order'
import BsPay from '../../../../components/BsPay.vue' import BsPay from '../../../../components/BsPay.vue';
import ORDER from '@/common/dicts/order';
export default { export default {
components: { UiButton, UiCell, BsPay }, components: { UiButton, UiCell, BsPay },
props : { props : {
@ -60,6 +68,7 @@ export default {
}, },
data(){ data(){
return { return {
ORDER,
// //
cancelShow : false, cancelShow : false,
cancelValue : 0, cancelValue : 0,
@ -77,16 +86,16 @@ export default {
this.cancelValue = val; this.cancelValue = val;
}, },
async cancelOrder(){ async cancelOrder(){
const ooderId = this.$Route.query.id; const orderId = this.orderInfo.orderId;
const {error, result} = await ApiPutCancelOrder({ const {error, result} = await ApiPutCancelOrder({
cancelReasonType : this.cancelValue, cancelReasonType : this.cancelValue,
orderId : ooderId orderId : orderId
}); });
if(error){ if(error){
uni.$u.toast(error.message); uni.$u.toast(error.message);
return false; return false;
} }
this.$Router.replace(`/orderDetail?id=${ooderId}`); this.$Router.replace(`/orderDetail?id=${orderId}`);
// //
}, },
/** /**
@ -100,13 +109,13 @@ export default {
success: async ({confirm}) => { success: async ({confirm}) => {
if(confirm){ if(confirm){
const {error} = await ApiPutOrderReceive({ const {error} = await ApiPutOrderReceive({
orderId : this.$Route.query.id orderId : this.orderInfo.orderId
}); });
if(error){ if(error){
uni.$toast(error.message); uni.$toast(error.message);
return false; return false;
} }
this.$Router.push('/orderSuccess'); this.$Router.push(`/orderSuccess?orderId=${this.orderInfo.orderId}`);
} }
} }
}) })

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-31 17:53:43 * @Date: 2022-03-31 17:53:43
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-05 20:43:19 * @LastEditTime: 2022-06-28 16:24:52
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -35,6 +35,8 @@ export default {
'5' : {name:'已收货', icon: require('@/static/order/fh.png')}, '5' : {name:'已收货', icon: require('@/static/order/fh.png')},
// //
'6' : {name:'交易成功', icon: require('@/static/order/cg.png')}, '6' : {name:'交易成功', icon: require('@/static/order/cg.png')},
//
'7' : {name:'交易成功', icon: require('@/static/order/cg.png')},
}, },
ctxCon : {}, ctxCon : {},
startSecondNum : 0, startSecondNum : 0,

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-22 10:58:24 * @Date: 2022-03-22 10:58:24
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-24 09:40:07 * @LastEditTime: 2022-06-28 16:43:37
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -37,17 +37,17 @@
@click="$Router.push(`/orderDetail?id=${item.orderId}`)">查看详情</UiButton> @click="$Router.push(`/orderDetail?id=${item.orderId}`)">查看详情</UiButton>
<UiButton size="min" v-if="item.orderStatus >= ORDER.STATUS.FINISH_SEND_GOODS" <UiButton size="min" v-if="item.orderStatus >= ORDER.STATUS.FINISH_SEND_GOODS"
@click="$Router.push(`/logisitcsInfo?orderId=${item.orderId}`)">查看物流</UiButton> @click="$Router.push(`/logisitcsInfo?orderId=${item.orderId}`)">查看物流</UiButton>
<UiButton size="min" type="gradual" <UiButton size="min" type="primaryLine"
v-if="item.orderStatus === ORDER.STATUS.FINISH_TAKE_GOODS" v-if="item.orderStatus === ORDER.STATUS.FINISH_TAKE_GOODS"
@click="$Router.push(`/comment?orderId=${item.orderId}`)">去评价</UiButton> @click="$Router.push(`/comment?orderId=${item.orderId}`)">去评价</UiButton>
<UiButton size="min" type="gradual" <UiButton size="min" type="primaryLine"
v-if="item.orderStatus === ORDER.STATUS.FINISH" v-if="item.orderStatus === ORDER.STATUS.FINISH"
@click="$Router.push(`/comment?orderId=${item.orderId}`)">去追评</UiButton> @click="$Router.push(`/comment?commentId=${item.orderId}`)">去追评</UiButton>
<UiButton size="min" type="gradual" v-if="item.orderStatus === ORDER.STATUS.FINISH_SEND_GOODS" @click="receive(item)"></UiButton> <UiButton size="min" type="gradual" v-if="item.orderStatus === ORDER.STATUS.FINISH_SEND_GOODS" @click="receive(item)"></UiButton>
</view> </view>
</view> </view>
<u-loadmore :status="loadingStatus" v-if="loadingStatus === 'loading'"/> <u-loadmore :status="loadingStatus" v-if="loadingStatus !== 'nomore'"/>
<BsPay :show.sync="payShow" :order="payOrder"></BsPay> <BsPay :show.sync="payShow" :order="payOrder"></BsPay>
</view> </view>
@ -114,6 +114,7 @@ export default {
uni.$u.toast(error.message); uni.$u.toast(error.message);
return false; return false;
} }
this.loadingStatus = 'finish';
// //
if(result.records.length < this.pageSize){ if(result.records.length < this.pageSize){
this.loadingStatus = 'nomore'; this.loadingStatus = 'nomore';
@ -155,7 +156,7 @@ export default {
uni.$toast(error.message); uni.$toast(error.message);
return false; return false;
} }
this.$Router.push('/orderSuccess') this.$Router.push(`/orderSuccess?orderId=${item.orderId}`)
} }
} }
}) })

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-28 17:16:44 * @Date: 2022-03-28 17:16:44
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-29 23:03:47 * @LastEditTime: 2022-06-28 16:46:43
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -10,7 +10,8 @@
<image class="icon" src="@/static/order/paySuccess.png"/> <image class="icon" src="@/static/order/paySuccess.png"/>
<view class="title">交易成功</view> <view class="title">交易成功</view>
<view class="btns"> <view class="btns">
<UiButton class="btn" type="primaryLine" @click="$Router.replaceAll('/')"></UiButton> <UiButton class="btn" @click="$Router.replaceAll('/')"></UiButton>
<UiButton class="btn" type="primaryLine" @click="$Router.replace(`/comment?orderId=${orderId}`)"></UiButton>
</view> </view>
</view> </view>
</template> </template>
@ -18,6 +19,11 @@
import UiButton from '@/components/UiButton.vue' import UiButton from '@/components/UiButton.vue'
export default { export default {
components: { UiButton }, components: { UiButton },
data(){
return {
orderId : this.$Route.query.orderId
}
}
} }
</script> </script>

Loading…
Cancel
Save