qauMaWeb/node_modules/.cache/babel-loader/15cacf29be21425ab991e2879b7...

1 line
19 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"core-js/modules/es.array.splice.js\";\nimport \"core-js/modules/es.array.slice.js\";\nimport \"core-js/modules/es.function.name.js\";\nimport \"core-js/modules/es.string.trim.js\";\nimport \"core-js/modules/es.symbol.js\";\nimport \"core-js/modules/es.symbol.description.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport API from \"@/utils/request\";\nvar url = \"/api/good\";\nexport default {\n name: \"GoodInfo\",\n data: function data() {\n return {\n baseApi: this.$store.state.baseApi,\n good: {\n discount: \"1\"\n },\n standards: [],\n index: 0,\n standard: {},\n fileList: [],\n dialogFormVisible: false,\n categoryItems: [],\n checkedCategory: {}\n };\n },\n created: function created() {\n var _this = this;\n\n this.request.get(\"/api/category\").then(function (res) {\n if (res.code === \"200\") {\n _this.categoryItems = res.data;\n }\n\n if (_this.$route.query.good) {\n _this.good = JSON.parse(_this.$route.query.good);\n _this.fileList = [{\n name: \"原始图片\",\n url: _this.good.imgs\n }];\n _this.checkedCategory = _this.categoryItems[_this.good.categoryId]; //从服务器获取商品规格信息\n\n _this.request.get(url + \"/standard/\" + _this.good.id).then(function (res) {\n if (res.code === \"200\") {\n var standards = JSON.parse(res.data);\n _this.standards = standards;\n } else {//没有规格\n }\n });\n }\n });\n },\n methods: {\n /*\r\n 规格操作\r\n */\n editStandard: function editStandard(index) {\n this.standard = this.standards[index];\n this.index = index;\n this.dialogFormVisible = true;\n },\n addStandard: function addStandard() {\n this.standard = {};\n this.index = this.standards.length;\n this.dialogFormVisible = true;\n },\n saveStandard: function saveStandard() {\n if (this.standard.value == undefined || this.standard.value == \"\") {\n this.$message({\n type: \"error\",\n message: \"请输入规格名称\",\n showClose: true\n });\n return;\n }\n\n if (this.standard.price == undefined || this.standard.price == \"\") {\n this.$message({\n type: \"error\",\n message: \"请输入价格\",\n showClose: true\n });\n return;\n }\n\n if (this.standard.store == undefined || this.standard.store == \"\") {\n this.$message({\n type: \"error\",\n message: \"请输入库存\",\n showClose: true\n });\n return;\n }\n\n this.standards[this.index] = this.standard;\n this.dialogFormVisible = false;\n },\n handleClose: function handleClose(standard) {\n this.standards.splice(this.standards.indexOf(standard), 1);\n },\n\n /*\r\n 文件上传操作\r\n */\n handleImgSuccess: function handleImgSuccess(res) {\n this.good.imgs = res.data;\n this.save();\n },\n handleChange: function handleChange(file, fileList) {\n this.fileList = fileList.slice(-3);\n },\n handleRemove: function handleRemove() {\n this.fileList.pop();\n },\n\n /*\r\n 保存数据操作\r\n */\n //点击提交按钮\n submit: function submit() {\n if (this.good.name == undefined || this.good.name.trim() == \"\") {\n this.$message({\n type: \"error\",\n message: \"请输入商品名称\",\n showClose: true\n });\n return false;\n