ソースを参照

修改营销活动

Fan 2 週間 前
親
コミット
5dabf08a86

+ 2 - 1
ui/smarttrade-platform/src/api/marketing/index.js

@@ -23,4 +23,5 @@ export const saveGenerateEmail = (data = {}) => post('/router/rest/marketing/cam
 export const getEmailDetail = (data = {}) => post('/router/rest/mkt/email/detail', data)
 export const getEmailById = (data = {}) => get('/router/rest/marketEmails/getById', data)
 export const editEmail = (data = {}) => post('/router/rest/marketEmails/editContent', data)
-export const getCustomerSource = (data = {}) => get('/router/rest/customerTrade/source-distribution', data)
+export const getCustomerSource = (data = {}) => get('/router/rest/customerTrade/source-distribution', data)
+export const getSopDetail = (id) => get(`/router/rest/marketing/campaign/sop-detail/get/${id}`)

+ 124 - 0
ui/smarttrade-platform/src/assets/styles/customer.css

@@ -0,0 +1,124 @@
+.data-page { flex: 1; display: flex; flex-direction: column; padding: 24px; overflow-y: auto; background: var(--bg-dark); }
+.data-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
+.data-title { font-size: 20px; font-weight: 600; }
+.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
+.stat-card-lg { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--bg-card); border-radius: 14px; border: 1px solid var(--border); cursor: auto; transition: all 0.2s; }
+/* .stat-card-lg:hover { border-color: var(--primary); } */
+.stat-icon-lg { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(99, 102, 241, 0.2); color: var(--primary); }
+.stat-icon-lg.green { background: rgba(16, 185, 129, 0.2); color: var(--success); }
+.stat-icon-lg.purple { background: rgba(139, 92, 246, 0.2); color: var(--secondary); }
+.stat-icon-lg.orange { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
+.stat-content-lg h3 { font-size: 24px; font-weight: 700; }
+.stat-content-lg p { font-size: 12px; color: var(--text-secondary); }
+.search-box { position: relative; }
+.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
+.search-input { width: 100%; padding: 10px 14px 10px 40px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); font-size: 13px; }
+.search-input:focus { outline: none; border-color: var(--primary); }
+.form-select { background: var(--bg-card); border: none; color: var(--text-primary);width: auto;padding: 0; }
+.form-select :deep(.el-input__wrapper){ background: var(--bg-card);box-shadow:none;border: 1px solid var(--border);border-radius: 8px;padding: 3px 10px;}
+.form-select :deep(.el-input__wrapper .el-input__inner){color:#fff;}
+.form-select :deep(.el-input__wrapper .el-input__inner::placeholder){color:#64748b;}
+.filter-customer .form-select{
+  flex: 1;
+}
+.filter-customer :deep(.el-input__wrapper),
+.filter-customer :deep(.el-textarea__inner),
+.filter-customer :deep(.el-select .el-select__wrapper),
+.filter-customer :deep(.el-input-number__wrapper),
+.filter-customer :deep(.el-date-editor.el-input__wrapper) {
+    background: var(--bg-dark);
+    border: 1px solid var(--border);
+    box-shadow: none;
+    border-radius: 8px;
+    color: var(--text-primary);
+    width: 100%;
+    box-sizing: border-box;
+    min-width: 0;
+}
+.customer-card { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg-card); border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border); cursor: pointer; transition: all 0.2s; }
+.customer-card:hover { border-color: var(--primary); }
+.customer-flag { font-size: 32px; }
+.customer-info { flex: 1; }
+.customer-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
+.customer-name { font-size: 15px; font-weight: 600; }
+.customer-status { font-size: 10px; padding: 2px 8px; border-radius: 10px; }
+.customer-contact { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
+.customer-meta { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); }
+.customer-score { text-align: center; margin-right: 20px; }
+.score-circle { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; }
+.score-circle.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
+.score-circle.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
+.score-circle.low { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }
+.score-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
+.customer-actions { display: flex; gap: 8px; }
+.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
+.modal { background: var(--bg-card); border-radius: 16px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
+.customer-detail-modal { max-width: 800px; }
+.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
+.modal-title { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; }
+.modal-title h3 { font-size: 16px; font-weight: 600; margin: 0;word-break: break-all;}
+.modal-title p { font-size: 12px; color: var(--text-secondary); margin: 4px 0 0 0; }
+.detail-flag { font-size: 32px; }
+.modal-close { width: 32px; height: 32px; background: var(--bg-hover); border: none; border-radius: 8px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
+.modal-close:hover { background: var(--border); color: var(--text-primary); }
+.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
+.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 20px; border-top: 1px solid var(--border); }
+.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
+.detail-stat-card { background: var(--bg-hover); border-radius: 12px; padding: 16px; text-align: center; }
+.detail-stat-value { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
+.detail-stat-value.high { color: var(--success); }
+.detail-stat-value.medium { color: var(--warning); }
+.detail-stat-value.success { color: var(--success); }
+.detail-stat-label { font-size: 12px; color: var(--text-secondary); }
+.detail-section { margin-bottom: 24px; }
+.detail-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
+.detail-section h4 i { color: var(--primary); }
+.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
+.contact-item { display: flex; gap: 12px; padding: 12px; background: var(--bg-hover); border-radius: 10px; }
+.contact-item i { font-size: 16px; color: var(--primary); width: 20px; }
+.contact-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
+.contact-value { font-size: 13px; font-weight: 500; }
+.contact-value.link { color: var(--primary); cursor: pointer; }
+.contact-sub { font-size: 11px; color: var(--text-secondary); }
+.ai-insight-cards { display: flex; flex-direction: column; gap: 10px; }
+.ai-insight-card { display: flex; gap: 12px; padding: 14px; background: var(--bg-hover); border-radius: 12px; border-left: 3px solid var(--primary); }
+.insight-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
+.insight-icon.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
+.insight-icon.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
+.insight-title { font-size: 13px;  margin-bottom: 4px;white-space: pre-line; }
+.insight-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
+.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 24px; }
+.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
+.timeline-item { position: relative; }
+.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card); }
+.timeline-dot.email { background: var(--primary); }
+.timeline-dot.call { background: var(--success); }
+.timeline-dot.meeting { background: var(--warning); }
+.timeline-dot.visit { background: var(--secondary); }
+.timeline-dot.order { background: var(--success); }
+.timeline-content { padding: 12px; background: var(--bg-hover); border-radius: 10px; }
+.timeline-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
+.timeline-action { font-size: 13px; font-weight: 500; }
+.timeline-time { font-size: 11px; color: var(--text-muted); }
+.timeline-detail { font-size: 12px; color: var(--text-secondary); display: flex;justify-content: space-between;}
+.related-opps { display: flex; flex-direction: column; gap: 10px; }
+.related-opp { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-hover); border-radius: 10px; }
+.opp-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
+.opp-meta { font-size: 11px; color: var(--text-secondary); }
+.opp-status { font-size: 10px; padding: 3px 8px; border-radius: 10px; }
+.opp-status.negotiation { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
+.opp-status.proposal { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
+.opp-status.won { background: rgba(16, 185, 129, 0.2); color: var(--success); }
+.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); z-index: 2000; }
+.toast.success { border-color: var(--success); }
+.toast.success i { color: var(--success); }
+.toast-enter-active, .toast-leave-active { transition: all 0.3s ease; }
+.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(20px); }
+
+.icon-spin {
+  animation: spin 1s linear infinite !important;
+}
+@keyframes spin {
+  0% { transform: rotate(0deg); }
+  100% { transform: rotate(360deg); }
+}

+ 222 - 0
ui/smarttrade-platform/src/components/customerDetail.vue

@@ -0,0 +1,222 @@
+<template>
+    <div v-if="showDetailModal" class="modal-overlay" @click.self="closeDetail()">
+      <div class="modal customer-detail-modal" v-loading="detailLoading" element-loading-background="rgba(0, 0, 0, 0.5)">
+        <div class="modal-header">
+          <div class="modal-title">
+            <span class="detail-flag">{{ selectedCustomer.flag }}</span>
+            <div>
+              <h3>{{ selectedCustomer.customerName }}</h3>
+              <p>{{ selectedCustomer.industry }} · {{ selectedCustomer.continent }}·{{ selectedCustomer.country }}</p>
+            </div>
+          </div>
+          <button class="modal-close" @click="showDetailModal = false"><i class="fas fa-times"></i></button>
+        </div>
+        <div class="modal-body">
+          <!-- Quick Stats -->
+          <div class="detail-stats">
+            <div class="detail-stat-card">
+              <div class="detail-stat-value" :class="getScoreClass(selectedCustomer?.customerAnalysisResult?.potentialScore ?? 0)">{{selectedCustomer?.customerAnalysisResult?.potentialScore ?? 0}}</div>
+              <div class="detail-stat-label">意向分</div>
+            </div>
+            <div class="detail-stat-card">
+              <div class="detail-stat-value">{{ selectedCustomer.totalOrderCount }}</div>
+              <div class="detail-stat-label">累计订单</div>
+            </div>
+            <div class="detail-stat-card">
+              <div class="detail-stat-value success">¥{{ formatNumber(selectedCustomer.totalOrderAmount) }}</div>
+              <div class="detail-stat-label">累计金额</div>
+            </div>
+            <div class="detail-stat-card">
+              <div class="detail-stat-value">{{selectedCustomer.lastContactDays==null?' - ':selectedCustomer.lastContactDays}}天前</div>
+              <div class="detail-stat-label">最后联系</div>
+            </div>
+          </div>
+
+          <!-- Contact Info -->
+          <div class="detail-section">
+            <h4><i class="fas fa-address-card"></i> 联系信息</h4>
+            <div class="contact-grid">
+              <div class="contact-item">
+                <i class="fas fa-user"></i>
+                <div class="contact-content">
+                  <div class="contact-label">主要联系人</div>
+                  <div class="contact-value">{{ selectedCustomer.liaison?.name }}</div>
+                  <div class="contact-sub">{{ selectedCustomer.liaison?.departmentPosition }}</div>
+                </div>
+              </div>
+              <div class="contact-item">
+                <i class="fas fa-envelope"></i>
+                <div class="contact-content">
+                  <div class="contact-label">邮箱</div>
+                  <div class="contact-value">{{ selectedCustomer.customerCompany?.email }}</div>
+                </div>
+              </div>
+              <div class="contact-item">
+                <i class="fas fa-phone"></i>
+                <div class="contact-content">
+                  <div class="contact-label">电话</div>
+                  <div class="contact-value">{{ selectedCustomer.liaison?.telephone }}</div>
+                </div>
+              </div>
+              <div class="contact-item">
+                <i class="fas fa-globe"></i>
+                <div class="contact-content">
+                  <div class="contact-label">官网</div>
+                  <div class="contact-value link">{{ selectedCustomer.customerCompany?.website }}</div>
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <!-- AI Insights -->
+          <div class="detail-section" >
+            <h4>
+              <div><i class="fas fa-robot"></i> AI 洞察</div>
+              <div><button class="btn btn-primary" @click="aiStreaming(selectedCustomer.id)" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}" style="color: #fff;"></i> AI分析</button></div> 
+            </h4>
+            <div class="ai-insight-cards" v-if="formattedText">
+              <div class="ai-insight-card">
+                <!-- <div class="insight-icon" :class="insight.level">
+                  <i :class="insight.icon"></i>
+                </div> -->
+                <div class="insight-content">
+                  <div class="insight-title">{{ formattedText }}</div>
+                  <!-- <div class="insight-desc">{{ insight.description }}</div> -->
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <!-- Interaction Timeline -->
+          <div class="detail-section">
+            <h4><i class="fas fa-history"></i> 互动记录</h4>
+            <div class="timeline" v-if="selectedCustomer.mailThreadList">
+              <div class="timeline-item" v-for="record in selectedCustomer.mailThreadList" :key="record.id">
+                <div class="timeline-dot" :class="record.type"></div>
+                <div class="timeline-content">
+                  <div class="timeline-header">
+                    <span class="timeline-action">{{ record.subject }}</span>
+                    <span class="timeline-time">{{ record.expectSendTime }}</span>
+                  </div>
+                  <div class="timeline-detail" v-for="item in record.replyList">
+                    <span class="timeline-action">{{ item.subject }}</span>
+                    <span class="timeline-time">{{ item.recipientDate }}</span>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <!-- Related Opportunities -->
+          <!-- <div class="detail-section">
+            <h4><i class="fas fa-briefcase"></i> 关联商机</h4>
+            <div class="related-opps">
+              <div class="related-opp" v-for="opp in selectedCustomer.opportunities" :key="opp.id">
+                <div class="opp-info">
+                  <div class="opp-name">{{ opp.name }}</div>
+                  <div class="opp-meta">¥{{ formatNumber(opp.amount) }} · {{ opp.stage }}</div>
+                </div>
+                <div class="opp-status" :class="opp.statusClass">{{ opp.statusLabel }}</div>
+              </div>
+            </div>
+          </div> -->
+        </div>
+        <div class="modal-footer">
+          <button class="btn btn-secondary" @click="closeDetail()">关闭</button>
+          <!-- <button class="btn btn-secondary"><i class="fas fa-edit"></i> 编辑</button> -->
+          <button class="btn btn-primary" @click="goOtherProject(selectedCustomer)">
+            <i class="fas fa-rocket"></i> 客户详情
+          </button>
+        </div>
+      </div>
+    </div>
+</template>
+
+<script setup>
+    import { ref } from 'vue'
+    import { getCustomerDetail,blocking } from '../api/customer'
+
+    const showDetailModal = ref(false)
+    const selectedCustomer = ref({})
+    const detailLoading = ref(false)
+
+    const formattedText = ref('')
+    const customerDetailId = ref()
+    const open = (id) => {
+        aiContentLoading.value = false
+        detailLoading.value = true
+        showDetailModal.value = true
+        customerDetailId.value = id
+        getCustomerDetail({id:id}).then(res => {
+            detailLoading.value = false
+            if(res.success){
+                selectedCustomer.value = res.result
+                if(selectedCustomer.value.customerAnalysisResult){
+                    formattedText.value = selectedCustomer.value.customerAnalysisResult.reasonSummary
+                }else{
+                    formattedText.value = ''
+                }
+            }else{
+                ElMessage.warning(res.message)
+            }
+        })
+    }
+
+    const getScoreClass = (score) => score >= 85 ? 'high' : score >= 70 ? 'medium' : 'low'
+    const formatNumber = (num = 0) => num.toLocaleString()
+
+    const aiContentLoading = ref(false)
+    const aiStreaming= (id) =>{
+        let params = {
+            appId: "app-rQrSHhudWbi5LVRkIX4tfVrg",
+            inputs: {"analysis_batch_no":"1","customer_id":+id},
+            query: "1",
+            response_mode: "blocking",
+            user: "1",
+            files:[]
+        }
+        if(aiContentLoading.value) return
+        aiContentLoading.value = true
+        ElMessage.warning('AI分析时间大概为2-4分钟,请稍后查看')
+        blocking(params).then(res => {
+            aiContentLoading.value = false
+            if(res.success){
+                open(customerDetailId.value)
+            }
+            // else{
+            //   return ElMessage.error('请求超时,请稍后再试')
+            // }
+        })
+    }
+
+    const goOtherProject = (data) => {
+        const baseUrl = 'https://sales.test.storlead.com/customer/followPanel' // 销售管理系统
+        const params = {
+            id: data.id,
+            resourceType: 10,
+            customerForm: 10,
+            queryRangeType: 0,
+            hasPublicCustomer: true,
+            hasFollowMode: false,
+        }
+        // 拼接参数
+        const queryStr = new URLSearchParams(params).toString()
+        const jumpUrl = `${baseUrl}?${queryStr}`
+        // 新窗口打开
+        window.open(jumpUrl, '_blank')
+        // 当前窗口打开:window.location.href = jumpUrl
+    }
+
+    const closeDetail = ()=>{
+        showDetailModal.value = false
+        aiContentLoading.value = false
+    }
+
+    defineExpose({
+        open
+    })
+</script>
+
+<style scoped>
+@import '../assets/styles/customer.css';
+</style>

