linwenxin 4 mēneši atpakaļ
vecāks
revīzija
e41dbc233c

+ 209 - 0
src/packageWorkorder/pages/mixins/orderBtnsShow.js

@@ -0,0 +1,209 @@
+import { getStorage } from '@/common/utils/storage.js'
+export default {
+  methods: {
+    isTodayOrYesterday(timeString) {
+      const date = new Date(timeString)
+      const now = new Date()
+
+      // 获取今天和昨天的日期
+      const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
+      const yesterday = new Date(today)
+      yesterday.setDate(today.getDate() - 1)
+
+      // 判断给定时间是否在今天或昨天
+      return date >= yesterday && date < today
+    },
+    orderStatus_v_zh(orderStatus, item) {
+      if (item?.isImportExcel && item?.isMeet === false) {
+        return 'DJD'
+      }
+      if (['DYY'].includes(orderStatus)) {
+        // 待预约
+        return 'DYY'
+      } else if (['DQD'].includes(orderStatus)) {
+        // 待抢单
+        return 'DQD'
+      } else if (
+        [
+          'DSHPG',
+          'CJ',
+          'YPD',
+          'DXSPD',
+          'DZBPG',
+          'DWDSPGP',
+          'DXSSPGP',
+          'DTJXSSPGP',
+          'DZBSPGP',
+          'DFZXPD',
+          'DFZXSPGP',
+          'XSBH',
+          'TJXSBH',
+          'ZBBH',
+          'FZXBH',
+          'FL'
+        ].includes(orderStatus)
+      ) {
+        // 待商户派工
+        return 'DSHPG'
+      } else if (['DWDPG', 'DWDPD', 'WDBH'].includes(orderStatus)) {
+        // 待网点派工
+        return 'DWDPG'
+      } else if (['DJD'].includes(orderStatus)) {
+        // 待接单
+        return 'DJD'
+      } else if (['FWZ', 'GCSZT', 'BFWG', 'DSM', 'YZP'].includes(orderStatus)) {
+        // 服务中
+        return 'FWZ'
+      } else if (['YCD'].includes(orderStatus)) {
+        // 异常单
+        return 'YCD'
+      } else if (['YWG', 'GCSZX', 'WDWG', 'YWGO'].includes(orderStatus)) {
+        // 已完工待结算
+        return 'YWG'
+      } else if (['YJS', 'LRCD'].includes(orderStatus)) {
+        // 已结算
+        return 'YJS'
+      } else if (['YQX', 'FWZT', 'YCGB', 'FWQX'].includes(orderStatus)) {
+        // 已取消
+        return 'YQX'
+      }
+      return ''
+    },
+    // 接单按钮
+    JIEDAN(item, userInfo) {
+      // ---------------
+      return (
+        (item.isImportExcel &&
+          !item.isMeet &&
+          item.attr == 'SELF' &&
+          (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+        // ---------------
+        (item.isImportExcel && !item.isMeet && item.attr != 'SELF') ||
+        // ---------------
+        (!item.isImportExcel &&
+          item.attr == 'SELF' &&
+          ['DYY', 'DJD'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+          (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+        // ---------------
+        (!item.isImportExcel &&
+          item.attr != 'SELF' &&
+          (['DYY'].includes(this.orderStatus_v_zh(item.orderStatus, item)) ||
+            (['DJD'].includes(this.orderStatus_v_zh(item.orderStatus, item))
+              ? item.orderType == 'INSTALL'
+                ? !!userInfo.workerNumber
+                : true
+              : false)))
+      )
+    },
+    // 抢单按钮
+    QIANGDAN(item, userInfo) {
+      // ---------------
+      return (
+        (!item.isImportExcel &&
+          item.attr == 'SELF' &&
+          ['DQD'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+          (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+        // ---------------
+        (!item.isImportExcel && item.attr != 'SELF' && ['DQD'].includes(this.orderStatus_v_zh(item.orderStatus, item)))
+      )
+    },
+    // 配件申请
+    PEIJIANSHENQING(item, userInfo) {
+      // ---------------
+      return (
+        ((item.isImportExcel &&
+          item.orderType != 'INSTALL' &&
+          (['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) ||
+            (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+              !userInfo.workerNumber))) ||
+          // ---------------
+          (item.isImportExcel &&
+            item.orderType != 'INSTALL' &&
+            ['YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            this.isTodayOrYesterday(item.overTime)) ||
+          // ---------------
+          (!item.isImportExcel && ['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)))) &&
+        (item.isImportExcel ? item.isMeet : true)
+      )
+    },
+    // 变更小工
+    BIANGENGXIAOGONG(item, userInfo) {
+      // ---------------
+      return (
+        ((item.isImportExcel &&
+          ['DYY', 'FWZ', 'YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+          (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+          // ---------------
+          (item.isImportExcel &&
+            ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            item.orderType != 'INSTALL' &&
+            !userInfo.workerNumber) ||
+          // ---------------
+          (!item.isImportExcel &&
+            ['DYY', 'FWZ', 'YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true))) &&
+        (item.isImportExcel ? item.isMeet : true)
+      )
+    },
+    // 辅材收费
+    FUCAISHOUFEI(item, userInfo) {
+      return (
+        ((item.isImportExcel &&
+          ['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+          (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+          //----------
+          (item.isImportExcel &&
+            ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            item.orderType != 'INSTALL' &&
+            !userInfo.workerNumber) ||
+          //----------
+          (!item.isImportExcel &&
+            ['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            !!userInfo.workerNumber) ||
+          //----------
+          (((item.isImportExcel &&
+            ['YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
+            (!item.isImportExcel &&
+              ['YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+              !!userInfo.workerNumber)) &&
+            this.isTodayOrYesterday(item.overTime))) &&
+        (item.isImportExcel ? item.isMeet : true)
+      )
+    },
+    PEIJIANSHOUFEI(item, userInfo) {
+      return (
+        ((item.isImportExcel &&
+          item.orderType != 'INSTALL' &&
+          (['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) ||
+            (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+              !userInfo.workerNumber))) ||
+          //----------
+          (!item.isImportExcel &&
+            item.orderType != 'INSTALL' &&
+            ['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+            !!userInfo.workerNumber) ||
+          //----------
+          (((item.isImportExcel &&
+            item.orderType != 'INSTALL' &&
+            ['YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item))) ||
+            (!item.isImportExcel &&
+              item.orderType != 'INSTALL' &&
+              ['YWG'].includes(this.orderStatus_v_zh(item.orderStatus, item)) &&
+              !!userInfo.workerNumber)) &&
+            this.isTodayOrYesterday(item.overTime))) &&
+        (item.isImportExcel ? item.isMeet : true)
+      )
+    },
+    GUOCHENFANKUI(item, userInfo) {
+      return (
+        (['DYY', 'FWZ'].includes(this.orderStatus_v_zh(item.orderStatus, item)) ||
+          (item.isImportExcel &&
+            item.orderType != 'INSTALL' &&
+            !userInfo.workerNumber &&
+            ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(this.orderStatus_v_zh(item.orderStatus, item)))) &&
+        (item.isImportExcel ? item.isMeet : true)
+      )
+    }
+  }
+}

+ 9 - 117
src/packageWorkorder/pages/orderDetail.vue

@@ -609,66 +609,14 @@
       <template slot="footer">
         <view class="bottom-container" v-if="detail">
           <!-- 接单 -->
-          <u-button
-            v-if="
-              // ---------------
-              (detail.isImportExcel &&
-                !detail.isMeet &&
-                detail.attr == 'SELF' &&
-                (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              // ---------------
-              (detail.isImportExcel && !detail.isMeet && detail.attr != 'SELF') ||
-              // ---------------
-              (!detail.isImportExcel &&
-                detail.attr == 'SELF' &&
-                ['DYY', 'DJD'].includes(orderStatus_v) &&
-                (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              // ---------------
-              (!detail.isImportExcel &&
-                detail.attr != 'SELF' &&
-                (['DYY'].includes(orderStatus_v) ||
-                  (['DJD'].includes(orderStatus_v)
-                    ? detail.orderType == 'INSTALL'
-                      ? !!userInfo.workerNumber
-                      : true
-                    : false)))
-            "
-            type="primary"
-            text="接单"
-            @tap="actionReceive()"
-          ></u-button>
+          <u-button v-if="JIEDAN(detail, userInfo)" type="primary" text="接单" @tap="actionReceive()"></u-button>
 
           <!-- 待抢单 -->
-          <u-button
-            v-if="
-              (!detail.isImportExcel &&
-                detail.attr == 'SELF' &&
-                ['DQD'].includes(orderStatus_v) &&
-                (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              (!detail.isImportExcel && detail.attr != 'SELF' && ['DQD'].includes(orderStatus_v))
-            "
-            type="primary"
-            text="抢单"
-            @tap="qdOrder(detail)"
-          ></u-button>
+          <u-button v-if="QIANGDAN(detail, userInfo)" type="primary" text="抢单" @tap="qdOrder(detail)"></u-button>
 
           <!-- 配件申请 -->
           <u-button
-            v-if="
-              // ---------------
-              ((detail.isImportExcel &&
-                detail.orderType != 'INSTALL' &&
-                (['DYY', 'FWZ'].includes(orderStatus_v) ||
-                  (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v) && !userInfo.workerNumber))) ||
-                // ---------------
-                (detail.isImportExcel &&
-                  detail.orderType != 'INSTALL' &&
-                  ['YWG'].includes(orderStatus_v) &&
-                  isTodayOrYesterday(detail.overTime)) ||
-                // ---------------
-                (!detail.isImportExcel && ['DYY', 'FWZ'].includes(orderStatus_v))) &&
-              (detail.isImportExcel ? detail.isMeet : true)
-            "
+            v-if="PEIJIANSHENQING(detail, userInfo)"
             plain
             type="primary"
             text="配件申请"
@@ -677,22 +625,7 @@
 
           <!-- 变更小工 -->
           <u-button
-            v-if="
-              // ---------------
-              ((detail.isImportExcel &&
-                ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v) &&
-                (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                // ---------------
-                (detail.isImportExcel &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v) &&
-                  detail.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber) ||
-                // ---------------
-                (!detail.isImportExcel &&
-                  ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v) &&
-                  (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true))) &&
-              (detail.isImportExcel ? detail.isMeet : true)
-            "
+            v-if="BIANGENGXIAOGONG(detail, userInfo)"
             plain
             type="primary"
             text="变更小工"
@@ -705,25 +638,7 @@
             type="primary"
             text="辅材收费"
             @tap="toCharge('M')"
-            v-if="
-              ((detail.isImportExcel &&
-                ['DYY', 'FWZ'].includes(orderStatus_v) &&
-                (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                //----------
-                (detail.isImportExcel &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v) &&
-                  detail.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber) ||
-                //----------
-                (!detail.isImportExcel && ['DYY', 'FWZ'].includes(orderStatus_v) && !!userInfo.workerNumber) ||
-                //----------
-                (((detail.isImportExcel &&
-                  ['YWG'].includes(orderStatus_v) &&
-                  (detail.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                  (!detail.isImportExcel && ['YWG'].includes(orderStatus_v) && !!userInfo.workerNumber)) &&
-                  isTodayOrYesterday(detail.overTime))) &&
-              (detail.isImportExcel ? detail.isMeet : true)
-            "
+            v-if="FUCAISHOUFEI(detail, userInfo)"
           ></u-button>
 
           <!-- 配件收费 ok-->
@@ -732,37 +647,12 @@
             type="primary"
             text="配件收费"
             @tap="toCharge('P')"
-            v-if="
-              ((detail.isImportExcel &&
-                detail.orderType != 'INSTALL' &&
-                (['DYY', 'FWZ'].includes(orderStatus_v) ||
-                  (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v) && !userInfo.workerNumber))) ||
-                //----------
-                (!detail.isImportExcel &&
-                  detail.orderType != 'INSTALL' &&
-                  ['DYY', 'FWZ'].includes(orderStatus_v) &&
-                  !!userInfo.workerNumber) ||
-                //----------
-                (((detail.isImportExcel && detail.orderType != 'INSTALL' && ['YWG'].includes(orderStatus_v)) ||
-                  (!detail.isImportExcel &&
-                    detail.orderType != 'INSTALL' &&
-                    ['YWG'].includes(orderStatus_v) &&
-                    !!userInfo.workerNumber)) &&
-                  isTodayOrYesterday(detail.overTime))) &&
-              (detail.isImportExcel ? detail.isMeet : true)
-            "
+            v-if="PEIJIANSHOUFEI(detail, userInfo)"
           ></u-button>
 
           <!-- 过程反馈 ok-->
           <u-button
-            v-if="
-              (['DYY', 'FWZ'].includes(orderStatus_v) ||
-                (detail.isImportExcel &&
-                  detail.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v))) &&
-              (detail.isImportExcel ? detail.isMeet : true)
-            "
+            v-if="GUOCHENFANKUI(detail, userInfo)"
             type="primary"
             text="过程反馈"
             @tap="toFeedback()"
@@ -823,7 +713,9 @@ import selectionWorkers from '@/components/selectionWorkers.vue'
 import zhifutanchuan from '@/components/zhifutanchuan.vue'
 import { wxScanCode } from '@/common/utils/util.js'
 import { getStorage } from '@/common/utils/storage.js'
+import orderBtnsShow from './mixins/orderBtnsShow.js'
 export default {
+  mixins: [orderBtnsShow],
   components: {
     zjDialogPicker,
     Logistics,

+ 10 - 129
src/packageWorkorder/pages/orderList.vue

@@ -136,71 +136,14 @@
             </view>
             <view class="item-btn" @tap.stop>
               <!-- 接单 ok-->
-              <u-button
-                v-if="
-                  // ---------------
-                  (item.isImportExcel &&
-                    !item.isMeet &&
-                    item.attr == 'SELF' &&
-                    (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                  // ---------------
-                  (item.isImportExcel && !item.isMeet && item.attr != 'SELF') ||
-                  // ---------------
-                  (!item.isImportExcel &&
-                    item.attr == 'SELF' &&
-                    ['DYY', 'DJD'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                  // ---------------
-                  (!item.isImportExcel &&
-                    item.attr != 'SELF' &&
-                    (['DYY'].includes(orderStatus_v(item.orderStatus, item)) ||
-                      (['DJD'].includes(orderStatus_v(item.orderStatus, item))
-                        ? item.orderType == 'INSTALL'
-                          ? !!userInfo.workerNumber
-                          : true
-                        : false)))
-                "
-                type="primary"
-                text="接单"
-                @tap="actionReceive(item)"
-              ></u-button>
+              <u-button v-if="JIEDAN(item, userInfo)" type="primary" text="接单" @tap="actionReceive(item)"></u-button>
 
               <!-- 待抢单 ok-->
-              <u-button
-                v-if="
-                  // ---------------
-                  (!item.isImportExcel &&
-                    item.attr == 'SELF' &&
-                    ['DQD'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                  // ---------------
-                  (!item.isImportExcel &&
-                    item.attr != 'SELF' &&
-                    ['DQD'].includes(orderStatus_v(item.orderStatus, item)))
-                "
-                type="primary"
-                text="抢单"
-                @tap="qdOrder(item)"
-              ></u-button>
+              <u-button v-if="QIANGDAN(item, userInfo)" type="primary" text="抢单" @tap="qdOrder(item)"></u-button>
 
               <!-- 配件申请 -->
               <u-button
-                v-if="
-                  // ---------------
-                  ((item.isImportExcel &&
-                    item.orderType != 'INSTALL' &&
-                    (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                      (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                        !userInfo.workerNumber))) ||
-                    // ---------------
-                    (item.isImportExcel &&
-                      item.orderType != 'INSTALL' &&
-                      ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      isTodayOrYesterday(item.overTime)) ||
-                    // ---------------
-                    (!item.isImportExcel && ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)))) &&
-                  (item.isImportExcel ? item.isMeet : true)
-                "
+                v-if="PEIJIANSHENQING(item, userInfo)"
                 plain
                 type="primary"
                 text="配件申请"
@@ -209,22 +152,7 @@
 
               <!-- 变更小工 -->
               <u-button
-                v-if="
-                  // ---------------
-                  ((item.isImportExcel &&
-                    ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                    // ---------------
-                    (item.isImportExcel &&
-                      ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      item.orderType != 'INSTALL' &&
-                      !userInfo.workerNumber) ||
-                    // ---------------
-                    (!item.isImportExcel &&
-                      ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true))) &&
-                  (item.isImportExcel ? item.isMeet : true)
-                "
+                v-if="BIANGENGXIAOGONG(item, userInfo)"
                 plain
                 type="primary"
                 text="变更小工"
@@ -237,55 +165,12 @@
                 type="primary"
                 text="辅材收费"
                 @tap="toCharge(item.id, 'M')"
-                v-if="
-                  ((item.isImportExcel &&
-                    ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                    //----------
-                    (item.isImportExcel &&
-                      ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      item.orderType != 'INSTALL' &&
-                      !userInfo.workerNumber) ||
-                    //----------
-                    (!item.isImportExcel &&
-                      ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      !!userInfo.workerNumber) ||
-                    //----------
-                    (((item.isImportExcel &&
-                      ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                      (!item.isImportExcel &&
-                        ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                        !!userInfo.workerNumber)) &&
-                      isTodayOrYesterday(item.overTime))) &&
-                  (item.isImportExcel ? item.isMeet : true)
-                "
+                v-if="FUCAISHOUFEI(item, userInfo)"
               ></u-button>
 
               <!-- 配件收费 -->
               <u-button
-                v-if="
-                  ((item.isImportExcel &&
-                    item.orderType != 'INSTALL' &&
-                    (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                      (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                        !userInfo.workerNumber))) ||
-                    //----------
-                    (!item.isImportExcel &&
-                      item.orderType != 'INSTALL' &&
-                      ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                      !!userInfo.workerNumber) ||
-                    //----------
-                    (((item.isImportExcel &&
-                      item.orderType != 'INSTALL' &&
-                      ['YWG'].includes(orderStatus_v(item.orderStatus, item))) ||
-                      (!item.isImportExcel &&
-                        item.orderType != 'INSTALL' &&
-                        ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                        !!userInfo.workerNumber)) &&
-                      isTodayOrYesterday(item.overTime))) &&
-                  (item.isImportExcel ? item.isMeet : true)
-                "
+                v-if="PEIJIANSHOUFEI(item, userInfo)"
                 plain
                 type="primary"
                 text="配件收费"
@@ -294,14 +179,7 @@
 
               <!-- 过程反馈 -->
               <u-button
-                v-if="
-                  (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                    (item.isImportExcel &&
-                      item.orderType != 'INSTALL' &&
-                      !userInfo.workerNumber &&
-                      ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)))) &&
-                  (item.isImportExcel ? item.isMeet : true)
-                "
+                v-if="GUOCHENFANKUI(item, userInfo)"
                 type="primary"
                 text="过程反馈"
                 @tap="toFeedback(item.id)"
@@ -349,7 +227,10 @@
 import zjDialogDateRangePicker from '@/components/zj-dialog/zj-dialog-dateRangePicker.vue'
 import selectionWorkers from '@/components/selectionWorkers.vue'
 import { getStorage } from '@/common/utils/storage.js'
+import orderBtnsShow from './mixins/orderBtnsShow.js'
 export default {
+  mixins: [orderBtnsShow],
+
   components: {
     selectionWorkers,
     zjDialogDateRangePicker

+ 10 - 127
src/packageWorkorder/pages/search.vue

@@ -91,69 +91,14 @@
         </view>
         <view class="item-btn" @tap.stop>
           <!-- 接单 ok-->
-          <u-button
-            v-if="
-              // ---------------
-              (item.isImportExcel &&
-                !item.isMeet &&
-                item.attr == 'SELF' &&
-                (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              // ---------------
-              (item.isImportExcel && !item.isMeet && item.attr != 'SELF') ||
-              // ---------------
-              (!item.isImportExcel &&
-                item.attr == 'SELF' &&
-                ['DYY', 'DJD'].includes(orderStatus_v(item.orderStatus, item)) &&
-                (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              // ---------------
-              (!item.isImportExcel &&
-                item.attr != 'SELF' &&
-                (['DYY'].includes(orderStatus_v(item.orderStatus, item)) ||
-                  (['DJD'].includes(orderStatus_v(item.orderStatus, item))
-                    ? item.orderType == 'INSTALL'
-                      ? !!userInfo.workerNumber
-                      : true
-                    : false)))
-            "
-            type="primary"
-            text="接单"
-            @tap="actionReceive(item)"
-          ></u-button>
+          <u-button v-if="JIEDAN(item, userInfo)" type="primary" text="接单" @tap="actionReceive(item)"></u-button>
 
           <!-- 待抢单 ok-->
-          <u-button
-            v-if="
-              // ---------------
-              (!item.isImportExcel &&
-                item.attr == 'SELF' &&
-                ['DQD'].includes(orderStatus_v(item.orderStatus, item)) &&
-                (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-              // ---------------
-              (!item.isImportExcel && item.attr != 'SELF' && ['DQD'].includes(orderStatus_v(item.orderStatus, item)))
-            "
-            type="primary"
-            text="抢单"
-            @tap="qdOrder(item)"
-          ></u-button>
+          <u-button v-if="QIANGDAN(item, userInfo)" type="primary" text="抢单" @tap="qdOrder(item)"></u-button>
 
           <!-- 配件申请 -->
           <u-button
-            v-if="
-              // ---------------
-              ((item.isImportExcel &&
-                item.orderType != 'INSTALL' &&
-                (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                  (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    !userInfo.workerNumber))) ||
-                // ---------------
-                (item.isImportExcel &&
-                  item.orderType != 'INSTALL' &&
-                  ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  isTodayOrYesterday(item.overTime)) ||
-                // ---------------
-                (!item.isImportExcel && ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)))) &&
-              (item.isImportExcel ? item.isMeet : true)
-            "
+            v-if="PEIJIANSHENQING(item, userInfo)"
             plain
             type="primary"
             text="配件申请"
@@ -162,22 +107,7 @@
 
           <!-- 变更小工 -->
           <u-button
-            v-if="
-              // ---------------
-              ((item.isImportExcel &&
-                ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                // ---------------
-                (item.isImportExcel &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  item.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber) ||
-                // ---------------
-                (!item.isImportExcel &&
-                  ['DYY', 'FWZ', 'YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true))) &&
-              (item.isImportExcel ? item.isMeet : true)
-            "
+            v-if="BIANGENGXIAOGONG(item, userInfo)"
             plain
             type="primary"
             text="变更小工"
@@ -190,55 +120,12 @@
             type="primary"
             text="辅材收费"
             @tap="toCharge(item.id, 'M')"
-            v-if="
-              ((item.isImportExcel &&
-                ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                //----------
-                (item.isImportExcel &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  item.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber) ||
-                //----------
-                (!item.isImportExcel &&
-                  ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  !!userInfo.workerNumber) ||
-                //----------
-                (((item.isImportExcel &&
-                  ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  (item.orderType == 'INSTALL' ? !!userInfo.workerNumber : true)) ||
-                  (!item.isImportExcel &&
-                    ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    !!userInfo.workerNumber)) &&
-                  isTodayOrYesterday(item.overTime))) &&
-              (item.isImportExcel ? item.isMeet : true)
-            "
+            v-if="FUCAISHOUFEI(item, userInfo)"
           ></u-button>
 
           <!-- 配件收费 -->
           <u-button
-            v-if="
-              ((item.isImportExcel &&
-                item.orderType != 'INSTALL' &&
-                (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                  (['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    !userInfo.workerNumber))) ||
-                //----------
-                (!item.isImportExcel &&
-                  item.orderType != 'INSTALL' &&
-                  ['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) &&
-                  !!userInfo.workerNumber) ||
-                //----------
-                (((item.isImportExcel &&
-                  item.orderType != 'INSTALL' &&
-                  ['YWG'].includes(orderStatus_v(item.orderStatus, item))) ||
-                  (!item.isImportExcel &&
-                    item.orderType != 'INSTALL' &&
-                    ['YWG'].includes(orderStatus_v(item.orderStatus, item)) &&
-                    !!userInfo.workerNumber)) &&
-                  isTodayOrYesterday(item.overTime))) &&
-              (item.isImportExcel ? item.isMeet : true)
-            "
+            v-if="PEIJIANSHOUFEI(item, userInfo)"
             plain
             type="primary"
             text="配件收费"
@@ -247,14 +134,7 @@
 
           <!-- 过程反馈 -->
           <u-button
-            v-if="
-              (['DYY', 'FWZ'].includes(orderStatus_v(item.orderStatus, item)) ||
-                (item.isImportExcel &&
-                  item.orderType != 'INSTALL' &&
-                  !userInfo.workerNumber &&
-                  ['DQD', 'DJD', 'DSHPG', 'DWDPG'].includes(orderStatus_v(item.orderStatus, item)))) &&
-              (item.isImportExcel ? item.isMeet : true)
-            "
+            v-if="GUOCHENFANKUI(item, userInfo)"
             type="primary"
             text="过程反馈"
             @tap="toFeedback(item.id)"
@@ -268,7 +148,10 @@
 </template>
 
 <script>
+import orderBtnsShow from './mixins/orderBtnsShow.js'
+import { getStorage } from '@/common/utils/storage.js'
 export default {
+  mixins: [orderBtnsShow],
   data() {
     return {
       keyword: '',