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

This commit is contained in:
YeMingfei666 2025-04-08 11:20:22 +08:00
commit 367efae393
16 changed files with 396 additions and 148 deletions

View File

@ -10,6 +10,13 @@ const ShopApi = {
params: params,
});
},
getBranchList(params: PageQuery) {
return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}/branchList`,
method: "get",
params: params,
});
},
add(data: ShopInfoEditDTO) {
return request<any, ShopInfoEditDTO>({
url: `${baseURL}`,
@ -277,4 +284,4 @@ export interface ShopInfo {
tubeType?: number | null;
updateTime?: null | string;
[property: string]: any;
}
}

View File

@ -0,0 +1,51 @@
import request from "@/utils/request";
import { Account_BaseUrl } from "@/api/config";
const baseURL = Account_BaseUrl + "/admin/shop/branch";
const ShopBranchApi = {
getList(params: any) {
return request<any>({
url: `${baseURL}/page`,
method: "get",
params
});
},
setDataSync(id: any) {
console.log(id)
return request<any>({
url: `${baseURL}/setting/dataSyncMethod?dataSyncMethod=${id}`,
method: "post",
});
},
dataSync(id: any) {
console.log(id)
return request<any>({
url: `${baseURL}/data/sync/enable?branchShopId=${id}`,
method: "post",
});
},
enable(id: any) {
console.log(id)
return request<any>({
url: `${baseURL}/account/enable?branchShopId=${id}`,
method: "post",
});
},
disable(id: any) {
return request<any>({
url: `${baseURL}/account/disable?branchShopId=${id}`,
method: "post",
});
},
};
export interface Responseres {
code?: number | null;
data?: any;
msg?: null | string;
[property: string]: any;
}
export default ShopBranchApi;

60
src/api/supplier/index.ts Normal file
View File

@ -0,0 +1,60 @@
import request from "@/utils/request";
const baseURL = "/product/admin/product/vendor";
// 供应商账单
const AuthAPI = {
/** 供应商账单统计*/
getSummary(params: any) {
return request<any, Responseres>({
url: `${baseURL}/summary`,
method: "get",
params,
});
},
/** 分页*/
getPage(params: any) {
return request<any, Responseres>({
url: `${baseURL}/bill`,
method: "get",
params,
});
},
// 账单记录
getRecordList(params: any) {
return request<any, Responseres>({
url: `${baseURL}/bill/record`,
method: "get",
params,
});
},
// 账单付款记录
getPayRecordList(params: any) {
return request<any, Responseres>({
url: `${baseURL}/bill/pay/record`,
method: "get",
params,
});
},
// 账单付款
billPay(data: any) {
return request<any, Responseres>({
url: `${baseURL}/bill/pay`,
method: "post",
data,
});
},
};
export interface Responseres {
code?: number | null;
data?: any;
msg?: null | string;
[property: string]: any;
}
export default AuthAPI;

View File

@ -1,34 +1,67 @@
<template>
<div class="logo">
<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> -->
<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 class="logo wh-full flex-center">
<!-- <transition name="el-fade-in-linear" mode="out-in"> -->
<!-- <router-link :key="+collapse" class="wh-full flex-center" to="/"> -->
<img :src="state.userInfo.logo" class="w20px h20px" />
<!-- <span v-if="!collapse" class="title">{{ userStore.userInfo.shopName }}</span> -->
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
<span v-if="!collapse" class="title">{{ state.shopName }}</span>
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
:command="item.shopId"
v-for="(item,index) in state.branchList" :key="index"
> {{ item.shopName }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<!-- </router-link> -->
<!-- </transition> -->
</div>
</template>
<script lang="ts" setup>
<script setup>
import defaultSettings from "@/settings";
import { useUserStore } from "@/store";
import ShopApi from "@/api/account/shop";
const userStore = useUserStore();
const state = reactive({
branchList: [],
userInfo: useUserStore().userInfo,
shopName: useUserStore().userInfo.shopName
});
onMounted(() => {
geiShopList()
});
async function geiShopList() {
let res = await ShopApi.getBranchList()
state.branchList = res;
if ( !localStorage.getItem("shopName") ) {
state.shopName = state.branchList[0].shopName
// localStorage.setItem("shopId", state.branchList[0].shopId )
localStorage.setItem("shopName", state.branchList[0].shopName )
} else {
state.shopName = localStorage.getItem("shopName")
}
}
function handleCommand(command) {
console.log(command)
let res = state.branchList.filter(v=> v.shopId == command)[0]
// localStorage.setItem("shopId", res.shopId )
localStorage.setItem("shopName", res.shopName )
state.shopName = res.shopName
console.log(res)
console.log(command)
}
defineProps({
collapse: {
@ -43,6 +76,7 @@ defineProps({
width: 100%;
height: $navbar-height;
background-color: $sidebar-logo-background;
cursor: pointer;
.title {
flex-shrink: 0;

View File

@ -22,7 +22,8 @@ service.interceptors.request.use(
} else {
delete config.headers.token;
}
config.headers.shopId = config.headers.shopId || useUserStoreHook().userInfo.id;
config.headers.shopId = config.headers.shopId || localStorage.getItem("shopId");
// config.headers.shopId = config.headers.shopId || useUserStoreHook().userInfo.id;
return config;
},
(error) => Promise.reject(error)

View File

@ -53,7 +53,7 @@
</div>
<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-option v-for="item in branchList" :key="item.shopId" :label="item.shopName" :value="item.shopId" />
</el-select>
<div class="time_wrap u-flex" style="flex-shrink: 0">
<el-radio-group v-model="timeValue" class="m-r-5" @change="timeChange">
@ -338,6 +338,7 @@
<script>
import dataSummaryApi from "@/api/order/data-summary";
import ShopApi from "@/api/account/shop";
import dayjs from "dayjs";
import * as echarts from "echarts";
import { debounce, formatDecimal } from "@/utils/tools";
@ -389,7 +390,7 @@ export default {
saveAmount: null,
},
],
storeList: [{ label: "门店1", value: 1 }],
branchList: [],
storeId: null,
trade: {},
formatDecimal,
@ -481,9 +482,14 @@ export default {
// }
}, 100);
window.addEventListener("resize", this.__resizeHandler);
this.geiShopList()
// this.initCardUserChart();
},
methods: {
async geiShopList() {
let res = await ShopApi.getBranchList()
this.branchList = res;
},
//
timeChange(e) {
const format = ["YYYY-MM-DD 00:00:00", "YYYY-MM-DD 23:59:59"];

View File

@ -13,7 +13,7 @@
<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-option v-for="item in branchList" :key="item.shopId" :label="item.shopName" :value="item.shopId" />
</el-select>
</el-form-item>
<el-form-item>
@ -182,7 +182,7 @@ export default {
downloadLoading: false,
payCount: "",
payCountTotal: 0,
storeList: [{ label: "门店1", value: 1 }],
branchList: [],
storeId: null,
};
},
@ -195,8 +195,16 @@ export default {
this.resetQuery = { ...this.query };
this.getTableData();
this.getCategory();
this.geiShopList();
},
methods: {
/**
* 获取分店列表
*/
async geiShopList() {
let res = await ShopApi.getBranchList()
this.branchList = res;
},
totalfilter(item, d) {
let num = item + d;
return num.toFixed(2);

View File

@ -12,28 +12,30 @@
<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-button type="primary" @click="handlePayment('all')" plain>批量付款</el-button>
<el-text tag="b" size="large" style="margin-left: 15px;">供应商{{ state.supplierName }}</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 @selection-change="handleSelectionChange" v-loading="state.tableData.loading"
:data="state.tableData.list">
<el-table-column type="selection" width="55" />
<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>
<div>{{ scope.row.conName }}</div>
<div>单价{{ scope.row.purchasePrice }}</div>
<div>入库数量{{ scope.row.inOutNumber }}</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 prop="amountPayable" label="账单金额" width="120" />
<el-table-column prop="actualPaymentAmount" label="已付款金额" width="120" />
<el-table-column prop="unPaidAmount" label="未付款金额" width="120" />
<el-table-column prop="createTime" label="创建时间" width="120" />
<el-table-column prop="remark" label="备注" />
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="primary" size="small" link @click="handlePayment(scope.row)">
@ -58,9 +60,9 @@
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import { ElMessageBox } from "element-plus";
import AuthAPI from "@/api/supplier/index";
import payment from "./components/payment.vue";
import { ElMessage } from "element-plus";
const route = useRoute();
const router = useRouter();
@ -68,6 +70,7 @@ const router = useRouter();
const state = reactive({
query: {
name: "",
vendorId: null,
},
tableData: {
list: [],
@ -76,23 +79,28 @@ const state = reactive({
loading: false,
total: 0,
},
supplierName: '',
flowIdList: [],
allAmount: 0
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
if (route.query.vendorId) {
state.query.vendorId = route.query.vendorId
}
if (route.query.supplierName) {
state.supplierName = route.query.supplierName
}
getTableData();
});
//
//
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getRecordList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
key: state.query.name,
vendorId: state.query.vendorId,
});
state.tableData.loading = false;
state.tableData.list = res.records;
@ -103,11 +111,28 @@ async function getTableData() {
}
const refPayment = ref();
function handlePayment(item) {
refPayment.value.open(item);
if (item != 'all') {
state.flowIdList = [item.id]
} else {
if( state.flowIdList.length <= 0 ){
ElMessage({ type: "error", message: "请选择付款耗材" });
return;
}
}
refPayment.value.open({ flowIdList: state.flowIdList, supplierName: state.supplierName,allAmount:state.allAmount });
}
function handleSelectionChange(e) {
state.flowIdList = []
state.allAmount = 0
e.map(item => {
state.flowIdList.push(item.id)
state.allAmount += item.unPaidAmount
})
}
//
function handleRecord(id) {
router.push({ name: "financePaymentRecord", query: { id: id } });
router.push({ name: "financePaymentRecord", query: { id: id, supplierName: state.supplierName } });
}

View File

@ -2,17 +2,18 @@
<!-- 修改和增加 -->
<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 label="供应商">
<el-input v-model="supplierName" placeholder="请输入供应商名称" readonly></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 label="付款金额 " prop="amount">
<el-input-number v-model="form.amount" :readonly="form.flowIdList.length > 1" 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 label="付款方式" prop="type">
<el-input v-model="form.type" placeholder="请输入付款方式"></el-input>
</el-form-item>
<el-form-item label="备注" prop="defaultUnit">
<el-input v-model="form.defaultUnit" placeholder="请输入备注"></el-input>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item style="display: flex; justify-content: flex-end">
<el-button @click="close"> </el-button>
@ -24,33 +25,35 @@
<script setup>
import consApi from "@/api/product/cons";
import AuthAPI from "@/api/supplier/index";
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" }],
amount: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
type: [{ required: true, message: "请输入付款方式", trigger: "blur" }],
};
const basicForm = {
conName: "",
consGroupId: "",
conUnit: "",
price: undefined,
conWarning: undefined,
flowIdList: [],
amount: undefined,
type: '',
remark: '',
};
const form = reactive({
...basicForm,
});
const supplierName = ref('');
const show = ref(false);
function open(item) {
Object.assign(form, item);
form.flowIdList = item.flowIdList
supplierName.value = item.supplierName
if (item.flowIdList.length > 1 && item.allAmount) {
form.amount = item.allAmount
}
// Object.assign(form, item);
show.value = true;
}
@ -61,8 +64,8 @@ const refform = ref();
async function submitForm() {
refform.value.validate(async (valid) => {
if (valid) {
const res = await consApi.add(form);
ElMessage({ type: "success", message: "付款成功" });
const res = await AuthAPI.billPay(form);
ElMessage({ type: "success", message: "付款成功" });
emits("refresh");
close();
}
@ -72,7 +75,7 @@ async function submitForm() {
function reset() {
console.log("reset");
Object.assign(form, basicForm);
console.log(form);
close();
}
defineExpose({
open,

View File

@ -21,16 +21,16 @@
<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>
<div>{{ state.summaryData.amountPayable }} / {{ state.summaryData.mouthAmountPayable }}</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>
<div>{{ state.summaryData.actualPaymentAmount }} / {{ state.summaryData.mouthActualPaymentAmount }}</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>
<div>{{ state.summaryData.unPaidAmount }} / {{ state.summaryData.mouthUnPaidAmount }}</div>
</el-col>
</el-row>
</el-card>
@ -38,15 +38,14 @@
<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 prop="name" label="供应商" width="220" />
<el-table-column prop="amountPayable" label="账单金额" width="200" />
<el-table-column prop="actualPaymentAmount" label="已付款金额" width="200" />
<el-table-column prop="unPaidAmount" label="未付款金额" width="200" />
<el-table-column prop="remark" 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 type="primary" size="small" link @click="handleTo(scope.row)">
账单记录
</el-button>
</template>
@ -64,13 +63,14 @@
</template>
<script setup>
import ShopApi from "@/api/account/shop";
import AuthAPI from "@/api/supplier/index";
const router = useRouter();
const state = reactive({
query: {
name: "",
},
summaryData: {},
tableData: {
list: [],
page: 1,
@ -80,18 +80,27 @@ const state = reactive({
},
});
onMounted(() => {
getSummary();
getTableData();
});
//
async function getSummary() {
try {
const res = await AuthAPI.getSummary();
state.summaryData = res;
} catch (error) {
console.log(error);
}
}
//
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getPage({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
key: state.query.name,
});
state.tableData.loading = false;
state.tableData.list = res.records;
@ -100,9 +109,9 @@ async function getTableData() {
console.log(error);
}
}
function handleTo(id) {
function handleTo(row) {
// router.push({ path: "/finance/supplierBill/billingRecord", query: { id: e.id } });
router.push({ name: "financeBillingRecord", query: { id: id } });
router.push({ name: "financeBillingRecord", query: { vendorId: row.vendorId, supplierName: row.name } });
}
//

View File

@ -4,7 +4,7 @@
<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-text tag="b" size="large" style="margin-left: 15px;">供应商{{ state.supplierName }}</el-text>
</el-card>
</div>
<div class="head-container">
@ -13,20 +13,20 @@
<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>
<div>{{ scope.row.conName }}</div>
<div>单价{{ scope.row.purchasePrice }}</div>
<div>入库数量{{ scope.row.inOutNumber }}</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 prop="amount" label="付款金额" width="120" />
<el-table-column prop="type" label="付款方式" width="120" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="createTime" 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>
<div>员工名称{{ scope.row.nickname }}</div>
<div>员工编号{{ scope.row.code }}</div>
<div>员工账号{{ scope.row.account }}</div>
</template>
</el-table-column>
</el-table>
@ -43,12 +43,15 @@
<script setup>
import ShopApi from "@/api/account/shop";
import AuthAPI from "@/api/supplier/index";
import { ElMessageBox } from "element-plus";
const route = useRoute();
const state = reactive({
query: {
name: "",
flowId: null,
},
tableData: {
list: [],
@ -57,23 +60,26 @@ const state = reactive({
loading: false,
total: 0,
},
supplierName: '',
});
onMounted(() => {
console.log(route.query);
if (route.query.id) {
state.query.flowId = route.query.id
}
if (route.query.supplierName) {
state.supplierName = route.query.supplierName
}
getTableData();
});
//
//
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await AuthAPI.getPayRecordList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
flowId: state.query.flowId,
});
state.tableData.loading = false;
state.tableData.list = res.records;

View File

@ -202,6 +202,8 @@ function handleLogin() {
userStore.meituan_douyin_info = checkInfo.userInfo;
setDouyinToken(checkInfo.userInfo.token);
});
localStorage.removeItem("shopName")
await userStore.getUserInfo();
const { path, queryParams } = parseRedirect();

View File

@ -7,8 +7,14 @@
<el-input v-model="state.query.name" clearable placeholder="请输入分店名称" style="width: 100%" class="filter-item"
@keyup.enter="getTableData" />
</el-col>
<el-col :span="4">
<el-select v-model="state.par.dataSyncMethod" @change="setDataSync" placeholder="请设置同步方式"
style="width: 100%">
<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">
<el-col :span="12">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
@ -19,41 +25,42 @@
<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="店铺信息" >
<el-table-column label="店铺信息">
<template v-slot="scope">
<div>{{ scope.row.shopName }}{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.shopName }}</div>
<div>账号{{ scope.row.account }}</div>
<div>联系电话{{ scope.row.phone }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="商品同步" width="120">
<el-table-column prop="isEnableProdSync" label="商品同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
<el-tag :type="scope.row.isEnableProdSync == 1 ? 'success' : 'error'" effect="dark"> {{ scope.row.isEnableProdSync == 1 ? '启用' : '禁用' }} </el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="会员同步" width="120">
<el-table-column prop="isEnableVipSync" label="会员同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
<el-tag :type="scope.row.isEnableVipSync == 1 ? 'success' : 'error'" effect="dark"> {{ scope.row.isEnableVipSync == 1 ? '启用' : '禁用' }} </el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="耗材同步" width="120">
<el-table-column prop="isEnableConsSync" label="耗材同步" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
<el-tag :type="scope.row.isEnableConsSync == 1 ? 'success' : 'error'" effect="dark"> {{ scope.row.isEnableConsSync == 1 ? '启用' : '禁用' }} </el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="账号状态" width="120">
<el-table-column prop="isAllowAccountLogin" label="账号状态" width="120">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" disabled />
<el-tag :type="scope.row.isAllowAccountLogin == 1 ? 'success' : 'error'" effect="dark"> {{ scope.row.isAllowAccountLogin == 1 ? '启用' : '禁用' }} </el-tag>
</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 v-if="!scope.row.isEnableProdSync || !scope.row.isEnableVipSync || !scope.row.isEnableConsSync"
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 type="primary" size="small" link icon="edit" @click="handleAccount(scope.row)">
{{ scope.row.isAllowAccountLogin ? '账号禁用' : '账号启用' }}
</el-button>
</template>
</el-table-column>
@ -71,22 +78,19 @@
<script setup>
import dayjs from "dayjs";
import ShopApi from "@/api/account/shop";
import ShopBranchApi from "@/api/account/shopBranch";
import { ElNotification, ElMessageBox } from "element-plus";
const state = reactive({
query: {
name: "",
},
par: {
dataSyncMethod: '',
},
status: [
{
type: 1,
label: "开启",
},
{
type: 0,
label: "关闭",
},
{ type: 'auto', label: "实时自动同步", },
{ type: 'manual', label: "手动同步", }
],
tableData: {
list: [],
@ -99,15 +103,14 @@ const state = reactive({
onMounted(() => {
getTableData();
});
//
//
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getList({
const res = await ShopBranchApi.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;
@ -117,6 +120,16 @@ async function getTableData() {
console.log(error);
}
}
//
async function setDataSync() {
await ShopBranchApi.setDataSync(state.par.dataSyncMethod);
ElMessage({
type: "success",
message: "设置成功",
});
}
//
function handleSync(e) {
console.log(e)
ElMessageBox.confirm(`同步功能开启后不能关闭,请确认是否给${e.shopName}开启同步?`, "提示", {
@ -124,7 +137,7 @@ function handleSync(e) {
cancelButtonText: "取消",
type: "warning",
}).then(async () => {
const res = await ShopApi.delete({ id: row.id });
await ShopBranchApi.dataSync(e.id)
ElMessage({
type: "success",
message: "同步成功",
@ -132,6 +145,17 @@ function handleSync(e) {
getTableData();
}).catch(() => { });
}
// /
async function handleAccount(row) {
if (row.isAllowAccountLogin) {
await ShopBranchApi.disable(row.id);
} else {
await ShopBranchApi.enable(row.id);
}
getTableData();
}
//
function resetHandle() {
state.query.name = "";

View File

@ -13,13 +13,13 @@
</el-radio-group>
<div class="tips">请谨慎修改</div>
</el-form-item>
<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="isHeadShop">
<el-radio-group v-model="state.form.isHeadShop" @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.isHeadShop == '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">
@ -208,7 +208,7 @@ const state = reactive({
cities: "",
districts: "",
chainName: "",
isMainStore: '0',
isHeadShop: '0',
},
resetForm: "",
rules: {
@ -226,7 +226,7 @@ const state = reactive({
trigger: "blur",
},
],
isMainStore: [
isHeadShop: [
{
required: true,
message: " ",
@ -354,6 +354,7 @@ function submitHandle() {
type: "success",
});
close();
location.reload()
} catch (error) {
state.formLoading = false;
console.log(error);
@ -528,4 +529,4 @@ defineExpose({
.amap-sug-result {
z-index: 2000;
}
</style>
</style>

View File

@ -68,7 +68,7 @@
<template v-slot="scope">
<div>
<span>{{ scope.row.shopName }}</span>
<div>(主店)</div>
<div>(主店{{ scope.row.headShopName }})</div>
</div>
</template>
</el-table-column>

View File

@ -1,6 +1,7 @@
import type { ISearchConfig } from "@/components/CURD/types";
import { paramTypeOptions } from './config'
import UserAPI from "@/api/product/productclassification";
import ShopApi from "@/api/account/shop";
const searchConfig: ISearchConfig = {
@ -19,7 +20,17 @@ const searchConfig: ISearchConfig = {
},
options: [],
async initFn(formItem) {
formItem.options = await UserAPI.getList();
// formItem.options = await UserAPI.getList();
let res = await ShopApi.getBranchList();
let options = [];
res.map(v=>{
options.push({
label: v.shopName,
value: v.shopId,
})
})
formItem.options = options
},
},
{