+ 141 - 22
ui/smarttrade-platform/src/components/marketing/aiGenerator.vue

@@ -1,6 +1,6 @@
 <template>
     <div v-if="showAIModal" class="modal-overlay" @click.self="showAIModal = false">
-      <div class="modal ai-modal">
+      <div class="modal ai-modal" v-loading="isGenerating" element-loading-text="邮件模板生成中,请稍后">
         <div class="modal-header">
           <div class="modal-title"><i class="fas fa-envelope"></i> AI 邮件生成器</div>
           <button class="modal-close" @click="showAIModal = false"><i class="fas fa-times"></i></button>
@@ -10,9 +10,9 @@
             <div class="generator-input">
               <h4>输入要求</h4>
               <div class="form-group">
-                <label class="form-label">邮件类型</label>
-                <el-select v-model="aiGenerator.inputs.scene">
-                  <el-option v-for="item in typeData" :value="item.name" :label="item.name"></el-option>
+                <label class="form-label">营销序列</label>
+                <el-select v-model="selectedSopId" @change="changeType" :disabled="isGenerating">
+                  <el-option v-for="item in typeData" :key="item.id" :value="item.id" :label="item.name"></el-option>
                 </el-select>
               </div>
               <div class="form-group">
@@ -52,7 +52,7 @@
                 <label class="form-label">额外要求</label>
                 <el-input type="textarea" v-model="aiGenerator.inputs.extra" :rows="3" resize="none" placeholder="例如:强调价格优势、提及促销信息"></el-input>
               </div>
-              <el-button style="height: 38px;" class="btn btn-primary btn-block" @click="generateEmail" :loading="isGenerating">生成邮件</el-button>
+              <el-button style="height: 38px;" class="btn btn-primary btn-block" @click="generateEmail" :disabled="!selectedSopId || isSopLoading || isGenerating">生成邮件</el-button>
             </div>
             <div class="generator-output">
               <h4>可用参数</h4>
@@ -135,17 +135,17 @@
         <div class="modal-footer">
           <button class="btn btn-secondary" @click="showAIModal = false">关闭</button>
           <button class="btn btn-secondary" @click="previewEmail" :disabled="!emailContent">预览</button>
-          <button class="btn btn-primary" @click="useEmail" :disabled="!emailContent">保存使用</button>
+          <button class="btn btn-primary" @click="useEmail" :disabled="!hasEmailChanges || isSopLoading || isGenerating || isSaving">保存使用</button>
         </div>
       </div>
     </div>
 </template>
 
 <script setup>
