From e16665cff0b8a2fc3c47f013bf61572548f559e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Tue, 13 Aug 2024 18:03:15 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/mer_admin.js | 149 ++++++++------ src/views/modules/product/index.vue | 187 +++++++++++++++++- .../modules/product/popup/add-or-update.vue | 10 +- src/views/modules/product/popup/add-price.vue | 185 +++++++++++++++++ 4 files changed, 460 insertions(+), 71 deletions(-) create mode 100644 src/views/modules/product/popup/add-price.vue diff --git a/src/api/modules/mer_admin.js b/src/api/modules/mer_admin.js index 33168cd..82ae6d2 100644 --- a/src/api/modules/mer_admin.js +++ b/src/api/modules/mer_admin.js @@ -1,67 +1,86 @@ -import $http from '@/utils/httpRequest.js' -import city_data from '@/utils/country-level2-data.js' +import $http from "@/utils/httpRequest.js"; +import city_data from "@/utils/country-level2-data.js"; export const mer_admin = { - /** - * 登录 - * @param {object} params LoginParam - * @param {number} params.type - * @param {string} params.role - * @param {string} params.username - * @param {string} params.password - * @param {string} params.mobile - * @param {string} params.code - * @returns - */ - loginByAccount: (params) => { - return $http.post(`/auth/login`, { - ...params, - type: 1 - }) - }, - loginByMobile: (params) => { - return $http.post(`/merchant-api/auth/sms/login`, { - ...params, - type: 2 - }) - }, - getYZM(mobile) { - return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`); - }, - getInfo() { - return $http.get(`/merchant-api/auth/info`); - }, - //商品管理 - //保存商品信息 - saveProduct: (data) => { - return $http.post(`/merchant-api/product/save`, data); - }, - //保存商品基本信息 - saveProductBase: (data) => { - return $http.post(`/merchant-api/product/save/basic`, data); - }, - //返回商品分类以及列表(聚合) - getPolyProduct: (data) => { - return $http.post(`/merchant-api/product/polymerization/list`, data); - }, - //商品分页 - getProductPage: (data) => { - return $http.post(`/merchant-api/product/page`, data); - }, - //商户商品分类 - getProductCategory: () => { - return $http.get(`/merchant-api/product/category/list?shopId=${JSON.parse(sessionStorage.getItem('userInfo')).shopId}`); - }, - //获取销售单位 - getSaleUnit: (data) => { - return $http.request({ url: `/merchant-api/product/unit/list`, method: 'get', params: data }); - }, - //文件上传 - uploadFile:()=>{ - return `${window.SITE_CONFIG['baseUrl']}/merchant-api/file/upload` - }, - //直接获取城市数据 - getCityOptions:()=>{ - return city_data; - } -} \ No newline at end of file + /** + * 登录 + * @param {object} params LoginParam + * @param {number} params.type + * @param {string} params.role + * @param {string} params.username + * @param {string} params.password + * @param {string} params.mobile + * @param {string} params.code + * @returns + */ + loginByAccount: (params) => { + return $http.post(`/auth/login`, { + ...params, + type: 1, + }); + }, + loginByMobile: (params) => { + return $http.post(`/merchant-api/auth/sms/login`, { + ...params, + type: 2, + }); + }, + getYZM(mobile) { + return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`); + }, + getInfo() { + return $http.get(`/merchant-api/auth/info`); + }, + //商品管理 + //保存商品信息 + saveProduct: (data) => { + return $http.post(`/merchant-api/product/save`, data); + }, + //保存商品基本信息 + saveProductBase: (data) => { + return $http.post(`/merchant-api/product/save/basic`, data); + }, + //返回商品分类以及列表(聚合) + getPolyProduct: (data) => { + return $http.post(`/merchant-api/product/polymerization/list`, data); + }, + //商品分页 + getProductPage: (data) => { + return $http.post( + `/merchant-api/product/page?pageNumber=${data.p.pageNumber}&pageSize=${data.p.pageSize}`, + data + ); + }, + //商户商品分类 + getProductCategory: () => { + return $http.get( + `/merchant-api/product/category/list?shopId=${ + JSON.parse(sessionStorage.getItem("userInfo")).shopId + }` + ); + }, + //批量删除商品 + BatchDeleteProducts: (data) => { + return $http.post(`/merchant-api/product/batch/delete`, data); + }, + //上架或下架商品 + putOnShelvesProducts: (data) => { + return $http.post(`/merchant-api/product/batch/update/status`, data); + }, + //获取销售单位 + getSaleUnit: (data) => { + return $http.request({ + url: `/merchant-api/product/unit/list`, + method: "get", + params: data, + }); + }, + //文件上传 + uploadFile: () => { + return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`; + }, + //直接获取城市数据 + getCityOptions: () => { + return city_data; + }, +}; diff --git a/src/views/modules/product/index.vue b/src/views/modules/product/index.vue index 306fa01..8704e8c 100644 --- a/src/views/modules/product/index.vue +++ b/src/views/modules/product/index.vue @@ -1,10 +1,13 @@ diff --git a/src/views/modules/product/popup/add-or-update.vue b/src/views/modules/product/popup/add-or-update.vue index 236b45d..8e55662 100644 --- a/src/views/modules/product/popup/add-or-update.vue +++ b/src/views/modules/product/popup/add-or-update.vue @@ -10,7 +10,7 @@ :modalHandles="modalHandles" > + \ No newline at end of file diff --git a/src/views/modules/product/popup/add-stock.vue b/src/views/modules/product/popup/add-stock.vue new file mode 100644 index 0000000..e88c7ae --- /dev/null +++ b/src/views/modules/product/popup/add-stock.vue @@ -0,0 +1,185 @@ + + + \ No newline at end of file From 13a802f527ed1a981d32b85839990295a58ae11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Thu, 15 Aug 2024 18:01:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/product/index.vue | 10 +- .../modules/product/popup/add-or-update.vue | 101 ++++++++++++++---- .../product/popup/add-specifications.vue | 22 +++- 3 files changed, 107 insertions(+), 26 deletions(-) diff --git a/src/views/modules/product/index.vue b/src/views/modules/product/index.vue index 3b34386..6d1af91 100644 --- a/src/views/modules/product/index.vue +++ b/src/views/modules/product/index.vue @@ -56,7 +56,10 @@ - + @@ -276,8 +279,9 @@ export default { align: "center", width: "340px", render: ({ row }) => { - const grant = () => {}; - let edit = () => {}; + let edit = () => { + this.$refs.addOrUpdate.toggle(row).update(); + }; let priceAdjustment = () => { console.log(row); this.$refs.AddPrice.toggle(row).update(); diff --git a/src/views/modules/product/popup/add-or-update.vue b/src/views/modules/product/popup/add-or-update.vue index 8e55662..4722c58 100644 --- a/src/views/modules/product/popup/add-or-update.vue +++ b/src/views/modules/product/popup/add-or-update.vue @@ -151,6 +151,14 @@ export default { }; }, mounted() {}, + watch: { + "modalConfig.show"(newVal) { + if (!newVal) { + this.currentPanel = "基础信息"; + this.fileList = []; + } + }, + }, methods: { toggle(e) { if (this.modalConfig.show == false) { @@ -160,12 +168,12 @@ export default { } if (e) { console.log(e); - this.init(cloneDeep(e.row)); + this.init(cloneDeep(e)); } return { - add: (item) => { - console.log(item); + add: () => { this.$nextTick(() => { + this.modalConfig.title = "添加商品"; this.modalData = { description: "", merchantId: "", @@ -192,21 +200,41 @@ export default { this.modalData.shopId = JSON.parse( sessionStorage.getItem("userInfo") ).shopId; + this.passCheck = []; + this.place = []; }); - console.log(this.modalData); this.isAdd = true; }, - update: (row) => { - this.modalData = row; + update: () => { + this.modalConfig.title = "编辑商品"; this.isAdd = false; }, }; }, - init(row) {}, + init(row) { + console.log(row); + this.fileList = row.productPhotoList.map((item) => { + return { + name: "", + url: item.url, + }; + }); + this.place = row.productPlace.split("-"); + this.modalData = row; + }, addSpecs() { console.log("123"); - this.$refs.addSpecifications.toggle().add(); + if (this.isAdd) { + this.$refs.addSpecifications.toggle().add(); + } else { + this.$refs.addSpecifications + .toggle() + .update( + this.modalData.productAttributeList, + this.modalData.productSpecificationList + ); + } }, //获取属性 getSpecs(tableData, AttributeData, salePrice, stockNum) { @@ -216,8 +244,6 @@ export default { attributeValue: item.attributeValue.join(","), }; }); - console.log(AttributeList); - this.$set(this.modalData, "productSpecificationList", tableData); this.$set(this.modalData, "productAttributeList", AttributeList); this.$set(this.modalData, "singlePrice", salePrice); @@ -236,9 +262,17 @@ export default { ]; console.log(this.modalData); }, - beforeTabLeave(activeName) { + beforeTabLeave(activeName, oldActiveName) { + if (this.passCheck.includes(activeName)) { + return true; + } let state = ""; this.$refs.modal.validate((valid) => { + if (valid) { + if (!this.passCheck.includes(oldActiveName)) { + this.passCheck.push(oldActiveName); + } + } state = valid; }); return state; @@ -270,16 +304,22 @@ export default { if (index == 0) { return { isMain: 1, - url: item.response.data, + url: item.response ? item.response.data : item.url, }; } else { return { - url: item.response.data, + url: item.response ? item.response.data : item.url, }; } } ); console.log(this.modalData.productPhotoList); + this.fileList = fileList.map((item) => { + return { + name: item.name, + url: item.response ? item.response.data : item.url, + }; + }); }; const handleRemove = (file, fileList) => { console.log(file, fileList); @@ -288,16 +328,22 @@ export default { if (index == 0) { return { isMain: 1, - url: item.response.data, + url: item.url, }; } else { return { - url: item.response.data, + url: item.url, }; } } ); console.log(this.modalData.productPhotoList); + this.fileList = fileList.map((item) => { + return { + name: item.name, + url: item.url, + }; + }); }; return (
@@ -361,6 +408,7 @@ export default { prop: "name", type: "Input", required: true, + maxlength: "30", rules: { required: true, message: "请输入商品名称", @@ -382,6 +430,7 @@ export default { return ( @@ -412,7 +461,7 @@ export default { return ( ); })} @@ -490,7 +539,6 @@ export default { const change = (e) => { console.log(e); this.modalData.productPlace = e.join("-"); - console.log(aa); }; return ( { console.log(res); + this.$emit("queryList"); + this.toggle(); }); } }, 300), }, + { + disabled: () => this.currentPanel != "其他信息", + label: "放入仓库", + type: "primary", + loading: this.isLoading, + submit: true, + handle: debounce(() => { + this.modalData.status = "DOWN"; + this.$api.mer_admin.saveProduct(this.modalData).then((res) => { + console.log(res); + this.$emit("queryList"); + this.toggle(); + }); + }, 300), + }, ]; }, }, diff --git a/src/views/modules/product/popup/add-specifications.vue b/src/views/modules/product/popup/add-specifications.vue index b2f451a..7e7df04 100644 --- a/src/views/modules/product/popup/add-specifications.vue +++ b/src/views/modules/product/popup/add-specifications.vue @@ -136,12 +136,22 @@ export default { add: () => { this.modalConfig.title = "属性"; this.$nextTick(() => { + // this.$refs.modal.resetFields(); this.modalData = {}; - this.$refs.modal.resetFields(); }); this.isAdd = true; }, - update: () => { + update: (productAttributeList, productSpecificationList) => { + console.log(productAttributeList, productSpecificationList); + this.AttributeData = productAttributeList.map((item) => { + return { + attributeName: item.attributeName, + attributeValue: item.attributeValue.split(","), + id: item.id, + inputVisible: false, + }; + }); + this.tableData = productSpecificationList; this.isAdd = false; }, }; @@ -211,9 +221,9 @@ export default { this.tableData = data.map((item) => { return { attributeValue: item, - salePrice: "", - costPrice: "", - stockNum: "", + salePrice: 0, + costPrice: 0, + stockNum: 0, }; }); console.log(data); @@ -259,6 +269,7 @@ export default {
this.tableData.length <= 0, // submit: true, handle: () => { let salePrice = ""; //价格范围 From 948f7242451bc6cbc1506b031b701556eefb96c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Fri, 16 Aug 2024 18:00:30 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/product/popup/add-attribute.vue | 31 ++++++-- .../modules/product/popup/add-discount.vue | 2 +- .../modules/product/popup/add-or-update.vue | 77 ++++++++++++++++--- .../product/popup/add-specifications.vue | 54 +++++++++---- 4 files changed, 131 insertions(+), 33 deletions(-) diff --git a/src/views/modules/product/popup/add-attribute.vue b/src/views/modules/product/popup/add-attribute.vue index 837752a..712ed8a 100644 --- a/src/views/modules/product/popup/add-attribute.vue +++ b/src/views/modules/product/popup/add-attribute.vue @@ -111,15 +111,34 @@ export default { this.init(cloneDeep(e.row)); } return { - add: () => { + add: (data) => { this.modalConfig.title = "添加属性"; - this.$nextTick(() => { - this.modalData = {}; - this.$refs.ruleForm.resetFields(); - }); + if (data.length == 0) { + this.ruleForm = { + name: "", + value: [], + }; + } else { + this.ruleForm = { + name: data[0].name, + value: data[0].value.split(","), + }; + } this.isAdd = true; }, - update: () => { + update: (data) => { + console.log(data); + if (data.length == 0) { + this.ruleForm = { + name: "", + value: [], + }; + } else { + this.ruleForm = { + name: data[0].name, + value: data[0].value.split(","), + }; + } this.isAdd = false; }, }; diff --git a/src/views/modules/product/popup/add-discount.vue b/src/views/modules/product/popup/add-discount.vue index e270d20..50836bd 100644 --- a/src/views/modules/product/popup/add-discount.vue +++ b/src/views/modules/product/popup/add-discount.vue @@ -204,7 +204,7 @@ export default { .catch(() => { this.$message({ type: "info", - message: "已取消删除", + message: "已取消", }); }); }, diff --git a/src/views/modules/product/popup/add-or-update.vue b/src/views/modules/product/popup/add-or-update.vue index 4722c58..a79fb6b 100644 --- a/src/views/modules/product/popup/add-or-update.vue +++ b/src/views/modules/product/popup/add-or-update.vue @@ -64,7 +64,7 @@ export default { //单库存 singleStock: "", //其他属性 - otherAttribute: '[{"name":"颜色","value":"黄色;屎黄色"}]', + otherAttribute: [], //[{"name":"颜色","value":"黄色;屎黄色"}] //折扣情况 discountActivity: { // "endTime": "2024-08-31 00:00:00", @@ -146,6 +146,8 @@ export default { fullscreen: true, }, fileList: [], //回显图片 + fileListOne: [], //介绍图 + fileListTwo: [], //视频 place: "", //场地 passCheck: [], //通行证 }; @@ -178,7 +180,7 @@ export default { description: "", merchantId: "", name: "", - otherAttribute: "", + otherAttribute: [], productAttributeList: [], productCategoryId: "", productIntroducePhoto: "", @@ -220,20 +222,67 @@ export default { url: item.url, }; }); + if (row.productIntroducePhoto) { + this.fileListOne = [ + { + name: "", + url: row.productIntroducePhoto, + }, + ]; + } else { + this.fileListOne = []; + } + if (row.productVideo) { + this.fileListTwo = [ + { + name: "", + url: row.productVideo, + }, + ]; + } else { + this.fileListTwo = []; + } this.place = row.productPlace.split("-"); this.modalData = row; + this.$set(this.modalData, "singleStock", row.stockNum); + if (row.minSalePrice == row.maxSalePrice) { + this.$set(this.modalData, "singlePrice", row.maxSalePrice); + } else { + this.$set( + this.modalData, + "singlePrice", + row.minSalePrice + "~" + row.maxSalePrice + ); + } + if (!row.productAttributeList) { + this.$set(this.modalData, "productAttributeList", []); + } + if (row.otherAttribute) { + this.modalData.otherAttribute = JSON.parse(row.otherAttribute); + } else { + this.modalData.otherAttribute = []; + } }, addSpecs() { console.log("123"); if (this.isAdd) { - this.$refs.addSpecifications.toggle().add(); - } else { this.$refs.addSpecifications .toggle() - .update( + .add( this.modalData.productAttributeList, this.modalData.productSpecificationList ); + } else { + if (this.modalData.productAttributeList.length == 0) { + this.$refs.addSpecifications.toggle().update([], []); + } else { + this.$refs.addSpecifications + .toggle() + .update( + this.modalData.productAttributeList, + this.modalData.productSpecificationList + ); + } } }, //获取属性 @@ -250,7 +299,11 @@ export default { this.$set(this.modalData, "singleStock", stockNum); }, addAttribute() { - this.$refs.addAttribute.toggle().add(); + if (this.isAdd) { + this.$refs.addAttribute.toggle().add(this.modalData.otherAttribute); + } else { + this.$refs.addAttribute.toggle().update(this.modalData.otherAttribute); + } }, getAttribute(data) { console.log(data); @@ -488,9 +541,7 @@ export default { render: () => { return ( 0 - } + readonly={this.modalData.productAttributeList.length > 0} placeholder="请输入价格" v-model={this.modalData.singlePrice} > @@ -504,9 +555,7 @@ export default { render: () => { return ( 0 - } + readonly={this.modalData.productAttributeList.length > 0} placeholder="请输入库存" v-model={this.modalData.singleStock} > @@ -603,6 +652,8 @@ export default { drag action={this.$api.mer_admin.uploadFile()} limit={1} + file-list={this.fileListOne} + list-type="picture" {...{ props: { "on-change": handleChange, @@ -652,6 +703,8 @@ export default { drag action={this.$api.mer_admin.uploadFile()} limit={1} + file-list={this.fileListTwo} + list-type="picture" {...{ props: { "on-change": handleChange, diff --git a/src/views/modules/product/popup/add-specifications.vue b/src/views/modules/product/popup/add-specifications.vue index 7e7df04..c0dda21 100644 --- a/src/views/modules/product/popup/add-specifications.vue +++ b/src/views/modules/product/popup/add-specifications.vue @@ -133,24 +133,50 @@ export default { this.init(cloneDeep(e.row)); } return { - add: () => { - this.modalConfig.title = "属性"; - this.$nextTick(() => { - // this.$refs.modal.resetFields(); - this.modalData = {}; - }); + add: (productAttributeList, productSpecificationList) => { + this.modalConfig.title = "添加属性"; + if (productAttributeList.length == 0) { + this.AttributeData = [ + { + attributeName: "", + attributeValue: [], + inputVisible: false, + }, + ]; + } else { + this.AttributeData = productAttributeList.map((item) => { + return { + attributeName: item.attributeName, + attributeValue: item.attributeValue.split(","), + id: item.id, + inputVisible: false, + }; + }); + } + this.tableData = productSpecificationList; this.isAdd = true; }, update: (productAttributeList, productSpecificationList) => { + this.modalConfig.title = "编辑属性"; console.log(productAttributeList, productSpecificationList); - this.AttributeData = productAttributeList.map((item) => { - return { - attributeName: item.attributeName, - attributeValue: item.attributeValue.split(","), - id: item.id, - inputVisible: false, - }; - }); + if (productAttributeList.length == 0) { + this.AttributeData = [ + { + attributeName: "", + attributeValue: [], + inputVisible: false, + }, + ]; + } else { + this.AttributeData = productAttributeList.map((item) => { + return { + attributeName: item.attributeName, + attributeValue: item.attributeValue.split(","), + id: item.id, + inputVisible: false, + }; + }); + } this.tableData = productSpecificationList; this.isAdd = false; }, From 7616190cd2069e2f31df8a0a4d31401fed3ac9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Sun, 18 Aug 2024 14:33:37 +0800 Subject: [PATCH 5/6] add --- .../product/popup/add-specifications.vue | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/views/modules/product/popup/add-specifications.vue b/src/views/modules/product/popup/add-specifications.vue index c0dda21..be0ed54 100644 --- a/src/views/modules/product/popup/add-specifications.vue +++ b/src/views/modules/product/popup/add-specifications.vue @@ -323,6 +323,44 @@ export default { ); }, }, + { + title: "重量", + field: "stockNum", + align: "center", + "min-width": "160px", + type: "jsx", + render: ({ row }) => { + return ( +
+ +
+ ); + }, + }, + { + title: "体积", + field: "volume", + align: "center", + "min-width": "160px", + type: "jsx", + render: ({ row }) => { + return ( +
+ +
+ ); + }, + }, { title: "操作", fixed: "right", From 637303fc1a3f96f578854cb53026fa332eaade2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Sun, 18 Aug 2024 18:04:26 +0800 Subject: [PATCH 6/6] add --- .../modules/product/popup/add-or-update.vue | 129 ++++++++++++++++-- .../product/popup/add-specifications.vue | 14 +- 2 files changed, 123 insertions(+), 20 deletions(-) diff --git a/src/views/modules/product/popup/add-or-update.vue b/src/views/modules/product/popup/add-or-update.vue index a79fb6b..f8fa261 100644 --- a/src/views/modules/product/popup/add-or-update.vue +++ b/src/views/modules/product/popup/add-or-update.vue @@ -158,6 +158,7 @@ export default { if (!newVal) { this.currentPanel = "基础信息"; this.fileList = []; + (this.fileListOne = []), (this.fileListTwo = []); } }, }, @@ -186,14 +187,23 @@ export default { productIntroducePhoto: "", productPhotoList: [], productPlace: "", - productSpecificationList: [], + productSpecificationList: [ + { + attributeValue: "默认", + costPrice: 20, + salePrice: 30, + stockNum: 10, + weight: 1, + volume: 0.3, + }, + ], productUnit: "", productVideo: "", shelfLife: "", shopId: "", singlePrice: "", singleStock: "", - specType: "", + specType: 0, status: "UP", }; this.modalData.merchantId = JSON.parse( @@ -273,7 +283,7 @@ export default { this.modalData.productSpecificationList ); } else { - if (this.modalData.productAttributeList.length == 0) { + if (this.modalData.specType == 0) { this.$refs.addSpecifications.toggle().update([], []); } else { this.$refs.addSpecifications @@ -287,6 +297,7 @@ export default { }, //获取属性 getSpecs(tableData, AttributeData, salePrice, stockNum) { + this.modalData.specType = 1; let AttributeList = AttributeData.map((item) => { return { attributeName: item.attributeName, @@ -525,6 +536,12 @@ export default { { label: "规格", prop: "productSpecificationList", + // required: true, + // rules: { + // required: true, + // message: "请选择销售单位", + // trigger: "blur", + // }, type: "jsx", render: () => { return ( @@ -534,6 +551,22 @@ export default { ); }, }, + { + label: "成本", + prop: "minCostPrice", + type: "jsx", + render: () => { + return ( + + + + ); + }, + }, { label: "价格", prop: "singlePrice", @@ -541,10 +574,12 @@ export default { render: () => { return ( 0} + readonly={this.modalData.specType != 0} placeholder="请输入价格" v-model={this.modalData.singlePrice} - > + > + + ); }, }, @@ -555,13 +590,41 @@ export default { render: () => { return ( 0} + readonly={this.modalData.specType != 0} placeholder="请输入库存" v-model={this.modalData.singleStock} > ); }, }, + { + label: "重量", + prop: "weight", + type: "jsx", + render: () => { + return ( + + ); + }, + }, + { + label: "体积", + prop: "volume", + type: "jsx", + render: () => { + return ( + + ); + }, + }, { label: "其他属性", prop: "productAttributeList", @@ -630,8 +693,8 @@ export default { label: "商品介绍图", prop: "productIntroducePhoto", type: "Input", - required: true, - rules: { required: true, message: "商品介绍图", trigger: "blur" }, + // required: true, + // rules: { required: true, message: "商品介绍图", trigger: "blur" }, placeholder: "商品介绍图", type: "jsx", render: () => { @@ -680,12 +743,12 @@ export default { { label: "商品视频", prop: "productVideo", - required: true, - rules: { - required: true, - message: "请填写商品描述", - trigger: "blur", - }, + // required: true, + // rules: { + // required: true, + // message: "请填写商品描述", + // trigger: "blur", + // }, type: "jsx", render: () => { const handleChange = (file, fileList) => { @@ -749,6 +812,25 @@ export default { this.currentPanel = "其他信息"; } else { console.log("请求接口", this.modalData); + if (this.modalData.specType == 0) { + this.modalData.productAttributeList = [ + { + id: "1821213026050191360", + attributeName: "重量", + attributeValue: "1斤", + }, + ]; + this.modalData.productSpecificationList = [ + { + attributeValue: "默认", + costPrice: this.modalData.minCostPrice, + salePrice: this.modalData.singlePrice, + stockNum: this.modalData.singleStock, + weight: this.modalData.weight, + volume: this.modalData.volume, + }, + ]; + } this.$api.mer_admin.saveProduct(this.modalData).then((res) => { console.log(res); this.$emit("queryList"); @@ -764,6 +846,25 @@ export default { loading: this.isLoading, submit: true, handle: debounce(() => { + if (this.modalData.specType == 0) { + this.modalData.productAttributeList = [ + { + id: "1821213026050191360", + attributeName: "重量", + attributeValue: "1斤", + }, + ]; + this.modalData.productSpecificationList = [ + { + attributeValue: "默认", + costPrice: this.modalData.minCostPrice, + salePrice: this.modalData.singlePrice, + stockNum: this.modalData.singleStock, + weight: this.modalData.weight, + volume: this.modalData.volume, + }, + ]; + } this.modalData.status = "DOWN"; this.$api.mer_admin.saveProduct(this.modalData).then((res) => { console.log(res); diff --git a/src/views/modules/product/popup/add-specifications.vue b/src/views/modules/product/popup/add-specifications.vue index be0ed54..15b1c23 100644 --- a/src/views/modules/product/popup/add-specifications.vue +++ b/src/views/modules/product/popup/add-specifications.vue @@ -250,6 +250,8 @@ export default { salePrice: 0, costPrice: 0, stockNum: 0, + weight: 0, + volume: 0, }; }); console.log(data); @@ -266,7 +268,7 @@ export default { "min-width": "160px", }, { - title: "价格", + title: "价格(元)", field: "salePrice", align: "center", "min-width": "160px", @@ -285,7 +287,7 @@ export default { }, }, { - title: "成本", + title: "成本(元)", field: "costPrice", align: "center", "min-width": "160px", @@ -324,8 +326,8 @@ export default { }, }, { - title: "重量", - field: "stockNum", + title: "重量(千克)", + field: "weight", align: "center", "min-width": "160px", type: "jsx", @@ -335,7 +337,7 @@ export default {
@@ -343,7 +345,7 @@ export default { }, }, { - title: "体积", + title: "体积(立方米)", field: "volume", align: "center", "min-width": "160px",