Merge branch 'dwb' of https://e.coding.net/g-cphe0354/cashier/cashier-web
This commit is contained in:
@@ -25,10 +25,28 @@
|
||||
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||
@click="handleSwitchChange(scope.row)"></el-switch>
|
||||
</template>
|
||||
<template #sellOut="scope">
|
||||
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||
@click="handleSwitchChangeTwo(scope.row)"></el-switch>
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||
</template>
|
||||
<template #consumables="scope">
|
||||
<template v-if="scope.row.type != null">
|
||||
<span style="color: #4080ff;" v-if="scope.row.consName">
|
||||
{{ scope.row.consName }}
|
||||
</span>
|
||||
<span v-else>
|
||||
绑定
|
||||
</span>
|
||||
<el-icon @click="editOpen(scope.row)" style="cursor: pointer;color: #4080ff;">
|
||||
<EditPen />
|
||||
</el-icon>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
@@ -49,10 +67,74 @@
|
||||
<MyDialog ref="myDialogRef" @confirm="confirm" title="修改库存预警">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="库存预警" label-width="">
|
||||
<el-input-number v-model="form.num" label="描述文字"></el-input-number>
|
||||
<el-input-number v-model="form.warnLine" label="描述文字"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</MyDialog>
|
||||
<!-- 报损 -->
|
||||
<MyDialog ref="myDialogRefbaosun" @confirm="confirmbaosun" title="报损">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="报损数量" label-width="">
|
||||
<el-input-number v-model="datas.number" label="描述文字"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="报损照片" label-width="">
|
||||
<MultiImageUpload v-model="datas.images" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" label-width="">
|
||||
<el-input v-model="datas.remark" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</MyDialog>
|
||||
<!-- 耗材绑定 -->
|
||||
<MyDialog ref="myDialogRefhaocai" @confirm="confirmhaocai" width="50%" title="耗材绑定">
|
||||
<el-row>
|
||||
<el-col :span="12"> <el-form-item label="商品名">
|
||||
{{ haocaiData.name }}
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="退款退回库存">
|
||||
<el-switch v-model="haocaiData.isRefundStock" :active-value="1" :inactive-value="0"
|
||||
@click="handleSwitchhaocai(haocaiData.isRefundStock)"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="haocaiData.consList" border>
|
||||
<el-table-column label="序号" type="index" width="60"></el-table-column>
|
||||
<el-table-column label="耗材名称" prop="consInfoId">
|
||||
<template v-slot="scope">
|
||||
<el-select v-model="scope.row.consInfoId" reserve-keyword placeholder="请输入关键词"
|
||||
@change="selectionChange($event, scope.row)">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.conName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- <div class="tips" v-if="scope.row.stockNumber">库存:{{ scope.row.stockNumber }}</div> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" prop="conUnit"> </el-table-column>
|
||||
<el-table-column label="使用数量" prop="surplusStock" min-width="150px">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.surplusStock" :min="0" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template v-slot="scope">
|
||||
<div class="table_btn_wrap">
|
||||
<div class="btn sub" v-if="haocaiData.consList.length > 1"
|
||||
@click="haocaiData.consList.splice(scope.$index, 1)">
|
||||
<el-icon>
|
||||
<RemoveFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="btn add" v-if="scope.$index == haocaiData.consList.length - 1" @click="createItem(scope.row)">
|
||||
<el-icon>
|
||||
<CirclePlusFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</MyDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -63,12 +145,12 @@ import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./indexconfig/add";
|
||||
import contentConfig from "./indexconfig/content";
|
||||
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue"
|
||||
import contentConfig2 from "./indexconfig/content2";
|
||||
import editModalConfig from "./indexconfig/edit";
|
||||
import searchConfig from "./indexconfig/search";
|
||||
import MyDialog from "@/components/mycomponents/myDialog.vue";
|
||||
import Statistics from "./indexconfig/statistics.vue";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
@@ -84,11 +166,38 @@ const {
|
||||
} = usePage();
|
||||
const router = useRouter();
|
||||
let gongjiData = ref({});
|
||||
const myDialogRef = ref(null);
|
||||
const route = useRoute();
|
||||
const myDialogRefbaosun = ref(null);
|
||||
const myDialogRefhaocai = ref(null);
|
||||
let haocaiData = ref({});
|
||||
let options = ref([]);
|
||||
const form = reactive({
|
||||
warnLine: "",
|
||||
});
|
||||
let datas = reactive({
|
||||
number: 0,
|
||||
remark: "",
|
||||
images: []
|
||||
});
|
||||
function newHandleQueryClick(e: IObject | undefined) {
|
||||
const filterParams = contentRef.value?.getFilterParams();
|
||||
contentRef.value?.fetchPageData({ ...e, ...filterParams }, true);
|
||||
getTongji(e);
|
||||
}
|
||||
function editOpen(item: any) {
|
||||
haocaiData.value = item
|
||||
if (haocaiData.value.consList.length == 0) {
|
||||
let items = {
|
||||
"productId": item.id,
|
||||
"consInfoId": "",
|
||||
"surplusStock": '0'
|
||||
}
|
||||
haocaiData.value.consList.push(items)
|
||||
}
|
||||
handleResetClick()
|
||||
myDialogRefhaocai.value.open();
|
||||
}
|
||||
// 重置
|
||||
function handleResetClick2(queryParams: IObject) {
|
||||
const filterParams = contentRef.value?.getFilterParams();
|
||||
@@ -102,9 +211,7 @@ function getTongji(params: IObject | undefined) {
|
||||
gongjiData.value = res
|
||||
});
|
||||
}
|
||||
const form = reactive({
|
||||
num: "",
|
||||
});
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
router.push({ name: "addgoods" });
|
||||
@@ -112,7 +219,15 @@ async function handleAddClick() {
|
||||
// 加载上级规格下拉数据源
|
||||
// addModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" });
|
||||
// 加载角色下拉数据源
|
||||
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
}
|
||||
// 生成新商品绑定耗材关系项
|
||||
function createItem(val: IObject) {
|
||||
let item = {
|
||||
"productId": val.productId,
|
||||
"consInfoId": "",
|
||||
"surplusStock": ''
|
||||
}
|
||||
haocaiData.value.consList.push(item)
|
||||
}
|
||||
// 上架
|
||||
function handleSwitchChange(data: any) {
|
||||
@@ -123,11 +238,27 @@ function handleSwitchChange(data: any) {
|
||||
};
|
||||
UserAPI.onOff(obj);
|
||||
}
|
||||
// 售罄
|
||||
function handleSwitchChangeTwo(data: any) {
|
||||
let obj = {
|
||||
type: data.type == "sku" ? "sku" : "product",
|
||||
id: data.id,
|
||||
isSoldOut: data.isSoldStock,
|
||||
};
|
||||
UserAPI.markIsSoldOut(obj);
|
||||
}
|
||||
// 退款退回
|
||||
async function handleSwitchhaocai(row: IObject) {
|
||||
let res = await UserAPI.refundToStock({ isReturn: row, id: haocaiData.value.id })
|
||||
ElMessage.success('成功')
|
||||
// myDialogRefhaocai.value.close()
|
||||
}
|
||||
|
||||
// 编辑
|
||||
async function handleEditClick(row: IObject) {
|
||||
router.push({ name: "addgoods", query: { goods_id: row.id } });
|
||||
}
|
||||
const myDialogRef = ref(null);
|
||||
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
@@ -136,8 +267,32 @@ function handleToolbarClick(name: string) {
|
||||
myDialogRef.value.open();
|
||||
}
|
||||
}
|
||||
function confirm() {
|
||||
console.log(form, "debug");
|
||||
async function confirm() {
|
||||
let res = await UserAPI.stockWarning(form.warnLine)
|
||||
ElMessage.success("成功");
|
||||
myDialogRef.value.close();
|
||||
|
||||
}
|
||||
// 商品选择耗材
|
||||
function selectionChange(e, row) {
|
||||
let item = options.value.find(item => item.id == e)
|
||||
row.name = item.conName
|
||||
row.conUnit = item.conUnit
|
||||
}
|
||||
async function confirmbaosun() {
|
||||
let res = await UserAPI.reportDamage(datas)
|
||||
ElMessage.success("成功");
|
||||
myDialogRefbaosun.value.close();
|
||||
}
|
||||
async function confirmhaocai() {
|
||||
let obj = {
|
||||
consList: haocaiData.value.consList,
|
||||
id: haocaiData.value.id
|
||||
}
|
||||
let res = await UserAPI.bind(obj)
|
||||
ElMessage.success("成功");
|
||||
handleResetClick()
|
||||
myDialogRefhaocai.value.close();
|
||||
}
|
||||
// 商品规格
|
||||
function typeFilter(item: any) {
|
||||
@@ -155,44 +310,40 @@ function typeFilter(item: any) {
|
||||
}
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
// 重置密码
|
||||
if (data.name === "reset_pwd") {
|
||||
ElMessageBox.prompt("请输入用户「" + data.row.username + "」的新密码", "重置密码", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
}).then(({ value }) => {
|
||||
if (!value || value.length < 6) {
|
||||
ElMessage.warning("密码至少需要6位字符,请重新输入");
|
||||
return false;
|
||||
}
|
||||
// UserAPI.resetPassword(data.row.id, value).then(() => {
|
||||
// ElMessage.success("密码重置成功,新密码是:" + value);
|
||||
// });
|
||||
});
|
||||
} else if (data.name === "detail") {
|
||||
// 禁用表单编辑
|
||||
editModalRef.value?.handleDisabled(true);
|
||||
// 打开抽屉
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 修改抽屉标题
|
||||
editModalConfig.drawer = { ...editModalConfig.drawer, title: "用户详情" };
|
||||
// 加载部门下拉数据源
|
||||
// editModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
|
||||
// 加载角色下拉数据源
|
||||
// editModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
// 根据id获取数据进行填充
|
||||
// const formData = await UserAPI.getFormData(data.row.id);
|
||||
// 设置表单数据
|
||||
// editModalRef.value?.setFormData(formData);
|
||||
}
|
||||
datas.productId = data.row.id
|
||||
myDialogRefbaosun.value.open();
|
||||
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
onMounted(() => {
|
||||
console.log(route.query);
|
||||
if (route.query.id) {
|
||||
contentRef.value?.fetchPageData({ id: route.query.id });
|
||||
}
|
||||
// 获取耗材列表
|
||||
gethaocaiList()
|
||||
});
|
||||
async function gethaocaiList() {
|
||||
let res = await UserAPI.productcons({ id: route.query.id })
|
||||
options.value = res.records
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.table_btn_wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
|
||||
.btn {
|
||||
font-size: 26px;
|
||||
|
||||
&.sub {
|
||||
color: #FF4D4F;
|
||||
}
|
||||
|
||||
&.add {
|
||||
color: #52C41A;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -27,7 +27,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
obj.createEndTime = obj['1']
|
||||
const res = await UserAPI.getPage(obj);
|
||||
res.records.forEach((element: any) => {
|
||||
if (element.type == "single") {
|
||||
if (element.type != "sku") {
|
||||
delete element.skuList
|
||||
}
|
||||
});
|
||||
@@ -59,13 +59,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
// {
|
||||
// icon: "edit",
|
||||
// text: "库存预警",
|
||||
// type: "info",
|
||||
// name: "custom1",
|
||||
// auth: "import",
|
||||
// },
|
||||
{
|
||||
icon: "edit",
|
||||
text: "库存预警",
|
||||
type: "info",
|
||||
name: "custom1",
|
||||
auth: "import",
|
||||
},
|
||||
],
|
||||
cols: [
|
||||
// { type: "selection", width: 50, align: "center" },
|
||||
@@ -77,7 +77,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
slotName: "type",
|
||||
},
|
||||
{ label: "库存", align: "center", prop: "stockNumber" },
|
||||
{ label: "耗材信息", align: "center", prop: "consName" },
|
||||
{ label: "耗材信息", align: "center", prop: "consName", slotName: "consumables", templet: "custom", },
|
||||
{
|
||||
label: "上架",
|
||||
align: "center",
|
||||
@@ -85,13 +85,20 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
templet: "custom",
|
||||
slotName: "shangjia",
|
||||
},
|
||||
{
|
||||
label: "售罄",
|
||||
align: "center",
|
||||
prop: "isSoldStock",
|
||||
templet: "custom",
|
||||
slotName: "sellOut",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
operat: [{ text: "报损" }, "edit", "delete"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-for="(item, index) in datas.DialogForm.couponsList" :label="item.title">
|
||||
<el-input-number v-model="item.number" min="1" controls-position="right" placeholder="请输入数量" />
|
||||
<el-button type="" text @click="removegoods(index)">删除</el-button>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
@@ -96,6 +97,9 @@ onMounted(() => {
|
||||
getList(res)
|
||||
})
|
||||
})
|
||||
function removegoods(index) {
|
||||
datas.DialogForm.couponsList.splice(index, 1)
|
||||
}
|
||||
function selectShopRes(item) {
|
||||
item.forEach(ele => {
|
||||
ele.number = 1
|
||||
|
||||
Reference in New Issue
Block a user