Browse Source

修复订单

yanjie 4 years ago
parent
commit
893e387b71
2 changed files with 22 additions and 11 deletions
  1. 21 10
      mini/components/out-order-item/index.js
  2. 1 1
      mini/components/out-order-item/index.wxml

+ 21 - 10
mini/components/out-order-item/index.js

xqd xqd xqd
@@ -5,6 +5,17 @@ Component({
   /**
    * 组件的属性列表
    */
+  lifetimes: {
+    attached: function () {
+      // 在组件实例进入页面节点树时执行
+      this.setData({
+        user_id: wx.getStorageSync('sg-userinfo').id
+      })
+    },
+    detached: function () {
+      // 在组件实例被从页面节点树移除时执行
+    },
+  },
   properties: {
     item: Object,
     role: Object,
@@ -18,43 +29,43 @@ Component({
    * 组件的初始数据
    */
   data: {
-
+    user_id: ""
   },
-  
+
 
   /**
    * 组件的方法列表
    */
   methods: {
-    navigate: function(e) {
+    navigate: function (e) {
       wx.navigateTo({
         url: e.currentTarget.dataset.url,
       })
     },
-    doAction: function(e) {
+    doAction: function (e) {
       var type = e.currentTarget.dataset.type
       var that = this
       var order = e.currentTarget.dataset.order
-      if(type == 'edit' || type == 'detail') {
+      if (type == 'edit' || type == 'detail') {
         this.navigate(e)
-      } else if(type == 'confirm') {
+      } else if (type == 'confirm') {
         Dialog.confirm({
           title: '提示',
           message: '确定订单吗',
         })
           .then(() => {
             that.submitCheck(order)
-          }).catch(()=>{
+          }).catch(() => {
             Dialog.close()
           })
-      } else if(type == 'delete') {
+      } else if (type == 'delete') {
         Dialog.confirm({
           title: '提示',
           message: '确定删除订单吗',
         })
           .then(() => {
             that.delete(order)
-          }).catch(()=>{
+          }).catch(() => {
             Dialog.close()
           })
       }
@@ -74,7 +85,7 @@ Component({
         }
       })
     },
-  
+
     submitCheck(order) {
       var that = this
       http({

+ 1 - 1
mini/components/out-order-item/index.wxml

xqd
@@ -34,7 +34,7 @@
         <view class="sg-right sg-green-bg sg-pad-sm sg-white sg-font-xs" catchtap="doAction" data-type="confirm"
           data-order="{{item}}">确认订单</view>
       </block>
-      <block wx:elif="{{item.status_key=='reject'}}">
+      <block wx:elif="{{item.status_key=='reject'&&user_id==item.user_id}}">
         <view class="sg-right sg-red-bg sg-pad-sm sg-white sg-font-xs" catchtap="doAction" data-type="edit"
           data-url="/pages/create-order/index?id={{item.project_id}}&order_id={{item.id}}&type=edit">
           重新修订</view>