funeralreport.vue 14.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
		<view class="content">
			<view class="message-list">
			<view class="titleall-box">
				<view class="titleall-left"><view class="titleall-left-line"></view>逝者信息<text style="color: red;">(必填)</text></view>
			</view>
			<view class="info-box">
				<view class="info-box-list">
					<view class="info-box-width">
						<view><input class="input-text" v-model="from.deceasedName" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">逝者姓名</view>
					</view>
					<view class="info-box-width">
						<view><input class="input-text" v-model="from.deceasedAge" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">逝者年龄</view>
					</view>
				</view>
				<view class="info-box-list">
					<view class="info-box-width">
						<view @click="xbshow = true">
							{{sex}}
						</view>
						<view class="info-box-small">逝者性别</view>
					</view>
					<view class="info-box-width">
						<view><input class="input-text" v-model="from.idCardNumber" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">逝者身份证号</view>
					</view>
				</view>
				<view class="info-box-list">
					<view class="info-box-width">
						<view><input class="input-text" v-model="from.ethnicity" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">逝者民族</view>
					</view>
				</view>
				<u-picker :show="xbshow" @confirm="xbconfirm" @cancel="xbclose" :columns="xbcolumns"></u-picker>
			</view>
			</view>
			
			<view class="message-list">
				<view class="titleall-box">
					<view class="titleall-left"><view class="titleall-left-line"></view>联系人信息<text style="color: red;">(必填)</text></view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="info-box-width">
							<view><input class="input-text" v-model="from.contactName" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
							<view class="info-box-small">联系人姓名</view>
						</view>
						<view class="info-box-width">
							<view><input v-model="from.contactPhone" class="input-text" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
							<view class="info-box-small">联系人电话</view>
						</view>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="message-list">
				<view class="titleall-box">
					<view class="titleall-left"><view class="titleall-left-line"></view>遗体接运信息<text style="color: red;">(必填)</text></view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="info-box-width width100">
							<!-- <view @click="areashow = true">{{area}}</view> -->
							<view>
								<input v-model="area" class="input-text" type="text" placeholder="请输入详细地址" placeholder-class="inputtext" />
							</view>
							<view class="info-box-small">接运地点</view>
						</view>
					</view>
					<u-picker :show="areashow"  :columns="areacolumns" @confirm="areaconfirm" @close="areaclose"></u-picker>
					<view class="info-box-list">
						<view class="info-box-width width100">
							<view @click="timeshow = true">
								<label>{{accessTime}}</label>
							</view>
							<view class="info-box-small">接运时间</view>
						</view>
					</view>
					<view class="info-box-list">
						<view class="info-box-width width100">
							<view>
								<input v-model="remarks" class="input-text" type="text" placeholder="请输入" placeholder-class="inputtext" />
							</view>
							<view class="info-box-small">备注</view>
						</view>
					</view>
				</view>
			</view>
			<u-datetime-picker
			    :show="timeshow1"
			    mode="datetime"
				v-model="accessTimeby"
				@confirm="xztime"
				@cancel="qxtime"
			></u-datetime-picker>
			<!--  -->
			<u-calendar :show="jytimeshow" @confirm="jytimeconfirm" @close="jytimeclose"></u-calendar>
			<view class="message-list">
				<view class="titleall-box">
					<view class="titleall-left"><view class="titleall-left-line"></view>死亡因数<text style="color: red;">(必填)</text></view>
				</view>
				<view class="info-box">
					<view class="info-box-list">
						<view class="info-box-width">
							<view @click="swyyshow = true"><input disabled v-model="from.deathCase" class="input-text" type="text" placeholder="请选择" placeholder-class="inputtext" /></view>
							<view class="info-box-small">死亡原因</view>
						</view>
						<view class="info-box-width" @click="timeshow = true">
							<view>{{from.deathdate}}</view>
							<view class="info-box-small">死亡日期</view>
						</view>
					</view>
					<u-picker :show="swyyshow" @confirm="swyyconfirm" @cancel="swyyclose" :columns="swyycolumns"></u-picker>
				</view>
			</view>
			<u-calendar minDate="2023-11-01" maxDate="3050-12-01" :show="timeshow" @confirm="timeconfirm" @close="timeclose"></u-calendar>
			<view class="message-list">
				<view class="titleall-box">
					<view class="titleall-left"><view class="titleall-left-line"></view>家属信息<text>(选填)</text></view>
				</view>
				<view class="info-box">
				<view class="info-box-list">
					<view class="info-box-width">
						<view><input v-model="from.relativeName" class="input-text" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">家属姓名</view>
					</view>
					<view class="info-box-width">
						<view><input v-model="from.relativePhone" class="input-text" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">家属电话</view>
					</view>
				</view>
				<view class="info-box-list">
					<view class="info-box-width">
						<view class="" @click="qsgxshow = true">
							{{from.deceasedRelationship}}
						</view>
						<!-- <view><input class="input-text" type="text" placeholder="请选择" placeholder-class="inputtext" /></view> -->
						<view class="info-box-small">与逝者关系</view>
					</view>
					<u-picker :show="qsgxshow" @confirm="qsgxconfirm" @cancel="qsgxclose" :columns="qsgxcolumns"></u-picker>
					<view class="info-box-width">
						<view><input class="input-text" v-model="from.relativeIdCardNumber" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">家属证件号码</view>
					</view>
				</view>
				<view class="info-box-list">
					<view class="info-box-width">
						<view><input class="input-text"  v-model="from.relativeAddress" type="text" placeholder="请输入" placeholder-class="inputtext" /></view>
						<view class="info-box-small">家属地址</view>
					</view>
				</view>
			</view>
			</view>
			
			<view class="page-footer">
			  <view class="footer-buy">
			    <view class="cart-add" @click="lxdh">
					<view><image src="../../static/btn2.png"></image></view>
					<view class="cart-add-text"><image src="../../static/phone.png"></image><text>联系电话</text></view>
			    </view>
			    <view class="buy-at" @click="funeralresult">
					<image src="../../static/btn1.png"></image>
			      <text>提交</text>
			    </view>
			  </view>
			</view>
		</view>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import BASE_URL from "@/common/config.js"
	export default {
		data() {
			return {
				BASE_URL,
				fileList: [],
				nvConfig:{
					title:"报丧登记",
					bgColor:"#ffffff",
					color:"#000000",
					fixedAssist:{
						hide:true,
					},
				},
				sex:"请选择",
				from:{
					deceasedName:"",
					deceasedAge:"",
					deceasedSex:"请选择",
					idCardNumber:"",
					ethnicity:"",
					
					contactName:"",
					contactPhone:"",
					
					deathCase:null,
					deathdate:"请选择",
					
					
					relativeName:"",
					relativePhone:"",
					deceasedRelationship:"请选择",
					relativeIdCardNumber:"",
					relativeAddress:"",
					
					provelmage:"",
					
					accessLocation:"",
					accessTime:"",
					obituaryType:"",
					remarks:"",
					userId:"",
				},
				xbshow:false,
				xbcolumns: [
				    ['男', '女']
				],
				qsgxshow:false,
				qsgxcolumns: [
				    ['爱人', '兄弟','父亲','母亲','其他']
				],
				timeshow:false,
				jytimeshow:false,
				// 不详、车祸、触电、溺水、枪击、烧死、事故、摔、死胎、死刑、他杀、滝死、意外、中毒、坠楼、自杀
				swyycolumns:[
					['病','不详','车祸','触电','溺水','枪击','烧死','事故','摔','死胎','死刑','他杀','滝死','意外','中毒','坠楼','自杀']
				],
				swyyshow:false,
				
				
				// 
				timeshow1:false,
				accessLocation:"",
				area:"",
				xxarea:"",
				areashow:false,
				areacolumns:[
					['地区1', '地区2']
				],
				
				accessTime:"请选择",
				accessTimeby:2,
				timeshow:false,
				remarks:"",
				info:{}
				// 
			};
		},
		onPageScroll(e) {this.$refs.nv.pageScroll(e)},
		computed:{
			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
		},
		onLoad(params) {
			const timestamp = Date.now();
			this.accessTime = this.timestampToTime(timestamp);
			
		},
		methods:{
			lxdh(){
				uni.showModal({
					title: '联系电话',
					content: '028-36241643',
					success: function(res) {
						if (res.confirm) {
							console.log('点击了确认')
						} else {
							console.log('点击了取消')
						}
					}
				})
			},
			// 
			xztime(value){
				this.timeshow1 = false
				var that = this;
				let selectTime =this.timestampToTime(value.value);
				that.accessTime = selectTime;
			},
			qxtime(){
				this.timeshow1 = false
			},
			timeclose(){
				this.timeshow1 = false
			},
			timestampToTime(timestamp) {
			    timestamp = timestamp ? timestamp : null;
			    let date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
			    let Y = date.getFullYear() + '-';
			    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
			    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
			    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
			    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
			    return Y + M + D + h + m + s;
			},
			funeralresult(){
				this.from.accessLocation = this.area
				this.from.accessTime = this.accessTime
				if(uni.getStorageSync('dh') == 2){
					this.from.obituaryType = "电话报丧"
				}else{
					this.from.obituaryType = "网上报丧"
				}
				this.from.remarks = this.remarks
				this.from.userId = uni.getStorageSync("USERS_KEY").userId
				console.log("提交数据",this.from,this.sex,this.area,this.accessTime,this.remarks);
				if(this.from.deceasedName != '' && this.from.deceasedAge != '' 
				&& this.from.idCardNumber != '' && this.from.ethnicity != '' 
				&& this.from.contactName != '' && this.from.contactPhone != '' 
				&& this.from.deathCase != '' && this.from.deathdate == '请选择' 
				&& this.deceasedSex != '请选择' && this.accessLocation != '请输入详细地址' && this.accessTime != "请选择" && this.remarks != ''){
					uni.showToast({
						icon:"error",
						title:"请填写完整必填信息"
					})
				}else{
					this.API.tjwsyy(this.from).then(res=>{
						console.log("网上报丧",res);
					})
					uni.navigateTo({
						url: '/pages/funeralresult/funeralresult',
					})
				}
			},
			// 地区选择确认回调
			areaconfirm(e){
				this.areashow = false
				this.area = e.value[0];
			},
			areaclose(){
				this.areashow = false
			},
			timeclose(){
				this.timeshow = false
			},
			// 
			// 上传图片
			async afterRead(event) {
				console.log(event);
				var res = await this.uploadImg(event.file.url)
				console.log("上传图片",res,this.BASE_URL)
				res = JSON.parse(res.data)
				this.from.provelmage = this.BASE_URL + res.fileName
				this.fileList.push({
					name:res.fileName,
					fileId:res.newFileName,
					url: this.BASE_URL + res.fileName
				})
			},
			uploadImg(url) {
				return new Promise((r, e) => {
					uni.uploadFile({
						url: this.BASE_URL + "/common/upload",
						filePath: url,
						name: "file",
						success: (d) => r(d)
					})
				})
			},
			deletePic(event) {
				this.fileList.splice(event.index, 1)
			},
			funeralreportmove(){
				// this.from.deceasedSex = this.sex
				var info = JSON.stringify(this.from)
				console.log("提交的数据",this.from,this.sex);
				// return
				// deceasedName deceasedAge idCardNumber ethnicity contactName contactPhone deathCase deathdate  sex 
				if(this.from.deceasedName == '' || this.from.deceasedAge == '' 
				|| this.from.idCardNumber == '' || this.from.ethnicity == '' 
				|| this.from.contactName == '' || this.from.contactPhone == '' 
				|| this.from.deathCase == '' || this.from.deathdate == '请选择' || this.sex == '请选择'){
					uni.showToast({
						title: '请输入完整必填',
						//将值设置为 success 或者直接不用写icon这个参数
						icon: 'error',
						//显示持续时间为 2秒
						duration: 2000
					})  
				}else{
					uni.navigateTo({
						url: '/pages/funeralreportmove/funeralreportmove?info=' + info,
					})
				}
				
			},
			// 性别确认选择
			xbconfirm(e){
				this.xbshow = false
				this.sex  = e.value[0]
				this.from.deceasedSex = e.value[0]
				console.log("性别选择",e);
			},
			// 性别取消选择
			xbclose(){
				this.xbshow = false
			},
			// 亲属关系确认选择
			qsgxconfirm(e){
				this.qsgxshow = false
				this.from.deceasedRelationship = e.value[0]
			},
			qsgxclose(){
				this.qsgxshow = false
			},
			// 死亡日期确认
			timeconfirm(e){
				console.log("死亡时间",e);
				this.from.deathdate = e[0]
				this.timeshow = false
			},
			timeclose(){
				this.timeshow = false
			},
			// 死亡原因确认
			swyyconfirm(e){
				console.log("e",e);
				this.from.deathCase = e.value[0]
				this.swyyshow = false
			},
			// 死亡原因取消
			swyyclose(){
				this.swyyshow = false
			}
			
		}
	}
</script>

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