Explorar o código

feat(web-admin): split archive qty vs price display flags

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu hai 1 mes
pai
achega
af0ae031a5

+ 16 - 9
web-admin/src/components/business/pl-plan-archive-brand-view-block/index.vue

@@ -19,16 +19,16 @@
             <tr>
               <th>品牌</th>
               <th class="is-num">实际数量</th>
-              <th class="is-num">单价(元)</th>
-              <th class="is-num">金额(元)</th>
+              <th v-if="showPrice" class="is-num">单价(元)</th>
+              <th v-if="showPrice" class="is-num">金额(元)</th>
             </tr>
           </thead>
           <tbody>
             <tr v-for="brandRow in item.rows" :key="brandRow.brandId">
               <td>{{ brandRow.brandName || '—' }}</td>
               <td class="is-num">{{ formatQty(brandRow.qty) }}</td>
-              <td class="is-num">{{ formatPrice(brandRow.price) }}</td>
-              <td class="is-num pl-archive-brand-table__amount">
+              <td v-if="showPrice" class="is-num">{{ formatPrice(brandRow.price) }}</td>
+              <td v-if="showPrice" class="is-num pl-archive-brand-table__amount">
                 {{ formatArchiveBrandAmount(brandRow.qty, brandRow.price) }}
               </td>
             </tr>
@@ -37,8 +37,8 @@
             <tr>
               <td>合计</td>
               <td class="is-num">{{ formatQty(sumQty(item.rows)) }}</td>
-              <td class="is-num">—</td>
-              <td class="is-num">{{ formatAmountTotal(item.rows) }}</td>
+              <td v-if="showPrice" class="is-num">—</td>
+              <td v-if="showPrice" class="is-num">{{ formatAmountTotal(item.rows) }}</td>
             </tr>
           </tfoot>
         </table>
@@ -55,9 +55,16 @@
   } from '@/utils/pl-plan-archive-brand-view'
   import { useDictStore } from '@/store/modules/dict'
 
-  defineProps<{
-    items: ArchiveBrandViewItem[]
-  }>()
+  withDefaults(
+    defineProps<{
+      items: ArchiveBrandViewItem[]
+      /** 是否展示单价/金额列;默认 true */
+      showPrice?: boolean
+    }>(),
+    {
+      showPrice: true
+    }
+  )
 
   const dictStore = useDictStore()
 

+ 44 - 37
web-admin/src/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue

@@ -173,7 +173,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          v-if="showArchiveIoFields && !archiveIoOutboundOnly"
+          v-if="showArchiveIoFields && showArchivePriceFields && !archiveIoOutboundOnly"
           :label="archiveSegmentLabels ? '单价(元)' : '入库单价(元)'"
           min-width="120"
           align="right"
@@ -191,7 +191,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          v-if="showArchiveIoFields && !archiveIoOutboundOnly"
+          v-if="showArchiveIoFields && showArchivePriceFields && !archiveIoOutboundOnly"
           :label="archiveSegmentLabels ? '金额(元)' : '入库金额'"
           min-width="110"
           align="right"
@@ -219,7 +219,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          v-if="showArchiveIoFields && !archiveIoInboundOnly"
+          v-if="showArchiveIoFields && showArchivePriceFields && !archiveIoInboundOnly"
           :label="archiveSegmentLabels ? '单价(元)' : '出库单价(元)'"
           min-width="120"
           align="right"
@@ -237,7 +237,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          v-if="showArchiveIoFields && !archiveIoInboundOnly"
+          v-if="showArchiveIoFields && showArchivePriceFields && !archiveIoInboundOnly"
           :label="archiveSegmentLabels ? '金额(元)' : '出库金额'"
           min-width="110"
           align="right"
@@ -358,39 +358,46 @@
   import DictSelect from '@/components/DictSelect/index.vue'
   import { useDictStore } from '@/store/modules/dict'
 
