更新接口路径,调整配置,优化用户及订单管理功能,并修复部分bug

This commit is contained in:
zmj 2024-06-07 09:43:24 +08:00
parent c5a70e321e
commit 7446d2c97f
3 changed files with 55 additions and 50 deletions

View File

@ -1,21 +1,8 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="分配权限"
:async="true"
width="550px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form
class="ls-form"
ref="formRef"
:rules="rules"
:model="formData"
label-width="60px"
v-loading="loading"
>
<popup ref="popupRef" title="分配权限" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<div>多门店后台</div>
<el-form class="ls-form" ref="formRef" :rules="rules" :model="formData" label-width="60px" v-loading="loading">
<el-scrollbar class="h-[400px] sm:h-[600px]">
<el-form-item label="权限" prop="menu_id">
<div>
@ -23,23 +10,35 @@
<el-checkbox label="全选/不全选" @change="handleSelectAll" />
<el-checkbox v-model="checkStrictly" label="父子联动" />
<div>
<el-tree
ref="treeRef"
:data="menuTree"
:props="{
label: 'name',
children: 'children'
}"
:check-strictly="!checkStrictly"
node-key="id"
:default-expand-all="isExpand"
show-checkbox
/>
<el-tree ref="treeRef" :data="menuTree" :props="{
label: 'name',
children: 'children'
}" :check-strictly="!checkStrictly" node-key="id" :default-expand-all="isExpand"
show-checkbox />
</div>
</div>
</el-form-item>
</el-scrollbar>
</el-form>
<!-- <div>收银系统</div>
<el-form class="ls-form" ref="formRef" :rules="rules" :model="formData" label-width="60px" v-loading="loading">
<el-scrollbar class="h-[400px] sm:h-[600px]">
<el-form-item label="权限" prop="menu_id">
<div>
<el-checkbox label="展开/折叠" @change="handleExpand" />
<el-checkbox label="全选/不全选" @change="handleSelectAll" />
<el-checkbox v-model="checkStrictly" label="父子联动" />
<div>
<el-tree ref="treeRef" :data="menuTree" :props="{
label: 'name',
children: 'children'
}" :check-strictly="!checkStrictly" node-key="id" :default-expand-all="isExpand"
show-checkbox />
</div>
</div>
</el-form-item>
</el-scrollbar>
</el-form> -->
</popup>
</div>
</template>

View File

@ -15,8 +15,8 @@
<el-switch v-model="formData.status" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="营业时间" prop="title">
<el-time-picker v-model="formData.times" is-range range-separator="-"
start-placeholder="开始时间" end-placeholder="结束时间" value-format="HH:mm:ss" />
<el-time-picker v-model="formData.times" is-range range-separator="-" start-placeholder="开始时间"
end-placeholder="结束时间" value-format="HH:mm:ss" />
</el-form-item>
<el-form-item label="门店地址" prop="title">
<el-row>
@ -100,6 +100,8 @@ const formData = reactive({
city_id: '',
area_id: '',
street_id: '',
address: "",
title: "",
lat: "",
lng: "",
range: '1',

View File

@ -1,32 +1,34 @@
<template>
<el-autocomplete class="w-[500px]" v-model="locationInfo.title" @select="handleSelect"
:fetch-suggestions="querySearch" placeholder="请输入详细地址" :trigger-on-focus="false" />
<el-autocomplete class="w-[500px]" v-model="formData.title" @select="handleSelect" :fetch-suggestions="querySearch"
placeholder="请输入详细地址" :trigger-on-focus="false" />
<el-button type="primary" @click="getLocationByAddress">搜索</el-button>
<el-button type="primary" @click="getLocation">当前位置</el-button>
<div id="myMap" class="w-[100%] h-[100%]"></div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue"
import { ref, onMounted, defineProps } from "vue"
import { jsonp } from "vue-jsonp"
import feedback from '@/utils/feedback'
let myMap: any = null //
var markerLayer: any = null //
var geocoder: any = null; //
let locationInfo = ref({
address: "",
title: "",
lat: "",
lng: ""
const props = defineProps({
formData: {
type: Object,
},
})
// let locationInfo = ref({
// address: "",
// title: "",
// lat: "",
// lng: ""
// })
const initMap = () => {
var center = new window.TMap.LatLng(30.629673, 103.775231)
var center = new window.TMap.LatLng(props.formData.lat, props.formData.lng)
myMap = new window.TMap.Map(document.getElementById('myMap'), {
center: center,
zoom: 15,
@ -37,6 +39,7 @@ const initMap = () => {
map: myMap
});
geocoder = new window.TMap.service.Geocoder()
if (!props.formData.lat) getLocation()
}
@ -69,8 +72,9 @@ const setMarker = async (lat: number, lng: number, isSelect: Boolean = false) =>
if (isSelect) return
var location = new window.TMap.LatLng(lat, lng);
let res = await geocoder.getAddress({ location: location })
locationInfo.value.address = res.result.address
locationInfo.value.title = res.result.formatted_addresses.recommend
console.log(res, 'res')
props.formData.address = res.result.address
props.formData.title = res.result.formatted_addresses.recommend
}
@ -87,17 +91,17 @@ const querySearch = async (queryString: string, cb: any) => {
}
};
const handleSelect = (e) => {
locationInfo.value.title = e.title
locationInfo.value.address = e.address
locationInfo.value.address = e.address
locationInfo.value.lat = e.location.lat
locationInfo.value.lng = e.location.lng
props.formData.title = e.title
props.formData.address = e.address
props.formData.address = e.address
props.formData.lat = e.location.lat
props.formData.lng = e.location.lng
setMarker(e.location.lat, e.location.lng, true)
}
//
const getLocationByAddress = async () => {
let res = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${locationInfo.value.address}&output=jsonp`);
let res = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${props.formData.address}&output=jsonp`);
if (!res.result) return feedback.msgError("位置搜索失败,请重新输入或手动选择")
setMarker(res.result.location.lat, res.result.location.lng)
}