diff --git a/src/views/detail/index.vue b/src/views/detail/index.vue index aeaa4f2..50b1163 100644 --- a/src/views/detail/index.vue +++ b/src/views/detail/index.vue @@ -21,7 +21,7 @@ - + @@ -111,7 +111,27 @@ export default { } }, initSku($event) { - this.initialSku[$event.skuKeyStr] = $event.id + const skuValue = $event.skuValue + const selectedSku = $event.selectedSku + for (const key in selectedSku) { + this.initialSku[key] = selectedSku[key] + if (selectedSku[key] && skuValue.skuKeyStr === key) { + this.initialSku[key + 'name'] = skuValue.name + } else if (skuValue.skuKeyStr === key) { + this.initialSku[key + 'name'] = '' + } + } + const nameArr = [] + for (const key in this.initialSku) { + if (key.indexOf('name') > 0 && this.initialSku[key]) { + nameArr.push(this.initialSku[key]) + } + } + this.name = nameArr.join(',') + }, + initSkuNum($event) { + this.stockNum = $event + this.initialSku.selectedNum = $event }, setSkuTree() { const specifications = [] diff --git a/src/views/detail/modules/Sku.vue b/src/views/detail/modules/Sku.vue index 5565874..6d61080 100644 --- a/src/views/detail/modules/Sku.vue +++ b/src/views/detail/modules/Sku.vue @@ -45,7 +45,7 @@ export default { this.$emit('input', false) }, onSkuSelected({ skuValue, selectedSku, selectedSkuComb }) { - this.$emit('initSku', skuValue) + this.$emit('initSku', { skuValue, selectedSku }) }, onStepperChange(num) { this.$emit('initSkuNum', num) diff --git a/vue.config.js b/vue.config.js index 56d44a4..09864cb 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,7 +15,7 @@ module.exports = { lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false, devServer: { - port: 8088, + port: 8099, open: true, overlay: { warnings: false,