From 28d23e6ca68c2d05416ee79696faeff54efce408 Mon Sep 17 00:00:00 2001 From: 20300 <643145201@qq.com> Date: Tue, 26 Mar 2024 09:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=AD=E5=93=AD=E5=93=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/info/detail/index.vue | 81 +++++++++++++++++++------ vue.config.js | 2 +- 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/src/views/product/info/detail/index.vue b/src/views/product/info/detail/index.vue index b27bfc3..10dcab6 100644 --- a/src/views/product/info/detail/index.vue +++ b/src/views/product/info/detail/index.vue @@ -9,8 +9,8 @@ - -

{{ item }}

+ +
@@ -54,8 +54,9 @@
- + +
@@ -72,17 +75,17 @@
-

商品名称

-

商品规格(内存-储存-颜色)

-

¥125

- +

{{projectDetail.projectInfo.name}}

+

商品规格:{{abc}}

+

{{formm.price}}

+ - + {{value}} - + 加入购物车 @@ -96,19 +99,16 @@
商品详情
- - kooriookami - 18100000000 - 苏州市 + + {{attrMap[attr.id]}} 学校 江苏省苏州市吴中区吴中大道 1188 号 - kooriookami - 18100000000 - 苏州市 + {{ott.value}} @@ -135,11 +135,17 @@ export default { value1: 4154.564, value2: 1314, title: "销量人气", - form: { - num: 1 + formm:{ + num: 1, + price: 0 }, + form: [], editorValue: "awejfoiajovhahrfhaowiejfoawijfeoiawjefoawjjogihao", - projectDetail: {} + projectDetail: {}, + abc: "", + attrMap: {}, + otherAttr: [], + carouseImages: [] } }, created() { @@ -147,9 +153,44 @@ export default { }, methods: { initProjectDetailInfo(){ - getDetailInfo(2).then(response => { + getDetailInfo(10).then(response => { + console.log("Response",response) this.projectDetail = response.data; + for (let i = 0; i < this.projectDetail.productAttributeInfoList.length; i++) { + this.attrMap[this.projectDetail.productAttributeInfoList[i].attributeId] = this.projectDetail.productAttributeInfoList[i].value + this.projectDetail.attributeGroupList.forEach(attrGroup => { + let map = attrGroup.attributeList.map(attrs => attrs.id); + if (!map.includes(this.projectDetail.productAttributeInfoList[i].attributeId)){ + this.otherAttr.push(this.projectDetail.productAttributeInfoList[i]) + } + }) + } + console.log("otherAttr",this.otherAttr) + this.initSku() + this.carouseImages = this.projectDetail.projectInfo.carouselImages.split(",") + }) + }, + changeSku() { + this.abc="" + for (let i = 0; i < this.projectDetail.ruleAttrModelList.length; i++) { + this.abc+=this.formm["rule"+i]+"-" + } + this.abc = this.abc.substring(0, this.abc.length - 1); + this.projectDetail.projectSkuInfoList.forEach(projectSku => { + if (projectSku.sku == this.abc){ + this.formm.price = projectSku.price + } + }) + }, + initSku(){ + for (let i = 0; i < this.projectDetail.ruleAttrModelList.length; i++) { + this.formm["rule"+i] = this.projectDetail.ruleAttrModelList[i].valueList[0] + } + this.changeSku() + }, + onSubmit() { + } } } diff --git a/vue.config.js b/vue.config.js index 92405cd..dd8b15d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -35,7 +35,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://10.1.123.97:8080`, + target: `http://localhost:8080`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: ''