supplementOrder.vue 14.5 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3 4 5 6 7
<template>
  <div class="supplementOrder">
    <el-card>
      <!-- 内容区 -->
      <el-row class="content-area">

        <!-- 左侧 -->
huhaiqing's avatar
huhaiqing committed
8
        <el-col :span="6" class="left-area">
huhaiqing's avatar
huhaiqing committed
9
          <el-row>
10 11
            <el-button type="primary" @click="addPart">{{$t('新增')}}</el-button>
            <el-button type="danger" @click="deletePart">{{$t('删除')}}</el-button>
huhaiqing's avatar
huhaiqing committed
12
          </el-row>
huhaiqing's avatar
huhaiqing committed
13
          <el-scrollbar style="height:calc(100% - 40px)">
huhaiqing's avatar
huhaiqing committed
14
            <el-row v-for="item in partList" :key="item.id" class="title-info" :class="item.id === partData.id ? 'selected' : ''">
huhaiqing's avatar
huhaiqing committed
15 16
              <div @click="partClick(item)">
                <p>{{item.title}}</p>
huhaiqing's avatar
huhaiqing committed
17
              </div>
huhaiqing's avatar
huhaiqing committed
18 19
              <el-collapse-transition>
                <div v-if="item.fold === false ? true : false">
huhaiqing's avatar
huhaiqing committed
20
                  <div v-for="(secGoog, index) in item.sectionOrderList" :key="index" class="part-secGoog">
huhaiqing's avatar
huhaiqing committed
21 22 23
                    <p>{{secGoog.orderNo}}</p>
                    <p>{{secGoog.prodTitleZh}}</p>
                    <div>
huhaiqing's avatar
huhaiqing committed
24
                      <i class="el-icon-delete" @click="deleteOrder(secGoog)"></i>
huhaiqing's avatar
huhaiqing committed
25 26 27 28 29 30
                    </div>
                  </div>
                </div>
              </el-collapse-transition>
              <div class="part-secGoog">
                <template>
huhaiqing's avatar
huhaiqing committed
31
                  {{getTotlContent(item.secStatistics)}}
huhaiqing's avatar
huhaiqing committed
32 33 34 35
                </template>
              </div>
            </el-row>
          </el-scrollbar>
huhaiqing's avatar
huhaiqing committed
36 37 38
        </el-col>

        <!-- 右侧 -->
huhaiqing's avatar
huhaiqing committed
39
        <el-col :span="18" class="right-area">
huhaiqing's avatar
huhaiqing committed
40 41

          <el-row class="right-title">
42 43 44
            <div>{{$t('货物筛选')}}</div>
            <div>{{$t('当前装柜')}}:{{partData.title}}</div>
            <div>{{$t('可预装方数')}}:{{unloadStatistics.volume}}m³,{{$t('重量')}}:{{unloadStatistics.weight}}Kg</div>
huhaiqing's avatar
huhaiqing committed
45 46 47 48
          </el-row>

          <!-- 搜索工作栏 -->
          <el-row>
huhaiqing's avatar
huhaiqing committed
49
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
50
              <el-form-item :label="$t('始发地')">
huhaiqing's avatar
huhaiqing committed
51 52
                <p>{{importCityName(queryParams.startWarehouseId)}}</p>
              </el-form-item>
53 54
              <el-form-item :label="$t('目的地')" prop="destination">
                <el-select v-model="queryParams.destWarehouseIdList" :placeholder="$t('请选择目的地')" multiple>
huhaiqing's avatar
huhaiqing committed
55
                  <el-option v-for="item in importWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
huhaiqing's avatar
huhaiqing committed
56 57
                </el-select>
              </el-form-item>
58 59
              <el-form-item :label="$t('订单号')" prop="orderNo">
                <el-input v-model="queryParams.orderNo" :placeholder="$t('请输入订单号')" clearable />
huhaiqing's avatar
huhaiqing committed
60 61 62
              </el-form-item>

              <el-form-item>
63
                <el-button type="primary" icon="el-icon-search" @click="queryAllData">{{$t('搜索')}}</el-button>
huhaiqing's avatar
huhaiqing committed
64 65 66 67 68
              </el-form-item>
            </el-form>
          </el-row>

          <!-- 表格 -->
