Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
xysBooking
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-01-18 10:37:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cb7265700f5d3582536b992c496713740e64513a
cb726570
1 parent
7a436e94
联调参观者列表新增和删除接口
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
66 deletions
components.d.ts
package.json
src/api/index.js
src/components/qrCode.vue
src/views/addVisitor.vue
src/views/bookingCode.vue
src/views/me.vue
src/views/submit.vue
yarn.lock
components.d.ts
View file @
cb72657
...
...
@@ -7,26 +7,15 @@ export {}
declare
module
'@vue/runtime-core'
{
export
interface
GlobalComponents
{
BookingCode
:
typeof
import
(
'./src/components/bookingCode.vue'
)[
'default'
]
QrCode
:
typeof
import
(
'./src/components/qrCode.vue'
)[
'default'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
VanButton
:
typeof
import
(
'vant/es'
)[
'Button'
]
VanCalendar
:
typeof
import
(
'vant/es'
)[
'Calendar'
]
VanCheckbox
:
typeof
import
(
'vant/es'
)[
'Checkbox'
]
VanCheckboxGroup
:
typeof
import
(
'vant/es'
)[
'CheckboxGroup'
]
VanCol
:
typeof
import
(
'vant/es'
)[
'Col'
]
VanDatePicker
:
typeof
import
(
'vant/es'
)[
'DatePicker'
]
VanDialog
:
typeof
import
(
'vant/es'
)[
'Dialog'
]
VanEmpty
:
typeof
import
(
'vant/es'
)[
'Empty'
]
VanField
:
typeof
import
(
'vant/es'
)[
'Field'
]
VanForm
:
typeof
import
(
'vant/es'
)[
'Form'
]
VanIcon
:
typeof
import
(
'vant/es'
)[
'Icon'
]
VanPicker
:
typeof
import
(
'vant/es'
)[
'Picker'
]
VanPopup
:
typeof
import
(
'vant/es'
)[
'Popup'
]
VanRadio
:
typeof
import
(
'vant/es'
)[
'Radio'
]
VanRadioGroup
:
typeof
import
(
'vant/es'
)[
'RadioGroup'
]
VanRow
:
typeof
import
(
'vant/es'
)[
'Row'
]
VanSwipe
:
typeof
import
(
'vant/es'
)[
'Swipe'
]
VanSwipeItem
:
typeof
import
(
'vant/es'
)[
'SwipeItem'
]
VanToast
:
typeof
import
(
'vant/es'
)[
'Toast'
]
...
...
package.json
View file @
cb72657
...
...
@@ -12,6 +12,7 @@
"cypress:open"
:
"cypress open"
},
"dependencies"
:
{
"@code-ts/cin"
:
"^0.0.2"
,
"@vant/area-data"
:
"^1.3.1"
,
"@vant/touch-emulator"
:
"^1.4.0"
,
"@vitejs/plugin-legacy"
:
"^1.8.2"
,
...
...
src/api/index.js
View file @
cb72657
/*
* @Date: 2023-08-24 09:42:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-1
7 17:37:48
* @LastEditTime: 2024-01-1
8 10:31:15
* @FilePath: /xysBooking/src/api/index.js
* @Description: 文件描述
*/
...
...
@@ -10,6 +10,9 @@ import { fn, fetch } from '@/api/fn';
const
Api
=
{
CAN_RESERVE_DATE_LIST
:
'/srv/?a=api&t=can_reserve_date_list'
,
CAN_RESERVE_TIME_LIST
:
'/srv/?a=api&t=can_reserve_time_list'
,
PERSON_LIST
:
'/srv/?a=api&t=person_list'
,
ADD_PERSON
:
'/srv/?a=api&t=add_person'
,
DEL_PERSON
:
'/srv/?a=api&t=del_person'
,
};
/**
...
...
@@ -27,8 +30,26 @@ export const canReserveDateListAPI = (params) => fn(fetch.get(Api.CAN_RESERVE_DA
export
const
canReserveTimeListAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
CAN_RESERVE_TIME_LIST
,
params
));
/**
* @description: 取消预约
* @param {String} id 预约订单的ID
* @description: 参观者列表
* @param {String} reserve_date 预约日期,格式 yyyy-mm-dd,没有传入则不查询指定日期是否已预约
* @param {String} begin_time 时段开始时间,格式 hh:mm
* @param {String} end_time 时段结束时间,格式 hh:mm
* @returns
*/
// export const orderCancelAPI = (params) => fn(fetch.post(Api.ORDER_CANCEL, params));
export
const
personListAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
PERSON_LIST
,
params
));
/**
* @description: 添加参观者
* @param {String} name 参观者姓名
* @param {String} id_type 证件类型,1=身份证,3=其他
* @param {String} id_number 证件号
* @returns
*/
export
const
addPersonAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
ADD_PERSON
,
params
));
/**
* @description: 删除参观者
* @param {String} person_id 参观者id
* @returns
*/
export
const
delPersonAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
DEL_PERSON
,
params
));
...
...
src/components/qrCode.vue
View file @
cb72657
<!--
* @Date: 2024-01-16 10:06:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-1
6 17:06:21
* @LastEditTime: 2024-01-1
8 10:36:53
* @FilePath: /xysBooking/src/components/qrCode.vue
* @Description: 文件描述
-->
...
...
@@ -49,7 +49,6 @@
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import xctcCheck from "xctc-check"
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
...
...
@@ -134,11 +133,7 @@ const nextCode = () => {
}
const formatId = (id) => {
if (id.length === 15) {
return replaceMiddleCharacters(id);
} else {
return xctcCheck.formatInfoHide(id)
}
};
const userinfo = computed(() => {
...
...
src/views/addVisitor.vue
View file @
cb72657
<!--
* @Date: 2024-01-15 17:39:29
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-1
6 17:25:22
* @LastEditTime: 2024-01-1
8 10:23:30
* @FilePath: /xysBooking/src/views/addVisitor.vue
* @Description: 文件描述
-->
...
...
@@ -51,13 +51,15 @@
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import
xctcCheck from "xctc-check"
import
{ validateCIN } from '@code-ts/cin'
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
//import { } from '@/composables'
import { showSuccessToast, showFailToast } from 'vant';
import { useGo } from '@/hooks/useGo'
import { addPersonAPI } from '@/api/index'
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
...
...
@@ -81,29 +83,28 @@ const checkUsername = () => {
return flag;
}
const checkIdCode = () => {
const res = xctcCheck.checkIdCard(idCode.value);
let flag = true;
if (idCode.value.length === 15) { // 15位身份证号码不校验
flag = true;
} else {
if (
res.status
) {
if (
validateCIN(idCode.value)
) {
} else {
show_error.value = true;
error_message.value =
res.msg
;
error_message.value =
'请检查身份证号码'
;
flag = false;
}
}
return flag;
}
const addVisitor = () => {
//
TODO:
保存用户信息
const addVisitor =
async
() => {
// 保存用户信息
if (checkUsername() && checkIdCode()) {
const { code, data } = await addPersonAPI({ name: username.value, id_type: id_type.value, id_number: idCode.value });
if (code) {
$router.go(-1);
console.warn(username.value);
console.warn(idCode.value);
console.warn(fieldValue.value);
}
}
}
...
...
@@ -112,14 +113,17 @@ const idTypeChange = () => {
showPicker.value = !showPicker.value;
}
const columns = [
{ text: '身份证', value: '
0
' },
{ text: '其他证件', value: '
1
' },
{ text: '身份证', value: '
1
' },
{ text: '其他证件', value: '
3
' },
];
const fieldValue = ref('身份证');
const id_type = ref('1');
const onConfirm = ({ selectedOptions }) => {
showPicker.value = false;
//
fieldValue.value = selectedOptions[0].text;
id_type.value = selectedOptions[0].value;
};
</script>
...
...
src/views/bookingCode.vue
View file @
cb72657
...
...
@@ -18,7 +18,6 @@
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import xctcCheck from "xctc-check"
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
...
...
src/views/me.vue
View file @
cb72657
<!--
* @Date: 2024-01-16 13:33:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-1
7 07:03:58
* @LastEditTime: 2024-01-1
8 10:36:04
* @FilePath: /xysBooking/src/views/me.vue
* @Description: 文件描述
-->
...
...
@@ -17,7 +17,7 @@
<div v-for="(item, index) in visitorList" :key="index" class="visitor-item">
<div>
<p style="color: #A67939;">{{ item.name }}</p>
<p>证件号:{{ formatId(item.id
Card
) }}</p>
<p>证件号:{{ formatId(item.id
_number
) }}</p>
</div>
<div @click="removeItem(item)" style="margin-left: 1rem;">
<van-icon name="https://cdn.ipadbiz.cn/xys/booking/%E5%88%A0%E9%99%A4@2x.png" />
...
...
@@ -35,13 +35,13 @@
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useGo } from '@/hooks/useGo'
import xctcCheck from "xctc-check"
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
//import { } from '@/composables'
import { showConfirmDialog } from 'vant';
import { showSuccessToast, showFailToast } from 'vant';
import { personListAPI, delPersonAPI } from '@/api/index'
const go = useGo();
const $route = useRoute();
const $router = useRouter();
...
...
@@ -68,11 +68,7 @@ function replaceMiddleCharacters(inputString) {
}
const formatId = (id) => {
if (id.length === 15) {
return replaceMiddleCharacters(id);
} else {
return xctcCheck.formatInfoHide(id)
}
};
const removeItem = (item) => {
...
...
@@ -82,23 +78,24 @@ const removeItem = (item) => {
confirmButtonColor: '#A67939',
width: '80vw'
})
.then(() => {
.then(
async
() => {
// on confirm
const { code, data } = await delPersonAPI({ person_id: item.id });
if (code) {
showSuccessToast('删除成功');
visitorList.value = visitorList.value.filter((v) => v.id !== item.id);
}
})
.catch(() => {
// on cancel
});
}
onMounted(() => {
visitorList.value = [
{ id: '1', name: '张雨燕1', idCard: '311522190103214', today: false },
{ id: '2', name: '张雨燕2', idCard: '311522190103214279', today: true },
{ id: '3',name: '张雨燕3', idCard: '311522190103214279', today: false },
{ id: '4',name: '张雨燕4', idCard: '311522190103214279', today: false }
];
onMounted(async () => {
const { code, data } = await personListAPI();
if (code) {
visitorList.value = data;
}
})
</script>
...
...
src/views/submit.vue
View file @
cb72657
<!--
* @Date: 2024-01-15 16:25:51
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-1
6 18:19:12
* @LastEditTime: 2024-01-1
8 10:36:40
* @FilePath: /xysBooking/src/views/submit.vue
* @Description:
文件描述
* @Description:
预约人员信息
-->
<template>
<div class="submit-page">
...
...
@@ -22,8 +22,8 @@
</div>
<div>
<p style="color: #A67939;">{{ item.name }}</p>
<p>证件号:{{ formatId(item.id
Card
) }}</p>
<p v-if="item.
today" style="color: #9C9A9A; font-size: 0.8rem;">*已预约过2024-01-10
参观,请不要重复预约</p>
<p>证件号:{{ formatId(item.id
_number
) }}</p>
<p v-if="item.
is_reserve === '1'" style="color: #9C9A9A; font-size: 0.8rem;">*已预约过{{ date }}
参观,请不要重复预约</p>
</div>
</div>
</div>
...
...
@@ -46,7 +46,6 @@
<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import xctcCheck from "xctc-check"
import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
//import { } from '@/utils/generateModules.js'
//import { } from '@/utils/generateIcons.js'
...
...
@@ -55,6 +54,7 @@ import { useGo } from '@/hooks/useGo'
import { showSuccessToast, showFailToast, showToast } from 'vant';
import icon_check1 from '@/assets/images/多选01@2x.png'
import icon_check2 from '@/assets/images/多选02@2x.png'
import { personListAPI } from '@/api/index'
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
...
...
@@ -82,16 +82,12 @@ function replaceMiddleCharacters(inputString) {
}
const formatId = (id) => {
if (id.length === 15) {
return replaceMiddleCharacters(id);
} else {
return xctcCheck.formatInfoHide(id)
}
};
const checked_visitors = ref([]);
const addVisitor = (item) => {
if (item.
today
) { // 今天已经预约
if (item.
is_reserve === '1'
) { // 今天已经预约
showToast('已预约过参观,请不要重复预约!')
return;
}
...
...
@@ -126,13 +122,11 @@ const submitBtn = () => {
}
}
onMounted(() => {
visitorList.value = [
{ id: '1', name: '张雨燕1', idCard: '311522190103214', today: false },
{ id: '2', name: '张雨燕2', idCard: '311522190103214279', today: true },
{ id: '3',name: '张雨燕3', idCard: '311522190103214279', today: false },
{ id: '4',name: '张雨燕4', idCard: '311522190103214279', today: false }
];
onMounted(async () => {
const { code, data } = await personListAPI({ reserve_date: date, begin_time: time.split('-')[0], end_time: time.split('-')[1] });
if (code) {
visitorList.value = data;
}
});
</script>
...
...
yarn.lock
View file @
cb72657
...
...
@@ -213,6 +213,11 @@
"@babel/helper-validator-identifier" "^7.22.5"
to-fast-properties "^2.0.0"
"@code-ts/cin@^0.0.2":
version "0.0.2"
resolved "https://mirrors.cloud.tencent.com/npm/@code-ts/cin/-/cin-0.0.2.tgz#574a64df3e55a180ae5f12d33830e62fa6c0ccb2"
integrity sha512-ZFIcwfxnYeBKAJSInmvKk3ogblkQTUUZDA1biqiEoukiAFsX3ldlQp+ZHooFIMeSYuR/32pGSNtFtgDl8TwyXQ==
"@colors/colors@1.5.0":
version "1.5.0"
resolved "https://mirrors.cloud.tencent.com/npm/@colors/colors/-/colors-1.5.0.tgz"
...
...
Please
register
or
login
to post a comment