|
@@ -5,30 +5,29 @@ import { useForm } from '@/hooks/web/useForm'
|
|
|
import { PropType, watch, ref, onMounted, unref } from 'vue'
|
|
import { PropType, watch, ref, onMounted, unref } from 'vue'
|
|
|
import { useValidator } from '@/hooks/web/useValidator'
|
|
import { useValidator } from '@/hooks/web/useValidator'
|
|
|
import { cloneDeep } from 'lodash-es'
|
|
import { cloneDeep } from 'lodash-es'
|
|
|
-import { ElAutocomplete, ElAvatar, ElText } from 'element-plus'
|
|
|
|
|
|
|
+import { ElAutocomplete } from 'element-plus'
|
|
|
import { getConfigKey, getMapSearch } from '@/api/system/admin'
|
|
import { getConfigKey, getMapSearch } from '@/api/system/admin'
|
|
|
import { mapAddressData } from '@/api/system/admin/types'
|
|
import { mapAddressData } from '@/api/system/admin/types'
|
|
|
-import { UserList } from '@/components/UserList'
|
|
|
|
|
-import { BaseButton } from '@/components/Button'
|
|
|
|
|
|
|
+// import { UserList } from '@/components/UserList'
|
|
|
|
|
+// import { BaseButton } from '@/components/Button'
|
|
|
|
|
+import { UserButtom } from '@/components/UserList'
|
|
|
|
|
|
|
|
const mapKey = ref('')
|
|
const mapKey = ref('')
|
|
|
const actionAddress = ref<mapAddressData>()
|
|
const actionAddress = ref<mapAddressData>()
|
|
|
const { required } = useValidator()
|
|
const { required } = useValidator()
|
|
|
const center = ref({ lat: 28.655759, lng: 121.420808 })
|
|
const center = ref({ lat: 28.655759, lng: 121.420808 })
|
|
|
const geometries = ref([{ styleId: 'marker', position: { lat: 28.655759, lng: 121.420808 } }])
|
|
const geometries = ref([{ styleId: 'marker', position: { lat: 28.655759, lng: 121.420808 } }])
|
|
|
-const userDetail = ref<any>()
|
|
|
|
|
-const showDrawer = ref(false)
|
|
|
|
|
|
|
+// const userDetail = ref<any>()
|
|
|
|
|
|
|
|
const checkedUser = async (res: any) => {
|
|
const checkedUser = async (res: any) => {
|
|
|
- userDetail.value = res
|
|
|
|
|
setValues({
|
|
setValues({
|
|
|
uid: res.uid
|
|
uid: res.uid
|
|
|
// name: res.real_name,
|
|
// name: res.real_name,
|
|
|
// avatar: [res.avatar],
|
|
// avatar: [res.avatar],
|
|
|
// birth_day_time: res.birthday,
|
|
// birth_day_time: res.birthday,
|
|
|
- // phone: res.phone
|
|
|
|
|
|
|
+ // phone: res.phone,
|
|
|
|
|
+ // gender: res.sex || 0
|
|
|
})
|
|
})
|
|
|
- showDrawer.value = false
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
@@ -36,6 +35,19 @@ onMounted(async () => {
|
|
|
if (res) {
|
|
if (res) {
|
|
|
mapKey.value = res.data.tengxun_map_key
|
|
mapKey.value = res.data.tengxun_map_key
|
|
|
}
|
|
}
|
|
|
|
|
+ if (props.currentRow) {
|
|
|
|
|
+ console.log(props.currentRow, 'props.currentRow')
|
|
|
|
|
+ rules.value.store_account = [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: false
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ rules.value.store_password = [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: false
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -50,7 +62,6 @@ const selectAddress = (item: mapAddressData) => {
|
|
|
console.error('Invalid input item:', item)
|
|
console.error('Invalid input item:', item)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
const adcodeStr = String(item.adcode).padStart(6, '0') // 确保 adcode 至少有6位
|
|
const adcodeStr = String(item.adcode).padStart(6, '0') // 确保 adcode 至少有6位
|
|
|
const province = adcodeStr.slice(0, 2)
|
|
const province = adcodeStr.slice(0, 2)
|
|
|
const city = adcodeStr.slice(2, 4)
|
|
const city = adcodeStr.slice(2, 4)
|
|
@@ -61,7 +72,9 @@ const selectAddress = (item: mapAddressData) => {
|
|
|
city: `${province}${city}00000000`,
|
|
city: `${province}${city}00000000`,
|
|
|
area: `${area}000000`,
|
|
area: `${area}000000`,
|
|
|
longitude: item.lng,
|
|
longitude: item.lng,
|
|
|
- latitude: item.lat
|
|
|
|
|
|
|
+ latitude: item.lat,
|
|
|
|
|
+ address: item.address,
|
|
|
|
|
+ detailed_address: item.label
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
actionAddress.value = item
|
|
actionAddress.value = item
|
|
@@ -101,32 +114,17 @@ const formSchema = ref<FormSchema[]>([
|
|
|
component: 'CheckboxGroup',
|
|
component: 'CheckboxGroup',
|
|
|
formItemProps: {
|
|
formItemProps: {
|
|
|
slots: {
|
|
slots: {
|
|
|
- default: () => {
|
|
|
|
|
- if (userDetail?.value) {
|
|
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <BaseButton size="large" onClick={() => (showDrawer.value = true)}>
|
|
|
|
|
- <div class={'flex items-center'}>
|
|
|
|
|
- <ElAvatar shape="circle" size="small" src={userDetail?.value?.avatar}>
|
|
|
|
|
- <img src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
|
|
|
|
|
- </ElAvatar>
|
|
|
|
|
- <div class={'flex flex-col ml-5px items-start justify-start'}>
|
|
|
|
|
- <ElText class={'self-start!'}>{userDetail?.value?.nickname}</ElText>
|
|
|
|
|
- <ElText size="small" class={'self-start!'}>
|
|
|
|
|
- UID:{userDetail?.value?.uid}
|
|
|
|
|
- </ElText>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </BaseButton>
|
|
|
|
|
- </>
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <BaseButton onClick={() => (showDrawer.value = true)}>选择用户</BaseButton>
|
|
|
|
|
- </>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ default: (data) => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <UserButtom
|
|
|
|
|
+ v-model={data.uid}
|
|
|
|
|
+ onChangeUser={(res) => {
|
|
|
|
|
+ checkedUser(res)
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></UserButtom>
|
|
|
|
|
+ </>
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -205,7 +203,7 @@ const formSchema = ref<FormSchema[]>([
|
|
|
default: (data) => {
|
|
default: (data) => {
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- <UpImgButtom v-model={data.slide_images}></UpImgButtom>
|
|
|
|
|
|
|
+ <UpImgButtom num={3} v-model={data.slide_images}></UpImgButtom>
|
|
|
</>
|
|
</>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -303,7 +301,7 @@ const formSchema = ref<FormSchema[]>([
|
|
|
component: 'Switch'
|
|
component: 'Switch'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- field: 'detail_address',
|
|
|
|
|
|
|
+ field: 'detailed_address',
|
|
|
label: '省市区地址',
|
|
label: '省市区地址',
|
|
|
colProps: {
|
|
colProps: {
|
|
|
span: 24
|
|
span: 24
|
|
@@ -315,7 +313,7 @@ const formSchema = ref<FormSchema[]>([
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<ElAutocomplete
|
|
<ElAutocomplete
|
|
|
- v-model={data.detail_address}
|
|
|
|
|
|
|
+ v-model={data.detailed_address}
|
|
|
value-key="label"
|
|
value-key="label"
|
|
|
onSelect={(val: any) => {
|
|
onSelect={(val: any) => {
|
|
|
selectAddress(val)
|
|
selectAddress(val)
|
|
@@ -373,7 +371,6 @@ const formSchema = ref<FormSchema[]>([
|
|
|
hidden: true,
|
|
hidden: true,
|
|
|
component: 'Input'
|
|
component: 'Input'
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
field: 'id',
|
|
field: 'id',
|
|
|
label: 'id',
|
|
label: 'id',
|
|
@@ -384,6 +381,7 @@ const formSchema = ref<FormSchema[]>([
|
|
|
|
|
|
|
|
const rules = ref({
|
|
const rules = ref({
|
|
|
name: [required('请填写门店名称')],
|
|
name: [required('请填写门店名称')],
|
|
|
|
|
+ uid: [required('请选择绑定用户')],
|
|
|
introduction: [required('请填写门店简介')],
|
|
introduction: [required('请填写门店简介')],
|
|
|
phone: [required('请填写联系号码')],
|
|
phone: [required('请填写联系号码')],
|
|
|
logo: [required('请选择logo')],
|
|
logo: [required('请选择logo')],
|
|
@@ -392,10 +390,11 @@ const rules = ref({
|
|
|
valid_range: [required('请填写有效距离')],
|
|
valid_range: [required('请填写有效距离')],
|
|
|
store_account: [required('请填写登录账号')],
|
|
store_account: [required('请填写登录账号')],
|
|
|
store_password: [required('请填写登录密码')],
|
|
store_password: [required('请填写登录密码')],
|
|
|
- detail_address: [
|
|
|
|
|
|
|
+ detailed_address: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
|
validator: (_, val, callback) => {
|
|
validator: (_, val, callback) => {
|
|
|
|
|
+ console.log(actionAddress.value, val, 'actionAddress.value')
|
|
|
if (!actionAddress.value || !val) {
|
|
if (!actionAddress.value || !val) {
|
|
|
callback(new Error('请选择地址'))
|
|
callback(new Error('请选择地址'))
|
|
|
} else {
|
|
} else {
|
|
@@ -425,6 +424,12 @@ watch(
|
|
|
async (value) => {
|
|
async (value) => {
|
|
|
if (!value) return
|
|
if (!value) return
|
|
|
const currentRow = cloneDeep(value)
|
|
const currentRow = cloneDeep(value)
|
|
|
|
|
+ actionAddress.value = {
|
|
|
|
|
+ adcode: currentRow.area,
|
|
|
|
|
+ label: currentRow.detail_address,
|
|
|
|
|
+ lng: currentRow.longitude,
|
|
|
|
|
+ lat: currentRow.latitude
|
|
|
|
|
+ }
|
|
|
setValues(currentRow)
|
|
setValues(currentRow)
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -464,5 +469,4 @@ defineExpose({
|
|
|
}"
|
|
}"
|
|
|
/>
|
|
/>
|
|
|
</TlbsMap>
|
|
</TlbsMap>
|
|
|
- <UserList v-model="showDrawer" @confirm="checkedUser" />
|
|
|
|
|
</template>
|
|
</template>
|