fix: 代码合并

This commit is contained in:
YeMingfei666 2025-04-22 10:14:05 +08:00
commit cfc925e55c
5 changed files with 243 additions and 91 deletions

View File

@ -2,14 +2,26 @@
<div class="app-container">
<!-- 列表 -->
<!-- 搜索 -->
<page-search ref="searchRef" :search-config="searchConfig" @query-click="newHandleQueryClick"
@reset-click="handleResetClick2" />
<page-search
ref="searchRef"
:search-config="searchConfig"
@query-click="newHandleQueryClick"
@reset-click="handleResetClick2"
/>
<!-- 顶部数据 -->
<Statistics :data="gongjiData"></Statistics>
<!-- 列表 -->
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
<page-content
ref="contentRef"
:content-config="contentConfig"
@add-click="handleAddClick"
@edit-click="handleEditClick"
@export-click="handleExportClick"
@search-click="handleSearchClick"
@toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick"
@filter-change="handleFilterChange"
>
<!-- <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
@ -22,43 +34,67 @@
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
</template>
<template #shangjia="scope">
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click="handleSwitchChange(scope.row)"></el-switch>
<el-switch
v-model="scope.row[scope.prop]"
:active-value="1"
:inactive-value="0"
@click="handleSwitchChange(scope.row)"
></el-switch>
</template>
<template #isStock="scope">
<el-switch
disabled
v-model="scope.row[scope.prop]"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
<template #kucunedit="scope">
<template v-if="scope.row.type != null">
{{ scope.row.stockNumber }} <el-icon @click="kucunedit(scope.row)" style="cursor: pointer;color: #4080ff;">
{{ scope.row.stockNumber }}
<el-icon @click="kucunedit(scope.row)" style="cursor: pointer; color: #4080ff">
<EditPen />
</el-icon>
</template>
</template>
<template #tuikuantuihui="scope">
<el-switch v-if="!scope.row.productId" v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click="handleSwitchhaocai(scope.row)"></el-switch>
<el-switch
v-if="!scope.row.productId"
v-model="scope.row[scope.prop]"
:active-value="1"
:inactive-value="0"
@click="handleSwitchhaocai(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>
<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" />
<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">
<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;">
<span v-else>绑定</span>
<el-icon @click="editOpen(scope.row)" style="cursor: pointer; color: #4080ff">
<EditPen />
</el-icon>
</template>
</template>
</page-content>
<!-- 新增 -->
@ -69,7 +105,11 @@
</page-modal>
<!-- 编辑 -->
<page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
<page-modal
ref="editModalRef"
:modal-config="editModalConfig"
@submit-click="handleSubmitClick"
>
<template #gender="scope">
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
</template>
@ -100,9 +140,11 @@
<!-- 耗材绑定 -->
<MyDialog ref="myDialogRefhaocai" @confirm="confirmhaocai" width="50%" title="耗材绑定">
<el-row>
<el-col :span="12"> <el-form-item label="商品名">
<el-col :span="12">
<el-form-item label="商品名">
{{ haocaiData.name }}
</el-form-item></el-col>
</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"
@ -114,15 +156,23 @@
<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
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="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" />
@ -131,13 +181,20 @@
<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)">
<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)">
<div
class="btn add"
v-if="scope.$index == haocaiData.consList.length - 1"
@click="createItem(scope.row)"
>
<el-icon>
<CirclePlusFilled />
</el-icon>
@ -162,13 +219,13 @@ import usePage from "@/components/CURD/usePage";
import { isSyncStatus } from "@/utils/index";
import addModalConfig from "./indexconfig/add";
import contentConfig from "./indexconfig/content";
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue"
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";
import { min } from 'lodash';
import { min } from "lodash";
const {
searchRef,
@ -192,24 +249,24 @@ const myDialogRefhaocai = ref(null);
const myDialogRefkucun = ref(null);
let haocaiData = ref({});
let options = ref([]);
let kucundata = ref(0)
let kucundata = ref(0);
const form = reactive({
warnLine: "",
});
let datas = reactive({
number: 0,
remark: "",
images: []
images: [],
});
if (isSyncStatus()) {
contentConfig.toolbar[0].hidden = true
contentConfig.toolbar[1].hidden = false
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true
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
contentConfig.toolbar[0].hidden = false;
contentConfig.toolbar[1].hidden = true;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false;
}
onMounted(() => {
@ -218,8 +275,64 @@ onMounted(() => {
contentRef.value?.fetchPageData({ id: route.query.id });
}
//
gethaocaiList()
gethaocaiList();
});
if (isSyncStatus()) {
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(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
//
gethaocaiList();
});
if (isSyncStatus()) {
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(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
//
gethaocaiList();
});
if (isSyncStatus()) {
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(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
//
gethaocaiList();
});
function newHandleQueryClick(e: IObject | undefined) {
const filterParams = contentRef.value?.getFilterParams();
@ -228,25 +341,28 @@ function newHandleQueryClick(e: IObject | undefined) {
}
//
function kucunedit(item) {
kucundata.value = item
myDialogRefkucun.value.open()
kucundata.value = item;
myDialogRefkucun.value.open();
}
async function confirmkucun() {
let res = await UserAPI.modifyStock({ id: kucundata.value.id, stockNumber: kucundata.value.stockNumber })
ElMessage.success('成功')
myDialogRefkucun.value.close()
let res = await UserAPI.modifyStock({
id: kucundata.value.id,
stockNumber: kucundata.value.stockNumber,
});
ElMessage.success("成功");
myDialogRefkucun.value.close();
}
function editOpen(item: any) {
haocaiData.value = item
haocaiData.value = item;
if (haocaiData.value.consList.length == 0) {
let items = {
"productId": item.id,
"consInfoId": "",
"surplusStock": '0'
}
haocaiData.value.consList.push(items)
productId: item.id,
consInfoId: "",
surplusStock: "0",
};
haocaiData.value.consList.push(items);
}
handleResetClick()
handleResetClick();
myDialogRefhaocai.value.open();
}
//
@ -254,12 +370,11 @@ function handleResetClick2(queryParams: IObject) {
const filterParams = contentRef.value?.getFilterParams();
contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true);
getTongji(queryParams);
}
function getTongji(params: IObject | undefined) {
UserAPI.statistics(params).then((res) => {
gongjiData.value = res
gongjiData.value = res;
});
}
@ -274,11 +389,11 @@ async function handleAddClick() {
//
function createItem(val: IObject) {
let item = {
"productId": val.productId,
"consInfoId": "",
"surplusStock": ''
}
haocaiData.value.consList.push(item)
productId: val.productId,
consInfoId: "",
surplusStock: "",
};
haocaiData.value.consList.push(item);
}
//
function handleSwitchChange(data: any) {
@ -309,18 +424,18 @@ function handleSwitchChangethree(data: any) {
// 退退
async function handleSwitchhaocai(row: IObject) {
let res = await UserAPI.refundToStock({ isReturn: row.isRefundStock, id: row.id })
ElMessage.success('成功')
handleResetClick()
let res = await UserAPI.refundToStock({ isReturn: row.isRefundStock, id: row.id });
ElMessage.success("成功");
handleResetClick();
// myDialogRefhaocai.value.close()
}
//
async function handleEditClick(row: IObject) {
try {
router.push({ name: "addgoods", query: { goods_id: row.id } });
router.push({ name: "addgoods", query: { goods_id: row.id } });
} catch (error) {
ElMessage.error('没有编辑权限')
ElMessage.error("没有编辑权限");
}
}
@ -331,25 +446,25 @@ async function handleToolbarClick(name: string) {
// ElMessage.success("1");
myDialogRef.value.open();
}
if (name === "sync") { //
let res = await UserAPI.sync()
ElMessage.success('操作成功,数据正在后台同步中...')
if (name === "sync") {
//
let res = await UserAPI.sync();
ElMessage.success("操作成功,数据正在后台同步中...");
}
}
async function confirm() {
let res = await UserAPI.stockWarning(form.warnLine)
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
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)
let res = await UserAPI.reportDamage(datas);
ElMessage.success("成功");
myDialogRefbaosun.value.close();
contentRef.value?.fetchPageData();
@ -357,11 +472,11 @@ async function confirmbaosun() {
async function confirmhaocai() {
let obj = {
consList: haocaiData.value.consList,
id: haocaiData.value.id
}
let res = await UserAPI.bind(obj)
id: haocaiData.value.id,
};
let res = await UserAPI.bind(obj);
ElMessage.success("成功");
handleResetClick()
handleResetClick();
myDialogRefhaocai.value.close();
}
//
@ -380,16 +495,15 @@ function typeFilter(item: any) {
}
//
async function handleOperatClick(data: IOperatData) {
datas.productId = data.row.id
datas.productId = data.row.id;
myDialogRefbaosun.value.open();
datas.number = 1
datas.remark = ""
datas.number = 1;
datas.remark = "";
}
async function gethaocaiList() {
let res = await UserAPI.productcons({ id: route.query.id })
options.value = res.records
let res = await UserAPI.productcons({ id: route.query.id });
options.value = res.records;
}
</script>
<style scoped lang="scss">
@ -402,11 +516,11 @@ async function gethaocaiList() {
font-size: 26px;
&.sub {
color: #FF4D4F;
color: #ff4d4f;
}
&.add {
color: #52C41A;
color: #52c41a;
}
}
}

View File

@ -93,6 +93,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
// { label: "库存", align: "center", prop: "stockNumber" },
{ label: "库存", align: "center", slotName: "kucunedit", templet: "custom", prop: "stockNumber" },
{ label: "耗材信息", align: "center", prop: "consName", slotName: "consumables", templet: "custom", },
{
label: "库存开关",
align: "center",
prop: "isStock",
templet: "custom",
slotName: "isStock",
},
{
label: "上架",
align: "center",

View File

@ -207,7 +207,12 @@
</div>
</div>
<!-- 扫码 -->
<scanPay ref="refScanPay" :order="orderInfo" @confirm="refScanPayConfirm"></scanPay>
<scanPay
ref="refScanPay"
:order="orderInfo"
@confirm="refScanPayConfirm"
@paysuccess="paysuccess"
></scanPay>
<!-- 打折 -->
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
<!-- 优惠券 -->
@ -591,12 +596,16 @@ async function payOrder(payType, isScan, guazhangren) {
}
if (res) {
clearTimeout(payTimer);
ElMessage.success("支付成功");
emits("paysuccess");
loading.close();
paysuccess();
}
}
function paysuccess() {
clearTimeout(payTimer);
ElMessage.success("支付成功");
emits("paysuccess");
}
//
const discountAmount = computed(() => {
const money = carts.goodsTotal - productCouponDiscountAmount.value;

View File

@ -139,9 +139,20 @@ export default {
shopId: localStorage.getItem("shopId"),
orderId: this.order.id,
});
console.log(res);
// if (res == "done") {
// ElMessage({
// message: "",
// type: "success",
// });
// }
if (res != "unpaid") {
console.log("已支付或取消");
this.close();
this.clear();
this.$emit("paySuccess");
if (res == "done") {
this.$emit("paysuccess");
}
}
},
startGetOrderInfo() {

View File

@ -859,7 +859,10 @@ function resetOldOrder() {
originAmount: 0,
});
}
function refresh() {
console.log("index refresh");
carts.clearHistory();
resetOldOrder();
showOrder.value = false;
user.value = {};
@ -871,6 +874,14 @@ function refresh() {
// router.go(0);
// }, 1500);
}
watch(
() => carts.oldOrder.id,
(newval, oldval) => {
if (!newval && carts.isEmpty) {
showOrder.value = false;
}
}
);
</script>
<style lang="scss" scoped>