修改
This commit is contained in:
parent
7ef4eb0392
commit
cbc01aa0c8
520
src/views/system/goodsInfo/goodsInfojs.js
Normal file
520
src/views/system/goodsInfo/goodsInfojs.js
Normal file
@ -0,0 +1,520 @@
|
||||
import {
|
||||
getGoodsInfo,
|
||||
delGoodsInfo,
|
||||
addGoodsInfo,
|
||||
updateGoodsInfo,
|
||||
updatePicture,
|
||||
goodsInfoList,
|
||||
goodsCategory,
|
||||
editGoodsWhetherShelf,
|
||||
} from "@/api/system/goodsInfo";
|
||||
import editor from "@/components/Editor";
|
||||
import { getListByUser } from "@/api/system/userlist.js";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl.js";
|
||||
|
||||
export default {
|
||||
components: { stationAcatar, editor },
|
||||
name: "OperateGoodsInfo",
|
||||
data() {
|
||||
return {
|
||||
imgone: "",
|
||||
|
||||
imageUrl: "", //商品图片
|
||||
value: "",
|
||||
datas: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
|
||||
// 商品基本信息表格数据
|
||||
goodsInfoList: [],
|
||||
// 护理站列表
|
||||
nurseStationlist: [],
|
||||
handstationlist: [], //页面搜索list
|
||||
// 查询商品分类列表
|
||||
goodsCategorylist: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// open2: false,
|
||||
innerVisible: false,
|
||||
// StationName: "请选择所属护理站",
|
||||
nursetotal: 0,
|
||||
nurseStationId: null,
|
||||
goods: [
|
||||
{
|
||||
value: "BUSINESS",
|
||||
label: "买卖",
|
||||
},
|
||||
{
|
||||
value: "LEASE",
|
||||
label: "租赁",
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
],
|
||||
// goodAttributeDetailsLists:[],
|
||||
goodDetailsLists: [],
|
||||
ids: 9999999,
|
||||
// 查询参数
|
||||
shangjia: {
|
||||
id: null,
|
||||
whetherShelf: null,
|
||||
},
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
queryParams: {
|
||||
id: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
// mame:null,
|
||||
},
|
||||
//权限查询
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
nurseStationName: "",
|
||||
nurseStationId: "",
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsName: [
|
||||
{ required: true, message: "请输入商品名称", trigger: "blur" },
|
||||
],
|
||||
goodsCategoryId: [
|
||||
{ required: true, message: "请选择商品分类名称", trigger: "blur" },
|
||||
],
|
||||
nurseStationId: [
|
||||
{ required: true, message: "请选择所属护理站", trigger: "blur" },
|
||||
],
|
||||
goodsPurpose: [
|
||||
{ required: true, message: "请选择商品用途", trigger: "blur" },
|
||||
],
|
||||
goodsUnit: [
|
||||
{ required: true, message: "请输入商品度量单位", trigger: "blur" },
|
||||
],
|
||||
goodsPictureUrl: [
|
||||
{ required: true, message: "请输入选择图片", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.info();
|
||||
this.infos();
|
||||
// this.getList2();
|
||||
},
|
||||
methods: {
|
||||
upwhetherShelf(row) {
|
||||
console.log(row);
|
||||
if (row.whetherShelf == false) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 0,
|
||||
};
|
||||
} else if (row.whetherShelf == true) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 1,
|
||||
};
|
||||
}
|
||||
editGoodsWhetherShelf(obj).then((res) => {
|
||||
console.log(obj);
|
||||
if (obj.whetherShelf == 0) {
|
||||
this.$modal.msgSuccess("已修改上架状态为未上架");
|
||||
} else {
|
||||
this.$modal.msgSuccess("已修改上架状态为上架");
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 查询商品基本信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
goodsInfoList(this.queryParams).then((response) => {
|
||||
response.rows.forEach((e) => {
|
||||
if (e.whetherShelf == 1) {
|
||||
e.whetherShelf = true;
|
||||
} else if (e.whetherShelf == 0) {
|
||||
e.whetherShelf = false;
|
||||
}
|
||||
});
|
||||
this.goodsInfoList = response.rows;
|
||||
console.log(this.goodsInfoList);
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 添加
|
||||
addgoodAttributeDetail() {
|
||||
console.log(this.goodDetailsLists);
|
||||
if (this.goodDetailsLists.length == 5) {
|
||||
this.$message.error("最多只能5条");
|
||||
} else {
|
||||
this.ids++;
|
||||
var obj = {
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: this.ids,
|
||||
};
|
||||
this.goodDetailsLists.push(obj);
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
delgoodAttributeDetail(item) {
|
||||
console.log(item);
|
||||
if (item.ids && !item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.ids != item.ids
|
||||
);
|
||||
}
|
||||
} else if (!item.ids && item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.attributeDetailsId != item.attributeDetailsId
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log(this.goodDetailsLists);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
console.log(this.form);
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.form.goodsPictureUrl);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributeName: "",
|
||||
goodAttributeDetailsLists: [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
// clickinnerVisible() {
|
||||
// this.innerVisible = true;
|
||||
// },
|
||||
// nurseclick(row) {
|
||||
// console.log(this.form);
|
||||
// console.log(row);
|
||||
// this.form.nurseStationId = row.id;
|
||||
// this.StationName = row.nurseStationName;
|
||||
// this.innerVisible = false;
|
||||
// },
|
||||
handleQuery2() {
|
||||
// this.getListByUserquery.pageNum = 1;
|
||||
this.getList2();
|
||||
},
|
||||
getList2() {
|
||||
getListByUser(this.getListByUserquery).then((res) => {
|
||||
this.total2 = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
});
|
||||
},
|
||||
resetQuery2() {
|
||||
this.resetForm("queryForm");
|
||||
(this.getListByUserquery = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}),
|
||||
this.handleQuery2();
|
||||
},
|
||||
addcancel() {
|
||||
// this.innerVisible = false;
|
||||
// this.innerVisiblexg = false;
|
||||
this.resetQuery2();
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
};
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
if (this.nurseStationlist[0]) {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.queryParams.goodsName = null;
|
||||
this.queryParams.goodsCategoryName = null;
|
||||
this.queryParams.goodsPurpose = null;
|
||||
this.queryParams.whetherShelf = null;
|
||||
// this.resetForm("queryForm");
|
||||
|
||||
|
||||
}
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
console.log(selection);
|
||||
this.ids = selection.map((item) => item.goodsInfoId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.nurseStationName = this.nurseStationlist[0].nurseStationName;
|
||||
this.form.nurseStationId = this.nurseStationlist[0].id;
|
||||
this.title = "商品基本信息";
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.open = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log(row);
|
||||
// this.reset();
|
||||
const id = row.goodsInfoId || this.ids;
|
||||
getGoodsInfo(id).then((response) => {
|
||||
console.log(response);
|
||||
this.form = response.data[0];
|
||||
this.form.nurseStationName = row.nurseStationName;
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data[0].goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改商品基本信息";
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form);
|
||||
console.log(this.goodDetailsLists);
|
||||
this.form.goodAttributeDetailsLists = [];
|
||||
this.form.goodDetailsLists = this.goodDetailsLists;
|
||||
console.log(this.form);
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.goodsInfoId != null) {
|
||||
this.form.id = this.form.goodsInfoId;
|
||||
updateGoodsInfo(this.form).then((response) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.imgone);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
// this.nurseStationId=this.form.nurseStationId
|
||||
addGoodsInfo(this.form).then((response) => {
|
||||
console.log(this.form);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
|
||||
// this.StationName = "请选择所属护理站";
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
console.log("row :>> ", row);
|
||||
this.$confirm("是否确认删除订单信息的数据项?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
obj.pictureUrlList.push(row.goodsPictureUrl);
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
|
||||
delGoodsInfo(row.goodsInfoId).then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.getList();
|
||||
// console.log('this.OrderDetailsList :>> ', this.OrderDetailsList);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
// handleDelete(row) {
|
||||
// const ids = row.id || this.ids;
|
||||
// this.$modal
|
||||
// .confirm("是否确认删除?")
|
||||
// .then(function () {
|
||||
// return delGoodsInfo(ids);
|
||||
// })
|
||||
// .then(() => {
|
||||
// this.getList();
|
||||
// this.$modal.msgSuccess("删除成功");
|
||||
// })
|
||||
// .catch(() => {});
|
||||
// },
|
||||
// /** 导出按钮操作 */
|
||||
// handleExport() {
|
||||
// this.download(
|
||||
// "system/goodsInfo/export",
|
||||
// {
|
||||
// ...this.queryParams,
|
||||
// },
|
||||
// `goodsInfo_${new Date().getTime()}.xlsx`
|
||||
// );
|
||||
// },
|
||||
imgUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
this.form.goodsPictureUrl = imgUrl;
|
||||
},
|
||||
attributePitureUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
// this.form.attributePitureUrl = imgUrl;
|
||||
},
|
||||
attributePitureitem(item) {
|
||||
let items = JSON.parse(item);
|
||||
if (items.ids && !items.id) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.ids == items.ids) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
} else if (!items.ids && items.attributeDetailsId) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.attributeDetailsId == items.attributeDetailsId) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//权限列表
|
||||
info() {
|
||||
goodsCategory().then((res) => {
|
||||
console.log(res);
|
||||
console.log(this.form);
|
||||
this.goodsCategorylist = res.rows;
|
||||
});
|
||||
getListByUser(this.getListByUserquery).then((res) => {
|
||||
console.log(res);
|
||||
this.total2 = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
this.queryParams.nurseStationId = res.rows[0].id;
|
||||
// this.handleQuery();
|
||||
this.getList()
|
||||
|
||||
});
|
||||
},
|
||||
infos() {
|
||||
var queryFor = {
|
||||
pageNum: 1,
|
||||
pageSize:9999,
|
||||
};
|
||||
getListByUser(queryFor).then((res) => {
|
||||
console.log(res)
|
||||
this.handstationlist = res.rows;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -464,534 +464,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getGoodsInfo,
|
||||
delGoodsInfo,
|
||||
addGoodsInfo,
|
||||
updateGoodsInfo,
|
||||
updatePicture,
|
||||
goodsInfoList,
|
||||
goodsCategory,
|
||||
editGoodsWhetherShelf,
|
||||
} from "@/api/system/goodsInfo";
|
||||
import editor from "@/components/Editor";
|
||||
import { getListByUser } from "@/api/system/userlist.js";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl.js";
|
||||
|
||||
export default {
|
||||
components: { stationAcatar, editor },
|
||||
name: "OperateGoodsInfo",
|
||||
data() {
|
||||
return {
|
||||
imgone: "",
|
||||
|
||||
imageUrl: "", //商品图片
|
||||
value: "",
|
||||
datas: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
|
||||
// 商品基本信息表格数据
|
||||
goodsInfoList: [],
|
||||
// 护理站列表
|
||||
nurseStationlist: [],
|
||||
handstationlist: [], //页面搜索list
|
||||
// 查询商品分类列表
|
||||
goodsCategorylist: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// open2: false,
|
||||
innerVisible: false,
|
||||
// StationName: "请选择所属护理站",
|
||||
nursetotal: 0,
|
||||
nurseStationId: null,
|
||||
goods: [
|
||||
{
|
||||
value: "BUSINESS",
|
||||
label: "买卖",
|
||||
},
|
||||
{
|
||||
value: "LEASE",
|
||||
label: "租赁",
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
],
|
||||
// goodAttributeDetailsLists:[],
|
||||
goodDetailsLists: [],
|
||||
ids: 9999999,
|
||||
// 查询参数
|
||||
shangjia: {
|
||||
id: null,
|
||||
whetherShelf: null,
|
||||
},
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
queryParams: {
|
||||
id: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
// mame:null,
|
||||
},
|
||||
//权限查询
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
nurseStationName: "",
|
||||
nurseStationId: "",
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsName: [
|
||||
{ required: true, message: "请输入商品名称", trigger: "blur" },
|
||||
],
|
||||
goodsCategoryId: [
|
||||
{ required: true, message: "请选择商品分类名称", trigger: "blur" },
|
||||
],
|
||||
nurseStationId: [
|
||||
{ required: true, message: "请选择所属护理站", trigger: "blur" },
|
||||
],
|
||||
goodsPurpose: [
|
||||
{ required: true, message: "请选择商品用途", trigger: "blur" },
|
||||
],
|
||||
goodsUnit: [
|
||||
{ required: true, message: "请输入商品度量单位", trigger: "blur" },
|
||||
],
|
||||
goodsPictureUrl: [
|
||||
{ required: true, message: "请输入选择图片", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.info();
|
||||
this.infos();
|
||||
// this.getList2();
|
||||
},
|
||||
methods: {
|
||||
upwhetherShelf(row) {
|
||||
console.log(row);
|
||||
if (row.whetherShelf == false) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 0,
|
||||
};
|
||||
} else if (row.whetherShelf == true) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 1,
|
||||
};
|
||||
}
|
||||
editGoodsWhetherShelf(obj).then((res) => {
|
||||
console.log(obj);
|
||||
if (obj.whetherShelf == 0) {
|
||||
this.$modal.msgSuccess("已修改上架状态为未上架");
|
||||
} else {
|
||||
this.$modal.msgSuccess("已修改上架状态为上架");
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 查询商品基本信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
goodsInfoList(this.queryParams).then((response) => {
|
||||
response.rows.forEach((e) => {
|
||||
if (e.whetherShelf == 1) {
|
||||
e.whetherShelf = true;
|
||||
} else if (e.whetherShelf == 0) {
|
||||
e.whetherShelf = false;
|
||||
}
|
||||
});
|
||||
this.goodsInfoList = response.rows;
|
||||
console.log(this.goodsInfoList);
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 添加
|
||||
addgoodAttributeDetail() {
|
||||
console.log(this.goodDetailsLists);
|
||||
if (this.goodDetailsLists.length == 5) {
|
||||
this.$message.error("最多只能5条");
|
||||
} else {
|
||||
this.ids++;
|
||||
var obj = {
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: this.ids,
|
||||
};
|
||||
this.goodDetailsLists.push(obj);
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
delgoodAttributeDetail(item) {
|
||||
console.log(item);
|
||||
if (item.ids && !item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.ids != item.ids
|
||||
);
|
||||
}
|
||||
} else if (!item.ids && item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.attributeDetailsId != item.attributeDetailsId
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log(this.goodDetailsLists);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
console.log(this.form);
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.form.goodsPictureUrl);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributeName: "",
|
||||
goodAttributeDetailsLists: [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
// clickinnerVisible() {
|
||||
// this.innerVisible = true;
|
||||
// },
|
||||
// nurseclick(row) {
|
||||
// console.log(this.form);
|
||||
// console.log(row);
|
||||
// this.form.nurseStationId = row.id;
|
||||
// this.StationName = row.nurseStationName;
|
||||
// this.innerVisible = false;
|
||||
// },
|
||||
handleQuery2() {
|
||||
// this.getListByUserquery.pageNum = 1;
|
||||
this.getList2();
|
||||
},
|
||||
getList2() {
|
||||
getListByUser(this.getListByUserquery).then((res) => {
|
||||
this.total2 = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
});
|
||||
},
|
||||
resetQuery2() {
|
||||
this.resetForm("queryForm");
|
||||
(this.getListByUserquery = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}),
|
||||
this.handleQuery2();
|
||||
},
|
||||
addcancel() {
|
||||
// this.innerVisible = false;
|
||||
// this.innerVisiblexg = false;
|
||||
this.resetQuery2();
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
};
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
if (this.nurseStationlist[0].isAdmin == "1") {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
} else {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.queryParams.goodsName = null;
|
||||
this.queryParams.goodsCategoryName = null;
|
||||
this.queryParams.goodsPurpose = null;
|
||||
this.queryParams.whetherShelf = null;
|
||||
}
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
console.log(selection);
|
||||
this.ids = selection.map((item) => item.goodsInfoId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.nurseStationName = this.nurseStationlist[0].nurseStationName;
|
||||
this.form.nurseStationId = this.nurseStationlist[0].id;
|
||||
this.title = "商品基本信息";
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.open = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log(row);
|
||||
// this.reset();
|
||||
const id = row.goodsInfoId || this.ids;
|
||||
getGoodsInfo(id).then((response) => {
|
||||
console.log(response);
|
||||
this.form = response.data[0];
|
||||
this.form.nurseStationName = row.nurseStationName;
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data[0].goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改商品基本信息";
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form);
|
||||
console.log(this.goodDetailsLists);
|
||||
this.form.goodAttributeDetailsLists = [];
|
||||
this.form.goodDetailsLists = this.goodDetailsLists;
|
||||
console.log(this.form);
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.goodsInfoId != null) {
|
||||
this.form.id = this.form.goodsInfoId;
|
||||
updateGoodsInfo(this.form).then((response) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.imgone);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
// this.nurseStationId=this.form.nurseStationId
|
||||
addGoodsInfo(this.form).then((response) => {
|
||||
console.log(this.form);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
|
||||
// this.StationName = "请选择所属护理站";
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
console.log("row :>> ", row);
|
||||
this.$confirm("是否确认删除订单信息的数据项?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
obj.pictureUrlList.push(row.goodsPictureUrl);
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
|
||||
delGoodsInfo(row.goodsInfoId).then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.getList();
|
||||
// console.log('this.OrderDetailsList :>> ', this.OrderDetailsList);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
// handleDelete(row) {
|
||||
// const ids = row.id || this.ids;
|
||||
// this.$modal
|
||||
// .confirm("是否确认删除?")
|
||||
// .then(function () {
|
||||
// return delGoodsInfo(ids);
|
||||
// })
|
||||
// .then(() => {
|
||||
// this.getList();
|
||||
// this.$modal.msgSuccess("删除成功");
|
||||
// })
|
||||
// .catch(() => {});
|
||||
// },
|
||||
// /** 导出按钮操作 */
|
||||
// handleExport() {
|
||||
// this.download(
|
||||
// "system/goodsInfo/export",
|
||||
// {
|
||||
// ...this.queryParams,
|
||||
// },
|
||||
// `goodsInfo_${new Date().getTime()}.xlsx`
|
||||
// );
|
||||
// },
|
||||
imgUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
this.form.goodsPictureUrl = imgUrl;
|
||||
},
|
||||
attributePitureUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
// this.form.attributePitureUrl = imgUrl;
|
||||
},
|
||||
attributePitureitem(item) {
|
||||
let items = JSON.parse(item);
|
||||
if (items.ids && !items.id) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.ids == items.ids) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
} else if (!items.ids && items.attributeDetailsId) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.attributeDetailsId == items.attributeDetailsId) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//权限列表
|
||||
info() {
|
||||
goodsCategory().then((res) => {
|
||||
console.log(res);
|
||||
|
||||
console.log(this.form);
|
||||
this.goodsCategorylist = res.rows;
|
||||
});
|
||||
getListByUser(this.getListByUserquery).then((res) => {
|
||||
console.log(res);
|
||||
if (res.rows[0].isAdmin == "1") {
|
||||
this.nurseStationlist = res.rows;
|
||||
// console.log(this.queryParams)
|
||||
this.total2 = res.total;
|
||||
} else {
|
||||
this.total2 = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
this.queryParams.nurseStationId = res.rows[0].id;
|
||||
this.handleQuery();
|
||||
}
|
||||
});
|
||||
},
|
||||
infos() {
|
||||
var queryFor = {
|
||||
pageNum: 1,
|
||||
pageSize:9999,
|
||||
};
|
||||
getListByUser(queryFor).then((res) => {
|
||||
console.log(res)
|
||||
this.handstationlist = res.rows;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
import goodsInfojs from './goodsInfojs'
|
||||
export default goodsInfojs
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="订单状态" prop="orderStatus">
|
||||
<el-select
|
||||
v-model="queryParams.orderStatus"
|
||||
@ -57,7 +56,11 @@
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
<el-button type="success" icon="el-icon-refresh-right" size="mini" @click="resetQuery"
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-refresh-right"
|
||||
size="mini"
|
||||
@click="resetQuery"
|
||||
>刷新</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
@ -80,12 +83,7 @@
|
||||
prop="orderNo"
|
||||
width="190"
|
||||
/>
|
||||
<el-table-column
|
||||
label="商品名称"
|
||||
align="center"
|
||||
prop="goodsName"
|
||||
|
||||
/>
|
||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
||||
|
||||
<el-table-column label="订单总金额" align="center" prop="totalPrice" />
|
||||
<el-table-column label="订单状态" align="center" prop="orderStatus">
|
||||
@ -147,7 +145,10 @@
|
||||
<el-table-column label="录入物流单号" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.orderStatus == 'WAIT_RECEIVED_GOODS'&&scope.row.expressNo"
|
||||
v-if="
|
||||
scope.row.orderStatus == 'WAIT_RECEIVED_GOODS' &&
|
||||
scope.row.expressNo
|
||||
"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@ -156,7 +157,10 @@
|
||||
>修改物流单号</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.orderStatus == 'WAIT_RECEIVED_GOODS'&&scope.row.expressNo==''"
|
||||
v-if="
|
||||
scope.row.orderStatus == 'WAIT_RECEIVED_GOODS' &&
|
||||
scope.row.expressNo == ''
|
||||
"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@ -165,7 +169,10 @@
|
||||
>录入物流单号</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.orderStatus == 'WAIT_RECEIVED_GOODS'&&scope.row.expressNo==null"
|
||||
v-if="
|
||||
scope.row.orderStatus == 'WAIT_RECEIVED_GOODS' &&
|
||||
scope.row.expressNo == null
|
||||
"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@ -294,7 +301,6 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<!-- <el-form-item label="商品属性" prop="goodsAttributeName">
|
||||
<el-input
|
||||
v-model="orderList.goodsAttributeName"
|
||||
@ -524,7 +530,6 @@
|
||||
:rows="5"
|
||||
disabled
|
||||
/>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item> </el-form-item>
|
||||
</el-form>
|
||||
@ -884,7 +889,7 @@ export default {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
nurseStationId: null,
|
||||
// nurseStationId: null,
|
||||
patientId: null,
|
||||
orderNo: null,
|
||||
orderStatus: null,
|
||||
@ -896,8 +901,10 @@ export default {
|
||||
orderChannel: null,
|
||||
};
|
||||
this.form = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: null,
|
||||
nurseStationId: null,
|
||||
// nurseStationId: null,
|
||||
patientId: null,
|
||||
orderNo: null,
|
||||
totalPrice: null,
|
||||
@ -923,19 +930,23 @@ export default {
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
if (this.nurseStationlist[0].isAdmin == '1') {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
}
|
||||
} else {
|
||||
console.log(this.nurseStationlist)
|
||||
console.log(this.nurseStationlist)
|
||||
if (this.nurseStationlist[0]){
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.orderNo = null
|
||||
this.queryParams.orderStatus = null
|
||||
|
||||
this.queryParams.pageSize = 10;
|
||||
this.queryParams.orderNo = null;
|
||||
this.queryParams.orderStatus = null;
|
||||
}
|
||||
|
||||
// this.queryParams = {
|
||||
// pageNum: 1,
|
||||
// pageSize: 10,
|
||||
// orderNo: null,
|
||||
// orderStatus: null,
|
||||
|
||||
// }
|
||||
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
@ -1000,27 +1011,19 @@ export default {
|
||||
this.download(
|
||||
"system/goodsOrder/export",
|
||||
{
|
||||
...this.queryParams,
|
||||
...this.getListByUserquery,
|
||||
},
|
||||
`goodsOrder_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
},
|
||||
//权限列表
|
||||
info() {
|
||||
// goodsCategory().then((res) => {
|
||||
// console.log(this.form);
|
||||
// this.goodsCategorylist = res.rows;
|
||||
// });
|
||||
getListByUser(this.getListByUserquery).then((res) => {
|
||||
if (res.rows[0].isAdmin == "1") {
|
||||
this.nurseStationlist = res.rows;
|
||||
this.total2 = res.total;
|
||||
} else {
|
||||
this.total2 = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
this.queryParams.nurseStationId = res.rows[0].id;
|
||||
this.handleQuery();
|
||||
}
|
||||
this.getList()
|
||||
// this.handleQuery();
|
||||
});
|
||||
},
|
||||
infos() {
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="会员名称" prop="patientName">
|
||||
<el-input
|
||||
@ -774,33 +775,32 @@ export default {
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
if (this.nurseStationlist[0].isAdmin == "1") {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
} else {
|
||||
if (this.nurseStationlist[0]){
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.queryParams.orderNo = null
|
||||
this.queryParams.orderStatus = null
|
||||
this.queryParams.patientName=null
|
||||
this.queryParams.patientName = null;
|
||||
this.queryParams.orderNo = null;
|
||||
this.queryParams.orderStatus = null;
|
||||
}
|
||||
// this.queryParams = {
|
||||
// pageNum: 1,
|
||||
// pageSize: 10,
|
||||
// // nurseStationId:null,
|
||||
// patientName:null,
|
||||
// orderNo:null,
|
||||
// orderStatus:null,
|
||||
// };
|
||||
this.handleQuery();
|
||||
},
|
||||
//权限列表
|
||||
info() {
|
||||
getListByUser(this.queryParams).then((res) => {
|
||||
if (res.rows[0].isAdmin == "1") {
|
||||
this.nurseStationlist = res.rows;
|
||||
this.total = res.total;
|
||||
} else {
|
||||
this.total = res.total;
|
||||
this.nurseStationlist = res.rows;
|
||||
this.queryParams.nurseStationId = res.rows[0].id;
|
||||
this.handleQuery();
|
||||
}
|
||||
this.getList()
|
||||
// this.handleQuery();
|
||||
|
||||
});
|
||||
},
|
||||
infos() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user