Merge branch 'multi-store' of https://e.coding.net/g-cphe0354/cashier/cashier-web into ymf_test

This commit is contained in:
2025-04-07 10:12:29 +08:00
16 changed files with 852 additions and 420 deletions

View File

@@ -3,7 +3,22 @@
<transition name="el-fade-in-linear" mode="out-in">
<router-link :key="+collapse" class="wh-full flex-center" to="/">
<img :src="userStore.userInfo.logo" class="w20px h20px" />
<span v-if="!collapse" class="title">{{ userStore.userInfo.shopName }}</span>
<!-- <span v-if="!collapse" class="title">{{ userStore.userInfo.shopName }}</span> -->
<el-dropdown trigger="click">
<span class="el-dropdown-link">
<span v-if="!collapse" class="title">{{ userStore.userInfo.shopName }}</span>
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>门店 1</el-dropdown-item>
<el-dropdown-item>门店 2</el-dropdown-item>
<el-dropdown-item>门店 3</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</router-link>
</transition>
</div>
@@ -30,7 +45,8 @@ defineProps({
background-color: $sidebar-logo-background;
.title {
flex-shrink: 0; /* 防止容器在空间不足时缩小 */
flex-shrink: 0;
/* 防止容器在空间不足时缩小 */
margin-left: 10px;
font-size: 16px;
color: #5a5e66;

View File

@@ -63,38 +63,6 @@ export const constantRoutes: RouteRecordRaw[] = [
keepAlive: true,
},
},
{
path: "credit",
name: "",
component: () => import("@/views/data/credit/index.vue"),
meta: {
title: "挂账管理",
affix: false,
keepAlive: true,
},
},
{
path: "credit-detail",
name: "",
component: () => import("@/views/data/credit/detail.vue"),
meta: {
title: "挂账明细",
affix: false,
keepAlive: true,
hidden: true
},
},
{
path: "work",
name: "",
component: () => import("@/views/data/work.vue"),
meta: {
title: "交班记录",
affix: false,
keepAlive: true,
},
},
{
path: "401",
component: () => import("@/views/error/401.vue"),
@@ -473,7 +441,6 @@ export const constantRoutes: RouteRecordRaw[] = [
// /**列表end */
// ],
// },
// {

View File

@@ -40,7 +40,7 @@
}"
@row-click="handleRowClick"
>
<el-table-column label="菜单名称" min-width="100">
<el-table-column label="菜单名称" min-width="140">
<template #default="scope">
{{ scope.row.title }}
</template>

View File

@@ -47,23 +47,29 @@
</div> -->
<div class="h_card_wrap">
<div class="status_wrap">
<div class="left">
<div class="left" style="flex-shrink: 0">
<div class="dot" />
<span>营业</span>
</div>
<div class="time_wrap u-flex">
<el-radio-group v-model="timeValue" class="m-r-5" @change="timeChange">
<el-radio-button value="0">今天</el-radio-button>
<el-radio-button value="-1">昨天</el-radio-button>
<el-radio-button value="-7">最近7天</el-radio-button>
<el-radio-button value="-30">最近30天</el-radio-button>
<el-radio-button value="week">本周</el-radio-button>
<el-radio-button value="month">本月</el-radio-button>
<el-radio-button value="custom">自定义</el-radio-button>
</el-radio-group>
<div class="u-flex">
<el-date-picker v-if="timeValue == 'custom'" v-model="query.createdAt" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD " @change="summarytrade" />
<div class="u-flex" style="flex-wrap: wrap">
<el-select v-model="storeId" placeholder="选择分店" style="width: 200px; margin-right: 10px;">
<el-option v-for="item in storeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<div class="time_wrap u-flex" style="flex-shrink: 0">
<el-radio-group v-model="timeValue" class="m-r-5" @change="timeChange">
<el-radio-button value="0">今天</el-radio-button>
<el-radio-button value="-1">昨天</el-radio-button>
<el-radio-button value="-7">最近7天</el-radio-button>
<el-radio-button value="-30">最近30天</el-radio-button>
<el-radio-button value="week">本周</el-radio-button>
<el-radio-button value="month">本月</el-radio-button>
<el-radio-button value="custom">自定义</el-radio-button>
</el-radio-group>
<div class="u-flex">
<el-date-picker v-if="timeValue == 'custom'" v-model="query.createdAt" type="daterange"
range-separator="" start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD "
@change="summarytrade" />
</div>
</div>
</div>
</div>
@@ -136,16 +142,16 @@
<div class="line_gropress">
<div class="gropress l" :style="{
width: `${trade.saleAmount
? (trade.saleAmount / (trade.saleAmount * 1 + trade.refundAmount * 1)) *
100
: 0
? (trade.saleAmount / (trade.saleAmount * 1 + trade.refundAmount * 1)) *
100
: 0
}%`,
}" />
<div class="gropress r" :style="{
width: `${trade.refundAmount
? (trade.refundAmount / (trade.saleAmount * 1 + trade.refundAmount * 1)) *
100
: 0
? (trade.refundAmount / (trade.saleAmount * 1 + trade.refundAmount * 1)) *
100
: 0
}%`,
}" />
</div>
@@ -165,18 +171,18 @@
<div class="line_gropress">
<div class="gropress l" :style="{
width: `${trade.rechargeAmount
? (trade.rechargeAmount /
(trade.memberPayAmount + trade.rechargeRefundAmount * 1)) *
100
: 0
? (trade.rechargeAmount /
(trade.memberPayAmount + trade.rechargeRefundAmount * 1)) *
100
: 0
}%`,
}" />
<div class="gropress r" :style="{
width: `${trade.rechargeRefundAmount
? (trade.rechargeRefundAmount /
(trade.memberPayAmount + trade.rechargeRefundAmount * 1)) *
100
: 0
? (trade.rechargeRefundAmount /
(trade.memberPayAmount + trade.rechargeRefundAmount * 1)) *
100
: 0
}%`,
}" />
</div>
@@ -383,6 +389,8 @@ export default {
saveAmount: null,
},
],
storeList: [{ label: "门店1", value: 1 }],
storeId: null,
trade: {},
formatDecimal,
topData: "",

View File

@@ -10,14 +10,15 @@
<el-form-item>
<el-input placeholder="商品名称" v-model="query.productName" />
</el-form-item>
<el-form-item>
<el-select v-model="storeId" placeholder="选择分店" style="width: 200px; margin-right: 10px">
<el-option v-for="item in storeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="query.prodCategoryId" placeholder="商品分类" style="width: 140px">
<el-option
:label="item.name"
:value="item.id"
v-for="item in categorys"
:key="item.id"
></el-option>
<el-option :label="item.name" :value="item.id" v-for="item in categorys" :key="item.id"></el-option>
</el-select>
</el-form-item>
</template>
@@ -32,16 +33,9 @@
<el-radio-button value="month">本月</el-radio-button>
<el-radio-button value="custom">自定义</el-radio-button>
</el-radio-group>
<el-date-picker
class="u-m-l-10"
v-model="query.createdAt"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
v-if="timeValue == 'custom'"
></el-date-picker>
<el-date-picker class="u-m-l-10" v-model="query.createdAt" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"
v-if="timeValue == 'custom'"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
@@ -57,7 +51,9 @@
<div class="collect_wrap">
<div class="item">
<div class="icon_wrap" style="--bg-color: #c978ee">
<el-icon color="#fff"><Coin /></el-icon>
<el-icon color="#fff">
<Coin />
</el-icon>
</div>
<div class="info">
<div class="m">{{ payCount.totalAmount || 0 }}</div>
@@ -66,7 +62,9 @@
</div>
<div class="item">
<div class="icon_wrap" style="--bg-color: #c978ee">
<el-icon color="#fff"><Coin /></el-icon>
<el-icon color="#fff">
<Coin />
</el-icon>
</div>
<div class="info">
<div class="m">{{ payCount.refundAmount || 0 }}</div>
@@ -75,7 +73,9 @@
</div>
<div class="item">
<div class="icon_wrap" style="--bg-color: #c978ee">
<el-icon color="#fff"><ShoppingCartFull /></el-icon>
<el-icon color="#fff">
<ShoppingCartFull />
</el-icon>
</div>
<div class="info">
<div class="m">{{ payCount.saleCount || 0 }}</div>
@@ -84,7 +84,9 @@
</div>
<div class="item">
<div class="icon_wrap" style="--bg-color: #c978ee">
<el-icon color="#fff"><ShoppingCart /></el-icon>
<el-icon color="#fff">
<ShoppingCart />
</el-icon>
</div>
<div class="info">
<div class="m">{{ payCount.refundCount || 0 }}</div>
@@ -145,14 +147,9 @@
</el-table>
</div>
<div class="head-container">
<el-pagination
:total="tableData.total"
:current-page="tableData.page"
:page-size="tableData.size"
@current-change="paginationChange"
@size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<el-pagination :total="tableData.total" :current-page="tableData.page" :page-size="tableData.size"
@current-change="paginationChange" @size-change="sizeChange"
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</div>
</template>
@@ -185,6 +182,8 @@ export default {
downloadLoading: false,
payCount: "",
payCountTotal: 0,
storeList: [{ label: "门店1", value: 1 }],
storeId: null,
};
},
filters: {

View File

@@ -0,0 +1,145 @@
<template>
<div class="app-container">
<div class="head-container">
<el-card shadow="never">
<el-alert title="当前列表仅作为数据记录,不产生任何实际交易。" type="warning" show-icon :closable="false"
style="margin-bottom: 15px;" />
<el-row :gutter="20">
<el-col :span="4">
<el-input v-model="state.query.name" clearable placeholder="请输入耗材名称" style="width: 100%" class="filter-item"
@keyup.enter="getTableData" />
</el-col>
<el-col :span="16">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button type="primary" @click="getTableData" plain>批量付款</el-button>
<el-text tag="b" size="large" style="margin-left: 15px;">供应商供应商名称</el-text>
</el-col>
</el-row>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="耗材信息">
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>联系电话{{ scope.row.phone }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="账单金额" width="120" />
<el-table-column prop="status" label="已付款金额" width="120" />
<el-table-column prop="status" label="未付款金额" width="120" />
<el-table-column prop="status" label="创建时间" width="120" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="primary" size="small" link @click="handlePayment(scope.row)">
付款
</el-button>
<el-button type="primary" size="small" link @click="handleRecord(scope.row.id)">
付款记录
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div class="head-container">
<el-pagination v-model:current-page="state.tableData.page" v-model:page-size="state.tableData.size"
:total="state.tableData.total" :page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper " @current-change="paginationChange" />
</div>
<payment ref="refPayment" @refresh="getTableData"></payment>
</div>
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import { ElMessageBox } from "element-plus";
import payment from "./components/payment.vue";
const route = useRoute();
const router = useRouter();
const state = reactive({
query: {
name: "",
},
tableData: {
list: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
}
getTableData();
});
// 获取商家列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
});
state.tableData.loading = false;
state.tableData.list = res.records;
state.tableData.total = res.totalRow * 1;
} catch (error) {
console.log(error);
}
}
const refPayment = ref();
function handlePayment(item) {
refPayment.value.open(item);
}
// 付款记录
function handleRecord(id) {
router.push({ name: "financePaymentRecord", query: { id: id } });
}
// 重置查询
function resetHandle() {
state.query.name = "";
getTableData();
}
// 分页回调
function paginationChange(e) {
state.tableData.page = e;
getTableData();
}
</script>
<style scoped lang="scss">
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>

View File

@@ -0,0 +1,81 @@
<template>
<!-- 修改和增加 -->
<el-dialog title="付款" v-model="show" width="400px" @close="reset">
<el-form :inline="false" ref="refform" label-width="90" :model="form" :rules="rules" class="demo-form-inline">
<el-form-item label="供应商" prop="conName">
<el-input v-model="form.conName" placeholder="请输入供应商名称"></el-input>
</el-form-item>
<el-form-item label="付款金额 " prop="price">
<el-input-number v-model="form.price" placeholder="请输入付款金额" style="width: 100%;"></el-input-number>
</el-form-item>
<el-form-item label="付款方式" prop="conName">
<el-input v-model="form.conName" placeholder="请输入付款方式"></el-input>
</el-form-item>
<el-form-item label="备注" prop="defaultUnit">
<el-input v-model="form.defaultUnit" placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item style="display: flex; justify-content: flex-end">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="submitForm('refform')"> </el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup>
import consApi from "@/api/product/cons";
import { ElMessage } from "element-plus";
const emits = defineEmits(["refresh"]);
const rules = {
conName: [{ required: true, message: "请输入耗材名称", trigger: "blur" }],
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
conWarning: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
conUnit: [{ required: true, message: "请输入付款方式", trigger: "blur" }],
};
const basicForm = {
conName: "",
consGroupId: "",
conUnit: "",
price: undefined,
conWarning: undefined,
};
const form = reactive({
...basicForm,
});
const show = ref(false);
function open(item) {
Object.assign(form, item);
show.value = true;
}
function close() {
show.value = false;
}
const refform = ref();
async function submitForm() {
refform.value.validate(async (valid) => {
if (valid) {
const res = await consApi.add(form);
ElMessage({ type: "success", message: "付款成功" });
emits("refresh");
close();
}
});
}
function reset() {
console.log("reset");
Object.assign(form, basicForm);
console.log(form);
}
defineExpose({
open,
close,
});
</script>

View File

@@ -0,0 +1,139 @@
<template>
<div class="app-container">
<div class="head-container">
<el-card shadow="never">
<el-alert title="当前列表仅作为数据记录,不产生任何实际交易。" type="warning" show-icon :closable="false"
style="margin-bottom: 15px;" />
<el-row :gutter="20">
<el-col :span="4">
<el-input v-model="state.query.name" clearable placeholder="请输入供应商名称" style="width: 100%"
class="filter-item" @keyup.enter="getTableData" />
</el-col>
<el-col :span="16">
<el-button type="primary" @click="getTableData">查询</el-button>
</el-col>
</el-row>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-row :gutter="24">
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>账单总金额全部/本月</div>
<div>2000/1000</div>
</el-col>
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>已付款总金额全部/本月</div>
<div>2000/1000</div>
</el-col>
<el-col :span="8" style="display: flex;flex-direction: column; justify-content: center;align-items: center;">
<div>未付款总金额全部/本月</div>
<div>2000/1000</div>
</el-col>
</el-row>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="status" label="供应商" width="220" />
<el-table-column prop="status" label="账单金额" width="160" />
<el-table-column prop="status" label="已付款金额" width="160" />
<el-table-column prop="status" label="未付款金额" width="160" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column label="操作" width="120">
<template v-slot="scope">
<el-button type="primary" size="small" link @click="handleTo(scope.row.id)">
账单记录
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div class="head-container">
<el-pagination v-model:current-page="state.tableData.page" v-model:page-size="state.tableData.size"
:total="state.tableData.total" :page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper " @current-change="paginationChange" />
</div>
</div>
</template>
<script setup>
import ShopApi from "@/api/account/shop";
const router = useRouter();
const state = reactive({
query: {
name: "",
},
tableData: {
list: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
});
onMounted(() => {
getTableData();
});
// 获取商家列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
});
state.tableData.loading = false;
state.tableData.list = res.records;
state.tableData.total = res.totalRow * 1;
} catch (error) {
console.log(error);
}
}
function handleTo(id) {
// router.push({ path: "/finance/supplierBill/billingRecord", query: { id: e.id } });
router.push({ name: "financeBillingRecord", query: { id: id } });
}
// 重置查询
function resetHandle() {
state.query.name = "";
getTableData();
}
// 分页回调
function paginationChange(e) {
state.tableData.page = e;
getTableData();
}
</script>
<style scoped lang="scss">
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>

View File

@@ -0,0 +1,131 @@
<template>
<div class="app-container">
<div class="head-container">
<el-card shadow="never">
<el-alert title="当前列表仅作为数据记录,不产生任何实际交易。" type="warning" show-icon :closable="false"
style="margin-bottom: 15px;" />
<el-text tag="b" size="large" style="margin-left: 15px;">供应商供应商名称</el-text>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="耗材信息">
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>联系电话{{ scope.row.phone }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="付款金额" width="120" />
<el-table-column prop="status" label="付款方式" width="120" />
<el-table-column prop="createdAt" label="备注" />
<el-table-column prop="status" label="创建时间" />
<el-table-column label="操作人" width="200">
<template v-slot="scope">
<div>员工名称{{ scope.row.shopName }}</div>
<div>员工编号{{ scope.row.shopName }}</div>
<div>员工账号{{ scope.row.phone }}</div>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div class="head-container">
<el-pagination v-model:current-page="state.tableData.page" v-model:page-size="state.tableData.size"
:total="state.tableData.total" :page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper " @current-change="paginationChange" />
</div>
</div>
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import { ElMessageBox } from "element-plus";
const route = useRoute();
const state = reactive({
query: {
name: "",
},
tableData: {
list: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
}
getTableData();
});
// 获取商家列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
});
state.tableData.loading = false;
state.tableData.list = res.records;
state.tableData.total = res.totalRow * 1;
} catch (error) {
console.log(error);
}
}
function handleSync(e) {
console.log(e)
ElMessageBox.confirm(`同步功能开启后不能关闭,请确认是否给${e.shopName}开启同步?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
}).then(async () => {
const res = await ShopApi.delete({ id: row.id });
ElMessage({
type: "success",
message: "同步成功",
});
getTableData();
}).catch(() => { });
}
// 重置查询
function resetHandle() {
state.query.name = "";
getTableData();
}
// 分页回调
function paginationChange(e) {
state.tableData.page = e;
getTableData();
}
</script>
<style scoped lang="scss">
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>

View File

@@ -1,197 +0,0 @@
<template>
<!-- 修改和增加 -->
<el-dialog :title="dialogtitle" v-model="show" width="85%">
<div v-if="dialogtitle != '编辑'">
<div v-for="(item, index) in forms" :key="index">
<el-form
:inline="true"
:ref="(el) => setFormRef(el, index)"
:model="item"
:rules="rules"
class="demo-form-inline"
>
<el-form-item label=" ">
<el-icon color="red" @click="formsReduce(index)"><Remove /></el-icon>
</el-form-item>
<el-form-item label="耗材名称" prop="conName">
<el-input v-model="item.conName" placeholder="请输入耗材信息名称"></el-input>
</el-form-item>
<el-form-item label="耗材类型" prop="conTypeId">
<el-select v-model="item.conTypeId" placeholder="请选择耗材类型" style="width: 200px">
<el-option
v-for="option in consGroups"
:key="option.conTypeId"
:label="option.conTypeName"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="单位" prop="conUnit">
<el-input v-model="item.conUnit" placeholder="请输入单位"></el-input>
</el-form-item>
<el-form-item label="耗材价格">
<el-input v-model="item.price" placeholder="请输入耗材价格"></el-input>
</el-form-item>
<el-form-item label="预警值">
<el-input v-model="item.conWarning" placeholder="请输入耗材预警值"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-icon color="green" @click="formsAdd(index)"><CirclePlus /></el-icon>
</el-form-item>
</el-form>
</div>
<div style="display: flex; justify-content: flex-end">
<el-button @click="dialogshow = false"> </el-button>
<el-button type="primary" @click="submitForms()"> </el-button>
</div>
</div>
<el-form
v-else
:inline="true"
ref="refform"
:model="form"
:rules="rules"
class="demo-form-inline"
>
{{ dialogtitle }}
<el-form-item label="耗材信息名称" prop="conName">
<el-input v-model="form.conName" placeholder="请输入耗材信息名称"></el-input>
</el-form-item>
<el-form-item label="耗材价格">
<el-input v-model="form.price" placeholder="请输入耗材价格"></el-input>
</el-form-item>
<el-form-item label="单位" prop="conUnit">
<el-input v-model="form.conUnit" placeholder="请输入单位"></el-input>
</el-form-item>
<el-form-item label="预警值">
<el-input v-model="form.conWarning" placeholder="请输入耗材预警值"></el-input>
</el-form-item>
<!-- <el-form-item label="状态" v-if="dialogtitle == '编辑'">
<el-switch v-model="form.status" active-value="1" inactive-value="0"></el-switch>
</el-form-item> -->
<!-- <el-form-item label="单位耗材值" prop="surplusStock">
<el-input v-model="form.surplusStock" placeholder="请输入单位耗材值"></el-input>
</el-form-item> -->
<el-form-item style="display: flex; justify-content: flex-end">
<el-button @click="dialogshow = false"> </el-button>
<el-button type="primary" @click="submitForm('refform')"> </el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup>
import consApi from "@/api/product/cons";
import consGroupApi from "@/api/product/cons-group";
import { ElMessage } from "element-plus";
const consGroups = ref([]);
const rules = {
conCode: [{ required: true, message: "请输入耗材信息代码", trigger: "blur" }],
conName: [{ required: true, message: "请输入耗材信息名称", trigger: "blur" }],
conTypeId: [{ required: true, message: "请选择耗材类型", trigger: "change" }],
price: [{ required: true, message: "请输入耗材价格", trigger: "blur" }],
conWarning: [{ required: true, message: "请输入耗材预警值", trigger: "blur" }],
conTypeId: [{ required: true, message: "请输入耗材类型id", trigger: "blur" }],
conUnit: [{ required: true, message: "请输入单位", trigger: "blur" }],
conWarning: [
{
required: true,
message: "请输入单位",
trigger: "blur",
},
],
};
function getConsGroups() {
consGroupApi.getAllList().then((res) => {
consGroups.value = res.map((v) => {
return {
...v,
label: v.name,
value: v.id,
};
});
});
}
getConsGroups();
const basicForm = {
conCode: "",
conName: "",
conTypeId: "",
price: "0",
conNames: "",
conUnit: "",
conWarning: "999",
shopId: localStorage.getItem("shopId"),
status: "",
};
const forms = ref([{ ...basicForm }]);
const form = reactive({
...basicForm,
});
const show = ref(false);
let dialogtitle = ref("");
function open(item) {
dialogtitle.value = item ? "编辑" : "新增";
show.value = true;
}
function formsAdd(index) {
forms.value.push({ ...basicForm });
}
function close() {
show.value = false;
}
const refForms = ref([]);
function setFormRef(el, index) {
if (el) {
refForms.value[index] = el;
}
}
function returnPromise(index, prosise) {
return new Promise((resolve, reject) => {
prosise
.then((res) => {
console.log(res);
resolve({ sucees: true });
})
.catch((err) => {
console.log(err);
resolve({ sucees: false });
});
});
}
async function submitForms() {
let isAllPassForm = 0;
for (let i in this.forms) {
console.log(refForms.value[i]);
const res = await returnPromise(i, refForms.value[i].validate());
console.log(res);
isAllPassForm += res.sucees ? 1 : 0;
}
//判断验证是否通过
if (isAllPassForm === this.forms.length) {
await consApi.add(this.forms);
ElMessage({ type: "success", message: "添加成功" });
// for(let i of this.forms){
// const res=await posttbConsInfo(i)
// this.$message({ type: "success", message: "添加成功" });
// }
this.dialogshow = false;
this.resetRuleForms();
this.ruleFormLoading = false;
this.getTableData();
}
}
defineExpose({
open,
close,
});
</script>

View File

@@ -301,10 +301,13 @@ async function handleEditClick(row: IObject) {
// 其他工具栏
function handleToolbarClick(name: string) {
console.log(name);
if (name === "custom1") {
if ( name === "custom1" ) {
// ElMessage.success("点击了自定义1按钮");
myDialogRef.value.open();
}
if ( name === "custom2" ) { //商品同步
}
}
async function confirm() {
let res = await UserAPI.stockWarning(form.warnLine)

View File

@@ -59,6 +59,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
pk: "id",
toolbar: [
"add",
{
icon: "refresh",
text: "同步",
type: "danger",
name: "custom2",
auth: "import",
},
{
icon: "edit",
text: "库存预警",
@@ -66,6 +73,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
name: "custom1",
auth: "import",
},
],
cols: [
// { type: "selection", width: 50, align: "center" },

View File

@@ -0,0 +1,166 @@
<template>
<div class="app-container">
<div class="head-container">
<el-card shadow="never">
<el-row :gutter="20">
<el-col :span="4">
<el-input v-model="state.query.name" clearable placeholder="请输入分店名称" style="width: 100%" class="filter-item"
@keyup.enter="getTableData" />
</el-col>
<el-col :span="6">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
</el-card>
</div>
<div class="head-container">
<el-card shadow="never">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column prop="status" label="ID" width="80" />
<el-table-column label="店铺信息" >
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>联系电话{{ scope.row.phone }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="商品同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
</template>
</el-table-column>
<el-table-column prop="status" label="会员同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
</template>
</el-table-column>
<el-table-column prop="status" label="耗材同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
</template>
</el-table-column>
<el-table-column prop="status" label="账号状态" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
</template>
</el-table-column>
<el-table-column prop="createdAt" label="备注" />
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="primary" size="small" link icon="edit" @click="handleSync(scope.row)">
同步启用
</el-button>
<el-button type="primary" size="small" link icon="edit" @click="handleAccount(scope.row.id)">
账号启用
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div class="head-container">
<el-pagination v-model:current-page="state.tableData.page" v-model:page-size="state.tableData.size"
:total="state.tableData.total" :page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper " @current-change="paginationChange" />
</div>
</div>
</template>
<script setup>
import dayjs from "dayjs";
import ShopApi from "@/api/account/shop";
import { ElNotification, ElMessageBox } from "element-plus";
const state = reactive({
query: {
name: "",
},
status: [
{
type: 1,
label: "开启",
},
{
type: 0,
label: "关闭",
},
],
tableData: {
list: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
});
onMounted(() => {
getTableData();
});
// 获取商家列表
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
});
state.tableData.loading = false;
state.tableData.list = res.records;
state.tableData.total = res.totalRow * 1;
} catch (error) {
console.log(error);
}
}
function handleSync(e) {
console.log(e)
ElMessageBox.confirm(`同步功能开启后不能关闭,请确认是否给${e.shopName}开启同步?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
}).then(async () => {
const res = await ShopApi.delete({ id: row.id });
ElMessage({
type: "success",
message: "同步成功",
});
getTableData();
}).catch(() => { });
}
// 重置查询
function resetHandle() {
state.query.name = "";
getTableData();
}
// 分页回调
function paginationChange(e) {
state.tableData.page = e;
getTableData();
}
</script>
<style scoped lang="scss">
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>

View File

@@ -1,17 +1,7 @@
<template>
<el-dialog
:title="state.form.id ? '编辑店铺' : '添加店铺'"
v-model="state.dialogVisible"
@close="reset"
>
<el-dialog :title="state.form.id ? '编辑店铺' : '添加店铺'" v-model="state.dialogVisible" @close="reset">
<div style="height: 50vh; overflow-y: auto">
<el-form
ref="refForm"
:model="state.form"
:rules="state.rules"
label-width="120px"
label-position="left"
>
<el-form ref="refForm" :model="state.form" :rules="state.rules" label-width="120px" label-position="left">
<el-form-item label="店铺名称" prop="shopName">
<el-input v-model="state.form.shopName" placeholder="请输入门店名称"></el-input>
</el-form-item>
@@ -23,22 +13,18 @@
</el-radio-group>
<div class="tips">请谨慎修改</div>
</el-form-item>
<el-form-item label="主店账号" prop="mainId" v-if="state.form.shopType != 'only'">
<el-select
v-model="state.form.mainId"
placeholder="请选择主店铺"
filterable
remote
reserve-keyword
:remote-method="getTableData"
:loading="state.shopListLoading"
>
<el-option
v-for="item in state.shopList"
:label="`ID:${item.id} - 名称:${item.shopName}`"
:value="item.id"
:key="item.id"
></el-option>
<el-form-item label="是否为主店" prop="isMainStore">
<el-radio-group v-model="state.form.isMainStore" @change=" state.form.mainId = ''">
<el-radio value="1"></el-radio>
<el-radio value="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="主店账号" prop="mainId" v-if="state.form.isMainStore == '0'">
<!-- <el-form-item label="主店账号" prop="mainId" v-if="state.form.shopType != 'only'"> -->
<el-select v-model="state.form.mainId" placeholder="请选择主店铺" filterable reserve-keyword
:remote-method="getTableData" :loading="state.shopListLoading">
<el-option v-for="item in state.shopList" :label="`${item.shopName}`" :value="item.id"
:key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="连锁店扩展店名">
@@ -78,24 +64,14 @@
<el-input v-model="state.form.accountName" placeholder="请输入登录账号"></el-input>
</el-form-item>
<el-form-item label="登录密码" prop="password" v-if="!state.form.id">
<el-input
type="password"
show-password
v-model="state.form.accountPwd"
placeholder="请输入登录密码"
></el-input>
<el-input type="password" show-password v-model="state.form.accountPwd" placeholder="请输入登录密码"></el-input>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="state.form.phone" placeholder="请输入联系电话"></el-input>
</el-form-item>
<el-form-item label="设备数量">
<el-input-number
v-model="state.form.supportDeviceNumber"
controls-position="right"
:min="1"
:step="1"
step-strictly
></el-input-number>
<el-input-number v-model="state.form.supportDeviceNumber" controls-position="right" :min="1" :step="1"
step-strictly></el-input-number>
</el-form-item>
<!-- <el-form-item label="外卖起送金额">
<el-input-number v-model="form.takeaway_money" placeholder="0.00" controls-position="right"
@@ -104,10 +80,7 @@
<el-form-item label="店铺经度" prop="lat">
<el-row>
<el-col :span="9" v-if="state.form.provinces">
<el-input
:value="`${state.form.provinces}-${state.form.cities}-${state.form.districts}`"
disabled
/>
<el-input :value="`${state.form.provinces}-${state.form.cities}-${state.form.districts}`" disabled />
</el-col>
<el-col :span="4" v-if="state.form.lng">
<el-input v-model="state.form.lng" placeholder="经度" disabled></el-input>
@@ -123,18 +96,10 @@
</el-row>
</el-form-item>
<el-form-item label="店铺详细地址">
<el-input
type="textarea"
v-model="state.form.address"
placeholder="请输入门店详细地址"
></el-input>
<el-input type="textarea" v-model="state.form.address" placeholder="请输入门店详细地址"></el-input>
</el-form-item>
<el-form-item label="店铺简介">
<el-input
type="textarea"
v-model="state.form.detail"
placeholder="请输入店铺简介"
></el-input>
<el-input type="textarea" v-model="state.form.detail" placeholder="请输入店铺简介"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="state.form.status">
@@ -144,12 +109,7 @@
</el-form-item>
</el-form>
</div>
<el-dialog
title="选择地址"
v-model="state.showLocation"
:modal="false"
:modal-append-to-body="false"
>
<el-dialog title="选择地址" v-model="state.showLocation" :modal="false" :modal-append-to-body="false">
<div class="map_box">
<div class="map">
<el-amap ref="map" :center="state.amapOptions.center" @init="mapInit">
@@ -157,13 +117,8 @@
</el-amap>
</div>
<div class="search_box">
<el-input
v-model="state.searchOption.keyword"
placeholder="请输入关键字"
@focus="state.searchOption.focus = true"
@blur="autoCompleteSearchBlur"
@input="autoCompleteSearch(state.searchOption.keyword)"
>
<el-input v-model="state.searchOption.keyword" placeholder="请输入关键字" @focus="state.searchOption.focus = true"
@blur="autoCompleteSearchBlur" @input="autoCompleteSearch(state.searchOption.keyword)">
<template #append>
<el-button type="primary" @click="placeSearchSearch(state.searchOption.keyword)">
搜索
@@ -171,12 +126,8 @@
</template>
</el-input>
<div class="list" v-if="state.searchOption.focus && state.searchOption.show">
<div
class="item"
@click="autoCompleteListClick(item)"
v-for="item in state.autoCompleteList"
:key="item.id"
>
<div class="item" @click="autoCompleteListClick(item)" v-for="item in state.autoCompleteList"
:key="item.id">
{{ item.name }}
</div>
</div>
@@ -257,6 +208,7 @@ const state = reactive({
cities: "",
districts: "",
chainName: "",
isMainStore: '0',
},
resetForm: "",
rules: {
@@ -274,6 +226,13 @@ const state = reactive({
trigger: "blur",
},
],
isMainStore: [
{
required: true,
message: " ",
trigger: "blur",
},
],
mainId: [
{
required: true,
@@ -347,6 +306,7 @@ onMounted(() => {
// 获取商家列表
async function getTableData(query = "") {
console.log(123)
state.shopListLoading = true;
try {
const res = await ShopApi.getList({
@@ -356,7 +316,7 @@ async function getTableData(query = "") {
type: "only",
});
state.shopListLoading = false;
state.shopList = res.content;
state.shopList = res.records;
} catch (error) {
state.shopListLoading = false;
console.log(error);
@@ -525,14 +485,17 @@ defineExpose({
top: 10px;
left: 10px;
z-index: 3000;
.list {
background-color: #fff;
.item {
height: 40px;
line-height: 40px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
padding: 0 10px;
cursor: pointer;
&:hover {
background-color: #eee;
}

View File

@@ -3,33 +3,16 @@
<div class="head-container">
<el-row :gutter="20">
<el-col :span="3">
<el-input
v-model="state.query.name"
clearable
placeholder="请输入店铺名称"
style="width: 100%"
class="filter-item"
@keyup.enter="getTableData"
/>
<el-input v-model="state.query.name" clearable placeholder="请输入店铺名称" style="width: 100%" class="filter-item"
@keyup.enter="getTableData" />
</el-col>
<el-col :span="3">
<el-input
v-model="state.query.account"
clearable
placeholder="请输入商户号"
style="width: 100%"
class="filter-item"
@keyup.enter="getTableData"
/>
<el-input v-model="state.query.account" clearable placeholder="请输入商户号" style="width: 100%" class="filter-item"
@keyup.enter="getTableData" />
</el-col>
<el-col :span="3">
<el-select v-model="state.query.status" placeholder="请选择店铺状态" style="width: 100%">
<el-option
:label="item.label"
:value="item.type"
v-for="item in state.status"
:key="item.type"
/>
<el-option v-for="item in state.status" :key="item.type" :label="item.label" :value="item.type" />
</el-select>
</el-col>
<el-col :span="6">
@@ -42,33 +25,31 @@
<el-button type="primary" icon="plus" @click="addShopShow">添加店铺</el-button>
</div>
<div class="head-container">
<el-table :data="state.tableData.list" v-loading="state.tableData.loading">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column label="店铺信息" width="200">
<template v-slot="scope">
<div class="shop_info">
<el-image
:src="scope.row.logo"
style="width: 50px; height: 50px; border-radius: 4px; background-color: #efefef"
>
<el-image :src="scope.row.logo"
style="width: 50px; height: 50px; border-radius: 4px; background-color: #efefef">
<template #error>
<div class="img_error">
<i class="icon el-icon-document-delete"></i>
<i class="icon el-icon-document-delete" />
</div>
</template>
</el-image>
<div class="info">
<span>{{ scope.row.shopName }}</span>
<div class="tag_wrap">
<el-tag type="info" effect="dark" v-if="scope.row.profiles == 'no'">
<el-tag v-if="scope.row.profiles == 'no'" type="info" effect="dark">
未激活
</el-tag>
<el-tag type="warning" effect="dark" v-if="scope.row.profiles == 'probation'">
<el-tag v-if="scope.row.profiles == 'probation'" type="warning" effect="dark">
试用
</el-tag>
<el-tag type="success" effect="dark" v-if="scope.row.profiles == 'release'">
<el-tag v-if="scope.row.profiles == 'release'" type="success" effect="dark">
正式
</el-tag>
<el-tag type="primary" effect="dark" v-if="scope.row.isWxMaIndependent">
<el-tag v-if="scope.row.isWxMaIndependent" type="primary" effect="dark">
独立小程序
</el-tag>
</div>
@@ -76,23 +57,24 @@
</div>
</template>
</el-table-column>
<el-table-column prop="registerType" label="类型">
<el-table-column prop="registerType" label="经营模式">
<template v-slot="scope">
<span v-if="scope.row.registerType == 'before'">快餐版</span>
<span v-if="scope.row.registerType == 'after'">餐饮版</span>
</template>
</el-table-column>
<el-table-column prop="address" label="商户号"></el-table-column>
<el-table-column prop="lowPrice" label="来源"></el-table-column>
<el-table-column prop="lowPrice" label="认证状态">-</el-table-column>
<el-table-column prop="address" label="商户号" />
<el-table-column prop="status" label="店铺类型">
<template v-slot="scope">
<div>
<span>{{ scope.row.shopName }}</span>
<div>(主店)</div>
</div>
</template>
</el-table-column>
<el-table-column prop="status" label="店铺状态">
<template v-slot="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
disabled
></el-switch>
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
</template>
</el-table-column>
<el-table-column prop="createdAt" label="到期时间">
@@ -106,17 +88,23 @@
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-link @click="addShopShow(scope.row)">
<el-icon><Edit /></el-icon>
<el-icon>
<Edit />
</el-icon>
编辑
</el-link>
<el-link @click="activateCodeShow(scope.row)">
<el-icon><Edit /></el-icon>
<el-icon>
<Edit />
</el-icon>
激活
</el-link>
<el-dropdown @command="dropdownClick($event, scope.row)">
<el-link>
更多
<el-icon><ArrowDown /></el-icon>
<el-icon>
<ArrowDown />
</el-icon>
</el-link>
<template #dropdown>
@@ -136,14 +124,9 @@
</el-table>
</div>
<div class="head-container">
<el-pagination
:total="state.tableData.total"
v-model:current-page="state.tableData.page"
v-model:page-size="state.tableData.size"
:page-sizes="[10, 20, 30, 50, 100]"
@current-change="paginationChange"
layout="total, sizes , prev, pager ,next, jumper "
></el-pagination>
<el-pagination v-model:current-page="state.tableData.page" v-model:page-size="state.tableData.size"
:total="state.tableData.total" :page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper " @current-change="paginationChange" />
</div>
<addShop ref="refAddShop" @success="getTableData" />
<detailModal ref="refDetailModal" />
@@ -217,7 +200,7 @@ function dropdownClick(e, row) {
});
getTableData();
})
.catch(() => {});
.catch(() => { });
return;
}
}
@@ -257,6 +240,7 @@ async function getTableData() {
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
@@ -265,8 +249,9 @@ async function getTableData() {
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>
</style>

View File

@@ -1,9 +1,27 @@
import type { ISearchConfig } from "@/components/CURD/types";
import { paramTypeOptions } from './config'
import UserAPI from "@/api/product/productclassification";
const searchConfig: ISearchConfig = {
pageName: "sys:user",
formItems: [
{
type: "select",
label: "分店选择",
prop: "storeId",
attrs: {
placeholder: "请选择分店",
clearable: true,
style: {
width: "200px",
},
},
options: [],
async initFn(formItem) {
formItem.options = await UserAPI.getList();
},
},
{
type: "input",
label: "账号名",