myevaluatedetail.vue 7.29 KB
<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
			<view class="content" style="background-color: #fff;padding: 20rpx;height: 100vh;">
				<view class="" style="border-bottom: 1px double #ccc;padding-bottom: 30rpx;">
					
					<view class="" style="display: flex;align-items: center;">
						<span>报丧评分:</span>
						  <u--input
						    placeholder="请输入评分"
						    border="surround"
						    v-model="list.funeralScore"
						  ></u--input>
					</view>
				</view>
				
				<view class="" style="margin-top: 40rpx;border-bottom: 1px double #ccc;padding-bottom: 30rpx;" v-if="info.funeralScore != null">
					<view class="" style="display: flex;align-items: center;">
						<span>火化预约评分:</span>
						  <u--input
						    placeholder="请输入评分"
						    border="surround"
						    v-model="list.cremationScheduled"
						  ></u--input>
					</view>
				</view>
				
				<view class="" style="margin-top: 40rpx;border-bottom: 1px double #ccc;padding-bottom: 30rpx;" v-if="info.cremationId != null">
					<view class="" style="display: flex;align-items: center;">
						<span>礼堂预约评分:</span>
						  <u--input
						    placeholder="请输入评分"
						    border="surround"
						    v-model="list.hallScheduled"
						  ></u--input>
					</view>
				</view>
				
				<view class="" style="margin-top: 40rpx;border-bottom: 1px double #ccc;padding-bottom: 30rpx;" v-if="info.hallId != null">
					<view class="" style="display: flex;align-items: center;">
						<span>骨灰寄存评分:</span>
						  <u--input
						    placeholder="请输入评分"
						    border="surround"
						    v-model="list.ashesstorageScheduled"
						  ></u--input>
					</view>
				</view>
				
				<view class="" style="margin-top: 40rpx;border-bottom: 1px double #ccc;padding-bottom: 30rpx;">
					<view class="" style="display: flex;align-items: center;margin-bottom: 80rpx;">
						<span>总评分:</span>
						  <u--input
						    placeholder="请输入总评分"
						    border="surround"
						    v-model="list.score"
						  ></u--input>
					</view>
					<view class="top" style="margin-bottom: 20rpx;">
						<view style="margin-bottom: 20rpx;">评价内容:</view>
						<u--textarea v-model="list.content" placeholder="请输入内容" ></u--textarea>
					</view>
				</view>
				
				<view class="" style="position: absolute;position: fixed;bottom: 0;margin-bottom: 20rpx;width: 95vw;">
					<u-button @click="tj" style="width: 95vw;" type="primary" text="提交评价"></u-button>
				</view>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
import { data } from 'uview-ui/libs/mixin/mixin';
	export default {
		data() {
			return {
				OrderType: 0,
				nvConfig:{
					title:"服务评价详情",
					bgColor:"#ffffff",
					color:"#000000",
					fixedAssist:{
						hide:true,
					},
				},
				list:{
					// bereavementNumber: "1",
					// content:"",
					// createdTime: null,
					// createdUser: null,
					// evaluationTime: "2023-09-30",
					// id: null,
					// orderNumber: "1",
					// productId: "1",
					// score: "",
					// updatedTime: null,
					// updatedUser: null,
					// userId: "1",
					
					bereavementNumber:"",
					funeralScore:"",
					
					cremationId:"",
					cremationScheduled:"",
					
					hallId:"",
					hallScheduled:"",
					
					ashesstorageId:"",
					ashesstorageScheduled:"",
					
					userId:uni.getStorageSync("USERS_KEY").userId,
					content:"",
					score:"",
				},
				info:{}
			};
		},
		onPageScroll(e) {this.$refs.nv.pageScroll(e)},
		computed:{
			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
		},
		onLoad(params) {
			console.log("info",JSON.parse(params.info));
			this.info = JSON.parse(params.info);
		},
		methods:{
			// 提交评论
			tj(){
				console.log(this.list);
				// var date = new Date()
				// this.list.evaluationTime = this.parseTime(date);
				// this.list.bereavementNumber = this.info.orderNumber;
				// console.log(this.list);
				// this.API.postpj(this.list).then(res=>{
				// 	console.log("提交评价",res);
				// 	if(res.code == 200){
				// 		this.$refs.uToast.show({
				// 			type: 'success',
				// 			title: '成功主题(带图标)',
				// 			message: "评论成功",
				// 			iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
				// 		})
				// 		setTimeout(function () {
				// 		    uni.reLaunch({
				// 		    	url:'/pages/my/my'
				// 		    })
				// 		}, 2000);
				// 	}
				// })
				var info = {
					bereavementNumber:"",
					funeralScore:"",
					
					cremationId:"",
					cremationScheduled:"",
					
					hallId:"",
					hallScheduled:"",
					
					ashesstorageId:"",
					ashesstorageScheduled:"",
					
					userId:uni.getStorageSync("USERS_KEY").userId,
					content:"",
					score:"",
					evaluationTime:"",
				}
				var date = new Date()
				info.evaluationTime = this.parseTime(date);
				info.bereavementNumber = this.info.funeralNumber;
				info.funeralScore = this.list.funeralScore;

				info.cremationId = this.info.cremationId;
				info.cremationScheduled = this.list.cremationScheduled;
				
				info.hallId = this.info.hallId;
				info.hallScheduled = this.list.hallScheduled;
				
				info.ashesstorageId = this.info.ashesstorageId;
				info.ashesstorageScheduled = this.list.ashesstorageScheduled;
				
				info.content = this.list.content;
				info.score = this.list.score;
				
				console.log("提交项目",info);
				// return
				this.API.sypjtj(info).then(res=>{
					console.log("评价结果",res);
					this.$refs.uToast.show({
						type: 'success',
						title: '成功主题(带图标)',
						message: "购买成功",
						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
					})
					setTimeout(function () {
					    uni.navigateBack({
					        delta: 1
					    });
					}, 2000);
				})
			},
			// 时间搓处理
			parseTime(timestamp){
			    var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
			    var Y = date.getFullYear() + '-';
			    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
			    var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
			    var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
			    var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
			    var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
			
			    let strDate = Y+M+D
			    console.log(strDate) //2020-05-08 17:44:56 
				return strDate;
			},

			/**
			 * 返回点击
			 */
			onBack(){
				uni.navigateBack();
			},
			/**
			 * 订单tab点击
			 */
			onOrderTab(type){
				this.OrderType = type;
				// #ifdef H5
				uni.redirectTo({
					url: '/pages/MyOrderList/MyOrderList?type=' + type,
				})
				//#endif
			},
			/**
			 * 订单列表点击
			 */
			onOrderList(){
				uni.navigateTo({
					url: '/pages/OrderDetails/OrderDetails',
				})
			},
      /**
       * 评价点击
       */
      onEvaluate(){
			  uni.navigateTo({
          url: '/pages/MyEvaluatePush/MyEvaluatePush'
        })
      }
		}
	}
</script>

<style scoped lang="scss">
	@import 'myevaluate.scss';
</style>