This commit is contained in:
zmj 2024-06-06 00:01:26 +08:00
parent 3ae0e73592
commit 239f86d81c
12 changed files with 529 additions and 47 deletions

View File

@ -63,4 +63,4 @@
<script type="module" src="/src/main.ts"></script>
</body>
</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>

View File

@ -72,11 +72,11 @@
</el-tab-pane> -->
</el-tabs>
</template>
<template #footer>
<!-- <template #footer>
<div style="flex: auto">
<el-button type="primary" @click="showDetail = false">确定</el-button>
</div>
</template>
</template> -->
</el-drawer>
</template>

View File

@ -13,7 +13,7 @@
<slot>{{ content }}</slot>
<!-- 底部弹窗页脚 -->
<template #footer>
<div class="dialog-footer">
<div class="dialog-footer" v-if="showFooter">
<el-button v-if="cancelButtonText" @click="handleEvent('cancel')">
{{ cancelButtonText }}
</el-button>
@ -74,6 +74,10 @@ export default defineComponent({
type: Boolean,
default: false
},
showFooter: {
type: Boolean,
default: true
},
customClass: {
type: String,
default: ''

View File

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

View File

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

View File

@ -1,6 +1,7 @@
<template>
<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-item label="店员名称" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入店员名称" />

View File

@ -68,6 +68,7 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
<DetailPopup v-if="showDetail" ref="detailRef" @close="showEdit = false" />
</div>
</template>
@ -77,10 +78,13 @@ import { ref, reactive } from "vue"
import { usePaging } from '@/hooks/usePaging'
import { apiGoodsListLists, apiStatus, apiGoodsTypeLists } from '@/api/goodsList'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const detailRef = ref(null)
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -134,8 +138,14 @@ const handleAdd = async () => {
}
const handleDetail = () => {
showDetail.value = true
nextTick(() => {
detailRef.value?.open()
})
}
getLists()
</script>

View File

@ -1,6 +1,7 @@
<template>
<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-column label="图片" prop="build_area_text" show-overflow-tooltip>
<template #default="{ row }">
@ -12,11 +13,12 @@
<el-table-column label="入库数量" prop="engineering_status_text" show-overflow-tooltip width="400">
<template #default="{ row }">
<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 :label="1">增加</el-radio>
<el-radio :label="0">减少</el-radio>
</el-radio-group>
<el-input v-model="row.number" clearable placeholder="入库数量" />
</div>
</template>
@ -25,7 +27,7 @@
</popup>
</div>
</template>
<script lang="ts" setup name="manageProjectEdit">
import Popup from '@/components/popup/index.vue'
import { usePaging } from '@/hooks/usePaging'
@ -65,9 +67,8 @@ const getTableLists = (query: any) => {
//
const handleSubmit = async () => {
let { unique, type, number } = pager.lists[0]
await apiStoreProductStock({ unique, type, number })
return
let attrs = pager.lists.map(item => { return { unique: item.unique, type: item.type, number: item.number } })
await apiStoreProductStock({ attrs })
emit('close')
}
@ -90,5 +91,4 @@ defineExpose({
open,
getTableLists
})
</script>
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-card>
<div class="w-[600px]">
<div class="w-[800px]">
<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">
@ -14,8 +14,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>
@ -53,9 +53,7 @@
<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> -->
<myMap></myMap>
</el-form-item>
</el-tab-pane>

View File

@ -1,23 +1,24 @@
<template>
<div>
<div>
{{ dataMap.latitude }}-{{ dataMap.lngitude }}
<div class="mb-6">
<el-autocomplete v-model="address" :fetch-suggestions="querySearch" placeholder="请输入详细地址"
: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>
</div>
<div id="amp-container" />
</div>
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, reactive, ref, toRefs, inject } from 'vue';
import { onMounted, reactive, ref, } 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: '',
@ -33,7 +34,7 @@ const init = () => {
let center = new TMap.LatLng(dataMap.latitude, dataMap.lngitude);
dataMap.map = new TMap.Map(document.getElementById('amp-container'), {
center: center,//
zoom: 11, //
// zoom: 11, //
viewMode: '2D'
});
(dataMap.map as any).on('click', clickHandler); //
@ -52,29 +53,41 @@ const reloadMap = () => {
};
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
jsonp('https://apis.map.qq.com/ws/location/v1/ip?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&output=jsonp').then(res => {
if (res.result) {
dataMap.latitude = res.result.location.lat;
dataMap.lngitude = res.result.location.lng;
// dataMap.latitude = 30.629673;
// 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) {
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) => {
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.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();
};
//
@ -107,11 +120,7 @@ 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);
let { result } = await jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&address=${address.value}&output=jsonp`);
dataMap.latitude = result.location.lat;
dataMap.lngitude = result.location.lng;
(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,
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) => {
let obj = {
value: item.address,

View File

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

View File

@ -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"stylesstyleId
"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>