Browse Source

feat(marketingEdit): 优化新建模板时商品文字添加逻辑

- 新建模式下无需模板ID即可添加商品文字
- 直接在本地添加商品文字数据到 goods_text 数组
- 添加成功后关闭表单并显示成功提示
- 避免了无模板ID时的错误提示
- 支持后续保存模板时一并提交所有商品文字数据
panqiuyao 17 giờ trước cách đây
mục cha
commit
cfb79a61f6
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      frontend/src/views/components/marketingEdit/index.vue

+ 8 - 1
frontend/src/views/components/marketingEdit/index.vue

@@ -748,8 +748,15 @@ export default {
       try {
         // 获取模板ID(编辑模式下)
         const templateId = this.$route?.params?.id
+
+        // 新建模式(无 templateId):仅在本地添加,后续保存模板时再一并提交
         if (!templateId) {
-          this.$message.error('无法获取模板ID,请刷新页面后重试')
+          this.goods_text.push({
+            key: this.addGoodsTextForm.key.trim(),
+            value: this.addGoodsTextForm.value.trim()
+          })
+          this.addGoodsTextForm.visible = false
+          this.$message.success('商品文字添加成功')
           return
         }