-    import { ref } from 'vue'
+    import { computed, ref } from 'vue'
     import { useRouter } from 'vue-router'
     import ckeditor from '@/components/ckeditor/index.vue'
-    import { getSopById, saveGenerateEmail } from '@/api/marketing'
+    import { getSopById, saveGenerateEmail, getSopDetail } from '@/api/marketing'
     import { getToken } from '@/utils/auth'
 
     const showAIModal = ref(false)
@@ -182,12 +182,20 @@
 
     const marketingData = ref()
     const typeData = ref([])
+    const selectedSopId = ref()
+    const activeSopId = ref()
+    const emailDrafts = ref({})
+    const isSopLoading = ref(false)
+    const isSaving = ref(false)
     const emailSubject = ref('')
     const open = (data) => {
         marketingData.value = data
-        getSopById(data.id).then(res => {
-            typeData.value = res.result || []
-        })
+        typeData.value = []
+        emailDrafts.value = {}
+        selectedSopId.value = undefined
+        activeSopId.value = undefined
+        isSopLoading.value = false
+        isSaving.value = false
         aiGenerator.value.inputs = {
             scene: '',
             products: '',
@@ -199,6 +207,73 @@
         emailContent.value = ''
         emailSubject.value = ''
         showAIModal.value = true
+        getSopById(data.id).then(async res => {
+            typeData.value = res.result || []
+            if (typeData.value.length > 0) {
+                selectedSopId.value = typeData.value[0].id
+                await changeType()
+            }
+        }).catch(err => {
+            ElMessage.error(err.message || '营销序列加载失败')
+        })
+    }
+
+    const syncActiveEmailDraft = () => {
+        if (activeSopId.value === undefined || activeSopId.value === null) return
+        const draft = emailDrafts.value[String(activeSopId.value)]
+        if (!draft) return
+        draft.emailContent = emailContent.value
+        draft.emailSubject = emailSubject.value
+    }
+
+    const changeType = async () => {
+        syncActiveEmailDraft()
+        const id = selectedSopId.value
+        activeSopId.value = id
+        const selectedSop = typeData.value.find(item => String(item.id) === String(id))
+        aiGenerator.value.inputs.scene = selectedSop ? selectedSop.name : ''
+        if (id === undefined || id === null) {
+            emailContent.value = ''
+            emailSubject.value = ''
+            isSopLoading.value = false
+            return
+        }
+
+        const key = String(id)
+        const draft = emailDrafts.value[key]
+        if (draft) {
+            emailContent.value = draft.emailContent
+            emailSubject.value = draft.emailSubject
+            isSopLoading.value = false
+            return
+        }
+
+        emailContent.value = ''
+        emailSubject.value = ''
+        isSopLoading.value = true
+        try {
+            const res = await getSopDetail(id)
+            const detail = res.result || {}
+            const originalContent = detail.emailContent || ''
+            const originalSubject = detail.emailSubject || ''
+            emailDrafts.value[key] = {
+                id,
+                originalContent,
+                originalSubject,
+                emailContent: originalContent,
+                emailSubject: originalSubject
+            }
+            if (String(selectedSopId.value) === String(id)) {
+                emailContent.value = originalContent
+                emailSubject.value = originalSubject
+            }
+        } catch (err) {
+            ElMessage.error(err.message || '营销序列邮件加载失败')
+        } finally {
+            if (String(selectedSopId.value) === String(id)) {
+                isSopLoading.value = false
+            }
+        }
     }
 
     const aiShow = ref(false)
@@ -285,6 +360,8 @@
     const generateEmail = async() => {
         isGenerating.value = true
         let params = JSON.parse(JSON.stringify(aiGenerator.value))
+        const selectedSop = typeData.value.find(item => String(item.id) === String(selectedSopId.value))
+        params.inputs.scene = selectedSop ? selectedSop.name : ''
         params.inputs.core_selling_points = params.inputs.core_selling_points.join(',')
         const url = import.meta.env.VITE_API_BASE_URL + 'router/rest/workflows/streaming';
         try {
@@ -384,9 +461,11 @@
             }
             emailContent.value = doneData.replace(/<p>\s*<\/p>/g, '')
             emailSubject.value = subject.replace(': ', '')
-            isGenerating.value = false
         } catch (error) {
             console.error('Fetch error:', error);
+            ElMessage.error('生成失败')
+        } finally {
+            isGenerating.value = false
         }
     }
     const previewEmail = () => {
@@ -400,19 +479,56 @@
         })
         window.open(href, '_blank')
     }
-    const useEmail = () => {
-        let params = {
-            id: typeData.value.filter(item => item.name == aiGenerator.value.inputs.scene)[0].id,
-            emailContent: emailContent.value,
-            emailSubject: emailSubject.value,
-            marketingCampaignId: marketingData.value.id
-        }
-        saveGenerateEmail(params).then(res => {
+    const hasEmailChanges = computed(() => {
+        const changedDraft = Object.values(emailDrafts.value).some(draft =>
+            draft.emailContent !== draft.originalContent ||
+            draft.emailSubject !== draft.originalSubject
+        )
+        const activeDraft = emailDrafts.value[String(activeSopId.value)]
+        return changedDraft || Boolean(activeDraft && (
+            emailContent.value !== activeDraft.originalContent ||
+            emailSubject.value !== activeDraft.originalSubject
+        ))
+    })
+
+    const useEmail = async () => {
+        syncActiveEmailDraft()
+        const changedDrafts = Object.entries(emailDrafts.value).filter(([, draft]) =>
+            draft.emailContent !== draft.originalContent ||
+            draft.emailSubject !== draft.originalSubject
+        )
+        if (changedDrafts.length === 0) return
+
+        isSaving.value = true
+        try {
+            const results = await Promise.allSettled(changedDrafts.map(([, draft]) =>
+                saveGenerateEmail({
+                    id: draft.id,
+                    emailContent: draft.emailContent,
+                    emailSubject: draft.emailSubject,
+                    marketingCampaignId: marketingData.value.id
+                })
+            ))
+            results.forEach((result, index) => {
+                if (result.status === 'fulfilled') {
+                    const draft = changedDrafts[index][1]
+                    draft.originalContent = draft.emailContent
+                    draft.originalSubject = draft.emailSubject
+                }
+            })
+
+            const failedCount = results.filter(result => result.status === 'rejected').length
+            if (failedCount > 0) {
+                ElMessage.error(failedCount === changedDrafts.length ? '保存失败' : `有 ${failedCount} 个营销序列保存失败,请重试`)
+                return
+            }
             ElMessage.success('保存成功')
             showAIModal.value = false
-        }).catch(err => {
+        } catch (err) {
             ElMessage.error(err.message || '保存失败')
-        })
+        } finally {
+            isSaving.value = false
+        }
     }
 
     defineExpose({ open })
@@ -565,4 +681,7 @@
     align-items: center;
     margin-top: 16px;
 }
+.ai-modal :deep(.el-loading-mask){
+    background: #1e293b9a;
+}
 </style>

+ 11 - 1
ui/smarttrade-platform/src/components/marketing/emailList.vue

@@ -27,6 +27,7 @@
             :key="item.id"
             class="email-card"
             v-if="emailList.length > 0"
+             @click="showDetail(item.customerId)"
           >
             <div class="email-card-left">
               <div class="email-card-top">
@@ -45,7 +46,7 @@
               <button v-if="activeFilter !== 'sent' && activeFilter !== 'error'" class="btn btn-secondary" @click="cancelSend(item)">
                 {{  activeFilter === 'pending' ? '取消' : '重新' }}发送
               </button>
-              <button class="btn btn-secondary" @click="viewDetail(item)" v-if="activeFilter == 'sent' || activeFilter == 'error'">
+              <button class="btn btn-secondary" @click.stop="viewDetail(item)" v-if="activeFilter == 'sent' || activeFilter == 'error'">
                 邮件详情
               </button>
               <button v-if="activeFilter !== 'sent' && activeFilter !== 'error'" class="btn btn-primary" @click="editEmail(item)">
@@ -61,6 +62,8 @@
       </div>
     </div>
   </div>
+
+  <CustomerDetail ref="customerDetailRef" />
 </template>
 
 <script setup>
@@ -68,6 +71,7 @@ import { ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { getEmailList, getEmailCount, cancelEmail } from '@/api/marketing'
 import { ElMessageBox } from 'element-plus'
+import CustomerDetail from '@/components/customerDetail.vue';
 
 const emits = defineEmits(['refresh']);
 const selectedCampaign = ref(null)
@@ -178,6 +182,11 @@ const close = () => {
   showEmailListModal.value = false
 }
 
+const customerDetailRef = ref()
+const showDetail = (id) => {
+  customerDetailRef.value.open(id)
+}
+
 defineExpose({ open, close })
 </script>
 
@@ -247,6 +256,7 @@ defineExpose({ open, close })
   border-left: 4px solid rgba(99, 102, 241, 0.6);
   border-radius: 16px;
   align-items: center;
+  cursor: pointer;
 }
 
 .email-card-left {

+ 12 - 1
ui/smarttrade-platform/src/components/marketing/interventionCustomers.vue

@@ -20,7 +20,7 @@
           <!-- Protected Customers List -->
           <div class="detail-section" v-if="protectedCustomersList.length > 0">
             <div class="protected-customers">
-              <div v-for="customer in protectedCustomersList" :key="customer.id" class="intervention-item" :class="{ 'protected-customer-item': tabType == 'protect', 'suspended-customer-item': tabType == 'suspend' }">
+              <div v-for="customer in protectedCustomersList" :key="customer.id" class="intervention-item" :class="{ 'protected-customer-item': tabType == 'protect', 'suspended-customer-item': tabType == 'suspend' }" @click="showDetail(customer.customerId)">
                 <div style="display: flex;justify-content: space-between;align-items: center;">
                   <div>
                     <div class="customer-header">
@@ -62,12 +62,15 @@
         </div>
       </div>
     </div>
+
+    <CustomerDetail ref="customerDetailRef" />
 </template>
 
 <script setup>
     import { ref } from 'vue';
     import { getInterventionCustomer, setProtectCustomer, setSuspendCustomer } from '@/api/marketing'
     import { ElMessageBox } from 'element-plus'
+    import CustomerDetail from '@/components/customerDetail.vue';
 
     const emits = defineEmits(['refresh']);
     const showInterventionModal = ref(false);
@@ -123,6 +126,11 @@
         getData()
     }
 
+    const customerDetailRef = ref()
+    const showDetail = (id) => {
+      customerDetailRef.value.open(id)
+    }
+
     defineExpose({ open });
 </script>
 
@@ -151,4 +159,7 @@
         font-size: 12px;
         color: #64748B;
     }
+    .intervention-item{
+      cursor: pointer;
+    }
 </style>

+ 9 - 1
ui/smarttrade-platform/src/components/marketing/openedCustomers.vue

@@ -23,7 +23,7 @@
             </div>
           </div>
           <div v-if="openedCustomers.length > 0" class="customers-list">
-            <div v-for="customer in openedCustomers" class="customer-item" :class="{ protected: customer.hasProtect, suspended: !customer.hasProtect && customer.hasSuspend }">
+            <div v-for="customer in openedCustomers" class="customer-item" :class="{ protected: customer.hasProtect, suspended: !customer.hasProtect && customer.hasSuspend }" @click="showDetail(customer.customerId)">
               <div class="customer-header">
                 <div class="customer-info">
                   <div class="customer-name">
@@ -77,12 +77,15 @@
         </div>
       </div>
     </div>
+
+    <CustomerDetail ref="customerDetailRef" />
 </template>
 
 <script setup>
     import { ref } from 'vue'
     import { getOpenCustomer, setProtectCustomer, setSuspendCustomer } from '@/api/marketing'
     import { ElMessageBox } from 'element-plus'
+    import CustomerDetail from '@/components/customerDetail.vue';
 
     const emits = defineEmits(['refresh']);
     const showOpenedCustomersModal = ref(false)
@@ -150,6 +153,11 @@
       })
     }
 
+    const customerDetailRef = ref()
+    const showDetail = (id) => {
+      customerDetailRef.value.open(id)
+    }
+
     defineExpose({
         open
     })

+ 13 - 1
ui/smarttrade-platform/src/components/marketing/replyCustomers.vue

@@ -23,7 +23,7 @@
             </div>
           </div>
           <div class="replies-list" v-if="repliedCustomers.length > 0">
-            <div v-for="reply in repliedCustomers" :key="reply.id" class="reply-item" :class="{ approved: reply.hasProtect, 'pending-review': !reply.hasProtect && reply.hasSuspend }">
+            <div v-for="reply in repliedCustomers" :key="reply.id" class="reply-item" :class="{ approved: reply.hasProtect, 'pending-review': !reply.hasProtect && reply.hasSuspend }" @click="showDetail(reply.customerId)">
               <div style="display: flex;justify-content: space-between;margin-bottom: 10px;align-items: center;">
                 <div>
                   <div class="reply-header">
@@ -80,12 +80,15 @@
         </div>
       </div>
     </div>
+
+    <CustomerDetail ref="customerDetailRef" />
 </template>
 
 <script setup>
     import { ref } from 'vue';
     import { getReplyCustomer, setProtectCustomer, setSuspendCustomer } from '@/api/marketing'
     import { ElMessageBox } from 'element-plus'
+    import CustomerDetail from '@/components/customerDetail.vue';
 
     const emits = defineEmits(['refresh']);
     const showReplyReviewModal = ref(false);
@@ -151,6 +154,11 @@
       })
     }
 
+    const customerDetailRef = ref()
+    const showDetail = (id) => {
+      customerDetailRef.value.open(id)
+    }
+
     defineExpose({
         open
     })
@@ -181,4 +189,8 @@
         font-size: 12px;
         color: #64748B;
     }
+
+    .reply-item{
+      cursor: pointer;
+    }
 </style>

+ 22 - 321
ui/smarttrade-platform/src/views/CustomersView.vue

@@ -179,137 +179,7 @@
     /> -->
 
     <!-- Customer Detail Modal -->
-    <div v-if="showDetailModal && selectedCustomer" class="modal-overlay" @click.self="closeDetail()">
-      <div class="modal customer-detail-modal" v-loading="detailLoading" element-loading-background="rgba(0, 0, 0, 0.5)">
-        <div class="modal-header">
-          <div class="modal-title">
-            <span class="detail-flag">{{ selectedCustomer.flag }}</span>
-            <div>
-              <h3>{{ selectedCustomer.customerName }}</h3>
-              <p>{{ selectedCustomer.industry }} · {{ selectedCustomer.continent }}·{{ selectedCustomer.country }}</p>
-            </div>
-          </div>
-          <button class="modal-close" @click="showDetailModal = false"><i class="fas fa-times"></i></button>
-        </div>
-        <div class="modal-body">
-          <!-- Quick Stats -->
-          <div class="detail-stats">
-            <div class="detail-stat-card">
-              <div class="detail-stat-value" :class="getScoreClass(selectedCustomer?.customerAnalysisResult?.potentialScore ?? 0)">{{selectedCustomer?.customerAnalysisResult?.potentialScore ?? 0}}</div>
-              <div class="detail-stat-label">意向分</div>
-            </div>
-            <div class="detail-stat-card">
-              <div class="detail-stat-value">{{ selectedCustomer.totalOrderCount }}</div>
-              <div class="detail-stat-label">累计订单</div>
-            </div>
-            <div class="detail-stat-card">
-              <div class="detail-stat-value success">¥{{ formatNumber(selectedCustomer.totalOrderAmount) }}</div>
-              <div class="detail-stat-label">累计金额</div>
-            </div>
-            <div class="detail-stat-card">
-              <div class="detail-stat-value">{{selectedCustomer.lastContactDays==null?' - ':selectedCustomer.lastContactDays}}天前</div>
-              <div class="detail-stat-label">最后联系</div>
-            </div>
-          </div>
-
-          <!-- Contact Info -->
-          <div class="detail-section">
-            <h4><i class="fas fa-address-card"></i> 联系信息</h4>
-            <div class="contact-grid">
-              <div class="contact-item">
-                <i class="fas fa-user"></i>
-                <div class="contact-content">
-                  <div class="contact-label">主要联系人</div>
-                  <div class="contact-value">{{ selectedCustomer.liaison?.name }}</div>
-                  <div class="contact-sub">{{ selectedCustomer.liaison?.departmentPosition }}</div>
-                </div>
-              </div>
-              <div class="contact-item">
-                <i class="fas fa-envelope"></i>
-                <div class="contact-content">
-                  <div class="contact-label">邮箱</div>
-                  <div class="contact-value">{{ selectedCustomer.customerCompany?.email }}</div>
-                </div>
-              </div>
-              <div class="contact-item">
-                <i class="fas fa-phone"></i>
-                <div class="contact-content">
-                  <div class="contact-label">电话</div>
-                  <div class="contact-value">{{ selectedCustomer.liaison?.telephone }}</div>
-                </div>
-              </div>
-              <div class="contact-item">
-                <i class="fas fa-globe"></i>
-                <div class="contact-content">
-                  <div class="contact-label">官网</div>
-                  <div class="contact-value link">{{ selectedCustomer.customerCompany?.website }}</div>
-                </div>
-              </div>
-            </div>
-          </div>
-
-          <!-- AI Insights -->
-          <div class="detail-section" >
-            <h4>
-              <div><i class="fas fa-robot"></i> AI 洞察</div>
-              <div><button class="btn btn-primary" @click="aiStreaming(selectedCustomer.id)" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}" style="color: #fff;"></i> AI分析</button></div> 
-            </h4>
-            <div class="ai-insight-cards" v-if="formattedText">
-              <div class="ai-insight-card">
-                <!-- <div class="insight-icon" :class="insight.level">
-                  <i :class="insight.icon"></i>
-                </div> -->
-                <div class="insight-content">
-                  <div class="insight-title">{{ formattedText }}</div>
-                  <!-- <div class="insight-desc">{{ insight.description }}</div> -->
-                </div>
-              </div>
-            </div>
-          </div>
-
-          <!-- Interaction Timeline -->
-          <div class="detail-section">
-            <h4><i class="fas fa-history"></i> 互动记录</h4>
-            <div class="timeline" v-if="selectedCustomer.mailThreadList">
-              <div class="timeline-item" v-for="record in selectedCustomer.mailThreadList" :key="record.id">
-                <div class="timeline-dot" :class="record.type"></div>
-                <div class="timeline-content">
-                  <div class="timeline-header">
-                    <span class="timeline-action">{{ record.subject }}</span>
-                    <span class="timeline-time">{{ record.expectSendTime }}</span>
-                  </div>
-                  <div class="timeline-detail" v-for="item in record.replyList">
-                    <span class="timeline-action">{{ item.subject }}</span>
-                    <span class="timeline-time">{{ item.recipientDate }}</span>
-                  </div>
-                </div>
-              </div>
-            </div>
-          </div>
-
-          <!-- Related Opportunities -->
-          <!-- <div class="detail-section">
-            <h4><i class="fas fa-briefcase"></i> 关联商机</h4>
-            <div class="related-opps">
-              <div class="related-opp" v-for="opp in selectedCustomer.opportunities" :key="opp.id">
-                <div class="opp-info">
-                  <div class="opp-name">{{ opp.name }}</div>
-                  <div class="opp-meta">¥{{ formatNumber(opp.amount) }} · {{ opp.stage }}</div>
-                </div>
-                <div class="opp-status" :class="opp.statusClass">{{ opp.statusLabel }}</div>
-              </div>
-            </div>
-          </div> -->
-        </div>
-        <div class="modal-footer">
-          <button class="btn btn-secondary" @click="closeDetail()">关闭</button>
-          <!-- <button class="btn btn-secondary"><i class="fas fa-edit"></i> 编辑</button> -->
-          <button class="btn btn-primary" @click="goOtherProject(selectedCustomer)">
-            <i class="fas fa-rocket"></i> 客户详情
-          </button>
-        </div>
-      </div>
-    </div>
+    <CustomerDetail ref="customerDetailRef" />
 
     <!-- Toast -->
     <transition name="toast">
