更新接口路径,调整配置,优化用户及订单管理功能,并修复部分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> <template>
<div class="edit-popup"> <div class="edit-popup">
<popup <popup ref="popupRef" title="分配权限" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
ref="popupRef" <div>多门店后台</div>
title="分配权限" <el-form class="ls-form" ref="formRef" :rules="rules" :model="formData" label-width="60px" v-loading="loading">
: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"
>
<el-scrollbar class="h-[400px] sm:h-[600px]"> <el-scrollbar class="h-[400px] sm:h-[600px]">
<el-form-item label="权限" prop="menu_id"> <el-form-item label="权限" prop="menu_id">
<div> <div>
@ -23,23 +10,35 @@
<el-checkbox label="全选/不全选" @change="handleSelectAll" /> <el-checkbox label="全选/不全选" @change="handleSelectAll" />
<el-checkbox v-model="checkStrictly" label="父子联动" /> <el-checkbox v-model="checkStrictly" label="父子联动" />
<div> <div>
<el-tree <el-tree ref="treeRef" :data="menuTree" :props="{
ref="treeRef" label: 'name',
:data="menuTree" children: 'children'
:props="{ }" :check-strictly="!checkStrictly" node-key="id" :default-expand-all="isExpand"
label: 'name', show-checkbox />
children: 'children'
}"
:check-strictly="!checkStrictly"
node-key="id"
:default-expand-all="isExpand"
show-checkbox
/>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
</el-scrollbar> </el-scrollbar>
</el-form> </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> </popup>
</div> </div>
</template> </template>

View File

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

View File

@ -1,32 +1,34 @@
<template> <template>
<el-autocomplete class="w-[500px]" v-model="locationInfo.title" @select="handleSelect" <el-autocomplete class="w-[500px]" v-model="formData.title" @select="handleSelect" :fetch-suggestions="querySearch"
:fetch-suggestions="querySearch" placeholder="请输入详细地址" :trigger-on-focus="false" /> placeholder="请输入详细地址" :trigger-on-focus="false" />
<el-button type="primary" @click="getLocationByAddress">搜索</el-button> <el-button type="primary" @click="getLocationByAddress">搜索</el-button>
<el-button type="primary" @click="getLocation">当前位置</el-button> <el-button type="primary" @click="getLocation">当前位置</el-button>
<div id="myMap" class="w-[100%] h-[100%]"></div> <div id="myMap" class="w-[100%] h-[100%]"></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from "vue" import { ref, onMounted, defineProps } from "vue"
import { jsonp } from "vue-jsonp" import { jsonp } from "vue-jsonp"
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
let myMap: any = null // let myMap: any = null //
var markerLayer: any = null // var markerLayer: any = null //
var geocoder: any = null; // var geocoder: any = null; //
const props = defineProps({
formData: {
let locationInfo = ref({ type: Object,
address: "", },
title: "",
lat: "",
lng: ""
}) })
// let locationInfo = ref({
// address: "",
// title: "",
// lat: "",
// lng: ""
// })
const initMap = () => { 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'), { myMap = new window.TMap.Map(document.getElementById('myMap'), {
center: center, center: center,
zoom: 15, zoom: 15,
@ -37,6 +39,7 @@ const initMap = () => {
map: myMap map: myMap
}); });
geocoder = new window.TMap.service.Geocoder() 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 if (isSelect) return
var location = new window.TMap.LatLng(lat, lng); var location = new window.TMap.LatLng(lat, lng);
let res = await geocoder.getAddress({ location: location }) let res = await geocoder.getAddress({ location: location })
locationInfo.value.address = res.result.address console.log(res, 'res')
locationInfo.value.title = res.result.formatted_addresses.recommend 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) => { const handleSelect = (e) => {
locationInfo.value.title = e.title props.formData.title = e.title
locationInfo.value.address = e.address props.formData.address = e.address
locationInfo.value.address = e.address props.formData.address = e.address
locationInfo.value.lat = e.location.lat props.formData.lat = e.location.lat
locationInfo.value.lng = e.location.lng props.formData.lng = e.location.lng
setMarker(e.location.lat, e.location.lng, true) setMarker(e.location.lat, e.location.lng, true)
} }
// //
const getLocationByAddress = async () => { 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("位置搜索失败,请重新输入或手动选择") if (!res.result) return feedback.msgError("位置搜索失败,请重新输入或手动选择")
setMarker(res.result.location.lat, res.result.location.lng) setMarker(res.result.location.lat, res.result.location.lng)
} }