Merge branch 'multi-store' of https://e.coding.net/g-cphe0354/cashier/cashier-web into multi-store
This commit is contained in:
@@ -246,6 +246,7 @@ export interface UserInfo {
|
||||
* 用户分页查询对象
|
||||
*/
|
||||
export interface UserPageQuery extends PageQuery {
|
||||
times: any;
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<!-- 其他 -->
|
||||
<template v-else-if="typeof item === 'object'">
|
||||
<el-button
|
||||
v-if="item.hidden === undefined || item.hidden === false"
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'default'"
|
||||
@@ -284,31 +285,10 @@
|
||||
</template>
|
||||
<!-- 其他 -->
|
||||
<template v-else-if="typeof item === 'object'">
|
||||
<el-button
|
||||
v-if="item.isBtn"
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'primary'"
|
||||
size="small"
|
||||
link
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
})
|
||||
"
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
|
||||
<el-dropdown style="margin-top: 4px" v-else>
|
||||
<template v-if="item.hidden === undefined || item.hidden === false">
|
||||
<el-button
|
||||
v-if="item.render === undefined || item.render(scope.row)"
|
||||
v-bind="
|
||||
item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
|
||||
"
|
||||
v-if="item.isBtn"
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'primary'"
|
||||
size="small"
|
||||
@@ -324,26 +304,51 @@
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
<template v-if="item.options && item.options.length > 0" #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
command: opt.command ? opt.command : '',
|
||||
})
|
||||
"
|
||||
v-for="opt in item.options"
|
||||
:key="opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
<el-dropdown style="margin-top: 4px" v-else>
|
||||
<el-button
|
||||
v-if="item.render === undefined || item.render(scope.row)"
|
||||
v-bind="
|
||||
item.auth
|
||||
? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] }
|
||||
: {}
|
||||
"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'primary'"
|
||||
size="small"
|
||||
link
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
})
|
||||
"
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
<template #dropdown v-if="item.options && item.options.length > 0">
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
command: opt.command ? opt.command : '',
|
||||
})
|
||||
"
|
||||
v-for="opt in item.options"
|
||||
:key="opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -148,6 +148,7 @@ export interface IContentConfig<T = any> {
|
||||
icon?: string;
|
||||
name: string;
|
||||
text: string;
|
||||
hidden?: boolean;
|
||||
type?: "primary" | "success" | "warning" | "danger" | "info";
|
||||
}
|
||||
>;
|
||||
@@ -215,6 +216,7 @@ export interface IContentConfig<T = any> {
|
||||
name: string;
|
||||
text: string;
|
||||
isBtn?: boolean;
|
||||
hidden?: boolean;
|
||||
type?: "primary" | "success" | "warning" | "danger" | "info";
|
||||
render?: (row: IObject) => boolean;
|
||||
options?: {
|
||||
|
||||
@@ -43,7 +43,7 @@ async function geiShopList() {
|
||||
state.branchList = res;
|
||||
if (!localStorage.getItem("shopName")) {
|
||||
state.shopName = state.branchList[0].shopName
|
||||
localStorage.setItem("branch_shopId", data.shopInfo.id)
|
||||
localStorage.setItem("branch_shopId", state.branchList[0].id)
|
||||
localStorage.setItem("shopName", state.branchList[0].shopName)
|
||||
} else {
|
||||
state.shopName = localStorage.getItem("shopName")
|
||||
|
||||
@@ -129,3 +129,16 @@ export function isSyncStatus() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有某权限
|
||||
*/
|
||||
export function hasPermission(params: any) {
|
||||
let $PermissionObj = JSON.parse(localStorage.getItem("permission") || '[]' )
|
||||
const obj = $PermissionObj.find((v: any) => v == params || v == params)
|
||||
if (obj) {
|
||||
return obj
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ import couponEnum from "./couponEnum";
|
||||
import couponDetails from "./components/coupon_details.vue";
|
||||
import couponAdd from "./components/add.vue";
|
||||
import couponApi from "@/api/account/coupon";
|
||||
import { hasPermission } from "@/utils/index";
|
||||
|
||||
export default {
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
@@ -100,6 +101,9 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData();
|
||||
console.log(hasPermission('coupon:add'))
|
||||
console.log(hasPermission('coupon:edit'))
|
||||
// coupon:add shopStaff:add
|
||||
},
|
||||
methods: {
|
||||
toAdd(data) {
|
||||
|
||||
@@ -20,7 +20,15 @@ const contentConfig: IContentConfig = {
|
||||
return Api.edit(data);
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: ["add"],
|
||||
toolbar: [
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
defaultToolbar: ["refresh", "filter", "search"],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
@@ -49,7 +57,7 @@ const contentConfig: IContentConfig = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit"],
|
||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -71,6 +71,7 @@ import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -87,6 +88,14 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||
}
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
@@ -28,7 +28,20 @@ const contentConfig: IContentConfig = {
|
||||
indexActionData: {},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
{
|
||||
icon: "refresh",
|
||||
text: "同步",
|
||||
type: "danger",
|
||||
name: "sync",
|
||||
auth: "import",
|
||||
},
|
||||
{
|
||||
text: "入库",
|
||||
name: "ruku",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
">
|
||||
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)">编辑</el-button>
|
||||
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)" v-if="!isSyncStatus()">编辑</el-button>
|
||||
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'consumables')">
|
||||
耗材盘点
|
||||
</el-button>
|
||||
@@ -89,12 +89,16 @@ import addHaocai from "./components/add-haocai.vue";
|
||||
import dataTongji from "./components/DataStatistics.vue";
|
||||
import addConsTakin from "./components/addConsTakin.vue";
|
||||
import consApi from "@/api/product/cons";
|
||||
import UserAPI from "@/api/product/index";
|
||||
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const router = useRouter();
|
||||
const {
|
||||
searchRef,
|
||||
@@ -122,6 +126,15 @@ if (conName) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.toolbar[1].hidden = false
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.toolbar[1].hidden = true
|
||||
}
|
||||
|
||||
|
||||
//统计数据
|
||||
const gongjiData = reactive({ totalRow: 0 });
|
||||
function getTongji(params: IObject | undefined) {
|
||||
@@ -189,8 +202,13 @@ async function handleEditClick(row: IObject) {
|
||||
editModalRef.value?.setFormData({ ...row, url: [row.url] });
|
||||
}
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
async function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if (name === 'sync') {
|
||||
let res = await UserAPI.sync()
|
||||
ElMessage.success('操作成功,数据正在后台同步中...')
|
||||
return;
|
||||
}
|
||||
if (name === "category") {
|
||||
router.push({ path: "/inventory/classification" });
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,15 @@ const contentConfig: IContentConfig = {
|
||||
return Api.edit(data);
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: ["add"],
|
||||
toolbar: [
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
defaultToolbar: ["refresh", "filter", "search"],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
@@ -71,7 +79,7 @@ const contentConfig: IContentConfig = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -71,6 +71,7 @@ import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -87,6 +88,16 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||
}
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
@@ -172,7 +172,8 @@ function handleLogin() {
|
||||
setDouyinToken(checkInfo.userInfo.token);
|
||||
});
|
||||
localStorage.removeItem("shopName")
|
||||
|
||||
let resData = await $API_login.getPermission()
|
||||
localStorage.setItem("permission",JSON.stringify(resData))
|
||||
|
||||
const { path, queryParams } = parseRedirect();
|
||||
console.log(path, queryParams);
|
||||
|
||||
@@ -176,6 +176,8 @@ import searchConfig from "./goodsGroupconfig/search";
|
||||
import searchConfig2 from "./goodsGroupconfig/search2";
|
||||
import myDialog from '@/components/mycomponents/myDialog.vue'
|
||||
import selectGoodslist from "./goodsGroupconfig/selectGoodslist.vue"
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
searchRefs,
|
||||
@@ -194,6 +196,18 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true
|
||||
contentConfig.cols[3].templet = "custom"
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.cols[3].templet = "switch"
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||
}
|
||||
|
||||
let switchref = ref(false)
|
||||
|
||||
// 新增
|
||||
|
||||
@@ -73,7 +73,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -95,6 +95,7 @@ import contentConfig from "./categoryconfig/content";
|
||||
import contentConfig2 from "./categoryconfig/content2";
|
||||
import editModalConfig from "./categoryconfig/edit";
|
||||
import searchConfig from "./categoryconfig/search";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -111,6 +112,17 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true
|
||||
contentConfig.cols[2].templet = "custom"
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.cols[2].templet = "switch"
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||
}
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
@@ -44,7 +44,15 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
// return res.list;
|
||||
// },
|
||||
pk: "id",
|
||||
toolbar: ["add"],
|
||||
toolbar: [
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
{ label: "分类名称", align: "center", prop: "name" },
|
||||
@@ -68,7 +76,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -200,17 +200,15 @@ let datas = reactive({
|
||||
remark: "",
|
||||
images: []
|
||||
});
|
||||
|
||||
if (isSyncStatus()) {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){
|
||||
contentConfig.toolbar?.splice(0, 1)
|
||||
}
|
||||
if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("delete") != -1){
|
||||
contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1)
|
||||
}
|
||||
}else {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("custom2") != -1){
|
||||
contentConfig.toolbar?.splice(1, 1)
|
||||
}
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.toolbar[1].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.toolbar[1].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -220,7 +218,7 @@ onMounted(() => {
|
||||
}
|
||||
// 获取耗材列表
|
||||
gethaocaiList()
|
||||
|
||||
|
||||
});
|
||||
function newHandleQueryClick(e: IObject | undefined) {
|
||||
const filterParams = contentRef.value?.getFilterParams();
|
||||
@@ -324,14 +322,13 @@ async function handleEditClick(row: IObject) {
|
||||
// 其他工具栏
|
||||
async function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if ( name === "custom1" ) {
|
||||
if (name === "custom1") {
|
||||
// ElMessage.success("点击了自定义1按钮");
|
||||
myDialogRef.value.open();
|
||||
}
|
||||
if ( name === "custom2" ) { //商品同步
|
||||
if (name === "sync") { //商品同步
|
||||
let res = await UserAPI.sync()
|
||||
ElMessage.success('操作成功,数据正在后台同步中...')
|
||||
console.log(res)
|
||||
}
|
||||
}
|
||||
async function confirm() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-input-number size="default" v-model="scope.row.salePrice" @change="priceFormat(scope.row, 'salePrice')"
|
||||
@blur="priceFormat(scope.row, 'salePrice')" controls-position="right"></el-input-number>
|
||||
@blur="priceFormat(scope.row, 'salePrice')" controls-position="right" :disabled="isSyncStatus()"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="originPrice">
|
||||
@@ -26,7 +26,7 @@
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-input-number @change="priceFormat(scope.row, 'originPrice')" v-model="scope.row.originPrice"
|
||||
@blur="priceFormat(scope.row, 'originPrice')" controls-position="right"></el-input-number>
|
||||
@blur="priceFormat(scope.row, 'originPrice')" controls-position="right" :disabled="isSyncStatus()"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="costPrice">
|
||||
@@ -38,7 +38,7 @@
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-input-number @change="priceFormat(scope.row, 'costPrice')" v-model="scope.row.costPrice"
|
||||
@blur="priceFormat(scope.row, 'costPrice')" controls-position="right"></el-input-number>
|
||||
@blur="priceFormat(scope.row, 'costPrice')" controls-position="right" :disabled="isSyncStatus()"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-input-number @change="priceFormat(scope.row, 'memberPrice')" v-model="scope.row.memberPrice"
|
||||
@blur="priceFormat(scope.row, 'memberPrice')" controls-position="right"></el-input-number>
|
||||
@blur="priceFormat(scope.row, 'memberPrice')" controls-position="right" :disabled="isSyncStatus()"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="起售数量" prop="suitNum">
|
||||
@@ -64,9 +64,9 @@
|
||||
<template v-slot="scope">
|
||||
<el-input-number @change="priceFormat(scope.row, 'suitNum')" v-model="scope.row.suitNum"
|
||||
@blur="priceFormat(scope.row, 'suitNum')" :min="0" controls-position="right"
|
||||
v-if="props.info.type == 'weigh'"></el-input-number>
|
||||
v-if="props.info.type == 'weigh'" :disabled="isSyncStatus()"></el-input-number>
|
||||
<el-input-number @change="priceFormat(scope.row, 'suitNum')" v-model="scope.row.suitNum"
|
||||
@blur="priceFormat(scope.row, 'suitNum')" :min="1" controls-position="right" v-else></el-input-number>
|
||||
@blur="priceFormat(scope.row, 'suitNum')" :min="1" controls-position="right" :disabled="isSyncStatus()" v-else></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -77,7 +77,7 @@
|
||||
<el-form-item>
|
||||
<el-input-number @change="priceFormat(batchNumberForm, 'batchNumber')"
|
||||
@blur="priceFormat(batchNumberForm, 'batchNumber')" v-model="batchNumberForm.batchNumber"
|
||||
controls-position="right" style="width: 100%"></el-input-number>
|
||||
controls-position="right" style="width: 100%" :disabled="isSyncStatus()"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -93,6 +93,8 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const ruleFormRef = ref(null)
|
||||
let batchNumberKey = ref(null)
|
||||
let batchNumberForm = reactive({
|
||||
@@ -193,4 +195,4 @@ const formatPrice = (price, min = -Infinity, max = 100000000, returnIsArea = fal
|
||||
return newval
|
||||
}
|
||||
defineExpose({ getdata })
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
<el-form-item label="商品名称" required>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="name">
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入商品名称" />
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入商品名称" :disabled="isSyncStatus()"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品介绍">
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
<el-input v-model="ruleForm.shortTitle" type="textarea" placeholder="请输入商品介绍" />
|
||||
<el-input v-model="ruleForm.shortTitle" type="textarea" placeholder="请输入商品介绍" :disabled="isSyncStatus()"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" required>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="unitId">
|
||||
<el-select v-model="ruleForm.unitId" placeholder="请选择单位">
|
||||
<el-select v-model="ruleForm.unitId" placeholder="请选择单位" :disabled="isSyncStatus()">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in datas.Company" :key="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -27,7 +27,7 @@
|
||||
<el-form-item label="商品分类" required>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="region">
|
||||
<el-select v-model="ruleForm.categoryId" placeholder="请选择商品分类">
|
||||
<el-select v-model="ruleForm.categoryId" placeholder="请选择商品分类" :disabled="isSyncStatus()">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in datas.classification" :key="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -54,7 +54,7 @@
|
||||
<AddImg ref="addImg" @successEvent="successEvent"></AddImg>
|
||||
|
||||
<el-form-item label="商品类型">
|
||||
<el-radio-group v-model="ruleForm.type" @change="changeTypeEnum(ruleForm.type)">
|
||||
<el-radio-group v-model="ruleForm.type" @change="changeTypeEnum(ruleForm.type)" :disabled="isSyncStatus()">
|
||||
<el-radio value="single">单规格商品</el-radio>
|
||||
<el-radio value="sku">多规格商品</el-radio>
|
||||
<el-radio value="package">套餐商品</el-radio>
|
||||
@@ -65,7 +65,7 @@
|
||||
<el-form-item label="套餐商品" v-if="ruleForm.type == 'package'">
|
||||
<div style="display: block;width: 100%;">
|
||||
<div class="head-container">
|
||||
<el-radio-group v-model="ruleForm.groupType" @change="typeChange">
|
||||
<el-radio-group v-model="ruleForm.groupType" @change="typeChange" :disabled="isSyncStatus()">
|
||||
<el-radio-button label="0">固定套餐</el-radio-button>
|
||||
<el-radio-button label="1">可选套餐</el-radio-button>
|
||||
</el-radio-group>
|
||||
@@ -82,13 +82,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column width="150">
|
||||
<template #header>
|
||||
<el-button type="primary" @click="addgoods(-1)">添加商品</el-button>
|
||||
<el-button type="primary" @click="addgoods(-1)" :disabled="isSyncStatus()">添加商品</el-button>
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" :disabled="scope.row.type != 'sku'"
|
||||
<el-button type="text" :disabled="scope.row.type != 'sku'&&isSyncStatus()"
|
||||
@click="showSelectSkuHandle(scope.row, scope.$index, index)">设置规格</el-button>
|
||||
<el-button type="text"
|
||||
@click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)">删除</el-button>
|
||||
@click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)" >删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -97,13 +97,13 @@
|
||||
<div class="group_wrap" v-for="(item, index) in ruleForm.proGroupVo" :key="index">
|
||||
<el-form inline :model="item">
|
||||
<el-form-item label="规格组名">
|
||||
<el-input v-model="item.title" />
|
||||
<el-input v-model="item.title" :disabled="isSyncStatus()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`本组菜品${item.goods.length}选`">
|
||||
<el-input v-model="item.number" />
|
||||
<el-input v-model="item.number" :disabled="isSyncStatus()"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="ruleForm.proGroupVo.splice(index, 1)">删除</el-button>
|
||||
<el-button @click="ruleForm.proGroupVo.splice(index, 1)" :disabled="isSyncStatus()">删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin-top: 20px;">
|
||||
@@ -113,29 +113,29 @@
|
||||
<el-table-column label="价格" prop="price"></el-table-column>
|
||||
<el-table-column label="数量" prop="number">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.number" :min="0" />
|
||||
<el-input-number v-model="scope.row.number" :min="0" :disabled="isSyncStatus()"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150">
|
||||
<template #header>
|
||||
<el-button type="primary" @click="addgoods(index);">添加商品</el-button>
|
||||
<el-button type="primary" @click="addgoods(index);" :disabled="isSyncStatus()">添加商品</el-button>
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<el-button type="text" :disabled="scope.row.type != 'sku'"
|
||||
<el-button type="text" :disabled="scope.row.type != 'sku'&&isSyncStatus()"
|
||||
@click="showSelectSkuHandle(scope.row, scope.$index, index)">设置规格</el-button>
|
||||
<el-button type="text"
|
||||
@click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)">删除</el-button>
|
||||
@click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)" :disabled="isSyncStatus()">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<el-button type="primary" @click="addtaocan">添加套餐组</el-button>
|
||||
<el-button type="primary" @click="addtaocan" :disabled="isSyncStatus()">添加套餐组</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择规格" v-if="ruleForm.type == 'sku'">
|
||||
<el-select v-model="ruleForm.specId" placeholder="请选择规格" style="width: 500px" @change="selectSpecHandle">
|
||||
<el-select v-model="ruleForm.specId" placeholder="请选择规格" style="width: 500px" @change="selectSpecHandle" :disabled="isSyncStatus()">
|
||||
<el-option :label="item.name" :value="item.id" v-for="item in datas.specificationsconfig"
|
||||
:key="item.id"></el-option>
|
||||
</el-select>
|
||||
@@ -157,7 +157,7 @@
|
||||
<el-form-item label="重量">
|
||||
<el-col :span="12">
|
||||
<div style="display: block;">
|
||||
<el-input v-model="ruleForm.weight" placeholder="">
|
||||
<el-input v-model="ruleForm.weight" placeholder="" :disabled="isSyncStatus()">
|
||||
<template #append>千克</template>
|
||||
</el-input>
|
||||
<!-- <div style="color: #999;">用于快递或配送运费计重</div> -->
|
||||
@@ -165,7 +165,7 @@
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否允许临时改价">
|
||||
<el-radio-group v-model="ruleForm.isAllowTempModifyPrice">
|
||||
<el-radio-group v-model="ruleForm.isAllowTempModifyPrice" :disabled="isSyncStatus()">
|
||||
<el-radio :value="1">允许</el-radio>
|
||||
<el-radio :value="0">不允许</el-radio>
|
||||
</el-radio-group>
|
||||
@@ -198,7 +198,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="库存开关">
|
||||
<div style="display: block;">
|
||||
<el-switch v-model="ruleForm.isStock" :active-value="1" :inactive-value="0" />
|
||||
<el-switch v-model="ruleForm.isStock" :active-value="1" :inactive-value="0" :disabled="isSyncStatus()"/>
|
||||
<div style="color: #999;">注:关闭则不计算出入库数据</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
<el-form-item label="打包费" prop="delivery">
|
||||
<div style="display: block;">
|
||||
<el-input-number v-model="ruleForm.packFee" controls-position="right"></el-input-number>
|
||||
<el-input-number v-model="ruleForm.packFee" controls-position="right" :disabled="isSyncStatus()"></el-input-number>
|
||||
<div style="color: #999;">单份商品打包费。注:店铺开启外卖模式下该数据才生效</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -251,6 +251,7 @@ import { reactive, ref } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
// 规格属性
|
||||
import SpecificationAttribute from './SpecificationAttribute.vue'
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
import UserAPI from "@/api/product/productclassification";
|
||||
import UserAPI2 from "@/api/product/commonUnits";
|
||||
import UserAPI3 from "@/api/product/index";
|
||||
@@ -492,6 +493,10 @@ function selectSkuHandle(item: any, index: number) {
|
||||
// }
|
||||
}
|
||||
function addimgEvent() {
|
||||
if( isSyncStatus() ){
|
||||
ElMessage.error('当前同步启用状态下不可修改')
|
||||
return
|
||||
}
|
||||
(addImg.value as any)?.show()
|
||||
}
|
||||
// 确认套餐商品设置规格
|
||||
@@ -521,6 +526,10 @@ function addgoods(index: number = -1) {
|
||||
(shopListRef.value as any)?.opens()
|
||||
}
|
||||
function deleteEvent(d: any) {
|
||||
if( isSyncStatus() ){
|
||||
ElMessage.error('当前同步启用状态下不可修改')
|
||||
return
|
||||
}
|
||||
let index = ruleForm.images.findIndex((ele) => ele == d);
|
||||
ruleForm.images.splice(index, 1);
|
||||
}
|
||||
@@ -915,4 +924,4 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
||||
top: -10px;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -58,12 +58,18 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
{
|
||||
icon: "refresh",
|
||||
text: "同步",
|
||||
type: "danger",
|
||||
name: "custom2",
|
||||
name: "sync",
|
||||
auth: "import",
|
||||
},
|
||||
{
|
||||
@@ -114,7 +120,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: [{ text: "报损" }, "edit", "delete"],
|
||||
operat: [{ text: "报损", name: ''}, { text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||
</template>
|
||||
<template #operates="scope">
|
||||
<el-button type="text" size="small" v-if="scope.row.level < 3"
|
||||
<el-button type="text" size="small" v-if="scope.row.level < 3&&!isSyncStatus()"
|
||||
@click="addlowerLevel(scope.row)">添加下一级</el-button>
|
||||
<el-button type="text" size="small" @click="handleEditClick(scope.row)">编辑</el-button>
|
||||
<el-button type="text" size="small" @click="deleteClick(scope.row)">删除</el-button>
|
||||
<el-button type="text" size="small" v-if="!isSyncStatus()" @click="handleEditClick(scope.row)">编辑</el-button>
|
||||
<el-button type="text" size="small" v-if="!isSyncStatus()" @click="deleteClick(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</page-content>
|
||||
<!-- 添加下一级-编辑 -->
|
||||
@@ -123,6 +123,8 @@ import contentConfig2 from "./specificationsconfig/content2";
|
||||
import editModalConfig from "./specificationsconfig/edit";
|
||||
import searchConfig from "./specificationsconfig/search";
|
||||
import { pid } from "process";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const validateSku1 = (rule, value, callback) => {
|
||||
if (!datas.skuForm.label) {
|
||||
callback(new Error(' '))
|
||||
@@ -190,6 +192,12 @@ let datas = reactive({
|
||||
addchilderinfo: {}
|
||||
})
|
||||
let myDialogRef = ref(null)
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
}
|
||||
|
||||
function subitgood() {
|
||||
skuForm.value.validate(async valid => {
|
||||
if (valid) {
|
||||
@@ -381,4 +389,4 @@ const isA = ref(true);
|
||||
margin-left: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -41,7 +41,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
// },
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
|
||||
@@ -61,6 +61,7 @@ import contentConfig from "./unitconfig/content";
|
||||
import contentConfig2 from "./unitconfig/content2";
|
||||
import editModalConfig from "./unitconfig/edit";
|
||||
import searchConfig from "./unitconfig/search";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -77,6 +78,16 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
contentConfig.toolbar[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true
|
||||
} else {
|
||||
contentConfig.toolbar[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false
|
||||
contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false
|
||||
}
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
@@ -38,7 +38,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
{
|
||||
icon: "plus",
|
||||
text: "新增",
|
||||
type: "primary",
|
||||
name: "add",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
@@ -50,7 +56,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user