child-info.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <text class="title">孩子信息</text>
  5. <text class="subtitle">请填写孩子的详细信息,用于测评档案</text>
  6. </view>
  7. <!-- 基本信息 -->
  8. <view class="section">
  9. <view class="section-title">基本信息</view>
  10. <view class="form-group">
  11. <view class="form-label">孩子姓名</view>
  12. <input class="form-input" v-model="form.childName" placeholder="请输入孩子姓名" />
  13. </view>
  14. <view class="form-group">
  15. <view class="form-label">出生日期</view>
  16. <picker mode="date" :value="form.childBirthday" @change="onBirthdayChange">
  17. <view class="picker-value">{{ form.childBirthday || '请选择出生日期' }}</view>
  18. </picker>
  19. </view>
  20. <view class="form-group">
  21. <view class="form-label">性别</view>
  22. <radio-group @change="onGenderChange">
  23. <label class="radio-item">
  24. <radio value="男" :checked="form.childGender === '男'" />
  25. <text>男</text>
  26. </label>
  27. <label class="radio-item">
  28. <radio value="女" :checked="form.childGender === '女'" />
  29. <text>女</text>
  30. </label>
  31. </radio-group>
  32. </view>
  33. <view class="form-group">
  34. <view class="form-label">年龄</view>
  35. <text class="form-value">{{ form.childAge || '自动计算' }}</text>
  36. </view>
  37. </view>
  38. <!-- 学校信息 -->
  39. <view class="section">
  40. <view class="section-title">学校信息</view>
  41. <view class="form-group">
  42. <view class="form-label">学校名称</view>
  43. <input class="form-input" v-model="form.school" placeholder="请输入学校名称" />
  44. </view>
  45. <view class="form-group">
  46. <view class="form-label">年级</view>
  47. <input class="form-input" v-model="form.grade" placeholder="如:一年级" />
  48. </view>
  49. <view class="form-group">
  50. <view class="form-label">班级</view>
  51. <input class="form-input" v-model="form.gradeClass" placeholder="如:3班" />
  52. </view>
  53. <view class="form-group">
  54. <view class="form-label">在校成绩</view>
  55. <radio-group @change="onSchoolScoreChange">
  56. <label class="radio-item">
  57. <radio value="优秀" :checked="form.schoolScore === '优秀'" />
  58. <text>优秀</text>
  59. </label>
  60. <label class="radio-item">
  61. <radio value="良好" :checked="form.schoolScore === '良好'" />
  62. <text>良好</text>
  63. </label>
  64. <label class="radio-item">
  65. <radio value="一般" :checked="form.schoolScore === '一般'" />
  66. <text>一般</text>
  67. </label>
  68. <label class="radio-item">
  69. <radio value="较差" :checked="form.schoolScore === '较差'" />
  70. <text>较差</text>
  71. </label>
  72. </radio-group>
  73. </view>
  74. </view>
  75. <!-- 身体信息 -->
  76. <view class="section">
  77. <view class="section-title">身体信息</view>
  78. <view class="form-row">
  79. <view class="form-group half">
  80. <view class="form-label">身高 (cm)</view>
  81. <input class="form-input" type="number" v-model="form.height" placeholder="cm" />
  82. </view>
  83. <view class="form-group half">
  84. <view class="form-label">体重 (kg)</view>
  85. <input class="form-input" type="digit" v-model="form.weight" placeholder="kg" />
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 家庭信息 -->
  90. <view class="section">
  91. <view class="section-title">家庭信息</view>
  92. <view class="form-group">
  93. <view class="form-label">家庭状况</view>
  94. <input class="form-input" v-model="form.familyStatus" placeholder="如:双亲家庭/单亲家庭" />
  95. </view>
  96. <view class="form-group">
  97. <view class="form-label">父母最高学历</view>
  98. <radio-group @change="onParentDegreeChange">
  99. <label class="radio-item">
  100. <radio value="高中及以下" :checked="form.parentDegree === '高中及以下'" />
  101. <text>高中及以下</text>
  102. </label>
  103. <label class="radio-item">
  104. <radio value="大专" :checked="form.parentDegree === '大专'" />
  105. <text>大专</text>
  106. </label>
  107. <label class="radio-item">
  108. <radio value="本科" :checked="form.parentDegree === '本科'" />
  109. <text>本科</text>
  110. </label>
  111. <label class="radio-item">
  112. <radio value="硕士" :checked="form.parentDegree === '硕士'" />
  113. <text>硕士</text>
  114. </label>
  115. <label class="radio-item">
  116. <radio value="博士" :checked="form.parentDegree === '博士'" />
  117. <text>博士</text>
  118. </label>
  119. </radio-group>
  120. </view>
  121. <view class="form-group">
  122. <view class="form-label">民族</view>
  123. <input class="form-input" v-model="form.nation" placeholder="如:汉族" />
  124. </view>
  125. <view class="form-group">
  126. <view class="form-label">是否独生子女</view>
  127. <radio-group @change="onSingleChildChange">
  128. <label class="radio-item">
  129. <radio value="是" :checked="form.singleChild === '是'" />
  130. <text>是</text>
  131. </label>
  132. <label class="radio-item">
  133. <radio value="否" :checked="form.singleChild === '否'" />
  134. <text>否</text>
  135. </label>
  136. </radio-group>
  137. </view>
  138. </view>
  139. <!-- 地址信息 -->
  140. <view class="section">
  141. <view class="section-title">地址信息</view>
  142. <view class="form-group">
  143. <view class="form-label">省份</view>
  144. <input class="form-input" v-model="form.province" placeholder="请输入省份" />
  145. </view>
  146. <view class="form-group">
  147. <view class="form-label">城市</view>
  148. <input class="form-input" v-model="form.city" placeholder="请输入城市" />
  149. </view>
  150. <view class="form-group">
  151. <view class="form-label">区县</view>
  152. <input class="form-input" v-model="form.district" placeholder="请输入区县" />
  153. </view>
  154. <view class="form-group">
  155. <view class="form-label">详细地址</view>
  156. <input class="form-input" v-model="form.address" placeholder="请输入详细地址" />
  157. </view>
  158. </view>
  159. <!-- 紧急联系人 -->
  160. <view class="section">
  161. <view class="section-title">紧急联系人</view>
  162. <view class="form-group">
  163. <view class="form-label">姓名</view>
  164. <input class="form-input" v-model="form.urgentName" placeholder="紧急联系人姓名" />
  165. </view>
  166. <view class="form-group">
  167. <view class="form-label">电话</view>
  168. <input class="form-input" type="number" v-model="form.urgentPhone" placeholder="紧急联系人电话" />
  169. </view>
  170. </view>
  171. <button class="btn-submit" @click="submit">下一步</button>
  172. </view>
  173. </template>
  174. <script>
  175. export default {
  176. data() {
  177. return {
  178. flowData: {},
  179. form: {
  180. childName: '',
  181. childBirthday: '',
  182. childGender: '',
  183. childAge: 0,
  184. school: '',
  185. grade: '',
  186. gradeClass: '',
  187. height: '',
  188. weight: '',
  189. familyStatus: '',
  190. parentDegree: '',
  191. nation: '',
  192. province: '',
  193. city: '',
  194. district: '',
  195. address: '',
  196. singleChild: '',
  197. schoolScore: '',
  198. urgentName: '',
  199. urgentPhone: ''
  200. }
  201. }
  202. },
  203. onLoad() {
  204. this.flowData = uni.getStorageSync('assessmentFlowData') || {}
  205. },
  206. methods: {
  207. onBirthdayChange(e) {
  208. this.form.childBirthday = e.detail.value
  209. this.calcAge(e.detail.value)
  210. },
  211. calcAge(birthday) {
  212. if (!birthday) return
  213. const birth = new Date(birthday)
  214. const today = new Date()
  215. let age = today.getFullYear() - birth.getFullYear()
  216. const m = today.getMonth() - birth.getMonth()
  217. if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) {
  218. age--
  219. }
  220. this.form.childAge = age > 0 ? age : 0
  221. },
  222. onGenderChange(e) { this.form.childGender = e.detail.value },
  223. onSchoolScoreChange(e) { this.form.schoolScore = e.detail.value },
  224. onParentDegreeChange(e) { this.form.parentDegree = e.detail.value },
  225. onSingleChildChange(e) { this.form.singleChild = e.detail.value },
  226. validate() {
  227. const required = ['childName', 'childBirthday', 'childGender']
  228. for (let i = 0; i < required.length; i++) {
  229. if (!this.form[required[i]]) {
  230. uni.showToast({ title: '请填写必填项', icon: 'none' })
  231. return false
  232. }
  233. }
  234. return true
  235. },
  236. submit() {
  237. if (!this.validate()) return
  238. uni.setStorageSync('assessmentChildInfo', this.form)
  239. const f = this.flowData
  240. uni.navigateTo({
  241. url: '/pages/assessment/order?guideId=' + (f.guideId || '') +
  242. '&guideName=' + encodeURIComponent(f.guideName || '') +
  243. '&packageId=' + (f.packageId || '') +
  244. '&packageName=' + encodeURIComponent(f.packageName || 'DAN专注力测评') +
  245. '&childId=' + (f.childId || '') +
  246. '&appointmentDate=' + (f.appointmentDate || '') +
  247. '&appointmentTime=' + (f.appointmentTime || '') +
  248. '&totalPrice=' + (f.totalPrice || '0') +
  249. '&discountAmount=' + (f.discountAmount || '0') +
  250. '&actualPrice=' + ((f.totalPrice || 0) - (f.discountAmount || 0))
  251. })
  252. }
  253. }
  254. }
  255. </script>
  256. <style scoped>
  257. .container {
  258. padding: 30rpx;
  259. background: #F8F8F8;
  260. min-height: 100vh;
  261. }
  262. .header {
  263. text-align: center;
  264. padding: 40rpx 0 30rpx;
  265. }
  266. .title {
  267. font-size: 48rpx;
  268. font-weight: bold;
  269. color: #333;
  270. display: block;
  271. margin-bottom: 16rpx;
  272. }
  273. .subtitle {
  274. font-size: 26rpx;
  275. color: #666;
  276. }
  277. .section {
  278. background: #fff;
  279. border-radius: 20rpx;
  280. padding: 30rpx;
  281. margin-bottom: 24rpx;
  282. }
  283. .section-title {
  284. font-size: 32rpx;
  285. font-weight: bold;
  286. color: #333;
  287. margin-bottom: 24rpx;
  288. padding-bottom: 16rpx;
  289. border-bottom: 1rpx solid #eee;
  290. }
  291. .form-group {
  292. margin-bottom: 24rpx;
  293. }
  294. .form-group:last-child {
  295. margin-bottom: 0;
  296. }
  297. .form-label {
  298. font-size: 28rpx;
  299. color: #333;
  300. margin-bottom: 12rpx;
  301. font-weight: 500;
  302. }
  303. .form-input {
  304. height: 80rpx;
  305. background: #F8F8F8;
  306. border-radius: 10rpx;
  307. padding: 0 20rpx;
  308. font-size: 28rpx;
  309. color: #333;
  310. }
  311. .form-value {
  312. font-size: 28rpx;
  313. color: #999;
  314. line-height: 80rpx;
  315. }
  316. .picker-value {
  317. height: 80rpx;
  318. background: #F8F8F8;
  319. border-radius: 10rpx;
  320. padding: 0 20rpx;
  321. font-size: 28rpx;
  322. color: #333;
  323. line-height: 80rpx;
  324. }
  325. .form-row {
  326. display: flex;
  327. gap: 20rpx;
  328. }
  329. .half {
  330. flex: 1;
  331. }
  332. .radio-item {
  333. display: inline-flex;
  334. align-items: center;
  335. margin-right: 40rpx;
  336. font-size: 28rpx;
  337. color: #333;
  338. }
  339. .btn-submit {
  340. width: 100%;
  341. height: 90rpx;
  342. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  343. color: #fff;
  344. border-radius: 45rpx;
  345. font-size: 32rpx;
  346. font-weight: bold;
  347. margin-top: 40rpx;
  348. margin-bottom: 40rpx;
  349. }
  350. </style>