Jelajahi Sumber

套餐档位支持挂载多条成本项且成本项不受订阅引用锁定:原先套餐档只有价格、额度、带宽等销售参数,成本口径散落在「分成与成本」里,无法看出某一档卖出去对应多少月度成本,且档位一旦被订阅引用整张表单全部禁用,连只影响成本核算的字段也改不动;现在在新增与修改套餐的弹窗(改为 wide 宽度)中增加 .pkg-costs 成本项区块,名称通过下拉直接选取「分成与成本」的成本项列表(pkgCostCatalog 按名称去重取金额),选中即带出按月计的默认金额且可手工修改,支持增删多条(data-pkg-cost-add / data-pkg-cost-del 走事件委托,pkgCostSync 把行内输入实时镜像回 modal.costRows 以免重渲染丢失),保存时在 saveModal 中统一收集并校验空名、非法金额与重复名称后写入 costs 字段;同时把成本项与套餐名称、套餐说明一起从引用锁定中豁免(packageRefCount > 0 时仍锁年价、额度、带宽、用途分类与归属客户),并同步修正弹窗标题 tooltip、表单说明与保存 toast 的措辞,避免界面继续宣称成本项不可改。附带三处交互修正:套餐目录页去掉页头大段说明与表下方长 note,只保留档位计数与被引用后的可改范围一句,layout 在 hint 为空时不再输出空 p 标签;styles.css 把 .modal textarea 纳入 max-width: 100% 覆盖,使套餐说明多行文本框跟随弹窗宽度而不再被全局 560px 上限卡住;上行/下行带宽去掉 bw-pair 独占整行的容器,与分账号额度同为 .form-grid 直接子项排在同一行,并删除已无引用的 .form-grid .bw-pair 规则。data.js 补充 costs 字段注释与两处示例数据。

cg 1 bulan lalu
induk
melakukan
fb2e171c81
3 mengubah file dengan 77 tambahan dan 28 penghapusan
  1. 60 17
      prototype/app.js
  2. 4 3
      prototype/data.js
  3. 13 8
      prototype/styles.css

File diff ditekan karena terlalu besar
+ 60 - 17
prototype/app.js


+ 4 - 3
prototype/data.js

