This commit is contained in:
wwz
2025-04-08 17:41:44 +08:00
5 changed files with 63 additions and 31 deletions

View File

@@ -92,7 +92,7 @@ pnpm run dev
pnpm run build
# 测试环境
pnpm run build:test
pnpm run build:local
# 正式环境
pnpm run build:pro

View File

@@ -10,23 +10,26 @@ const ShopBranchApi = {
params
});
},
getDataSync(params: any) {
return request<any>({
url: `${baseURL}/get/dataSyncMethod`,
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",

View File

@@ -7,16 +7,17 @@
<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="12">
<el-col :span="16">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
<span style="margin-left: 30px;">同步设置</span>
<el-select v-model="state.par.dataSyncMethod" @change="setDataSync" placeholder="请设置同步方式"
style="width: 200px">
<el-option v-for="item in state.status" :key="item.type" :label="item.label" :value="item.type" />
</el-select>
</el-col>
</el-row>
</el-card>
@@ -24,10 +25,10 @@
<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 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 }}{{ scope.row.shopType == 'chain' ? '(连锁店)' : scope.row.shopType == 'join' ? '(加盟店)' : '' }}</div>
<div>账号{{ scope.row.account }}</div>
<div>联系电话{{ scope.row.phone }}</div>
</template>
@@ -102,7 +103,13 @@ const state = reactive({
});
onMounted(() => {
getTableData();
getDataSync()
});
async function getDataSync () {
let res = await ShopBranchApi.getDataSync()
state.par.dataSyncMethod = res
}
// 获取分店列表
async function getTableData() {
state.tableData.loading = true;

View File

@@ -6,23 +6,23 @@
<el-input v-model="state.form.shopName" placeholder="请输入门店名称"></el-input>
</el-form-item>
<el-form-item label="店铺类型">
<el-radio-group v-model="state.form.shopType">
<el-radio-group v-model="state.form.shopType" :disabled="state.form.id || state.type == 'addBranch'">
<el-radio-button value="only">单店</el-radio-button>
<el-radio-button value="chain">连锁店</el-radio-button>
<el-radio-button value="join">加盟店</el-radio-button>
</el-radio-group>
<div class="tips">请谨慎修改</div>
</el-form-item>
<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-form-item label="是否为主店" prop="isHeadShop" v-if="state.form.shopType != 'only'">
<el-radio-group v-model="state.form.isHeadShop" @change=" state.form.mainId = ''" :disabled="state.form.id || state.type == 'addBranch'">
<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.isHeadShop == '0'&&state.form.shopType != 'only'">
<!-- <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">
:remote-method="getTableData" :loading="state.shopListLoading" :disabled="state.form.id || state.type == 'addBranch'">
<el-option v-for="item in state.shopList" :label="`${item.shopName}`" :value="item.id"
:key="item.id"></el-option>
</el-select>
@@ -44,9 +44,9 @@
<div class="tips">请谨慎修改</div>
</el-form-item>
<el-form-item label="管理方式" v-if="state.form.shopType != 'only'">
<el-radio-group v-model="state.form.tube_type">
<el-radio-button value="0">不可直接管理</el-radio-button>
<el-radio-button value="1">直接管理</el-radio-button>
<el-radio-group v-model="state.form.tubeType">
<el-radio-button :value="0">不可直接管理</el-radio-button>
<el-radio-button :value="1">直接管理</el-radio-button>
</el-radio-group>
<div class="tips">请谨慎修改</div>
</el-form-item>
@@ -185,11 +185,11 @@ const state = reactive({
endTime: "",
formLoading: false,
form: {
id: "",
id: null,
shopName: "",
mainId: "",
shopType: "only",
tube_type: "0",
tubeType: 0,
registerType: "before",
profiles: "release",
activateCode: "",
@@ -208,8 +208,9 @@ const state = reactive({
cities: "",
districts: "",
chainName: "",
isHeadShop: '0',
isHeadShop: 0,
},
type: '',
resetForm: "",
rules: {
activateCode: [
@@ -370,13 +371,22 @@ function handleSuccess(response, file, fileList) {
state.files = response.data;
}
function show(obj) {
function show(obj,type) {
getTableData();
state.dialogVisible = true;
if (obj && obj.id) {
console.log(obj);
state.form = { ...obj };
}
if (obj && obj.mainId) {
state.form = { ...obj };
}
if( type ){
state.type = type
}
console.log(state.form);
console.log(state.type);
for (let key in state.rules) {
if (key === "accountName") {
if (obj.id) {
@@ -390,9 +400,13 @@ function show(obj) {
}
function close() {
state.dialogVisible = false;
state.form = { ...state.resetForm };
state.type = "";
}
function reset() {
state.form = { ...state.resetForm };
state.type = "";
}
let ElMap = undefined;

View File

@@ -64,11 +64,13 @@
</template>
</el-table-column>
<el-table-column prop="address" label="商户号" />
<el-table-column prop="status" label="店铺类型">
<el-table-column prop="status" label="店铺类型" align="center">
<template v-slot="scope">
<div>
<span>{{ scope.row.shopName }}</span>
<div>(主店{{ scope.row.headShopName }})</div>
<span v-if="scope.row.shopType == 'only'">单店</span>
<span v-if="scope.row.shopType == 'chain'">连锁店</span>
<span v-if="scope.row.shopType == 'join'">加盟店</span>
<div v-if="scope.row.shopType != 'only'&&scope.row.isHeadShop == 0">(主店{{ scope.row.headShopName }})</div>
</div>
</template>
</el-table-column>
@@ -109,6 +111,7 @@
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="scope.row.isHeadShop == 1" :command="0">添加分店</el-dropdown-item>
<el-dropdown-item :command="{ row: scope.row, command: 1 }">
三方配置
</el-dropdown-item>
@@ -182,6 +185,11 @@ const refDetailModal = ref(null);
function dropdownClick(e, row) {
console.log(e);
console.log(row);
if (e == 0) {
refAddShop.value.show({mainId:row.id,shopType:row.shopType,isHeadShop:0},'addBranch');
return;
}
if (e.command == 1) {
refDetailModal.value.show(e.row);
return;