huhaiqing's avatar
huhaiqing committed
69
          <el-scrollbar style="height:calc(100% - 164px)">
huhaiqing's avatar
huhaiqing committed
70
            <el-row v-for="(item, index) in toBePreList" :key="index" class="toBePre-table">
huhaiqing's avatar
huhaiqing committed
71 72
              <el-row class="table-title">
                <div>{{item.orderNo}}</div>
73
                <div>{{$t('发往')}}:{{item.destWarehouseName}}</div>
74
                <div :class="item.customsType !== 1 ? 'custom_type_red' : ''">
huhaiqing's avatar
huhaiqing committed
75
                  <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item.customsType" />
huhaiqing's avatar
huhaiqing committed
76
                </div>
77
                <div>{{$t('入仓时间')}}:{{formatDate(item.rucangTime)}}</div>
huhaiqing's avatar
huhaiqing committed
78
                <div>
79 80
                  <el-button type="text" @click="handleGoods('all', item)">[{{$t('全部预装')}}]</el-button>
                  <el-button type="text" @click="foldTable(index, item)">[{{item.fold ? $t('展开') : $t('收起')}}]</el-button>
huhaiqing's avatar
huhaiqing committed
81 82 83 84
                </div>
              </el-row>
              <el-collapse-transition>
                <div v-show="!item.fold">
huhaiqing's avatar
huhaiqing committed
85
                  <el-table v-loading="loading" :data="item.boxOrderItemList" border>
huhaiqing's avatar
huhaiqing committed
86
                    <el-table-column :label="$t('序号')" type="index" align="center" width="50" />
huhaiqing's avatar
huhaiqing committed
87 88 89 90 91
                    <el-table-column :label="$t('品名')" align="center" prop="" min-width="500">
                      <template slot-scope="{row}">
                        {{$l(row,'prodTitle')}}
                      </template>
                    </el-table-column>
92
                    <el-table-column :label="$t('品牌')" align="center" prop="brandType" width="120">
huhaiqing's avatar
huhaiqing committed
93
                      <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
94 95
                        <template v-if="scope.row.brandName">{{scope.row.brandName}}</template>
                        <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="scope.row.feeType" />
huhaiqing's avatar
huhaiqing committed
96 97
                      </template>
                    </el-table-column>
98 99
                    <el-table-column :label="$t('箱数')" align="center" prop="num" width="120" />
                    <el-table-column :label="$t('体积')" align="center" prop="volume" width="120">
huhaiqing's avatar
huhaiqing committed
100
                      <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
101
                        <p v-if="scope.row.volume">{{getTotlContent(scope.row,['volume'])}}</p>
huhaiqing's avatar
huhaiqing committed
102 103
                      </template>
                    </el-table-column>
104
                    <el-table-column :label="$t('重量')" align="center" prop="weight" width="120">
huhaiqing's avatar
huhaiqing committed
105
                      <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
106
                        <p v-if="scope.row.weight">{{getTotlContent(scope.row,['weight'])}}</p>
huhaiqing's avatar
huhaiqing committed
107 108
                      </template>
                    </el-table-column>
109
                    <!-- <el-table-column :label="$t('预装柜')"
110 111
                                     align="center"
                                     prop=""
Marcus's avatar
Marcus committed
112
                                     width="120">{{ $t('无返回') }}</el-table-column> -->
113
                    <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="100">
huhaiqing's avatar
huhaiqing committed
114
                      <template slot-scope="scope">
115
                        <el-button type="text" size="small" @click="handleGoods('singele',scope.row)">{{$t('预装')}}</el-button>
huhaiqing's avatar
huhaiqing committed
116 117 118 119 120
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </el-collapse-transition>
huhaiqing's avatar
huhaiqing committed
121
            </el-row>
huhaiqing's avatar
huhaiqing committed
122
          </el-scrollbar>
huhaiqing's avatar
huhaiqing committed
123 124

          <!-- 分页 -->
huhaiqing's avatar
huhaiqing committed
125
          <el-pagination background layout="prev, pager, next" :page-size="pageParam.pageSize" :total="total" @current-change="pageChange" v-show="total > 0"></el-pagination>
