Преглед изворни кода

change: indent 计价按商品数量大小排序.

peter пре 1 недеља
родитељ
комит
ce2f26dde7
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      src/pages/indent-manage/indent/components/calcPrice/index.vue

+ 4 - 1
src/pages/indent-manage/indent/components/calcPrice/index.vue

@@ -942,7 +942,10 @@ let initProductInfo = () => {
   if (temp.price_list && temp.price_list.length > 2) {
     const t = JSON.parse(temp.price_list)
 
-    t.forEach((item: any) => {
+    // temp.number 按数量从小到大排序
+    t.sort(
+      (a: any, b: any) => parseFloat(a.number) - parseFloat(b.number),
+    ).forEach((item: any) => {
       temp.number.push(parseFloat(item.number))
       temp.price.push(parseFloat(item.price))
       temp.days.push(parseFloat(item.days))