@@ -327,6 +197,7 @@ import { getCustomerList,getCustomerDetail,blocking } from '../api/customer'
 import {region} from '@/utils/region';
 // 引入添加客户组件
 import AddCustomerModal from '../components/addCustomer.vue'
+import CustomerDetail from '../components/customerDetail.vue';
 
 const showAddModal = ref(false)
 const showDetailModal = ref(false)
@@ -412,69 +283,26 @@ const getRegion = (value) => {
 }
 
 const customerDetailId = ref()
+const customerDetailRef = ref()
 const showCustomerDetail = (id) => {
-  aiContentLoading.value = false
-  detailLoading.value = true
-  showDetailModal.value = true
-  customerDetailId.value = id
-  getCustomerDetail({id:id}).then(res => {
-    detailLoading.value = false
-    if(res.success){
-      selectedCustomer.value = res.result
-      if(selectedCustomer.value.customerAnalysisResult){
-        formattedText.value = selectedCustomer.value.customerAnalysisResult.reasonSummary
-      }else{
-        formattedText.value = ''
-      }
-    }else{
-      ElMessage.warning(res.message)
-    }
-  })
-}
-
-const aiStreaming= (id) =>{
-  let params = {
-    appId: "app-rQrSHhudWbi5LVRkIX4tfVrg",
-    inputs: {"analysis_batch_no":"1","customer_id":+id},
-    query: "1",
-    response_mode: "blocking",
-    user: "1",
-    files:[]
-  }
-  if(aiContentLoading.value) return
-  aiContentLoading.value = true
-  ElMessage.warning('AI分析时间大概为2-4分钟,请稍后查看')
-  blocking(params).then(res => {
-    aiContentLoading.value = false
-    if(res.success){
-      showCustomerDetail(customerDetailId.value)
-    }
-    // else{
-    //   return ElMessage.error('请求超时,请稍后再试')
-    // }
-  })
-}
-
-const goOtherProject = (data) => {
-  const baseUrl = 'https://sales.test.storlead.com/customer/followPanel' // 销售管理系统
-  const params = {
-    id: data.id,
-    resourceType: 10,
-    customerForm: 10,
-    queryRangeType: 0,
-    hasPublicCustomer: true,
-    hasFollowMode: false,
-  }
-  // 拼接参数
-  const queryStr = new URLSearchParams(params).toString()
-  const jumpUrl = `${baseUrl}?${queryStr}`
-  // 新窗口打开
-  window.open(jumpUrl, '_blank')
-  // 当前窗口打开:window.location.href = jumpUrl
-}
-const closeDetail = ()=>{
-  showDetailModal.value = false
-  aiContentLoading.value = false
+  customerDetailRef.value.open(id)
+  // aiContentLoading.value = false
+  // detailLoading.value = true
+  // showDetailModal.value = true
+  // customerDetailId.value = id
+  // getCustomerDetail({id:id}).then(res => {
+  //   detailLoading.value = false
+  //   if(res.success){
+  //     selectedCustomer.value = res.result
+  //     if(selectedCustomer.value.customerAnalysisResult){
+  //       formattedText.value = selectedCustomer.value.customerAnalysisResult.reasonSummary
+  //     }else{
+  //       formattedText.value = ''
+  //     }
+  //   }else{
+  //     ElMessage.warning(res.message)
+  //   }
+  // })
 }
 // const customers = ref([
 //   { 
