user-edit.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  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 class="form-item">
  60. <text class="label">真实姓名</text>
  61. <input type="text" v-model="form.realName" placeholder="选填,用于家庭管理" class="input" maxlength="20" />
  62. </view>
  63. <!-- 性别(成长规划师必填) -->
  64. <view class="form-item">
  65. <text class="label">性别 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  66. <radio-group class="role-select" @change="onGenderChange">
  67. <label class="role-option">
  68. <radio value="male" :checked="form.gender === 'male'" />
  69. <text>男</text>
  70. </label>
  71. <label class="role-option">
  72. <radio value="female" :checked="form.gender === 'female'" />
  73. <text>女</text>
  74. </label>
  75. </radio-group>
  76. </view>
  77. <!-- 身份证号(成长规划师必填) -->
  78. <view class="form-item">
  79. <text class="label">身份证号 <text class="required" v-if="form.role === 'teacher'">*</text></text>
  80. <input type="idcard" v-model="form.idCard" placeholder="选填,填写后自动生成生日" class="input" maxlength="18" @input="onIdCardInput" />
  81. </view>
  82. <!-- 生日 -->
  83. <view class="form-item">
  84. <text class="label">生日</text>
  85. <picker mode="date" :value="form.birthday" @change="onBirthdayChange">
  86. <view class="picker-input">{{ form.birthday || '请选择生日' }}</view>
  87. </picker>
  88. </view>
  89. <!-- 出生时辰 -->
  90. <view class="form-item">
  91. <text class="label">出生时辰</text>
  92. <picker mode="selector" :range="birthHourOptions" :value="birthHourIndex" @change="onBirthHourChange">
  93. <view class="picker-input">{{ form.birthHour || '请选择出生时辰' }}</view>
  94. </picker>
  95. </view>
  96. <!-- 民族 -->
  97. <view class="form-item">
  98. <text class="label">民族</text>
  99. <picker mode="selector" :range="ethnicityOptions" :value="ethnicityIndex" @change="onEthnicityChange">
  100. <view class="picker-input">{{ form.ethnicity || '请选择民族' }}</view>
  101. </picker>
  102. </view>
  103. <!-- 血型 -->
  104. <view class="form-item">
  105. <text class="label">血型</text>
  106. <picker mode="selector" :range="bloodTypeOptions" :value="bloodTypeIndex" @change="onBloodTypeChange">
  107. <view class="picker-input">{{ form.bloodType || '请选择血型' }}</view>
  108. </picker>
  109. </view>
  110. <!-- 最高学历 -->
  111. <view class="form-item">
  112. <text class="label">最高学历</text>
  113. <picker mode="selector" :range="educationOptions" :value="educationIndex" @change="onEducationChange">
  114. <view class="picker-input">{{ form.highestEducation || '请选择最高学历' }}</view>
  115. </picker>
  116. </view>
  117. <!-- 婚姻状态 -->
  118. <view class="form-item">
  119. <text class="label">婚姻状态</text>
  120. <picker mode="selector" :range="maritalOptions" :value="maritalIndex" @change="onMaritalChange">
  121. <view class="picker-input">{{ form.maritalStatus || '请选择婚姻状态' }}</view>
  122. </picker>
  123. </view>
  124. <!-- 所在地区(省市区三级联动,与订单收货人地址一致) -->
  125. <view class="form-item address-row" @click="openRegionPicker">
  126. <text class="label">所在地区</text>
  127. <view class="address-value-wrap">
  128. <text v-if="form.address" class="address-value">{{ form.address }}</text>
  129. <text v-else class="address-placeholder">请选择省市区</text>
  130. <text class="address-arrow">›</text>
  131. </view>
  132. </view>
  133. <!-- 详细地址 -->
  134. <view class="form-item">
  135. <text class="label">详细地址</text>
  136. <input type="text" v-model="form.street" placeholder="请输入详细地址(选填)" class="input" maxlength="100" @input="updateFullAddress" />
  137. </view>
  138. <!-- 兴趣爱好 -->
  139. <view class="form-item">
  140. <text class="label">兴趣爱好</text>
  141. <input type="text" v-model="form.hobbies" placeholder="如: 阅读、运动、音乐" class="input" maxlength="200" />
  142. </view>
  143. <!-- 饮食偏好 -->
  144. <view class="form-item">
  145. <text class="label">饮食偏好</text>
  146. <input type="text" v-model="form.dietPreferences" placeholder="如: 清淡、无辣、低糖" class="input" maxlength="200" />
  147. </view>
  148. <!-- 成长规划师额外字段 -->
  149. <view class="form-section-title" v-if="form.role === 'teacher'">成长规划师信息</view>
  150. <!-- 成长规划师证书号(成长规划师必填) -->
  151. <view class="form-item" v-if="form.role === 'teacher'">
  152. <text class="label">成长规划师证书号 <text class="required">*</text></text>
  153. <input type="text" v-model="form.teacherNo" placeholder="请输入成长规划师证书号" class="input" maxlength="50" />
  154. </view>
  155. <!-- 成长规划师照片(成长规划师必填) -->
  156. <view class="form-item" v-if="form.role === 'teacher'">
  157. <text class="label">成长规划师照片 <text class="required">*</text></text>
  158. <view class="photo-upload" @click="chooseTeacherPhoto">
  159. <image v-if="form.teacherPhoto" :src="form.teacherPhoto" class="photo-preview" mode="aspectFill"></image>
  160. <view v-else class="photo-placeholder">
  161. <text class="plus-icon">+</text>
  162. <text class="placeholder-text">上传照片</text>
  163. </view>
  164. </view>
  165. </view>
  166. <!-- 成长规划师证书照片(成长规划师必填) -->
  167. <view class="form-item" v-if="form.role === 'teacher'">
  168. <text class="label">成长规划师证书 <text class="required">*</text></text>
  169. <view class="photo-upload" @click="chooseCertificate">
  170. <image v-if="form.certificateImage" :src="form.certificateImage" class="photo-preview" mode="aspectFill"></image>
  171. <view v-else class="photo-placeholder">
  172. <text class="plus-icon">+</text>
  173. <text class="placeholder-text">上传证书</text>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. <!-- 助手选择(会员专属;新用户流程不展示,避免注册时被助手选择打扰) -->
  179. <view class="family-section" v-if="isEdit && !isNewUserFlow && memberLevel !== 'FREE'">
  180. <view class="section-title">🤖 选择助手</view>
  181. <view class="mascot-cards">
  182. <view class="mascot-card" :class="{ active: form.mascot === 'xibao' }" @click="selectMascot('xibao')">
  183. <view class="mascot-card-icon xibao-bg">🌟</view>
  184. <view class="mascot-card-info">
  185. <text class="mascot-card-name">浠宝</text>
  186. <text class="mascot-card-desc">温柔活泼的阳光女孩</text>
  187. </view>
  188. </view>
  189. <view class="mascot-card" :class="{ active: form.mascot === 'fubao' }" @click="selectMascot('fubao')">
  190. <view class="mascot-card-icon fubao-bg">💪</view>
  191. <view class="mascot-card-info">
  192. <text class="mascot-card-name">福宝</text>
  193. <text class="mascot-card-desc">开朗自信的阳光男孩</text>
  194. </view>
  195. </view>
  196. </view>
  197. </view>
  198. <!-- 家庭角色选择(新用户流程、角色为家长、有家庭邀请码时显示,可选) -->
  199. <view class="family-section" v-if="isEdit && form.role === 'parent' && isNewUserFlow && hasPendingFamilyInvite">
  200. <view class="section-title">👨‍👩‍👧‍👦 家庭身份(可选)</view>
  201. <view class="form-item">
  202. <text class="label">您在家庭中的身份</text>
  203. <picker mode="selector" :range="familyRoleOptions" :value="familyRoleIndex" @change="onFamilyRoleChange">
  204. <view class="picker-input">{{ form.familyRole || '请选择(可跳过)' }}</view>
  205. </picker>
  206. </view>
  207. <text class="hint-text">不选也可先保存,后续在家庭页面发起申请</text>
  208. </view>
  209. <!-- 免费用户提示(新用户首次注册信息完善时不展示,注册流程不推送会员) -->
  210. <view class="family-section" v-if="isEdit && !isNewUserFlow && memberLevel === 'FREE'">
  211. <view class="mascot-locked-hint" @click="goUpgrade">
  212. <text class="locked-icon">🔒</text>
  213. <text class="locked-text">开通会员解锁更多能力</text>
  214. <text class="locked-arrow">›</text>
  215. </view>
  216. </view>
  217. <!-- 新用户流程:保存资料 / 跳过 -->
  218. <view class="family-section" v-if="isEdit && form.role !== 'teacher' && isNewUserFlow">
  219. <view class="family-actions">
  220. <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
  221. 保存资料
  222. </button>
  223. <button class="btn btn-skip" @click="skip">
  224. 跳过
  225. </button>
  226. </view>
  227. </view>
  228. <!-- 修改个人资料保存按钮(非新用户流程时显示) -->
  229. <view class="family-section" v-if="isEdit && !isNewUserFlow && form.role !== 'teacher'">
  230. <view class="family-actions">
  231. <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
  232. 保存修改
  233. </button>
  234. </view>
  235. </view>
  236. <!-- 成长规划师提交按钮 -->
  237. <view class="family-section" v-if="isEdit && form.role === 'teacher' && isNewUserFlow">
  238. <view class="family-actions">
  239. <button class="btn btn-primary" @click="submitTeacherInfo" :loading="loading">
  240. 提交申请
  241. </button>
  242. </view>
  243. </view>
  244. </view>
  245. <view v-else-if="isEdit">
  246. <FamilyEmptyState type="card" />
  247. </view>
  248. <!-- 区域选择弹窗(省市区三级联动) -->
  249. <view class="region-mask" v-if="showRegionPicker" @click="cancelRegion">
  250. <view class="region-picker" @click.stop>
  251. <view class="region-header">
  252. <text class="region-header-btn" @click="cancelRegion">取消</text>
  253. <text class="region-header-title">选择地区</text>
  254. <text class="region-header-btn region-confirm" @click="confirmRegion">确定</text>
  255. </view>
  256. <view class="region-breadcrumb">
  257. <text
  258. v-for="(name, i) in regionBreadcrumb"
  259. :key="i"
  260. :class="['crumb-item', i === currentRegionLevel ? 'crumb-active' : '']"
  261. @click="jumpRegionLevel(i)"
  262. >{{ name || '请选择' }}</text>
  263. <text class="crumb-arrow" v-if="currentRegionLevel < 2">›</text>
  264. </view>
  265. <scroll-view class="region-list" scroll-y>
  266. <view
  267. v-for="(item, idx) in currentRegionItems"
  268. :key="idx"
  269. :class="['region-item', isRegionSelected(item) ? 'region-item-selected' : '']"
  270. @click="selectRegionItem(item)"
  271. >
  272. <text class="region-item-text">{{ getRegionName(item) }}</text>
  273. <text class="region-item-check" v-if="isRegionSelected(item)">✓</text>
  274. </view>
  275. <view v-if="regionLoading" class="region-loading">
  276. <text>加载中...</text>
  277. </view>
  278. </scroll-view>
  279. </view>
  280. </view>
  281. </view>
  282. </template>
  283. <script>
  284. import { updateUserInfo, createFamily, directRegister, getUserInfo, requestJoinByCode, getMyMembership, bindReferral } from '../../utils/api.js'
  285. import config from '@/config.js'
  286. export default {
  287. data() {
  288. return {
  289. isEdit: false,
  290. showRoleSelect: true,
  291. isNewUserFlow: false, // 是否是新用户注册流程
  292. memberLevel: 'FREE', // 会员等级,用于判断是否解锁助手
  293. form: {
  294. role: '',
  295. avatar: '',
  296. nickname: '',
  297. realName: '',
  298. gender: '',
  299. idCard: '',
  300. birthday: '',
  301. birthHour: '',
  302. inviteCode: '',
  303. familyRole: '', // 家庭角色:爸爸/妈妈/爷爷/奶奶/姥爷/姥姥/其他(可选)
  304. mascot: '',
  305. phone: '',
  306. teacherNo: '',
  307. teacherPhoto: '',
  308. certificateImage: '',
  309. ethnicity: '',
  310. bloodType: '',
  311. highestEducation: '',
  312. maritalStatus: '',
  313. hobbies: '',
  314. dietPreferences: '',
  315. address: '',
  316. province: '',
  317. city: '',
  318. district: '',
  319. street: ''
  320. },
  321. // 区域选择弹窗(省市区三级联动,与订单收货人地址一致)
  322. showRegionPicker: false,
  323. currentRegionLevel: 0, // 0=省份, 1=城市, 2=区县
  324. regionLoading: false,
  325. provinceList: [],
  326. cityList: [],
  327. districtList: [],
  328. tempProvince: null,
  329. tempCity: null,
  330. tempDistrict: null,
  331. ethnicityOptions: ['汉族','蒙古族','回族','藏族','维吾尔族','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克族','傣族','黎族','其他'],
  332. bloodTypeOptions: ['A','B','AB','O','未知'],
  333. 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)'],
  334. birthHourValues: ['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'],
  335. educationOptions: ['小学','初中','高中','中专','大专','本科','硕士','博士'],
  336. maritalOptions: ['未婚','已婚','离异','丧偶'],
  337. familyRoleOptions: ['爸爸', '妈妈', '爷爷', '奶奶', '姥爷', '姥姥', '其他'],
  338. loading: false,
  339. userId: '',
  340. token: ''
  341. }
  342. },
  343. computed: {
  344. ethnicityIndex() {
  345. return this.ethnicityOptions.indexOf(this.form.ethnicity)
  346. },
  347. bloodTypeIndex() {
  348. return this.bloodTypeOptions.indexOf(this.form.bloodType)
  349. },
  350. birthHourIndex() {
  351. return this.birthHourValues.indexOf(this.form.birthHour)
  352. },
  353. educationIndex() {
  354. return this.educationOptions.indexOf(this.form.highestEducation)
  355. },
  356. maritalIndex() {
  357. return this.maritalOptions.indexOf(this.form.maritalStatus)
  358. },
  359. familyRoleIndex: {
  360. get() {
  361. return this.familyRoleOptions.indexOf(this.form.familyRole)
  362. },
  363. set(val) {
  364. this.form.familyRole = this.familyRoleOptions[val] || ''
  365. }
  366. },
  367. hasFamily: function() {
  368. if (this.token) return true
  369. return this.$store.getters.hasFamily
  370. },
  371. // 是否有待处理的家庭邀请码
  372. hasPendingFamilyInvite: function() {
  373. return !!uni.getStorageSync('pendingFamilyInviteCode')
  374. },
  375. regionBreadcrumb: function() {
  376. var names = []
  377. names.push(this.tempProvince ? this.getRegionName(this.tempProvince) : '省份')
  378. names.push(this.tempCity ? this.getRegionName(this.tempCity) : '城市')
  379. names.push(this.tempDistrict ? this.getRegionName(this.tempDistrict) : '区县')
  380. return names
  381. },
  382. currentRegionItems: function() {
  383. if (this.currentRegionLevel === 0) return this.provinceList
  384. if (this.currentRegionLevel === 1) return this.cityList
  385. if (this.currentRegionLevel === 2) return this.districtList
  386. return []
  387. },
  388. },
  389. onLoad(options) {
  390. if (options.token && options.userId) {
  391. this.token = options.token
  392. this.userId = options.userId
  393. if (options.autoParent === 'true') {
  394. // 首次登录:跳过角色选择,默认 parent,直接进入信息补充页
  395. this.showRoleSelect = false
  396. this.isEdit = true
  397. this.isNewUserFlow = true
  398. this.form.role = 'parent'
  399. } else {
  400. // 检查是否需要选择角色(新用户)- 只有明确传递 needsRoleSelect=true 才显示选择
  401. this.showRoleSelect = options.needsRoleSelect === 'true'
  402. this.isEdit = !this.showRoleSelect
  403. this.isNewUserFlow = options.needsRoleSelect === 'true'
  404. }
  405. } else if (options.phone && (options.autoParent === 'true' || options.needsRoleSelect === 'true')) {
  406. // 测试环境:没有token,只有手机号,是新用户注册流程
  407. this.showRoleSelect = options.needsRoleSelect === 'true'
  408. this.isEdit = !this.showRoleSelect
  409. this.isNewUserFlow = true
  410. if (options.autoParent === 'true') {
  411. this.form.role = 'parent'
  412. }
  413. // 将手机号传递给表单
  414. this.form.phone = options.phone
  415. } else {
  416. // 其他情况:默认进入编辑模式(如从"我的"页面进入)
  417. this.showRoleSelect = false
  418. this.isEdit = true
  419. this.isNewUserFlow = false
  420. }
  421. // 非新用户流程时,加载已有用户信息
  422. if (this.isEdit && !this.isNewUserFlow) {
  423. this.loadUserInfo()
  424. }
  425. // 加载会员等级(用于助手解锁)
  426. var self = this
  427. getMyMembership().then(function(res) {
  428. if (res.data && res.data.memberLevel) {
  429. self.memberLevel = res.data.memberLevel
  430. }
  431. }).catch(function() {})
  432. },
  433. methods: {
  434. selectRole(role) {
  435. this.form.role = role
  436. },
  437. confirmRole() {
  438. if (!this.form.role) {
  439. uni.showToast({ title: '请选择角色', icon: 'none' })
  440. return
  441. }
  442. this.showRoleSelect = false
  443. this.isEdit = true
  444. // 测试环境:直接注册用户(不需要验证码)
  445. if (!this.token && this.form.phone) {
  446. // 自动进入家庭绑定流程
  447. }
  448. },
  449. chooseAvatar() {
  450. uni.chooseImage({
  451. count: 1,
  452. success: (res) => {
  453. this.form.avatar = res.tempFilePaths[0]
  454. }
  455. })
  456. },
  457. chooseTeacherPhoto() {
  458. uni.chooseImage({
  459. count: 1,
  460. success: (res) => {
  461. this.form.teacherPhoto = res.tempFilePaths[0]
  462. }
  463. })
  464. },
  465. chooseCertificate() {
  466. uni.chooseImage({
  467. count: 1,
  468. success: (res) => {
  469. this.form.certificateImage = res.tempFilePaths[0]
  470. }
  471. })
  472. },
  473. onGenderChange(e) {
  474. this.form.gender = e.detail.value
  475. },
  476. onIdCardInput(e) {
  477. const idCard = e.detail.value
  478. if (idCard.length === 18) {
  479. // 根据身份证号自动提取生日
  480. const year = idCard.substring(6, 10)
  481. const month = idCard.substring(10, 12)
  482. const day = idCard.substring(12, 14)
  483. this.form.birthday = `${year}-${month}-${day}`
  484. }
  485. },
  486. onBirthdayChange(e) {
  487. this.form.birthday = e.detail.value
  488. },
  489. onEthnicityChange(e) {
  490. this.form.ethnicity = this.ethnicityOptions[e.detail.value]
  491. },
  492. onBloodTypeChange(e) {
  493. this.form.bloodType = this.bloodTypeOptions[e.detail.value]
  494. },
  495. onBirthHourChange(e) {
  496. this.form.birthHour = this.birthHourValues[e.detail.value]
  497. },
  498. onEducationChange(e) {
  499. this.form.highestEducation = this.educationOptions[e.detail.value]
  500. },
  501. onMaritalChange(e) {
  502. this.form.maritalStatus = this.maritalOptions[e.detail.value]
  503. },
  504. onFamilyRoleChange(e) {
  505. this.form.familyRole = this.familyRoleOptions[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. // 新用户流程:消费分享者推荐码,绑定推荐人(推荐码统一为 refCode storage)
  894. // 登录页 completeLogin 在 needsRoleSelect=true 时直接跳本页,跳过了 handleReferralBind,
  895. // 因此在此处统一消费 storage 中的 refCode/inviteCode,避免推荐人绑定丢失
  896. var refCode = uni.getStorageSync('refCode')
  897. var inviteCode = uni.getStorageSync('inviteCode')
  898. var inviteType = uni.getStorageSync('inviteType')
  899. var code = refCode || (inviteCode && inviteType !== 'team' ? inviteCode : '')
  900. if (code) {
  901. var self = this
  902. bindReferral(code).then(function(res) {
  903. if (res && res.code === 200) {
  904. console.log('新用户绑定推荐人成功', code)
  905. }
  906. }).catch(function(e) {
  907. // 后端 Result.error(code=500) → request() 已 toast 业务消息
  908. if (e && e.code !== undefined && e.code !== 401) {
  909. console.log('新用户绑定推荐人业务拒绝', code, e.message || '')
  910. } else {
  911. console.log('新用户绑定推荐人失败', e)
  912. }
  913. })
  914. }
  915. uni.removeStorageSync('refCode')
  916. uni.removeStorageSync('inviteCode')
  917. uni.removeStorageSync('inviteType')
  918. // 用 switchTab 跳转带底部 TabBar 的首页(行/身/智/心/富)
  919. // parent-index/child-index 是分包页面(非 TabBar 页),用 navigateTo 会丢失底部 TabBar
  920. uni.switchTab({ url: '/pages/index-home/index' })
  921. }
  922. }
  923. }
  924. </script>
  925. <style scoped>
  926. .user-edit-container {
  927. min-height: 100vh;
  928. background: #f5f5f5;
  929. padding: 30rpx;
  930. }
  931. .header {
  932. margin-bottom: 40rpx;
  933. text-align: center;
  934. }
  935. .title {
  936. font-size: 40rpx;
  937. font-weight: bold;
  938. color: #333;
  939. display: block;
  940. margin-bottom: 10rpx;
  941. }
  942. .subtitle {
  943. font-size: 28rpx;
  944. color: #999;
  945. }
  946. /* 角色选择 */
  947. .role-select-section {
  948. margin-bottom: 40rpx;
  949. }
  950. .role-card {
  951. background: #fff;
  952. border-radius: 16rpx;
  953. padding: 40rpx;
  954. margin-bottom: 20rpx;
  955. display: flex;
  956. flex-direction: column;
  957. align-items: center;
  958. border: 2rpx solid transparent;
  959. transition: all 0.3s;
  960. }
  961. .role-card.active {
  962. border-color: #4CAF50;
  963. background: #f8fdf8;
  964. }
  965. .role-icon {
  966. font-size: 80rpx;
  967. margin-bottom: 16rpx;
  968. }
  969. .role-name {
  970. font-size: 32rpx;
  971. font-weight: bold;
  972. color: #333;
  973. margin-bottom: 8rpx;
  974. }
  975. .role-desc {
  976. font-size: 24rpx;
  977. color: #999;
  978. }
  979. .btn-next {
  980. background: #4CAF50;
  981. color: #fff;
  982. border-radius: 40rpx;
  983. margin-top: 20rpx;
  984. }
  985. /* 表单 */
  986. .form-section {
  987. background: #fff;
  988. border-radius: 16rpx;
  989. padding: 30rpx;
  990. margin-bottom: 30rpx;
  991. }
  992. .form-section-title {
  993. font-size: 30rpx;
  994. font-weight: bold;
  995. color: #333;
  996. margin-bottom: 20rpx;
  997. padding-bottom: 16rpx;
  998. border-bottom: 1rpx solid #f0f0f0;
  999. }
  1000. .form-item {
  1001. margin-bottom: 30rpx;
  1002. }
  1003. .label {
  1004. display: block;
  1005. font-size: 28rpx;
  1006. color: #333;
  1007. margin-bottom: 16rpx;
  1008. }
  1009. .required {
  1010. color: #f44336;
  1011. }
  1012. .input, .picker-input {
  1013. padding: 20rpx;
  1014. background: #f5f5f5;
  1015. border-radius: 12rpx;
  1016. font-size: 28rpx;
  1017. }
  1018. .role-select {
  1019. display: flex;
  1020. gap: 40rpx;
  1021. }
  1022. .role-option {
  1023. display: flex;
  1024. align-items: center;
  1025. gap: 8rpx;
  1026. }
  1027. /* 头像上传 */
  1028. .avatar-upload {
  1029. width: 150rpx;
  1030. height: 150rpx;
  1031. }
  1032. .avatar-preview {
  1033. width: 150rpx;
  1034. height: 150rpx;
  1035. border-radius: 50%;
  1036. }
  1037. .avatar-placeholder {
  1038. width: 150rpx;
  1039. height: 150rpx;
  1040. background: #f5f5f5;
  1041. border-radius: 50%;
  1042. display: flex;
  1043. align-items: center;
  1044. justify-content: center;
  1045. font-size: 60rpx;
  1046. color: #ccc;
  1047. }
  1048. /* 照片上传 */
  1049. .photo-upload {
  1050. width: 300rpx;
  1051. height: 200rpx;
  1052. }
  1053. .photo-preview {
  1054. width: 300rpx;
  1055. height: 200rpx;
  1056. border-radius: 12rpx;
  1057. }
  1058. .photo-placeholder {
  1059. width: 300rpx;
  1060. height: 200rpx;
  1061. background: #f5f5f5;
  1062. border-radius: 12rpx;
  1063. display: flex;
  1064. flex-direction: column;
  1065. align-items: center;
  1066. justify-content: center;
  1067. }
  1068. .plus-icon {
  1069. font-size: 60rpx;
  1070. color: #ccc;
  1071. }
  1072. .placeholder-text {
  1073. font-size: 24rpx;
  1074. color: #999;
  1075. margin-top: 8rpx;
  1076. }
  1077. /* 助手选择 */
  1078. .mascot-cards {
  1079. display: flex;
  1080. gap: 20rpx;
  1081. margin-top: 16rpx;
  1082. }
  1083. .mascot-card {
  1084. flex: 1;
  1085. background: #f8f8f8;
  1086. border-radius: 16rpx;
  1087. padding: 24rpx;
  1088. display: flex;
  1089. align-items: center;
  1090. gap: 16rpx;
  1091. border: 2rpx solid transparent;
  1092. transition: all 0.3s;
  1093. }
  1094. .mascot-card.active {
  1095. border-color: #4CAF50;
  1096. background: #f0fdf4;
  1097. }
  1098. .mascot-card-icon {
  1099. width: 72rpx;
  1100. height: 72rpx;
  1101. border-radius: 50%;
  1102. display: flex;
  1103. align-items: center;
  1104. justify-content: center;
  1105. font-size: 36rpx;
  1106. flex-shrink: 0;
  1107. }
  1108. .xibao-bg {
  1109. background: linear-gradient(135deg, #FFF0DB, #FFD6A5);
  1110. }
  1111. .fubao-bg {
  1112. background: linear-gradient(135deg, #FFF8E1, #FCD34D);
  1113. }
  1114. .mascot-card-info {
  1115. display: flex;
  1116. flex-direction: column;
  1117. gap: 4rpx;
  1118. }
  1119. .mascot-card-name {
  1120. font-size: 30rpx;
  1121. font-weight: bold;
  1122. color: #333;
  1123. }
  1124. .mascot-card-desc {
  1125. font-size: 22rpx;
  1126. color: #999;
  1127. }
  1128. /* 家庭绑定 */
  1129. .family-section {
  1130. background: #fff;
  1131. border-radius: 16rpx;
  1132. padding: 30rpx;
  1133. }
  1134. .section-title {
  1135. font-size: 30rpx;
  1136. font-weight: bold;
  1137. color: #333;
  1138. margin-bottom: 20rpx;
  1139. }
  1140. .family-actions {
  1141. display: flex;
  1142. flex-direction: column;
  1143. gap: 20rpx;
  1144. margin-top: 30rpx;
  1145. }
  1146. .btn {
  1147. border-radius: 40rpx;
  1148. font-size: 30rpx;
  1149. }
  1150. .btn-primary {
  1151. background: #4CAF50;
  1152. color: #fff;
  1153. }
  1154. .btn-skip {
  1155. background: #f5f5f5;
  1156. color: #999;
  1157. }
  1158. /* ===== 区域选择弹窗 ===== */
  1159. .region-mask {
  1160. position: fixed;
  1161. top: 0;
  1162. left: 0;
  1163. right: 0;
  1164. bottom: 0;
  1165. background: rgba(0, 0, 0, 0.5);
  1166. z-index: 999;
  1167. display: flex;
  1168. align-items: flex-end;
  1169. }
  1170. .region-picker {
  1171. background: #fff;
  1172. border-radius: 20rpx 20rpx 0 0;
  1173. width: 100%;
  1174. max-height: 70vh;
  1175. display: flex;
  1176. flex-direction: column;
  1177. }
  1178. .region-header {
  1179. display: flex;
  1180. justify-content: space-between;
  1181. align-items: center;
  1182. padding: 24rpx 30rpx;
  1183. border-bottom: 1rpx solid #f0f0f0;
  1184. }
  1185. .region-header-btn {
  1186. font-size: 28rpx;
  1187. color: #999;
  1188. }
  1189. .region-confirm {
  1190. color: #F97316;
  1191. font-weight: bold;
  1192. }
  1193. .region-header-title {
  1194. font-size: 30rpx;
  1195. font-weight: bold;
  1196. color: #333;
  1197. }
  1198. .region-breadcrumb {
  1199. display: flex;
  1200. align-items: center;
  1201. padding: 20rpx 30rpx;
  1202. border-bottom: 1rpx solid #f5f5f5;
  1203. }
  1204. .crumb-item {
  1205. font-size: 26rpx;
  1206. color: #999;
  1207. padding: 8rpx 12rpx;
  1208. border-radius: 8rpx;
  1209. }
  1210. .crumb-item.crumb-active {
  1211. color: #F97316;
  1212. font-weight: bold;
  1213. }
  1214. .crumb-arrow {
  1215. font-size: 24rpx;
  1216. color: #ccc;
  1217. margin: 0 8rpx;
  1218. }
  1219. .region-list {
  1220. max-height: 50vh;
  1221. overflow-y: auto;
  1222. }
  1223. .region-item {
  1224. display: flex;
  1225. justify-content: space-between;
  1226. align-items: center;
  1227. padding: 28rpx 30rpx;
  1228. border-bottom: 1rpx solid #f5f5f5;
  1229. }
  1230. .region-item:active {
  1231. background: #FFF7ED;
  1232. }
  1233. .region-item-text {
  1234. font-size: 28rpx;
  1235. color: #333;
  1236. }
  1237. .region-item-check {
  1238. font-size: 28rpx;
  1239. color: #F97316;
  1240. font-weight: bold;
  1241. }
  1242. .region-item-selected {
  1243. background: #FFF7ED;
  1244. }
  1245. .region-item-selected .region-item-text {
  1246. color: #F97316;
  1247. font-weight: bold;
  1248. }
  1249. .region-loading {
  1250. padding: 40rpx;
  1251. text-align: center;
  1252. font-size: 26rpx;
  1253. color: #999;
  1254. }
  1255. /* ===== 地址行(所在地区) ===== */
  1256. .address-row {
  1257. display: flex;
  1258. justify-content: space-between;
  1259. align-items: center;
  1260. }
  1261. .address-value-wrap {
  1262. display: flex;
  1263. align-items: center;
  1264. flex: 1;
  1265. justify-content: flex-end;
  1266. }
  1267. .address-value {
  1268. font-size: 28rpx;
  1269. color: #333;
  1270. }
  1271. .address-placeholder {
  1272. font-size: 28rpx;
  1273. color: #999;
  1274. }
  1275. .address-arrow {
  1276. font-size: 28rpx;
  1277. color: #ccc;
  1278. margin-left: 8rpx;
  1279. }
  1280. /* 助手锁定提示 */
  1281. .mascot-locked-hint {
  1282. display: flex;
  1283. align-items: center;
  1284. padding: 28rpx 32rpx;
  1285. background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  1286. border-radius: 20rpx;
  1287. margin-top: 16rpx;
  1288. }
  1289. .locked-icon {
  1290. font-size: 36rpx;
  1291. margin-right: 16rpx;
  1292. }
  1293. .locked-text {
  1294. flex: 1;
  1295. font-size: 28rpx;
  1296. font-weight: 600;
  1297. color: #92400e;
  1298. }
  1299. .locked-arrow {
  1300. font-size: 32rpx;
  1301. color: #92400e;
  1302. margin-left: 8rpx;
  1303. }
  1304. </style>