Переглянути джерело

fix: 商品详情页. 修复接口调整后的若干数据逻辑.

peter 2 тижнів тому
батько
коміт
e4a1105544

+ 12 - 6
components/product/ProductLeft.vue

@@ -137,12 +137,18 @@ export default {
     currentPre(){
       return this.$store.state.product.smImgUlIdx
     },
-    comInfo(){
-      const temp = this.pageData.main
-      const a = temp.image_color.map((i)=>i.image)
-      temp.mergeImages = [...temp.images,...a]
-			return temp
-		},
+    comInfo() {
+      const { main } = this.pageData;
+      const images = main.image_color.map(i => i.image); 
+
+      if (main.image) {
+        images.unshift(main.image);
+      }
+
+      main.mergeImages = images;
+      return main;
+    },
+
     comS3Img(){
 			return this.comInfo.mergeImages.map(url => this.$utils.repaceDomain(url));
 		}

+ 6 - 5
components/product/ProductRight.vue

@@ -21,9 +21,7 @@
             v-for="(item,i) of pageData.main.image_color"
             :key="item.id">
             <div class="color-item" v-if="item.color?.img">
-              <div
-                @click="setSmImgUlIdx(pageData.main?.images?.length + i)"
-                :class="currentPre == pageData.main?.images?.length + i ? 'slip' : ''">
+              <div @click="setSmImgUlIdx(computedIndex(i))" :class="currentPre == (computedIndex(i)) ? 'slip' : ''">
                 <el-tooltip
                 :content="item.color?.name"
                 placement="top"
@@ -334,8 +332,8 @@
           title="网页产品问题反馈"
           sendbtnCext="提交"
           cancelbtnCext="取消"
-          labelWidth=90
-          marginBottom=0
+          :labelWidth=90
+          :marginBottom=0
           :emailForm="ticketForm"
           :enquiryConfig="ticketConfig"
           :visible.sync="ticketFormVisible"
@@ -492,6 +490,9 @@ export default {
     isProduct(str) {
       return /^[A-z]{1,4}\d{1,4}[A-z]?$/.test(str)
     },
+    computedIndex(i) {
+      return this.pageData.main?.image ? 1 + i : i;
+    },
     // 保存一下用户选择的周期、型号、打印服务、addon、packaging, product builder页面要用到
     saveUserSelected() {
       let result = {

+ 3 - 2
components/product/Quote.vue

@@ -640,7 +640,7 @@ export default {
           for(const key in priceList) {
             if (Object.hasOwn(priceList, key)) {
               for (const k in priceList[key]) {
-                if (Object.hasOwn(priceList[key], k)) {     
+                if (Object.hasOwn(priceList[key], k) && Array.isArray(priceList[key][k])) {     
                   priceList[key][k] = priceList[key][k].map(item => {
                 const temp = {...item}
                 for(let i = 1; i<=8; i++) {
@@ -683,7 +683,7 @@ export default {
           // 格式化数据,对象改成数组
           for (const keys in priceList) {
             const vals = {}
-            const { decoration, additionlist, ...remaining } = priceList[keys]
+            const { decoration, additionlist, printDescription, ...remaining } = priceList[keys]
             vals.basePrice = []
             vals.selectAdditionRow = []
             vals.curPrint = 0
@@ -708,6 +708,7 @@ export default {
               }
             })
             for (const k in remaining) {
+              console.log(k, 'k')
               const o = {}
               o.name = k
               o.data = remaining[k]