You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

576 lines
12 KiB

<template>
<!-- 发表评论 -->
<view class="comment">
<far-bottom></far-bottom>
<view class="orderInfo">
<view class="orderInfoPackage" v-if="goodsDetail || oderData">
<view class="orderInfoImg">
<image :src="goodsDetail.thumb?goodsDetail.thumb:goodsDetail.logo?goodsDetail.logo:oderData.storelist[0].goodlist[0].thumb" />
</view>
<view class="info">
<view class="nameUp">
{{ goodsDetail.goodsname?goodsDetail.goodsname:goodsDetail.goods_name?goodsDetail.goods_name:oderData.storelist[0].storename}}
</view>
<view v-if="type !== '9'">
<span>
¥{{ goodsDetail.price?goodsDetail.price:oderData.storelist[0].allmoney}}
<span v-if="type!='8'&&type!='6' && !oderData && goodsDetail.oldprice" style="text-decoration:line-through;">¥ {{ goodsDetail.oldprice }}</span>
</span>
<!-- <view><span>订单详情</span></view> -->
</view>
</view>
</view>
</view>
<!-- 商品详情 -->
<!-- 评论区域 -->
<view class="plView">
<view class="plPackage">
<view class="checkStar">
<span>评分</span>
<view class="starPackage">
<view>
<image :src="imgfixUrls+ 'merchant/nStar.png'" v-if="stars.indexOf(1) == -1" @click="checkedStar(1)" />
<image :src="imgfixUrls+ 'merchant/yStar.png'" v-else @click="checkedStar(1)" />
</view>
<view>
<image :src="imgfixUrls+ 'merchant/nStar.png'" v-if="stars.indexOf(2) == -1" @click="checkedStar(2)" />
<image :src="imgfixUrls+ 'merchant/yStar.png'" v-else @click="checkedStar(2)" />
</view>
<view>
<image :src="imgfixUrls+ 'merchant/nStar.png'" v-if="stars.indexOf(3) == -1" @click="checkedStar(3)" />
<image :src="imgfixUrls+ 'merchant/yStar.png'" v-else @click="checkedStar(3)" />
</view>
<view>
<image :src="imgfixUrls+ 'merchant/nStar.png'" v-if="stars.indexOf(4) == -1" @click="checkedStar(4)" />
<image :src="imgfixUrls+ 'merchant/yStar.png'" v-else @click="checkedStar(4)" />
</view>
<view>
<image :src="imgfixUrls+ 'merchant/nStar.png'" v-if="stars.indexOf(5) == -1" @click="checkedStar(5)" />
<image :src="imgfixUrls+ 'merchant/yStar.png'" v-else @click="checkedStar(5)" />
</view>
</view>
</view>
<view class="plInput">
<textarea placeholder="请输入评论" maxlength="140" v-model="text"></textarea>
<view class="plLength">
<span></span>
<span>{{ text.length }}/140</span>
</view>
<view class="plUpload">
<view class="picMb" v-for="(item,index) in picArray">
<image :src="item" />
<image @click="closePic(item)" :src="imgfixUrls+ 'merchant/close.png'" class="closeButton" />
</view>
<view class="upLoad" @click="uploadFiles">
<image :src="imgfixUrls+ 'merchant/cream.png'" />
</view>
</view>
</view>
</view>
</view>
<!-- 评论区域 -->
<view class="tips"><span>tips:内容丰富的评论有机会成为优质点评哦~</span></view>
<!-- 提交按钮 -->
<view class="plSubmit" @click="orderComment"><span>发表</span></view>
<!-- 提交按钮 -->
<PhoneMask :show1="popShow" @clickmask1="closePop"></PhoneMask>
<getvxphone :show="vxshow" @showFalse="showFalse"></getvxphone>
</view>
</template>
<script>
import App from '@/common/js/app.js';
import PhoneMask from '@/components/template/PhoneMask';
import getvxphone from '@/components/template/getVXphone.vue'
// #ifdef H5
import wxApi from '@/common/js/wxApi.js';
// #endif
export default {
components:{
getvxphone,
PhoneMask
},
data() {
return {
id: null,
type: null,
goodsDetail: null,
stars: [],
pic: [],
text: '',
star: null,
table: null,
picArray: [],
id1: null,
imageArr: [],
oderData:null,
img:'',
popShow: false,
vxshow:false
};
},
onLoad: function(option) {
this.img= this.imgfixUrl;
this.id = option.goods_id; //商品id type=9时为商户id
this.id1 = option.order_id; //订单id
this.type = option.plugin; //商品类型:1=抢购 2=团购 3=拼团 4=大礼包 5=优惠卷 6=折扣卡 7=砍价商品 8=积分商品 9=买单评价,获取商户信息
this.table = option.a;
this.init(option.order_id);
if(option.plugin == 'citydelivery'){
this.getorder(option)
}
},
methods: {
showFalse(){
console.log('进了showfalse')
this.vxshow = false;
},
closePop() {
let _this = this
_this.popShow = false
},
getorder(option){
App._post_form(
`&p=citydelivery&do=orderDetail&id=${option.order_id}&idstatus=${2}`,
{},
res => {
this.setData({
oderData:res.data
})
console.log(this.oderData);
},
false,
() => {
// _this.loadlogo = true
}
);
},
init(order_id) {
let _this = this;
// #ifdef H5
wxApi.wxRegister();
// #endif
//判断获取商品详情还是获取商户详情
if (_this.type === '9') {
//获取商户详情
_this.getStoreDetail();
} else if (_this.type === '6') {
//
_this.getPayOnlieOrder(order_id)
} else {
//获取商品详情
_this.getGoodsDetail();
}
},
getPayOnlieOrder(order_id) {
let _this = this
let data = {
orderid: order_id
}
App._post_form('&p=Goods&do=getPayOnlieOrder', data, res => {
// _this.goodsDetail = res.data;
_this.setData({
goodsDetail:res.data
})
})
},
// 加星星
checkedStar(xin) {
let _this = this;
_this.stars = [];
for (let i = 0; i < xin; i++) {
_this.stars.push(i + 1);
}
console.info(_this.stars);
},
// 商品详情信息获取
getGoodsDetail() {
let _this = this;
let data = {
order_id: _this.id1,
plugin: _this.type
};
App._post_form('&p=order&do=commentPage', data, res => {
_this.goodsDetail = res.data;
});
},
getStoreDetail() {
let _this = this;
let data = {
sid: _this.id,
};
App._post_form('&p=store&do=detail', data, res => {
console.log(res.data);
let storeData = {
logo: res.data.logo,
goods_name: res.data.storename + '在线买单',
};
_this.goodsDetail = storeData;
});
},
// 用户对订单进行评论
orderComment() {
let _this = this;
let data = {
id: _this.id1,
pic: _this.pic,
text: _this.text,
star: _this.stars.length,
table: _this.table
};
// uni.showLoading({
// })
App._post_form('&p=pay&do=orderComment', data, res => {
if (res.errno === 0) {
App.showSuccess('评价成功', () => {
// App.navigationTo({
// url: 'pages/subPages/orderList/orderList',
// navType: 'rediRect'
// })
uni.navigateBack({
delta:1
})
})
}
},fail=>{
// _this.gouniond();
if (fail.data.message == '未绑定手机号') {
//#ifdef H5
_this.popShow = true;
//#endif
//#ifndef H5
_this.vxshow = true;
//#endif
}
});
},
gouniond(){
uni.hideLoading();
},
// 删除图片
closePic(item) {
let _this = this
for (let i = 0; i < _this.picArray.length; i++) {
if (item == _this.picArray[i]) {
_this.picArray.splice(i, 1)
_this.pic.splice(i, 1)
}
}
},
// 文件上传接口
async uploadFiles(type) {
let _this = this;
// #ifdef H5
if(App.getClientType() == 2){
let res = await App.browser_upload(9);
for (let i = 0; i < res.tempFilePaths.length; i++) {
let aa = await App._upLoad(res.tempFilePaths[i])
_this.pic.push(aa.data.image);
_this.picArray.push(aa.data.img);
}
return
}
wxApi.choseImage(res => {
wxApi.uoloadIg(res.localIds[0], data => {
if (data.errMsg === 'uploadImage:ok') {
uni.showLoading({});
let requestData = {
upload_type: 2,
id: data.serverId
};
App._post_form(
'&do=uploadFiles',
requestData,
res => {
if (res.errno === 0) {
_this.pic.push(res.data.image);
_this.picArray.push(res.data.img);
}
},
false,
() => {
uni.hideLoading();
}
);
} else {
uni.hideLoading();
App.showError('上传失败');
}
});
});
// #endif
// #ifndef H5
wx.chooseImage({
count: 6,
sourceType: ['album', 'camera'],
success: async function(res) {
for (let i = 0; i < res.tempFilePaths.length; i++) {
let aa = await App._upLoad(res.tempFilePaths[i])
_this.pic.push(aa.data.image);
_this.picArray.push(aa.data.img);
}
}
})
// #endif
}
}
};
</script>
<style lang="less" scoped>
.closeButton {
width: 34upx !important;
height: 34upx !important;
position: relative;
bottom: 130upx;
left: 95upx;
}
page {
overflow-x: hidden;
}
.comment {
border: 1px solid rgba(0, 0, 0, 0);
font-size: 0;
background: #f8f8f8;
}
.orderInfo {
margin: 20upx auto 0 auto;
width: 690upx;
background: rgba(255, 255, 255, 1);
border-radius: 10upx;
}
.orderInfoPackage {
padding: 30upx;
>view {
display: inline-block;
vertical-align: top;
}
}
.orderInfoImg {
width: 128upx;
height: 128upx;
border-radius: 6upx;
overflow: hidden;
>image {
width: 128upx;
height: 128upx;
}
}
.info {
margin-left: 30upx;
width: 456upx;
>view:nth-child(1) {
height: 70upx;
}
.nameUp {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
>view:nth-child(2) {
width: 450upx;
margin-top: 20upx;
display: flex;
justify-content: space-between;
>span {
line-height: 55upx;
vertical-align: middle;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
>span {
margin-left: 15upx;
font-size: 24upx;
text-decoration: line-through;
color: rgba(153, 153, 153, 1);
}
}
>view {
vertical-align: middle;
text-align: center;
width: 139upx;
height: 55upx;
border: 1upx solid rgba(238, 238, 238, 1);
border-radius: 28upx;
>span {
font-size: 24upx;
color: rgba(153, 153, 153, 1);
line-height: 55upx;
}
}
}
}
.plView {
margin: 20upx auto 0 auto;
width: 690upx;
background: rgba(255, 255, 255, 1);
border-radius: 10upx;
}
.plPackage {
padding: 30upx;
}
.checkStar {
text-align: center;
>span {
vertical-align: middle;
font-size: 28upx;
color: rgba(153, 153, 153, 1);
}
}
.starPackage {
display: inline-block;
vertical-align: middle;
margin-left: 5upx;
>view {
display: inline-block;
vertical-align: middle;
margin-left: 20upx;
width: 49upx;
height: 47upx;
>image {
width: 49upx;
height: 47upx;
}
}
}
.plInput {
width: 630upx;
background: rgba(253, 251, 254, 1);
border-radius: 6upx;
margin: 50upx 0 0 0;
>textarea {
height: 180upx;
padding: 30upx;
width: 570upx;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
}
.plLength {
display: flex;
justify-content: space-between;
>span {
margin-right: 30upx;
font-size: 24upx;
color: rgba(153, 153, 153, 1);
}
}
.plUpload {
padding: 30upx;
}
.picMb {
vertical-align: top;
margin: 10upx 10upx 0 0;
display: inline-block;
width: 133upx;
height: 132upx;
border: 1upx solid rgba(204, 204, 204, 1);
border-radius: 6upx;
>image {
width: 133upx;
height: 132upx;
}
}
.upLoad {
margin: 10upx 0 0 0;
vertical-align: top;
display: inline-block;
width: 133upx;
height: 132upx;
border: 1upx dashed rgba(204, 204, 204, 1);
border-radius: 6upx;
text-align: center;
>image {
margin: 33upx 0 0 0;
width: 66upx;
height: 66upx;
}
}
.tips {
margin: 40upx 0 0 0;
text-align: center;
>span {
font-size: 24upx;
color: rgba(153, 153, 153, 1);
}
}
.plSubmit {
margin: 70upx auto 0 auto;
width: 688upx;
height: 80upx;
background: rgba(255, 68, 68, 1);
border-radius: 40upx;
text-align: center;
>span {
line-height: 80upx;
font-size: 28upx;
color: rgba(255, 255, 255, 1);
}
}
</style>