associatedOrder.vue 5.31 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
<template>
<div class="associated-order">
     <h1 class="title">
       {{$t('关联订单')}}-{{orderDetails.orderNo}}
     </h1>
  <el-divider></el-divider>
  <orde-details-form  :details ="orderDetails" ></orde-details-form>
  <el-divider></el-divider>
  <el-form inline label-width="100px">
    <el-form-item :label="$t('订单号')"><div class="content">
      <el-input v-model.trim="params.relateOrderNo"></el-input>
    </div></el-form-item>
    <el-form-item><div class="content">
      <el-button @click="getList">{{$t('查询')}}</el-button>
    </div></el-form-item>
  </el-form>
  <el-divider></el-divider>
   <div style="display: flex;align-items: center;">
     <h1 class="title">
       {{$t('已加入关联订单列表')}}
     </h1>
       <div style="flex: 1;margin-left: 20px;">
         <el-button :disabled="multipleSelection.length === 0" type="primary" @click="batchGuanlianOrderByOrderId(multipleSelection.map(e =>({orderId:e.orderId,relateOrderId:e.relateOrderId})))" >{{$t('批量移出')}}</el-button>
       </div>
     <div>
        <el-button type="primary" @click="$router.push(`/order/add-associated-order/${orderId}`)">{{$t('添加关联订单')}}</el-button>
     </div>
   </div>
   <el-table :data="list"  @selection-change="handleSelectionChange" >
     <el-table-column
       type="selection"
       width="55">
     </el-table-column>
     <el-table-column type="index" :label="$t('序号')"></el-table-column>
     <el-table-column :label="$t('订单号')" prop="orderBackVO.orderNo"></el-table-column>
     <el-table-column :label="$t('唛头')" prop="orderBackVO.marks"></el-table-column>
     <el-table-column :label="$t('货物数据')">
       <template v-slot="{row}">
        <div>
          {{row.orderBackVO.costVO.totalNum}}{{$t('')}}
        </div>
         <div>
          {{row.orderBackVO.costVO.totalVolume}}
        </div>
         <div>
          {{row.orderBackVO.costVO.totalWeight}}KG
        </div>
       </template>
     </el-table-column>
     <el-table-column :label="$t('入仓时间')" prop="orderBackVO.rucangTime">
       <template v-slot="{row}">
         {{parseTime(row.orderBackVO.rucangTime)}}
       </template>
     </el-table-column>
     <el-table-column :label="$t('状态')" prop="status" >
       <template v-slot:default="scope">
        {{scope.row.orderBackVO.statusMsg}}
       </template>
     </el-table-column>
     <el-table-column :label="$t('操作人')" prop="creator">
       <template v-slot="{row}">
         {{(userList.find( i => row.creator == i.id) || {}).nickname}}
       </template>
     </el-table-column>
     <el-table-column :label="$t('操作时间')">
       <template v-slot="{row}">
         {{parseTime(row.createTime)}}
       </template>
     </el-table-column>
     <el-table-column :label="$t('操作')">
       <template v-slot:default='scope'>
         <el-button type="text"  @click ="guanlianOrderByOrderId({orderId:scope.row.orderId,relateOrderId:scope.row.relateOrderId})">
           {{$t('移出')}}
         </el-button>
       </template>
     </el-table-column>
   </el-table>
  <pagination v-show="total > 0" :total="total" :page.sync="params.page" :limit.sync="params.rows"
              @pagination="getList" />
</div>
</template>

<script>
//关联订单
import ordeDetailsForm from "@/views/ecw/order/components/ordeDetailsForm";
import {getOrder} from "@/api/ecw/order";
import {
  deleteBatchGuanlianOrderByOrderId,
  deleteGuanlianOrderByOrderId,
  guanlianList,
} from "@/api/ecw/associatedOrder";
import {getDictDatas,DICT_TYPE} from '@/utils/dict'
import Template from "@/views/cms/template";
import {listSimpleUsers} from "@/api/system/user";
export default {
  name: "associatedOrder",
  props:{
    orderId:[String,Boolean]
  },
  components:{
    Template,
    ordeDetailsForm
  },
  computed:{
    check(){
      let flag = true;
      if(this.list.length === 1 && this.list[0].status === 5){
         flag = false
      }else {

      }
    }
  },
  data(){
    return {
      orderDetails:{},
      params:{
        orderId:undefined,
        relateOrderNo:undefined,
        page:1,
        rows:10
      },
      list:[],
      DICT_TYPE,
      getDictDatas,
      multipleSelection:[],
      userList:[],
      total:0,
    }
  },
  created() {
    this.params.orderId = this.orderId;
    this.getList();
    getOrder(this.orderId).then( r =>{
      if(r.code === 0){
        this.orderDetails = r.data;
      }
    })
    listSimpleUsers().then(r => this.userList = r.data)
  },
  methods:{
    getList(){
      guanlianList(this.params).then(r => {
        if(r.code === 0){
          this.list = r.data.list;
          this.total = r.data.total;
        }
      })
    },
    guanlianOrderByOrderId(params){
      deleteGuanlianOrderByOrderId(params).then(r =>{
        if(r.code === 0){
          this.getList()
          this.$message.success(this.$t('操作成功'));
        }
      })
    },
    batchGuanlianOrderByOrderId(val){
      deleteBatchGuanlianOrderByOrderId(val).then(r => {
        this.getList()
        this.$message.success(this.$t('操作成功'));
        this.multipleSelection = []
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  },

}
</script>

<style scoped lang="scss">
.associated-order{
  padding: 20px;
  box-sizing: border-box;
  .title{
    font-size: 30px;
    font-weight: 600;
  }
}
</style>