Browse Source

处理移动端卖家订单问题

yangc 7 years ago
parent
commit
3c3f18ba7d
2 changed files with 14 additions and 10 deletions
  1. 12 10
      pages/mobile/order/index.vue
  2. 2 0
      store/order.js

+ 12 - 10
pages/mobile/order/index.vue

@@ -838,18 +838,20 @@
       },
       // 买卖家中心字段同步化
       _initSetParams(_obj) {
-        _obj = this.baseUtils.deepCopy(_obj)
-        for (let i = 0; i < _obj.length; i++) {
-          if (!_obj[i].purchaseDetails) {
-            _obj[i].purchaseDetails = _obj[i].orderDetails
-          }
-          if (_obj[i].status === 505 || _obj[i].status === 406 || _obj[i].status === 407 || _obj[i].status === 403 || _obj[i].status === 408) {
-            // _obj[i].paidTimeFromNow = this._getHoursFromNow(_obj[i].paytime)
-            // _obj[i].lastNotiDelivery = this._getHoursFromNow(_obj[i].lastNotifyDeliveryTime)
+        if (_obj) {
+          _obj = this.baseUtils.deepCopy(_obj)
+          for (let i = 0; i < _obj.length; i++) {
+            if (!_obj[i].purchaseDetails) {
+              _obj[i].purchaseDetails = _obj[i].orderDetails
+            }
+            if (_obj[i].status === 505 || _obj[i].status === 406 || _obj[i].status === 407 || _obj[i].status === 403 || _obj[i].status === 408) {
+              // _obj[i].paidTimeFromNow = this._getHoursFromNow(_obj[i].paytime)
+              // _obj[i].lastNotiDelivery = this._getHoursFromNow(_obj[i].lastNotifyDeliveryTime)
+            }
+            _obj[i].showItem = _obj[i].purchaseDetails.length > 3 ? 3 : _obj[i].purchaseDetails.length
           }
-          _obj[i].showItem = _obj[i].purchaseDetails.length > 3 ? 3 : _obj[i].purchaseDetails.length
         }
-        return _obj
+        return _obj || []
       },
       // 传入时间,计算距离现在的时间是多少小时了
       _getHoursFromNow(time) {

+ 2 - 0
store/order.js

@@ -8,6 +8,7 @@ export const actions = {
       .then(response => {
         commit('order/GET_ORDERLIST_SUCCESS', response.data)
       }, err => {
+        commit('order/GET_ORDERLIST_SUCCESS', {})
         commit('order/GET_ORDERLIST_FAILURE', err)
       })
   },
@@ -18,6 +19,7 @@ export const actions = {
       .then(response => {
         commit('order/GET_ORDERLIST_SUCCESS', response.data)
       }, err => {
+        commit('order/GET_ORDERLIST_SUCCESS', {})
         commit('order/GET_ORDERLIST_FAILURE', err)
       })
   },