-  const props = defineProps<{
-    products: PlanFormProductRow[]
-    showDelete?: boolean
-    showSelect?: boolean
-    /** 已加入运输计划的产品 ID,用于禁用合同预览中的「选择」按钮 */
-    selectedProductIds?: string[]
-    editableRemark?: boolean
-    editableQty?: boolean
-    /** 产品信息区:别名 / 品牌可改 */
-    editableAliasBrand?: boolean
-    /** 单位 / 包装规格 / 送货方式可下拉编辑(对齐报价单) */
-    editablePackageDelivery?: boolean
-    /** 新增/编辑弹窗默认不展示实际数量 */
-    showActualQty?: boolean
-    /** 展示归档品牌数量摘要(如:君正 12 / 红四方 13) */
-    showBrandQty?: boolean
-    /** 仅实际数量可编辑,计划数量只读(归档弹窗) */
-    editableActualQtyOnly?: boolean
-    /** 展示入库/出库数量列(不含价格) */
-    showInboundOutboundQty?: boolean
-    /** 展示入库/出库数量、单价与计算金额列 */
-    showArchiveIoFields?: boolean
-    /** 入库/出库数量与价格可编辑(归档弹窗) */
-    editableArchiveIoFields?: boolean
-    /** 归档:仅展示/编辑入库列(装货段) */
-    archiveIoInboundOnly?: boolean
-    /** 归档:仅展示/编辑出库列(送货段) */
-    archiveIoOutboundOnly?: boolean
-    /** 段次归档:入库/出库列统一展示为实际数量、单价、金额 */
-    archiveSegmentLabels?: boolean
-    /** 归档段表单:仅保留产品名称、单位、计划数量与归档列 */
-    archiveCompact?: boolean
-  }>()
+  const props = withDefaults(
+    defineProps<{
+      products: PlanFormProductRow[]
+      showDelete?: boolean
+      showSelect?: boolean
+      /** 已加入运输计划的产品 ID,用于禁用合同预览中的「选择」按钮 */
+      selectedProductIds?: string[]
+      editableRemark?: boolean
+      editableQty?: boolean
+      /** 产品信息区:别名 / 品牌可改 */
+      editableAliasBrand?: boolean
+      /** 单位 / 包装规格 / 送货方式可下拉编辑(对齐报价单) */
+      editablePackageDelivery?: boolean
+      /** 新增/编辑弹窗默认不展示实际数量 */
+      showActualQty?: boolean
+      /** 展示归档品牌数量摘要(如:君正 12 / 红四方 13) */
+      showBrandQty?: boolean
+      /** 仅实际数量可编辑,计划数量只读(归档弹窗) */
+      editableActualQtyOnly?: boolean
+      /** 展示入库/出库数量列(不含价格) */
+      showInboundOutboundQty?: boolean
+      /** 展示入库/出库数量、单价与计算金额列 */
+      showArchiveIoFields?: boolean
+      /** 归档查看/表单:展示单价与金额列;默认 true(兼容旧用法) */
+      showArchivePriceFields?: boolean
+      /** 入库/出库数量与价格可编辑(归档弹窗) */
+      editableArchiveIoFields?: boolean
+      /** 归档:仅展示/编辑入库列(装货段) */
+      archiveIoInboundOnly?: boolean
+      /** 归档:仅展示/编辑出库列(送货段) */
+      archiveIoOutboundOnly?: boolean
+      /** 段次归档:入库/出库列统一展示为实际数量、单价、金额 */
+      archiveSegmentLabels?: boolean
+      /** 归档段表单:仅保留产品名称、单位、计划数量与归档列 */
+      archiveCompact?: boolean
+    }>(),
+    {
+      showArchivePriceFields: true
+    }
+  )
 
   const emit = defineEmits<{
     remove: [index: number]

+ 5 - 1
web-admin/src/components/business/pl-plan-transport-feedback-blocks/index.vue

@@ -10,6 +10,7 @@
         show-actual-qty
         show-brand-qty
         :show-archive-io-fields="showArchiveIoFields"
+        :show-archive-price-fields="showArchivePriceFields"
         :show-inbound-outbound-qty="!showArchiveIoFields"
       />
     </section>
@@ -447,8 +448,10 @@
   const props = withDefaults(
     defineProps<{
       feedbackEditable?: boolean
-      /** 仅运输计划归档:展示入库/出库单价与金额 */
+      /** 仅运输计划归档:展示入库/出库数量(及默认跟随的价格) */
       showArchiveIoFields?: boolean
+      /** 归档查看:展示单价与金额;未传时跟随 showArchiveIoFields */
+      showArchivePriceFields?: boolean
       /** 司机/出库单回传「实际数量」后展示仅供参考说明 */
       showActualQtyDisclaimer?: boolean
       loading?: boolean
@@ -494,6 +497,7 @@
     {
       feedbackEditable: false,
       showArchiveIoFields: false,
+      showArchivePriceFields: undefined,
       showActualQtyDisclaimer: false,
       loading: false,
       canEditDriverFeedback: false,

+ 4 - 1
web-admin/src/components/business/pl-plan-view-dialog/index.vue

@@ -36,6 +36,7 @@
       :arrange-driver-url="driverUrl"
       :arrange-site-records="siteRecords"
       :show-archive-io-fields="showArchiveIoFields"
+      :show-archive-price-fields="showArchivePriceFields"
       :show-inbound-outbound-qty="showInboundOutboundQty"
     />
 
@@ -67,8 +68,10 @@
   const props = defineProps<{
     visible: boolean
     planId?: string
-    /** 仅运输计划归档:展示入库/出库单价与金额 */
+    /** 仅运输计划归档:展示入库/出库数量(及默认跟随的价格) */
     showArchiveIoFields?: boolean
+    /** 归档查看:展示单价与金额;未传时跟随 showArchiveIoFields */
+    showArchivePriceFields?: boolean
     /** 计划概况产品表:展示入库/出库数量(不含单价与金额) */
     showInboundOutboundQty?: boolean
   }>()

+ 36 - 18
web-admin/src/components/business/pl-plan-view-tabs/index.vue

@@ -116,13 +116,14 @@
                 :products="loadView.products"
                 compact
                 show-stop-actual-qty
-                :show-stop-archive-price="showArchiveIoFields"
+                :show-stop-archive-price="effectiveShowArchivePrice"
                 stop-archive-mode="load"
               />
               <p v-else class="pl-plan-form-empty-hint">暂无装货产品</p>
               <PlPlanArchiveBrandViewBlock
                 v-if="showArchiveIoFields"
                 :items="loadArchiveBrandItems"
+                :show-price="effectiveShowArchivePrice"
               />
               <PlPlanStopFeedbackPanel
                 v-if="showStopFeedback && !feedbackMirrorTo"
@@ -200,13 +201,14 @@
                 :products="delivery.products"
                 compact
                 show-stop-actual-qty
-                :show-stop-archive-price="showArchiveIoFields"
+                :show-stop-archive-price="effectiveShowArchivePrice"
                 stop-archive-mode="delivery"
               />
               <p v-else class="pl-plan-form-empty-hint">暂无送货产品</p>
               <PlPlanArchiveBrandViewBlock
                 v-if="showArchiveIoFields"
                 :items="deliveryArchiveBrandItems(delivery, index)"
+                :show-price="effectiveShowArchivePrice"
               />
               <PlPlanStopFeedbackPanel
                 v-if="showStopFeedback && !feedbackMirrorTo"
@@ -492,8 +494,10 @@
       hideNav?: boolean
       /** 受控当前 Tab:overview / transport */
       tab?: string
-      /** 仅运输计划归档:展示入库/出库单价与金额 */
+      /** 仅运输计划归档:展示入库/出库数量(及默认跟随的价格) */
       showArchiveIoFields?: boolean
+      /** 归档查看:展示单价与金额;未传时跟随 showArchiveIoFields */
+      showArchivePriceFields?: boolean
       /** 司机/出库单回传「实际数量」后展示仅供参考说明 */
       showActualQtyDisclaimer?: boolean
       /** 计划概况产品表:展示入库/出库数量(不含单价与金额) */
@@ -509,11 +513,16 @@
       hideNav: false,
       tab: undefined,
       showArchiveIoFields: false,
+      showArchivePriceFields: undefined,
       showActualQtyDisclaimer: false,
       showInboundOutboundQty: false
     }
   )
 
+  const effectiveShowArchivePrice = computed(
+    () => props.showArchivePriceFields ?? props.showArchiveIoFields
+  )
+
   const emit = defineEmits<{
     'update:tab': [value: string]
   }>()
@@ -1383,6 +1392,7 @@
   const feedbackBlocksBind = computed(() => ({
     feedbackEditable: props.feedbackEditable,
     showArchiveIoFields: props.showArchiveIoFields,
+    showArchivePriceFields: effectiveShowArchivePrice.value,
     showActualQtyDisclaimer: props.showActualQtyDisclaimer,
     loading: loading.value,
     canEditDriverFeedback: canEditDriverFeedback.value,
@@ -1487,9 +1497,10 @@
     const hasFreight = plan.value?.hasFreight === 1
     const unit = freightUnitLabel.value
     const isByWeight = hasFreight && displayFreightType.value === 'by_weight'
+    const hideArchiveMoney = props.showArchiveIoFields && !effectiveShowArchivePrice.value
 
     // long: false — 强制七字段同一行展示
-    return [
+    const fields: ViewField[] = [
       { label: '是否有运输费用', value: getPlYesNoLabel(plan.value?.hasFreight), long: false },
       { label: '运输公里数', value: hasFreight ? displayDistanceKm.value : '—', long: false },
       {
@@ -1501,25 +1512,32 @@
         label: `运输量(${unit})`,
         value: isByWeight ? displayTransportQty.value : '—',
         long: false
-      },
-      {
-        label: `运输单价(元/${unit})`,
-        value: isByWeight ? displayFreightPrice.value : '—',
-        money: isByWeight,
-        long: false
-      },
-      {
-        label: '运费金额(元)',
-        value: hasFreight ? displayFreightAmount.value : '—',
-        money: hasFreight,
-        long: false
-      },
+      }
+    ]
+    if (!hideArchiveMoney) {
+      fields.push(
+        {
+          label: `运输单价(元/${unit})`,
+          value: isByWeight ? displayFreightPrice.value : '—',
+          money: isByWeight,
+          long: false
+        },
+        {
+          label: '运费金额(元)',
+          value: hasFreight ? displayFreightAmount.value : '—',
+          money: hasFreight,
+          long: false
+        }
+      )
+    }
+    fields.push(
       { label: '是否开票', value: hasFreight ? displayHasInvoiceLabel.value : '—', long: false },
       {
         label: '运费备注',
         value: hasFreight ? plan.value?.freightRemark?.trim() || '—' : '—'
       }
-    ]
+    )
+    return fields
   })
 
   /** 危化证区域展示 CRM 标准名(productRows 已回填 standardProductName;库内 productName 可能是别名) */