Browse Source

fix: 商品详情-additionlist重复id问题;额外打印数据组合匹配

peter 5 months ago
parent
commit
a1d6ee7be3
1 changed files with 11 additions and 2 deletions
  1. 11 2
      components/product/Quote.vue

+ 11 - 2
components/product/Quote.vue

@@ -701,7 +701,12 @@ export default {
               }
               return result;
             });
-            vals.additionlist = additionlist
+            vals.additionlist = additionlist.map(item => {
+              return {
+                ...item,
+                id: item.id + '-1'  // 修改 id
+              }
+            })
             for (const k in remaining) {
               const o = {}
               o.name = k
@@ -775,7 +780,11 @@ export default {
             // 所有周期的所有打印,进来页面时默认勾选第一条价格
             options.basePrice.forEach((opt,idx) => {
               this.$set(opt, 'selectBaseRow', opt.data[0] ||{})
-              opt.decoration_addition = [...(options.decorationOrign?.[idx]?.decoration_addition || []),...(options.additionlist || [])]
+              // 打印原数据decorationOrign的name 匹配 basePrice(周期下的每个打印数据)的name
+              const matchData = options.decorationOrign.find(d=>{
+                return d.pricetype?.name === opt.name
+              })
+              opt.decoration_addition = [...(matchData?.decoration_addition || []),...(options.additionlist || [])]
             })
             options.decoration.forEach(opt => {
               this.$set(opt, 'num', 0)