浏览代码

[Fix] Sort order in goods list

Ark 4 年之前
父节点
当前提交
992c403a90
共有 1 个文件被更改,包括 5 次插入8 次删除
  1. 5 8
      src/api/controller/goods.js

+ 5 - 8
src/api/controller/goods.js

@@ -148,19 +148,16 @@ module.exports = class extends Base {
     }
 
     // 排序
-    let orderMap = {};
+    const orderMap = {
+      sort_order: 'desc'
+    };
     if (sort === 'price') {
       // 按价格
-      orderMap = {
-        retail_price: order
-      };
+      orderMap['retail_price'] = 'order';
     } else {
       // 按商品添加时间
-      orderMap = {
-        id: 'desc'
-      };
+      orderMap['id'] = 'desc';
     }
-    orderMap['sort_order'] = 'desc';
 
     // 筛选的分类
     let filterCategory = [{