|
|
|
@ -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({
|
|
|
|
|