同步数据

This commit is contained in:
duan 2024-11-29 16:34:48 +08:00
parent 79abd9c10d
commit aa54684e44
2 changed files with 214 additions and 0 deletions

View File

@ -11,6 +11,31 @@ export function tbShopPayTypeGet(params) {
params
});
}
// 同步数据提交
export function getsync(data) {
return request({
url: "/api/tbShopSyncInfo/sync",
method: "post",
data,
});
}
// 撤销同步
export function setclear(data) {
return request({
url: "/api/tbShopSyncInfo/clear",
method: "post",
data,
});
}
// 同步数据列表
export function gettbShopSyncInfo(params) {
return request({
url: "/api/tbShopSyncInfo",
method: "get",
params
});
}
/**
* 更改/增加支付方式

View File

@ -0,0 +1,189 @@
<template>
<div class="app-container">
<div class="head-container">
<el-form :model="forms">
<el-form-item label="步骤一" label-width="80px">
单位({{ forms.proUnit > 0 ? forms.proUnit : 0 }})&nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'proUnit')"
v-model="forms.proUnit"></el-checkbox>
规格({{ forms.proSpec > 0 ? forms.proSpec : 0 }}) &nbsp;&nbsp;<el-checkbox :true-label="1"
v-if="disableds" :false-label="0" @change="selectChange($event, 'proSpec')"
v-model="forms.proSpec"></el-checkbox>
分类({{ forms.proCategory > 0 ? forms.proCategory : 0 }}) &nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'proCategory')"
v-model="forms.proCategory"></el-checkbox>
耗材类型({{ forms.consType > 0 ? forms.consType : 0 }}) &nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'consType')"
v-model="forms.consType"></el-checkbox>
</el-form-item>
<el-form-item label="步骤二" label-width="80px">
商品({{ forms.product > 0 ? forms.product : 0 }})&nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'product')"
v-model="forms.product"></el-checkbox>
耗材信息({{ forms.consInfo > 0 ? forms.consInfo : 0 }})&nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'consInfo')"
v-model="forms.consInfo"></el-checkbox>
</el-form-item>
<el-form-item label="步骤三" label-width="80px">
分组({{ forms.proGroup > 0 ? forms.proGroup : 0 }})&nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'proGroup')"
v-model="forms.proGroup"></el-checkbox>
配方({{ forms.consPro > 0 ? forms.consPro : 0 }})&nbsp;&nbsp;<el-checkbox v-if="disableds"
:true-label="1" :false-label="0" @change="selectChange($event, 'consPro')"
v-model="forms.consPro"></el-checkbox>
</el-form-item>
</el-form>
</div>
<div class="head-container">
<el-button type="primary" @click="sumbitForm" :disabled="!disableds">同步</el-button>
<el-button type="primary" @click="outsync" :disabled="disableds">撤销同步</el-button>
</div>
</div>
</template>
<script>
import { gettbShopSyncInfo, getsync, setclear } from '@/api/setting.js'
export default {
data() {
return {
forms: {
proUnit: 0,
proSpec: 0,
proCategory: 0,
consType: 0,
product: 0,
consInfo: 0,
proGroup: 0,
consPro: 0,
sourceShopId: localStorage.getItem("mainId"),
pointShopId: localStorage.getItem("shopId"),
},
disableds: false,
}
}
,
mounted() {
this.getlist()
},
methods: {
async sumbitForm() {
if (this.forms.sourceShopId == this.forms.pointShopId) {
this.$message.error('当前店铺和源店铺一致');
} else {
let res = await getsync(this.forms)
this.getlist()
}
},
outsync() {
this.$confirm('此操作会撤销所有, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
let res = await setclear({ pointShopId: localStorage.getItem("shopId") })
this.getlist()
this.$message({
type: 'success',
message: '撤销成功!'
});
}).catch(() => {
});
},
selectChange(v, k) {
switch (k) {
case 'proUnit':
if (v == 0) {
this.forms.product = v
this.forms.consPro = v
this.forms.proGroup = 0
} else this.forms.consPro = 0
break;
case 'proSpec':
if (v == 0) {
this.forms.product = v
this.forms.consPro = v
this.forms.proGroup = 0
} else this.forms.consPro = 0
break;
case 'proCategory':
if (v == 0) {
this.forms.product = v
this.forms.consPro = v
this.forms.proGroup = 0
} else this.forms.consPro = 0
break;
case 'consType':
//
if (v == 0) {
this.forms.consInfo = v
this.forms.consPro = 0
}
break;
case 'product':
//
if (v == 1) {
this.forms.proUnit = v
this.forms.proSpec = v
this.forms.proCategory = v
} else {
this.forms.proGroup = 0
this.forms.consPro = 0
}
break;
case 'consInfo':
//
if (v == 1) {
console.log(this.forms, '调试1')
this.forms.consType = 1
} else {
this.forms.consPro = 0
}
break;
case 'proGroup':
//
this.forms.proUnit = 1
this.forms.proSpec = 1
this.forms.proCategory = 1
this.forms.product = 1
break;
case 'consPro':
//
this.forms.product = 1
this.forms.consType = 1
this.forms.consInfo = 1
this.forms.proUnit = 1
this.forms.proSpec = 1
this.forms.proCategory = 1
break;
default:
break;
}
},
async getlist() {
let res = await gettbShopSyncInfo({ pointShopId: localStorage.getItem("shopId") })
if (res) {
this.forms = res
this.disableds = false
} else {
this.disableds = true
this.forms = {
proUnit: 0,
proSpec: 0,
proCategory: 0,
consType: 0,
product: 0,
consInfo: 0,
proGroup: 0,
consPro: 0,
sourceShopId: localStorage.getItem("mainId"),
pointShopId: localStorage.getItem("shopId"),
}
}
}
}
}
</script>