user-edit.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  1. <template>
  2. <view class="user-edit-container">
  3. <view class="header">
  4. <text class="title">{{ isEdit ? '完善个人信息' : '选择角色' }}</text>
  5. <text class="subtitle">{{ isEdit ? '以下信息可帮助您更好地使用服务' : '请选择您的身份类型' }}</text>
  6. </view>
  7. <!-- 角色选择(新用户首次登录时显示) -->
  8. <view class="role-select-section" v-if="!isEdit && showRoleSelect">
  9. <view
  10. class="role-card"
  11. :class="{ active: form.role === 'parent' }"
  12. @click="selectRole('parent')"
  13. >
  14. <text class="role-icon">👨‍👩‍👧</text>
  15. <text class="role-name">家长</text>
  16. <text class="role-desc">管理孩子任务、审核奖励</text>
  17. </view>
  18. <view
  19. class="role-card"
  20. :class="{ active: form.role === 'child' }"
  21. @click="selectRole('child')"
  22. >
  23. <text class="role-icon">👶</text>
  24. <text class="role-name">孩子</text>
  25. <text class="role-desc">执行任务、赚取积分</text>
  26. </view>
  27. <view
  28. class="role-card"
  29. :class="{ active: form.role === 'teacher' }"
  30. @click="selectRole('teacher')"
  31. >
  32. <text class="role-icon">👨‍🏫</text>
  33. <text class="role-name">成长规划师</text>
  34. <text class="role-desc">DAN测评、制定成长方案</text>
  35. </view>
  36. <button class="btn-next" @click="confirmRole" :disabled="!form.role">
  37. 下一步
  38. </button>
  39. </view>
  40. <!-- 详细信息填写(选择角色后显示) -->
  41. <view v-if="isEdit && (!isNewUserFlow || hasFamily)">
  42. <view class="form-section">
  43. <!-- 头像 -->
  44. <view class="form-item avatar-item">
  45. <text class="label">头像</text>
  46. <view class="avatar-upload" @click="chooseAvatar">
  47. <image v-if="form.avatar" :src="form.avatar" class="avatar-preview"></image>
  48. <view v-else class="avatar-placeholder">
  49. <text class="iconfont icon-plus">+</text>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 昵称 -->
  54. <view class="form-item">
  55. <text class="label">昵称 <text class="required">*</text></text>
  56. <input type="text" v-model="form.nickname" placeholder="请输入昵称" class="input" maxlength="20" />
  57. </view>
  58. <!-- 新用户流程:仅展示头像+昵称,其余字段按需在功能页补充 -->
  59. <view v-if="!isNewUserFlow">
  60. <!-- 真实姓名 -->
  61. <view class="form-item">
  62. <text class="label">真实姓名</text>
  63. <input type="text" v-model="form.realName" placeholder="选填,用于家庭管理" class="input" maxlength="20" />
  64. </view>
  65. <!-- 性别(成长规划师必填) -->
  66. <view class="form-item">
  67. <text class="label">性别 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  68. <radio-group class="role-select" @change="onGenderChange">
  69. <label class="role-option">
  70. <radio value="male" :checked="form.gender === 'male'" />
  71. <text>男</text>
  72. </label>
  73. <label class="role-option">
  74. <radio value="female" :checked="form.gender === 'female'" />
  75. <text>女</text>
  76. </label>
  77. </radio-group>
  78. </view>
  79. <!-- 身份证号(成长规划师必填) -->
  80. <view class="form-item">
  81. <text class="label">身份证号 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  82. <input type="idcard" v-model="form.idCard" placeholder="选填,填写后自动生成生日" class="input" maxlength="18" @input="onIdCardInput" />
  83. </view>
  84. <!-- 生日 -->
  85. <view class="form-item">
  86. <text class="label">生日</text>
  87. <picker mode="date" :value="form.birthday" @change="onBirthdayChange">
  88. <view class="picker-input">{{ form.birthday || '请选择生日' }}</view>
  89. </picker>
  90. </view>
  91. <!-- 出生时辰 -->
  92. <view class="form-item">
  93. <text class="label">出生时辰</text>
  94. <picker mode="selector" :range="birthHourOptions" :value="birthHourIndex" @change="onBirthHourChange">
  95. <view class="picker-input">{{ form.birthHour || '请选择出生时辰' }}</view>
  96. </picker>
  97. </view>
  98. <!-- 民族 -->
  99. <view class="form-item">
  100. <text class="label">民族</text>
  101. <picker mode="selector" :range="ethnicityOptions" :value="ethnicityIndex" @change="onEthnicityChange">
  102. <view class="picker-input">{{ form.ethnicity || '请选择民族' }}</view>
  103. </picker>
  104. </view>
  105. <!-- 血型 -->
  106. <view class="form-item">
  107. <text class="label">血型</text>
  108. <picker mode="selector" :range="bloodTypeOptions" :value="bloodTypeIndex" @change="onBloodTypeChange">
  109. <view class="picker-input">{{ form.bloodType || '请选择血型' }}</view>
  110. </picker>
  111. </view>
  112. <!-- 最高学历 -->
  113. <view class="form-item">
  114. <text class="label">最高学历</text>
  115. <picker mode="selector" :range="educationOptions" :value="educationIndex" @change="onEducationChange">
  116. <view class="picker-input">{{ form.highestEducation || '请选择最高学历' }}</view>
  117. </picker>
  118. </view>
  119. <!-- 婚姻状态 -->
  120. <view class="form-item">
  121. <text class="label">婚姻状态</text>
  122. <picker mode="selector" :range="maritalOptions" :value="maritalIndex" @change="onMaritalChange">
  123. <view class="picker-input">{{ form.maritalStatus || '请选择婚姻状态' }}</view>
  124. </picker>
  125. </view>
  126. <!-- 所在地区(省市区三级联动,与订单收货人地址一致) -->
  127. <view class="form-item address-row" @click="openRegionPicker">
  128. <text class="label">所在地区 <text class="required" v-if="isNewUserFlow">*</text></text>
  129. <view class="address-value-wrap">
  130. <text v-if="form.address" class="address-value">{{ form.address }}</text>
  131. <text v-else class="address-placeholder">请选择省市区</text>
  132. <text class="address-arrow">›</text>
  133. </view>
  134. </view>
  135. <!-- 详细地址 -->
  136. <view class="form-item">
  137. <text class="label">详细地址</text>
  138. <input type="text" v-model="form.street" placeholder="请输入详细地址(选填)" class="input" maxlength="100" @input="updateFullAddress" />
  139. </view>
  140. <!-- 兴趣爱好 -->
  141. <view class="form-item">
  142. <text class="label">兴趣爱好</text>
  143. <input type="text" v-model="form.hobbies" placeholder="如: 阅读、运动、音乐" class="input" maxlength="200" />
  144. </view>
  145. <!-- 饮食偏好 -->
  146. <view class="form-item">
  147. <text class="label">饮食偏好</text>
  148. <input type="text" v-model="form.dietPreferences" placeholder="如: 清淡、无辣、低糖" class="input" maxlength="200" />
  149. </view>
  150. </view>
  151. <!-- 成长规划师额外字段 -->
  152. <view class="form-section-title" v-if="form.role === 'teacher'">成长规划师信息</view>
  153. <!-- 成长规划师证书号(成长规划师必填) -->
  154. <view class="form-item" v-if="form.role === 'teacher'">
  155. <text class="label">成长规划师证书号 <text class="required">*</text></text>
  156. <input type="text" v-model="form.teacherNo" placeholder="请输入成长规划师证书号" class="input" maxlength="50" />
  157. </view>
  158. <!-- 成长规划师照片(成长规划师必填) -->
  159. <view class="form-item" v-if="form.role === 'teacher'">
  160. <text class="label">成长规划师照片 <text class="required">*</text></text>
  161. <view class="photo-upload" @click="chooseTeacherPhoto">
  162. <image v-if="form.teacherPhoto" :src="form.teacherPhoto" class="photo-preview" mode="aspectFill"></image>
  163. <view v-else class="photo-placeholder">
  164. <text class="plus-icon">+</text>
  165. <text class="placeholder-text">上传照片</text>
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 成长规划师证书照片(成长规划师必填) -->
  170. <view class="form-item" v-if="form.role === 'teacher'">
  171. <text class="label">成长规划师证书 <text class="required">*</text></text>
  172. <view class="photo-upload" @click="chooseCertificate">
  173. <image v-if="form.certificateImage" :src="form.certificateImage" class="photo-preview" mode="aspectFill"></image>
  174. <view v-else class="photo-placeholder">
  175. <text class="plus-icon">+</text>
  176. <text class="placeholder-text">上传证书</text>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. <!-- 助手选择(会员专属) -->
  182. <view class="family-section" v-if="isEdit && memberLevel !== 'FREE'">
  183. <view class="section-title">🤖 选择助手</view>
  184. <view class="mascot-cards">
  185. <view class="mascot-card" :class="{ active: form.mascot === 'xibao' }" @click="selectMascot('xibao')">
  186. <view class="mascot-card-icon xibao-bg">🌟</view>
  187. <view class="mascot-card-info">
  188. <text class="mascot-card-name">浠宝</text>
  189. <text class="mascot-card-desc">温柔活泼的阳光女孩</text>
  190. </view>
  191. </view>
  192. <view class="mascot-card" :class="{ active: form.mascot === 'fubao' }" @click="selectMascot('fubao')">
  193. <view class="mascot-card-icon fubao-bg">💪</view>
  194. <view class="mascot-card-info">
  195. <text class="mascot-card-name">福宝</text>
  196. <text class="mascot-card-desc">开朗自信的阳光男孩</text>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. <!-- 家庭角色选择(新用户流程、角色为家长、有家庭邀请码时显示,可选) -->
  202. <view class="family-section" v-if="isEdit && form.role === 'parent' && isNewUserFlow && hasPendingFamilyInvite">
  203. <view class="section-title">👨‍👩‍👧‍👦 家庭身份(可选)</view>
  204. <view class="form-item">
  205. <text class="label">您在家庭中的身份</text>
  206. <picker mode="selector" :range="familyRoleOptions" :value="familyRoleIndex" @change="onFamilyRoleChange">
  207. <view class="picker-input">{{ form.familyRole || '请选择(可跳过)' }}</view>
  208. </picker>
  209. </view>
  210. <text class="hint-text">不选也可先保存,后续在家庭页面发起申请</text>
  211. </view>
  212. <!-- 免费用户提示 -->
  213. <view class="family-section" v-if="isEdit && memberLevel === 'FREE'">
  214. <view class="mascot-locked-hint" @click="goUpgrade">
  215. <text class="locked-icon">🔒</text>
  216. <text class="locked-text">开通会员解锁更多能力</text>
  217. <text class="locked-arrow">›</text>
  218. </view>
  219. </view>
  220. <!-- 新用户流程:保存资料 / 跳过 -->
  221. <view class="family-section" v-if="isEdit && form.role !== 'teacher' && isNewUserFlow">
  222. <view class="family-actions">
  223. <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
  224. 保存资料
  225. </button>
  226. <button class="btn btn-skip" @click="skip">
  227. 跳过
  228. </button>
  229. </view>
  230. </view>
  231. <!-- 修改个人资料保存按钮(非新用户流程时显示) -->
  232. <view class="family-section" v-if="isEdit && !isNewUserFlow && form.role !== 'teacher'">
  233. <view class="family-actions">
  234. <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
  235. 保存修改
  236. </button>
  237. </view>
  238. </view>
  239. <!-- 成长规划师提交按钮 -->
  240. <view class="family-section" v-if="isEdit && form.role === 'teacher' && isNewUserFlow">
  241. <view class="family-actions">
  242. <button class="btn btn-primary" @click="submitTeacherInfo" :loading="loading">
  243. 提交申请
  244. </button>
  245. </view>
  246. </view>
  247. </view>
  248. <view v-else-if="isEdit">
  249. <FamilyEmptyState type="card" />
  250. </view>
  251. <!-- 区域选择弹窗(省市区三级联动) -->
  252. <view class="region-mask" v-if="showRegionPicker" @click="cancelRegion">
  253. <view class="region-picker" @click.stop>
  254. <view class="region-header">
  255. <text class="region-header-btn" @click="cancelRegion">取消</text>
  256. <text class="region-header-title">选择地区</text>
  257. <text class="region-header-btn region-confirm" @click="confirmRegion">确定</text>
  258. </view>
  259. <view class="region-breadcrumb">
  260. <text
  261. v-for="(name, i) in regionBreadcrumb"
  262. :key="i"
  263. :class="['crumb-item', i === currentRegionLevel ? 'crumb-active' : '']"
  264. @click="jumpRegionLevel(i)"
  265. >{{ name || '请选择' }}</text>
  266. <text class="crumb-arrow" v-if="currentRegionLevel < 2">›</text>
  267. </view>
  268. <scroll-view class="region-list" scroll-y>
  269. <view
  270. v-for="(item, idx) in currentRegionItems"
  271. :key="idx"
  272. :class="['region-item', isRegionSelected(item) ? 'region-item-selected' : '']"
  273. @click="selectRegionItem(item)"
  274. >
  275. <text class="region-item-text">{{ getRegionName(item) }}</text>
  276. <text class="region-item-check" v-if="isRegionSelected(item)">✓</text>
  277. </view>
  278. <view v-if="regionLoading" class="region-loading">
  279. <text>加载中...</text>
  280. </view>
  281. </scroll-view>
  282. </view>
  283. </view>
  284. </view>
  285. </template>
  286. <script>
  287. import { updateUserInfo, createFamily, directRegister, getUserInfo, requestJoinByCode, getMyMembership } from '../../utils/api.js'
  288. import config from '@/config.js'
  289. export default {
  290. data() {
  291. return {
  292. isEdit: false,
  293. showRoleSelect: true,
  294. isNewUserFlow: false, // 是否是新用户注册流程
  295. memberLevel: 'FREE', // 会员等级,用于判断是否解锁助手
  296. form: {
  297. role: '',
  298. avatar: '',
  299. nickname: '',
  300. realName: '',
  301. gender: '',
  302. idCard: '',
  303. birthday: '',
  304. birthHour: '',
  305. inviteCode: '',
  306. familyRole: '', // 家庭角色:爸爸/妈妈/爷爷/奶奶/姥爷/姥姥/其他(可选)
  307. mascot: '',
  308. phone: '',
  309. teacherNo: '',
  310. teacherPhoto: '',
  311. certificateImage: '',
  312. ethnicity: '',
  313. bloodType: '',
  314. highestEducation: '',
  315. maritalStatus: '',
  316. hobbies: '',
  317. dietPreferences: '',
  318. address: '',
  319. province: '',
  320. city: '',
  321. district: '',
  322. street: ''
  323. },
  324. // 区域选择弹窗(省市区三级联动,与订单收货人地址一致)
  325. showRegionPicker: false,
  326. currentRegionLevel: 0, // 0=省份, 1=城市, 2=区县
  327. regionLoading: false,
  328. provinceList: [],
  329. cityList: [],
  330. districtList: [],
  331. tempProvince: null,
  332. tempCity: null,
  333. tempDistrict: null,
  334. ethnicityOptions: ['汉族','蒙古族','回族','藏族','维吾尔族','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克族','傣族','黎族','其他'],
  335. bloodTypeOptions: ['A','B','AB','O','未知'],
  336. birthHourOptions: ['子时(23-01)','丑时(01-03)','寅时(03-05)','卯时(05-07)','辰时(07-09)','巳时(09-11)','午时(11-13)','未时(13-15)','申时(15-17)','酉时(17-19)','戌时(19-21)','亥时(21-23)'],
  337. birthHourValues: ['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'],
  338. educationOptions: ['小学','初中','高中','中专','大专','本科','硕士','博士'],
  339. maritalOptions: ['未婚','已婚','离异','丧偶'],
  340. familyRoleOptions: ['爸爸', '妈妈', '爷爷', '奶奶', '姥爷', '姥姥', '其他'],
  341. loading: false,
  342. userId: '',
  343. token: ''
  344. }
  345. },
  346. computed: {
  347. ethnicityIndex() {
  348. return this.ethnicityOptions.indexOf(this.form.ethnicity)
  349. },
  350. bloodTypeIndex() {
  351. return this.bloodTypeOptions.indexOf(this.form.bloodType)
  352. },
  353. birthHourIndex() {
  354. return this.birthHourValues.indexOf(this.form.birthHour)
  355. },
  356. educationIndex() {
  357. return this.educationOptions.indexOf(this.form.highestEducation)
  358. },
  359. maritalIndex() {
  360. return this.maritalOptions.indexOf(this.form.maritalStatus)
  361. },
  362. familyRoleIndex: {
  363. get() {
  364. return this.familyRoleOptions.indexOf(this.form.familyRole)
  365. },
  366. set(val) {
  367. this.form.familyRole = this.familyRoleOptions[val] || ''
  368. }
  369. },
  370. hasFamily: function() {
  371. if (this.token) return true
  372. return this.$store.getters.hasFamily
  373. },
  374. // 是否有待处理的家庭邀请码
  375. hasPendingFamilyInvite: function() {
  376. return !!uni.getStorageSync('pendingFamilyInviteCode')
  377. },
  378. regionBreadcrumb: function() {
  379. var names = []
  380. names.push(this.tempProvince ? this.getRegionName(this.tempProvince) : '省份')
  381. names.push(this.tempCity ? this.getRegionName(this.tempCity) : '城市')
  382. names.push(this.tempDistrict ? this.getRegionName(this.tempDistrict) : '区县')
  383. return names
  384. },
  385. currentRegionItems: function() {
  386. if (this.currentRegionLevel === 0) return this.provinceList
  387. if (this.currentRegionLevel === 1) return this.cityList
  388. if (this.currentRegionLevel === 2) return this.districtList
  389. return []
  390. },
  391. },
  392. onLoad(options) {
  393. if (options.token && options.userId) {
  394. this.token = options.token
  395. this.userId = options.userId
  396. if (options.autoParent === 'true') {
  397. // 首次登录:跳过角色选择,默认 parent,直接进入信息补充页
  398. this.showRoleSelect = false
  399. this.isEdit = true
  400. this.isNewUserFlow = true
  401. this.form.role = 'parent'
  402. } else {
  403. // 检查是否需要选择角色(新用户)- 只有明确传递 needsRoleSelect=true 才显示选择
  404. this.showRoleSelect = options.needsRoleSelect === 'true'
  405. this.isEdit = !this.showRoleSelect
  406. this.isNewUserFlow = options.needsRoleSelect === 'true'
  407. }
  408. } else if (options.phone && (options.autoParent === 'true' || options.needsRoleSelect === 'true')) {
  409. // 测试环境:没有token,只有手机号,是新用户注册流程
  410. this.showRoleSelect = options.needsRoleSelect === 'true'
  411. this.isEdit = !this.showRoleSelect
  412. this.isNewUserFlow = true
  413. if (options.autoParent === 'true') {
  414. this.form.role = 'parent'
  415. }
  416. // 将手机号传递给表单
  417. this.form.phone = options.phone
  418. } else {
  419. // 其他情况:默认进入编辑模式(如从"我的"页面进入)
  420. this.showRoleSelect = false
  421. this.isEdit = true
  422. this.isNewUserFlow = false
  423. }
  424. // 非新用户流程时,加载已有用户信息
  425. if (this.isEdit && !this.isNewUserFlow) {
  426. this.loadUserInfo()
  427. }
  428. // 加载会员等级(用于助手解锁)
  429. var self = this
  430. getMyMembership().then(function(res) {
  431. if (res.data && res.data.memberLevel) {
  432. self.memberLevel = res.data.memberLevel
  433. }
  434. }).catch(function() {})
  435. },
  436. methods: {
  437. selectRole(role) {
  438. this.form.role = role
  439. },
  440. confirmRole() {
  441. if (!this.form.role) {
  442. uni.showToast({ title: '请选择角色', icon: 'none' })
  443. return
  444. }
  445. this.showRoleSelect = false
  446. this.isEdit = true
  447. // 测试环境:直接注册用户(不需要验证码)
  448. if (!this.token && this.form.phone) {
  449. // 自动进入家庭绑定流程
  450. }
  451. },
  452. chooseAvatar() {
  453. uni.chooseImage({
  454. count: 1,
  455. success: (res) => {
  456. this.form.avatar = res.tempFilePaths[0]
  457. }
  458. })
  459. },
  460. chooseTeacherPhoto() {
  461. uni.chooseImage({
  462. count: 1,
  463. success: (res) => {
  464. this.form.teacherPhoto = res.tempFilePaths[0]
  465. }
  466. })
  467. },
  468. chooseCertificate() {
  469. uni.chooseImage({
  470. count: 1,
  471. success: (res) => {
  472. this.form.certificateImage = res.tempFilePaths[0]
  473. }
  474. })
  475. },
  476. onGenderChange(e) {
  477. this.form.gender = e.detail.value
  478. },
  479. onIdCardInput(e) {
  480. const idCard = e.detail.value
  481. if (idCard.length === 18) {
  482. // 根据身份证号自动提取生日
  483. const year = idCard.substring(6, 10)
  484. const month = idCard.substring(10, 12)
  485. const day = idCard.substring(12, 14)
  486. this.form.birthday = `${year}-${month}-${day}`
  487. }
  488. },
  489. onBirthdayChange(e) {
  490. this.form.birthday = e.detail.value
  491. },
  492. onEthnicityChange(e) {
  493. this.form.ethnicity = this.ethnicityOptions[e.detail.value]
  494. },
  495. onBloodTypeChange(e) {
  496. this.form.bloodType = this.bloodTypeOptions[e.detail.value]
  497. },
  498. onBirthHourChange(e) {
  499. this.form.birthHour = this.birthHourValues[e.detail.value]
  500. },
  501. onEducationChange(e) {
  502. this.form.highestEducation = this.educationOptions[e.detail.value]
  503. },
  504. onMaritalChange(e) {
  505. this.form.maritalStatus = this.maritalOptions[e.detail.value]
  506. },
  507. selectMascot(code) {
  508. this.form.mascot = code
  509. },
  510. goUpgrade() {
  511. uni.navigateTo({ url: '/pages/membership/upgrade' })
  512. },
  513. // ===== 省市区三级联动弹窗(与订单收货人地址一致) =====
  514. openRegionPicker() {
  515. this.tempProvince = this.form.province ? { name: this.form.province, id: null } : null
  516. this.tempCity = this.form.city ? { name: this.form.city, id: null } : null
  517. this.tempDistrict = this.form.district ? { name: this.form.district, id: null } : null
  518. this.currentRegionLevel = 0
  519. this.showRegionPicker = true
  520. this.loadRegionProvinces()
  521. },
  522. loadRegionProvinces() {
  523. var self = this
  524. self.regionLoading = true
  525. uni.request({
  526. url: config.api('/api/region/provinces'),
  527. method: 'POST',
  528. header: {
  529. 'Content-Type': 'application/json',
  530. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  531. },
  532. success: function(res) {
  533. self.regionLoading = false
  534. if (res.data && res.data.code === 200) {
  535. self.provinceList = res.data.data || []
  536. }
  537. },
  538. fail: function() {
  539. self.regionLoading = false
  540. }
  541. })
  542. },
  543. loadRegionCities(parentId) {
  544. if (!parentId) return
  545. var self = this
  546. self.regionLoading = true
  547. uni.request({
  548. url: config.api('/api/region/cities'),
  549. method: 'POST',
  550. data: { parentId: parentId },
  551. header: {
  552. 'Content-Type': 'application/json',
  553. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  554. },
  555. success: function(res) {
  556. self.regionLoading = false
  557. if (res.data && res.data.code === 200) {
  558. self.cityList = res.data.data || []
  559. }
  560. },
  561. fail: function() {
  562. self.regionLoading = false
  563. }
  564. })
  565. },
  566. loadRegionDistricts(parentId) {
  567. if (!parentId) return
  568. var self = this
  569. self.regionLoading = true
  570. uni.request({
  571. url: config.api('/api/region/districts'),
  572. method: 'POST',
  573. data: { parentId: parentId },
  574. header: {
  575. 'Content-Type': 'application/json',
  576. 'Authorization': 'Bearer ' + uni.getStorageSync('token')
  577. },
  578. success: function(res) {
  579. self.regionLoading = false
  580. if (res.data && res.data.code === 200) {
  581. self.districtList = res.data.data || []
  582. }
  583. },
  584. fail: function() {
  585. self.regionLoading = false
  586. }
  587. })
  588. },
  589. selectRegionItem(item) {
  590. if (this.currentRegionLevel === 0) {
  591. this.tempProvince = item
  592. this.tempCity = null
  593. this.tempDistrict = null
  594. this.cityList = []
  595. this.districtList = []
  596. this.currentRegionLevel = 1
  597. this.loadRegionCities(this.getRegionId(item))
  598. } else if (this.currentRegionLevel === 1) {
  599. this.tempCity = item
  600. this.tempDistrict = null
  601. this.districtList = []
  602. this.currentRegionLevel = 2
  603. this.loadRegionDistricts(this.getRegionId(item))
  604. } else if (this.currentRegionLevel === 2) {
  605. this.tempDistrict = item
  606. this.confirmRegion()
  607. }
  608. },
  609. confirmRegion() {
  610. if (this.tempProvince) {
  611. this.form.province = this.getRegionName(this.tempProvince)
  612. }
  613. if (this.tempCity) {
  614. this.form.city = this.getRegionName(this.tempCity)
  615. }
  616. if (this.tempDistrict) {
  617. this.form.district = this.getRegionName(this.tempDistrict)
  618. }
  619. this.updateFullAddress()
  620. this.showRegionPicker = false
  621. },
  622. cancelRegion() {
  623. this.showRegionPicker = false
  624. },
  625. jumpRegionLevel(level) {
  626. if (level < this.currentRegionLevel) {
  627. this.currentRegionLevel = level
  628. }
  629. },
  630. getRegionName(item) {
  631. return item && (item.name || item.province || item.city || item.district || '')
  632. },
  633. getRegionId(item) {
  634. return item && (item.id || item.code)
  635. },
  636. isRegionSelected(item) {
  637. var name = this.getRegionName(item)
  638. if (this.currentRegionLevel === 0) return this.tempProvince && this.getRegionName(this.tempProvince) === name
  639. if (this.currentRegionLevel === 1) return this.tempCity && this.getRegionName(this.tempCity) === name
  640. if (this.currentRegionLevel === 2) return this.tempDistrict && this.getRegionName(this.tempDistrict) === name
  641. return false
  642. },
  643. updateFullAddress() {
  644. this.form.address = (this.form.province || '') + (this.form.city || '') + (this.form.district || '') + (this.form.street || '')
  645. },
  646. // 加载已有用户信息
  647. async loadUserInfo() {
  648. try {
  649. const res = await getUserInfo()
  650. if (res.code === 200 && res.data) {
  651. const userData = res.data
  652. this.form.nickname = userData.nickname || ''
  653. this.form.realName = userData.realName || ''
  654. this.form.gender = userData.gender || ''
  655. this.form.idCard = userData.idCard || ''
  656. // 生日只取日期部分,去掉时间和 ISO 格式的 T 分隔符
  657. this.form.birthday = userData.birthday ? String(userData.birthday).split(/[T ]/)[0] : ''
  658. this.form.avatar = userData.avatar || ''
  659. this.form.role = userData.role || ''
  660. this.form.phone = userData.phone || ''
  661. this.form.ethnicity = userData.ethnicity || ''
  662. this.form.bloodType = userData.bloodType || ''
  663. this.form.highestEducation = userData.highestEducation || ''
  664. this.form.maritalStatus = userData.maritalStatus || ''
  665. this.form.hobbies = userData.hobbies || ''
  666. this.form.dietPreferences = userData.dietPreferences || ''
  667. this.form.mascot = userData.mascot || ''
  668. this.form.address = userData.address || ''
  669. this.form.province = userData.province || ''
  670. this.form.city = userData.city || ''
  671. this.form.district = userData.district || ''
  672. this.form.street = userData.street || ''
  673. // 若无完整地址文本但有省市区,则拼接
  674. if (!this.form.address && (this.form.province || this.form.city || this.form.district)) {
  675. this.updateFullAddress()
  676. }
  677. }
  678. } catch (e) {
  679. console.error('加载用户信息失败', e)
  680. }
  681. },
  682. // 保存修改
  683. async saveUserInfo() {
  684. // 新用户流程:昵称可跳过(跳过时用默认昵称);老用户流程:昵称必填
  685. if (!this.isNewUserFlow && !this.form.nickname) {
  686. uni.showToast({ title: '请输入昵称', icon: 'none' })
  687. return
  688. }
  689. if (this.isNewUserFlow && !this.form.nickname) {
  690. var phone = this.form.phone || ''
  691. this.form.nickname = phone ? '用户' + phone.substring(phone.length - 4) : '微信用户'
  692. }
  693. // 从省市区街道字段同步完整地址文本
  694. this.updateFullAddress()
  695. this.loading = true
  696. try {
  697. await updateUserInfo({
  698. nickname: this.form.nickname,
  699. realName: this.form.realName,
  700. gender: this.form.gender,
  701. idCard: this.form.idCard,
  702. birthday: this.form.birthday,
  703. avatar: this.form.avatar,
  704. mascot: this.form.mascot,
  705. ethnicity: this.form.ethnicity,
  706. bloodType: this.form.bloodType,
  707. highestEducation: this.form.highestEducation,
  708. maritalStatus: this.form.maritalStatus,
  709. hobbies: this.form.hobbies,
  710. dietPreferences: this.form.dietPreferences,
  711. address: this.form.address,
  712. province: this.form.province,
  713. city: this.form.city,
  714. district: this.form.district,
  715. street: this.form.street
  716. })
  717. // 新用户流程且有家庭邀请码:提交加入家庭申请
  718. if (this.isNewUserFlow && this.hasPendingFamilyInvite) {
  719. var inviteCode = uni.getStorageSync('pendingFamilyInviteCode')
  720. var familyRole = this.form.familyRole || ''
  721. if (inviteCode) {
  722. try {
  723. await requestJoinByCode(inviteCode, familyRole)
  724. uni.showToast({ title: '加入家庭申请已提交,等待管理员审批', icon: 'success' })
  725. } catch (e) {
  726. uni.showToast({ title: e.message || '申请提交失败,可稍后在家庭页重试', icon: 'none' })
  727. }
  728. uni.removeStorageSync('pendingFamilyInviteCode')
  729. }
  730. setTimeout(() => {
  731. this.navigateToHome()
  732. }, 1500)
  733. } else {
  734. uni.showToast({ title: '保存成功', icon: 'success' })
  735. setTimeout(() => {
  736. if (this.isNewUserFlow) {
  737. this.navigateToHome()
  738. } else {
  739. uni.navigateBack()
  740. }
  741. }, 1500)
  742. }
  743. } catch (e) {
  744. uni.showToast({ title: '保存失败', icon: 'none' })
  745. } finally {
  746. this.loading = false
  747. }
  748. },
  749. async submitTeacherInfo() {
  750. // 验证必填字段
  751. if (!this.form.nickname) {
  752. uni.showToast({ title: '请输入昵称', icon: 'none' })
  753. return
  754. }
  755. if (!this.form.gender) {
  756. uni.showToast({ title: '请选择性别', icon: 'none' })
  757. return
  758. }
  759. if (!this.form.idCard) {
  760. uni.showToast({ title: '请输入身份证号', icon: 'none' })
  761. return
  762. }
  763. if (!this.form.teacherNo) {
  764. uni.showToast({ title: '请输入成长规划师证书号', icon: 'none' })
  765. return
  766. }
  767. if (!this.form.teacherPhoto) {
  768. uni.showToast({ title: '请上传成长规划师照片', icon: 'none' })
  769. return
  770. }
  771. if (!this.form.certificateImage) {
  772. uni.showToast({ title: '请上传成长规划师证书', icon: 'none' })
  773. return
  774. }
  775. this.loading = true
  776. try {
  777. await updateUserInfo({
  778. ...this.form,
  779. roles: this.form.role
  780. })
  781. uni.showToast({ title: '提交成功,请等待审核' })
  782. setTimeout(() => {
  783. uni.switchTab({ url: '/pages/index-home/index' })
  784. }, 1500)
  785. } catch (e) {
  786. uni.showToast({ title: '提交失败', icon: 'none' })
  787. } finally {
  788. this.loading = false
  789. }
  790. },
  791. async joinFamilyAction() {
  792. if (!this.form.inviteCode) {
  793. uni.showToast({ title: '请输入邀请码', icon: 'none' })
  794. return
  795. }
  796. if (!this.form.nickname) {
  797. uni.showToast({ title: '请输入昵称', icon: 'none' })
  798. return
  799. }
  800. this.loading = true
  801. try {
  802. let userId = this.userId
  803. // 测试环境:没有token,需要先注册用户
  804. if (!this.token && this.form.phone) {
  805. const regRes = await directRegister({
  806. phone: this.form.phone,
  807. nickname: this.form.nickname,
  808. avatar: this.form.avatar,
  809. role: this.form.role,
  810. mascot: this.form.mascot,
  811. birthday: this.form.birthday,
  812. gender: this.form.gender,
  813. inviteCode: this.form.inviteCode
  814. })
  815. userId = regRes.data.userId
  816. // 保存登录信息
  817. uni.setStorageSync('token', regRes.data.token)
  818. uni.setStorageSync('userId', userId)
  819. uni.setStorageSync('role', regRes.data.role)
  820. // 邀请码注册不写入 familyId(加入需管理员审批)
  821. } else {
  822. await updateUserInfo(this.form)
  823. await requestJoinByCode(this.form.inviteCode)
  824. }
  825. uni.showToast({ title: '申请已提交,等待管理员审批' })
  826. setTimeout(() => {
  827. this.navigateToHome()
  828. }, 1500)
  829. } catch (e) {
  830. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  831. } finally {
  832. this.loading = false
  833. }
  834. },
  835. async createFamilyAction() {
  836. if (!this.form.nickname) {
  837. uni.showToast({ title: '请输入昵称', icon: 'none' })
  838. return
  839. }
  840. this.loading = true
  841. try {
  842. let userId = this.userId
  843. // 测试环境:没有token,需要先注册用户
  844. if (!this.token && this.form.phone) {
  845. const regRes = await directRegister({
  846. phone: this.form.phone,
  847. nickname: this.form.nickname,
  848. avatar: this.form.avatar,
  849. role: this.form.role,
  850. mascot: this.form.mascot,
  851. birthday: this.form.birthday,
  852. gender: this.form.gender
  853. })
  854. userId = regRes.data.userId
  855. // 保存登录信息
  856. uni.setStorageSync('token', regRes.data.token)
  857. uni.setStorageSync('userId', userId)
  858. uni.setStorageSync('role', regRes.data.role)
  859. // 注册不写入 familyId(后端根据 userId 获取)
  860. } else {
  861. await updateUserInfo(this.form)
  862. const famRes = await createFamily(this.form.nickname + '的家庭')
  863. // 同步 familyId 到 store(hasFamily getter 依赖)
  864. if (famRes && famRes.data) {
  865. this.$store.commit('setFamilyId', famRes.data)
  866. }
  867. }
  868. uni.showToast({ title: '创建成功' })
  869. setTimeout(() => {
  870. this.navigateToHome()
  871. }, 1500)
  872. } catch (e) {
  873. uni.showToast({ title: e.message || '创建失败', icon: 'none' })
  874. } finally {
  875. this.loading = false
  876. }
  877. },
  878. skip() {
  879. // 跳过时不清理邀请码,用户可后续重新进入编辑页提交申请
  880. this.navigateToHome()
  881. },
  882. navigateToHome() {
  883. // 保存 mascot 到 userInfo 存储,供聊天页读取
  884. if (this.form.mascot) {
  885. try {
  886. const userInfo = uni.getStorageSync('userInfo') || {}
  887. userInfo.mascot = this.form.mascot
  888. uni.setStorageSync('userInfo', userInfo)
  889. } catch (e) {
  890. console.error('保存 mascot 失败', e)
  891. }
  892. }
  893. // 用 switchTab 跳转带底部 TabBar 的首页(行/身/智/心/富)
  894. // parent-index/child-index 是分包页面(非 TabBar 页),用 navigateTo 会丢失底部 TabBar
  895. uni.switchTab({ url: '/pages/index-home/index' })
  896. }
  897. }
  898. }
  899. </script>
  900. <style scoped>
  901. .user-edit-container {
  902. min-height: 100vh;
  903. background: #f5f5f5;
  904. padding: 30rpx;
  905. }
  906. .header {
  907. margin-bottom: 40rpx;
  908. text-align: center;
  909. }
  910. .title {
  911. font-size: 40rpx;
  912. font-weight: bold;
  913. color: #333;
  914. display: block;
  915. margin-bottom: 10rpx;
  916. }
  917. .subtitle {
  918. font-size: 28rpx;
  919. color: #999;
  920. }
  921. /* 角色选择 */
  922. .role-select-section {
  923. margin-bottom: 40rpx;
  924. }
  925. .role-card {
  926. background: #fff;
  927. border-radius: 16rpx;
  928. padding: 40rpx;
  929. margin-bottom: 20rpx;
  930. display: flex;
  931. flex-direction: column;
  932. align-items: center;
  933. border: 2rpx solid transparent;
  934. transition: all 0.3s;
  935. }
  936. .role-card.active {
  937. border-color: #4CAF50;
  938. background: #f8fdf8;
  939. }
  940. .role-icon {
  941. font-size: 80rpx;
  942. margin-bottom: 16rpx;
  943. }
  944. .role-name {
  945. font-size: 32rpx;
  946. font-weight: bold;
  947. color: #333;
  948. margin-bottom: 8rpx;
  949. }
  950. .role-desc {
  951. font-size: 24rpx;
  952. color: #999;
  953. }
  954. .btn-next {
  955. background: #4CAF50;
  956. color: #fff;
  957. border-radius: 40rpx;
  958. margin-top: 20rpx;
  959. }
  960. /* 表单 */
  961. .form-section {
  962. background: #fff;
  963. border-radius: 16rpx;
  964. padding: 30rpx;
  965. margin-bottom: 30rpx;
  966. }
  967. .form-section-title {
  968. font-size: 30rpx;
  969. font-weight: bold;
  970. color: #333;
  971. margin-bottom: 20rpx;
  972. padding-bottom: 16rpx;
  973. border-bottom: 1rpx solid #f0f0f0;
  974. }
  975. .form-item {
  976. margin-bottom: 30rpx;
  977. }
  978. .label {
  979. display: block;
  980. font-size: 28rpx;
  981. color: #333;
  982. margin-bottom: 16rpx;
  983. }
  984. .required {
  985. color: #f44336;
  986. }
  987. .input, .picker-input {
  988. padding: 20rpx;
  989. background: #f5f5f5;
  990. border-radius: 12rpx;
  991. font-size: 28rpx;
  992. }
  993. .role-select {
  994. display: flex;
  995. gap: 40rpx;
  996. }
  997. .role-option {
  998. display: flex;
  999. align-items: center;
  1000. gap: 8rpx;
  1001. }
  1002. /* 头像上传 */
  1003. .avatar-upload {
  1004. width: 150rpx;
  1005. height: 150rpx;
  1006. }
  1007. .avatar-preview {
  1008. width: 150rpx;
  1009. height: 150rpx;
  1010. border-radius: 50%;
  1011. }
  1012. .avatar-placeholder {
  1013. width: 150rpx;
  1014. height: 150rpx;
  1015. background: #f5f5f5;
  1016. border-radius: 50%;
  1017. display: flex;
  1018. align-items: center;
  1019. justify-content: center;
  1020. font-size: 60rpx;
  1021. color: #ccc;
  1022. }
  1023. /* 照片上传 */
  1024. .photo-upload {
  1025. width: 300rpx;
  1026. height: 200rpx;
  1027. }
  1028. .photo-preview {
  1029. width: 300rpx;
  1030. height: 200rpx;
  1031. border-radius: 12rpx;
  1032. }
  1033. .photo-placeholder {
  1034. width: 300rpx;
  1035. height: 200rpx;
  1036. background: #f5f5f5;
  1037. border-radius: 12rpx;
  1038. display: flex;
  1039. flex-direction: column;
  1040. align-items: center;
  1041. justify-content: center;
  1042. }
  1043. .plus-icon {
  1044. font-size: 60rpx;
  1045. color: #ccc;
  1046. }
  1047. .placeholder-text {
  1048. font-size: 24rpx;
  1049. color: #999;
  1050. margin-top: 8rpx;
  1051. }
  1052. /* 助手选择 */
  1053. .mascot-cards {
  1054. display: flex;
  1055. gap: 20rpx;
  1056. margin-top: 16rpx;
  1057. }
  1058. .mascot-card {
  1059. flex: 1;
  1060. background: #f8f8f8;
  1061. border-radius: 16rpx;
  1062. padding: 24rpx;
  1063. display: flex;
  1064. align-items: center;
  1065. gap: 16rpx;
  1066. border: 2rpx solid transparent;
  1067. transition: all 0.3s;
  1068. }
  1069. .mascot-card.active {
  1070. border-color: #4CAF50;
  1071. background: #f0fdf4;
  1072. }
  1073. .mascot-card-icon {
  1074. width: 72rpx;
  1075. height: 72rpx;
  1076. border-radius: 50%;
  1077. display: flex;
  1078. align-items: center;
  1079. justify-content: center;
  1080. font-size: 36rpx;
  1081. flex-shrink: 0;
  1082. }
  1083. .xibao-bg {
  1084. background: linear-gradient(135deg, #FFF0DB, #FFD6A5);
  1085. }
  1086. .fubao-bg {
  1087. background: linear-gradient(135deg, #FFF8E1, #FCD34D);
  1088. }
  1089. .mascot-card-info {
  1090. display: flex;
  1091. flex-direction: column;
  1092. gap: 4rpx;
  1093. }
  1094. .mascot-card-name {
  1095. font-size: 30rpx;
  1096. font-weight: bold;
  1097. color: #333;
  1098. }
  1099. .mascot-card-desc {
  1100. font-size: 22rpx;
  1101. color: #999;
  1102. }
  1103. /* 家庭绑定 */
  1104. .family-section {
  1105. background: #fff;
  1106. border-radius: 16rpx;
  1107. padding: 30rpx;
  1108. }
  1109. .section-title {
  1110. font-size: 30rpx;
  1111. font-weight: bold;
  1112. color: #333;
  1113. margin-bottom: 20rpx;
  1114. }
  1115. .family-actions {
  1116. display: flex;
  1117. flex-direction: column;
  1118. gap: 20rpx;
  1119. margin-top: 30rpx;
  1120. }
  1121. .btn {
  1122. border-radius: 40rpx;
  1123. font-size: 30rpx;
  1124. }
  1125. .btn-primary {
  1126. background: #4CAF50;
  1127. color: #fff;
  1128. }
  1129. .btn-skip {
  1130. background: #f5f5f5;
  1131. color: #999;
  1132. }
  1133. /* ===== 区域选择弹窗 ===== */
  1134. .region-mask {
  1135. position: fixed;
  1136. top: 0;
  1137. left: 0;
  1138. right: 0;
  1139. bottom: 0;
  1140. background: rgba(0, 0, 0, 0.5);
  1141. z-index: 999;
  1142. display: flex;
  1143. align-items: flex-end;
  1144. }
  1145. .region-picker {
  1146. background: #fff;
  1147. border-radius: 20rpx 20rpx 0 0;
  1148. width: 100%;
  1149. max-height: 70vh;
  1150. display: flex;
  1151. flex-direction: column;
  1152. }
  1153. .region-header {
  1154. display: flex;
  1155. justify-content: space-between;
  1156. align-items: center;
  1157. padding: 24rpx 30rpx;
  1158. border-bottom: 1rpx solid #f0f0f0;
  1159. }
  1160. .region-header-btn {
  1161. font-size: 28rpx;
  1162. color: #999;
  1163. }
  1164. .region-confirm {
  1165. color: #F97316;
  1166. font-weight: bold;
  1167. }
  1168. .region-header-title {
  1169. font-size: 30rpx;
  1170. font-weight: bold;
  1171. color: #333;
  1172. }
  1173. .region-breadcrumb {
  1174. display: flex;
  1175. align-items: center;
  1176. padding: 20rpx 30rpx;
  1177. border-bottom: 1rpx solid #f5f5f5;
  1178. }
  1179. .crumb-item {
  1180. font-size: 26rpx;
  1181. color: #999;
  1182. padding: 8rpx 12rpx;
  1183. border-radius: 8rpx;
  1184. }
  1185. .crumb-item.crumb-active {
  1186. color: #F97316;
  1187. font-weight: bold;
  1188. }
  1189. .crumb-arrow {
  1190. font-size: 24rpx;
  1191. color: #ccc;
  1192. margin: 0 8rpx;
  1193. }
  1194. .region-list {
  1195. max-height: 50vh;
  1196. overflow-y: auto;
  1197. }
  1198. .region-item {
  1199. display: flex;
  1200. justify-content: space-between;
  1201. align-items: center;
  1202. padding: 28rpx 30rpx;
  1203. border-bottom: 1rpx solid #f5f5f5;
  1204. }
  1205. .region-item:active {
  1206. background: #FFF7ED;
  1207. }
  1208. .region-item-text {
  1209. font-size: 28rpx;
  1210. color: #333;
  1211. }
  1212. .region-item-check {
  1213. font-size: 28rpx;
  1214. color: #F97316;
  1215. font-weight: bold;
  1216. }
  1217. .region-item-selected {
  1218. background: #FFF7ED;
  1219. }
  1220. .region-item-selected .region-item-text {
  1221. color: #F97316;
  1222. font-weight: bold;
  1223. }
  1224. .region-loading {
  1225. padding: 40rpx;
  1226. text-align: center;
  1227. font-size: 26rpx;
  1228. color: #999;
  1229. }
  1230. /* ===== 地址行(所在地区) ===== */
  1231. .address-row {
  1232. display: flex;
  1233. justify-content: space-between;
  1234. align-items: center;
  1235. }
  1236. .address-value-wrap {
  1237. display: flex;
  1238. align-items: center;
  1239. flex: 1;
  1240. justify-content: flex-end;
  1241. }
  1242. .address-value {
  1243. font-size: 28rpx;
  1244. color: #333;
  1245. }
  1246. .address-placeholder {
  1247. font-size: 28rpx;
  1248. color: #999;
  1249. }
  1250. .address-arrow {
  1251. font-size: 28rpx;
  1252. color: #ccc;
  1253. margin-left: 8rpx;
  1254. }
  1255. /* 助手锁定提示 */
  1256. .mascot-locked-hint {
  1257. display: flex;
  1258. align-items: center;
  1259. padding: 28rpx 32rpx;
  1260. background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  1261. border-radius: 20rpx;
  1262. margin-top: 16rpx;
  1263. }
  1264. .locked-icon {
  1265. font-size: 36rpx;
  1266. margin-right: 16rpx;
  1267. }
  1268. .locked-text {
  1269. flex: 1;
  1270. font-size: 28rpx;
  1271. font-weight: 600;
  1272. color: #92400e;
  1273. }
  1274. .locked-arrow {
  1275. font-size: 32rpx;
  1276. color: #92400e;
  1277. margin-left: 8rpx;
  1278. }
  1279. </style>