no message

This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-04-26 11:11:26 +08:00
parent c233dc932c
commit cf787e136e
11 changed files with 436 additions and 322 deletions

View File

@ -4,6 +4,8 @@ import zhCn from "element-plus/es/locale/lang/zh-cn";
import useAppStore from "./stores/modules/app"; import useAppStore from "./stores/modules/app";
import useSettingStore from "./stores/modules/setting"; import useSettingStore from "./stores/modules/setting";
import { ScreenEnum } from "./enums/appEnums"; import { ScreenEnum } from "./enums/appEnums";
import { onMounted } from "vue";
const appStore = useAppStore(); const appStore = useAppStore();
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const elConfig = { const elConfig = {

View File

@ -71,7 +71,6 @@ export function merchantCategoryApi(params: any) {
return request.get({ url: '/merchant.merchant/merchantCategory', params }) return request.get({ url: '/merchant.merchant/merchantCategory', params })
} }
// 区域分类 // 区域分类
export function merchantAreaListApi(params: any) { export function merchantAreaListApi(params: any) {
return request.get({ url: '/merchant.merchant/AreatList', params }) return request.get({ url: '/merchant.merchant/AreatList', params })

View File

@ -3,7 +3,7 @@
<el-popover placement="bottom" trigger="hover" width="200px"> <el-popover placement="bottom" trigger="hover" width="200px">
<template #reference> <template #reference>
<el-badge <el-badge
:is-dot="newsList.length > 0 ? true : false" :value="newsList.length"
class="item" class="item"
style="display: flex; align-items: center; height: 100%; cursor: pointer" style="display: flex; align-items: center; height: 100%; cursor: pointer"
> >
@ -32,22 +32,24 @@
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { newList } from "@/api/merchant"; import { newList } from "@/api/merchant";
import { getRoutePath } from "@/router"; import { getRoutePath } from "@/router";
import { ref, getCurrentInstance, type ComponentInternalInstance, onMounted, onBeforeMount } from "vue"; import mitt from "@/utils/mitt";
//
mitt.on("selfEvent", (res: any) => {
getNewsList();
});
const { appContext } = getCurrentInstance() as ComponentInternalInstance;
const newsList = ref([]); const newsList = ref([]);
onMounted(()=>{ const getNewsList = () => {
appContext.config.globalProperties.$mitt.on('selfEvent',(res:any)=>{ //
console.log('执行了自定义方法') newList("").then((res: any) => {
// newsList.value = res;
newList("").then((res) => { });
newsList.value = res; };
});
}) getNewsList();
})
// //
const router = useRouter(); const router = useRouter();
const rowClick = (row: any) => { const rowClick = (row: any) => {
router.push({ router.push({
@ -55,4 +57,9 @@ const rowClick = (row: any) => {
query: { mer_ids: row.mer_ids.join(",") }, query: { mer_ids: row.mer_ids.join(",") },
}); });
}; };
router.beforeEach((a, b, c) => {
// bell
getNewsList();
c();
});
</script> </script>

5
src/utils/mitt.ts Normal file
View File

@ -0,0 +1,5 @@
import mitt from "mitt";
const mi: any = mitt();
export default mi;

View File

@ -9,22 +9,22 @@
@close="handleClose" @close="handleClose"
> >
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="店铺类型" prop="type_id"> <el-form-item label="商户分类" prop="type_id">
<el-select <el-select
class="w-[280px]" class="w-[280px]"
placeholder="请输入店铺类型" placeholder="请选择商户分类"
v-model="formData.type_id" v-model="formData.type_id"
> >
<el-option <el-option
v-for="item in merchantData" v-for="item in merchantData"
:label="item.type_name" :label="item.category_name"
:value="item.mer_type_id" :value="item.merchant_category_id"
:key="item.mer_type_id" :key="item.merchant_category_id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="店铺类型" prop="open"> <el-form-item label="状态" prop="open">
<el-switch v-model="formData.open" active-text="开启" inactive-text="关闭"> <el-switch v-model="formData.open" active-text="开启" inactive-text="关闭">
</el-switch> </el-switch>
</el-form-item> </el-form-item>
@ -41,7 +41,7 @@
<script lang="ts" setup name="cateTimeEdit"> <script lang="ts" setup name="cateTimeEdit">
import type { FormInstance } from "element-plus"; import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue"; import Popup from "@/components/popup/index.vue";
import { merchantCate } from "@/api/merchant"; import { merchantCategoryApi } from "@/api/merchant";
import { apiRecordDetail } from "@/api/record"; import { apiRecordDetail } from "@/api/record";
import { cateTimeAddApi, cateTimeEditApi } from "@/api/cate_time"; import { cateTimeAddApi, cateTimeEditApi } from "@/api/cate_time";
@ -61,12 +61,13 @@ const formData = reactive({
type_id: "", type_id: "",
time: "", time: "",
open: true, open: true,
merchant_id: "",
}); });
// //
const merchantData: any = ref([]); const merchantData: any = ref([]);
const getMerchantCate = async () => { const getMerchantCate = async () => {
merchantData.value = await merchantCate(""); merchantData.value = await merchantCategoryApi("");
}; };
// //

View File

@ -2,18 +2,18 @@
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline> <el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="店铺类型" prop="type_id"> <el-form-item label="商户分类" prop="type_id">
<el-select <el-select
placeholder="请选择商户" placeholder="请选择商户分类"
v-model="queryParams.type_id" v-model="queryParams.type_id"
class="w-[280px]" class="w-[280px]"
filterable filterable
> >
<el-option <el-option
v-for="(item, indx) in merchantData" v-for="(item, indx) in merchantData"
:key="item.mer_type_id" :key="item.merchant_category_id"
:value="item.mer_type_id + ''" :value="item.merchant_category_id + ''"
:label="item.type_name" :label="item.category_name"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -35,7 +35,7 @@
<el-table :data="pager.lists"> <el-table :data="pager.lists">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column <el-table-column
label="店铺类型" label="商户分类"
prop="cate_name" prop="cate_name"
min-width="200" min-width="200"
show-overflow-tooltip show-overflow-tooltip
@ -79,10 +79,9 @@
<script lang="ts" setup name="cateTimeList"> <script lang="ts" setup name="cateTimeList">
import { usePaging } from "@/hooks/usePaging"; import { usePaging } from "@/hooks/usePaging";
import { recordAll, recordInfo } from "@/api/record";
import { cateTimeListsApi, cateTimeDelApi } from "@/api/cate_time"; import { cateTimeListsApi, cateTimeDelApi } from "@/api/cate_time";
import feedback from "@/utils/feedback"; import feedback from "@/utils/feedback";
import { merchantCate } from "@/api/merchant"; import { merchantCategoryApi } from "@/api/merchant";
import EditPopup from "./edit.vue"; import EditPopup from "./edit.vue";
const editRef = shallowRef<InstanceType<typeof EditPopup>>(); const editRef = shallowRef<InstanceType<typeof EditPopup>>();
@ -125,7 +124,7 @@ const handleDelete = async (id: number | any[]) => {
// //
const merchantData: any = ref([]); const merchantData: any = ref([]);
const getMerchantCate = async () => { const getMerchantCate = async () => {
merchantData.value = await merchantCate(""); merchantData.value = await merchantCategoryApi("");
}; };
getMerchantCate(); getMerchantCate();

View File

@ -24,88 +24,7 @@
label-width="100px" label-width="100px"
:rules="rules" :rules="rules"
> >
<div class="form-wrap"> <div class="form-wrap"></div>
<el-form-item label="商户名称" prop="mer_name">
<el-input
class="w-80"
v-model="formData.mer_name"
placeholder="请输入商户名称"
clearable
/>
</el-form-item>
<el-form-item label="真实姓名" prop="real_name">
<el-input
class="w-80"
v-model="formData.real_name"
placeholder="请输入真实姓名"
/>
</el-form-item>
<el-form-item label="总采购金额" prop="purchase_amount">
<el-input
class="w-80"
v-model="formData.purchase_amount"
placeholder="请输入总采购金额"
readonly
/>
</el-form-item>
<el-form-item label="总销售金额" prop="sale_amount">
<el-input
class="w-80"
v-model="formData.sale_amount"
placeholder="请输入总销售金额"
readonly
/>
</el-form-item>
<el-form-item label="手机号" prop="service_phone">
<el-input
class="w-80"
v-model="formData.service_phone"
placeholder="请输入手机号"
clearable
/>
</el-form-item>
<el-form-item label="评分" prop="product_score">
<el-input
class="w-80"
v-model="formData.product_score"
placeholder="请输入评分"
type="number"
maxlength="1"
max="5"
min="1"
clearable
/>
</el-form-item>
<el-form-item label="店铺类型" prop="type_name">
<el-select
class="w-80"
v-model="formData.type_name"
placeholder="请输入店铺类型"
>
<el-option
:label="item.type_name"
:value="item.mer_type_id"
v-for="item in merchantData"
:key="item.mer_type_id"
/>
</el-select>
</el-form-item>
<el-form-item label="地址" prop="mer_address">
<el-input
class="w-80"
v-model="formData.mer_address"
placeholder="请输入地址"
clearable
/>
</el-form-item>
</div>
</el-form> </el-form>
</el-card> </el-card>
<footer-btns> <footer-btns>

View File

@ -18,6 +18,16 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="真实姓名" prop="real_name">
<el-input
class="w-[280px]"
v-model="queryParams.real_name"
placeholder="请输入真实姓名"
clearable
@keyup.enter="resetPage"
/>
</el-form-item>
<el-form-item label="店铺类型" prop="type_id"> <el-form-item label="店铺类型" prop="type_id">
<el-select <el-select
class="w-[280px]" class="w-[280px]"
@ -25,6 +35,7 @@
v-model="queryParams.type_id" v-model="queryParams.type_id"
@keyup.enter="resetPage" @keyup.enter="resetPage"
> >
<el-option label="全部" value="" />
<el-option <el-option
v-for="item in merchantData" v-for="item in merchantData"
:label="item.type_name" :label="item.type_name"
@ -41,6 +52,7 @@
v-model="queryParams.category_id" v-model="queryParams.category_id"
@keyup.enter="resetPage" @keyup.enter="resetPage"
> >
<el-option label="全部" value="" />
<el-option <el-option
v-for="item in categoryList" v-for="item in categoryList"
:label="item.category_name" :label="item.category_name"
@ -57,6 +69,7 @@
v-model="queryParams.wholesale" v-model="queryParams.wholesale"
@keyup.enter="resetPage" @keyup.enter="resetPage"
> >
<el-option label="全部" value="" />
<el-option label="仅零售" value="0" /> <el-option label="仅零售" value="0" />
<el-option label="仅批发" value="1" /> <el-option label="仅批发" value="1" />
<el-option label="零售批发" value="2" /> <el-option label="零售批发" value="2" />
@ -103,16 +116,6 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="真实姓名" prop="real_name">
<el-input
class="w-[280px]"
v-model="queryParams.real_name"
placeholder="请输入真实姓名"
clearable
@keyup.enter="resetPage"
/>
</el-form-item>
<el-form-item label="区、县" prop="category_id"> <el-form-item label="区、县" prop="category_id">
<el-select <el-select
class="w-[280px]" class="w-[280px]"
@ -121,6 +124,7 @@
@keyup.enter="resetPage" @keyup.enter="resetPage"
@change="areaChange" @change="areaChange"
> >
<el-option label="全部" value="" />
<el-option <el-option
v-for="item in areaList" v-for="item in areaList"
:label="item.area_name" :label="item.area_name"
@ -137,6 +141,7 @@
v-model="queryParams.street_id" v-model="queryParams.street_id"
@keyup.enter="resetPage" @keyup.enter="resetPage"
> >
<el-option label="全部" value="" />
<el-option <el-option
v-for="item in streetList" v-for="item in streetList"
:label="item.street_name" :label="item.street_name"
@ -146,6 +151,19 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否分配" prop="status">
<el-select
class="w-[280px]"
placeholder="请是否分配"
v-model="queryParams.status"
@keyup.enter="resetPage"
>
<el-option label="全部" value="" />
<el-option label="未分配" value="1" />
<el-option label="已分配" value="2" />
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button> <el-button @click="resetParams">重置</el-button>
@ -187,7 +205,15 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商户名称" prop="mer_name" min-width="220" /> <el-table-column label="商户名称" prop="mer_name" min-width="220" />
<el-table-column label="商户分类" prop="category_name" min-width="220" />
<el-table-column label="真实姓名" prop="real_name" min-width="100" /> <el-table-column label="真实姓名" prop="real_name" min-width="100" />
<el-table-column label="是否分配" prop="real_name" min-width="100">
<template #default="props">
<el-tag v-if="props.row.admin_id > 0" type="success">已分配</el-tag>
<el-tag v-else type="info">未分配</el-tag>
</template>
</el-table-column>
<el-table-column label="接受人" prop="admin_name" min-width="100" />
<el-table-column label="总采购金额" prop="purchase_amount" min-width="100" /> <el-table-column label="总采购金额" prop="purchase_amount" min-width="100" />
<el-table-column label="总销售金额" prop="sale_amount" min-width="100" /> <el-table-column label="总销售金额" prop="sale_amount" min-width="100" />
<el-table-column label="手机号" prop="service_phone" min-width="120" /> <el-table-column label="手机号" prop="service_phone" min-width="120" />
@ -197,22 +223,8 @@
<el-table-column label="地址" prop="mer_address" min-width="220" /> <el-table-column label="地址" prop="mer_address" min-width="220" />
<el-table-column label="操作" width="240" fixed="right"> <el-table-column label="操作" width="240" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button @click="onView(row)" type="primary" size="small" link>
v-perms="['merchant.merchant/edit', 'merchant.merchant/add:edit']" 详情
type="primary"
size="small"
link
>
<router-link
:to="{
path: getRoutePath('merchant.merchant/add:edit'),
query: {
id: row.mer_id,
},
}"
>
编辑
</router-link>
</el-button> </el-button>
<el-button <el-button
v-perms="['merchant.merchant/edit', 'merchant.merchant/add:edit']" v-perms="['merchant.merchant/edit', 'merchant.merchant/add:edit']"
@ -288,6 +300,95 @@
</el-form> </el-form>
</Popup> </Popup>
<!-- 详情查看 -->
<Popup
ref="viewRef"
title="详情"
:async="true"
width="650px"
@confirm="handleSubmit"
@close="onClose"
confirmButtonText=""
>
<el-form ref="formRef" class="ls-form" :model="bindForm" label-width="110px">
<el-form-item label="商户名称" prop="mer_name">
<el-input
v-model="formData.mer_name"
placeholder="请输入商户名称"
clearable
readonly
/>
</el-form-item>
<el-form-item label="真实姓名" prop="real_name">
<el-input v-model="formData.real_name" placeholder="请输入真实姓名" readonly />
</el-form-item>
<el-form-item label="总采购金额" prop="purchase_amount">
<el-input
v-model="formData.purchase_amount"
placeholder="请输入总采购金额"
readonly
/>
</el-form-item>
<el-form-item label="总销售金额" prop="sale_amount">
<el-input
v-model="formData.sale_amount"
placeholder="请输入总销售金额"
readonly
/>
</el-form-item>
<el-form-item label="手机号" prop="service_phone">
<el-input
v-model="formData.service_phone"
placeholder="请输入手机号"
clearable
readonly
/>
</el-form-item>
<el-form-item label="评分" prop="product_score">
<el-input
v-model="formData.product_score"
placeholder="请输入评分"
type="number"
maxlength="1"
max="5"
min="1"
clearable
readonly
/>
</el-form-item>
<el-form-item label="店铺类型" prop="type_name">
<el-select
v-model="formData.type_name"
placeholder="请输入店铺类型"
disabled
style="width: 100%"
>
<el-option
:label="item.type_name"
:value="item.mer_type_id"
v-for="item in merchantData"
:key="item.mer_type_id"
/>
</el-select>
</el-form-item>
<el-form-item label="地址" prop="mer_address">
<el-input
v-model="formData.mer_address"
placeholder="请输入地址"
clearable
readonly
/>
</el-form-item>
</el-form>
</Popup>
<!-- 督导情况 --> <!-- 督导情况 -->
<Popup <Popup
ref="monitorRef" ref="monitorRef"
@ -297,6 +398,9 @@
@confirm="onBindSubmit" @confirm="onBindSubmit"
@close="onMonitorClose" @close="onMonitorClose"
> >
<div style="font-size: 20px; color: #333; text-align: center; margin-bottom: 20px">
{{ monitorForm.mer_name }}
</div>
<el-form ref="formRef" :model="monitorForm" label-width="180px"> <el-form ref="formRef" :model="monitorForm" label-width="180px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@ -322,7 +426,7 @@
v-model="monitorForm.store_condition.survival_rate" v-model="monitorForm.store_condition.survival_rate"
placeholder="请输入成活率" placeholder="请输入成活率"
controls-position="right" controls-position="right"
:min="0.01" :min="0.0"
:max="100" :max="100"
:step="1" :step="1"
:precision="2" :precision="2"
@ -353,7 +457,7 @@
v-model="monitorForm.store_condition.administrator_rate" v-model="monitorForm.store_condition.administrator_rate"
placeholder="请输入成活率" placeholder="请输入成活率"
controls-position="right" controls-position="right"
:min="0.01" :min="0.0"
:max="100" :max="100"
:step="1" :step="1"
:precision="2" :precision="2"
@ -384,7 +488,7 @@
v-model="monitorForm.store_condition.operate_rate" v-model="monitorForm.store_condition.operate_rate"
placeholder="请输入成活率" placeholder="请输入成活率"
controls-position="right" controls-position="right"
:min="0.01" :min="0.0"
:max="100" :max="100"
:step="1" :step="1"
:precision="2" :precision="2"
@ -656,11 +760,17 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商品总数"> <el-form-item label="在售商品总数">
<el-input v-model="monitorForm.saleNum" placeholder="" readonly></el-input> <el-input v-model="monitorForm.saleNum" placeholder="" readonly></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="商品总数">
<el-input v-model="monitorForm.allGoods" placeholder="" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="商品分类"> <el-form-item label="商品分类">
<el-table :data="monitorForm.storeCates" max-height="320"> <el-table :data="monitorForm.storeCates" max-height="320">
@ -788,6 +898,7 @@
</el-row> </el-row>
</el-form> </el-form>
</Popup> </Popup>
<!-- 跟进记录 --> <!-- 跟进记录 -->
<edit-popup ref="editRef" @success="getLists" @close="showEdit = false" /> <edit-popup ref="editRef" @success="getLists" @close="showEdit = false" />
</div> </div>
@ -807,6 +918,7 @@ import {
streetListApi, streetListApi,
saveConditionApi, saveConditionApi,
recordManApi, recordManApi,
merchantListNoPage,
} from "@/api/merchant"; } from "@/api/merchant";
import { usePaging } from "@/hooks/usePaging"; import { usePaging } from "@/hooks/usePaging";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
@ -815,9 +927,11 @@ import feedback from "@/utils/feedback";
import { ref } from "vue"; import { ref } from "vue";
import Popup from "@/components/popup/index.vue"; import Popup from "@/components/popup/index.vue";
import EditPopup from "@/views/record/edit.vue"; // import EditPopup from "@/views/record/edit.vue"; //
import mitt from "@/utils/mitt";
const monitorRef: any = ref(null); // const monitorRef: any = ref(null); //
const formRef: any = ref(null); // const formRef: any = ref(null); //
const viewRef: any = ref(null); //
const popupRef = shallowRef<InstanceType<typeof Popup>>(); //dialog const popupRef = shallowRef<InstanceType<typeof Popup>>(); //dialog
const tableRef: any = ref(null); // const tableRef: any = ref(null); //
const emit = defineEmits(["success", "close"]); const emit = defineEmits(["success", "close"]);
@ -836,6 +950,7 @@ const queryParams = reactive({
wholesale: "", wholesale: "",
area_id: "", area_id: "",
street_id: "", street_id: "",
status: "",
}); });
// //
const route = useRoute(); const route = useRoute();
@ -872,23 +987,51 @@ const bindForm: any = reactive({
// //
const onBind = (e: any) => { const onBind = (e: any) => {
if (e.admin_id > 0) {
return feedback.notifyError("该商户已绑定!");
}
popupRef.value?.open(); popupRef.value?.open();
bindForm.merchant_ids.push(e.mer_id); bindForm.merchant_ids.push(e.mer_id);
}; };
//
const formData = ref(null);
const onView = (e: any) => {
formData.value = e;
viewRef.value?.open();
};
// //
const onBindBatch = async () => { const onBindBatch = async () => {
if (!selectData.value || selectData.value.length === 0) if (!selectData.value || selectData.value.length === 0)
return await feedback.notifyError("请至少选择一条记录!"); return await feedback.notifyError("请至少选择一条记录!");
popupRef.value?.open();
selectData.value.forEach((item) => { selectData.value.forEach((item) => {
bindForm.merchant_ids.push(item); if (item.admin_id > 0) {
tableRef.value?.toggleRowSelection(item, false);
} else {
bindForm.merchant_ids.push(item.mer_id);
}
}); });
popupRef.value?.open();
}; };
// //
const onDownload = () => { const onDownload = () => {
excelApi(queryParams).then((res) => {}); const arr: any = reactive({
data: [],
});
if (selectData.value.length > 0) {
selectData.value.forEach((item: any) => {
arr.data.push(item.mer_id);
});
}
excelApi({ mer_ids: arr.data }).then((res) => {
arr.data = [];
tableRef.value?.clearSelection();
});
}; };
// //
@ -902,7 +1045,14 @@ const handleSubmit = async () => {
// //
const selectData = ref<any[]>([]); const selectData = ref<any[]>([]);
const onSelectionChange = (val: any[]) => { const onSelectionChange = (val: any[]) => {
selectData.value = val.map(({ mer_id }) => mer_id); // if (val && val.length > 0) {
// val.forEach((item) => {
// if (item.admin_id > 0) {
// tableRef.value?.toggleRowSelection(item, false);
// }
// });
// }
selectData.value = val;
}; };
// //
@ -916,7 +1066,28 @@ const onMonitorClose = () => {};
// //
const onMonitor = async (row: any) => { const onMonitor = async (row: any) => {
console.log(row);
let detail = await storeSuper({ mer_id: row.mer_id }); let detail = await storeSuper({ mer_id: row.mer_id });
if (!detail.store_condition || detail.store_condition.length == 0) {
detail.mer_name = row.mer_name;
detail.store_condition = {
administrator: "",
administrator_rate: "",
condition: "",
extend: "",
finance: "",
mer_id: detail.mer_id,
merchant_name: "",
operate: "",
operate_rate: "",
risk: "",
supervisor: "",
supervisor_more: "",
survival_rate: "",
technology: "",
};
}
monitorForm.value = detail; monitorForm.value = detail;
monitorRef.value?.open(); monitorRef.value?.open();
}; };
@ -1024,6 +1195,11 @@ const areaChange = () => {
}); });
}; };
//
mitt.on("refresh", (res: any) => {
getLists();
});
getLists(); getLists();
// //

View File

@ -70,7 +70,13 @@
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" clearable placeholder="请输入备注" /> <el-input
type="textarea"
:rows="5"
v-model="formData.remark"
clearable
placeholder="请输入备注"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</popup> </popup>
@ -88,7 +94,8 @@ import {
recordInfo, recordInfo,
} from "@/api/record"; } from "@/api/record";
import { merchantListNoPage } from "@/api/merchant"; import { merchantListNoPage } from "@/api/merchant";
import { getCurrentInstance,type ComponentInternalInstance ,onMounted} from 'vue'; import { getCurrentInstance,type ComponentInternalInstance ,ref} from 'vue';
import mitt from "@/utils/mitt";
const emit = defineEmits(["success", "close"]); const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>(); const formRef = shallowRef<FormInstance>();
@ -185,8 +192,9 @@ const handleSubmit = async () => {
mode.value == "edit" ? await apiRecordEdit(data) : await apiRecordAdd(data); mode.value == "edit" ? await apiRecordEdit(data) : await apiRecordAdd(data);
popupRef.value?.close(); popupRef.value?.close();
emit("success"); emit("success");
const {appContext} = getCurrentInstance()as ComponentInternalInstance;
appContext.config.globalProperties.$mitt.emit("selfEvent"); mitt.emit("selfEvent");
mitt.emit("refresh")
}; };
// //
@ -194,6 +202,12 @@ const open = (type = "add", merId = "") => {
mode.value = type; mode.value = type;
popupRef.value?.open(); popupRef.value?.open();
if (merId) { if (merId) {
formData. id ="";
formData. theme= "";
formData. rid= "";
formData. admin_id= "";
formData.remark= "";
formData.flow_time= "";
formData.merchant_id = merId; formData.merchant_id = merId;
} }
}; };

View File

@ -2,18 +2,18 @@
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline label-width="80"> <el-form class="mb-[-16px]" :model="queryParams" inline label-width="80">
<el-form-item label="店铺类型" prop="mer_id"> <el-form-item label="商户名称" prop="mer_id">
<el-select <el-select
class="w-[280px]" class="w-[280px]"
placeholder="请输入店铺类型" placeholder="请输入商户名称"
v-model="queryParams.mer_id" v-model="queryParams.mer_id"
@keyup.enter="resetPage" @keyup.enter="resetPage"
> >
<el-option <el-option
v-for="item in merchantData" v-for="item in merchantData"
:label="item.type_name" :label="item.mer_name"
:value="item.mer_type_id" :value="item.mer_id"
:key="item.mer_type_id" :key="item.mer_id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -194,8 +194,7 @@
<script lang="ts" setup name="recordLists"> <script lang="ts" setup name="recordLists">
import { usePaging } from "@/hooks/usePaging"; import { usePaging } from "@/hooks/usePaging";
import { monitorListApi, monitorDelApi } from "@/api/monitor"; import { monitorListApi, monitorDelApi } from "@/api/monitor";
import { merchantCate } from "@/api/merchant"; import { merchantListNoPage } from "@/api/merchant";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback"; import feedback from "@/utils/feedback";
import EditPopup from "./edit.vue"; import EditPopup from "./edit.vue";
@ -223,7 +222,7 @@ const handleSelectionChange = (val: any[]) => {
// //
const merchantData: any = ref([]); const merchantData: any = ref([]);
const getMerchantCate = async () => { const getMerchantCate = async () => {
merchantData.value = await merchantCate(""); merchantData.value = await merchantListNoPage("");
}; };
// //

View File

@ -121,196 +121,189 @@
</template> </template>
<script lang="ts" setup name="workbench"> <script lang="ts" setup name="workbench">
import { getWorkbench, merchantInfo } from '@/api/app' import { getWorkbench, merchantInfo } from "@/api/app";
import { orderBy } from 'lodash-es'; import { orderBy } from "lodash-es";
import vCharts from 'vue-echarts'; import vCharts from "vue-echarts";
import { getCurrentInstance,type ComponentInternalInstance ,onMounted} from 'vue';
// bell
onMounted(()=>{
const {appContext} = getCurrentInstance()as ComponentInternalInstance;
appContext.config.globalProperties.$mitt.emit("selfEvent");
})
// //
const merchantInfoData = ref({ const merchantInfoData = ref({
// //
order: { order: {
nowWeekOrders: 0, nowWeekOrders: 0,
lastWeekOrders: 0 lastWeekOrders: 0,
}, },
// //
amount: { amount: {
nowWeekAmount: 0, nowWeekAmount: 0,
lastWeekAmount: 0 lastWeekAmount: 0,
}, },
// echarts // echarts
echartOptionNowWeek: { echartOptionNowWeek: {
tooltip: { show: true }, tooltip: { show: true },
xAxis: { xAxis: {
type: 'category', type: "category",
data: [], data: [],
axisLabel: { axisLabel: {
show: true, show: true,
rotate: 45 rotate: 45,
} },
},
yAxis: {
type: 'value'
},
series: [
{
data: [],
type: 'bar',
barMaxWidth: 30,
label: {
show: true,
position: 'top'
}
}
]
}, },
yAxis: {
type: "value",
},
series: [
{
data: [],
type: "bar",
barMaxWidth: 30,
label: {
show: true,
position: "top",
},
},
],
},
// echarts // echarts
echartOptionLastWeek: { echartOptionLastWeek: {
tooltip: { show: true }, tooltip: { show: true },
xAxis: { xAxis: {
type: 'category', type: "category",
data: [], data: [],
axisLabel: { axisLabel: {
show: true, show: true,
rotate: 45 rotate: 45,
} },
},
yAxis: {
type: "value",
},
series: [
{
data: [],
type: "bar",
barMaxWidth: 30,
label: {
show: true,
position: "top",
}, },
yAxis: { },
type: 'value' ],
}, },
series: [
{
data: [],
type: 'bar',
barMaxWidth: 30,
label: {
show: true,
position: 'top'
}
}
]
}
}); });
// //
const getMerchangeInfo = () => { const getMerchangeInfo = () => {
merchantInfo().then(res => { merchantInfo().then((res) => {
// //
merchantInfoData.value.order.nowWeekOrders = res.nowWeekOrderNum; merchantInfoData.value.order.nowWeekOrders = res.nowWeekOrderNum;
merchantInfoData.value.order.lastWeekOrders = res.lastWeekOrderNum; merchantInfoData.value.order.lastWeekOrders = res.lastWeekOrderNum;
// //
merchantInfoData.value.amount.nowWeekAmount = res.nowWeekMoney; merchantInfoData.value.amount.nowWeekAmount = res.nowWeekMoney;
merchantInfoData.value.amount.lastWeekAmount = res.lastWeekMoney; merchantInfoData.value.amount.lastWeekAmount = res.lastWeekMoney;
// //
let nameArr: any = [], dataArr: any = []; let nameArr: any = [],
res.nowWeekGoods.map((item: any) => { dataArr: any = [];
nameArr.push(item.store_name ? item.store_name : '-'); res.nowWeekGoods.map((item: any) => {
dataArr.push(item.product_count); nameArr.push(item.store_name ? item.store_name : "-");
}); dataArr.push(item.product_count);
merchantInfoData.value.echartOptionNowWeek.xAxis.data = nameArr; });
merchantInfoData.value.echartOptionNowWeek.series[0].data = dataArr; merchantInfoData.value.echartOptionNowWeek.xAxis.data = nameArr;
merchantInfoData.value.echartOptionNowWeek.series[0].data = dataArr;
//
let nameArr1: any = [], dataArr1: any = [];
res.lastWeekGoods.map((item: any) => {
nameArr1.push(item.store_name || '-');
dataArr1.push(item.product_count);
});
merchantInfoData.value.echartOptionLastWeek.xAxis.data = nameArr1;
merchantInfoData.value.echartOptionLastWeek.series[0].data = dataArr1;
})
}
//
let nameArr1: any = [],
dataArr1: any = [];
res.lastWeekGoods.map((item: any) => {
nameArr1.push(item.store_name || "-");
dataArr1.push(item.product_count);
});
merchantInfoData.value.echartOptionLastWeek.xAxis.data = nameArr1;
merchantInfoData.value.echartOptionLastWeek.series[0].data = dataArr1;
});
};
// //
const workbenchData: any = reactive({ const workbenchData: any = reactive({
version: { version: {
version: '', // version: "", //
website: '', // website: "", //
based: '', based: "",
channel: { channel: {
gitee: '', gitee: "",
website: '' website: "",
}
}, },
support: [], },
today: {}, // support: [],
menu: [], // today: {}, //
visitor: [], // 访 menu: [], //
article: [], // visitor: [], // 访
article: [], //
visitorOption: { visitorOption: {
xAxis: { xAxis: {
type: 'category', type: "category",
data: [0] data: [0],
}, },
yAxis: { yAxis: {
type: 'value' type: "value",
}, },
legend: { legend: {
data: ['访问量'] data: ["访问量"],
}, },
itemStyle: { itemStyle: {
// //
color: 'red' color: "red",
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: "axis",
}, },
series: [ series: [
{ {
name: '访问量', name: "访问量",
data: [0], data: [0],
type: 'line', type: "line",
smooth: true smooth: true,
} },
] ],
} },
}) });
// //
const getData = () => { const getData = () => {
getWorkbench() getWorkbench()
.then((res: any) => { .then((res: any) => {
workbenchData.version = res.version workbenchData.version = res.version;
workbenchData.today = res.today workbenchData.today = res.today;
workbenchData.menu = res.menu workbenchData.menu = res.menu;
workbenchData.visitor = res.visitor workbenchData.visitor = res.visitor;
workbenchData.support = res.support workbenchData.support = res.support;
// echarts // echarts
workbenchData.visitorOption.xAxis.data = [] workbenchData.visitorOption.xAxis.data = [];
workbenchData.visitorOption.series[0].data = [] workbenchData.visitorOption.series[0].data = [];
// //
res.visitor.date.reverse().forEach((item: any) => { res.visitor.date.reverse().forEach((item: any) => {
workbenchData.visitorOption.xAxis.data.push(item) workbenchData.visitorOption.xAxis.data.push(item);
}) });
res.visitor.list[0].data.forEach((item: any) => { res.visitor.list[0].data.forEach((item: any) => {
workbenchData.visitorOption.series[0].data.push(item) workbenchData.visitorOption.series[0].data.push(item);
}) });
}) })
.catch((err: any) => { .catch((err: any) => {
console.log('err', err) console.log("err", err);
}) });
} };
onMounted(() => { onMounted(() => {
getData(); getData();
getMerchangeInfo(); getMerchangeInfo();
}) });
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>