wangxy 1 день назад
Родитель
Сommit
f90e13f636

+ 67 - 0
pages/admin/Hetong/components/laorenNianling.vue

@@ -0,0 +1,67 @@
+<template>
+	<view v-for="(item,index) in myData.children" :key="item.timer">
+		<view><text v-if="index == 0">老人年龄</text></view>
+		<uni-easyinput v-model="item.age" placeholder="请输入老人年龄" @change="onChange" />
+		<button @click="handleAdd" v-if="myData.children.length == 1">+</button>
+		<button @click="handleAdd"
+			v-else-if="myData.children.length-1 == index && myData.children.length != 1 && myData.children.length<3">+</button>
+		<button @click="handleDelete(item.timer)" v-else>-</button>
+	</view>
+</template>
+
+<script setup>
+	import {
+		computed,
+		reactive,
+		watch,
+		watchEffect
+	} from "vue"
+	import {
+		useHetong
+	} from "../useHetong.js"
+	const {
+		injectHetong
+	} = useHetong();
+
+	const data = injectHetong()
+
+	const emits = defineEmits(['change'])
+
+	const myData = reactive({
+		children: []
+	})
+
+	watchEffect(() => {
+		const list = data.hetong.qzHzNianliang && data.hetong.qzHzNianliang.split(',').map((item,index) => ({
+			age: item,
+			timer: new Date().getTime()+index
+		}));
+		myData.children = list.length ? list : [{
+			age: '',
+			timer: new Date().getTime()
+		}]
+	})
+
+	function onChange() {
+		data.hetong.qzHzNianliang = myData.children.map(item => item.age).join(',')
+	}
+
+	function handleAdd() {
+		myData.children.push({
+			age: '',
+			timer: new Date().getTime()
+		});
+		data.hetong.qzHzNianliang = myData.children.map(item => item.age).join(',')
+		emits('change')
+	}
+
+	function handleDelete(timer) {
+		console.log('timer', timer)
+		myData.children = myData.children.filter(item => item.timer != timer)
+		data.hetong.qzHzNianliang = myData.children.map(item => item.age).join(',')
+		emits('change')
+	}
+</script>
+
+<style>
+</style>

+ 28 - 0
pages/admin/Hetong/components/zhaoguYunfu.vue

@@ -0,0 +1,28 @@
+<template>
+	<view class="fwnr-item-box">
+		<view class="title-row-box">
+			<text>孕、产妇护理</text> 
+			 <view class="title-del-btn">
+				 <icon class="del-icon"></icon>
+			 </view>
+		</view>
+		<view class="fwnr-label-input">
+			<uni-easyinput v-model="data.hetong.lxName" placeholder="请输入护理内容" />
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		useHetong
+	} from "../useHetong.js"
+	const {
+		injectHetong
+	} = useHetong();
+	
+	const data = injectHetong()
+</script>
+
+
+<style>
+</style>