Browse Source

feat(Photography): 更新模板详情页面电商平台选择功能

- 将单一的国内电商平台选择扩展为国内外电商平台分别选择
- 适配新的数据结构,支持国内和国外电商平台的独立展示和选择
- 修改电商平台数据获取逻辑,分别获取国内和国外电商平台列表
- 更新一键上架逻辑,合并国内和国外平台进行提交
panqiuyao 3 months ago
parent
commit
1176de6e25
1 changed files with 35 additions and 21 deletions
  1. 35 21
      frontend/src/views/Photography/detail.vue

+ 35 - 21
frontend/src/views/Photography/detail.vue

@@ -181,19 +181,32 @@
               <span class="mar-left-10">该模版图片顺序说明:{{form.selectTemplate.template_image_order}}</span>
             </div>
 
-            <!-- 模板下:一键上架 和 国内电商平台(多选) -->
-            <div class="publish-section flex left" v-if="onlineStores.length">
+            <!-- 模板下:一键上架 和 电商平台(多选) -->
+            <div class="publish-section flex left" v-if="onlineStoreTempList.length || onlineStoreTempListForeign.length">
               <div class="form-item flex left">
                 <div class="fw-b">一键上架:</div>
                </div>
-              <div class="form-item flex left mar-top-10">
+              <div class="form-item flex left mar-top-10" style="margin-right: 10px !important;"  v-if="onlineStoreTempList.length">
                 <div class="label">国内电商平台:</div>
                 <el-select  v-model="domesticPlatforms" multiple placeholder="请选择平台" style="min-width: 200px;">
                   <el-option
-                    v-for="store in onlineStores"
-                    :key="store"
-                    :label="store"
-                    :value="store"
+                    v-for="store in onlineStoreTempList"
+                    :key="store.show_name"
+                    :label="store.show_name"
+                    :value="store.online_store_name"
+                    :disabled="!store.channel_status"
+                  />
+                </el-select>
+              </div>
+              <div class="form-item flex left mar-top-10" v-if="onlineStoreTempListForeign.length">
+                <div class="label">国外电商平台:</div>
+                <el-select  v-model="foreignPlatforms" multiple placeholder="请选择平台" style="min-width: 200px;">
+                  <el-option
+                    v-for="store in onlineStoreTempListForeign"
+                    :key="store.show_name"
+                    :label="store.show_name"
+                    :value="store.online_store_name"
+                    :disabled="!store.channel_status"
                   />
                 </el-select>
               </div>
@@ -486,7 +499,15 @@ const viewTemplate = (template) => {
 const getCompanyTemplates = async () => {
   const { data } = await getCompanyTemplatesApi()
   templates.value = data.list
-  onlineStores.value = data.online_stores || [] // 获取电商平台列表
+  // 获取电商平台列表 - 支持新的数据结构
+  if (data.online_store_temp_list) {
+    onlineStoreTempList.value = data.online_store_temp_list
+  }
+
+  if (data.online_store_temp_list_foreign) {
+    onlineStoreTempListForeign.value = data.online_store_temp_list_foreign
+  }
+
   // 默认选中第一个模板
   if (templates.value.length > 0) {
     form.selectTemplate = templates.value[0]
@@ -513,18 +534,11 @@ const toggleService = (key: string) => {
   else form.services.push(key)
 }
 
-// 国内电商平台多选与一键上架
+// 电商平台多选与一键上架
 const domesticPlatforms = ref<string[]>([])
-const onlineStores = ref<any[]>([]) // 从接口获取的电商平台列表
-const publishToPlatforms = () => {
-  if (!domesticPlatforms.value.length) {
-    ElMessage.warning('请选择至少一个电商平台')
-    return
-  }
-  clickLog({ describe: { action: '点击一键上架', platforms: domesticPlatforms.value } }, route)
-  // 具体上架逻辑按后续接口对接
-}
-
+const foreignPlatforms = ref<string[]>([])
+const onlineStoreTempList = ref<any[]>([]) // 国内电商平台列表
+const onlineStoreTempListForeign = ref<any[]>([]) // 国外电商平台列表
 // 模特与场景弹窗
 const modelDialogVisible = ref(false)
 const scenePromptDialogVisible = ref(false)
@@ -813,8 +827,8 @@ const generate = async function () {
     temp_list,
     token,
     uuid: uuidStore.getUuid || '',
-          // 新增服务参数
-      online_stores: Object.values(domesticPlatforms.value || {}),
+    // 新增服务参数 - 合并国内和国外平台
+    online_stores: [...(domesticPlatforms.value || []), ...(foreignPlatforms.value || [])],
     is_detail: isDetail,
     is_product_scene: isProductScene,
     is_upper_footer: isUpperFooter,