@@ -166,18 +166,19 @@ const SEED = {
      cat 为用途分类,目录按它分组;desc 为报价单权益口径。
      报价单按月报价,首期只做按年订阅,年订阅价格 = 月价 × 12。
      分账号额度报价单未给出,按用途推定(办公档 10;直播 A 单链接单流 2、B 单链接多流 5、C 顶配 10;
-     AI 5M 档 3、10M 档 5;按个叠加的增值项不占额度记 0),运营可在目录内直接改。 */
+     AI 5M 档 3、10M 档 5;按个叠加的增值项不占额度记 0),运营可在目录内直接改。
+     costs 为该档位随附的成本项(按月计):名称取自「分成与成本」的成本项列表,金额默认沿用列表值、可在套餐档上改写。 */
   packages: [
     { name: "跨境办公 · 基础档", cat: "通用办公", yearPrice: 1080, monthPrice: 90, quota: 10, bw: "不承诺带宽", desc: "一般访问流量,无固定境外 IP,不承诺带宽", custom: null },
     { name: "跨境办公 · 标准档", cat: "通用办公", yearPrice: 1440, monthPrice: 120, quota: 10, bw: "下行 10M / 上行 1M", desc: "店铺管理、一般办公、视频会议、ERP 等,比基础档速度更快更稳定", custom: null },
-    { name: "跨境办公 · 独立 IP 档", cat: "通用办公", yearPrice: 1920, monthPrice: 160, quota: 10, bw: "下行 5M / 上行 2M", desc: "单独境外 IP 配置,通过 CPE 组织网络管理平台", custom: null },
+    { name: "跨境办公 · 独立 IP 档", cat: "通用办公", yearPrice: 1920, monthPrice: 160, quota: 10, bw: "下行 5M / 上行 2M", desc: "单独境外 IP 配置,通过 CPE 组织网络管理平台", custom: null, costs: [{ name: "国家 IP 地址月摊销", amount: 50 }] },
     { name: "直播高需求 · A 类", cat: "直播高需求", yearPrice: 10800, monthPrice: 900, quota: 2, bw: "上下行 10M", desc: "单链接、单流;单独境外 IP 另购,80 元/个", custom: null },
     { name: "直播高需求 · B 类", cat: "直播高需求", yearPrice: 32400, monthPrice: 2700, quota: 5, bw: "上下行 30M", desc: "单链接、多流;团队内部运营如后台管理、看播等已包含", custom: null },
     { name: "直播高需求 · C 类", cat: "直播高需求", yearPrice: 62400, monthPrice: 5200, quota: 10, bw: "上下行 50M", desc: "直播高需求顶配档;链接数与流数按合同另定", custom: null },
     { name: "AI 应用 · 5M 档", cat: "AI 应用", yearPrice: 5760, monthPrice: 480, quota: 3, bw: "上下行 5M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null },
     { name: "AI 应用 · 10M 档", cat: "AI 应用", yearPrice: 10800, monthPrice: 900, quota: 5, bw: "上下行 10M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null },
     { name: "单独境外 IP(按个叠加)", cat: "叠加增值", yearPrice: 960, monthPrice: 80, quota: 0, bw: "按个计,不占带宽", desc: "80 元/个/月,与主档叠加订阅、各自计费;个数与单价在订阅上按合同改写", custom: null },
-    { name: "临港 ICT 定制套餐", cat: "定制化", yearPrice: 24000, monthPrice: 2000, quota: 8, bw: "150Mbps", desc: "使用规模 30 人及以上,业务分析与需求摸排调研后定制;临港跨境贸易专项档", custom: 1 },
+    { name: "临港 ICT 定制套餐", cat: "定制化", yearPrice: 24000, monthPrice: 2000, quota: 8, bw: "150Mbps", desc: "使用规模 30 人及以上,业务分析与需求摸排调研后定制;临港跨境贸易专项档", custom: 1, costs: [{ name: "国际出口带宽月摊销", amount: 80 }, { name: "国际云主机月摊销", amount: 30 }] },
   ],
   /* 订阅一律按名称引用「套餐目录」中的档位,签约时把目录价冻结到订阅上(目录改价不影响存量订阅)。
      示例覆盖全部用途分类:通用办公(基础 / 标准 / 独立 IP 档)、直播高需求(A 类)、AI 应用(5M 档)、

+ 13 - 8
prototype/styles.css

@@ -261,13 +261,17 @@ textarea { min-height: 88px; max-width: 560px; }
 .f-err { display: block; margin-top: 3px; font-size: 12px; color: var(--red); }
 .form-grid .form-actions { grid-column: 1 / -1; }
 
-/* 上 / 下行带宽:独占一行,两个输入框在行内水平排布(窄弹窗单列时也不会溢出) */
-.form-grid .bw-pair {
-  grid-column: 1 / -1;
-  display: grid;
-  grid-template-columns: 1fr 1fr;
-  gap: 0 12px;
-}
+/* 套餐档弹窗的成本项:名称下拉取自「分成与成本」成本项列表,金额按月计可改,可加多条、逐条删除 */
+.form-grid .pkg-costs { grid-column: 1 / -1; margin-top: 10px; }
+.pkg-costs-head {
+  display: flex; align-items: center; justify-content: space-between;
+  gap: 10px; flex-wrap: wrap;
+}
+.pkg-costs-head .btn { padding: 5px 12px; font-size: 13px; }
+.pkg-cost-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
+.pkg-cost-row select { flex: 1 1 auto; min-width: 0; }
+.pkg-cost-row input { flex: 0 0 auto; width: 120px; max-width: 120px; }
+.pkg-cost-row .pkg-cost-unit { flex: 0 0 auto; white-space: nowrap; }
 
 /* 开关(二态表单):checkbox 隐藏,用 .track 画滑块 */
 label.switch {
@@ -626,7 +630,8 @@ input:focus, select:focus, textarea:focus {
 }
 .modal h3 { font-size: 17px; margin-bottom: 10px; }
 .modal label { margin-top: 2px; }
-.modal input, .modal select { max-width: 100%; }
+/* 弹窗内的编辑项跟随弹窗宽度,不再受全局 420/560 上限约束(多行文本框同样撑满所在列) */
+.modal input, .modal select, .modal textarea { max-width: 100%; }
 /* 字段较多的新增/编辑表单(客户档案、订阅)用宽弹窗 */
 .modal.wide { max-width: 760px; }
 /* 新增客户字段最多(含客户主账号),再加宽一档 */

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini