diff --git a/src/App.vue b/src/App.vue index 3eba186..98f2e9a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -95,8 +95,8 @@ const tabbar: TabbarItem[] = [ { pagePath: "pages/tabbar/invitationRecord", text: "邀约记录", - iconPath: "/static/tabbar/invitation.png", - selectedIconPath: "/static/tabbar/invitation-select.png", + iconPath: "/static/tabbar/order.png", + selectedIconPath: "/static/tabbar/order-select.png", launchParam: ["invitation"], auth: [], }, diff --git a/src/pages/invitation/detail.vue b/src/pages/invitation/detail.vue index a79b335..6516294 100644 --- a/src/pages/invitation/detail.vue +++ b/src/pages/invitation/detail.vue @@ -1,3 +1,105 @@ - + + + diff --git a/src/pages/tabbar/invitation.vue b/src/pages/tabbar/invitation.vue index 3d927be..eb2d551 100644 --- a/src/pages/tabbar/invitation.vue +++ b/src/pages/tabbar/invitation.vue @@ -51,7 +51,7 @@ - + - - + + @@ -90,20 +90,19 @@ import { onLoad } from "@dcloudio/uni-app" import { reactive, ref } from "vue" import { invitationApi } from "@/sheep/api/index" -const form = reactive({ +const form = reactive({ name: "", mobile: "", companyName: "", vStartDate: "", vEndDate: "", - deptId: "", reasonValue: "", + reasonText: "", isOtherPeople: true, isDrive: true, }) const _timestr = ref("2025-01-01") -const _pingtaistr = ref("") -const visitorReasonList = ref([]) +const visitorReasonList = ref<{ title: string; id: string }[]>([]) onLoad(() => { const app = getApp() @@ -116,35 +115,54 @@ onLoad(() => { const getVisitorReasonList = async () => { const { code, data } = await invitationApi.getDictListByType("1") if (code == 0 && data) { - visitorReasonList.value = data + visitorReasonList.value = data.map((item: any) => ({ title: item.label, id: item.value })) return } visitorReasonList.value = [] } +// 来访原因选择器确认 +const reasonPickerConfirm = (ids: string) => { + const reason = visitorReasonList.value.find((item) => item.id === ids[0]) + form.reasonText = reason?.title || "" + form.reasonValue = reason?.id || "" +} + const rules: Record = { name: [{ required: true, message: "姓名2到5个字符", rule: /^.{2,5}$/ }], mobile: [{ required: true, message: "请输入正确的手机号", rule: /^(?:(?:\+|00)86)?1\d{10}$/ }], companyName: [{ required: true, message: "请输入来访公司名称" }], vStartDate: [{ required: true, message: "请选择拜访开始时间" }], vEndDate: [{ required: true, message: "请选择拜访离开时间" }], - deptId: [{ required: true, message: "请选择拜访部门" }], reasonValue: [{ required: true, message: "请选择拜访原因" }], } // 表单提交 const onsubmit = (evt: TM.FORM_SUBMIT_RESULT) => { - console.log("校验结果:", evt) + // console.log("校验结果:", evt) if (!evt.isPass) return uni.showModal({ title: "提示", content: "确认提交吗?", confirmColor: "#0094ff", success: async () => { + if (form.isOtherPeople) { + form.isOtherPeople = "1" + } else { + form.isOtherPeople = "0" + } + + if (form.isDrive) { + form.isDrive = "1" + } else { + form.isDrive = "0" + } + try { const { code, data, msg } = await invitationApi.saveInvitation(form) if (code == 0) { uni.showToast({ title: "提交成功", icon: "success" }) + resetForm() uni.switchTab({ url: "/pages/tabbar/invitationRecord" }) return } @@ -155,4 +173,19 @@ const onsubmit = (evt: TM.FORM_SUBMIT_RESULT) => { }, }) } + +// 重置表单 +const resetForm = () => { + Object.assign(form, { + name: "", + mobile: "", + companyName: "", + vStartDate: "", + vEndDate: "", + reasonValue: "", + reasonText: "", + isOtherPeople: true, + isDrive: true, + }) +} diff --git a/src/pages/tabbar/invitationRecord.vue b/src/pages/tabbar/invitationRecord.vue index 4a22d0a..4ab4144 100644 --- a/src/pages/tabbar/invitationRecord.vue +++ b/src/pages/tabbar/invitationRecord.vue @@ -15,18 +15,32 @@ @scroll="pageHook.scroll" > diff --git a/src/sheep/api/invitation.ts b/src/sheep/api/invitation.ts index ef4bd87..19268bb 100644 --- a/src/sheep/api/invitation.ts +++ b/src/sheep/api/invitation.ts @@ -4,7 +4,7 @@ export default { // 获取拜访原因字典 getDictListByType: (type: number | string): Promise => request({ - url: `/integrated/app/visitor/getDictListByType?type=${type}`, + url: `/integrated/visitors/getDictListByType?type=${type}`, method: "GET", }), @@ -32,4 +32,11 @@ export default { method: "GET", params, }), + + // 查看邀约详情 + getInvitationDetail: (id: string): Promise => + request({ + url: `/integrated/visitors/${id}`, + method: "GET", + }), }