商超接口修改
This commit is contained in:
parent
8b3f480836
commit
b5c6a43a58
|
|
@ -61,7 +61,7 @@ export function getMaterialListApi(data) {
|
|||
// 新增商品
|
||||
export function addMaterialApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_product/add',
|
||||
url: '/smart-canteen/supermarket_product',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -85,14 +85,14 @@ export function updateMaterialApi(data) {
|
|||
// 删除商品
|
||||
export function removeMaterialApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_product/del',
|
||||
url: '/smart-canteen/supermarket_product/del/'+data.productId,
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 批量删除商品
|
||||
export function batchRemoveMaterialApi(data) {
|
||||
return request({
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function supermarketPageListApi(data) {
|
|||
// 超市列表-新增
|
||||
export function insertSupermarketApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_info/add',
|
||||
url: '/smart-canteen/supermarket_info',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -50,12 +50,11 @@ export function editSupermarketApi(data) {
|
|||
// 超市列表-删除
|
||||
export function deleteSupermarketApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_info/del',
|
||||
url: '/smart-canteen/supermarket_info/del/'+data.supermarketId,
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function drpUnitPageListApi(data) {
|
|||
// 单位列表-新增
|
||||
export function addDrpUnitApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_unit/add',
|
||||
url: '/smart-canteen/supermarket_unit',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -49,14 +49,13 @@ export function editDrpUnitApi(data) {
|
|||
}
|
||||
|
||||
// 单位列表-删除
|
||||
export function removeDrpUnitApi(data) {
|
||||
export function removeDrpUnitApi(unitId) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_unit/del',
|
||||
url: '/smart-canteen/supermarket_unit/del/'+unitId,
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ service.interceptors.request.use(config => {
|
|||
// console.log(sessionObj)
|
||||
// console.log(requestObj)
|
||||
if(requestObj.data&&requestObj.data.indexOf('pageNum')==-1){
|
||||
if (sessionObj.data === requestObj.data && requestObj.time - sessionObj.time < 3000 && sessionObj.url === requestObj.url) {
|
||||
if (sessionObj.data === requestObj.data && requestObj.time - sessionObj.time < 2000 && sessionObj.url === requestObj.url) {
|
||||
console.warn(`[${sessionObj.url}]: 数据正在处理,请勿重复提交`)
|
||||
return Promise.reject(new Error('数据正在处理,请勿重复提交'))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -722,91 +722,6 @@
|
|||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <el-descriptions v-if="baseForm.sizeType==1" title="" :column="2" size="small" border :labelStyle="{width:'150px'}">
|
||||
<el-descriptions-item>
|
||||
<template slot="label">热量(千卡)</template>
|
||||
{{baseForm.calories||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">蛋白质(g)</template>
|
||||
{{baseForm.protein||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">脂肪(g)</template>
|
||||
{{baseForm.fat||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碳水化合物(g)</template>
|
||||
{{baseForm.carbohydrate||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">膳食纤维(g)</template>
|
||||
{{baseForm.dietaryFiber||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">胆固醇(mg)</template>
|
||||
{{baseForm.cholesterol||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钙(mg)</template>
|
||||
{{baseForm.calcium||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钠(mg)</template>
|
||||
{{baseForm.sodium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">总嘌呤含量(mg)</template>
|
||||
{{baseForm.purine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">铁(mg)</template>
|
||||
{{baseForm.iron||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碘(μg)</template>
|
||||
{{baseForm.iodine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钾(mg)</template>
|
||||
{{baseForm.kalium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素a(μg)</template>
|
||||
{{baseForm.vitaminA||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素c(mg)</template>
|
||||
{{baseForm.vitaminC||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素e(mg)</template>
|
||||
{{baseForm.vitaminE||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">镁(mg)</template>
|
||||
{{baseForm.magnesium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">锌(mg)</template>
|
||||
{{baseForm.zinc||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">血糖生成指数(GI)</template>
|
||||
{{baseForm.glycemicIndex||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
</el-descriptions> -->
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
|
|
|||
|
|
@ -1162,6 +1162,7 @@ export default {
|
|||
}
|
||||
getNutrition(data).then(response => {
|
||||
this.form = response.data;
|
||||
this.formTable = [this.form]
|
||||
this.$set(this.form,"categoryId",Number(response.data.categoryId))
|
||||
this.chosenType(this.form.categoryId)
|
||||
this.open = true;
|
||||
|
|
@ -1257,6 +1258,7 @@ export default {
|
|||
}
|
||||
}
|
||||
this.form[field] = newValue;
|
||||
this.formTable[0][field] = newValue;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -1281,6 +1283,7 @@ export default {
|
|||
}
|
||||
// 格式化为两位小数
|
||||
this.form[field] = value.toFixed(2);
|
||||
this.formTable[0][field] = value.toFixed(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
:close-on-click-modal="false"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose"
|
||||
@open="handelOpen"
|
||||
>
|
||||
<div style="width: 100%;height: 500px;overflow-y: auto;">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
|
|
@ -161,13 +162,10 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled="loading">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
|
@ -191,6 +189,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
treeAreaOptions:[],//区域树
|
||||
treeTypeOptions:[],//类型树
|
||||
unitOptions:[],//单位下拉
|
||||
|
|
@ -237,11 +236,18 @@ export default {
|
|||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getAreaTreeData();//获取区域树
|
||||
this.getTypeTreeData();//获取商品类别树
|
||||
this.getDrpUnitList();//获取单位类型下拉
|
||||
},
|
||||
methods: {
|
||||
handelOpen(){
|
||||
this.getAreaTreeData();//获取区域树
|
||||
this.getDrpUnitList();//获取单位类型下拉
|
||||
},
|
||||
handleClose() {
|
||||
this.$emit('update:visible', false);
|
||||
this.$nextTick(() => {
|
||||
this.reset();
|
||||
});
|
||||
},
|
||||
//区域树
|
||||
getAreaTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
|
|
@ -278,7 +284,7 @@ export default {
|
|||
}
|
||||
this.form.unitId=null
|
||||
getDrpUnitListApi(param).then((response) => {
|
||||
this.unitOptions = response.data;
|
||||
this.unitOptions = response.rows;
|
||||
// if(response.data.records.length>0){
|
||||
// response.data.records.forEach(item => {
|
||||
// if(item.weighType==this.form.salesMode){
|
||||
|
|
@ -329,19 +335,20 @@ export default {
|
|||
submitForm() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading=true
|
||||
this.form.salePrice = Number(this.form.salePrice)*100;
|
||||
this.form.prefPrice = Number(this.form.prefPrice)*100;
|
||||
setTimeout(()=>{
|
||||
this.$set(this.form,"salePrice",Number((this.form.salePrice/100).toFixed(2)))
|
||||
this.$set(this.form,"prefPrice",Number((this.form.prefPrice/100).toFixed(2)))
|
||||
this.loading=false
|
||||
},2000)
|
||||
this.$emit('submit', this.form);
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.$emit('update:visible', false);
|
||||
this.$nextTick(() => {
|
||||
this.reset();
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.$emit('update:visible', false);
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<material-dialog :visible.sync="dialogVisible" :title="title" @submit="handleDialogSubmit" ref="materialDialog" />
|
||||
<material-dialog :visible.sync="dialogVisible" :title="title" :treeOptions="treeOptions" :treeAreaOptions="treeAreaOptions" @submit="handleDialogSubmit" ref="materialDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@
|
|||
</el-tab-pane> -->
|
||||
</el-tabs>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled="loadingBtn">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
|
@ -302,6 +302,7 @@
|
|||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
loadingBtn: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
|
|
@ -570,6 +571,7 @@
|
|||
console.log(this.baseForm)
|
||||
this.$refs["baseForm"].validate(valid => {//基本设置表单校验
|
||||
if (valid) {
|
||||
this.loadingBtn=true
|
||||
this.baseForm.imgUrl = this.checkUrlList[0]
|
||||
let param = this.baseForm
|
||||
// param.configList = this.configList;
|
||||
|
|
@ -577,12 +579,14 @@
|
|||
editSupermarketApi(param).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.loadingBtn = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
insertSupermarketApi(param).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.loadingBtn = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue