Commit d688fa22 by wangzhihui

```

feat(stockManage): 更新库存管理相关API接口和页面功能

- 修改补库存标签码API接口方法名为dj.api.smartcarlife.labelCode.recode
- 修改补库存标签码操作日志API接口方法名为dj.api.smartcarlife.labelCode.recodeLog
- 在出入库记录页面添加搜索按钮事件处理
- 更新表格字段映射,包括出入库方式、备注等字段
- 添加页面间参数传递功能,支持时间参数传递
- 在出库列表页面更新出库方式字段映射和格式化逻辑
- 优化补码对话框组件,调整表单字段和验证逻辑
- 更新补码日志对话框组件,优化表格数据显示
- 在库存列表页面添加库存跳转功能和日期范围选择
- 更新门店配置页面的扫码出入库开关配置功能
```
1 parent ecbbc1d0
......@@ -277,15 +277,12 @@ export function getInventoryTransactionRecordsPage(data) {
// 补库存标签码 (补码日志)
export function replenishCodeApi(data) {
data.method = "dj.api.smartcarlife.merchant.stock.replenishCode";
data.method = "dj.api.smartcarlife.labelCode.recode";
return request(data, RequestMethods.POST);
}
// 补库存标签码操作日志列表 (接口待提供)
// 补库存标签码操作日志列表
export function getReplenishLogListApi(data) {
// data.method = "dj.api.smartcarlife.merchant.stock.replenishLog"
// return request(data, RequestMethods.POST)
// 暂时拦截报错,让前端直接走 catch 渲染 Mock 数据
return Promise.reject("接口尚未提供");
data.method = "dj.api.smartcarlife.labelCode.recodeLog";
return request(data, RequestMethods.POST);
}
......@@ -11,9 +11,9 @@
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
handle
size="small"
type="primary">
type="primary"
@click="handleSearch">
查询
</el-button>
<el-button size="small" @click="handleReset">
......@@ -232,12 +232,19 @@ export default {
},
{
label: "出入库方式",
prop: "merchantName",
prop: "warehousingMethod",
width: 120,
formatter: (cellValue) => {
return cellValue.warehousingMethod == 1
? "扫码入库"
: cellValue.warehousingMethod == 3
? "手工入库"
: "-";
},
},
{
label: "备注",
prop: "merchantName",
prop: "remark",
width: 120,
},
{
......@@ -305,6 +312,13 @@ export default {
mounted() {
let allOpt = { confId: "", confValue: "全部" };
this.baseData.inventoryTypeList.unshift(allOpt);
// 接收上个页面带过来的时间参数
if (this.$route.query.startDate && this.$route.query.endDate) {
this.searchForm.transactionTimeStr = [this.$route.query.startDate, this.$route.query.endDate];
this.handleSearch();
}
this.getBaseData();
},
......@@ -335,6 +349,9 @@ export default {
}
delete this.tableSearchForm.transactionTimeStr;
},
handleSearch() {
this.$refs.purchasementReviewTable.refreshTable(true, true);
},
handleReset() {
this.searchForm = {
transactionTimeStr: "",
......
......@@ -306,18 +306,16 @@ export default {
},
}, {
label: "出库方式",
prop: "storeUsage",
prop: "reduceMethod",
width: "200px",
formatter: (cellValue) => {
return cellValue.storeUsage || "-";
// 出库方式: 2-扫码出库, 4-手工出库
return cellValue.reduceMethod == 2 ? "扫码出库" : cellValue.reduceMethod == 4 ? "手工出库" : "-";
},
}, {
label: "备注",
prop: "storeUsage",
prop: " remark",
width: "200px",
formatter: (cellValue) => {
return cellValue.storeUsage || "-";
},
}, {
label: "操作人",
prop: "updatedUserName",
......
......@@ -19,15 +19,12 @@
<span>{{ row.productCode || '-' }}</span>
</el-form-item>
<el-form-item label="产品ID:">
<span>{{ row.productId || '-' }}</span>
<span>{{ row.upgradeCommodityCode || '-' }}</span>
</el-form-item>
<el-form-item v-if="isMembrane"
<el-form-item v-if="row.isFilm"
:error="errorMsg"
label="库存数量:"
prop="stockNum">
<template #label>
<span style="color: #f56c6c;">*</span>库存数量:
</template>
<el-input v-model="form.stockNum"
placeholder="请输入"
style="width: 200px"
......@@ -39,27 +36,6 @@
</el-form-item>
</el-form>
</div>
<!-- 步骤2:展示并下载二维码 -->
<!-- <div v-else class="qrcode-wrapper">
<div id="qrcode-capture" class="qrcode-capture-box">
<div class="info-section">
<div class="info-item">
名称:{{ row.upgradeGoodsName || '-' }}
</div>
<div class="info-item">
编码:{{ row.productCode || '-' }}
</div>
<div class="info-item">
ID:{{ row.productId || '-' }}
</div>
</div>
<div id="qrcodeDiv" class="qrcode-img"></div>
<div class="qr-text">
补码
</div>
</div>
</div> -->
</div>
</baseDialog>
</template>
......@@ -67,7 +43,6 @@
<script>
import { replenishCodeApi } from "@/api/stockManage";
import { limitPrice } from "@/common/format";
import { baseConfig } from "@/main";
export default {
name: "ComplementCodeDialog",
......@@ -117,17 +92,6 @@ export default {
this.$emit("update:visibleSync", newVal);
},
},
isMembrane() {
// 膜类产品类目:太阳膜、改色膜、车衣
return baseConfig.membraneTypeList && baseConfig.membraneTypeList.includes(this.row.goodsType);
},
},
mounted() {
// 校验当前产品库存是否大于0
if (!this.row.stock || Number(this.row.stock) <= 0) {
this.$message.error("当前产品库存必须大于0,才允许补库存标签码");
this.$emit("update:visibleSync", false);
}
},
methods: {
handleInput(val) {
......@@ -147,8 +111,7 @@ export default {
// 执行下载
this.downloadQrCode();
} else {
// 第一步确认,校验并生成二维码
if (this.isMembrane) {
if (this.row.isFilm) {
if (!this.form.stockNum) {
this.$message.warning("请输入库存数量");
return;
......@@ -158,21 +121,29 @@ export default {
this.$message.error("输入值不能高于当前库存数量");
return;
}
} else {
if (!this.row.stock || Number(this.row.stock) <= 0) {
this.$message.error("当前产品库存必须大于0,才允许补库存标签码");
return;
}
}
// 组装请求参数
const params = {
merchantShopGoodsStockId: this.row.id, // 假设列表行数据包含主键 id,如果不是请替换为正确的键名
productId: this.row.productId,
stockNum: this.isMembrane ? this.form.stockNum : 1, // 膜类传输入的数量,非膜类默认传1
merchantId: this.row.merchantId,
upgradeGoodsId: this.row.upgradeGoodsId, // 产品ID
goodsType: this.row.goodsType, // 商品类型
};
if (this.row.isFilm) {
params.stockNum = this.form.stockNum;
}
this.isLoading = true;
replenishCodeApi(params).then((res) => {
this.isLoading = false;
if (res && res.qrCodeUrl) {
// 记录补码日志成功,拿到 url 直接下载
this.downloadFile(res.qrCodeUrl, `补码标签_${this.row.upgradeGoodsName || this.row.productCode}.png`);
if (res && res.labelImageUrl) {
// 拿到 labelImageUrl 直接下载
this.downloadFile(res.labelImageUrl, `补码标签_${this.row.upgradeGoodsName || this.row.productCode}.png`);
this.visible = false;
this.$message.success("补库存标签码成功并开始下载");
} else {
......@@ -185,10 +156,9 @@ export default {
},
downloadFile(url, fileName) {
const link = document.createElement("a");
link.href = url;
// 解决跨域下载问题(如果后端支持CORS),否则如果是同源或者blob则直接下载
link.setAttribute("download", fileName);
link.target = "_blank"; // 兜底:如果浏览器不支持直接下载跨域资源,则在新标签页打开
link.style.display = "none";
link.href = url + "?response-content-type=application/octet-stream";
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
......
......@@ -20,48 +20,60 @@
</el-col>
<el-col class="info-item" :span="24">
<span class="label">产品ID:</span>
<span class="value">{{ row.productId || '-' }}</span>
<span class="value">{{ row.upgradeCommodityCode || '-' }}</span>
</el-col>
</el-row>
</div>
<!-- 操作日志 -->
<div class="section-title" style="margin-top: 20px;">
操作日志
</div>
<el-table v-loading="loading"
border
:data="tableData"
style="width: 100%">
<el-table-column align="center"
label="序号"
type="index"
width="80">
</el-table-column>
<el-table-column v-if="isMembrane"
align="center"
label="库存数量"
prop="stockNum">
</el-table-column>
<el-table-column align="center"
label="操作人"
prop="createByName">
</el-table-column>
<el-table-column align="center"
label="操作时间"
prop="createTime">
</el-table-column>
</el-table>
<template v-if="tableData.length">
<div class="section-title" style="margin-top: 20px;">
操作日志
</div>
<el-table v-loading="loading"
border
:data="tableData"
style="width: 100%">
<el-table-column align="center"
label="序号"
type="index"
width="80">
</el-table-column>
<el-table-column v-if="row.isFilm"
align="center"
label="库存数量"
prop="stockNum">
</el-table-column>
<el-table-column align="center"
label="操作人"
prop="createdBy">
</el-table-column>
<el-table-column align="center"
label="操作时间">
<template #default="scope">
{{ scope.row.createdDate | formatDate }}
</template>
</el-table-column>
</el-table>
</template>
</div>
</baseDialog>
</template>
<script>
import dayjs from "dayjs";
import { getReplenishLogListApi } from "@/api/stockManage";
import { baseConfig } from "@/main";
export default {
name: "ComplementLogDialog",
filters: {
formatDate(val) {
if (!val)
return "-";
return dayjs(val).format("YYYY-MM-DD HH:mm:ss");
},
},
props: {
visibleSync: {
type: Boolean,
......@@ -96,10 +108,6 @@ export default {
this.$emit("update:visibleSync", newVal);
},
},
isMembrane() {
// 膜类产品类目:太阳膜、改色膜、车衣
return baseConfig.membraneTypeList && baseConfig.membraneTypeList.includes(this.row.goodsType);
},
},
mounted() {
this.fetchLogData();
......@@ -107,23 +115,23 @@ export default {
methods: {
fetchLogData() {
this.loading = true;
// 假设接口通过门店库存ID或者产品ID查询
const params = {
merchantShopGoodsStockId: this.row.id,
pageSize: 1000,
currentPage: 1,
upgradeGoodsId: this.row.upgradeGoodsId,
merchantId: this.row.merchantId,
};
getReplenishLogListApi(params).then((res) => {
this.loading = false;
// 假设后端返回的数据已经是按时间倒序排列好的数组
this.tableData = res || [];
if (res && res.list) {
this.tableData = res.list;
} else {
this.tableData = [];
}
}).catch(() => {
this.loading = false;
// TODO: 由于后端接口还没提供,为了方便前端查看原型效果,这里加入 Mock 数据
// 后续接口提供后,如果能正常返回,catch里的这部分 mock 可以移除
this.tableData = [
{ stockNum: 10, createByName: "周杰伦", createTime: "2025-09-12 10:01:12" },
{ stockNum: 2, createByName: "孙燕姿", createTime: "2025-09-11 10:01:12" },
];
this.tableData = [];
});
},
},
......
......@@ -36,6 +36,10 @@
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams">
<template #stockHtml="scope">
<span class="count-txt" @click="gotoInventoryTransaction">{{ (scope.scope.stock || scope.scope.stock == 0) ? Number.parseFloat(scope.scope.stock).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) == 1 ? "米" : "件") : "-" }}</span>
</template>
<template #auth-button="scope">
<auth-button :data="scope.scope" />
</template>
......@@ -97,6 +101,7 @@ export default {
yqMerchantId: "",
goodsType: "",
goodsSeries: "",
selectData: [],
queryDate: "",
},
searchFormSearch: {},
......@@ -148,7 +153,7 @@ export default {
isClear: true,
}, {
label: "选择日期",
name: "queryDate",
name: "selectData",
type: "datePicker",
isClear: true,
placeholder: "请选择",
......@@ -178,7 +183,7 @@ export default {
width: "250px",
}, {
label: "产品ID",
prop: "productId",
prop: "upgradeCommodityCode",
width: "250px",
}, {
label: "系列",
......@@ -203,9 +208,10 @@ export default {
}, {
label: "当前库存",
prop: "stock",
formatter: (cellValue) => {
return (cellValue.stock || cellValue.stock == 0) ? Number.parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) == 1 ? "米" : "件") : "-";
},
addHtml: "stockHtml",
// formatter: (cellValue) => {
// return (cellValue.stock || cellValue.stock == 0) ? Number.parseFloat(cellValue.stock).toFixed(2) + (this.membraneTypeList.includes(cellValue.goodsType) == 1 ? "米" : "件") : "-";
// },
}, {
label: "所属仓库",
prop: "yqMerchantName",
......@@ -261,6 +267,17 @@ export default {
// async getBaseData() {
// this.getOptionsList()
// },
gotoInventoryTransaction() {
let query = {};
if (this.searchForm.selectData && this.searchForm.selectData.length === 2) {
query.startDate = Util.dateFormate(this.searchForm.selectData[0], "YYYY-MM-DD");
query.endDate = Util.dateFormate(this.searchForm.selectData[1], "YYYY-MM-DD");
}
this.$router.push({
path: "/inventoryTransactionRecords",
query,
});
},
// 补码
handleComplement(row) {
this.recordInfo = row;
......@@ -287,9 +304,10 @@ export default {
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm);
if (this.searchFormSearch.queryDate) {
this.searchFormSearch.queryDate = Util.dateFormate(this.searchFormSearch.queryDate, "YYYY-MM-DD") + " 23:59:59";
if (this.searchFormSearch.selectData && this.searchFormSearch.selectData.length) {
this.searchFormSearch.queryDate = Util.dateFormate(this.searchFormSearch.selectData[1], "YYYY-MM-DD") + " 23:59:59";
}
delete this.searchFormSearch.selectData;
this.searchFormSearch.dataMonth = Util.dateFormate(new Date(), "YYYY-MM");
resolve();
......@@ -320,6 +338,7 @@ export default {
yqMerchantId: "",
goodsType: "",
goodsSeries: "",
selectData: [],
queryDate: "",
};
this.$refs.recordTable.refreshTable();
......@@ -330,7 +349,7 @@ export default {
handleRelateProConfirm(data) {
let params = data;
params.method = "dj.api.smartcarlife.merchantShopGoodsStock.statement.exportAsync";
console.log(params);
// return
const list = [
...this.dowloadList,
......@@ -389,6 +408,7 @@ export default {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
cursor: pointer;
}
.leftSpan {
......
......@@ -263,8 +263,13 @@ export default {
width: "200px",
}, {
label: "入库方式",
prop: "merchantName",
prop: "warehousingMethod",
width: "200px",
formatter: (cellValue) => {
// 入库方式: 1-扫码入库, 3-手工入库
return cellValue.warehousingMethod == 1 ? "扫码入库" : "手工入库";
},
}],
},
baseData: {
......
......@@ -424,22 +424,23 @@
<span class="item-tips">注:单选1.1场景的门店,当前门店权益/延保录单后,会给客户赠送该门店1.1太阳膜礼券</span>
</el-form-item>
<el-form-item label="扫码出入库:">
<el-switch v-model="form.openFlag"
<el-switch v-model="form.scanEnable"
active-color="#2a58ad"
active-value="Y"
:active-value="1"
class="switchStyle"
inactive-value="N"
@change="openNoteTaking($event)">
:inactive-value="0"
@change="changeScanEnable">
</el-switch>
</el-form-item>
<el-form-item label="扫码+输入:">
<el-switch v-model="form.openFlag"
<el-switch v-model="form.scanInputEnable"
active-color="#2a58ad"
active-value="Y"
:active-value="1"
class="switchStyle"
inactive-value="N"
@change="openNoteTaking($event)">
:disabled="!form.scanEnable "
:inactive-value="0">
</el-switch>
<span class="item-tips">注:该开关不允许单独开启</span>
</el-form-item>
<!-- <el-form-item label="阳光激励费:" prop="sunlightIncentiveCost">
<div>
......@@ -567,6 +568,8 @@ export default {
serviceMerchantServiceChargeConfig: {},
shopMerchantConfig: {},
bindMerchantId: "",
scanEnable: "0",
scanInputEnable: "0",
// boutiqueSunshineInspiration: '',
// quotationSunshineInspiration: '',
// boutiqueMarketInspiration: '',
......@@ -659,6 +662,13 @@ export default {
get: "d2admin/base/get",
close: "d2admin/page/close",
}),
// 扫码出入库按钮【关闭】则该条件不予许操作且置灰显示,点击按钮全局提示“该开关不允许单独开启
changeScanEnable(value) {
console.log(value);
if (value === 0) {
this.form.scanInputEnable = 0;
}
},
async getBaseData() { },
// 获取店铺设置信息
......@@ -723,12 +733,13 @@ export default {
this.directorList[item.directorType].push(item.directorUserId);
}
});
console.log(res, "res");
res.costPrivacyShowFlag = res?.shopMerchantConfig?.costPrivacyShowFlag || null;
res.bindMerchantId = res?.shopMerchantConfig?.bindMerchantId || "";
res.bindMerchantName = res?.shopMerchantConfig?.bindMerchantName || "";
res.boutiqueBusinessDevelopmentScene = res?.shopMerchantConfig?.boutiqueBusinessDevelopmentScene ? res?.shopMerchantConfig?.boutiqueBusinessDevelopmentScene.split(",") : [];
res.quotationBusinessDevelopmentScene = res?.shopMerchantConfig?.quotationBusinessDevelopmentScene ? res?.shopMerchantConfig?.quotationBusinessDevelopmentScene.split(",") : [];
res.scanEnable = res?.shopMerchantConfig?.scanEnable || null;
res.scanInputEnable = res?.shopMerchantConfig?.scanInputEnable || null;
console.log(res, "res");
this.form = deepClone(res);
if (!this.form.serviceMerchantServiceChargeConfig) {
......@@ -1197,6 +1208,9 @@ export default {
}
}
const shopMerchantConfig = _params.shopMerchantConfig;
// 扫码出入库、扫码+输入
shopMerchantConfig.scanEnable = _params.scanEnable;
shopMerchantConfig.scanInputEnable = _params.scanInputEnable;
_params.boutiqueBusinessDevelopmentScene = this.form.boutiqueBusinessDevelopmentScene.join(",");
_params.quotationBusinessDevelopmentScene = this.form.quotationBusinessDevelopmentScene.join(",");
// _params.boutiqueDirectorUserId = shopMerchantConfig.boutiqueDirectorUserId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!