From 69705e4747b4bdd5497a62b32882e81adc63d730 Mon Sep 17 00:00:00 2001 From: dy-hu Date: Fri, 21 Jun 2024 14:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8EH5=E7=AB=AF=E5=A4=9A=E7=BB=84?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E5=88=87=E6=8D=A2=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/api.js | 4 ++-- .../goodsModule/components/GoodSkuSelect.vue | 27 +++++++++++++++++++++- pages_category_page1/goodsModule/goodsDetails.vue | 8 +++++-- pages_category_page1/goodsModule/goodsDetails2.vue | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/config/api.js b/config/api.js index 7f234fd..7f6629d 100644 --- a/config/api.js +++ b/config/api.js @@ -1,8 +1,8 @@ //默认打开商家 const default_project = 0 -//const DOMAIN_PREFIX = 'http://127.0.0.1:9007' -const DOMAIN_PREFIX = 'http://36.138.125.206:8081/ceres-app-api' +const DOMAIN_PREFIX = 'http://127.0.0.1:9007' +//const DOMAIN_PREFIX = 'http://36.138.125.206:8081/ceres-app-api' // const DOMAIN_PREFIX = 'https://http://36.138.125.206:8081/ceres-local-filehnthee.com/ceres-app-api' // const DOMAIN_PREFIX = 'https://ceres.zkthink.com/api' diff --git a/pages_category_page1/goodsModule/components/GoodSkuSelect.vue b/pages_category_page1/goodsModule/components/GoodSkuSelect.vue index adc1304..cd9e71f 100644 --- a/pages_category_page1/goodsModule/components/GoodSkuSelect.vue +++ b/pages_category_page1/goodsModule/components/GoodSkuSelect.vue @@ -329,7 +329,12 @@ export default { // 遍历后端数据 for (const allSkuValueGroupMapKey in allSkuValueGroupMap) { // 当和当前选中的sku一致 - if (nowSelectSkuValueGroupKey === allSkuValueGroupMapKey) { + /* if (nowSelectSkuValueGroupKey === allSkuValueGroupMapKey) { + this.selectedSku = allSkuValueGroupMap[allSkuValueGroupMapKey] + this.echoFatherRowText(this.productData, this.selectedSku, this.buyNum) + }*/ + + if (this.isEqual(nowSelectSkuValueGroupKey, allSkuValueGroupMapKey)) { this.selectedSku = allSkuValueGroupMap[allSkuValueGroupMapKey] this.echoFatherRowText(this.productData, this.selectedSku, this.buyNum) } @@ -337,6 +342,26 @@ export default { }, + //有逗号分隔的字符串,不分先后顺序判断 + isEqual(a, b) { + let c = a.split(','), d = b.split(','); + if (c.length != d.length) { + return false; + } + for (let i = 0; i < c.length; i++) { + let isMatch = false; + for (let j = 0; j < d.length; j++) { + if (c[i] == d[j]) { + isMatch = true; + break; + } + } + if (!isMatch) { + return false; + } + } + return true; + }, /** * 回显父组件(通讯) * @param productData 当前商品对象 diff --git a/pages_category_page1/goodsModule/goodsDetails.vue b/pages_category_page1/goodsModule/goodsDetails.vue index f96c2db..a545739 100644 --- a/pages_category_page1/goodsModule/goodsDetails.vue +++ b/pages_category_page1/goodsModule/goodsDetails.vue @@ -94,7 +94,7 @@ - @@ -472,7 +472,8 @@ export default { productIds: '', } }, - defaultImageUrl: 'http://36.138.125.206:8081/ceres-local-file/image/sku_default.png' + defaultImageUrl: 'http://36.138.125.206:8081/ceres-local-file/image/sku_default.png', + selectedAttr: {}, } }, created() { @@ -763,11 +764,13 @@ export default { this.$nextTick(async () => { if (this.paramSkuId) { this.$refs.skuSelect.handleSelectBySkuId(this.paramSkuId) + this.selectedAttr = this.$refs.skuSelect.selectedAttr } else { // 默认选中第0个 for (const skuRowItem of this.productData.names) { this.$refs.skuSelect.handleClickSkuItem(skuRowItem.nameCode, skuRowItem.values[0].valueCode) } + this.selectedAttr = this.$refs.skuSelect.selectedAttr } //如果是拼团,设置拼团id if (this.productData.activityType === 1) { @@ -831,6 +834,7 @@ export default { handleClickSku(nameCode, valueCode) { this.$refs.skuSelect.handleClickSkuItem(nameCode,valueCode) + this.selectedAttr = this.$refs.skuSelect.selectedAttr }, onImageError(e) { diff --git a/pages_category_page1/goodsModule/goodsDetails2.vue b/pages_category_page1/goodsModule/goodsDetails2.vue index 90f062a..16b2a7a 100644 --- a/pages_category_page1/goodsModule/goodsDetails2.vue +++ b/pages_category_page1/goodsModule/goodsDetails2.vue @@ -730,7 +730,7 @@ export default { // 评价 this.commentList = res.data.comments // 宝贝详情 - + this.sellDescList = res.data.text.replace(/\