diff --git a/src/api/skuStock.js b/src/api/skuStock.js new file mode 100644 index 0000000..986d008 --- /dev/null +++ b/src/api/skuStock.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' +export function fetchList(pid,params) { + return request({ + url:'/sku/'+pid, + method:'get', + params:params + }) +} + +export function update(pid,data) { + return request({ + url:'/sku/update/'+pid, + method:'post', + data:data + }) +} diff --git a/src/views/pms/product/components/ProductAttrDetail.vue b/src/views/pms/product/components/ProductAttrDetail.vue index 4aa18ec..89bcd72 100644 --- a/src/views/pms/product/components/ProductAttrDetail.vue +++ b/src/views/pms/product/components/ProductAttrDetail.vue @@ -95,6 +95,11 @@ style="margin-top: 20px" @click="handleRefreshProductSkuList">刷新列表 + 同步价格 + @@ -403,6 +408,20 @@ this.refreshProductSkuList(); }); }, + handleSyncProductSkuPrice(){ + this.$confirm('将同步第一个sku的价格到所有sku,是否继续', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if(this.value.skuStockList!==null&&this.value.skuStockList.length>0){ + let price=this.value.skuStockList[0].price; + for(let i=0;i{ + this.productParam=response.data; + }); + } + }, methods: { hideAll() { for (let i = 0; i < this.showStatus.length; i++) { diff --git a/src/views/pms/product/components/ProductInfoDetail.vue b/src/views/pms/product/components/ProductInfoDetail.vue index d70bfa3..82ded47 100644 --- a/src/views/pms/product/components/ProductInfoDetail.vue +++ b/src/views/pms/product/components/ProductInfoDetail.vue @@ -52,6 +52,9 @@ + + + 下一步,填写商品促销 @@ -75,6 +78,7 @@ }, data() { return { + hasEditCreated:false, //选中商品分类的值 selectProductCateValue: [], productCateOptions: [], @@ -93,13 +97,22 @@ }; }, created() { - if(this.isEdit){ - this.handleEditCreated(); - } this.getProductCateList(); this.getBrandList(); }, + computed:{ + //商品的编号 + productId(){ + return this.value.id; + } + }, watch: { + productId:function(newValue){ + if(!this.isEdit)return; + if(this.hasEditCreated)return; + if(newValue===undefined||newValue==null||newValue===0)return; + this.handleEditCreated(); + }, selectProductCateValue: function (newValue) { if (newValue != null && newValue.length === 2) { this.value.productCategoryId = newValue[1]; @@ -111,13 +124,11 @@ methods: { //处理编辑逻辑 handleEditCreated(){ - getProduct(this.$route.query.id).then(response=>{ - if(response.data.productCategoryId!=null){ - this.selectProductCateValue.push(response.data.cateParentId); - this.selectProductCateValue.push(response.data.productCategoryId); - } - this.$emit('input',response.data); - }); + if(this.value.productCategoryId!=null){ + this.selectProductCateValue.push(this.value.cateParentId); + this.selectProductCateValue.push(this.value.productCategoryId); + } + this.hasEditCreated=true; }, getProductCateList() { fetchListWithChildren().then(response => { diff --git a/src/views/pms/product/components/ProductSaleDetail.vue b/src/views/pms/product/components/ProductSaleDetail.vue index 938aca3..9677192 100644 --- a/src/views/pms/product/components/ProductSaleDetail.vue +++ b/src/views/pms/product/components/ProductSaleDetail.vue @@ -33,7 +33,7 @@ 推荐 diff --git a/src/views/pms/product/index.vue b/src/views/pms/product/index.vue index edab0c9..fb0eaae 100644 --- a/src/views/pms/product/index.vue +++ b/src/views/pms/product/index.vue @@ -135,7 +135,7 @@ @@ -211,6 +211,64 @@ :total="total"> + + 商品货号: + {{editSkuInfo.productName}} + + + + + + + + + + + + + + + + + + + + + + 取 消 + 确 定 + +