From ce1e1de48c16e693e0e4c7300a466502a310bc0a Mon Sep 17 00:00:00 2001 From: waynaqua <1669738430@qq.com> Date: Mon, 3 Aug 2020 10:05:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/detail/index.vue | 24 ++++++++++++++++++++++-- src/views/detail/modules/Sku.vue | 2 +- vue.config.js | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) 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,