huhaiqing's avatar
huhaiqing committed
126 127 128 129 130
        </el-col>

      </el-row>
    </el-card>
    <el-row>
huhaiqing's avatar
huhaiqing committed
131
      <el-col :span="6" class="totle-info">
huhaiqing's avatar
huhaiqing committed
132
        <div>
133
          <p>{{$t('总计')}}:</p>
huhaiqing's avatar
huhaiqing committed
134
          <p>{{sumStatistics(partList)}}</p>
huhaiqing's avatar
huhaiqing committed
135 136
        </div>
        <div>
137
          <p>{{$t('容量')}}:</p>
138
          <p>{{calcCapacity}}</p>
huhaiqing's avatar
huhaiqing committed
139 140 141 142
        </div>
      </el-col>
    </el-row>
    <el-row class="button-area">
143
      <el-button type="primary" @click="handlerFinish">{{$t('完成')}}</el-button>
huhaiqing's avatar
huhaiqing committed
144 145 146 147 148
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
149
import {
huhaiqing's avatar
huhaiqing committed
150
  loadSecGoodsList,
huhaiqing's avatar
huhaiqing committed
151 152 153 154
  preloadPage,
  createSection,
  deleteSection,
  createGoods,
155
  remove,
huhaiqing's avatar
huhaiqing committed
156
} from "@/api/ecw/boxSea";
157 158 159 160 161
import {
  formatDate,
  getTotlContent,
  serviceMsg,
  getCapacity,
huhaiqing's avatar
huhaiqing committed
162
  sumStatistics,
163
} from "../../utils";
huhaiqing's avatar
huhaiqing committed
164 165 166 167 168
/**
 * 补单
 */
