123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- import { getStorage } from '@/common/utils/storage.js'
- import moment from 'moment-timezone'
- // 设置时区为中国
- moment.tz.setDefault('Asia/Shanghai')
- export default {
- methods: {
- isTodayOrYesterday(timeString) {
- const date = moment(timeString)
- const now = moment()
- // 获取今天和昨天的日期
- const today = now.startOf('day')
- const yesterday = today.clone().subtract(1, 'days')
- // 判断给定日期是否在今天或昨天
- return date.isSame(today, 'day') || date.isSame(yesterday, 'day')
- },
- 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)
- )
- }
- }
- }
|