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:
commit
1e68aaf87e
|
|
@ -91,9 +91,61 @@ export function shopProductPageListApi(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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@
|
|||
:disabled="multiple"
|
||||
@click="handleShopBatchDel"
|
||||
>批量删除</el-button>
|
||||
<el-button type="primary" size="mini" :disabled="multiple" @click="handleShopBatchOnline">批量线上销售</el-button>
|
||||
</el-col>
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
|
||||
</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="putawayState" prop="putawayState" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
|
||||
<span>{{ scope.row.putawayState=="1" ? '上架' : '下架' }}</span>
|
||||
<el-switch
|
||||
v-model="scope.row.putawayState"
|
||||
v-model="scope.row.putawayState=='1'?true:false"
|
||||
@change="handlePutawayStateChange(scope.row)">
|
||||
</el-switch>
|
||||
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
|
||||
<span>{{ scope.row.putawayState=="1" ? '上架' : '下架' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线上销售" align="center" key="ifOnline" prop="ifOnline" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
|
||||
<span>{{ scope.row.ifOnline=="2" ? '否' : '是' }}</span>
|
||||
<el-switch
|
||||
v-model="scope.row.ifOnline"
|
||||
v-model="scope.row.ifOnline=='1'?true:false"
|
||||
@change="handleIfOnlineChange(scope.row)">
|
||||
</el-switch>
|
||||
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
|
||||
<span>{{ scope.row.ifOnline=="2" ? '否' : '是' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零售价" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
|
||||
|
|
@ -455,6 +456,116 @@
|
|||
</el-row>
|
||||
</div>
|
||||
</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>
|
||||
<div class="app-container" id="toolsType">
|
||||
<el-row>
|
||||
|
|
@ -485,14 +596,14 @@
|
|||
/>
|
||||
</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>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<!--数据-->
|
||||
<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 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" />
|
||||
|
|
@ -503,7 +614,7 @@
|
|||
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
|
||||
<el-switch
|
||||
v-model="scope.row.putawayState"
|
||||
@change="handlePutawayStateChange(scope.row)">
|
||||
@change="handlePutawayStateChanges(scope.row)">
|
||||
</el-switch>
|
||||
<span>{{ scope.row.putawayState==1 ? '上架' : '下架' }}</span>
|
||||
</template>
|
||||
|
|
@ -513,7 +624,7 @@
|
|||
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
|
||||
<el-switch
|
||||
v-model="scope.row.ifOnline"
|
||||
@change="handleIfOnlineChange(scope.row)">
|
||||
@change="handleIfOnlineChanges(scope.row)">
|
||||
</el-switch>
|
||||
<span>{{ scope.row.ifOnline==2 ? '否' : '是' }}</span>
|
||||
</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="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" width="100" fixed="right">
|
||||
<!-- <el-table-column label="操作" align="center" width="100" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
|
@ -542,14 +653,14 @@
|
|||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
:page.sync="queryAddShopParams.pageNum"
|
||||
:limit.sync="queryAddShopParams.pageSize"
|
||||
@pagination="getAddShopList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -569,7 +680,7 @@
|
|||
<script>
|
||||
import { systemAreaTreeApi } from "@/api/base/area";
|
||||
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 { imgUpLoadTwo } from '@/api/system/upload'
|
||||
export default {
|
||||
|
|
@ -627,8 +738,9 @@
|
|||
queryShopParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyShopWord: undefined,
|
||||
materialName: undefined,
|
||||
putawayState: undefined,
|
||||
barCode:undefined
|
||||
},
|
||||
wareHouseOptions:[],
|
||||
wareHouseOptions2:[],
|
||||
|
|
@ -749,9 +861,26 @@
|
|||
materialName:"",
|
||||
barCode:""
|
||||
},
|
||||
batchIds:[],
|
||||
openAddProduct:false,
|
||||
titleAddProduct:"",
|
||||
tableAddShopListData:[],
|
||||
addBatchIds:[],
|
||||
productFrom:{},
|
||||
openProductEitd:false,
|
||||
titleProductEitd:"",
|
||||
productFrom:{
|
||||
materialName:"",
|
||||
unitName:"",
|
||||
barCode:"",
|
||||
salePrice:"",
|
||||
prefPrice:"",
|
||||
personLimit:"",
|
||||
oneDayLimit:"",
|
||||
inventoryNum:"",
|
||||
putawayState:"1",
|
||||
ifOnline:"2",
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
|
@ -768,6 +897,12 @@
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
handleNumberInput(value){
|
||||
this.inputValue = value.replace(/[^\d.]/g, '');
|
||||
},
|
||||
handleNumberInput(value){
|
||||
this.inputValue = value.replace(/[^\d.]/g, '');
|
||||
},
|
||||
//区域树
|
||||
getTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
|
|
@ -1083,15 +1218,20 @@
|
|||
this.resetForm("queryShopForm");
|
||||
this.handleShopQuery();
|
||||
},
|
||||
|
||||
|
||||
|
||||
/** 商品列表 */
|
||||
getShopList() {
|
||||
this.loading = true;
|
||||
let param = {
|
||||
"pageNum": this.queryShopParams.pageNum,
|
||||
"pageSize": this.queryShopParams.pageSize,
|
||||
"warehouseId": this.queryShopParams.warehouseId,
|
||||
"areaId":this.queryShopParams.areaId
|
||||
"putawayState": this.queryShopParams.putawayState,
|
||||
"materialName":this.queryShopParams.materialName,
|
||||
"barCode":this.queryShopParams.barCode,
|
||||
}
|
||||
console.log("this.queryShopParams",param)
|
||||
shopPageListApi(param).then(response => {
|
||||
this.tableShopListData = response.rows;
|
||||
console.log("this.tableShopListData",this.tableShopListData);
|
||||
|
|
@ -1099,21 +1239,134 @@
|
|||
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){
|
||||
this.batchIds = []
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.batchIds = selection.map((item) => item.productId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 商品批量删除
|
||||
handleShopBatchDel(){
|
||||
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.$refs.multipleTable.clearSelection()
|
||||
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() {
|
||||
this.reset();
|
||||
|
|
@ -1121,6 +1374,12 @@
|
|||
this.titleAddProduct = "新增-超市商品";
|
||||
this.getAddShopList();
|
||||
},
|
||||
handleAddSelectionChange(selection){
|
||||
this.addBatchIds = []
|
||||
this.addBatchIds = selection.map((item) => item.materialId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增商品列表 */
|
||||
getAddShopList() {
|
||||
this.loading = true;
|
||||
|
|
@ -1136,8 +1395,33 @@
|
|||
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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue