Browse Source

交期显示改动及帮助中心排序。

ouxq 8 years ago
parent
commit
8baa62524b

+ 12 - 12
components/help/left.vue

@@ -16,17 +16,11 @@
 </template>
 <script>
   // 升序
-  function compare (propertyName) {
-    return function (object1, object2) {
-      let value1 = object1[propertyName]
-      let value2 = object2[propertyName]
-      if (value1 > value2) {
-        return 1
-      } else if (value1 > value2) {
-        return -1
-      } else {
-        return 0
-      }
+  function compare (property) {
+    return function (a, b) {
+      var value1 = a[property]
+      var value2 = b[property]
+      return value1 - value2
     }
   }
   export default {
@@ -41,7 +35,13 @@
     },
     computed: {
       helps () {
-        return this.$store.state.help.snapsho.data.sort(compare('detno'))
+        let list = this.$store.state.help.snapsho.data.sort(compare('detno'))
+        if (list) {
+          for (let i = 0; i < list.length; i++) {
+            list[i].children = list[i].children.sort(compare('detno'))
+          }
+        }
+        return list
       }
     },
     methods: {

+ 5 - 1
components/search/GoodList.vue

@@ -115,7 +115,11 @@
               <div v-show="!item.b2cMinDelivery">
                 <span>—</span>
               </div>
-              <div v-if="item.b2cMinDelivery">交期: <span v-text="item.b2cMinDelivery + '-' + item.b2cMaxDelivery"></span></div>
+              <div v-if="item.b2cMinDelivery">交期:
+                <!--<span v-text="item.b2cMinDelivery + '-' + item.b2cMaxDelivery"></span>-->
+                <span v-if="item.b2cMinDelivery != item.b2cMaxDelivery" v-text="item.b2cMinDelivery + '-' + item.b2cMaxDelivery"></span>
+                <span v-if="item.b2cMinDelivery == item.b2cMaxDelivery" v-text="item.b2cMinDelivery"></span>
+              </div>
             </td>
             <td>
               <div v-show="!item.reserve">

+ 6 - 2
components/store/CommodityList.vue

@@ -37,7 +37,7 @@
             <th width="90">数量</th>
             <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
             <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>
-            <th width="100">交期</th>
+            <th width="100">交期(天)</th>
             <th width="100">操作</th>
           </tr>
           </thead>
@@ -83,7 +83,11 @@
               <div v-for="price in commodity.prices" v-text="price.rMBPrice"></div>
             </td>
             <td>
-              <div v-if="commodity.b2cMinDelivery">交期:{{commodity.b2cMinDelivery || 0}}-{{commodity.b2cMaxDelivery || 0}}天</div>
+              <div v-if="commodity.b2cMinDelivery">交期:
+                <!--{{commodity.b2cMinDelivery || 0}}-{{commodity.b2cMaxDelivery || 0}}天-->
+                <span v-if="commodity.b2cMinDelivery != commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery + '-' + commodity.b2cMaxDelivery"></span>
+                <span v-if="commodity.b2cMinDelivery == commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery"></span>
+              </div>
             </td>
             <td>
               <buy :item="commodity"></buy>

+ 5 - 11
pages/help/helpList/_id.vue

@@ -36,17 +36,11 @@
 </template>
 <script>
   // 升序
-  function compare (propertyName) {
-    return function (object1, object2) {
-      let value1 = object1[propertyName]
-      let value2 = object2[propertyName]
-      if (value1 > value2) {
-        return 1
-      } else if (value1 < value2) {
-        return -1
-      } else {
-        return 0
-      }
+  function compare (property) {
+    return function (a, b) {
+      var value1 = a[property]
+      var value2 = b[property]
+      return value1 - value2
     }
   }
   import { left, helpHeader } from '~components/help'

+ 15 - 1
pages/help/home.vue

@@ -31,6 +31,14 @@
   </div>
 </template>
 <script>
+  // 升序
+  function compare (property) {
+    return function (a, b) {
+      var value1 = a[property]
+      var value2 = b[property]
+      return value1 - value2
+    }
+  }
   import { left, helpHeader } from '~components/help'
   export default {
     name: 'help',
@@ -45,7 +53,13 @@
     },
     computed: {
       helpNav () {
-        return this.$store.state.help.snapsho.data
+        let list = this.$store.state.help.snapsho.data.sort(compare('detno'))
+        if (list) {
+          for (let i = 0; i < list.length; i++) {
+            list[i].children = list[i].children.sort(compare('detno'))
+          }
+        }
+        return list
       }
     }
   }