singleApply.vue 12.6 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
    <el-card>
        <div slot="header" class="card-title">{{$t('合单申请')}}-{{orderData.orderNo||''}}</div>
        <el-descriptions :column="4">
            <el-descriptions-item :label="$t('唛头')">
                {{orderData.marks||$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('已到箱数/总箱数')">
                <span>{{orderData.sumNum||0}}/{{orderData.costVO?orderData.costVO.totalNum:0}}</span>
            </el-descriptions-item>
            <el-descriptions-item :label="$t('订单状态')">
              <!-- <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="orderData.status" /> -->
              {{orderData.abnormalState!=0?$t('异常'):$t('正常')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('送货日期')">
             {{orderData.deliveryDate||$t('')}}
            </el-descriptions-item>

            <el-descriptions-item :label="$t('运输方式')">
                <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="orderData.transportId" />
            </el-descriptions-item>
            <el-descriptions-item :label="$t('出货渠道')">
                  {{orderData.channelName||'/'}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('始发地')" >
                  {{orderData.logisticsInfoDto?orderData.logisticsInfoDto.startTitleZh:$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('目的地')" :span="2">
               {{orderData.logisticsInfoDto?orderData.logisticsInfoDto.destTitleZh:$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('发货人姓名')">
                {{orderData.consignorVO?orderData.consignorVO.name||$t(''):$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('发货公司')">
                {{orderData.consignorVO?orderData.consignorVO.company||$t(''):$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('发货电话')">
                  {{!orderData.consignorVO?$t(''):!orderData.consignorVO.phone?$t(''):(checkCode(orderData.consignorVO.countryCode)+orderData.consignorVO.phone)}}
            </el-descriptions-item>
        </el-descriptions>
        <el-descriptions :column="4">
            <el-descriptions-item :label="$t('收货人姓名')">
                {{orderData.consigneeVO?orderData.consigneeVO.name||$t(''):$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('收货公司')">
                {{orderData.consigneeVO?orderData.consigneeVO.company||$t(''):$t('')}}
            </el-descriptions-item>
            <el-descriptions-item :label="$t('收货电话')">
                 {{!orderData.consigneeVO?$t(''):!orderData.consigneeVO.phone?$t(''):(checkCode(orderData.consigneeVO.countryCode)+orderData.consigneeVO.phone)}}
            </el-descriptions-item>
        </el-descriptions>

    </el-card>
    <el-card class="card">
      <!-- 列表 -->
      <div slot="header" class="card-title">{{$t('已合单订单')}}</div>
      <el-table v-loading="loading" border :data="mergedList" style="width: 200px;">
        <el-table-column :label="$t('序号')" align="center" prop="id" type="index">
          <template slot-scope="scope">
              <span>{{scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column :label="$t('订单号')" align="center">
        <template slot-scope="scope">
           <span>{{scope.row.mergedOrder.orderNo}}</span>
          </template>
        </el-table-column>
<!--        <el-table-column :label="唛头" align="center">
          <template slot-scope="scope">
           <span>{{scope.row.mergedOrder.marks}}</span>
          </template>
        </el-table-column>
        <el-table-column :label="始发地" align="center">
            <template slot-scope="scope">
              <span>{{importCityName(scope.row.mergedOrder.orderDepartureVO.departureId)}}</span>
            </template>
        </el-table-column>
        <el-table-column :label="入仓货物属性" align="center">
            <template slot-scope="scope">
              <span>{{ $t('合计:') }}</span>
              <span>{{scope.row.mergedOrder.sumNum+'箱 '+scope.row.mergedOrder.sumVolume+'m³ '+scope.row.mergedOrder.sumWeight+'kg'}}</span>
            </template>
        </el-table-column>
        <el-table-column :label="入仓时间" align="center" prop='createTime' />
        <el-table-column :label="状态" align="center">
           <template slot-scope="scope">
               <dict-tag :type="DICT_TYPE.AUDIT_STATUS" :value="scope.row.status" />
          </template>
        </el-table-column> -->
      </el-table>
    </el-card>
    <el-card class="card">
      <!-- 列表 -->
      <div slot="header" class="card-title">{{$t('待合单订单')}}</div>
      <el-table  border :data="singleData" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55">
               </el-table-column>
        <el-table-column :label="$t('序号')" align="center" prop="id" type="index">
          <template slot-scope="scope">
              <span>{{scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column :label="$t('订单号')" align="center">
        <template slot-scope="scope">
           <span>{{scope.row.orderNo}}</span>
          </template>
        </el-table-column>
         <el-table-column :label="$t('唛头')" align="center">
           <template slot-scope="scope">
            <span>{{scope.row.marks}}</span>
           </template>
         </el-table-column>
        <el-table-column :label="$t('始发地')" align="center">
            <template slot-scope="scope">
              <span>{{scope.row.orderDepartureDO.departure}}</span>
            </template>
        </el-table-column>
        <el-table-column :label="$t('入仓货物属性')" align="center">
            <template slot-scope="scope">
              <span>{{$t('合计')}}</span>
              <span>{{scope.row.sumNum+$t('')+' '+scope.row.sumVolume+''+scope.row.sumWeight+'kg'}}</span>
            </template>
        </el-table-column>
        <el-table-column :label="$t('入仓时间')" align="center">
           <template slot-scope="scope">
            <span>{{parseTime(scope.row.rucangTime)}}</span>
           </template>
        </el-table-column>
        <el-table-column :label="$t('状态')" align="center">
           <template slot-scope="scope">
             <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status"></dict-tag>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows"
        @pagination="getList" />
<!--      <el-row v-if="singleData.length>0">
           <el-checkbox v-model="checked">{{ $t('需要仓库打包') }}</el-checkbox>
      </el-row> -->
    </el-card>
    <work-flow v-if='singleData.length>0||orderData.inWarehouseState==209' xmlkey="merge_order" v-model="selectedUsers"></work-flow>
    <div slot="footer" class="card footer_btn" v-if="singleData.length>0||orderData.inWarehouseState==209">
        <el-button  v-if="orderData.inWarehouseState!=209" type="primary" @click="submitForm">{{$t('提交申请')}}</el-button>
        <el-button v-if="orderData.inWarehouseState!=209" plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('取消')}}</el-button>
        <el-button v-if="orderData.inWarehouseState==209"  type="primary" @click="$router.push(`/bpm/process-instance/detail?id=`+bpmProcessId)">{{$t('审核中')}}</el-button>
        <el-button v-if="orderData.inWarehouseState==209" plain type="primary" @click="dialogVisible = true">{{$t('取消审核')}}</el-button>
        <el-button v-if="orderData.inWarehouseState==209" plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('返回')}}</el-button>
    </div>
    <el-dialog
     :title="$t('提示')"
      :visible.sync="dialogVisible"
      width="30%">
       <span class="cancel_notice">{{$t('合单申请正在审核中,你确定取消合单申请吗?')}}</span>
       <div class="cancel_content">
         <span>{{$t('取消原因')}}:</span>
         <el-input v-model="reason" :placeholder="$t('请输入取消原因')"></el-input>
       </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">{{$t('取消')}}</el-button>
        <el-button type="primary" @click="cancelMerge">{{$t('确定')}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {getMergeListByOrderNo,createMerge,cancelMerge} from "@/api/ecw/orderHandle"
import {getTradeCityList} from '@/api/ecw/region'
import {DICT_TYPE} from  '@/utils/dict'
import {getChannel} from '@/api/ecw/channel'
import {getModel} from '@/api/bpm/model'
import WorkFlow from '@/components/WorkFlow/'

export default {
  name: "SingleApply",
  components: {
    WorkFlow
  },
  data() {
    return {
      DICT_TYPE,
      checked:false,
      orderData:{},
      // 订单异常列表
      list: [],
      mergedList:[],
      singleData:[],
      tradeCityList:[],
      loading:false,
      queryParams:{
        mergedOrderNo:'NG2200006L',
        page:1,
        rosw:10
      },
      selectedUsers:[],
      total:0,
      orderNos:'',
      bpmProcessId:'',
      reason:'',
      dialogVisible:false
    };
  },
  created() {
    if (this.$route.query.orderNo) {
      this.queryParams.mergedOrderNo = this.$route.query.orderNo
    }
    this.getList()
    getTradeCityList().then(res => this.tradeCityList = res.data)
  },
  methods: {
    checkCode(data){
      if(data.indexOf('+')==-1){
      	return '+'+data
      }
      return data
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 执行查询
      getMergeListByOrderNo(this.queryParams).then(response => {
        this.loading = false;
        console.log('(response.data',response.data)
        if(response.data.mergedList){
          this.mergedList = response.data.mergedList;
        }
        if(response.data.unMergeList){
          this.total = response.data.unMergeList.total;
          this.singleData = response.data.unMergeList.list;
        }
        if(response.data.orderInfo){
          this.orderData = response.data.orderInfo
        }
        if(response.data.bpmProcessId){
          this.bpmProcessId = response.data.bpmProcessId
        }
      });
    },
    handleSelectionChange(val) {
       var orderNo = []
       val.forEach((item)=>{
         orderNo.push(item.orderNo)
       })
       this.orderNos = orderNo
     },
    importCityName(id){
        var arr = this.tradeCityList.filter(item => item.id == id)
        return arr.length>0?arr[0].titleZh:this.$t('')
    },
    getChannelName(id){
      getChannel(id).then(res=>{
        return  res.data.nameZh
      })
    },
    cancelMerge(){
      let that = this
      // if(!that.orderNos){
      //   that.$message.error("请选择取消合单的订单");
      //   return
      // }
      if(!that.reason){
        that.$message.error(this.$t("请输入取消原因"));
        return
      }
      var  params = {
        applyOrderNo :that.queryParams.mergedOrderNo,
        orderNo :that.queryParams.mergedOrderNo,
        reason:that.reason
      }
      cancelMerge(params).then(res=>{
          that.$message.success(this.$t("取消成功"));
           that.$store.dispatch('tagsView/delCurrentView')
      })
    },
    submitForm(){
      let that = this
      if(!that.orderNos||that.orderNos.length==0){
        that.$message.error(this.$t("请选择待合单的订单"));
        return
      }
      var params = []
      that.orderNos.forEach((item)=>{
        var data = {
          applyOrderNo:that.queryParams.mergedOrderNo,
          copyUserId:that.selectedUsers,
          orderNos:item,
          status:1
        }
        params.push(data)
      })
        createMerge(params).then(res=>{
          that.$message.success(this.$t("修改成功"));
          that.$store.dispatch('tagsView/delCurrentView')
        })
    }
  }
}
</script>
<style scoped>
  .card-title{
      font-size: 18px;
      font-weight: bold;
       margin-top: 10px;
  }
  .card{
    margin-top: 20px;
  }
  .footer_btn{
    padding-bottom: 60px;
  }
  .cancel_notice{
    font-size: 16px;
    font-weight: 600;
  }
  .cancel_content{
    display: flex;
    align-items: center;
    padding-top: 20px;
  }
  .cancel_content span{
    width: 100px;
  }
</style>