export default {
  name: "supplementOrder",
huhaiqing's avatar
huhaiqing committed
169
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
170 171 172 173 174
  data() {
    return {
      // 二维码/条码编号
      cabinetNo: "",
      // 表格数据
huhaiqing's avatar
huhaiqing committed
175 176 177 178 179
      listData: [],
      // 选中部分
      partData: {},
      // 部分列表
      partList: [],
180 181
      // 部分统计
      loadStatistics: {},
huhaiqing's avatar
huhaiqing committed
182
      // 查询参数
huhaiqing's avatar
huhaiqing committed
183 184 185 186 187 188 189
      queryParams: {
        startWarehouseId: this.$attrs.shipmentObj.startWarehouseId,
      },
      pageParam: { pageNo: 1, pageSize: 10 },
      // 待预装
      toBePreList: [],
      total: 0,
190
      loading: false,
191
      unloadStatistics: {},
huhaiqing's avatar
huhaiqing committed
192 193
    };
  },
huhaiqing's avatar
huhaiqing committed
194 195 196 197 198 199
  created() {
    this.queryAllData();
  },
  methods: {
    /* 查询已预装 */
    getSecGoods() {
huhaiqing's avatar
huhaiqing committed
200 201 202 203 204 205 206 207 208 209 210 211
      loadSecGoodsList({ shipmentId: this.$attrs.shipmentObj.id }).then(
        (res) => {
          this.partList = res.data.map((item, index) => {
            item.fold = true;
            if (
              Object.keys(this.partData).length &&
              this.partData.id === item.id
            ) {
              item.fold = false;
            }
            return {
              ...item,
huhaiqing's avatar
huhaiqing committed
212
              title: this.$t("第{index}部分", { index: index + 1 }),
huhaiqing's avatar
huhaiqing committed
213 214
            };
          });
huhaiqing's avatar
huhaiqing committed
215

huhaiqing's avatar
huhaiqing committed
216 217 218 219
          if (this.partList.length && !Object.keys(this.partData).length) {
            this.partList[0].fold = false;
            this.partData = this.partList[0];
          }
huhaiqing's avatar
huhaiqing committed
220
        }
huhaiqing's avatar
huhaiqing committed
221
      );
huhaiqing's avatar
huhaiqing committed
222 223 224
    },
    /* 查询待预装 */
    getPreLoad() {
225
      this.loading = true;
huhaiqing's avatar
huhaiqing committed
226 227 228 229 230
      // 处理查询参数
      let params = {
        ...this.queryParams,
      };
      preloadPage({ ...params, ...this.pageParam }).then((res) => {
231 232 233 234
        const { data } = res;
        this.toBePreList = data.dataList?.list ?? [];
        this.total = data.dataList?.total ?? 0;
        this.unloadStatistics = data.unloadStatistics ?? {};
235
        this.loading = false;
huhaiqing's avatar
huhaiqing committed
236 237 238 239
      });
    },
    /* 删除订单 */
    deleteOrder(data) {
240 241 242 243 244 245
      let params = {
        secId: this.partData.id,
        shipmentId: this.$attrs.shipmentObj.id,
        orderId: data.orderId,
      };
      remove(params).then((res) => {
huhaiqing's avatar
huhaiqing committed
246 247 248 249 250 251 252 253 254 255 256 257 258
        serviceMsg(res, this).then(() => {
          this.getSecGoods();
        });
      });
    },
    /** 预装 */
    handleGoods(type, item) {
      let params = {
        secId: this.partData.id,
        shipmentId: this.$attrs.shipmentObj.id,
        orderId: item.orderId,
      };
      if (type === "all") {
259
        params.orderItemIdList = item.boxOrderItemList.map(
huhaiqing's avatar
huhaiqing committed
260 261 262 263 264 265 266 267 268 269 270 271 272
          (data) => data.orderItemId
        );
      } else {
        params.orderItemIdList = [item.orderItemId];
      }
      createGoods(params).then((res) => {
        serviceMsg(res, this).then(() => {
          this.queryAllData();
        });
      });
    },
    /* 增加部分 */
    addPart() {
huhaiqing's avatar
huhaiqing committed
273 274 275 276
      createSection({
        shipmentId: this.$attrs.shipmentObj.id,
        isCover: 1,
      }).then((res) => {
huhaiqing's avatar
huhaiqing committed
277 278 279 280 281 282 283
        serviceMsg(res, this).then(() => {
          this.getSecGoods();
        });
      });
    },
    /* 删除部分 */
    deletePart() {
huhaiqing's avatar
huhaiqing committed
284 285 286 287 288 289 290
      this.$confirm(
        this.$t("确认删除该部分及其已预装订单?"),
        this.$t("提示"),
        {
          type: "warning",
        }
      )
huhaiqing's avatar
huhaiqing committed
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
        .then((_) => {
          deleteSection(this.partData.id).then((res) => {
            serviceMsg(res, this).then(() => {
              this.partData = {};
              this.getSecGoods();
            });
          });
        })
        .catch((_) => {});
    },
    /* 部分点击 */
    partClick(item) {
      item.fold = !item.fold;
      this.partData = item;
      let copyList = [...this.partList];
      copyList = copyList.map((cItem) => {
        cItem.fold = true;
        if (item.id === cItem.id) {
          cItem.fold = false;
          return cItem;
        }
      });
      this.$set(this.partList, copyList);
    },
    /* 获取城市 */
    importCityName(id) {
      var arr = this.$attrs.warehouseList.filter((item) => item.id == id);
huhaiqing's avatar
huhaiqing committed
318
      return arr.length > 0 ? this.$l(arr[0], "title") : this.$t("");
huhaiqing's avatar
huhaiqing committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
    },
    /* 待预装订单分页 */
    pageChange(page) {
      this.pageParam.pageNo = page;
      this.getPreLoad();
    },
    /* 折叠 */
    foldTable(index, item) {
      item.fold = !item.fold;
      this.$set(this.toBePreList, index, item);
    },
    /* 查询所有数据 */
    queryAllData() {
      this.getSecGoods();
      this.pageParam.pageNo = 1;
      this.getPreLoad();
    },
    /* 完成 */
    handlerFinish() {
338
      this.$confirm(this.$t("确定执行操作?"), this.$t("提示"), {
huhaiqing's avatar
huhaiqing committed
339 340 341 342 343 344 345
        type: "warning",
      })
        .then((_) => {
          this.$emit("supplementFinish");
        })
        .catch((_) => {});
    },
346
    formatDate,
huhaiqing's avatar
huhaiqing committed
347
    getTotlContent,
huhaiqing's avatar
huhaiqing committed
348
    sumStatistics,
huhaiqing's avatar
huhaiqing committed
349 350 351 352 353 354 355 356
  },
  computed: {
    /** 目的地 */
    importWarehouseList() {
      return this.$attrs.warehouseList.filter(
        (item) => item.tradeType == "1" || item.type == "3"
      );
    },
357 358 359 360 361
    /* 容量 */
    calcCapacity() {
      const { cabinetRespVO } = this.$attrs.shipmentObj;
      return getCapacity(cabinetRespVO);
    },
huhaiqing's avatar
huhaiqing committed
362
  },
huhaiqing's avatar
huhaiqing committed
363 364 365
};
</script>

