Commit 1a81742d authored by zhengke's avatar zhengke

增加评论

parent db5dd663
...@@ -327,6 +327,10 @@ ...@@ -327,6 +327,10 @@
"path":"place_order" "path":"place_order"
},{ },{
"path":"rili" "path":"rili"
},{
"path":"order-commit"
},{
"path":"order-commit-detail"
}] }]
}, },
{ {
......
<template>
<view class="commit-detail">
<u-top-tips ref="uTips"></u-top-tips>
<view class="good_List">
<view class="good-item">
<image class="good-pic" :src="dataList.DetailList[0].CoverImagePath" mode="aspectFit" />
<view class="right-box">
<view class="good-info">{{dataList.DetailList[0].GoodsName}}</view>
<view class="op-box">
天数:{{dataList.DetailList[0].UseDay}}
颜色:{{dataList.DetailList[0].CarColorName}}
类型:{{dataList.DetailList[0].RideNum}}
</view>
</view>
</view>
<view class="good_Line"></view>
<view style="padding:0 10px 20px 10px;">
<view class="title-box">
<text style="margin-right:10px;">商品评价</text>
<u-rate :current="msg[0].CommentScore" active-color="#FA3534" inactive-color="#b2b2b2" active-icon="star"
inactive-icon="star-o" size="40" @change='change1'></u-rate>
</view>
<view class="editor-box">
<view class="editor-icon">
<u-icon name="edit" size="36"></u-icon>
</view>
<view class="editor">
<textarea placeholder="写入评价" v-model="msg[0].Content" maxlength="200"></textarea>
<u-upload :action="action" :file-list="fileList" @on-remove="onRemove1" max-count="9" :custom-btn="true"
@on-success="uploadSuccessHandler">
<view slot="addBtn" class="slot-btn">
<u-icon name="photograph" size="40" color="#888"></u-icon>
<view class="mian-title">上传图片</view>
</view>
</u-upload>
</view>
</view>
</view>
</view>
<view class="good_List">
<view class="good-item" style="margin-bottom:0;">
<u-avatar mode="circle" :src="dataList.DetailList[0].GuidePhoto"></u-avatar>
<view style="margin:13px 0 0 10px;">
{{dataList.DetailList[0].GuideName}}
</view>
</view>
<view style="padding:0 10px 20px 10px;">
<view class="title-box">
<text style="margin-right:10px;">导游评价</text>
<u-rate :current="msg[1].CommentScore" active-color="#FA3534" inactive-color="#b2b2b2" active-icon="star"
inactive-icon="star-o" size="40" @change='change2'></u-rate>
</view>
<view class="editor-box">
<view class="editor-icon">
<u-icon name="edit" size="36"></u-icon>
</view>
<view class="editor">
<textarea placeholder="写入评价" v-model="msg[1].Content" maxlength="200"></textarea>
<u-upload :action="action" :file-list="fileList2" @on-remove="onRemove2" max-count="9" :custom-btn="true"
@on-success="uploadSuccessHandler2">
<view slot="addBtn" class="slot-btn">
<u-icon name="photograph" size="40" color="#888"></u-icon>
<view class="mian-title">上传图片</view>
</view>
</u-upload>
</view>
</view>
</view>
</view>
<view style="padding:10px 40px;">
<u-button size="80" :ripple="true" @click="submitForm" shape="circle" :custom-style="{
backgroundColor: mc,
height: '80rpx',
color: '#FFF',
fontSize: '14px'
}">
<u-loading mode="circle" style="margin-right: 5px;" v-if="submitStatus"></u-loading>提交评价
</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle: "发表评价",
mc: "",
secondary: "",
msg: [{
OrderDetailId: 0, //订单详情
GoodsId: 0, //商品id
Content: '', //评价内容
CommentImgList: [], //评价图片
CommentScore: 5, //分数
GuideId: 0, //导游(导游id(新增一条评论需新增2调数据,一个是对导游(车辆id=0)的一个是对车辆的(导游id=0)
CarId: 0 //车辆(车辆id)
}, {
OrderDetailId: 0, //订单详情
GoodsId: 0, //商品id
Content: '', //评价内容
CommentImgList: [], //评价图片
CommentScore: 5, //分数
GuideId: 0, //导游(导游id(新增一条评论需新增2调数据,一个是对导游(车辆id=0)的一个是对车辆的(导游id=0)
CarId: 0 //车辆(车辆id)
}],
OrderId: 0,
submitStatus: false,
goodsName: "",
goodsPic: "",
action: this.host2 + "/api/File/UploadTencent",
fileList: [], //商品上传图
fileList2: [], //导游上传图
dataList: {} //商品详情数据
};
},
onLoad(option) {
if (option.param) {
let param = JSON.parse(decodeURIComponent(option.param));
this.msg[0].GoodsId = param.GoodsId;
this.msg[1].GoodsId = param.GoodsId;
this.msg[0].OrderDetailId = param.OrderDetailId;
this.msg[1].OrderDetailId = param.OrderDetailId;
this.goodsName = param.GoodsName;
this.goodsPic = param.CoverImage;
this.OrderId = param.OrderId;
this.getOrderDetail();
}
},
mounted() {
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
},
methods: {
uploadSuccessHandler(data, index, lists) {
let r = JSON.parse(data);
this.msg[0].CommentImgList.push(r.data);
},
uploadSuccessHandler2(data, index, lists) {
let r = JSON.parse(data);
this.msg[1].CommentImgList.push(r.data);
},
//删除1
onRemove1(index) {
this.msg[0].CommentImgList.splice(index, 1);
},
//删除2
onRemove2(index) {
this.msg[1].CommentImgList.splice(index, 1);
},
//获取订单详情
getOrderDetail() {
let msg = {
OrderId: this.OrderId,
NewUserId: 0
}
this.request2({
url: "/api/AppletGCOrder/GetAppletGuidecarOrderOrderInfo",
data: msg
},
(res) => {
if (res.resultCode == 1) {
this.dataList = res.data;
this.msg[0].CarId = this.dataList.DetailList[0].CarId;
this.msg[1].GuideId = this.dataList.DetailList[0].GuideId;
}
}
);
},
change1(val) {
this.msg[0].CommentScore = val
},
change2(val) {
this.msg[1].CommentScore = val
},
submitForm() {
if (this.msg[0].CommentScore == 0) {
this.$refs.uTips.show({
title: "请您为车打打分吧",
type: "error",
duration: "2300",
});
return;
}
if (this.msg[1].CommentScore == 0) {
this.$refs.uTips.show({
title: "请您为导游打打分吧",
type: "error",
duration: "2300",
});
return;
}
this.submitStatus = true;
this.request2({
url: "/api/AppletGCOrder/SetGuideCarCommentInfo",
data: this.msg,
},
(res) => {
if (res.resultCode == 1) {
uni.showModal({
content: "评价成功,感谢您的反馈",
showCancel: false,
confirmText: "确认",
success: function(res) {
if (res.confirm) {
uni.navigateBack({
delta: 1,
});
}
this.submitStatus = false;
},
});
} else {
this.submitStatus = false;
this.$refs.uTips.show({
title: res.msg,
type: "error",
duration: "2300",
});
}
}
);
}
}
};
</script>
<style>
.commit-detail {
background: #faf8f9;
position: relative;
}
.commit-detail .good-item {
margin: 10px 0;
background: #fff;
padding: 10px;
border-radius: 10px;
display: flex;
}
.good_Line {
width: 95%;
margin: auto;
height: 1px;
border-top: 1px solid #e2e2e2;
padding-bottom: 15px;
}
.commit-detail .good-item .good-pic {
width: 120rpx;
height: 120rpx;
margin-right: 15px;
border-radius: 5px;
}
.commit-detail .good-item .right-box {
width: 1px;
flex: 1;
display: flex;
flex-direction: column;
height: 100rpx;
}
.commit-detail .good-item .right-box .good-info {
flex: 1;
width: 100%;
height: 1px;
font-size: 28rpx;
color: #333;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
margin-bottom: 5px;
}
.commit-detail .good-item .right-box .op-box {
height: 25px;
}
.commit-detail .content-box {
background: #fff;
padding: 15px;
border-radius: 5px;
}
.commit-detail .good_List .title-box {
padding-bottom: 15px;
/* border-bottom: 1px solid #e3e3e3; */
font-size: 15px;
font-weight: 500;
margin-bottom: 15px;
color: #000;
display: flex;
align-items: center;
}
.commit-detail .good_List .editor-box {
display: flex;
}
.commit-detail .good_List .editor-box .editor-icon {
width: 18px;
margin-right: 5px;
}
.commit-detail .good_List .editor-box .editor {
width: 1px;
flex: 1;
}
.commit-detail .good_List .editor-box .editor textarea {
width: 100%;
height: 150px;
font-size: 14px;
color: #000;
border: none;
outline: none;
margin-bottom: 10px;
}
.commit-detail .good_List .editor-box .editor .slot-btn {
width: 140rpx;
height: 140rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background: rgb(244, 245, 246);
border-radius: 10rpx;
}
.commit-detail .content-box .editor-box .editor .slot-btn .mian-title {
font-size: 28rpx;
color: #888;
font-weight: 600;
margin: 10rpx 0;
}
.commit-detail .content-box .editor-box .editor .slot-btn .sub-title {
color: #999;
font-size: 26rpx;
font-family: "microsoft yahei" !important;
}
.commit-detail .u-list-item {
width: 90px !important;
height: 90px !important;
}
.commit-detail .good_List {
background-color: #fff;
margin-bottom: 10px;
}
</style>
<template>
<view class="commit-box">
<u-empty text="没有找到未评价的商品信息" font-size="36" mode="list" v-if="g.length == 0 && !loading"></u-empty>
<view
v-if="g.length > 0"
style="height: 100vh;width: 100vw;overflow: hidden;padding:0 0 10px 0;"
>
<scroll-view
:scroll-y="true"
@scrolltolower="lower"
:enable-back-to-top="true"
:enable-flex="true"
:scroll-top="scrollTop"
@scroll="scroll"
style="height: 100%; padding-bottom: 0px;"
>
<view class="good-list">
<view class="good-item" v-for="(x, i) in g" :key="i">
<image class="good-pic" :src="x.CoverImage" mode="aspectFit" />
<view class="right-box">
<view class="good-info">
<view class="good-name">{{x.GoodsName}}</view>
<view class="good-attr">
<u-tag
v-for="(y, yi) in x.SpecificationList"
:key="yi"
size="mini"
:text="y"
type="warning"
/>
</view>
</view>
<view class="op-box">
<u-button
size="mini"
ripple
plain
shape="circle"
:custom-style="{color:mc,borderColor:mc}"
@click="goCommit(x)"
>评价</u-button>
</view>
</view>
</view>
</view>
<u-loadmore
v-if="showLoading"
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#F5F5F5"
/>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle: "评价中心",
loading: false,
g: [],
showLoading: false,
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多评价商品了",
},
status: "loadmore",
scrollTop: 0,
old: {
scrollTop: 0,
},
mc: "",
secondary: "",
msg: {
pageIndex: 1,
pageSize: 10,
IsComment: 2,
GoodsName: "",
OrderNo: "",
OrderClassify:1
},
page_count: 0,
isover: false,
};
},
onShow() {
this.msg.pageIndex = 1;
this.g = [];
this.init();
},
mounted() {
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
},
methods: {
scroll(e) {
this.old.scrollTop = e.detail.scrollTop;
},
goCommit(x) {
let msg = {
GoodsId: x.GoodsId,
OrderDetailId: x.OrderDetailId,
GoodsName: x.GoodsName,
CoverImage: x.CoverImage,
OrderId: x.OrderId
};
uni.navigateTo({
url:
"/pages/guidecar/order-commit-detail?param=" +
encodeURIComponent(JSON.stringify(msg)),
fail: function (e) {
console.log(e);
},
});
},
goTop(e) {
this.scrollTop = this.old.scrollTop;
this.$nextTick(function () {
this.scrollTop = 0;
});
},
init() {
this.isover = false;
this.loading = true;
this.showLoading = this.msg.pageIndex != 1;
this.request2(
{
url: "/api/AppletOrder/GetAppletGoodsWaitCommentPageList",
data: this.msg,
},
(res) => {
this.isloading = false;
if (res.resultCode == 1) {
this.g = this.g.concat(res.data.pageData);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.isover = true;
this.status = "nomore";
} else {
this.status = "loadmore";
}
}
uni.hideNavigationBarLoading();
}
);
},
lower(e) {
if (this.msg.pageIndex < this.page_count) {
this.status = "loading";
this.msg.pageIndex++;
this.init();
} else {
this.isover = true;
this.status = "nomore";
}
},
},
};
</script>
<style>
.commit-box {
background: #faf8f9;
height: 100vh;
position: relative;
}
.commit-box .quick {
right: 50rpx;
bottom: 50rpx;
position: absolute;
}
.commit-box .quick .item {
background: #fff;
border: 1px solid #aaa;
height: 90rpx;
width: 90rpx;
color: #333;
border-radius: 90rpx;
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.commit-box .good-list {
}
.commit-box .good-list .good-item {
margin-top: 10px;
background: #fff;
padding: 10px;
border-radius: 10px;
display: flex;
}
.commit-box .good-list .good-item .good-pic {
width: 200rpx;
height: 200rpx;
margin-right: 15px;
border-radius: 5px;
}
.commit-box .good-list .good-item .right-box {
width: 1px;
flex: 1;
display: flex;
flex-direction: column;
height: 200rpx;
}
.commit-box .good-list .good-item .right-box .good-info {
flex: 1;
width: 100%;
height: 1px;
}
.commit-box .good-list .good-item .right-box .op-box {
text-align: right;
height: 25px;
}
.commit-box .good-list .good-item .right-box .good-info .good-name {
font-size: 28rpx;
color: #333;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 5px;
}
.commit-box .good-list .good-item .right-box .good-info .good-attr {
text-align: left;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment