소스 검색

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))