userAppeal.vue 5.44 KB
<template>
	<view class="page">
		<!-- 反馈内容 -->
		<view class="feedback-data">
			<view class="titleall-box">
				<view class="titleall-left">
					<view class="titleall-left-line"></view>回复信息
				</view>
			</view>
			<uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData" style="width: 96%;margin: 0 auto;">
				<uni-forms-item label="内容" required name="title">
					<uni-easyinput v-model="valiFormData.title" disabled  />
				</uni-forms-item>
				<uni-forms-item label="模块" required name="subTitle">
					<uni-easyinput v-model="valiFormData.subTitle" disabled  />
				</uni-forms-item>
				<uni-forms-item label="回复内容">
					<uni-easyinput type="textarea" disabled v-model="valiFormData.bodyContent" placeholder="请输入" />
				</uni-forms-item>
			</uni-forms>
			<!-- 选择反馈类型 -->
			<view class="feedback-type">
				<view class="feedback-type-left">状态</view>
				<view class="feedback-type-right">
					<view class="title">
						<text>{{TypeArray[TypeIndex]}}</text>
					</view>
					<view class="picker">
						<picker @change="FeedbackTypeCh" :value="TypeIndex" :range="TypeArray">
								<view class="uni-input">{{TypeArray[TypeIndex]}}</view>
						</picker>
					</view>
					<view class="more">
						<image src="../../../static/down1.png"></image>
					</view>
				</view>
			</view>
		</view>

		<!-- 提交 -->
		<!-- <view v-if="have" class="submit-btn" @click="submitContent('valiForm')">
			<text>发布</text>
		</view> -->
		<!-- <view class="submit-btn" @click="updateInfo('valiForm')">
			<text>确定</text>
		</view> -->
	</view>
</template>

<script>
	import {
		data
	} from '../../../uview-ui/libs/mixin/mixin';
	import request from '@/utils/request.js'
	import utils from '../../../service/utils';
	export default {
		data() {
			return {
				userCode: {},
				// 选择图片路径
				filePath: [],
				uploadPath: [],
				type: "",
				lastModifyUserId: '',
				// 校验表单数据
				valiFormData: {
					title: '',
					bodyContent: '',
					subTitle: '',
				},
				// 通知信息标题
				noticeTitle:'',
				// 通知详情
				noticeDesc:'',
				creater: '',
				rules: {
					title: {
						rules: [{
							required: true,
							errorMessage: '不能为空'
						}]
					},
					subTitle: {
						rules: [{
							required: true,
							errorMessage: '不能为空'
						}]
					},
				},
				baseUrl: "http://deyanggaoxin.fengshiyun.com",
				// 判断是否传了id
				isId: '',
				have: false,
				detailData: [],
				// 需要通知的公司的id
				companysId: [],
				tellInfo:[],
				TypeArray: ['已提交', '已处理', '忽略', '无效'],
				TypeIndex: 0,
				info:{}
			};

		},
		// onShow() {
		// 	this.getType()
		// },
		onUnload() {
			uni.$off('idInfo')
			uni.$off('tellInfo')
		},
		onLoad(options) {
			console.log("options", options)
			uni.$on('idInfo', res => {
				console.log("选择公司页面返回的公司ID", res)
				if(res.length > 0)
				this.companysId = res
			})
			uni.$on('tellInfo', res => {
				console.log("tell信息", res)
				if(res.length > 0)
				this.tellInfo = res
			})
			if (JSON.stringify(options) == "{}") {
				this.have = true
			} else {
				this.isId = JSON.parse(options.data)
				console.log("Id", this.isId)
				this.getConDetail(this.isId)
			}
			this.getUser()
			let user = uni.getStorageSync('user')
			this.lastModifyUserId = user.userInfo.userId

		},
		methods: {
			// 获取上传状态
			select(e) {
				console.log('选择文件:', e)
				this.filePath = e.tempFilePaths
			},
			// 获取用户信息
			getUser() {
				if (uni.getStorageSync('user')) {
					this.userCode = uni.getStorageSync('user').userInfo
					// this.userInfo = this.userCode.userAccount
					// this.userInfo = '123456'
					console.log('用户已登录!', this.userCode)
				} else {
					uni.showToast({
						title: '请登录',
						icon: 'none'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/login/index'
						})
					})
				}
			},
			// /**
			//  * 反馈类型
			//  * @param {Object} 
			//  */
			FeedbackTypeCh(val) {
				console.log(val);
				this.TypeIndex = val.detail.value;
			},
			// 获取信息
			getConDetail(id) {
				let that = this
				let currentId = id
				console.log(currentId)
				request({
					url:'/api/Extend/baseappealinformation/' + id,
					method:'get',
					data:{}
				}).then(res=>{
					if(res.code === 200){
						console.log(res)
						this.info = res.data
						if(this.info.status !== null){
							let index = this.TypeArray.findIndex(it=>it === this.info.status)
							this.TypeIndex = index
							console.log(index)
						}
						this.valiFormData.title = this.info.content
						this.valiFormData.subTitle = this.info.plate
						this.valiFormData.bodyContent = this.info.result
					}
				})
			},
			// 进行诉求处理
			updateInfo(){
				request({
					url:'/api/Extend/baseappealinformation/' + this.isId,
					method:'put',
					data:{
						content:this.info.content,
						status:this.TypeArray[this.TypeIndex],
						result:this.valiFormData.bodyContent,
						plate:this.info.plate,
						isShow:this.info.isShow,
						type:this.info.type,
						id:this.isId
					}
				}).then(res=>{
					console.log("修改后",res)
					if(res.code === 200){
						uni.showToast({
							icon:"success",
							title:'已完成!',
							duration:1500
						})
						uni.navigateBack({
							delta:1
						})
					}
				})
			}
		},
	}
</script>

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