猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

587 lines
13 KiB

fix(订单管理): 修复宠物档案跳转缺少订单ID的问题 修复订单详情页跳转宠物档案页面时未传递orderId参数的问题 ``` ```msg refactor(认证考试): 重构考试答案提交逻辑 将单个题目提交改为批量提交,优化考试流程: 1. 基础考试和培训考试都改为最后统一提交答案 2. 添加加载状态提示 3. 使用Promise.all处理并发请求 ``` ```msg fix(认证考试): 修复考试完成状态判断逻辑 修改answeBaseIsFinish和answeTrainIsFinish接口的返回判断逻辑,从检查code改为检查data字段 ``` ```msg feat(认证考试): 新增重新考试和成为伴宠师接口 1. 添加retakeExam和appletUsersTeacher接口 2. 在错误详情页添加重新考试功能 3. 在考试完成页添加成为伴宠师功能 ``` ```msg style(时间轴组件): 优化操作按钮布局 1. 添加按钮间距(gap) 2. 使用flex:1使按钮等宽 3. 根据状态显示不同按钮文本 4. 添加serviceBtn属性控制档案按钮显示 ``` ```msg refactor(订单弹窗): 重构服务档案弹窗组件 1. 使用timelineService组件替代原有实现 2. 简化数据结构处理 3. 添加状态判断逻辑 4. 优化弹窗标题和样式 ``` ```msg fix(表单验证): 添加认证考试结束页表单验证 1. 添加姓名、电话、地址的必填验证 2. 添加格式验证(电话格式、姓名格式) 3. 添加长度验证 4. 添加错误状态样式 5. 优化错误提示体验 ``` ```msg refactor(工作台): 重构伴宠师申请流程 1. 优化申请条件判断逻辑 2. 添加用户状态检查 3. 完善考试状态跳转逻辑 4. 统一使用store获取用户信息
4 days ago
fix(订单管理): 修复宠物档案跳转缺少订单ID的问题 修复订单详情页跳转宠物档案页面时未传递orderId参数的问题 ``` ```msg refactor(认证考试): 重构考试答案提交逻辑 将单个题目提交改为批量提交,优化考试流程: 1. 基础考试和培训考试都改为最后统一提交答案 2. 添加加载状态提示 3. 使用Promise.all处理并发请求 ``` ```msg fix(认证考试): 修复考试完成状态判断逻辑 修改answeBaseIsFinish和answeTrainIsFinish接口的返回判断逻辑,从检查code改为检查data字段 ``` ```msg feat(认证考试): 新增重新考试和成为伴宠师接口 1. 添加retakeExam和appletUsersTeacher接口 2. 在错误详情页添加重新考试功能 3. 在考试完成页添加成为伴宠师功能 ``` ```msg style(时间轴组件): 优化操作按钮布局 1. 添加按钮间距(gap) 2. 使用flex:1使按钮等宽 3. 根据状态显示不同按钮文本 4. 添加serviceBtn属性控制档案按钮显示 ``` ```msg refactor(订单弹窗): 重构服务档案弹窗组件 1. 使用timelineService组件替代原有实现 2. 简化数据结构处理 3. 添加状态判断逻辑 4. 优化弹窗标题和样式 ``` ```msg fix(表单验证): 添加认证考试结束页表单验证 1. 添加姓名、电话、地址的必填验证 2. 添加格式验证(电话格式、姓名格式) 3. 添加长度验证 4. 添加错误状态样式 5. 优化错误提示体验 ``` ```msg refactor(工作台): 重构伴宠师申请流程 1. 优化申请条件判断逻辑 2. 添加用户状态检查 3. 完善考试状态跳转逻辑 4. 统一使用store获取用户信息
4 days ago
fix(订单管理): 修复宠物档案跳转缺少订单ID的问题 修复订单详情页跳转宠物档案页面时未传递orderId参数的问题 ``` ```msg refactor(认证考试): 重构考试答案提交逻辑 将单个题目提交改为批量提交,优化考试流程: 1. 基础考试和培训考试都改为最后统一提交答案 2. 添加加载状态提示 3. 使用Promise.all处理并发请求 ``` ```msg fix(认证考试): 修复考试完成状态判断逻辑 修改answeBaseIsFinish和answeTrainIsFinish接口的返回判断逻辑,从检查code改为检查data字段 ``` ```msg feat(认证考试): 新增重新考试和成为伴宠师接口 1. 添加retakeExam和appletUsersTeacher接口 2. 在错误详情页添加重新考试功能 3. 在考试完成页添加成为伴宠师功能 ``` ```msg style(时间轴组件): 优化操作按钮布局 1. 添加按钮间距(gap) 2. 使用flex:1使按钮等宽 3. 根据状态显示不同按钮文本 4. 添加serviceBtn属性控制档案按钮显示 ``` ```msg refactor(订单弹窗): 重构服务档案弹窗组件 1. 使用timelineService组件替代原有实现 2. 简化数据结构处理 3. 添加状态判断逻辑 4. 优化弹窗标题和样式 ``` ```msg fix(表单验证): 添加认证考试结束页表单验证 1. 添加姓名、电话、地址的必填验证 2. 添加格式验证(电话格式、姓名格式) 3. 添加长度验证 4. 添加错误状态样式 5. 优化错误提示体验 ``` ```msg refactor(工作台): 重构伴宠师申请流程 1. 优化申请条件判断逻辑 2. 添加用户状态检查 3. 完善考试状态跳转逻辑 4. 统一使用store获取用户信息
4 days ago
fix(订单管理): 修复宠物档案跳转缺少订单ID的问题 修复订单详情页跳转宠物档案页面时未传递orderId参数的问题 ``` ```msg refactor(认证考试): 重构考试答案提交逻辑 将单个题目提交改为批量提交,优化考试流程: 1. 基础考试和培训考试都改为最后统一提交答案 2. 添加加载状态提示 3. 使用Promise.all处理并发请求 ``` ```msg fix(认证考试): 修复考试完成状态判断逻辑 修改answeBaseIsFinish和answeTrainIsFinish接口的返回判断逻辑,从检查code改为检查data字段 ``` ```msg feat(认证考试): 新增重新考试和成为伴宠师接口 1. 添加retakeExam和appletUsersTeacher接口 2. 在错误详情页添加重新考试功能 3. 在考试完成页添加成为伴宠师功能 ``` ```msg style(时间轴组件): 优化操作按钮布局 1. 添加按钮间距(gap) 2. 使用flex:1使按钮等宽 3. 根据状态显示不同按钮文本 4. 添加serviceBtn属性控制档案按钮显示 ``` ```msg refactor(订单弹窗): 重构服务档案弹窗组件 1. 使用timelineService组件替代原有实现 2. 简化数据结构处理 3. 添加状态判断逻辑 4. 优化弹窗标题和样式 ``` ```msg fix(表单验证): 添加认证考试结束页表单验证 1. 添加姓名、电话、地址的必填验证 2. 添加格式验证(电话格式、姓名格式) 3. 添加长度验证 4. 添加错误状态样式 5. 优化错误提示体验 ``` ```msg refactor(工作台): 重构伴宠师申请流程 1. 优化申请条件判断逻辑 2. 添加用户状态检查 3. 完善考试状态跳转逻辑 4. 统一使用store获取用户信息
4 days ago
  1. <template>
  2. <view class="timeline-container">
  3. <!-- 日期和状态标签 -->
  4. <view class="date-header">
  5. <view class="date-box">
  6. <view class="date-box-color" :style="{'background-color': getTopBgColor()}"></view>
  7. <view class="date-month-day">{{ formatDate(props.date).month }}-{{ formatDate(props.date).day }}</view>
  8. </view>
  9. <view class="status-tag" :class="{'status-tag-pending': props.status}">
  10. <image src="/static/images/ydd/icon1.png"
  11. mode="aspectFit"
  12. v-if="status"
  13. class="status-icon"></image>
  14. <image src="/static/images/order/success.png"
  15. mode="aspectFit"
  16. v-else
  17. class="status-icon"></image>
  18. {{ status ? '待上门' : '已完成' }}
  19. </view>
  20. </view>
  21. <!-- 空状态显示 -->
  22. <view v-if="!props.list || props.list.length === 0" class="empty-state">
  23. <text class="empty-text">暂无订单数据</text>
  24. </view>
  25. <!-- 时间线主体 -->
  26. <view v-else class="timeline-body" v-for="(item, index) in props.list" :key="index">
  27. <view class="timeline-line"></view>
  28. <view class="time-point">
  29. <view class="time-icon">
  30. <image src="/static/images/order/address.png" mode="aspectFit" class="time-image"></image>
  31. </view>
  32. <view class="time-text">{{ item.receiverCity }}</view>
  33. <view class="collapse-icon" @click="toggleServiceCard(index)">
  34. {{ serviceCardCollapsed[index] ? '展开' : '收起' }} <text class="arrow" :class="{'arrow-up': !serviceCardCollapsed[index]}"></text>
  35. </view>
  36. </view>
  37. <!-- 服务内容卡片 -->
  38. <view v-if="!serviceCardCollapsed[index]" class="service-card">
  39. <!-- 服务日期 -->
  40. <view class="service-section">
  41. <view class="section-title">
  42. <view class="title-indicator"></view>
  43. <text>服务日期</text>
  44. <text style="margin-left: auto;font-weight: 500;font-size: 24rpx;">订单编号{{ item.orderId }}</text>
  45. </view>
  46. <view class="section-content date-content" :class="{bgSuccessQ : item.status == '2'}">
  47. {{ dayjs(item.serviceDate).format('YYYY/MM/DD') }}
  48. </view>
  49. </view>
  50. <!-- 陪伴对象 -->
  51. <view class="service-section">
  52. <view class="section-title">
  53. <view class="title-indicator"></view>
  54. <text>陪伴对象</text>
  55. <view class="collapse-icon" @click="togglePetList(index)">
  56. {{ petListCollapsed[index] ? '展开' : '收起' }} <text class="arrow" :class="{'arrow-up': !petListCollapsed[index]}"></text>
  57. </view>
  58. </view>
  59. <view class="section-content pet-list" :class="{bgSuccessQ : item.status == '2'}" v-if="!petListCollapsed[index]">
  60. <view v-for="(pet, i) in item.pets" :key="i" class="pet-item">
  61. <view class="pet-avatar">
  62. <image :src="pet.photo" mode="aspectFill" class="avatar-image"></image>
  63. </view>
  64. <view class="pet-info">
  65. <view class="pet-name">
  66. {{ pet.name }}
  67. <text class="pet-gender" :class="{'pet-gender-male': pet.gender === 'male', 'pet-gender-female': pet.gender === 'female'}">
  68. {{ pet.gender === 'male' ? '♂' : '♀' }}
  69. </text>
  70. </view>
  71. <view class="pet-description">
  72. {{ pet.breed }}{{ pet.bodyType }} | {{ pet.orderItemList.map(n => n.productName).join(',') }}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 上门地址 -->
  79. <view class="service-section">
  80. <view class="section-title">
  81. <view class="title-indicator"></view>
  82. <text>上门地址</text>
  83. </view>
  84. <view class="section-content address-content" :class="{bgSuccessQ : item.status == '2'}">
  85. {{ item.receiverDetailAddress }}
  86. </view>
  87. </view>
  88. <!-- 操作按钮 -->
  89. <view class="action-buttons">
  90. <view class="btn btn-clock" :class="{bgSuccess : item.status == '2'}"
  91. @click="handleClock(item)">{{ item.status == '2' ? '查看记录' : '打卡' }}</view>
  92. <view class="btn btn-clock" :class="{bgSuccess : item.status == '2'}"
  93. v-if="serviceBtn"
  94. @click="handlePetFile(item)">宠物档案</view>
  95. <view class="btn btn-clock" :class="{bgSuccess : item.status == '2'}"
  96. v-if="serviceBtn"
  97. @click="handleServiceFile(item)">服务档案</view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script setup>
  104. import { ref, computed } from 'vue';
  105. import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js';
  106. import dayjs from 'dayjs';
  107. import list from '../../../uni_modules/uview-plus/components/u-list/list';
  108. // 定义组件属性
  109. const props = defineProps({
  110. date: {
  111. type: String,
  112. default: '2024-12-08'
  113. },
  114. orderCount: {
  115. type: Number,
  116. default: 2
  117. },
  118. status : {
  119. type: Boolean,
  120. default: true
  121. },
  122. current: {
  123. type: Number,
  124. default: 0
  125. },
  126. list: {
  127. type: Array,
  128. default: () => []
  129. },
  130. serviceBtn : {
  131. default : true,
  132. type : Boolean,
  133. },
  134. });
  135. // 宠物列表折叠状态 - 使用数组来单独控制每个卡片中的宠物列表
  136. const petListCollapsed = ref([]);
  137. // 服务卡片折叠状态 - 使用数组来单独控制每个卡片
  138. const serviceCardCollapsed = ref([]);
  139. // 切换宠物列表显示状态
  140. const togglePetList = (index) => {
  141. if (petListCollapsed.value[index] === undefined) {
  142. petListCollapsed.value[index] = true;
  143. } else {
  144. petListCollapsed.value[index] = !petListCollapsed.value[index];
  145. }
  146. };
  147. // 切换服务卡片显示状态
  148. const toggleServiceCard = (index) => {
  149. if (serviceCardCollapsed.value[index] === undefined) {
  150. serviceCardCollapsed.value[index] = true;
  151. } else {
  152. serviceCardCollapsed.value[index] = !serviceCardCollapsed.value[index];
  153. }
  154. };
  155. // 格式化日期
  156. const formatDate = (dateString) => {
  157. const date = new Date(dateString);
  158. return {
  159. day: date.getDate().toString().padStart(2, '0'),
  160. month: (date.getMonth() + 1).toString().padStart(2, '0')
  161. };
  162. };
  163. // 按钮事件处理函数
  164. const handleClock = (item) => {
  165. console.log(item);
  166. // 根据订单状态确定跳转路径
  167. const paths = [
  168. `/otherPages/myOrdersManage/clock/index?id=${item.id}`,
  169. ];
  170. uni.navigateTo({
  171. url: `/otherPages/myOrdersManage/clock/index?id=${item.id}`,
  172. });
  173. };
  174. const handlePetFile = (item) => {
  175. uni.navigateTo({
  176. url: "/otherPages/orderTakingManage/pet/index?id=" + item.orderId
  177. });
  178. };
  179. const handleServiceFile = (item) => {
  180. uni.navigateTo({
  181. url: "/otherPages/myOrdersManage/service/index?id=" + item.orderId
  182. });
  183. };
  184. function getTopBgColor(){
  185. return props.status ? '#FFAA48' : '#4CD964';
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .bgSuccess{
  190. background-color: #4CD964 !important;
  191. }
  192. .bgSuccessQ{
  193. background-color: #4CD96422 !important;
  194. }
  195. .timeline-container {
  196. position: relative;
  197. padding: 20rpx;
  198. margin-bottom: 30rpx;
  199. .empty-state {
  200. display: flex;
  201. flex-direction: column;
  202. align-items: center;
  203. justify-content: center;
  204. padding: 80rpx 40rpx;
  205. .empty-image {
  206. width: 200rpx;
  207. height: 200rpx;
  208. margin-bottom: 20rpx;
  209. }
  210. .empty-text {
  211. color: #999;
  212. font-size: 28rpx;
  213. }
  214. }
  215. .date-header {
  216. display: flex;
  217. align-items: center;
  218. margin-bottom: 20rpx;
  219. .date-box {
  220. width: 80rpx;
  221. background-color: #ffffff;
  222. border: 2px solid #333;
  223. border-radius: 0;
  224. display: flex;
  225. flex-direction: column;
  226. justify-content: center;
  227. align-items: center;
  228. margin-right: 20rpx;
  229. box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.05);
  230. border-radius: 14rpx;
  231. .date-box-color{
  232. height: 20rpx;
  233. width: 100%;
  234. border-top-left-radius: 14rpx;
  235. border-top-right-radius: 14rpx;
  236. position: relative;
  237. &::before{
  238. content: '';
  239. display: block;
  240. background-color: #ddd;
  241. width: 100%;
  242. height: 26rpx;
  243. top: 100%;
  244. left: 0;
  245. position: absolute;
  246. }
  247. }
  248. .date-month-day {
  249. position: relative;
  250. font-size: 26rpx;
  251. font-weight: bold;
  252. color: #333;
  253. height: 50rpx;
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: center;
  257. }
  258. }
  259. .status-tag {
  260. background-color: #4CD96422;
  261. color: #4CD964;
  262. border: 4rpx solid #4CD964;
  263. padding: 16rpx 26rpx;
  264. border-radius: 14rpx;
  265. font-size: 26rpx;
  266. display: flex;
  267. align-items: center;
  268. position: relative;
  269. margin-left: 20rpx;
  270. .status-icon {
  271. width: 32rpx;
  272. height: 32rpx;
  273. margin-right: 8rpx;
  274. }
  275. &::after{
  276. content: '';
  277. display: block;
  278. position: absolute;
  279. width: 0;
  280. height: 0;
  281. top: 50%;
  282. transform: translateY(-50%);
  283. left: -16rpx;
  284. border-top: 16rpx solid transparent;
  285. border-bottom: 16rpx solid transparent;
  286. border-right: 16rpx solid #4CD964;
  287. }
  288. &::before{
  289. content: '';
  290. display: block;
  291. position: absolute;
  292. width: 0;
  293. height: 0;
  294. top: 50%;
  295. transform: translateY(-50%);
  296. left: -12rpx;
  297. border-top: 12rpx solid transparent;
  298. border-bottom: 12rpx solid transparent;
  299. border-right: 12rpx solid #4CD96422;
  300. z-index: 1;
  301. }
  302. }
  303. .status-tag-pending {
  304. background-color: #FFAA4822;
  305. color: #FFAA48;
  306. border-color: #FFAA48;
  307. &::after{
  308. border-right-color: #FFAA48;
  309. }
  310. &::before{
  311. border-right-color: #FFAA4822;
  312. }
  313. }
  314. }
  315. .timeline-body {
  316. position: relative;
  317. padding-left: 40rpx;
  318. padding-bottom: 40rpx;
  319. .timeline-line {
  320. position: absolute;
  321. left: 40rpx;
  322. top: 0;
  323. height: 100%;
  324. width: 0;
  325. border-left: 2rpx dashed #707070;
  326. border-left-style: dashed;
  327. border-image: repeating-linear-gradient(to bottom, #707070 0, #707070 8rpx, transparent 8rpx, transparent 20rpx) 1;
  328. z-index: 0;
  329. &::after{
  330. content: '';
  331. display: block;
  332. position: absolute;
  333. width: 8rpx;
  334. height: 8rpx;
  335. background-color: #000;
  336. border: 2rpx solid #707070;
  337. border-radius: 50%;
  338. left: -7rpx;
  339. top: 30rpx;
  340. }
  341. }
  342. .time-point {
  343. display: flex;
  344. align-items: center;
  345. margin-bottom: 20rpx;
  346. position: relative;
  347. z-index: 1;
  348. .time-icon {
  349. width: 60rpx;
  350. height: 60rpx;
  351. background-color: #fff;
  352. border-radius: 50%;
  353. display: flex;
  354. justify-content: center;
  355. align-items: center;
  356. margin-right: 20rpx;
  357. position: relative;
  358. left: 20rpx;
  359. .time-image {
  360. width: 40rpx;
  361. height: 40rpx;
  362. }
  363. }
  364. .time-text {
  365. font-size: 28rpx;
  366. color: #333;
  367. margin-left: 20rpx;
  368. flex: 1;
  369. }
  370. .collapse-icon {
  371. font-size: 24rpx;
  372. color: #999;
  373. padding: 0 20rpx;
  374. .arrow {
  375. transition: transform 0.3s;
  376. display: inline-block;
  377. }
  378. .arrow-up {
  379. transform: rotate(180deg);
  380. }
  381. }
  382. }
  383. .service-card {
  384. background-color: #fff;
  385. border-radius: 12rpx;
  386. padding: 30rpx;
  387. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  388. margin-left: 20rpx;
  389. .service-section {
  390. margin-bottom: 30rpx;
  391. .section-title {
  392. display: flex;
  393. align-items: center;
  394. margin-bottom: 15rpx;
  395. .title-indicator {
  396. width: 6rpx;
  397. height: 30rpx;
  398. background-color: #FFAA48;
  399. margin-right: 15rpx;
  400. }
  401. text {
  402. font-size: 28rpx;
  403. color: #333;
  404. font-weight: bold;
  405. }
  406. .collapse-icon {
  407. margin-left: auto;
  408. font-size: 24rpx;
  409. color: #999;
  410. .arrow {
  411. transition: transform 0.3s;
  412. display: inline-block;
  413. }
  414. .arrow-up {
  415. transform: rotate(180deg);
  416. }
  417. }
  418. }
  419. .section-content {
  420. padding: 0 15rpx;
  421. background-color: #FFF9F0;
  422. }
  423. .date-content {
  424. background-color: #FFF9F0;
  425. padding: 20rpx;
  426. border-radius: 8rpx;
  427. font-size: 28rpx;
  428. color: #333;
  429. }
  430. .pet-list {
  431. padding: 15rpx;
  432. .pet-item {
  433. display: flex;
  434. margin-bottom: 20rpx;
  435. &:last-child {
  436. margin-bottom: 0;
  437. }
  438. .pet-avatar {
  439. width: 80rpx;
  440. height: 80rpx;
  441. border-radius: 50%;
  442. overflow: hidden;
  443. margin-right: 20rpx;
  444. .avatar-image {
  445. width: 100%;
  446. height: 100%;
  447. }
  448. }
  449. .pet-info {
  450. flex: 1;
  451. .pet-name {
  452. font-size: 28rpx;
  453. color: #333;
  454. margin-bottom: 8rpx;
  455. .pet-gender {
  456. display: inline-block;
  457. width: 32rpx;
  458. height: 32rpx;
  459. line-height: 32rpx;
  460. text-align: center;
  461. border-radius: 50%;
  462. color: #fff;
  463. font-size: 20rpx;
  464. margin-left: 10rpx;
  465. }
  466. .pet-gender-male {
  467. background-color: #4A90E2;
  468. }
  469. .pet-gender-female {
  470. background-color: #FF6B9A;
  471. }
  472. }
  473. .pet-description {
  474. font-size: 24rpx;
  475. color: #7D8196;
  476. }
  477. }
  478. }
  479. }
  480. .address-content {
  481. padding: 20rpx;
  482. border-radius: 8rpx;
  483. font-size: 28rpx;
  484. color: #7D8196;
  485. }
  486. }
  487. .action-buttons {
  488. display: flex;
  489. justify-content: space-between;
  490. gap: 20rpx;
  491. .btn {
  492. height: 80rpx;
  493. line-height: 80rpx;
  494. text-align: center;
  495. border-radius: 40rpx;
  496. font-size: 28rpx;
  497. flex: 1;
  498. }
  499. .btn-clock {
  500. background-color: #FFAA48;
  501. color: #fff;
  502. }
  503. .btn-pet-file, .btn-service-file {
  504. background-color: #F6F7FB;
  505. color: #333;
  506. border: 1px solid #E5E6EB;
  507. }
  508. }
  509. }
  510. }
  511. }
  512. </style>