tcwm-uniapp-user/pages/order/feedback.vue

442 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="page">
<!-- <view class="feedback-title"> -->
<!-- <text>评价</text> -->
<!-- <text @tap="chooseMsg">快速键入</text> -->
<!-- </view> -->
<view class="feedback-body">
<textarea placeholder="请输入你的评价..." v-model="sendDate.content" class="feedback-textare" />
</view>
<!-- <view class="feedback-title"><text>QQ/邮箱</text></view> -->
<!-- <view class="feedback-body"><input class="feedback-input" v-model="sendDate.mail" placeholder="方便我们联系你 " /></view> -->
<view class="text-white padding bg radius margin-tb">
<view>
<view class="text-lg margin-top-sm text-black">商品评价图(可多张)</view>
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view>
<view class="margin-top flex margin-right-sm flex-wrap">
<view class="flex"
style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;"
v-for="(image,index) in shopBanner" :key="index">
<!-- <image :src="image" style="width: 100%;height: 100%;"></image> -->
<image :src="image" style="width: 100%;height: 100%;"></image>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="removeImg(index)">
<u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
</view>
</view>
<view class="flex"
style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;" @click="addImages(2)" v-if="shopBanner.length<9">
<!-- <image :src="image" style="width: 100%;height: 100%;"></image> -->
<view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
class="flex justify-center align-center">
<view>
<view class="text-center">
<image src="/static/images/addimg.png" style="width: 65rpx;height: 55rpx;">
</image>
</view>
<view class="text-center text-black">添加图片</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="feedback-title feedback-star-view">
<text>订单评分</text>
<view class="feedback-star-view">
<!-- <text class="feedback-star" v-for="(value, key) in stars" :key="key" :class="key < sendDate.score ? 'active' : ''" @tap="chooseStar(value)"></text> -->
</view>
<u-rate :count="count" min-count='1' active-color="#FCD202" v-model="value"></u-rate>
</view>
<button type="primary" style="background: #FCD202;margin-top: 32upx;" class="feedback-submit"
@tap="send">提交</button>
</view>
</template>
<script>
import configUrl from '../../common/config.js'
export default {
data() {
return {
shopBanner: [],
msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视丑哭了', '偶发性崩溃'],
stars: [1, 2, 3, 4, 5],
imageList: [],
sendDate: {
score: 5,
content: '',
contact: '',
goodsId: '',
ordersId: '',
orderNumber: '',
shopId: ''
},
count: 5,
value: 5,
goodsId: '',
ordersId: '',
orderNumber: '',
};
},
onLoad(e) {
this.sendDate.goodsId = e.goodsId
this.sendDate.ordersId = e.ordersId
this.sendDate.orderNumber = e.orderNumber
this.sendDate.shopId = e.shopId
// let deviceInfo = {
// appid: plus.runtime.appid,
// imei: plus.device.imei, //设备标识
// p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型i表示iOS平台a表示Android平台。
// md: plus.device.model, //设备型号
// app_version: plus.runtime.version,
// plus_version: plus.runtime.innerVersion, //基座版本号
// os: plus.os.version,
// net: '' + plus.networkinfo.getCurrentType()
// };
// this.sendDate = Object.assign(deviceInfo, this.sendDate);
},
methods: {
// 图片上传
addImages(e) {
let that = this
uni.chooseImage({
count: 9,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
uni.uploadFile({ // 上传接口
// url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
// url: 'https://tcwm.xianmaxiong.com/sqx_fast/alioss/upload',
url:configUrl.APIHOST+'/alioss/upload',
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
if (that.shopBanner.length < 9) {
if(JSON.parse(uploadFileRes.data).data){
that.shopBanner.push(JSON.parse(uploadFileRes.data).data)
}else{
uni.showToast({
title:'图片上传失败,请重试',
icon:'none'
})
}
}
console.log(that.shopBanner)
uni.hideLoading();
}
});
}
}
})
},
// 评价图删除
removeImg(index) {
this.shopBanner.splice(index, 1)
},
close(e) {
this.imageList.splice(e, 1);
},
chooseMsg() {
//快速输入
uni.showActionSheet({
itemList: this.msgContents,
success: res => {
this.sendDate.content = this.msgContents[res.tapIndex];
}
});
},
chooseImg() {
//选择图片
uni.chooseImage({
sourceType: ['camera', 'album'],
sizeType: 'compressed',
count: 8 - this.imageList.length,
success: res => {
this.imageList = this.imageList.concat(res.tempFilePaths);
}
});
},
chooseStar(e) {
//点击评星
this.sendDate.score = e;
},
previewImage() {
//预览图片
uni.previewImage({
urls: this.imageList
});
},
send() {
//发送反馈
// console.log(this.sendDate,'111111111');
// console.log(this.shopBanner.join(','),'22222222222222222')
if (!this.sendDate.content) {
uni.showToast({
icon: 'none',
title: '请输入评价内容'
});
return;
}
if(!this.shopBanner.length){
uni.showToast({
icon: 'none',
title: '请上传商品评价图'
});
return;
}
this.$queue.showLoading('加载中...');
console.log(this.orderNumber)
this.$Request.postJson('/app/order/insertEvaluate', {
goodsId: this.sendDate.goodsId,
ordersId: this.sendDate.ordersId,
orderNumber: this.sendDate.orderNumber,
evaluateMessage: this.sendDate.content,
score: this.value,
shopId: this.sendDate.shopId,
pictures:this.shopBanner.length>0?this.shopBanner.join(','):[]
}).then(res => {
if (res.code === 0) {
uni.showToast({
title: '评价成功'
});
setTimeout(function() {
uni.navigateBack();
}, 1000);
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '评价失败',
content: res.msg
});
}
});
}
}
};
</script>
<style>
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
}
page {
background-color: #FFFFFF;
}
view {
font-size: 28upx;
}
.input-view {
font-size: 28upx;
}
.close-view {
text-align: center;
line-height: 14px;
height: 16px;
width: 16px;
border-radius: 50%;
background: #ff5053;
color: #ffffff;
position: absolute;
top: -6px;
right: -4px;
font-size: 12px;
}
/* 上传 */
.uni-uploader {
flex: 1;
flex-direction: column;
}
.uni-uploader-head {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.uni-uploader-info {
color: #b2b2b2;
}
.uni-uploader-body {
margin-top: 16upx;
}
.uni-uploader__files {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.uni-uploader__file {
margin: 10upx;
width: 210upx;
height: 210upx;
}
.uni-uploader__img {
display: block;
width: 210upx;
height: 210upx;
}
.uni-uploader__input-box {
position: relative;
margin: 10upx;
width: 208upx;
height: 208upx;
border: 2upx solid #d9d9d9;
}
.uni-uploader__input-box:before,
.uni-uploader__input-box:after {
content: ' ';
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #d9d9d9;
}
.uni-uploader__input-box:before {
width: 4upx;
height: 79upx;
}
.uni-uploader__input-box:after {
width: 79upx;
height: 4upx;
}
.uni-uploader__input-box:active {
border-color: #999999;
}
.uni-uploader__input-box:active:before,
.uni-uploader__input-box:active:after {
background-color: #999999;
}
.uni-uploader__input {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
/*问题反馈*/
.feedback-title {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20upx;
color: #8f8f94;
font-size: 28upx;
}
.feedback-star-view.feedback-title {
justify-content: flex-start;
margin: 0;
}
.feedback-quick {
position: relative;
padding-right: 40upx;
}
.feedback-quick:after {
font-family: uniicons;
font-size: 40upx;
content: '\e581';
position: absolute;
right: 0;
top: 50%;
color: #bbb;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.feedback-body {
font-size: 32upx;
padding: 16upx;
margin: 16upx;
border-radius: 16upx;
background: #F2F2F2;
color: #FFF;
}
.feedback-textare {
height: 200upx;
font-size: 30upx;
line-height: 50upx;
width: 100%;
box-sizing: border-box;
padding: 10upx 0upx 0;
color: #8f8f94;
}
.feedback-input {
font-size: 32upx;
height: 60upx;
padding: 15upx 20upx;
line-height: 60upx;
}
.feedback-uploader {
padding: 22upx 20upx;
}
.feedback-star {
font-family: uniicons;
font-size: 40upx;
margin-left: 6upx;
}
.feedback-star-view {
margin-left: 20upx;
}
.feedback-star:after {
content: '\e408';
}
.feedback-star.active {
color: #ffb400;
}
.feedback-star.active:after {
content: '\e438';
}
.feedback-submit {
background: #007aff;
color: #ffffff;
margin: 20upx;
}
</style>