notMutexOrder.vue 4.22 KB
Newer Older
dcy's avatar
dcy committed
1 2
<template>
  <div class="add-associated-order">
dcy's avatar
dcy committed
3
    <h1 class="title">{{$t('订单号')}}{{ orderDetails.orderNo }} {{$t('选择订单')}}</h1>
dcy's avatar
dcy committed
4 5
    <el-divider></el-divider>
    <el-form inline label-width="85px" label-position="left">
dcy's avatar
dcy committed
6
      <el-form-item :label="$t('订单号')">
dcy's avatar
dcy committed
7
        <div class="content">
dcy's avatar
dcy committed
8
          <el-input v-model.trim="params.mutualOrderNo"></el-input>
dcy's avatar
dcy committed
9 10 11
        </div>
      </el-form-item>
      <el-form-item>
dcy's avatar
dcy committed
12
        <el-button @click="getUnassociatedOrder">{{$t('查询')}}</el-button>
dcy's avatar
dcy committed
13 14 15
      </el-form-item>
    </el-form>
    <h1 class="title">
dcy's avatar
dcy committed
16
      {{$t('未加入互斥订单列表')}}
dcy's avatar
dcy committed
17 18 19 20 21 22 23
    </h1>
    <el-divider></el-divider>
    <el-table :data="list" @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55"
      ></el-table-column>
dcy's avatar
dcy committed
24 25 26 27
      <el-table-column :label="$t('序号')" type="index"></el-table-column>
      <el-table-column :label="$t('订单号')" prop="orderNo"></el-table-column>
      <el-table-column :label="$t('唛头')" prop="marks"></el-table-column>
      <el-table-column :label="$t('货物数据')">
28 29
        <template v-slot="{row}">
          <div>
dcy's avatar
dcy committed
30
            {{row.costVO.totalNum}}{{$t('')}}
31 32 33 34 35
          </div>
          <div>
            {{row.costVO.totalVolume}}
          </div>
          <div>
36
            {{row.costVO.totalWeight}}KG
37 38 39
          </div>
        </template>
      </el-table-column>
dcy's avatar
dcy committed
40
      <el-table-column :label="$t('入仓时间')" prop="rucangTime">
41 42 43 44
        <template v-slot="{row}">
          {{parseTime(row.rucangTime)}}
        </template>
      </el-table-column>
邓春圆's avatar
邓春圆 committed
45
      <el-table-column :label="$t('状态')" prop="statusMsg" >
dcy's avatar
dcy committed
46
      </el-table-column>
dcy's avatar
dcy committed
47
      <el-table-column :label="$t('操作')">
dcy's avatar
dcy committed
48
        <template v-slot:default="scope">
dcy's avatar
dcy committed
49
          <el-button type="text" size="mini" @click="joinAssociation(scope.row.orderId)">{{$t('加入互斥')}}</el-button>
dcy's avatar
dcy committed
50 51 52
        </template>
      </el-table-column>
    </el-table>
dcy's avatar
dcy committed
53 54
    <pagination v-show="total > 0" :total="total" :page.sync="params.page" :limit.sync="params.rows"
                @pagination="getUnassociatedOrder" />
dcy's avatar
dcy committed
55 56 57 58
    <el-row style="margin-top: 40px">
      <el-col>
        <el-button type="primary" @click="batchJoin(multipleSelection.map(e => e.orderId))"
                   :disabled="multipleSelection.length === 0">
dcy's avatar
dcy committed
59
          {{$t('批量加入互斥')}}
dcy's avatar
dcy committed
60 61
        </el-button>
        <el-button @click="$router.push('/order/mutex-order/'+ orderId);">
dcy's avatar
dcy committed
62
          {{$t('取消')}}
dcy's avatar
dcy committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
        </el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
//添加关联订单
import {getOrder} from "@/api/ecw/order";
import Template from "@/views/cms/template";
import {getUnGuanlianOrderByOrderId, guanlianCreate, ordeRcreateBatch} from "@/api/ecw/mutexOrder";

export default {
  name: "notMutexOrder",
  components: {Template},
  props: {
    orderId: [String, Number]
  },
  data() {
    return {
      orderDetails: {},
      mutualOrderId: '',
      list: [],
      multipleSelection: [],
dcy's avatar
dcy committed
87 88 89 90 91
      total:0,
      params:{
        page:1,
        rows:10,
      }
dcy's avatar
dcy committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
    }
  },
  created() {
    getOrder(this.orderId).then(r => {
      if (r.code === 0) {
        this.orderDetails = r.data;
      }
    })
    this.getUnassociatedOrder();
  },
  mounted() {
  },
  methods: {
    getUnassociatedOrder() {
      getUnGuanlianOrderByOrderId({
        orderId: this.orderId,
dcy's avatar
dcy committed
108
        ...this.params,
dcy's avatar
dcy committed
109 110
      }).then(r => {
        if (r.code === 0) {
dcy's avatar
dcy committed
111 112
          this.list = r.data.list;
          this.total = r.data.total;
dcy's avatar
dcy committed
113 114 115 116 117 118 119 120 121 122 123 124
        }
      })
    },
    joinAssociation(val) {
      guanlianCreate({orderId: this.orderId, mutualOrderId: val}).then(this.operation)
    },
    batchJoin(val) {
      let p = val.map(e => ({orderId:this.orderId,mutualOrderId:e}))
      ordeRcreateBatch(p).then(this.operation)
    },
    operation(r) {
      if (r.code === 0) {
dcy's avatar
dcy committed
125
        this.$message.success(this.$t('操作成功'))
dcy's avatar
dcy committed
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
        this.getUnassociatedOrder();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  }
}
</script>

<style scoped lang="scss">
.add-associated-order {
  padding: 20px;
  box-sizing: border-box;

  .title {
    font-size: 30px;
    font-weight: 600;
    text-align: left;
  }

  .el-form {
    .content {
      width: 300px;
    }
  }
}
</style>