refactor(icon): 替换NutIcon为IconFont组件并优化数据默认值处理
- 将所有页面中的NutIcon组件替换为IconFont组件 - 为API返回数据添加默认空数组处理 - 更新README文档说明项目功能和技术栈 - 修复部分页面样式问题
Showing
14 changed files
with
134 additions
and
80 deletions
| 1 | ## 项目介绍 | 1 | ## 项目介绍 |
| 2 | 2 | ||
| 3 | -基于Taro4的微信小程序模版,集成了常用的功能,如登录、注册、列表、详情、购物车等。 | 3 | +本项目是将原有H5预约系统迁移至微信小程序的实现。基于 Taro4 + Vue3 + NutUI 开发,保留了原有的功能和UI风格。 |
| 4 | + | ||
| 5 | +## 功能模块 | ||
| 6 | + | ||
| 7 | +1. **预约流程** | ||
| 8 | + * 日期与时间段选择 (`pages/booking/index`) | ||
| 9 | + * 预约信息确认与提交 (`pages/submit/index`) | ||
| 10 | + * 预约记录查看 (`pages/bookingList/index`) | ||
| 11 | + * 预约详情 (`pages/bookingDetail/index`) | ||
| 12 | + | ||
| 13 | +2. **参观者管理** | ||
| 14 | + * 参观者列表 (`pages/visitorList/index`) | ||
| 15 | + * 添加/编辑参观者 (`pages/addVisitor/index`) | ||
| 16 | + * 支持身份证号校验与脱敏显示 | ||
| 17 | + | ||
| 18 | +3. **个人中心** | ||
| 19 | + * 预约码展示 (`pages/bookingCode/index`) | ||
| 20 | + * 我的页面 (`pages/me/index`) | ||
| 21 | + * 邀请码/证件号查询 (`pages/search/index`) | ||
| 22 | + | ||
| 23 | +4. **公共功能** | ||
| 24 | + * 全局路由封装 (`hooks/useGo`) | ||
| 25 | + * API 请求封装 (`utils/request`, `api/index`) | ||
| 26 | + * 登录授权流程 (`pages/auth/index`) | ||
| 4 | 27 | ||
| 5 | ## 技术栈 | 28 | ## 技术栈 |
| 6 | 29 | ||
| 7 | -- Taro4 | 30 | +* **框架**: Taro 4.x |
| 8 | -- Vue3 | 31 | +* **UI库**: NutUI 4.x (Vue3) |
| 9 | -- TypeScript | 32 | +* **语言**: JavaScript (Vue3 Setup 语法糖) |
| 10 | -- Pinia | 33 | +* **样式**: Less + TailwindCSS (部分) |
| 11 | -- Less | 34 | +* **状态管理**: Pinia |
| 35 | +* **路由**: Taro Router + 自定义 Hooks | ||
| 12 | 36 | ||
| 13 | ## 项目结构 | 37 | ## 项目结构 |
| 14 | 38 | ||
| 15 | -- src | 39 | +* `src/api`: 接口定义 |
| 16 | - - api:请求接口 | 40 | +* `src/assets`: 图片等静态资源 |
| 17 | - - assets:静态资源 | 41 | +* `src/components`: 公共组件 (qrCode, qrCodeSearch, reserveCard等) |
| 18 | - - components:全局组件 | 42 | +* `src/pages`: 页面文件 |
| 19 | - - config:项目配置 | 43 | +* `src/hooks`: 组合式函数 (useGo等) |
| 20 | - - pages:页面 | 44 | +* `src/utils`: 工具函数 (request, tools等) |
| 21 | - - stores:状态管理 | ||
| 22 | - - utils:工具函数 | ||
| 23 | - - app.config.js:项目配置 | ||
| 24 | - - app.js:应用入口 | ||
| 25 | - - app.less:全局样式 | ||
| 26 | -- taro.config.js:Taro配置 | ||
| 27 | -- tsconfig.json:TypeScript配置 | ||
| 28 | -- package.json:依赖配置 | ||
| 29 | 45 | ||
| 30 | ## 项目运行 | 46 | ## 项目运行 |
| 31 | 47 | ||
| 32 | 1. 安装依赖 | 48 | 1. 安装依赖 |
| 49 | + ```bash | ||
| 50 | + pnpm install | ||
| 51 | + ``` | ||
| 33 | 52 | ||
| 34 | -```bash | 53 | +2. 运行开发环境 |
| 35 | -npm install | 54 | + ```bash |
| 36 | -``` | 55 | + pnpm dev:weapp |
| 37 | - | 56 | + ``` |
| 38 | -2. 运行项目 | ||
| 39 | 57 | ||
| 40 | -```bash | 58 | +3. 打包构建 |
| 41 | -npm run dev:weapp | 59 | + ```bash |
| 42 | -``` | 60 | + pnpm build:weapp |
| 61 | + ``` | ||
| 43 | 62 | ||
| 44 | -3. 打包项目 | 63 | +## 优化建议 (TODO) |
| 45 | 64 | ||
| 46 | -```bash | 65 | +* [ ] 小程序授权流程有问题 |
| 47 | -npm run build:weapp | 66 | +* [ ] 完善支付流程(目前为模拟/H5跳转) |
| 48 | -``` | 67 | +* [ ] 优化图片资源加载(考虑使用 CDN 或分包) |
| 68 | +* [ ] 增强网络请求的错误处理与重试机制 | ||
| 69 | +* [ ] 补充单元测试 | ... | ... |
| ... | @@ -14,7 +14,6 @@ declare module 'vue' { | ... | @@ -14,7 +14,6 @@ declare module 'vue' { |
| 14 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] | 14 | NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] |
| 15 | NutForm: typeof import('@nutui/nutui-taro')['Form'] | 15 | NutForm: typeof import('@nutui/nutui-taro')['Form'] |
| 16 | NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] | 16 | NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] |
| 17 | - NutIcon: typeof import('@nutui/nutui-taro')['Icon'] | ||
| 18 | NutInput: typeof import('@nutui/nutui-taro')['Input'] | 17 | NutInput: typeof import('@nutui/nutui-taro')['Input'] |
| 19 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] | 18 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] |
| 20 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] | 19 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-08-24 09:42:27 | 2 | * @Date: 2023-08-24 09:42:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-29 17:26:42 | 4 | + * @LastEditTime: 2026-01-06 21:08:32 |
| 5 | * @FilePath: /xyxBooking-weapp/src/api/index.js | 5 | * @FilePath: /xyxBooking-weapp/src/api/index.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -100,55 +100,64 @@ export const payCallbackAPI = (params) => fn(fetch.post(Api.PAY_CALLBACK, params | ... | @@ -100,55 +100,64 @@ export const payCallbackAPI = (params) => fn(fetch.post(Api.PAY_CALLBACK, params |
| 100 | export const billInfoAPI = (params) => fn(fetch.get(Api.BILL_INFO, params)); | 100 | export const billInfoAPI = (params) => fn(fetch.get(Api.BILL_INFO, params)); |
| 101 | 101 | ||
| 102 | /** | 102 | /** |
| 103 | - * @description: 扫码核销二维码列表 | 103 | + * @description: 预约单详情,参观者列表 - 免授权接口 |
| 104 | - * @returns | 104 | + * @param {String} pay_id 订单id |
| 105 | + * @returns {String} | ||
| 106 | + */ | ||
| 107 | +export const onAuthBillInfoAPI = (params) => fn(fetch.get(Api.ON_AUTH_BILL_INFO, params)); | ||
| 108 | + | ||
| 109 | +/** | ||
| 110 | + * @description: 预约码列表 | ||
| 111 | + * @returns {String} | ||
| 105 | */ | 112 | */ |
| 106 | export const qrcodeListAPI = (params) => fn(fetch.get(Api.QRCODE_LIST, params)); | 113 | export const qrcodeListAPI = (params) => fn(fetch.get(Api.QRCODE_LIST, params)); |
| 107 | 114 | ||
| 108 | /** | 115 | /** |
| 109 | - * @description: 扫码核销二维码状态 | 116 | + * @description: 二维码使用状态 |
| 110 | - * @returns | 117 | + * @param {String} qr_code 二维码编号 |
| 118 | + * @returns {String} status 二维码状态 1=未激活(未支付),3=待使用(已支付),5=被取消,7=已使用 | ||
| 111 | */ | 119 | */ |
| 112 | export const qrcodeStatusAPI = (params) => fn(fetch.get(Api.QRCODE_STATUS, params)); | 120 | export const qrcodeStatusAPI = (params) => fn(fetch.get(Api.QRCODE_STATUS, params)); |
| 113 | 121 | ||
| 114 | /** | 122 | /** |
| 115 | * @description: 预约单列表 | 123 | * @description: 预约单列表 |
| 116 | - * @returns | 124 | + * @param {String} |
| 125 | + * @returns {String} | ||
| 117 | */ | 126 | */ |
| 118 | export const billListAPI = (params) => fn(fetch.get(Api.BILL_LIST, params)); | 127 | export const billListAPI = (params) => fn(fetch.get(Api.BILL_LIST, params)); |
| 119 | 128 | ||
| 120 | /** | 129 | /** |
| 121 | - * @description: 退款 | 130 | + * @description: 取消预约 |
| 122 | - * @returns | 131 | + * @param {String} pay_id |
| 132 | + * @returns {String} | ||
| 123 | */ | 133 | */ |
| 124 | export const icbcRefundAPI = (params) => fn(fetch.post(Api.ICBC_REFUND, params)); | 134 | export const icbcRefundAPI = (params) => fn(fetch.post(Api.ICBC_REFUND, params)); |
| 125 | 135 | ||
| 126 | /** | 136 | /** |
| 127 | - * @description: 支付前准备(获取支付参数等) | 137 | + * @description: 预约单的参观者列表 |
| 128 | - * @returns | 138 | + * @param {String} |
| 139 | + * @returns {String} | ||
| 129 | */ | 140 | */ |
| 130 | -export const billPrepareAPI = (params) => fn(fetch.post(Api.BILL_PREPARE, params)); | 141 | +export const billPersonAPI = (params) => fn(fetch.get(Api.BILL_PREPARE, params)); |
| 131 | 142 | ||
| 132 | /** | 143 | /** |
| 133 | - * @description: 支付状态查询 | 144 | + * 接口废弃 |
| 134 | - * @returns | 145 | + * @description: 刷新预约单支付状态 |
| 146 | + * @param {String} | ||
| 147 | + * @returns {String} | ||
| 135 | */ | 148 | */ |
| 136 | export const billPayStatusAPI = (params) => fn(fetch.get(Api.BILL_PAY_STATUS, params)); | 149 | export const billPayStatusAPI = (params) => fn(fetch.get(Api.BILL_PAY_STATUS, params)); |
| 137 | 150 | ||
| 138 | /** | 151 | /** |
| 139 | - * @description: 证件号查询二维码 | 152 | + * @description: 身份证查询预约码 |
| 140 | - * @returns | 153 | + * @param {String} |
| 154 | + * @returns {String} | ||
| 141 | */ | 155 | */ |
| 142 | export const queryQrCodeAPI = (params) => fn(fetch.get(Api.QUERY_QR_CODE, params)); | 156 | export const queryQrCodeAPI = (params) => fn(fetch.get(Api.QUERY_QR_CODE, params)); |
| 143 | 157 | ||
| 144 | /** | 158 | /** |
| 145 | - * @description: 订单查询 | 159 | + * @description: 查询订单号 |
| 146 | - * @returns | 160 | + * @param {String} |
| 161 | + * @returns {String} | ||
| 147 | */ | 162 | */ |
| 148 | export const icbcOrderQryAPI = (params) => fn(fetch.get(Api.ICBC_ORDER_QRY, params)); | 163 | export const icbcOrderQryAPI = (params) => fn(fetch.get(Api.ICBC_ORDER_QRY, params)); |
| 149 | - | ||
| 150 | -/** | ||
| 151 | - * @description: 授权前订单详情查询 | ||
| 152 | - * @returns | ||
| 153 | - */ | ||
| 154 | -export const onAuthBillInfoAPI = (params) => fn(fetch.get(Api.ON_AUTH_BILL_INFO, params)); | ... | ... |
| ... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
| 15 | <view class="booking-num"> | 15 | <view class="booking-num"> |
| 16 | <view class="num-body van-ellipsis">预约人数:<text>{{ reserve_info.total_qty }} 人</text> <text>({{ reserve_info.person_name }})</text></view> | 16 | <view class="num-body van-ellipsis">预约人数:<text>{{ reserve_info.total_qty }} 人</text> <text>({{ reserve_info.person_name }})</text></view> |
| 17 | <view v-if="(reserve_info.status === CodeStatus.SUCCESS || reserve_info.status === CodeStatus.USED || reserve_info.status === CodeStatus.CANCEL)"> | 17 | <view v-if="(reserve_info.status === CodeStatus.SUCCESS || reserve_info.status === CodeStatus.USED || reserve_info.status === CodeStatus.CANCEL)"> |
| 18 | - <nut-icon name="rect-right" /> | 18 | + <IconFont name="rect-right" /> |
| 19 | </view> | 19 | </view> |
| 20 | </view> | 20 | </view> |
| 21 | <view class="booking-price">支付金额:<text>¥ {{ reserve_info.total_amt }}</text></view> | 21 | <view class="booking-price">支付金额:<text>¥ {{ reserve_info.total_amt }}</text></view> |
| ... | @@ -29,6 +29,7 @@ | ... | @@ -29,6 +29,7 @@ |
| 29 | 29 | ||
| 30 | <script setup> | 30 | <script setup> |
| 31 | import { computed } from 'vue' | 31 | import { computed } from 'vue' |
| 32 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 32 | import { useGo } from '@/hooks/useGo' | 33 | import { useGo } from '@/hooks/useGo' |
| 33 | 34 | ||
| 34 | const go = useGo(); | 35 | const go = useGo(); | ... | ... |
| ... | @@ -66,7 +66,7 @@ const formatId = (id) => replaceMiddleCharacters(id); | ... | @@ -66,7 +66,7 @@ const formatId = (id) => replaceMiddleCharacters(id); |
| 66 | const loadList = async () => { | 66 | const loadList = async () => { |
| 67 | const { code, data } = await personListAPI({}); | 67 | const { code, data } = await personListAPI({}); |
| 68 | if (code) { | 68 | if (code) { |
| 69 | - visitorList.value = data; | 69 | + visitorList.value = data || []; |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | 72 | ... | ... |
| ... | @@ -109,7 +109,7 @@ useDidShow(async () => { | ... | @@ -109,7 +109,7 @@ useDidShow(async () => { |
| 109 | const { code, data } = await canReserveDateListAPI({ month: `${raw_date.getFullYear()}-${(raw_date.getMonth() + 1).toString().padStart(2, '0')}` }); | 109 | const { code, data } = await canReserveDateListAPI({ month: `${raw_date.getFullYear()}-${(raw_date.getMonth() + 1).toString().padStart(2, '0')}` }); |
| 110 | if (code) { | 110 | if (code) { |
| 111 | // 日期列表 | 111 | // 日期列表 |
| 112 | - dates_list.value = data; | 112 | + dates_list.value = data || []; |
| 113 | // 今日之前都不可约 | 113 | // 今日之前都不可约 |
| 114 | dates_list.value.forEach((date) => { | 114 | dates_list.value.forEach((date) => { |
| 115 | if (dayjs(date.month_date).isBefore(dayjs())) { | 115 | if (dayjs(date.month_date).isBefore(dayjs())) { |
| ... | @@ -264,7 +264,7 @@ const onConfirm = async ({ selectedValue, selectedOptions }) => { // é€‰æ‹©æ—¥æœ | ... | @@ -264,7 +264,7 @@ const onConfirm = async ({ selectedValue, selectedOptions }) => { // é€‰æ‹©æ—¥æœ |
| 264 | const { code, data } = await canReserveDateListAPI({ month: `${year}-${month}` }); | 264 | const { code, data } = await canReserveDateListAPI({ month: `${year}-${month}` }); |
| 265 | if (code) { | 265 | if (code) { |
| 266 | // 日期列表 | 266 | // 日期列表 |
| 267 | - dates_list.value = data; | 267 | + dates_list.value = data || []; |
| 268 | // 今日之前都不可约 | 268 | // 今日之前都不可约 |
| 269 | dates_list.value.forEach((date) => { | 269 | dates_list.value.forEach((date) => { |
| 270 | if (dayjs(date.month_date).isBefore(dayjs())) { | 270 | if (dayjs(date.month_date).isBefore(dayjs())) { | ... | ... |
| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | <view style="padding: 1rem;"> | 10 | <view style="padding: 1rem;"> |
| 11 | <qrCode></qrCode> | 11 | <qrCode></qrCode> |
| 12 | <view class="warning"> | 12 | <view class="warning"> |
| 13 | - <view><nut-icon name="tips" /> 温馨提示</view> | 13 | + <view><IconFont name="tips" /> 温馨提示</view> |
| 14 | <view style="margin-top: 0.5rem;">一人一码,扫码或识别身份证成功后进入</view> | 14 | <view style="margin-top: 0.5rem;">一人一码,扫码或识别身份证成功后进入</view> |
| 15 | <view style="height: 8rem;"></view> | 15 | <view style="height: 8rem;"></view> |
| 16 | </view> | 16 | </view> |
| ... | @@ -36,6 +36,7 @@ | ... | @@ -36,6 +36,7 @@ |
| 36 | import { ref } from 'vue' | 36 | import { ref } from 'vue' |
| 37 | import Taro from '@tarojs/taro' | 37 | import Taro from '@tarojs/taro' |
| 38 | import qrCode from '@/components/qrCode'; | 38 | import qrCode from '@/components/qrCode'; |
| 39 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 39 | import icon_3 from '@/assets/images/首页01@2x.png' | 40 | import icon_3 from '@/assets/images/首页01@2x.png' |
| 40 | import icon_4 from '@/assets/images/二维码icon.png' | 41 | import icon_4 from '@/assets/images/二维码icon.png' |
| 41 | import icon_5 from '@/assets/images/我的01@2x.png' | 42 | import icon_5 from '@/assets/images/我的01@2x.png' | ... | ... |
| ... | @@ -47,18 +47,19 @@ const loadData = async (isRefresh = false) => { | ... | @@ -47,18 +47,19 @@ const loadData = async (isRefresh = false) => { |
| 47 | loading.value = false; | 47 | loading.value = false; |
| 48 | 48 | ||
| 49 | if (code) { | 49 | if (code) { |
| 50 | - data.forEach(item => { | 50 | + const list = data || []; |
| 51 | + list.forEach(item => { | ||
| 51 | item.booking_time = item && formatDatetime(item); | 52 | item.booking_time = item && formatDatetime(item); |
| 52 | item.order_time = item.created_time ? item.created_time.slice(0, -3) : ''; | 53 | item.order_time = item.created_time ? item.created_time.slice(0, -3) : ''; |
| 53 | }); | 54 | }); |
| 54 | 55 | ||
| 55 | if (isRefresh) { | 56 | if (isRefresh) { |
| 56 | - bookingList.value = data; | 57 | + bookingList.value = list; |
| 57 | } else { | 58 | } else { |
| 58 | - bookingList.value = bookingList.value.concat(data); | 59 | + bookingList.value = bookingList.value.concat(list); |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | - if (data.length < limit.value) { | 62 | + if (list.length < limit.value) { |
| 62 | finished.value = true; | 63 | finished.value = true; |
| 63 | } else { | 64 | } else { |
| 64 | page.value++; | 65 | page.value++; | ... | ... |
| ... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
| 6 | {{ item.name }} | 6 | {{ item.name }} |
| 7 | </view> | 7 | </view> |
| 8 | <view> | 8 | <view> |
| 9 | - <nut-icon name="rect-right" size="1.2rem" /> | 9 | + <IconFont name="rect-right" size="1.2rem" /> |
| 10 | </view> | 10 | </view> |
| 11 | </view> | 11 | </view> |
| 12 | <view class="index-nav"> | 12 | <view class="index-nav"> |
| ... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
| 30 | import { ref } from 'vue' | 30 | import { ref } from 'vue' |
| 31 | import Taro from '@tarojs/taro' | 31 | import Taro from '@tarojs/taro' |
| 32 | import { useGo } from '@/hooks/useGo' | 32 | import { useGo } from '@/hooks/useGo' |
| 33 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 33 | import icon_3 from '@/assets/images/首页01@2x.png' | 34 | import icon_3 from '@/assets/images/首页01@2x.png' |
| 34 | import icon_4 from '@/assets/images/二维码icon.png' | 35 | import icon_4 from '@/assets/images/二维码icon.png' |
| 35 | import icon_5 from '@/assets/images/我的02@2x.png' | 36 | import icon_5 from '@/assets/images/我的02@2x.png' | ... | ... |
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | </view> | 17 | </view> |
| 18 | <view style="color:#A67939; font-size: 0.95rem; text-align: center;"> | 18 | <view style="color:#A67939; font-size: 0.95rem; text-align: center;"> |
| 19 | <view> | 19 | <view> |
| 20 | - <nut-icon name="tips" /> 温馨提示 | 20 | + <IconFont name="tips" /> 温馨提示 |
| 21 | </view> | 21 | </view> |
| 22 | <view style="margin-top: 0.5rem;">获取参观码,扫码或识别身份证成功进闸机</view> | 22 | <view style="margin-top: 0.5rem;">获取参观码,扫码或识别身份证成功进闸机</view> |
| 23 | </view> | 23 | </view> |
| ... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
| 40 | <script setup> | 40 | <script setup> |
| 41 | import { ref } from 'vue' | 41 | import { ref } from 'vue' |
| 42 | import Taro from '@tarojs/taro' | 42 | import Taro from '@tarojs/taro' |
| 43 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 43 | import qrCodeSearch from '@/components/qrCodeSearch'; | 44 | import qrCodeSearch from '@/components/qrCodeSearch'; |
| 44 | import { useGo } from '@/hooks/useGo' | 45 | import { useGo } from '@/hooks/useGo' |
| 45 | 46 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 16:25:51 | 2 | * @Date: 2024-01-15 16:25:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-30 15:18:58 | 4 | + * @LastEditTime: 2026-01-06 21:22:54 |
| 5 | - * @FilePath: /xyxBooking-weapp/src/pages/submit/index.vue | 5 | + * @FilePath: /git/xyxBooking-weapp/src/pages/submit/index.vue |
| 6 | * @Description: 预约人员信息 | 6 | * @Description: 预约人员信息 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <view class="submit-page"> | 9 | <view class="submit-page"> |
| 10 | <view @tap="goToBooking" class="visit-time"> | 10 | <view @tap="goToBooking" class="visit-time"> |
| 11 | <view>参访时间</view> | 11 | <view>参访时间</view> |
| 12 | - <view><text style="font-size: 0.95rem;">{{ date }} {{ time }}</text> <nut-icon name="rect-right" /></view> | 12 | + <view><text style="font-size: 0.95rem;">{{ date }} {{ time }}</text> <IconFont name="rect-right" /></view> |
| 13 | </view> | 13 | </view> |
| 14 | <view @tap="goToVisitor" class="add-visitors"> | 14 | <view @tap="goToVisitor" class="add-visitors"> |
| 15 | - <view><nut-icon name="plus" /> 添加参观者</view> | 15 | + <view><IconFont name="plus" /> 添加参观者</view> |
| 16 | </view> | 16 | </view> |
| 17 | <view v-if="visitorList.length" class="visitors-list"> | 17 | <view v-if="visitorList.length" class="visitors-list"> |
| 18 | <view v-for="(item, index) in visitorList" :key="index" @tap="addVisitor(item)" class="visitor-item"> | 18 | <view v-for="(item, index) in visitorList" :key="index" @tap="addVisitor(item)" class="visitor-item"> |
| ... | @@ -49,6 +49,7 @@ | ... | @@ -49,6 +49,7 @@ |
| 49 | <script setup> | 49 | <script setup> |
| 50 | import { ref, computed } from 'vue' | 50 | import { ref, computed } from 'vue' |
| 51 | import Taro, { useDidShow, useRouter as useTaroRouter } from '@tarojs/taro' | 51 | import Taro, { useDidShow, useRouter as useTaroRouter } from '@tarojs/taro' |
| 52 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 52 | import { useGo } from '@/hooks/useGo' | 53 | import { useGo } from '@/hooks/useGo' |
| 53 | import icon_check1 from '@/assets/images/多选01@2x.png' | 54 | import icon_check1 from '@/assets/images/多选01@2x.png' |
| 54 | import icon_check2 from '@/assets/images/多选02@2x.png' | 55 | import icon_check2 from '@/assets/images/多选02@2x.png' |
| ... | @@ -172,7 +173,7 @@ useDidShow(async () => { | ... | @@ -172,7 +173,7 @@ useDidShow(async () => { |
| 172 | if (date.value && time.value) { | 173 | if (date.value && time.value) { |
| 173 | const { code, data } = await personListAPI({ reserve_date: date.value, begin_time: time.value.split('-')[0], end_time: time.value.split('-')[1] }); | 174 | const { code, data } = await personListAPI({ reserve_date: date.value, begin_time: time.value.split('-')[0], end_time: time.value.split('-')[1] }); |
| 174 | if (code) { | 175 | if (code) { |
| 175 | - visitorList.value = data; | 176 | + visitorList.value = data || []; |
| 176 | } | 177 | } |
| 177 | } | 178 | } |
| 178 | }); | 179 | }); | ... | ... |
| ... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
| 18 | <view class="payment-amount">支付金额:<text>¥ {{ billInfo?.total_amt }}</text></view> | 18 | <view class="payment-amount">支付金额:<text>¥ {{ billInfo?.total_amt }}</text></view> |
| 19 | </view> | 19 | </view> |
| 20 | <view class="appointment-notice"> | 20 | <view class="appointment-notice"> |
| 21 | - <view style="margin-bottom: 0.25rem;"><nut-icon name="tips" /> 温馨提示</view> | 21 | + <view style="margin-bottom: 0.25rem;"><IconFont name="tips" /> 温馨提示</view> |
| 22 | <view style="font-size: 0.85rem;">1. 一人一码,或拿身份证,扫码或识别身份证成功后进入</view> | 22 | <view style="font-size: 0.85rem;">1. 一人一码,或拿身份证,扫码或识别身份证成功后进入</view> |
| 23 | <view style="font-size: 0.85rem;">2. 若您无法按时参观,请提前在预约记录中取消您的预约</view> | 23 | <view style="font-size: 0.85rem;">2. 若您无法按时参观,请提前在预约记录中取消您的预约</view> |
| 24 | </view> | 24 | </view> |
| ... | @@ -33,6 +33,7 @@ | ... | @@ -33,6 +33,7 @@ |
| 33 | <script setup> | 33 | <script setup> |
| 34 | import { ref } from 'vue' | 34 | import { ref } from 'vue' |
| 35 | import Taro, { useDidShow, useRouter as useTaroRouter } from '@tarojs/taro' | 35 | import Taro, { useDidShow, useRouter as useTaroRouter } from '@tarojs/taro' |
| 36 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 36 | import { useGo } from '@/hooks/useGo' | 37 | import { useGo } from '@/hooks/useGo' |
| 37 | import { billInfoAPI } from '@/api/index' | 38 | import { billInfoAPI } from '@/api/index' |
| 38 | import { formatDatetime } from '@/utils/tools'; | 39 | import { formatDatetime } from '@/utils/tools'; | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | - <view class="me-page"> | 2 | + <view class="visitor-list-page"> |
| 3 | - <view class="me-content"> | 3 | + <view class="visitor-content"> |
| 4 | <view class="title"> | 4 | <view class="title"> |
| 5 | <view class="text">参观者信息</view> | 5 | <view class="text">参观者信息</view> |
| 6 | </view> | 6 | </view> |
| 7 | <view @tap="() => { go('/pages/addVisitor/index') }" class="add-visitors"> | 7 | <view @tap="() => { go('/pages/addVisitor/index') }" class="add-visitors"> |
| 8 | - <view><nut-icon name="plus" /> 添加参观者</view> | 8 | + <view class="add-btn"><IconFont name="plus" /> 添加参观者</view> |
| 9 | </view> | 9 | </view> |
| 10 | <view v-if="visitorList.length" class="visitors-list"> | 10 | <view v-if="visitorList.length" class="visitors-list"> |
| 11 | <view v-for="(item, index) in visitorList" :key="index" class="visitor-item"> | 11 | <view v-for="(item, index) in visitorList" :key="index" class="visitor-item"> |
| ... | @@ -44,6 +44,7 @@ | ... | @@ -44,6 +44,7 @@ |
| 44 | <script setup> | 44 | <script setup> |
| 45 | import { ref } from 'vue' | 45 | import { ref } from 'vue' |
| 46 | import Taro, { useDidShow } from '@tarojs/taro' | 46 | import Taro, { useDidShow } from '@tarojs/taro' |
| 47 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 47 | import { useGo } from '@/hooks/useGo' | 48 | import { useGo } from '@/hooks/useGo' |
| 48 | import { personListAPI, delPersonAPI } from '@/api/index' | 49 | import { personListAPI, delPersonAPI } from '@/api/index' |
| 49 | import icon_3 from '@/assets/images/首页01@2x.png' | 50 | import icon_3 from '@/assets/images/首页01@2x.png' |
| ... | @@ -77,15 +78,21 @@ function replaceMiddleCharacters(inputString) { | ... | @@ -77,15 +78,21 @@ function replaceMiddleCharacters(inputString) { |
| 77 | const formatId = (id) => replaceMiddleCharacters(id); | 78 | const formatId = (id) => replaceMiddleCharacters(id); |
| 78 | 79 | ||
| 79 | const loadList = async () => { | 80 | const loadList = async () => { |
| 81 | + try { | ||
| 80 | const { code, data } = await personListAPI({}); | 82 | const { code, data } = await personListAPI({}); |
| 81 | if (code) { | 83 | if (code) { |
| 82 | - visitorList.value = data; | 84 | + visitorList.value = data || []; |
| 85 | + } | ||
| 86 | + } catch (err) { | ||
| 87 | + console.error(err); | ||
| 88 | + Taro.showToast({ title: '加载失败', icon: 'none' }); | ||
| 83 | } | 89 | } |
| 84 | } | 90 | } |
| 85 | 91 | ||
| 86 | const removeItem = async (item) => { | 92 | const removeItem = async (item) => { |
| 87 | const { confirm } = await Taro.showModal({ title: '提示', content: '确定删除该参观者吗?' }); | 93 | const { confirm } = await Taro.showModal({ title: '提示', content: '确定删除该参观者吗?' }); |
| 88 | if (confirm) { | 94 | if (confirm) { |
| 95 | + try { | ||
| 89 | const { code, msg } = await delPersonAPI({ person_id: item.id }); | 96 | const { code, msg } = await delPersonAPI({ person_id: item.id }); |
| 90 | if (code) { | 97 | if (code) { |
| 91 | Taro.showToast({ title: '删除成功' }); | 98 | Taro.showToast({ title: '删除成功' }); |
| ... | @@ -93,6 +100,10 @@ const removeItem = async (item) => { | ... | @@ -93,6 +100,10 @@ const removeItem = async (item) => { |
| 93 | } else { | 100 | } else { |
| 94 | Taro.showToast({ title: msg || '删除失败', icon: 'none' }); | 101 | Taro.showToast({ title: msg || '删除失败', icon: 'none' }); |
| 95 | } | 102 | } |
| 103 | + } catch (error) { | ||
| 104 | + console.error(error); | ||
| 105 | + Taro.showToast({ title: '删除出错', icon: 'none' }); | ||
| 106 | + } | ||
| 96 | } | 107 | } |
| 97 | } | 108 | } |
| 98 | 109 | ||
| ... | @@ -102,12 +113,12 @@ useDidShow(() => { | ... | @@ -102,12 +113,12 @@ useDidShow(() => { |
| 102 | </script> | 113 | </script> |
| 103 | 114 | ||
| 104 | <style lang="less"> | 115 | <style lang="less"> |
| 105 | -.me-page { | 116 | +.visitor-list-page { |
| 106 | min-height: 100vh; | 117 | min-height: 100vh; |
| 107 | background-color: #F6F6F6; | 118 | background-color: #F6F6F6; |
| 108 | padding: 1rem; | 119 | padding: 1rem; |
| 109 | 120 | ||
| 110 | - .me-content { | 121 | + .visitor-content { |
| 111 | .title { | 122 | .title { |
| 112 | .text { | 123 | .text { |
| 113 | font-size: 1.1rem; | 124 | font-size: 1.1rem; |
| ... | @@ -126,6 +137,11 @@ useDidShow(() => { | ... | @@ -126,6 +137,11 @@ useDidShow(() => { |
| 126 | padding: .65rem 0; | 137 | padding: .65rem 0; |
| 127 | margin: 1rem 0; | 138 | margin: 1rem 0; |
| 128 | font-size: 1.15rem; | 139 | font-size: 1.15rem; |
| 140 | + .add-btn { | ||
| 141 | + display: flex; | ||
| 142 | + align-items: center; | ||
| 143 | + justify-content: center; | ||
| 144 | + } | ||
| 129 | } | 145 | } |
| 130 | 146 | ||
| 131 | .visitors-list { | 147 | .visitors-list { |
| ... | @@ -171,6 +187,7 @@ useDidShow(() => { | ... | @@ -171,6 +187,7 @@ useDidShow(() => { |
| 171 | display: flex; | 187 | display: flex; |
| 172 | flex-direction: column; | 188 | flex-direction: column; |
| 173 | align-items: center; | 189 | align-items: center; |
| 190 | + font-size: 0.8rem; | ||
| 174 | } | 191 | } |
| 175 | } | 192 | } |
| 176 | } | 193 | } | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | <view class="waiting-page"> | 2 | <view class="waiting-page"> |
| 3 | <view class="waiting-content"> | 3 | <view class="waiting-content"> |
| 4 | <view> | 4 | <view> |
| 5 | - <nut-icon name="clock" size="40" color="#A67939" /> | 5 | + <IconFont name="clock" size="40" color="#A67939" /> |
| 6 | </view> | 6 | </view> |
| 7 | <view style="margin: 1rem 0;">支付中</view> | 7 | <view style="margin: 1rem 0;">支付中</view> |
| 8 | <view>{{ current.seconds }} s</view> | 8 | <view>{{ current.seconds }} s</view> |
| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | <script setup> | 19 | <script setup> |
| 20 | import { ref, onMounted, onUnmounted } from 'vue' | 20 | import { ref, onMounted, onUnmounted } from 'vue' |
| 21 | import Taro, { useRouter } from '@tarojs/taro' | 21 | import Taro, { useRouter } from '@tarojs/taro' |
| 22 | +import { IconFont } from '@nutui/icons-vue-taro' | ||
| 22 | import { billPayStatusAPI } from '@/api/index' | 23 | import { billPayStatusAPI } from '@/api/index' |
| 23 | import { useGo } from '@/hooks/useGo' | 24 | import { useGo } from '@/hooks/useGo' |
| 24 | 25 | ... | ... |
-
Please register or login to post a comment