商超接口修改
This commit is contained in:
parent
8b3f480836
commit
b5c6a43a58
|
|
@ -61,7 +61,7 @@ export function getMaterialListApi(data) {
|
||||||
// 新增商品
|
// 新增商品
|
||||||
export function addMaterialApi(data) {
|
export function addMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_product/add',
|
url: '/smart-canteen/supermarket_product',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -85,14 +85,14 @@ export function updateMaterialApi(data) {
|
||||||
// 删除商品
|
// 删除商品
|
||||||
export function removeMaterialApi(data) {
|
export function removeMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_product/del',
|
url: '/smart-canteen/supermarket_product/del/'+data.productId,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
}
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量删除商品
|
// 批量删除商品
|
||||||
export function batchRemoveMaterialApi(data) {
|
export function batchRemoveMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export function supermarketPageListApi(data) {
|
||||||
// 超市列表-新增
|
// 超市列表-新增
|
||||||
export function insertSupermarketApi(data) {
|
export function insertSupermarketApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_info/add',
|
url: '/smart-canteen/supermarket_info',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -50,12 +50,11 @@ export function editSupermarketApi(data) {
|
||||||
// 超市列表-删除
|
// 超市列表-删除
|
||||||
export function deleteSupermarketApi(data) {
|
export function deleteSupermarketApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_info/del',
|
url: '/smart-canteen/supermarket_info/del/'+data.supermarketId,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
}
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export function drpUnitPageListApi(data) {
|
||||||
// 单位列表-新增
|
// 单位列表-新增
|
||||||
export function addDrpUnitApi(data) {
|
export function addDrpUnitApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_unit/add',
|
url: '/smart-canteen/supermarket_unit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -49,14 +49,13 @@ export function editDrpUnitApi(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 单位列表-删除
|
// 单位列表-删除
|
||||||
export function removeDrpUnitApi(data) {
|
export function removeDrpUnitApi(unitId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/supermarket_unit/del',
|
url: '/smart-canteen/supermarket_unit/del/'+unitId,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
}
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ service.interceptors.request.use(config => {
|
||||||
// console.log(sessionObj)
|
// console.log(sessionObj)
|
||||||
// console.log(requestObj)
|
// console.log(requestObj)
|
||||||
if(requestObj.data&&requestObj.data.indexOf('pageNum')==-1){
|
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}]: 数据正在处理,请勿重复提交`)
|
console.warn(`[${sessionObj.url}]: 数据正在处理,请勿重复提交`)
|
||||||
return Promise.reject(new Error('数据正在处理,请勿重复提交'))
|
return Promise.reject(new Error('数据正在处理,请勿重复提交'))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -721,92 +721,7 @@
|
||||||
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</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>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
|
||||||
|
|
@ -1162,6 +1162,7 @@ export default {
|
||||||
}
|
}
|
||||||
getNutrition(data).then(response => {
|
getNutrition(data).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
this.formTable = [this.form]
|
||||||
this.$set(this.form,"categoryId",Number(response.data.categoryId))
|
this.$set(this.form,"categoryId",Number(response.data.categoryId))
|
||||||
this.chosenType(this.form.categoryId)
|
this.chosenType(this.form.categoryId)
|
||||||
this.open = true;
|
this.open = true;
|
||||||
|
|
@ -1257,6 +1258,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.form[field] = newValue;
|
this.form[field] = newValue;
|
||||||
|
this.formTable[0][field] = newValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1281,6 +1283,7 @@ export default {
|
||||||
}
|
}
|
||||||
// 格式化为两位小数
|
// 格式化为两位小数
|
||||||
this.form[field] = value.toFixed(2);
|
this.form[field] = value.toFixed(2);
|
||||||
|
this.formTable[0][field] = value.toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
|
@open="handelOpen"
|
||||||
>
|
>
|
||||||
<div style="width: 100%;height: 500px;overflow-y: auto;">
|
<div style="width: 100%;height: 500px;overflow-y: auto;">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
|
@ -160,14 +161,11 @@
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -190,7 +188,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loading:false,
|
||||||
treeAreaOptions:[],//区域树
|
treeAreaOptions:[],//区域树
|
||||||
treeTypeOptions:[],//类型树
|
treeTypeOptions:[],//类型树
|
||||||
unitOptions:[],//单位下拉
|
unitOptions:[],//单位下拉
|
||||||
|
|
@ -237,11 +236,18 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getAreaTreeData();//获取区域树
|
|
||||||
this.getTypeTreeData();//获取商品类别树
|
|
||||||
this.getDrpUnitList();//获取单位类型下拉
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handelOpen(){
|
||||||
|
this.getAreaTreeData();//获取区域树
|
||||||
|
this.getDrpUnitList();//获取单位类型下拉
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.$emit('update:visible', false);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.reset();
|
||||||
|
});
|
||||||
|
},
|
||||||
//区域树
|
//区域树
|
||||||
getAreaTreeData() {
|
getAreaTreeData() {
|
||||||
systemAreaTreeApi({}).then((response) => {
|
systemAreaTreeApi({}).then((response) => {
|
||||||
|
|
@ -278,7 +284,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.form.unitId=null
|
this.form.unitId=null
|
||||||
getDrpUnitListApi(param).then((response) => {
|
getDrpUnitListApi(param).then((response) => {
|
||||||
this.unitOptions = response.data;
|
this.unitOptions = response.rows;
|
||||||
// if(response.data.records.length>0){
|
// if(response.data.records.length>0){
|
||||||
// response.data.records.forEach(item => {
|
// response.data.records.forEach(item => {
|
||||||
// if(item.weighType==this.form.salesMode){
|
// if(item.weighType==this.form.salesMode){
|
||||||
|
|
@ -329,19 +335,20 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loading=true
|
||||||
this.form.salePrice = Number(this.form.salePrice)*100;
|
this.form.salePrice = Number(this.form.salePrice)*100;
|
||||||
this.form.prefPrice = Number(this.form.prefPrice)*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);
|
this.$emit('submit', this.form);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClose() {
|
|
||||||
this.$emit('update:visible', false);
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.reset();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$emit('update:visible', false);
|
this.$emit('update:visible', false);
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
</el-tab-pane> -->
|
</el-tab-pane> -->
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -302,6 +302,7 @@
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
|
loadingBtn: false,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
|
|
@ -570,21 +571,24 @@
|
||||||
console.log(this.baseForm)
|
console.log(this.baseForm)
|
||||||
this.$refs["baseForm"].validate(valid => {//基本设置表单校验
|
this.$refs["baseForm"].validate(valid => {//基本设置表单校验
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loadingBtn=true
|
||||||
this.baseForm.imgUrl = this.checkUrlList[0]
|
this.baseForm.imgUrl = this.checkUrlList[0]
|
||||||
let param = this.baseForm
|
let param = this.baseForm
|
||||||
// param.configList = this.configList;
|
// param.configList = this.configList;
|
||||||
if (param.supermarketId) {
|
if (param.supermarketId) {
|
||||||
editSupermarketApi(param).then(response => {
|
editSupermarketApi(param).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
this.loadingBtn = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
insertSupermarketApi(param).then(response => {
|
insertSupermarketApi(param).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.loadingBtn = false;
|
||||||
});
|
this.getList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue