Merge branch 'bonus-jyy-smart-canteen' of http://192.168.0.75:3000/bonus/bonus-ui into bonus-jyy-smart-canteen

This commit is contained in:
zzyuan 2025-06-09 13:40:28 +08:00
commit 1e68aaf87e
2 changed files with 363 additions and 27 deletions

View File

@ -91,9 +91,61 @@ export function shopProductPageListApi(data) {
params: data params: data
}) })
} }
// 批量添加商品
export function batchRemoveMaterialApi(data) {
return request({
url: '/smart-canteen/supermarket_product/addProducts',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除商品
export function delShopProductApi(data) {
return request({
url: '/smart-canteen/supermarket_product/delProduct',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 商品详情
export function getShopProductApi(data) {
return request({
url: '/smart-canteen/supermarket_product/getInfo',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 商品编辑
export function eitdShopProductApi(data) {
return request({
url: '/smart-canteen/supermarket_product/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 商品上线销售
export function onlienShopProductApi(data) {
return request({
url: '/smart-canteen/supermarket_product/onlines',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}

View File

@ -378,6 +378,7 @@
:disabled="multiple" :disabled="multiple"
@click="handleShopBatchDel" @click="handleShopBatchDel"
>批量删除</el-button> >批量删除</el-button>
<el-button type="primary" size="mini" :disabled="multiple" @click="handleShopBatchOnline">批量线上销售</el-button>
</el-col> </el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> --> <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
</el-row> </el-row>
@ -393,22 +394,22 @@
<el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="上架状态" align="center" key="putawayState" prop="putawayState" :show-overflow-tooltip="true"> <el-table-column label="上架状态" align="center" key="putawayState" prop="putawayState" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span> <span>{{ scope.row.putawayState=="1" ? '上架' : '下架' }}</span>
<el-switch <el-switch
v-model="scope.row.putawayState" v-model="scope.row.putawayState=='1'?true:false"
@change="handlePutawayStateChange(scope.row)"> @change="handlePutawayStateChange(scope.row)">
</el-switch> </el-switch>
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span> <span>{{ scope.row.putawayState=="1" ? '上架' : '下架' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="线上销售" align="center" key="ifOnline" prop="ifOnline" :show-overflow-tooltip="true"> <el-table-column label="线上销售" align="center" key="ifOnline" prop="ifOnline" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span> <span>{{ scope.row.ifOnline=="2" ? '否' : '是' }}</span>
<el-switch <el-switch
v-model="scope.row.ifOnline" v-model="scope.row.ifOnline=='1'?true:false"
@change="handleIfOnlineChange(scope.row)"> @change="handleIfOnlineChange(scope.row)">
</el-switch> </el-switch>
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span> <span>{{ scope.row.ifOnline=="2" ? '否' : '是' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="零售价" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true"> <el-table-column label="零售价" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
@ -455,6 +456,116 @@
</el-row> </el-row>
</div> </div>
</el-dialog> </el-dialog>
<!-- 商品编辑对话框 -->
<el-dialog :title="titleProductEitd" :visible.sync="openProductEitd" width="980px" append-to-body>
<el-form ref="form" :model="productFrom" label-width="90px">
<el-row justify="center">
<table align="center" width="80%" cellspacing="0">
<tr >
<td colspan="4" class="table-title">商品</td>
</tr>
<tr >
<td class="table-label"><span >名称</span></td>
<td class="table-content">
<el-input
v-model="productFrom.materialName"
disabled
/>
</td>
<td class="table-label"><span >单位</span></td>
<td class="table-content">
<el-input
v-model="productFrom.unitName"
disabled
/>
</td>
</tr>
<tr >
<td class="table-label"><span >条码</span></td>
<td class="table-content">
<el-input
v-model="productFrom.barCode"
disabled
/>
</td>
<td class="table-label"><span >零售价</span></td>
<td class="table-content">
<el-input
v-model="productFrom.salePrice"
placeholder="请输入"
@input="handleNumberInput"
/>
</td>
</tr>
<tr >
<td class="table-label"><span >会员价</span></td>
<td class="table-content">
<el-input
v-model="productFrom.prefPrice"
placeholder="请输入"
@input="handleNumberInput"
/>
</td>
<td class="table-label"><span >个人限购数量</span></td>
<td class="table-content">
<el-input
v-model="productFrom.personLimit"
placeholder="请输入"
@input="handleNumberInput"
/>
</td>
</tr>
<tr >
<td class="table-label"><span >每日限购数量</span></td>
<td class="table-content">
<el-input
v-model="productFrom.oneDayLimit"
placeholder="请输入"
@input="handleNumberInput"
/>
</td>
<td class="table-label"><span >库存</span></td>
<td class="table-content">
<el-input
v-model="productFrom.inventoryNum"
placeholder="请输入"
@input="handleNumberInput"
/>
</td>
</tr>
<tr >
<td class="table-label"><span >上架状态</span></td>
<td class="table-content">
<template>
<span>{{ (productFrom.putawayState)=="1" ? '上架' : '下架' }}</span>
<el-switch
v-model="productFrom.putawayStatef"
@change="handlePutawayStateEitdChange(productFrom)">
</el-switch>
<span>{{ (productFrom.putawayState)=="1" ? '上架' : '下架' }}</span>
</template>
</td>
<td class="table-label"><span >线上销售</span></td>
<td class="table-content">
<template >
<span>{{ (productFrom.ifOnline)=="2" ? '否' : '是' }}</span>
<el-switch
v-model="productFrom.ifOnlinef"
@change="handleIfOnlineEitdChange(productFrom)">
</el-switch>
<span>{{ (productFrom.ifOnline)=="2" ? '否' : '是' }}</span>
</template>
</td>
</tr>
</table>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitShopEitd"> </el-button>
<el-button @click="cancelShopEitd"> </el-button>
</div>
</el-dialog>
<!-- 商品添加对话框 -->
<el-dialog :title="titleAddProduct" :visible.sync="openAddProduct" width="1200px" append-to-body> <el-dialog :title="titleAddProduct" :visible.sync="openAddProduct" width="1200px" append-to-body>
<div class="app-container" id="toolsType"> <div class="app-container" id="toolsType">
<el-row> <el-row>
@ -485,14 +596,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="">批量线上销售</el-button> <el-button type="primary" @click="handleAddShopQuery">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row> </el-row>
<el-row> <el-row>
<!--数据--> <!--数据-->
<el-col :span="24" :xs="24"> <el-col :span="24" :xs="24">
<el-table v-loading="loading" :data="tableAddShopListData" height="550" ref="multipleTable" border :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tableAddShopListData" height="550" ref="multipleTable" border :row-key="(row)=>{return row.materialId}" @selection-change="handleAddSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/> <el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
<el-table-column label="区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" /> <el-table-column label="区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
<el-table-column label="名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
@ -503,7 +614,7 @@
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span> <span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
<el-switch <el-switch
v-model="scope.row.putawayState" v-model="scope.row.putawayState"
@change="handlePutawayStateChange(scope.row)"> @change="handlePutawayStateChanges(scope.row)">
</el-switch> </el-switch>
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span> <span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
</template> </template>
@ -513,7 +624,7 @@
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span> <span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
<el-switch <el-switch
v-model="scope.row.ifOnline" v-model="scope.row.ifOnline"
@change="handleIfOnlineChange(scope.row)"> @change="handleIfOnlineChanges(scope.row)">
</el-switch> </el-switch>
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span> <span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
</template> </template>
@ -532,7 +643,7 @@
<el-table-column label="每日限购数量" align="center" key="oneDayLimit" prop="oneDayLimit" :show-overflow-tooltip="true" /> <el-table-column label="每日限购数量" align="center" key="oneDayLimit" prop="oneDayLimit" :show-overflow-tooltip="true" />
<el-table-column label="库存数" align="center" key="inventoryNum" prop="inventoryNum" :show-overflow-tooltip="true" /> <el-table-column label="库存数" align="center" key="inventoryNum" prop="inventoryNum" :show-overflow-tooltip="true" />
<el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" /> <el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="100" fixed="right"> <!-- <el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -542,14 +653,14 @@
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
<pagination <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryAddShopParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryAddShopParams.pageSize"
@pagination="getList" @pagination="getAddShopList"
/> />
</el-col> </el-col>
</el-row> </el-row>
@ -569,7 +680,7 @@
<script> <script>
import { systemAreaTreeApi } from "@/api/base/area"; import { systemAreaTreeApi } from "@/api/base/area";
import { drpWareHousePageApi,supermarketPageListApi,insertSupermarketApi,editSupermarketApi,deleteSupermarketApi,userListByRoleApi import { drpWareHousePageApi,supermarketPageListApi,insertSupermarketApi,editSupermarketApi,deleteSupermarketApi,userListByRoleApi
,shopPageListApi,shopProductPageListApi} from "@/api/superStore/super"; ,shopPageListApi,shopProductPageListApi,batchRemoveMaterialApi,delShopProductApi,getShopProductApi,eitdShopProductApi,onlienShopProductApi} from "@/api/superStore/super";
import { shopMaterialTreeApi} from "@/api/superStore/shopMaterial"; import { shopMaterialTreeApi} from "@/api/superStore/shopMaterial";
import { imgUpLoadTwo } from '@/api/system/upload' import { imgUpLoadTwo } from '@/api/system/upload'
export default { export default {
@ -627,8 +738,9 @@
queryShopParams: { queryShopParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
keyShopWord: undefined, materialName: undefined,
putawayState: undefined, putawayState: undefined,
barCode:undefined
}, },
wareHouseOptions:[], wareHouseOptions:[],
wareHouseOptions2:[], wareHouseOptions2:[],
@ -749,9 +861,26 @@
materialName:"", materialName:"",
barCode:"" barCode:""
}, },
batchIds:[],
openAddProduct:false, openAddProduct:false,
titleAddProduct:"", titleAddProduct:"",
tableAddShopListData:[], tableAddShopListData:[],
addBatchIds:[],
productFrom:{},
openProductEitd:false,
titleProductEitd:"",
productFrom:{
materialName:"",
unitName:"",
barCode:"",
salePrice:"",
prefPrice:"",
personLimit:"",
oneDayLimit:"",
inventoryNum:"",
putawayState:"1",
ifOnline:"2",
},
}; };
}, },
created() { created() {
@ -768,6 +897,12 @@
}, },
}, },
methods: { methods: {
handleNumberInput(value){
this.inputValue = value.replace(/[^\d.]/g, '');
},
handleNumberInput(value){
this.inputValue = value.replace(/[^\d.]/g, '');
},
// //
getTreeData() { getTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
@ -1083,15 +1218,20 @@
this.resetForm("queryShopForm"); this.resetForm("queryShopForm");
this.handleShopQuery(); this.handleShopQuery();
}, },
/** 商品列表 */ /** 商品列表 */
getShopList() { getShopList() {
this.loading = true; this.loading = true;
let param = { let param = {
"pageNum": this.queryShopParams.pageNum, "pageNum": this.queryShopParams.pageNum,
"pageSize": this.queryShopParams.pageSize, "pageSize": this.queryShopParams.pageSize,
"warehouseId": this.queryShopParams.warehouseId, "putawayState": this.queryShopParams.putawayState,
"areaId":this.queryShopParams.areaId "materialName":this.queryShopParams.materialName,
"barCode":this.queryShopParams.barCode,
} }
console.log("this.queryShopParams",param)
shopPageListApi(param).then(response => { shopPageListApi(param).then(response => {
this.tableShopListData = response.rows; this.tableShopListData = response.rows;
console.log("this.tableShopListData",this.tableShopListData); console.log("this.tableShopListData",this.tableShopListData);
@ -1099,21 +1239,134 @@
this.loading = false; this.loading = false;
}); });
}, },
handleShopUpdate(row){
this.openProductEitd=true;
this.titleProductEitd="商品编辑";
let param={
"productId":row.productId,
"supermarketId":this.selectSupermarketId
}
getShopProductApi(param).then(response => {
console.log("response.data",response.data)
this.productFrom=response.data;
this.productFrom.putawayStatef=this.productFrom.putawayState=="1"?true:false;
this.productFrom.ifOnlinef=this.productFrom.ifOnline=="2"?true:false;
});
},
cancelShopEitd(){
this.openProductEitd=false;
},
handlePutawayStateEitdChange(from){
let pws=from.putawayState;
if(pws=="1"){
this.productFrom.putawayState="2";
}else if(pws=="2"){
this.productFrom.putawayState="1";
}
},
handleIfOnlineEitdChange(from){
let pws=from.ifOnline;
if(pws=="1"){
this.productFrom.ifOnline="2";
}else if(pws=="2"){
this.productFrom.ifOnline="1";
}
},
handlePutawayStateChange(row){
let pws=row.putawayState;
let param={}
if(pws=="1"){
param={
productId:row.productId,
putawayState:"2"
}
}else if(pws=="2"){
param={
productId:row.productId,
putawayState:"1"
}
}
eitdShopProductApi(param).then(response => {
this.getShopList();
});
},
handleIfOnlineChange(row){
let pws=row.ifOnline;
let param={}
if(pws=="1"){
param={
productId:row.productId,
ifOnline:"2"
}
}else if(pws=="2"){
param={
productId:row.productId,
ifOnline:"1"
}
}
eitdShopProductApi(param).then(response => {
this.getShopList();
});
},
handlePutawayStateChanges(row){
},
handleIfOnlineChanges(row){
},
submitShopEitd(){
console.log("this.productFrom",this.productFrom)
eitdShopProductApi(this.productFrom).then(response => {
this.$modal.msgSuccess("修改 成功");
this.openProductEitd=false;
this.getShopList();
});
},
handleShopDelete(row){
let param={
"productIds":row.productId,
"supermarketId":this.selectSupermarketId
}
delShopProductApi(param).then(response => {
this.$modal.msgSuccess("删除成功");
this.getShopList();
});
},
handleSelectionChange(selection){ handleSelectionChange(selection){
this.batchIds = [] this.batchIds = []
this.batchIds = selection.map((item) => item.materialId) this.batchIds = selection.map((item) => item.productId)
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
// //
handleShopBatchDel(){ handleShopBatchDel(){
console.log(this.batchIds) console.log(this.batchIds)
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => { if(this.batchIds.length<=0){
this.$modal.msgSuccess("请选择数据!");
return;
}
delShopProductApi({"productIds":this.batchIds.join(",")}).then(response => {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
this.$refs.multipleTable.clearSelection() this.$refs.multipleTable.clearSelection()
this.getShopList(); this.getShopList();
}); });
}, },
handleShopBatchOnline(){
console.log(this.batchIds)
if(this.batchIds.length<=0){
this.$modal.msgSuccess("请选择数据!");
return;
}
onlienShopProductApi({"productIds":this.batchIds.join(",")}).then(response => {
this.$modal.msgSuccess("修改成功");
this.$refs.multipleTable.clearSelection()
this.getShopList();
});
},
/** 商品新增 */ /** 商品新增 */
handleShopAdd() { handleShopAdd() {
this.reset(); this.reset();
@ -1121,6 +1374,12 @@
this.titleAddProduct = "新增-超市商品"; this.titleAddProduct = "新增-超市商品";
this.getAddShopList(); this.getAddShopList();
}, },
handleAddSelectionChange(selection){
this.addBatchIds = []
this.addBatchIds = selection.map((item) => item.materialId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增商品列表 */ /** 新增商品列表 */
getAddShopList() { getAddShopList() {
this.loading = true; this.loading = true;
@ -1136,8 +1395,33 @@
this.loading = false; this.loading = false;
}); });
}, },
handleAddShopQuery(){
let param = {
"pageNum": this.queryAddShopParams.pageNum,
"pageSize": this.queryAddShopParams.pageSize,
"materialName":this.queryAddShopParams.materialName,
"barCode":this.queryAddShopParams.barCode,
}
shopProductPageListApi(param).then(response => {
this.tableAddShopListData = response.rows;
console.log("this.tableAddShopListData",this.tableAddShopListData);
this.total = Number(response.total);
this.loading = false;
});
},
cancelAddShopProduct(){
this.openAddProduct = false;
this.titleAddProduct = "新增-超市商品";
},
handleAddShopProduct(){
console.log("this.addBatchIds",this.addBatchIds)
batchRemoveMaterialApi({"materialIds":this.addBatchIds.join(","),"supermarketId":this.selectSupermarketId}).then(response => {
this.$modal.msgSuccess("添加成功");
this.$refs.multipleTable.clearSelection()
this.getAddShopList();
this.getShopList();
});
}
} }