LaveyD 2 hónapja
szülő
commit
0f1bc722f1

+ 1 - 1
src/views/goodsCenter/priceList.vue

@@ -395,7 +395,7 @@
 
     <ElDialog
       :title="dialogType === 'add' ? '创建产品' : '编辑产品'"
-      width="800px"
+      width="1000px"
       v-model="dialogVisible">
       <EditDialog
         :perform-list="performList"

+ 33 - 10
src/views/goodsCenter/priceList/EditDialog.vue

@@ -20,7 +20,7 @@
           <el-option
             v-for="item in ticketTypeList"
             :key="item.id"
-            :label="`${item.ticketTypeId}-${item.name}-${CategoryDict[item.category] || ''}`"
+            :label="getTicketTypeLabel(item)"
             :value="item.ticketTypeId"></el-option>
         </el-select>
       </el-form-item>
@@ -604,7 +604,7 @@ export default {
     },
     // 判断是否是场次票
     isBatchTicket () {
-      return this.currentTicketType.category === 'batch'
+      return this.currentTicketType.category === 'batch' || this.currentTicketType.category === 'ticket'
     },
     // 当前票种的场次列表
     currentBatchConfigList () {
@@ -678,14 +678,26 @@ export default {
           this.form.otaSourceIds = this.form.otaSourceId ? [this.form.otaSourceId] : []
           // 处理美团场次票数据回填
           if (this.currentItem.mtProductLevelList && this.currentItem.mtProductLevelList.length > 0) {
-            this.form.mtProductLevelRequests = this.currentItem.mtProductLevelList.map(item => ({
-              batchConfigId: item.batchConfigId,
-              marketPrice: item.marketPrice,
-              mtPrice: item.mtPrice,
-              settlementPrice: item.settlementPrice,
-              startDate: item.priceDate ? item.priceDate.split(' - ')[0] : '',
-              endDate: item.priceDate ? item.priceDate.split(' - ')[1] : ''
-            }))
+            this.form.mtProductLevelRequests = this.currentItem.mtProductLevelList.map(item => {
+              // priceDate 格式可能是 "2026-03-29~2027-03-29" 或 "2026-03-29 - 2027-03-29"
+              let startDate = ''
+              let endDate = ''
+              if (item.priceDate) {
+                // 兼容 ~ 和 - 两种分隔符
+                const separator = item.priceDate.includes('~') ? '~' : ' - '
+                const dates = item.priceDate.split(separator)
+                startDate = dates[0] ? dates[0].trim() : ''
+                endDate = dates[1] ? dates[1].trim() : ''
+              }
+              return {
+                batchConfigId: item.batchConfigId,
+                marketPrice: item.marketPrice,
+                mtPrice: item.mtPrice,
+                settlementPrice: item.settlementPrice,
+                startDate: startDate,
+                endDate: endDate
+              }
+            })
           } else {
             this.form.mtProductLevelRequests = []
           }
@@ -732,6 +744,17 @@ export default {
     }
   },
   methods: {
+    // 生成票种选项标签
+    getTicketTypeLabel (item) {
+      const category = this.CategoryDict[item.category] || ''
+      let label = `${item.ticketTypeId}-${item.name}-${category}`
+      // 只有场次票才显示场次信息
+      if (item.category === 'batch') {
+        const hasBatch = item.batchConfigList && item.batchConfigList.length > 0 ? '有场次' : '无场次'
+        label += `--${hasBatch}`
+      }
+      return label
+    },
     getScenicList () {
       getScenicList().then(res => {
         this.scenicList = res.data || []