解决店铺无法编辑问题

master
飘泊客 11 months ago
parent 2d507d8e93
commit e9a1c85e7a

@ -12,11 +12,11 @@ export function storeUserQueryAll() {
return httpClient.get<ApiResult>('/storeUser/queryAll', {})
}
export function createUser(data: shopDetailVO) {
return httpClient.post<ApiResult<void>>('/store/add', data)
export function createStore(data: shopDetailVO) {
return httpClient.post<ApiResult<void>>('/store/add', data)
}
export function updateUser(data: shopDetailVO) {
export function updateStore(data: shopDetailVO) {
return httpClient.post<ApiResult<void>>('/store/update', data)
}
// 查询预约详情

@ -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<shopDetailVO> = {
[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({

Loading…
Cancel
Save