From c8787894fc49a54888c9c93304b781447e17a685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=98=E6=B3=8A=E5=AE=A2?= <1059510186@qq.com> Date: Wed, 20 Sep 2023 16:39:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shopManage/index.ts | 27 +- src/api/shopManage/types.ts | 30 +- src/main.ts | 2 +- src/styles/global.less | 1 + src/styles/index.less | 32 ++ src/utils/bean-utils.ts | 3 + .../inspectionIndex.vue | 1 - src/views/shopManage/reservationModal.vue | 161 ++++++ src/views/shopManage/shopIndex.vue | 36 +- src/views/shopManage/shopModal copy 2.vue | 294 ----------- src/views/shopManage/shopModal copy.vue | 294 ----------- src/views/shopManage/shopModal.vue | 462 ++++++++---------- src/views/shopManage/shopSearch.vue | 108 ++-- 13 files changed, 542 insertions(+), 909 deletions(-) create mode 100644 src/styles/index.less create mode 100644 src/views/shopManage/reservationModal.vue delete mode 100644 src/views/shopManage/shopModal copy 2.vue delete mode 100644 src/views/shopManage/shopModal copy.vue diff --git a/src/api/shopManage/index.ts b/src/api/shopManage/index.ts index a364ed9..64c881a 100644 --- a/src/api/shopManage/index.ts +++ b/src/api/shopManage/index.ts @@ -1,12 +1,33 @@ import httpClient from '@/utils/axios' import type { ApiResult } from '@/api/types' -import type { shopPageParam } from './types' +import type { shopPageParam, shopDetailVO, queryReservation } from './types' -export function pageQueryAll(pageParams: shopPageParam) { - return httpClient.get('/store/queryAll', { +export function pageQueryPage(pageParams: shopPageParam) { + return httpClient.get('/store/queryPage', { params: pageParams }) } + export function storeUserQueryAll() { return httpClient.get('/storeUser/queryAll', {}) } + +export function createUser(data: shopDetailVO) { + return httpClient.post>('/store/add', data) +} + +export function updateUser(data: shopDetailVO) { + return httpClient.post>('/store/update', data) +} +// 查询预约详情 +export function getReservation(pageParams: queryReservation) { + return httpClient.get('/store/reservation', { + params: pageParams + }) +} +export function deleteShop(id: number) { + return httpClient.delete>(`/store/${id}`) +} +export function exportI18nDataExcel(params: queryReservation) { + return httpClient.get('/store/export', { params, responseType: 'blob' }) +} diff --git a/src/api/shopManage/types.ts b/src/api/shopManage/types.ts index 1f2d7ff..a0a0a8a 100644 --- a/src/api/shopManage/types.ts +++ b/src/api/shopManage/types.ts @@ -1,12 +1,13 @@ import type { PageParam } from '@/api/types' +import type { Dayjs } from 'dayjs' export type shopParam = { storeName?: string - storeType?: number + storeType?: number | null province?: string + address?: string[] city?: string county?: string - createStartTime?: string - createEndTime?: string + reservationDate?: [Dayjs, Dayjs] } export type shopPageParam = shopParam & PageParam @@ -17,3 +18,26 @@ export type shopDTO = shopParam & { storeType: number storeStatus: number } +export interface shopDetailVO { + id?: number | null + storeName: string + storeType: number | string + storeStatus: number + userId: string + detail: string + province: string + nid: string + city: string + county: string + address: string + tradeTime: string[] + tradeStartTime?: string + tradeEndTime?: string + longitude: number + latitude: number +} +export interface queryReservation { + storeId: number + startTime: string + endTime: string +} diff --git a/src/main.ts b/src/main.ts index fb951f1..b33c656 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import '@/styles/global.less' import 'ant-design-vue/es/message/style/index.less' import 'ant-design-vue/es/notification/style/index.less' import 'ant-design-vue/es/modal/style/index.less' - +import './styles/index.less' import App from './App.vue' import { enableI18n } from '@/config' diff --git a/src/styles/global.less b/src/styles/global.less index 1678501..23ff354 100644 --- a/src/styles/global.less +++ b/src/styles/global.less @@ -80,3 +80,4 @@ ol { color: @error-color-hover; } } + diff --git a/src/styles/index.less b/src/styles/index.less new file mode 100644 index 0000000..a0dd0f6 --- /dev/null +++ b/src/styles/index.less @@ -0,0 +1,32 @@ +.mb-5 { + margin-bottom: 5px; +} +.ml-5 { + margin-left: 5px; +} +.u-flex { + display: flex; + align-items: center; +} +// 滚动条 +.sim-cont{ + max-height: 100%; + overflow: auto; +} +.sim-cont::-webkit-scrollbar { /*滚动条整体样式*/ + width: 7px; + height: 3px; +} +.sim-cont::-webkit-scrollbar-thumb { /*滚动条里面小方块样式*/ + border-radius: 100px; + -webkit-box-shadow: inset 0 0 5px rgba(151, 151, 151, 0.2); + background:rgba(0,0,0,0.1);; +} +.sim-cont::-webkit-scrollbar-track { /*滚动条里面轨道样式*/ + -webkit-box-shadow: inset 0 0 5px rgba(223, 223, 223, 0.2); + border-radius: 100px; + background: rgba(0,0,0,0.1); +} +.flex-1 { + flex: 1; +} \ No newline at end of file diff --git a/src/utils/bean-utils.ts b/src/utils/bean-utils.ts index 9d6daa0..cb334df 100644 --- a/src/utils/bean-utils.ts +++ b/src/utils/bean-utils.ts @@ -1,6 +1,8 @@ /* 使用源对象,覆盖目标对象的已有属性 */ export function overrideProperties(target: T, source: any, excludes?: string[]): T { if (!source) return target + console.log('target==', target) + console.log('source==', source) // @ts-ignore Object.keys(target).forEach(key => { const result = target as any @@ -8,5 +10,6 @@ export function overrideProperties(target: T, source: any, excludes?: string[ result[key] = source[key] } }) + console.log('return---', target) return target } diff --git a/src/views/qualityInspectionDistribution/inspectionIndex.vue b/src/views/qualityInspectionDistribution/inspectionIndex.vue index 24817b3..5a106d9 100644 --- a/src/views/qualityInspectionDistribution/inspectionIndex.vue +++ b/src/views/qualityInspectionDistribution/inspectionIndex.vue @@ -63,7 +63,6 @@ let searchParams: GeopoliticalCustomersPageParam = {} //远程加载表格数据 const tableRequest: TableRequest = (params, sorter, filter) => { - console.log('11111111111111111') const pageParam = mergePageParam(params, sorter, filter) return pageAccessLogs({ ...pageParam, ...searchParams }) } diff --git a/src/views/shopManage/reservationModal.vue b/src/views/shopManage/reservationModal.vue new file mode 100644 index 0000000..cab993f --- /dev/null +++ b/src/views/shopManage/reservationModal.vue @@ -0,0 +1,161 @@ + + + + diff --git a/src/views/shopManage/shopIndex.vue b/src/views/shopManage/shopIndex.vue index dc9f8ce..0f5bd3f 100644 --- a/src/views/shopManage/shopIndex.vue +++ b/src/views/shopManage/shopIndex.vue @@ -9,7 +9,6 @@
新建店铺 - 批量新建
@@ -30,31 +29,33 @@ + + - diff --git a/src/views/shopManage/shopModal copy.vue b/src/views/shopManage/shopModal copy.vue deleted file mode 100644 index 664d040..0000000 --- a/src/views/shopManage/shopModal copy.vue +++ /dev/null @@ -1,294 +0,0 @@ - - - - diff --git a/src/views/shopManage/shopModal.vue b/src/views/shopManage/shopModal.vue index 8131c28..8da1b2e 100644 --- a/src/views/shopManage/shopModal.vue +++ b/src/views/shopManage/shopModal.vue @@ -7,156 +7,121 @@ :body-style="{ paddingBottom: '8px' }" :confirm-loading="submitLoading" :width="650" + @ok="handleSubmit" @cancel="handleClose" > - - - - - - - - - - - - - 直营店 - 加盟店 - - - - - - - - - 正常 - 未营业 - - - - - - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + 直营店 + 加盟店 + + + + + + + + + 正常 + 未营业 + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 匹配 -
- - - - - -
-
-
-
- -
-
-
-
-
- + + + + + + +
+
+
+ +
@@ -165,66 +130,54 @@ import { reactive, ref, onMounted, toRefs } from 'vue' import { useModal } from '@/hooks/modal' import type { FormRequestMapping } from '@/hooks/form' import { overrideProperties } from '@/utils/bean-utils' -import { message } from 'ant-design-vue' // import type { shopDTO } from '@/api/geopoliticalCustomers/types' -import { storeUserQueryAll } from '@/api/shopManage/index' -import { doRequest } from '@/utils/axios/request' +import { storeUserQueryAll, createUser, updateUser } from '@/api/shopManage/index' import { provincesAndCitiesAndAutonomousRegions } from '@/utils/geopolitical-customers' import type { ShowSearchType } from 'ant-design-vue/es/cascader' import { useAdminForm, useFormAction, FormAction, labelCol, wrapperCol } from '@/hooks/form' +import type { shopDetailVO } from '@/api/shopManage/types' +import type { FormInstance } from 'ant-design-vue/es/form/Form' //预约时间 import 'dayjs/locale/zh-cn' -import { reverse } from 'dns' -import { useUserStore } from '@/stores/user-store' -// import dayjs from 'dayjs' const emits = defineEmits<{ (e: 'submit-success'): void }>() -const { userInfo } = useUserStore() declare const AMap: any -interface ReservationShop { - customStoreId?: number - storeName: string - reservationTime: string -} -interface shopDetailVO { - storeName: string - storeType: number | string - storeStatus: number | string - detail: string - address: string - tradeTime: string[] - tradeStartTime: string - tradeEndTime: string - longitude: number - latitude: number -} const formModel = reactive({ + id: null, storeName: '', + userId: '', storeType: '', - storeStatus: '', + storeStatus: 0, + province: '', + nid: '', + city: '', + county: '', detail: '', address: '', tradeTime: [], - tradeStartTime: '', - tradeEndTime: '', longitude: 0, latitude: 0 }) -const companyOptions = reactive({}) -const userList: any = reactive([]) +const formRef = ref() +// 锚点对象 +let anchorData: any = reactive({}) +const userList: any = ref([]) // 表单校验规则 const formRule = ref({}) const provincesAndCitiesAndAutonomousOptions: any = ref([]) // 表单的提交请求 -const formRequestMapping: FormRequestMapping = {} +const formRequestMapping: FormRequestMapping = { + [FormAction.CREATE]: createUser, + [FormAction.UPDATE]: updateUser +} const { title, visible, openModal, closeModal } = useModal() const { formAction } = useFormAction() -const { submitLoading, resetFields } = useAdminForm( +const { submitLoading, resetFields, validateAndSubmit } = useAdminForm( formAction, formRequestMapping, formModel, @@ -233,38 +186,23 @@ const { submitLoading, resetFields } = useAdminForm( onMounted(() => { provincesAndCitiesAndAutonomousOptions.value = provincesAndCitiesAndAutonomousRegions - // selectUserList() }) -const filter: ShowSearchType['filter'] = (val, path) => { - return path.some(option => option.label.toLowerCase().indexOf(val.toLowerCase()) > -1) -} - //输入提示插件AMap.Autocomplete const autoComplete = ref() //POI搜索插件AMap.PlaceSearch const placeSearch = ref() -//点标记AMap.Marker -//创建的一个 Marker 实例 -const marker = ref({}) //创建地图AMap.Map const map = ref({}) -//使用geocoder做地理/逆地理编码 -//正向地理编码: 将地址 描述信息 转换成 地理坐标(经纬度),对应为AMap.Geocoder的getLocation方法 -//逆向地理编码:将 地理坐标(经纬度) 转换成 地址描述信息,对应为AMap.Geocoder的getAddress方法 -const geocoder = ref({}) //创建地图 - const initMap = () => { - map.value = new AMap.Map('draw-station-container', { + map.value = new AMap.Map(['shopMap'], { center: [120.1551, 30.2741], // 地图中心点经纬度 - zoom: 13 // 缩放级别 + zoom: 13, // 缩放级别 + resizeEnable: true }) - // marker.value = new AMap.Marker({ - // position: [116.397428, 39.90923] // 标记位置经纬度 - // }) const geolocation = new AMap.Geolocation({ enableHighAccuracy: true, // 是否使用高精度定位,默认为false timeout: 10000, // 超时时间,单位毫秒,默认为无穷大 @@ -282,45 +220,78 @@ const initMap = () => { console.log('定位失败:', result.message) } }) - AMap.plugin('AMap.AutoComplete', function () { // 实例化Autocomplete const autoOptions = { //city 限定城市,默认全国 input: 'tipinput' } - autoComplete.value = new AMap.AutoComplete(autoOptions) - // geocoder.value = new AMap.Geocoder({ - // city: '010' //城市设为北京,默认:“全国” - // }) }) - - // map.value.add(marker.value) + AMap.plugin('AMap.PlaceSearch', function () { + // PlaceSearch + const placeOptions = { + map: map.value + } + placeSearch.value = new AMap.PlaceSearch(placeOptions) + }) + autoComplete.value.on('select', (e: any) => { + placeSearch.value.setCity(e.poi.adcode) + placeSearch.value.search(e.poi.name) + }) + placeSearch.value.on('markerClick', (e: any) => { + formModel.address = `${e.data.pname}${e.data.cityname}${e.data.adname}${e.data.address}` + anchorData = { ...e.data } + }) + map.value.addControl(geolocation) } const selectUserList = () => { - storeUserQueryAll().then(res => { - console.log(res) + return new Promise(resolve => { + storeUserQueryAll().then((res: any) => { + userList.value = res.data + resolve(true) + }) }) } const handleClose = () => { + closeModal() submitLoading.value = false } -const match = () => {} -const toExamine = (type: number) => { - // updateCustomerAudit(type).then(res => { - // message.info(res.message) - // if (res.code == 200) { - // closeModal() - // emits('submit-success') - // } - // }) + +/* 表单提交处理 */ +const handleSubmit = () => { + formRef.value?.validate().then(res => { + const addkey: any = {} + if (title.value == '添加门店') { + addkey.province = anchorData.pname + addkey.city = anchorData.cityname + addkey.county = anchorData.adname + addkey.detail = anchorData.address + addkey.longitude = anchorData.location.lng + addkey.latitude = anchorData.location.lat + } + anchorData && + validateAndSubmit( + { + ...formModel, + ...addkey, + tradeStartTime: formModel.tradeTime[0], + tradeEndTime: formModel.tradeTime[1] + }, + { + onSuccess: () => { + closeModal() + emits('submit-success') + } + } + ) + }) } + defineExpose({ - open(newFormAction: FormAction, record?: shopDetailVO) { - console.log(record, 'record') - console.log(1111111) + async open(newFormAction: FormAction, record?: shopDetailVO) { + await selectUserList() openModal() resetFields() if (newFormAction === FormAction.CREATE) { @@ -329,17 +300,9 @@ defineExpose({ }) title.value = '添加门店' } else if (newFormAction === FormAction.UPDATE) { - nextTick(() => { - initMap() - }) title.value = '编辑门店' - // record!.comprehensiveAddress = `${record?.economize}${record?.market}${record?.distinguish}${record?.detailAddress}` - // record!.customStoreVOList = [ - // { - // storeName: '测试', - // reservationTime: '2023-9-14 10:12:15' - // } - // ] + const tradeTime = record?.tradeTime.toString() + record!.tradeTime = tradeTime!.split('-') overrideProperties(formModel, record) } formAction.value = newFormAction @@ -347,43 +310,13 @@ defineExpose({ }) diff --git a/src/views/shopManage/shopSearch.vue b/src/views/shopManage/shopSearch.vue index 1ef3d99..1b020d2 100644 --- a/src/views/shopManage/shopSearch.vue +++ b/src/views/shopManage/shopSearch.vue @@ -4,38 +4,35 @@ - - + + - - + + + 直营店 + 加盟店 + - - + + - + @@ -46,25 +43,35 @@
-