diff --git a/src/api/shopManage/index.ts b/src/api/shopManage/index.ts index 1c7a423..5b37c44 100644 --- a/src/api/shopManage/index.ts +++ b/src/api/shopManage/index.ts @@ -12,11 +12,11 @@ export function storeUserQueryAll() { return httpClient.get('/storeUser/queryAll', {}) } -export function createUser(data: shopDetailVO) { - return httpClient.post>('/store/add', data) +export function createStore(data: shopDetailVO) { + return httpClient.post>('/store/add', data) } -export function updateUser(data: shopDetailVO) { +export function updateStore(data: shopDetailVO) { return httpClient.post>('/store/update', data) } // 查询预约详情 diff --git a/src/views/shopManage/shopModal.vue b/src/views/shopManage/shopModal.vue index 979ceee..2688ce6 100644 --- a/src/views/shopManage/shopModal.vue +++ b/src/views/shopManage/shopModal.vue @@ -139,7 +139,7 @@ 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, createUser, updateUser } from '@/api/shopManage/index' +import { storeUserQueryAll, createStore, updateStore } 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' @@ -177,8 +177,8 @@ const formRule = ref({}) const provincesAndCitiesAndAutonomousOptions: any = ref([]) // 表单的提交请求 const formRequestMapping: FormRequestMapping = { - [FormAction.CREATE]: createUser, - [FormAction.UPDATE]: updateUser + [FormAction.CREATE]: createStore, + [FormAction.UPDATE]: updateStore } const { title, visible, openModal, closeModal } = useModal() @@ -266,6 +266,7 @@ const selectUserList = () => { } const handleClose = () => { closeModal() + anchorData = null formModel.tradeTime = [] submitLoading.value = false } @@ -273,35 +274,34 @@ const handleClose = () => { /* 表单提交处理 */ const handleSubmit = () => { formRef.value?.validate().then(res => { - if (anchorData && anchorData.location && anchorData.location.lng) { - console.log(anchorData.location, 'anchorData.location') - 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') - } - } - ) - } else { + if (!anchorData?.location && title.value == '添加门店') { message.info('请先选择具体门店') + return false } + 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 + } + validateAndSubmit( + { + ...formModel, + ...addkey, + tradeStartTime: formModel.tradeTime[0], + tradeEndTime: formModel.tradeTime[1] + }, + { + onSuccess: () => { + closeModal() + anchorData = null + emits('submit-success') + } + } + ) }) } defineExpose({