refactor(icon): 替换NutIcon为IconFont组件并优化数据默认值处理
- 将所有页面中的NutIcon组件替换为IconFont组件 - 为API返回数据添加默认空数组处理 - 更新README文档说明项目功能和技术栈 - 修复部分页面样式问题
Showing
14 changed files
with
206 additions
and
152 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. 安装依赖 |
| 33 | - | 49 | + ```bash |
| 34 | -```bash | 50 | + pnpm install |
| 35 | -npm install | 51 | + ``` |
| 36 | -``` | ||
| 37 | 52 | ||
| 38 | -2. 运行项目 | 53 | +2. 运行开发环境 |
| 54 | + ```bash | ||
| 55 | + pnpm dev:weapp | ||
| 56 | + ``` | ||
| 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(); |
| ... | @@ -109,7 +110,7 @@ const goToDetail = (item) => { | ... | @@ -109,7 +110,7 @@ const goToDetail = (item) => { |
| 109 | padding: 1rem; | 110 | padding: 1rem; |
| 110 | margin-bottom: 1rem; | 111 | margin-bottom: 1rem; |
| 111 | box-shadow: 0rem 0rem 0.92rem 0rem rgba(106,106,106,0.1); | 112 | box-shadow: 0rem 0rem 0.92rem 0rem rgba(106,106,106,0.1); |
| 112 | - | 113 | + |
| 113 | .booking-list-item-header { | 114 | .booking-list-item-header { |
| 114 | display: flex; | 115 | display: flex; |
| 115 | justify-content: space-between; | 116 | justify-content: space-between; |
| ... | @@ -120,13 +121,13 @@ const goToDetail = (item) => { | ... | @@ -120,13 +121,13 @@ const goToDetail = (item) => { |
| 120 | font-size: 1rem; | 121 | font-size: 1rem; |
| 121 | font-weight: bold; | 122 | font-weight: bold; |
| 122 | color: #333; | 123 | color: #333; |
| 123 | - | 124 | + |
| 124 | .status { | 125 | .status { |
| 125 | font-size: 0.85rem; | 126 | font-size: 0.85rem; |
| 126 | font-weight: normal; | 127 | font-weight: normal; |
| 127 | padding: 2px 6px; | 128 | padding: 2px 6px; |
| 128 | border-radius: 4px; | 129 | border-radius: 4px; |
| 129 | - | 130 | + |
| 130 | &.success { | 131 | &.success { |
| 131 | color: #A67939; | 132 | color: #A67939; |
| 132 | background-color: #FBEEDC; | 133 | background-color: #FBEEDC; |
| ... | @@ -141,7 +142,7 @@ const goToDetail = (item) => { | ... | @@ -141,7 +142,7 @@ const goToDetail = (item) => { |
| 141 | } | 142 | } |
| 142 | } | 143 | } |
| 143 | } | 144 | } |
| 144 | - | 145 | + |
| 145 | .booking-list-item-body { | 146 | .booking-list-item-body { |
| 146 | .booking-num { | 147 | .booking-num { |
| 147 | display: flex; | 148 | display: flex; |
| ... | @@ -149,7 +150,7 @@ const goToDetail = (item) => { | ... | @@ -149,7 +150,7 @@ const goToDetail = (item) => { |
| 149 | align-items: center; | 150 | align-items: center; |
| 150 | margin-bottom: 0.5rem; | 151 | margin-bottom: 0.5rem; |
| 151 | color: #666; | 152 | color: #666; |
| 152 | - | 153 | + |
| 153 | .num-body { | 154 | .num-body { |
| 154 | span, text { | 155 | span, text { |
| 155 | color: #A67939; | 156 | color: #A67939; | ... | ... |
| ... | @@ -18,11 +18,11 @@ | ... | @@ -18,11 +18,11 @@ |
| 18 | <nut-input v-model="id_number" placeholder="请输入参观者证件号" type="idcard" /> | 18 | <nut-input v-model="id_number" placeholder="请输入参观者证件号" type="idcard" /> |
| 19 | </nut-form-item> | 19 | </nut-form-item> |
| 20 | </nut-form> | 20 | </nut-form> |
| 21 | - | 21 | + |
| 22 | <view style="padding: 1rem;"> | 22 | <view style="padding: 1rem;"> |
| 23 | <nut-button type="primary" block color="#A67939" @click="save">保存</nut-button> | 23 | <nut-button type="primary" block color="#A67939" @click="save">保存</nut-button> |
| 24 | </view> | 24 | </view> |
| 25 | - | 25 | + |
| 26 | <view v-if="visitorList.length" class="history-list"> | 26 | <view v-if="visitorList.length" class="history-list"> |
| 27 | <view class="title">历史参观者</view> | 27 | <view class="title">历史参观者</view> |
| 28 | <view v-for="(item, index) in visitorList" :key="index" class="item"> | 28 | <view v-for="(item, index) in visitorList" :key="index" class="item"> |
| ... | @@ -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 | ||
| ... | @@ -79,7 +79,7 @@ const save = async () => { | ... | @@ -79,7 +79,7 @@ const save = async () => { |
| 79 | Taro.showToast({ title: '请输入正确的身份证号', icon: 'none' }); | 79 | Taro.showToast({ title: '请输入正确的身份证号', icon: 'none' }); |
| 80 | return; | 80 | return; |
| 81 | } | 81 | } |
| 82 | - | 82 | + |
| 83 | Taro.showLoading({ title: '保存中' }); | 83 | Taro.showLoading({ title: '保存中' }); |
| 84 | const { code, msg } = await addPersonAPI({ | 84 | const { code, msg } = await addPersonAPI({ |
| 85 | name: name.value, | 85 | name: name.value, |
| ... | @@ -87,7 +87,7 @@ const save = async () => { | ... | @@ -87,7 +87,7 @@ const save = async () => { |
| 87 | id_number: id_number.value | 87 | id_number: id_number.value |
| 88 | }); | 88 | }); |
| 89 | Taro.hideLoading(); | 89 | Taro.hideLoading(); |
| 90 | - | 90 | + |
| 91 | if (code) { | 91 | if (code) { |
| 92 | Taro.showToast({ title: '添加成功' }); | 92 | Taro.showToast({ title: '添加成功' }); |
| 93 | name.value = ''; | 93 | name.value = ''; |
| ... | @@ -123,12 +123,12 @@ useDidShow(() => { | ... | @@ -123,12 +123,12 @@ useDidShow(() => { |
| 123 | min-height: 100vh; | 123 | min-height: 100vh; |
| 124 | background-color: #F6F6F6; | 124 | background-color: #F6F6F6; |
| 125 | padding-top: 1px; | 125 | padding-top: 1px; |
| 126 | - | 126 | + |
| 127 | .history-list { | 127 | .history-list { |
| 128 | margin-top: 1rem; | 128 | margin-top: 1rem; |
| 129 | background-color: #FFF; | 129 | background-color: #FFF; |
| 130 | padding: 1rem; | 130 | padding: 1rem; |
| 131 | - | 131 | + |
| 132 | .title { | 132 | .title { |
| 133 | font-size: 1rem; | 133 | font-size: 1rem; |
| 134 | color: #333; | 134 | color: #333; |
| ... | @@ -136,18 +136,18 @@ useDidShow(() => { | ... | @@ -136,18 +136,18 @@ useDidShow(() => { |
| 136 | border-left: 3px solid #A67939; | 136 | border-left: 3px solid #A67939; |
| 137 | padding-left: 0.5rem; | 137 | padding-left: 0.5rem; |
| 138 | } | 138 | } |
| 139 | - | 139 | + |
| 140 | .item { | 140 | .item { |
| 141 | display: flex; | 141 | display: flex; |
| 142 | justify-content: space-between; | 142 | justify-content: space-between; |
| 143 | align-items: center; | 143 | align-items: center; |
| 144 | padding: 1rem 0; | 144 | padding: 1rem 0; |
| 145 | border-bottom: 1px solid #EEE; | 145 | border-bottom: 1px solid #EEE; |
| 146 | - | 146 | + |
| 147 | &:last-child { | 147 | &:last-child { |
| 148 | border-bottom: none; | 148 | border-bottom: none; |
| 149 | } | 149 | } |
| 150 | - | 150 | + |
| 151 | .info { | 151 | .info { |
| 152 | .name { | 152 | .name { |
| 153 | font-size: 1rem; | 153 | font-size: 1rem; |
| ... | @@ -159,7 +159,7 @@ useDidShow(() => { | ... | @@ -159,7 +159,7 @@ useDidShow(() => { |
| 159 | color: #999; | 159 | color: #999; |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | - | 162 | + |
| 163 | .action { | 163 | .action { |
| 164 | color: #FF0000; | 164 | color: #FF0000; |
| 165 | font-size: 0.9rem; | 165 | font-size: 0.9rem; | ... | ... |
| ... | @@ -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())) { |
| ... | @@ -250,12 +250,12 @@ const onConfirm = async ({ selectedValue, selectedOptions }) => { // é€‰æ‹©æ—¥æœ | ... | @@ -250,12 +250,12 @@ const onConfirm = async ({ selectedValue, selectedOptions }) => { // é€‰æ‹©æ—¥æœ |
| 250 | // selectedOptions 是选项对象数组 | 250 | // selectedOptions 是选项对象数组 |
| 251 | // year-month 模式下 selectedValue 可能是 [year, month] | 251 | // year-month 模式下 selectedValue 可能是 [year, month] |
| 252 | // 实际上 NutUI DatePicker confirm 事件参数:{ selectedValue, selectedOptions } | 252 | // 实际上 NutUI DatePicker confirm 事件参数:{ selectedValue, selectedOptions } |
| 253 | - | 253 | + |
| 254 | showPicker.value = false; | 254 | showPicker.value = false; |
| 255 | // selectedValue: ['2024', '02'] | 255 | // selectedValue: ['2024', '02'] |
| 256 | const [year, month] = selectedValue; | 256 | const [year, month] = selectedValue; |
| 257 | currentDateText.value = month; | 257 | currentDateText.value = month; |
| 258 | - | 258 | + |
| 259 | // 清空选择 | 259 | // 清空选择 |
| 260 | checked_day.value = ''; | 260 | checked_day.value = ''; |
| 261 | checked_time.value = -1; | 261 | checked_time.value = -1; |
| ... | @@ -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' | ... | ... |
| ... | @@ -10,10 +10,10 @@ | ... | @@ -10,10 +10,10 @@ |
| 10 | <view v-for="(item, index) in bookingList" :key="index"> | 10 | <view v-for="(item, index) in bookingList" :key="index"> |
| 11 | <reserveCard :data="item" /> | 11 | <reserveCard :data="item" /> |
| 12 | </view> | 12 | </view> |
| 13 | - | 13 | + |
| 14 | <view v-if="loading" style="text-align: center; color: #999; padding: 10px;">加载中...</view> | 14 | <view v-if="loading" style="text-align: center; color: #999; padding: 10px;">加载中...</view> |
| 15 | <view v-if="finished && bookingList.length > 0" style="text-align: center; color: #999; padding: 10px;">没有更多了</view> | 15 | <view v-if="finished && bookingList.length > 0" style="text-align: center; color: #999; padding: 10px;">没有更多了</view> |
| 16 | - | 16 | + |
| 17 | <view v-if="!bookingList.length && finished" class="no-qrcode"> | 17 | <view v-if="!bookingList.length && finished" class="no-qrcode"> |
| 18 | <image src="https://cdn.ipadbiz.cn/xys/booking/%E6%9A%82%E6%97%A0@2x.png" style="width: 10rem; height: 10rem;" /> | 18 | <image src="https://cdn.ipadbiz.cn/xys/booking/%E6%9A%82%E6%97%A0@2x.png" style="width: 10rem; height: 10rem;" /> |
| 19 | <view class="no-qrcode-title">您还没有预约过参观</view> | 19 | <view class="no-qrcode-title">您还没有预约过参观</view> |
| ... | @@ -36,29 +36,30 @@ const finished = ref(false); | ... | @@ -36,29 +36,30 @@ const finished = ref(false); |
| 36 | 36 | ||
| 37 | const loadData = async (isRefresh = false) => { | 37 | const loadData = async (isRefresh = false) => { |
| 38 | if (loading.value || (finished.value && !isRefresh)) return; | 38 | if (loading.value || (finished.value && !isRefresh)) return; |
| 39 | - | 39 | + |
| 40 | loading.value = true; | 40 | loading.value = true; |
| 41 | if (isRefresh) { | 41 | if (isRefresh) { |
| 42 | page.value = 1; | 42 | page.value = 1; |
| 43 | finished.value = false; | 43 | finished.value = false; |
| 44 | } | 44 | } |
| 45 | - | 45 | + |
| 46 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); | 46 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); |
| 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++; |
| ... | @@ -80,14 +81,14 @@ useReachBottom(() => { | ... | @@ -80,14 +81,14 @@ useReachBottom(() => { |
| 80 | padding: 1rem; | 81 | padding: 1rem; |
| 81 | min-height: 100vh; | 82 | min-height: 100vh; |
| 82 | background-color: #F6F6F6; | 83 | background-color: #F6F6F6; |
| 83 | - | 84 | + |
| 84 | .no-qrcode { | 85 | .no-qrcode { |
| 85 | display: flex; | 86 | display: flex; |
| 86 | justify-content: center; | 87 | justify-content: center; |
| 87 | align-items: center; | 88 | align-items: center; |
| 88 | flex-direction: column; | 89 | flex-direction: column; |
| 89 | padding-top: 5rem; | 90 | padding-top: 5rem; |
| 90 | - | 91 | + |
| 91 | .no-qrcode-title { | 92 | .no-qrcode-title { |
| 92 | color: #A67939; | 93 | color: #A67939; |
| 93 | font-size: 1.05rem; | 94 | font-size: 1.05rem; | ... | ... |
| ... | @@ -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 | ||
| ... | @@ -87,13 +88,13 @@ const goToHome = () => { | ... | @@ -87,13 +88,13 @@ const goToHome = () => { |
| 87 | padding: 1rem; | 88 | padding: 1rem; |
| 88 | min-height: 100vh; | 89 | min-height: 100vh; |
| 89 | background-color: #F6F6F6; | 90 | background-color: #F6F6F6; |
| 90 | - | 91 | + |
| 91 | .input-item { | 92 | .input-item { |
| 92 | background-color: #FFF; | 93 | background-color: #FFF; |
| 93 | padding: 1rem; | 94 | padding: 1rem; |
| 94 | border-radius: 8px; | 95 | border-radius: 8px; |
| 95 | margin-bottom: 1rem; | 96 | margin-bottom: 1rem; |
| 96 | - | 97 | + |
| 97 | view:first-child { | 98 | view:first-child { |
| 98 | margin-bottom: 0.5rem; | 99 | margin-bottom: 0.5rem; |
| 99 | font-weight: bold; | 100 | font-weight: bold; |
| ... | @@ -103,7 +104,7 @@ const goToHome = () => { | ... | @@ -103,7 +104,7 @@ const goToHome = () => { |
| 103 | padding: 0.5rem 0; | 104 | padding: 0.5rem 0; |
| 104 | } | 105 | } |
| 105 | } | 106 | } |
| 106 | - | 107 | + |
| 107 | .save-wrapper { | 108 | .save-wrapper { |
| 108 | margin-top: 2rem; | 109 | margin-top: 2rem; |
| 109 | .save-btn { | 110 | .save-btn { |
| ... | @@ -115,7 +116,7 @@ const goToHome = () => { | ... | @@ -115,7 +116,7 @@ const goToHome = () => { |
| 115 | font-size: 1.1rem; | 116 | font-size: 1.1rem; |
| 116 | } | 117 | } |
| 117 | } | 118 | } |
| 118 | - | 119 | + |
| 119 | .success-btn { | 120 | .success-btn { |
| 120 | position: fixed; | 121 | position: fixed; |
| 121 | bottom: 2rem; | 122 | bottom: 2rem; |
| ... | @@ -123,7 +124,7 @@ const goToHome = () => { | ... | @@ -123,7 +124,7 @@ const goToHome = () => { |
| 123 | left: 0; | 124 | left: 0; |
| 124 | display: flex; | 125 | display: flex; |
| 125 | justify-content: space-around; | 126 | justify-content: space-around; |
| 126 | - | 127 | + |
| 127 | .btn-item { | 128 | .btn-item { |
| 128 | width: 40%; | 129 | width: 40%; |
| 129 | text-align: center; | 130 | text-align: center; |
| ... | @@ -131,19 +132,19 @@ const goToHome = () => { | ... | @@ -131,19 +132,19 @@ const goToHome = () => { |
| 131 | border-radius: 8px; | 132 | border-radius: 8px; |
| 132 | font-size: 1.1rem; | 133 | font-size: 1.1rem; |
| 133 | } | 134 | } |
| 134 | - | 135 | + |
| 135 | .btn-left { | 136 | .btn-left { |
| 136 | border: 1px solid #A67939; | 137 | border: 1px solid #A67939; |
| 137 | color: #A67939; | 138 | color: #A67939; |
| 138 | background-color: #FFF; | 139 | background-color: #FFF; |
| 139 | } | 140 | } |
| 140 | - | 141 | + |
| 141 | .btn-right { | 142 | .btn-right { |
| 142 | background-color: #A67939; | 143 | background-color: #A67939; |
| 143 | color: #FFF; | 144 | color: #FFF; |
| 144 | } | 145 | } |
| 145 | } | 146 | } |
| 146 | - | 147 | + |
| 147 | .logo { | 148 | .logo { |
| 148 | position: absolute; | 149 | position: absolute; |
| 149 | right: 0; | 150 | right: 0; | ... | ... |
| 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"> |
| 19 | <view style="margin-right: 1rem;"> | 19 | <view style="margin-right: 1rem;"> |
| 20 | <image v-if="!checked_visitors.includes(item.id)" :src="icon_check1" style="width: 1.2rem; height: 1.2rem;" /> | 20 | <image v-if="!checked_visitors.includes(item.id)" :src="icon_check1" style="width: 1.2rem; height: 1.2rem;" /> |
| 21 | <image v-else :src="icon_check2" style="width: 1.2rem; height: 1.2rem;" /> | 21 | <image v-else :src="icon_check2" style="width: 1.2rem; height: 1.2rem;" /> |
| ... | @@ -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' |
| ... | @@ -118,24 +119,24 @@ const submitBtn = async () => { | ... | @@ -118,24 +119,24 @@ const submitBtn = async () => { |
| 118 | } else { | 119 | } else { |
| 119 | // TAG: 提交订单跳转到支付页面 | 120 | // TAG: 提交订单跳转到支付页面 |
| 120 | Taro.showLoading({ title: '提交中...' }); | 121 | Taro.showLoading({ title: '提交中...' }); |
| 121 | - const { code, data } = await addReserveAPI({ | 122 | + const { code, data } = await addReserveAPI({ |
| 122 | - reserve_date: date.value, | 123 | + reserve_date: date.value, |
| 123 | - begin_time: time.value.split('-')[0], | 124 | + begin_time: time.value.split('-')[0], |
| 124 | - end_time: time.value.split('-')[1], | 125 | + end_time: time.value.split('-')[1], |
| 125 | - person_id_list: JSON.stringify(checked_visitors.value) | 126 | + person_id_list: JSON.stringify(checked_visitors.value) |
| 126 | }); | 127 | }); |
| 127 | - | 128 | + |
| 128 | Taro.hideLoading(); | 129 | Taro.hideLoading(); |
| 129 | - | 130 | + |
| 130 | if (code) { | 131 | if (code) { |
| 131 | // H5 逻辑: const pay_url = `/srv/?f=reserve&a=icbc_pay&pay_id=${data.pay_id}`; location.href = pay_url; | 132 | // H5 逻辑: const pay_url = `/srv/?f=reserve&a=icbc_pay&pay_id=${data.pay_id}`; location.href = pay_url; |
| 132 | - // 小程序逻辑: | 133 | + // 小程序逻辑: |
| 133 | // 1. 如果支持小程序支付,应该调用获取支付参数接口 | 134 | // 1. 如果支持小程序支付,应该调用获取支付参数接口 |
| 134 | // 2. 暂时提示不支持,或尝试模拟 | 135 | // 2. 暂时提示不支持,或尝试模拟 |
| 135 | - | 136 | + |
| 136 | // 假设 payPrepareAPI 可用 | 137 | // 假设 payPrepareAPI 可用 |
| 137 | // const payParams = await payPrepareAPI({ bill_id: data.pay_id }); // 假设接口 | 138 | // const payParams = await payPrepareAPI({ bill_id: data.pay_id }); // 假设接口 |
| 138 | - | 139 | + |
| 139 | Taro.showModal({ | 140 | Taro.showModal({ |
| 140 | title: '提示', | 141 | title: '提示', |
| 141 | content: '订单提交成功。由于小程序支付暂未配置,请联系管理员或前往H5完成支付。', | 142 | content: '订单提交成功。由于小程序支付暂未配置,请联系管理员或前往H5完成支付。', |
| ... | @@ -144,7 +145,7 @@ const submitBtn = async () => { | ... | @@ -144,7 +145,7 @@ const submitBtn = async () => { |
| 144 | go('/bookingList'); | 145 | go('/bookingList'); |
| 145 | } | 146 | } |
| 146 | }); | 147 | }); |
| 147 | - | 148 | + |
| 148 | // 如果后端有返回支付参数,可以使用 requestPayment | 149 | // 如果后端有返回支付参数,可以使用 requestPayment |
| 149 | /* | 150 | /* |
| 150 | Taro.requestPayment({ | 151 | Taro.requestPayment({ |
| ... | @@ -153,7 +154,7 @@ const submitBtn = async () => { | ... | @@ -153,7 +154,7 @@ const submitBtn = async () => { |
| 153 | package: '', | 154 | package: '', |
| 154 | signType: 'MD5', | 155 | signType: 'MD5', |
| 155 | paySign: '', | 156 | paySign: '', |
| 156 | - success (res) { | 157 | + success (res) { |
| 157 | go('/success'); | 158 | go('/success'); |
| 158 | }, | 159 | }, |
| 159 | fail (res) { } | 160 | fail (res) { } |
| ... | @@ -168,11 +169,11 @@ useDidShow(async () => { | ... | @@ -168,11 +169,11 @@ useDidShow(async () => { |
| 168 | date.value = params.date || ''; | 169 | date.value = params.date || ''; |
| 169 | time.value = params.time || ''; | 170 | time.value = params.time || ''; |
| 170 | price.value = params.price || 0; | 171 | price.value = params.price || 0; |
| 171 | - | 172 | + |
| 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 | }); |
| ... | @@ -235,7 +236,7 @@ useDidShow(async () => { | ... | @@ -235,7 +236,7 @@ useDidShow(async () => { |
| 235 | justify-content: space-between; | 236 | justify-content: space-between; |
| 236 | flex-direction: column; | 237 | flex-direction: column; |
| 237 | box-shadow: 0rem -0.33rem 0.25rem 0rem rgba(0,0,0,0.12); | 238 | box-shadow: 0rem -0.33rem 0.25rem 0rem rgba(0,0,0,0.12); |
| 238 | - | 239 | + |
| 239 | .control-wrapper { | 240 | .control-wrapper { |
| 240 | display: flex; | 241 | display: flex; |
| 241 | justify-content: space-between; | 242 | justify-content: space-between; | ... | ... |
| ... | @@ -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'; |
| ... | @@ -64,7 +65,7 @@ useDidShow(async () => { | ... | @@ -64,7 +65,7 @@ useDidShow(async () => { |
| 64 | position: relative; | 65 | position: relative; |
| 65 | background-color: #FFF; | 66 | background-color: #FFF; |
| 66 | min-height: 100vh; | 67 | min-height: 100vh; |
| 67 | - | 68 | + |
| 68 | .text-prompts { | 69 | .text-prompts { |
| 69 | display: flex; | 70 | display: flex; |
| 70 | align-items: center; | 71 | align-items: center; |
| ... | @@ -100,19 +101,19 @@ useDidShow(async () => { | ... | @@ -100,19 +101,19 @@ useDidShow(async () => { |
| 100 | } | 101 | } |
| 101 | } | 102 | } |
| 102 | } | 103 | } |
| 103 | - | 104 | + |
| 104 | .appointment-notice { | 105 | .appointment-notice { |
| 105 | padding: 1rem; | 106 | padding: 1rem; |
| 106 | color: #666; | 107 | color: #666; |
| 107 | } | 108 | } |
| 108 | - | 109 | + |
| 109 | .success-btn { | 110 | .success-btn { |
| 110 | position: fixed; | 111 | position: fixed; |
| 111 | bottom: 2rem; | 112 | bottom: 2rem; |
| 112 | width: 100vw; | 113 | width: 100vw; |
| 113 | display: flex; | 114 | display: flex; |
| 114 | justify-content: space-around; | 115 | justify-content: space-around; |
| 115 | - | 116 | + |
| 116 | .btn-item { | 117 | .btn-item { |
| 117 | width: 40%; | 118 | width: 40%; |
| 118 | text-align: center; | 119 | text-align: center; |
| ... | @@ -120,12 +121,12 @@ useDidShow(async () => { | ... | @@ -120,12 +121,12 @@ useDidShow(async () => { |
| 120 | border-radius: 8px; | 121 | border-radius: 8px; |
| 121 | font-size: 1.1rem; | 122 | font-size: 1.1rem; |
| 122 | } | 123 | } |
| 123 | - | 124 | + |
| 124 | .btn-left { | 125 | .btn-left { |
| 125 | border: 1px solid #A67939; | 126 | border: 1px solid #A67939; |
| 126 | color: #A67939; | 127 | color: #A67939; |
| 127 | } | 128 | } |
| 128 | - | 129 | + |
| 129 | .btn-right { | 130 | .btn-right { |
| 130 | background-color: #A67939; | 131 | background-color: #A67939; |
| 131 | color: #FFF; | 132 | color: #FFF; | ... | ... |
| 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,21 +78,31 @@ function replaceMiddleCharacters(inputString) { | ... | @@ -77,21 +78,31 @@ 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 || []; |
| 83 | } | 85 | } |
| 86 | + } catch (err) { | ||
| 87 | + console.error(err); | ||
| 88 | + Taro.showToast({ title: '加载失败', icon: 'none' }); | ||
| 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) { |
| 89 | - const { code, msg } = await delPersonAPI({ person_id: item.id }); | 95 | + try { |
| 90 | - if (code) { | 96 | + const { code, msg } = await delPersonAPI({ person_id: item.id }); |
| 91 | - Taro.showToast({ title: '删除成功' }); | 97 | + if (code) { |
| 92 | - loadList(); | 98 | + Taro.showToast({ title: '删除成功' }); |
| 93 | - } else { | 99 | + loadList(); |
| 94 | - Taro.showToast({ title: msg || '删除失败', icon: 'none' }); | 100 | + } else { |
| 101 | + Taro.showToast({ title: msg || '删除失败', icon: 'none' }); | ||
| 102 | + } | ||
| 103 | + } catch (error) { | ||
| 104 | + console.error(error); | ||
| 105 | + Taro.showToast({ title: '删除出错', icon: 'none' }); | ||
| 95 | } | 106 | } |
| 96 | } | 107 | } |
| 97 | } | 108 | } |
| ... | @@ -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 | ||
| ... | @@ -70,7 +71,7 @@ const checkStatus = async () => { | ... | @@ -70,7 +71,7 @@ const checkStatus = async () => { |
| 70 | case PAY_STATUS.SUCCESS: | 71 | case PAY_STATUS.SUCCESS: |
| 71 | // 预约成功页面 | 72 | // 预约成功页面 |
| 72 | // Replace to avoid back button loop | 73 | // Replace to avoid back button loop |
| 73 | - go(`/pages/success/index?pay_id=${pay_id}`, 'replace') | 74 | + go(`/pages/success/index?pay_id=${pay_id}`, 'replace') |
| 74 | break | 75 | break |
| 75 | case PAY_STATUS.FAIL: | 76 | case PAY_STATUS.FAIL: |
| 76 | pay_msg.value = '订单支付失败' | 77 | pay_msg.value = '订单支付失败' |
| ... | @@ -112,7 +113,7 @@ const goBackBtn = () => { | ... | @@ -112,7 +113,7 @@ const goBackBtn = () => { |
| 112 | background-color: #fff; | 113 | background-color: #fff; |
| 113 | align-items: center; | 114 | align-items: center; |
| 114 | padding-top: 3rem; | 115 | padding-top: 3rem; |
| 115 | - | 116 | + |
| 116 | .waiting-content { | 117 | .waiting-content { |
| 117 | display: flex; | 118 | display: flex; |
| 118 | flex-direction: column; | 119 | flex-direction: column; |
| ... | @@ -120,7 +121,7 @@ const goBackBtn = () => { | ... | @@ -120,7 +121,7 @@ const goBackBtn = () => { |
| 120 | font-size: 1rem; | 121 | font-size: 1rem; |
| 121 | color: #333; | 122 | color: #333; |
| 122 | } | 123 | } |
| 123 | - | 124 | + |
| 124 | .go-back-wrapper { | 125 | .go-back-wrapper { |
| 125 | width: 80%; | 126 | width: 80%; |
| 126 | margin-top: 2rem; | 127 | margin-top: 2rem; | ... | ... |
-
Please register or login to post a comment