@@ -556,10 +384,6 @@ const closeDetail = ()=>{
 //   return result
 // })
 
-const formatNumber = (num) => num.toLocaleString()
-
-const getScoreClass = (score) => score >= 85 ? 'high' : score >= 70 ? 'medium' : 'low'
-
 const getStatusBg = (status) => ({
   prospect: 'rgba(139, 92, 246, 0.2)',
   intent: 'rgba(245, 158, 11, 0.2)',
@@ -671,128 +495,5 @@ const handleAddCustomer = (customerData) => {
 </script>
 
 <style scoped>
-.data-page { flex: 1; display: flex; flex-direction: column; padding: 24px; overflow-y: auto; background: var(--bg-dark); }
-.data-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
-.data-title { font-size: 20px; font-weight: 600; }
-.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
-.stat-card-lg { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--bg-card); border-radius: 14px; border: 1px solid var(--border); cursor: auto; transition: all 0.2s; }
-/* .stat-card-lg:hover { border-color: var(--primary); } */
-.stat-icon-lg { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(99, 102, 241, 0.2); color: var(--primary); }
-.stat-icon-lg.green { background: rgba(16, 185, 129, 0.2); color: var(--success); }
-.stat-icon-lg.purple { background: rgba(139, 92, 246, 0.2); color: var(--secondary); }
-.stat-icon-lg.orange { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
-.stat-content-lg h3 { font-size: 24px; font-weight: 700; }
-.stat-content-lg p { font-size: 12px; color: var(--text-secondary); }
-.search-box { position: relative; }
-.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
-.search-input { width: 100%; padding: 10px 14px 10px 40px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); font-size: 13px; }
-.search-input:focus { outline: none; border-color: var(--primary); }
-.form-select { background: var(--bg-card); border: none; color: var(--text-primary);width: auto;padding: 0; }
-.form-select :deep(.el-input__wrapper){ background: var(--bg-card);box-shadow:none;border: 1px solid var(--border);border-radius: 8px;padding: 3px 10px;}
-.form-select :deep(.el-input__wrapper .el-input__inner){color:#fff;}
-.form-select :deep(.el-input__wrapper .el-input__inner::placeholder){color:#64748b;}
-.filter-customer .form-select{
-  flex: 1;
-}
-.filter-customer :deep(.el-input__wrapper),
-.filter-customer :deep(.el-textarea__inner),
-.filter-customer :deep(.el-select .el-select__wrapper),
-.filter-customer :deep(.el-input-number__wrapper),
-.filter-customer :deep(.el-date-editor.el-input__wrapper) {
-    background: var(--bg-dark);
-    border: 1px solid var(--border);
-    box-shadow: none;
-    border-radius: 8px;
-    color: var(--text-primary);
-    width: 100%;
-    box-sizing: border-box;
-    min-width: 0;
-}
-.customer-card { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg-card); border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border); cursor: pointer; transition: all 0.2s; }
-.customer-card:hover { border-color: var(--primary); }
-.customer-flag { font-size: 32px; }
-.customer-info { flex: 1; }
-.customer-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
-.customer-name { font-size: 15px; font-weight: 600; }
-.customer-status { font-size: 10px; padding: 2px 8px; border-radius: 10px; }
-.customer-contact { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
-.customer-meta { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); }
-.customer-score { text-align: center; margin-right: 20px; }
-.score-circle { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; }
-.score-circle.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
-.score-circle.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
-.score-circle.low { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }
-.score-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
-.customer-actions { display: flex; gap: 8px; }
-.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
-.modal { background: var(--bg-card); border-radius: 16px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
-.customer-detail-modal { max-width: 800px; }
-.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
-.modal-title { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; }
-.modal-title h3 { font-size: 16px; font-weight: 600; margin: 0;word-break: break-all;}
-.modal-title p { font-size: 12px; color: var(--text-secondary); margin: 4px 0 0 0; }
-.detail-flag { font-size: 32px; }
-.modal-close { width: 32px; height: 32px; background: var(--bg-hover); border: none; border-radius: 8px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
-.modal-close:hover { background: var(--border); color: var(--text-primary); }
-.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
-.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 20px; border-top: 1px solid var(--border); }
-.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
-.detail-stat-card { background: var(--bg-hover); border-radius: 12px; padding: 16px; text-align: center; }
-.detail-stat-value { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
-.detail-stat-value.high { color: var(--success); }
-.detail-stat-value.medium { color: var(--warning); }
-.detail-stat-value.success { color: var(--success); }
-.detail-stat-label { font-size: 12px; color: var(--text-secondary); }
-.detail-section { margin-bottom: 24px; }
-.detail-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
-.detail-section h4 i { color: var(--primary); }
-.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
-.contact-item { display: flex; gap: 12px; padding: 12px; background: var(--bg-hover); border-radius: 10px; }
-.contact-item i { font-size: 16px; color: var(--primary); width: 20px; }
-.contact-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
-.contact-value { font-size: 13px; font-weight: 500; }
-.contact-value.link { color: var(--primary); cursor: pointer; }
-.contact-sub { font-size: 11px; color: var(--text-secondary); }
-.ai-insight-cards { display: flex; flex-direction: column; gap: 10px; }
-.ai-insight-card { display: flex; gap: 12px; padding: 14px; background: var(--bg-hover); border-radius: 12px; border-left: 3px solid var(--primary); }
-.insight-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
-.insight-icon.high { background: rgba(16, 185, 129, 0.2); color: var(--success); }
-.insight-icon.medium { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
-.insight-title { font-size: 13px;  margin-bottom: 4px;white-space: pre-line; }
-.insight-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
-.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 24px; }
-.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
-.timeline-item { position: relative; }
-.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card); }
-.timeline-dot.email { background: var(--primary); }
-.timeline-dot.call { background: var(--success); }
-.timeline-dot.meeting { background: var(--warning); }
-.timeline-dot.visit { background: var(--secondary); }
-.timeline-dot.order { background: var(--success); }
-.timeline-content { padding: 12px; background: var(--bg-hover); border-radius: 10px; }
-.timeline-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
-.timeline-action { font-size: 13px; font-weight: 500; }
-.timeline-time { font-size: 11px; color: var(--text-muted); }
-.timeline-detail { font-size: 12px; color: var(--text-secondary); display: flex;justify-content: space-between;}
-.related-opps { display: flex; flex-direction: column; gap: 10px; }
-.related-opp { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-hover); border-radius: 10px; }
-.opp-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
-.opp-meta { font-size: 11px; color: var(--text-secondary); }
-.opp-status { font-size: 10px; padding: 3px 8px; border-radius: 10px; }
-.opp-status.negotiation { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
-.opp-status.proposal { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
-.opp-status.won { background: rgba(16, 185, 129, 0.2); color: var(--success); }
-.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); z-index: 2000; }
-.toast.success { border-color: var(--success); }
-.toast.success i { color: var(--success); }
-.toast-enter-active, .toast-leave-active { transition: all 0.3s ease; }
-.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(20px); }
-
-.icon-spin {
-  animation: spin 1s linear infinite !important;
-}
-@keyframes spin {
-  0% { transform: rotate(0deg); }
-  100% { transform: rotate(360deg); }
-}
+@import '../assets/styles/customer.css';
 </style>

+ 1 - 1
ui/smarttrade-platform/src/views/MarketingView.vue

@@ -912,7 +912,7 @@ const openAIGenerator = (campaign) => {
   let time = campaign.updateTime || campaign.createTime
   // time跟当前时间比,小于20分钟的话,暂时不让操作
   if (new Date().getTime() - new Date(time).getTime() < 20 * 60 * 1000) {
-    ElMessage.error('邮件正在生成中,请稍后操作')
+    ElMessage.error('邮件序列正在初始化,请稍后编辑模板')
     return
   }
   selectedCampaign.value = campaign