add
This commit is contained in:
parent
3ae0e73592
commit
239f86d81c
|
@ -63,4 +63,4 @@
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56"></script>
|
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7"></script>
|
||||||
|
|
|
@ -72,11 +72,11 @@
|
||||||
</el-tab-pane> -->
|
</el-tab-pane> -->
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<!-- <template #footer>
|
||||||
<div style="flex: auto">
|
<div style="flex: auto">
|
||||||
<el-button type="primary" @click="showDetail = false">确定</el-button>
|
<el-button type="primary" @click="showDetail = false">确定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template> -->
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<slot>{{ content }}</slot>
|
<slot>{{ content }}</slot>
|
||||||
<!-- 底部弹窗页脚 -->
|
<!-- 底部弹窗页脚 -->
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer" v-if="showFooter">
|
||||||
<el-button v-if="cancelButtonText" @click="handleEvent('cancel')">
|
<el-button v-if="cancelButtonText" @click="handleEvent('cancel')">
|
||||||
{{ cancelButtonText }}
|
{{ cancelButtonText }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -74,6 +74,10 @@ export default defineComponent({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
showFooter: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
customClass: {
|
customClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<template>
|
||||||
|
<!-- <el-table :data="props.lists"> -->
|
||||||
|
<el-table :data="[{}]">
|
||||||
|
<el-table-column :label="item.label" :prop="item.prop" show-overflow-tooltip v-for="item in column" />
|
||||||
|
</el-table>
|
||||||
|
<div class="flex mt-4 justify-end">
|
||||||
|
<pagination v-model="pager" @change="getLists" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="manageProjectLists">
|
||||||
|
import { ref, reactive, defineProps } from "vue"
|
||||||
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
let props = defineProps({
|
||||||
|
fetchApi: {
|
||||||
|
type: Function
|
||||||
|
},
|
||||||
|
column: {
|
||||||
|
type: Array,
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 分页相关
|
||||||
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||||
|
fetchFun: props.fetchApi,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// getLists()
|
||||||
|
</script>
|
|
@ -0,0 +1,71 @@
|
||||||
|
<template>
|
||||||
|
<popup ref="popupRef" title="店员详情" :async="true" width="50vw" @close="close" :show-footer="false">
|
||||||
|
<div class="flex">
|
||||||
|
<el-avatar shape="circle" :size="70"
|
||||||
|
src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
|
||||||
|
<el-row class="w-[100%] ml-4">
|
||||||
|
<el-col :span="24">你干嘛</el-col>
|
||||||
|
<el-col :span="7">收银订单:¥200.00</el-col>
|
||||||
|
<el-col :span="7">核销订单:¥200.00</el-col>
|
||||||
|
<el-col :span="7">配送订单:¥200.00</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-tabs tab-position="left" style="height: 200px" class="demo-tabs mt-8">
|
||||||
|
<el-tab-pane label="收银订单">
|
||||||
|
<myTable :column="datas.moneyLists"></myTable>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="配送订单">
|
||||||
|
<myTable :column="datas.moneyLists"></myTable>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="核销订单">
|
||||||
|
<myTable :column="datas.moneyLists"></myTable>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</popup>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import myTable from './components/myTable.vue';
|
||||||
|
|
||||||
|
|
||||||
|
const popupRef = ref(null)
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
const open = () => {
|
||||||
|
popupRef.value?.open()
|
||||||
|
}
|
||||||
|
const close = () => {
|
||||||
|
emit('close')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const datas = reactive({
|
||||||
|
moneyLists: [
|
||||||
|
{ label: '订单id', prop: 'orderid' },
|
||||||
|
{ label: '收货人', prop: 'orderid' },
|
||||||
|
{ label: '商品数量', prop: 'orderid' },
|
||||||
|
{ label: '商品总价', prop: 'orderid' },
|
||||||
|
{ label: '实付金额', prop: 'orderid' },
|
||||||
|
{ label: '交易完成时间', prop: 'orderid' },
|
||||||
|
],
|
||||||
|
sendLists: [
|
||||||
|
{ label: '订单id', prop: 'orderid' },
|
||||||
|
{ label: '收货人', prop: 'orderid' },
|
||||||
|
{ label: '商品数量', prop: 'orderid' },
|
||||||
|
{ label: '商品总价', prop: 'orderid' },
|
||||||
|
{ label: '实付金额', prop: 'orderid' },
|
||||||
|
{ label: '交易完成时间', prop: 'orderid' },
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
|
||||||
|
@close="handleClose">
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
<el-form-item label="店员名称" prop="title">
|
<el-form-item label="店员名称" prop="title">
|
||||||
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
|
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||||
|
<DetailPopup v-if="showDetail" ref="detailRef" @close="showEdit = false" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -77,10 +78,13 @@ import { ref, reactive } from "vue"
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import { apiGoodsListLists, apiStatus, apiGoodsTypeLists } from '@/api/goodsList'
|
import { apiGoodsListLists, apiStatus, apiGoodsTypeLists } from '@/api/goodsList'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
|
import DetailPopup from './detail.vue'
|
||||||
|
|
||||||
|
const detailRef = ref(null)
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
|
const showDetail = ref(false)
|
||||||
|
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
|
@ -134,8 +138,14 @@ const handleAdd = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDetail = () => {
|
const handleDetail = () => {
|
||||||
|
showDetail.value = true
|
||||||
|
nextTick(() => {
|
||||||
|
detailRef.value?.open()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getLists()
|
getLists()
|
||||||
</script>
|
</script>
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="60vw" @confirm="handleSubmit" @close="handleClose">
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="60vw" @confirm="handleSubmit"
|
||||||
|
@close="handleClose">
|
||||||
<el-table :data="pager.lists">
|
<el-table :data="pager.lists">
|
||||||
<el-table-column label="图片" prop="build_area_text" show-overflow-tooltip>
|
<el-table-column label="图片" prop="build_area_text" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
@ -12,11 +13,12 @@
|
||||||
<el-table-column label="入库数量" prop="engineering_status_text" show-overflow-tooltip width="400">
|
<el-table-column label="入库数量" prop="engineering_status_text" show-overflow-tooltip width="400">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div style=" padding:0 10px;display: flex;align-items: center;">
|
<div style=" padding:0 10px;display: flex;align-items: center;">
|
||||||
|
<el-input v-model="row.number" clearable placeholder="入库数量" class="w-[200px] mr-2"
|
||||||
|
type="number" />
|
||||||
<el-radio-group v-model="row.type">
|
<el-radio-group v-model="row.type">
|
||||||
<el-radio :label="1">增加</el-radio>
|
<el-radio :label="1">增加</el-radio>
|
||||||
<el-radio :label="0">减少</el-radio>
|
<el-radio :label="0">减少</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<el-input v-model="row.number" clearable placeholder="入库数量" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,7 +27,7 @@
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="manageProjectEdit">
|
<script lang="ts" setup name="manageProjectEdit">
|
||||||
import Popup from '@/components/popup/index.vue'
|
import Popup from '@/components/popup/index.vue'
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
@ -65,9 +67,8 @@ const getTableLists = (query: any) => {
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
let { unique, type, number } = pager.lists[0]
|
let attrs = pager.lists.map(item => { return { unique: item.unique, type: item.type, number: item.number } })
|
||||||
await apiStoreProductStock({ unique, type, number })
|
await apiStoreProductStock({ attrs })
|
||||||
return
|
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,5 +91,4 @@ defineExpose({
|
||||||
open,
|
open,
|
||||||
getTableLists
|
getTableLists
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div class="w-[600px]">
|
<div class="w-[800px]">
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
<el-tabs v-model="activeName" class="demo-tabs">
|
<el-tabs v-model="activeName" class="demo-tabs">
|
||||||
<el-tab-pane label="基础设置" name="first">
|
<el-tab-pane label="基础设置" name="first">
|
||||||
|
@ -14,8 +14,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="-" start-placeholder="开始时间"
|
<el-time-picker v-model="formData.times" is-range range-separator="-"
|
||||||
end-placeholder="结束时间" value-format="HH:mm:ss" />
|
start-placeholder="开始时间" 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>
|
||||||
|
@ -53,9 +53,7 @@
|
||||||
<el-input-number v-model="formData.num" :step="1" />
|
<el-input-number v-model="formData.num" :step="1" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="门店详细地址" prop="title">
|
<el-form-item label="门店详细地址" prop="title">
|
||||||
<!-- <el-input v-model="formData.title" clearable placeholder="请输入手机号码" /> -->
|
<myMap></myMap>
|
||||||
<!-- <myMap></myMap> -->
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
{{ dataMap.latitude }}-{{ dataMap.lngitude }}
|
||||||
|
<div class="mb-6">
|
||||||
<el-autocomplete v-model="address" :fetch-suggestions="querySearch" placeholder="请输入详细地址"
|
<el-autocomplete v-model="address" :fetch-suggestions="querySearch" placeholder="请输入详细地址"
|
||||||
:trigger-on-focus="false" />
|
:trigger-on-focus="false" />
|
||||||
<el-button type="primary" @click="getLocations">
|
<!-- <el-button type="primary" @click="getLocations">
|
||||||
|
搜索
|
||||||
|
</el-button> -->
|
||||||
|
<el-button type="primary" @click="setMarkerBylatLon(30.629673, 103.775231)">
|
||||||
搜索
|
搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="amp-container" />
|
<div id="amp-container" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineComponent, onMounted, reactive, ref, toRefs, inject } from 'vue';
|
import { onMounted, reactive, ref, } from 'vue';
|
||||||
import { jsonp } from "vue-jsonp"
|
import { jsonp } from "vue-jsonp"
|
||||||
|
|
||||||
// jsonp('https://apis.map.qq.com/ws/location/v1/ip?ip=111.206.145.41&key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&output=jsonp').then(res => {
|
|
||||||
// console.log(res)
|
|
||||||
// })
|
|
||||||
const $api: any = inject("$api");
|
|
||||||
const dataMap = reactive({
|
const dataMap = reactive({
|
||||||
map: '',
|
map: '',
|
||||||
markerLayer: '',
|
markerLayer: '',
|
||||||
|
@ -33,7 +34,7 @@ const init = () => {
|
||||||
let center = new TMap.LatLng(dataMap.latitude, dataMap.lngitude);
|
let center = new TMap.LatLng(dataMap.latitude, dataMap.lngitude);
|
||||||
dataMap.map = new TMap.Map(document.getElementById('amp-container'), {
|
dataMap.map = new TMap.Map(document.getElementById('amp-container'), {
|
||||||
center: center,//设置地图中心点坐标
|
center: center,//设置地图中心点坐标
|
||||||
zoom: 11, //设置地图缩放级别
|
// zoom: 11, //设置地图缩放级别
|
||||||
viewMode: '2D'
|
viewMode: '2D'
|
||||||
});
|
});
|
||||||
(dataMap.map as any).on('click', clickHandler); // 绑定点击地图获取地理位置的事件
|
(dataMap.map as any).on('click', clickHandler); // 绑定点击地图获取地理位置的事件
|
||||||
|
@ -52,29 +53,41 @@ const reloadMap = () => {
|
||||||
};
|
};
|
||||||
const getLocation = async () => {
|
const getLocation = async () => {
|
||||||
try {
|
try {
|
||||||
let params = {
|
jsonp('https://apis.map.qq.com/ws/location/v1/ip?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&output=jsonp').then(res => {
|
||||||
// ip:(window as any ).returnCitySN['cip'],
|
if (res.result) {
|
||||||
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56",
|
dataMap.latitude = res.result.location.lat;
|
||||||
};
|
dataMap.lngitude = res.result.location.lng;
|
||||||
let { result } = await $api.cerStores.getLoaction(params);
|
// dataMap.latitude = 30.629673;
|
||||||
// 发起一个post请求
|
// dataMap.lngitude = 103.775231;
|
||||||
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
reloadMap();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
dataMap.latitude = result.location.lat;
|
|
||||||
dataMap.lngitude = result.location.lng;
|
|
||||||
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
|
||||||
reloadMap();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setMarkerBylatLon = (lat, lng) => {
|
||||||
|
dataMap.latitude = lat;
|
||||||
|
dataMap.lngitude = lng;
|
||||||
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
reloadMap();
|
||||||
|
}
|
||||||
|
|
||||||
// 点击获取经纬度
|
// 点击获取经纬度
|
||||||
const clickHandler = (evt: any) => {
|
const clickHandler = (evt: any) => {
|
||||||
|
let lavting = evt.latLng
|
||||||
|
console.log(lavting.getLat(), lavting.getLng())
|
||||||
|
return
|
||||||
|
|
||||||
|
setMarkerBylatLon(evt.latLng.lat.toFixed(4), evt.latLng.lng.toFixed(4))
|
||||||
|
return
|
||||||
dataMap.latitude = evt.latLng.getLat().toFixed(6);
|
dataMap.latitude = evt.latLng.getLat().toFixed(6);
|
||||||
dataMap.lngitude = evt.latLng.getLng().toFixed(6);
|
dataMap.lngitude = evt.latLng.getLng().toFixed(6);
|
||||||
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
// (dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
reloadMap();
|
reloadMap();
|
||||||
};
|
};
|
||||||
//标记地图
|
//标记地图
|
||||||
|
@ -107,11 +120,7 @@ const address = ref('');
|
||||||
// 获取搜索经纬度
|
// 获取搜索经纬度
|
||||||
const getLocations = async () => {
|
const getLocations = async () => {
|
||||||
try {
|
try {
|
||||||
let params = {
|
let { result } = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${address.value}&output=jsonp`);
|
||||||
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56", // 填申请到的腾讯key
|
|
||||||
address: address.value, //具体的地址
|
|
||||||
};
|
|
||||||
let { result } = await $api.cerStores.getGeocoder(params);
|
|
||||||
dataMap.latitude = result.location.lat;
|
dataMap.latitude = result.location.lat;
|
||||||
dataMap.lngitude = result.location.lng;
|
dataMap.lngitude = result.location.lng;
|
||||||
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
@ -126,7 +135,8 @@ const querySearch = async (queryString: string, cb: any) => {
|
||||||
keyword: queryString,
|
keyword: queryString,
|
||||||
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56", // 填申请到的腾讯key
|
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56", // 填申请到的腾讯key
|
||||||
};
|
};
|
||||||
let { data } = await $api.cerStores.getSuggestion(params);
|
|
||||||
|
let { data } = await jsonp(`https://apis.map.qq.com/ws/place/v1/suggestion/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&keyword=${queryString}&output=jsonp`);
|
||||||
const results = data.map((item: any) => {
|
const results = data.map((item: any) => {
|
||||||
let obj = {
|
let obj = {
|
||||||
value: item.address,
|
value: item.address,
|
||||||
|
|
|
@ -0,0 +1,213 @@
|
||||||
|
<template>
|
||||||
|
<el-card>
|
||||||
|
<div class="w-[600px]">
|
||||||
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
|
<el-tabs v-model="activeName" class="demo-tabs">
|
||||||
|
<el-tab-pane label="基础设置" name="first">
|
||||||
|
<el-form-item label="门店名称" prop="title">
|
||||||
|
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="门店手机号" prop="title">
|
||||||
|
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营业状态" prop="title">
|
||||||
|
<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-form-item>
|
||||||
|
<el-form-item label="门店地址" prop="title">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-select class="flex-1" v-model="formData.city_id" clearable placeholder="请选择"
|
||||||
|
@change="getCityList(formData.province_id, false)">
|
||||||
|
<el-option v-for="(item, index) in address.provinceList" :key="index"
|
||||||
|
:label="item.province_name" :value="parseInt(item.province_code)" />
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-select class="flex-1" v-model="formData.city_id" clearable placeholder="请选择"
|
||||||
|
@change="getAreaList(formData.city_id, false)">
|
||||||
|
<el-option v-for="(item, index) in address.cityList" :key="index"
|
||||||
|
:label="item.city_name" :value="parseInt(item.city_code)" />
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-select class="flex-1" v-model="formData.area_id" clearable placeholder="请选择"
|
||||||
|
@change="getTownList(formData.area_id, false)">
|
||||||
|
<el-option v-for="(item, index) in address.areaList" :key="index"
|
||||||
|
:label="item.area_name" :value="parseInt(item.area_code)" />
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-select class="flex-1" v-model="formData.street_id" clearable placeholder="请选择"
|
||||||
|
@change="getVilllageList(formData.street_id, false)">
|
||||||
|
<el-option v-for="(item, index) in address.townList" :key="index"
|
||||||
|
:label="item.street_name" :value="parseInt(item.street_code)" />
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="配送范围(km)" prop="title">
|
||||||
|
<el-input-number v-model="formData.num" :step="1" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="门店详细地址" prop="title">
|
||||||
|
<!-- <el-input v-model="formData.title" clearable placeholder="请输入手机号码" /> -->
|
||||||
|
<!-- <myMap></myMap> -->
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<el-tab-pane label="配送设置" name="second">
|
||||||
|
<el-form-item label="同城配送" prop="title">
|
||||||
|
<el-switch v-model="formData.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="到店自提" prop="title">
|
||||||
|
<el-switch v-model="formData.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="默认配送方式" prop="title">
|
||||||
|
<el-radio-group v-model="formData.types" class="ml-4">
|
||||||
|
<el-radio label="1" size="large">配送</el-radio>
|
||||||
|
<el-radio label="2" size="large">自提</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="oaPlanEdit">
|
||||||
|
import type { FormInstance } from 'element-plus'
|
||||||
|
import { timeFormat } from '@/utils/util'
|
||||||
|
import { apicityLists, apiAreaLists, apiStreetLists, apigetProvinceLists } from "@/api/address"
|
||||||
|
import myMap from "./myMap/index.vue"
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
//
|
||||||
|
const formRef = shallowRef<FormInstance>()
|
||||||
|
const activeName = ref('first')
|
||||||
|
// 地址
|
||||||
|
const address = reactive({
|
||||||
|
provinceList: [],
|
||||||
|
cityList: [],
|
||||||
|
areaList: [],
|
||||||
|
townList: [],
|
||||||
|
})
|
||||||
|
// 表单数据
|
||||||
|
const formData = reactive({
|
||||||
|
id: '',
|
||||||
|
status: 0,
|
||||||
|
title: '',
|
||||||
|
province_id: '510000',
|
||||||
|
city_id: '',
|
||||||
|
area_id: '',
|
||||||
|
street_id: '',
|
||||||
|
types: '1',
|
||||||
|
times: '',
|
||||||
|
num: "",
|
||||||
|
start_time: '',
|
||||||
|
end_time: '',
|
||||||
|
remind_type: '',
|
||||||
|
remark: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const chekcDate = (rule: any, value: any, callback: any) => {
|
||||||
|
if (new Date(formData.end_time) < new Date(formData.start_time)) {
|
||||||
|
callback(new Error('结束时间不能早于开始时间'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单验证
|
||||||
|
const formRules = reactive<any>({
|
||||||
|
end_time: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入结束时间',
|
||||||
|
trigger: ['blur']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: chekcDate,
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
|
remind_type: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入提醒类型',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 获取详情
|
||||||
|
const setFormData = async (data: Record<any, any>) => {
|
||||||
|
for (const key in formData) {
|
||||||
|
if (data[key] != null && data[key] != undefined) {
|
||||||
|
//@ts-ignore
|
||||||
|
formData[key] = data[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 提交按钮
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
await formRef.value?.validate()
|
||||||
|
const data = { ...formData, }
|
||||||
|
// mode.value == 'edit'
|
||||||
|
// ? await apiOaPlanEdit(data)
|
||||||
|
// : await apiOaPlanAdd(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProvinceList = async (isAsync: Boolean) => {
|
||||||
|
let res = await apigetProvinceLists()
|
||||||
|
address.provinceList = res
|
||||||
|
if (isAsync) {
|
||||||
|
return Promise.resolve({
|
||||||
|
msg: '获取成功'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const getCityList = async (province_code: number | String, isAsync: Boolean) => {
|
||||||
|
let res = await apicityLists({ province_code })
|
||||||
|
address.cityList = res
|
||||||
|
if (isAsync) {
|
||||||
|
return Promise.resolve({
|
||||||
|
msg: '获取成功'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const getAreaList = async (city_code: number | String, isAsync: Boolean) => {
|
||||||
|
let res = await apiAreaLists({ city_code })
|
||||||
|
address.areaList = res
|
||||||
|
if (isAsync) {
|
||||||
|
return Promise.resolve({
|
||||||
|
msg: '获取成功'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const getTownList = async (area_code: number | String, isAsync: Boolean) => {
|
||||||
|
let res = await apiStreetLists({ area_code })
|
||||||
|
address.townList = res
|
||||||
|
if (isAsync) {
|
||||||
|
return Promise.resolve({
|
||||||
|
msg: '获取成功'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// getProvinceList(false)
|
||||||
|
</script>
|
|
@ -0,0 +1,144 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<el-autocomplete v-model="address" :fetch-suggestions="querySearch" placeholder="请输入详细地址"
|
||||||
|
:trigger-on-focus="false" />
|
||||||
|
<el-button type="primary" @click="getLocations">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div id="amp-container" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { defineComponent, onMounted, reactive, ref, toRefs, inject } from 'vue';
|
||||||
|
import { jsonp } from "vue-jsonp"
|
||||||
|
|
||||||
|
// jsonp('https://apis.map.qq.com/ws/location/v1/ip?ip=111.206.145.41&key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&output=jsonp').then(res => {
|
||||||
|
// console.log(res)
|
||||||
|
// })
|
||||||
|
const $api: any = inject("$api");
|
||||||
|
const dataMap = reactive({
|
||||||
|
map: '',
|
||||||
|
markerLayer: '',
|
||||||
|
latitude: '', //纬度
|
||||||
|
lngitude: '', //经度
|
||||||
|
});
|
||||||
|
const TMap = (window as any).TMap;
|
||||||
|
onMounted(() => {
|
||||||
|
init();
|
||||||
|
getLocation();
|
||||||
|
});
|
||||||
|
const init = () => {
|
||||||
|
let center = new TMap.LatLng(dataMap.latitude, dataMap.lngitude);
|
||||||
|
dataMap.map = new TMap.Map(document.getElementById('amp-container'), {
|
||||||
|
center: center,//设置地图中心点坐标
|
||||||
|
zoom: 11, //设置地图缩放级别
|
||||||
|
viewMode: '2D'
|
||||||
|
});
|
||||||
|
(dataMap.map as any).on('click', clickHandler); // 绑定点击地图获取地理位置的事件
|
||||||
|
markerLayer(); // 标记地图
|
||||||
|
};
|
||||||
|
// 重载地图
|
||||||
|
const reloadMap = () => {
|
||||||
|
(document.getElementById('amp-container') as any).innerHTML = '';
|
||||||
|
dataMap.markerLayer = '';
|
||||||
|
let center = new TMap.LatLng(dataMap.latitude, dataMap.lngitude);
|
||||||
|
dataMap.map = new TMap.Map(document.getElementById('amp-container'), {
|
||||||
|
center: center,//设置地图中心点坐标
|
||||||
|
viewMode: '2D'
|
||||||
|
});
|
||||||
|
markerLayer();
|
||||||
|
};
|
||||||
|
const getLocation = async () => {
|
||||||
|
try {
|
||||||
|
let params = {
|
||||||
|
// ip:(window as any ).returnCitySN['cip'],
|
||||||
|
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56",
|
||||||
|
};
|
||||||
|
let { result } = await $api.cerStores.getLoaction(params);
|
||||||
|
// 发起一个post请求
|
||||||
|
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
dataMap.latitude = result.location.lat;
|
||||||
|
dataMap.lngitude = result.location.lng;
|
||||||
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
reloadMap();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 点击获取经纬度
|
||||||
|
const clickHandler = (evt: any) => {
|
||||||
|
dataMap.latitude = evt.latLng.getLat().toFixed(6);
|
||||||
|
dataMap.lngitude = evt.latLng.getLng().toFixed(6);
|
||||||
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
reloadMap();
|
||||||
|
};
|
||||||
|
//标记地图
|
||||||
|
const markerLayer = () => {
|
||||||
|
dataMap.markerLayer = new TMap.MultiMarker({
|
||||||
|
map: dataMap.map, //指定地图容器
|
||||||
|
//样式定义
|
||||||
|
styles: {
|
||||||
|
//创建一个styleId为"myStyle"的样式(styles的子属性名即为styleId)
|
||||||
|
"myStyle": new TMap.MarkerStyle({
|
||||||
|
"width": 25, // 点标记样式宽度(像素)
|
||||||
|
"height": 35, // 点标记样式高度(像素)
|
||||||
|
// "src": '../../assets/logo.png', //图片路径
|
||||||
|
'background': 'pink',
|
||||||
|
//焦点在图片中的像素位置,一般大头针类似形式的图片以针尖位置做为焦点,圆形点以圆心位置为焦点
|
||||||
|
"anchor": { x: 16, y: 32 }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//点标记数据数组
|
||||||
|
geometries: [
|
||||||
|
{
|
||||||
|
"id": "1", //点标记唯一标识,后续如果有删除、修改位置等操作,都需要此id
|
||||||
|
"styleId": 'myStyle', //指定样式id
|
||||||
|
"position": new TMap.LatLng(dataMap.latitude, dataMap.lngitude), //点标记坐标位置
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const address = ref('');
|
||||||
|
// 获取搜索经纬度
|
||||||
|
const getLocations = async () => {
|
||||||
|
try {
|
||||||
|
let params = {
|
||||||
|
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56", // 填申请到的腾讯key
|
||||||
|
address: address.value, //具体的地址
|
||||||
|
};
|
||||||
|
let { result } = await $api.cerStores.getGeocoder(params);
|
||||||
|
dataMap.latitude = result.location.lat;
|
||||||
|
dataMap.lngitude = result.location.lng;
|
||||||
|
(dataMap.map as any).setCenter(new TMap.LatLng(dataMap.latitude, dataMap.lngitude));
|
||||||
|
reloadMap();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const querySearch = async (queryString: string, cb: any) => {
|
||||||
|
try {
|
||||||
|
let params = {
|
||||||
|
keyword: queryString,
|
||||||
|
key: "V4LBZ-UKCHA-EUNK7-CUH4F-HOXVO-YTF56", // 填申请到的腾讯key
|
||||||
|
};
|
||||||
|
let { data } = await $api.cerStores.getSuggestion(params);
|
||||||
|
const results = data.map((item: any) => {
|
||||||
|
let obj = {
|
||||||
|
value: item.address,
|
||||||
|
address: item.address
|
||||||
|
};
|
||||||
|
return obj;
|
||||||
|
});
|
||||||
|
cb(results);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
Loading…
Reference in New Issue