associatedOrder.vue 5.34 KB
Newer Older
1 2 3
<template>
<div class="associated-order">
     <h1 class="title">
dcy's avatar
dcy committed
4
       {{$t('关联订单')}}-{{orderDetails.orderNo}}
5 6
     </h1>
  <el-divider></el-divider>
7
  <orde-details-form  :details ="orderDetails" ></orde-details-form>
8 9
  <el-divider></el-divider>
  <el-form inline label-width="100px">
dcy's avatar
dcy committed
10
    <el-form-item :label="$t('订单号')"><div class="content">
dcy's avatar
dcy committed
11
      <el-input v-model.trim="params.relateOrderNo"></el-input>
12 13
    </div></el-form-item>
    <el-form-item><div class="content">
dcy's avatar
dcy committed
14
      <el-button @click="getList">{{$t('查询')}}</el-button>
15 16 17 18 19
    </div></el-form-item>
  </el-form>
  <el-divider></el-divider>
   <div style="display: flex;align-items: center;">
     <h1 class="title">
dcy's avatar
dcy committed
20
       {{$t('已加入关联订单列表')}}
21 22
     </h1>
       <div style="flex: 1;margin-left: 20px;">
dcy's avatar
dcy committed
23
         <el-button :disabled="multipleSelection.length === 0" type="primary" @click="batchGuanlianOrderByOrderId(multipleSelection.map(e =>({orderId:orderId,relateOrderId:e.orderId})))" >{{$t('批量移出')}}</el-button>
24 25
       </div>
     <div>
dcy's avatar
dcy committed
26
        <el-button type="primary" @click="$router.push(`/order/add-associated-order/${orderId}`)">{{$t('添加关联订单')}}</el-button>
27 28
     </div>
   </div>
dcy's avatar
dcy committed
29
   <el-table :data="list"  @selection-change="handleSelectionChange" >
30 31 32 33
     <el-table-column
       type="selection"
       width="55">
     </el-table-column>
dcy's avatar
dcy committed
34 35 36 37
     <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('货物数据')">
38 39
       <template v-slot="{row}">
        <div>
dcy's avatar
dcy committed
40
          {{row.orderBackVO.costVO.totalNum}}{{$t('')}}
41 42 43 44 45
        </div>
         <div>
          {{row.orderBackVO.costVO.totalVolume}}
        </div>
         <div>
46
          {{row.orderBackVO.costVO.totalWeight}}KG
47 48 49
        </div>
       </template>
     </el-table-column>
dcy's avatar
dcy committed
50
     <el-table-column :label="$t('入仓时间')" prop="orderBackVO.rucangTime">
51 52 53 54
       <template v-slot="{row}">
         {{parseTime(row.orderBackVO.rucangTime)}}
       </template>
     </el-table-column>
dcy's avatar
dcy committed
55
     <el-table-column :label="$t('状态')" prop="status" >
dcy's avatar
dcy committed
56
       <template v-slot:default="scope">
dcy's avatar
dcy committed
57
         <dict-tag :value="scope.row.orderBackVO.status" :type="DICT_TYPE.ORDER_STATUS" ></dict-tag>
dcy's avatar
dcy committed
58 59
       </template>
     </el-table-column>
dcy's avatar
dcy committed
60
     <el-table-column :label="$t('操作人')" prop="creator">
dcy's avatar
dcy committed
61
       <template v-slot="{row}">
dcy's avatar
dcy committed
62
         {{(userList.find( i => row.creator == i.id) || {}).nickname}}
dcy's avatar
dcy committed
63 64
       </template>
     </el-table-column>
dcy's avatar
dcy committed
65
     <el-table-column :label="$t('操作时间')">
66 67 68 69
       <template v-slot="{row}">
         {{parseTime(row.createTime)}}
       </template>
     </el-table-column>
dcy's avatar
dcy committed
70
     <el-table-column :label="$t('操作')">
dcy's avatar
dcy committed
71
       <template v-slot:default='scope'>