huhaiqing's avatar
huhaiqing committed
366
<style lang="scss">
huhaiqing's avatar
huhaiqing committed
367
.supplementOrder {
huhaiqing's avatar
huhaiqing committed
368 369
  display: flex;
  flex-direction: column;
huhaiqing's avatar
huhaiqing committed
370 371 372
  p {
    margin: 0;
  }
huhaiqing's avatar
huhaiqing committed
373 374 375
  .el-card__body {
    height: 100%;
  }
huhaiqing's avatar
huhaiqing committed
376 377
  .content-area {
    display: flex;
huhaiqing's avatar
huhaiqing committed
378
    height: 100%;
huhaiqing's avatar
huhaiqing committed
379 380
    .left-area {
      border-right: 3px solid #e6ebf5;
huhaiqing's avatar
huhaiqing committed
381 382 383
      .el-scrollbar__view {
        padding-right: 10px;
      }
huhaiqing's avatar
huhaiqing committed
384 385 386
      .title-info {
        margin-top: 10px;
        height: auto;
huhaiqing's avatar
huhaiqing committed
387 388 389 390 391 392 393 394

        &.selected {
          > div:first-child {
            background-color: #4f9cdd;
            color: #fff;
          }
        }

huhaiqing's avatar
huhaiqing committed
395 396 397 398 399
        > div:first-child {
          font-size: 16px;
          background-color: #f2f2f2;
          line-height: 30px;
          text-align: center;
huhaiqing's avatar
huhaiqing committed
400
          cursor: pointer;
huhaiqing's avatar
huhaiqing committed
401
        }
huhaiqing's avatar
huhaiqing committed
402 403
        .part-secGoog {
          margin-top: 5px;
huhaiqing's avatar
huhaiqing committed
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
          display: flex;
          align-items: center;
          > p {
            margin-right: 10px;
            color: #4f9cdd;
          }
          > div {
            flex: 1;
            text-align: right;
            > i {
              cursor: pointer;
              color: red;
            }
          }
        }
      }
    }
    .right-area {
      padding-left: 10px;
      .right-title {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
        font-size: 16px;
        > div:first-child {
          font-size: 18px;
        }
        > div:first-child + div {
          margin-left: 20px;
        }
        > div:last-child {
          flex: 1;
          text-align: right;
          font-size: 18px;
          color: red;
        }
      }
      .table-title {
        display: flex;
huhaiqing's avatar
huhaiqing committed
443
        align-items: center;
huhaiqing's avatar
huhaiqing committed
444 445 446 447 448 449 450 451 452 453
        line-height: 30px;
        background-color: #4f9cdd;
        color: #fff;
        > div {
          margin-left: 10px;
        }
        > div:last-child {
          flex: 1;
          display: flex;
          justify-content: flex-end;
huhaiqing's avatar
huhaiqing committed
454 455 456 457
          > .el-button--text {
            color: #fff;
          }
          > .el-button--text:last-child {
huhaiqing's avatar
huhaiqing committed
458 459 460 461 462 463 464 465 466
            margin-right: 10px;
          }
        }
      }
      .el-pagination {
        margin-top: 10px;
        padding: 0;
        text-align: right;
      }
huhaiqing's avatar
huhaiqing committed
467 468 469 470

      .toBePre-table {
        margin-bottom: 10px;
      }
huhaiqing's avatar
huhaiqing committed
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
    }
  }
  .totle-info {
    font-size: 20px;
    margin-top: 15px;
    > div {
      display: flex;
      margin-bottom: 5px;
    }
  }
  .button-area {
    text-align: center;
  }
}
</style>