huyufeng's avatar
huyufeng committed
72
         <el-button type="text"  @click ="guanlianOrderByOrderId(scope.row.relateOrderId)">
dcy's avatar
dcy committed
73
           {{$t('移出')}}
dcy's avatar
dcy committed
74 75 76
         </el-button>
       </template>
     </el-table-column>
77
   </el-table>
dcy's avatar
dcy committed
78 79
  <pagination v-show="total > 0" :total="total" :page.sync="params.page" :limit.sync="params.rows"
              @pagination="getList" />
80 81 82 83 84 85
</div>
</template>

<script>
//关联订单
import ordeDetailsForm from "@/views/ecw/order/components/ordeDetailsForm";
86
import {getOrder} from "@/api/ecw/order";
dcy's avatar
dcy committed
87 88 89 90 91
import {
  deleteBatchGuanlianOrderByOrderId,
  deleteGuanlianOrderByOrderId,
  guanlianList,
} from "@/api/ecw/associatedOrder";
dcy's avatar
dcy committed
92
import {getDictDatas,DICT_TYPE} from '@/utils/dict'
93
import Template from "@/views/cms/template";
dcy's avatar
dcy committed
94
import {listSimpleUsers} from "@/api/system/user";
95 96
export default {
  name: "associatedOrder",
97 98 99
  props:{
    orderId:[String,Boolean]
  },
100
  components:{
101
    Template,
102
    ordeDetailsForm
103
  },
104 105 106 107 108 109 110 111 112 113
  computed:{
    check(){
      let flag = true;
      if(this.list.length === 1 && this.list[0].status === 5){
         flag = false
      }else {

      }
    }
  },
114 115
  data(){
    return {
dcy's avatar
dcy committed
116 117 118
      orderDetails:{},
      params:{
        orderId:undefined,
dcy's avatar
dcy committed
119 120 121
        relateOrderNo:undefined,
        page:1,
        rows:10
dcy's avatar
dcy committed
122 123 124
      },
      list:[],
      DICT_TYPE,
dcy's avatar
dcy committed
125
      getDictDatas,
dcy's avatar
dcy committed
126
      multipleSelection:[],
dcy's avatar
dcy committed
127 128
      userList:[],
      total:0,
129 130 131
    }
  },
  created() {
dcy's avatar
dcy committed
132 133
    this.params.orderId = this.orderId;
    this.getList();
134 135 136 137 138
    getOrder(this.orderId).then( r =>{
      if(r.code === 0){
        this.orderDetails = r.data;
      }
    })
dcy's avatar
dcy committed
139
    listSimpleUsers().then(r => this.userList = r.data)
140
  },
dcy's avatar
dcy committed
141 142
  methods:{
    getList(){
dcy's avatar
dcy committed
143 144
      guanlianList(this.params).then(r => {
        if(r.code === 0){
dcy's avatar
dcy committed
145 146
          this.list = r.data.list;
          this.total = r.data.total;
dcy's avatar
dcy committed
147
        }
dcy's avatar
dcy committed
148
      })
dcy's avatar
dcy committed
149 150 151 152 153
    },
    guanlianOrderByOrderId(id){
      deleteGuanlianOrderByOrderId({orderId:this.orderId,relateOrderId:id}).then(r =>{
        if(r.code === 0){
          this.getList()
dcy's avatar
dcy committed
154
          this.$message.success(this.$t('操作成功'));
dcy's avatar
dcy committed
155 156 157 158 159 160
        }
      })
    },
    batchGuanlianOrderByOrderId(val){
      deleteBatchGuanlianOrderByOrderId(val).then(r => {
        this.getList()
dcy's avatar
dcy committed
161
        this.$message.success(this.$t('操作成功'));
dcy's avatar
dcy committed
162 163 164 165 166
        this.multipleSelection = []
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
dcy's avatar
dcy committed
167
    }
dcy's avatar
dcy committed
168 169
  },

170 171 172 173 174 175 176 177 178 179 180 181 182
}
</script>

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