penddingList.vue 28.6 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4
<!--空运待出列表-->
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
5
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px" class="search-z">
lanbaoming's avatar
lanbaoming committed
6
      <el-form-item :label="$t('编号')" prop="orderNo">
7
        <el-input v-model="queryParams.numberKey" :placeholder="$t('请输入订单号、唛头、提单号')" clearable @keyup.enter.native="handleQuery" @input="replaceSpace(queryParams, 'numberKey')"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
8 9 10
      </el-form-item>

      <el-form-item :label="$t('发货人')" prop="consignorKey">
11
        <el-input v-model.trim="queryParams.consignorKey" :placeholder="$t('发货人')" clearable @keyup.enter.native="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
12 13
      </el-form-item>
      <el-form-item :label="$t('收货人')" prop="consigneeKey">
14
        <el-input v-model.trim="queryParams.consigneeKey" :placeholder="$t('收货人')" clearable @keyup.enter.native="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
15
      </el-form-item>
16
      <el-form-item :label="$t('客户经理')" >
17
        <user-selector manage v-model="queryParams.salesmanIds" multiple clearable @change="handleQuery"  class="w-200"
18
                       :prepend="{ id: 0, nickname: $t('未分配客户经理')}"/>
lanbaoming's avatar
lanbaoming committed
19
      </el-form-item>
yujinyao's avatar
yujinyao committed
20 21
      <div>
        <el-form-item :label="$t('始发仓')" prop="startWarehouseIds">
22
          <el-select v-model="queryParams.startWarehouseIds" :placeholder="$t('请选择始发仓')" clearable multiple @change="handleQuery"  class="w-200">
yujinyao's avatar
yujinyao committed
23 24 25 26 27 28
            <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的国')" prop="destCountryId">
          <el-select
            v-model="destCountryId"
zhengyi's avatar
zhengyi committed
29
            filterable
yujinyao's avatar
yujinyao committed
30
            multiple
31
            class="w-200"
yujinyao's avatar
yujinyao committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
            :label="destCountryId"
            :placeholder="$t('请选择目的国')"
            clearable
            @change="handleQuery"
          >
            <el-option
              v-for="item in AddressProvince"
              :key="item.guojia"
              :label="item.guojiaName"
              :value="item.guojia"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的城市')" prop="objectiveId">
          <el-select
            v-model="objectiveId"
zhengyi's avatar
zhengyi committed
48
            filterable
yujinyao's avatar
yujinyao committed
49
            multiple
50
            class="w-200"
yujinyao's avatar
yujinyao committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
            :placeholder="$t('请选择目的城市')"
            style="width: 200px"
            clearable
            @change="handleQuery"
          >
            <el-option
              v-for="item in AddressCity"
              :key="item.shi"
              :label="item.shiName"
              :value="item.shi"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
          <el-select
            v-model="destWarehouseId"
zhengyi's avatar
zhengyi committed
67
            filterable
yujinyao's avatar
yujinyao committed
68
            multiple
69
            class="w-200"
yujinyao's avatar
yujinyao committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83
            :placeholder="$t('请选择目的仓')"
            style="width: 200px"
            clearable
            @change="handleQuery"
          >
            <el-option
              v-for="item in AddressTown"
              :key="item.id"
              :label="item.titleZh"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </div>
lanbaoming's avatar
lanbaoming committed
84 85 86 87

      <!--<el-form-item :label="$t('运输方式')" prop="transportId">
        <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model.number="queryParams.transportId" clearable @change="handleQuery"/>
      </el-form-item>-->
88 89
      <!--根据需求文档 lanbm 2024-06-23-->
      <el-form-item :label="$t('控货')" prop="isCargoControl" v-show="showSearch">
90
        <dict-selector v-model="queryParams.isCargoControl" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" clearable  class="w-200"/>
91
      </el-form-item>
92
      <el-form-item :label="$t('商品类型')" prop="goodsTypes" v-show="showSearch">
93
        <selector v-model="queryParams.goodsTypes" multiple :options="productAttrList" label-field="attrName" value-field="id"  class="w-200">
94 95 96
        </selector>
      </el-form-item>

yujinyao's avatar
yujinyao committed
97
      <el-form-item :label="$t('商品')" prop="tidanNo" v-show="showSearch">
98
        <el-input v-model.trim="queryParams.prodKey" :placeholder="$t('请输入商品类型、品名或品牌')" clearable  @keyup.enter.native="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
99
      </el-form-item>
100

yujinyao's avatar
yujinyao committed
101 102
      <!--根据需求文档 lanbm 2024-06-23 隐藏-->
      <el-form-item :label="$t('入仓类型')" prop="warehouseType" v-show="showSearch">
103
        <dict-selector :type="DICT_TYPE.ECW_WAREHOUSING_TYPE" v-model="queryParams.warehouseType"  clearable  class="w-200"/>
yujinyao's avatar
yujinyao committed
104
      </el-form-item>
105

yujinyao's avatar
yujinyao committed
106
      <!--根据需求文档 lanbm 2024-06-23 隐藏-->
余金瑶's avatar
余金瑶 committed
107 108
      <el-form-item :label="$t('订单状态')" prop="status" v-show="showSearch">
        <dict-selector :type="DICT_TYPE.ORDER_STATUS" v-model="queryParams.status"
109
          @keyup.enter.native="handleQuery" clearable  class="w-200"/>
yujinyao's avatar
yujinyao committed
110 111
      </el-form-item>
      <el-form-item :label="$t('报关方式')" prop="customsType" v-show="showSearch">
112
        <dict-selector :type="DICT_TYPE.ECW_CUSTOMS_TYPE" v-model="queryParams.customsType" clearable @change="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
113
      </el-form-item>
yujinyao's avatar
yujinyao committed
114
      <el-form-item :label="$t('是否齐货')" v-show="showSearch">
lanbaoming's avatar
lanbaoming committed
115
        <!--// 字段存疑-->
116
        <dict-selector v-model="queryParams.isNeat" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool"  clearable @change="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
117 118
      </el-form-item>

余金瑶's avatar
余金瑶 committed
119
      <el-form-item :label="$t('备案属性')" prop="productRecords" v-show="showSearch">
120
        <dict-selector :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" multiple v-model="queryParams.productRecords" clearable @change="handleQuery"  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
121
      </el-form-item>
yujinyao's avatar
yujinyao committed
122 123
      <!--lanbm 2024-06-23 根据需求文档隐藏-->
      <el-form-item :label="$t('快递单号')" prop="number" v-show="showSearch">
124
        <el-input  class="w-200" v-model="queryParams.number" :placeholder="$t('快递单号')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/\s+/g, '')" />
yujinyao's avatar
yujinyao committed
125 126
      </el-form-item>
      <el-form-item :label="$t('外部仓')" prop="number" v-show="showSearch">
127
        <el-select v-model="queryParams.isExternalWarehouse" :placeholder="$t('请选择')" clearable @change="handleQuery"  class="w-200">
lanbaoming's avatar
lanbaoming committed
128 129 130 131 132
          <el-option :label="$t('外部仓')" :value="1"></el-option>
          <el-option :label="$t('自有仓')" :value="0"></el-option>
        </el-select>
      </el-form-item>

yujinyao's avatar
yujinyao committed
133
      <el-form-item :label="$t('异常状态')" prop="status" v-show="showSearch">
lanbaoming's avatar
lanbaoming committed
134
        <dict-selector :type="DICT_TYPE.ORDER_ABNORMAL_STATE" v-model="queryParams.abnormalState"
135
          @keyup.enter.native="handleQuery" clearable  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
136
      </el-form-item>
yujinyao's avatar
yujinyao committed
137
      <el-form-item :label="$t('审核状态')" prop="status" v-show="showSearch">
lanbaoming's avatar
lanbaoming committed
138
        <dict-selector :type="DICT_TYPE.ECW_ORDER_APPROVAL_TYPE" v-model="queryParams.auditType"
139
          @keyup.enter.native="handleQuery" clearable  class="w-200"/>
lanbaoming's avatar
lanbaoming committed
140
      </el-form-item>
余金瑶's avatar
余金瑶 committed
141
      <el-form-item :label="$t('增值服务')" prop="number" v-show="showSearch">
142
        <el-select v-model="queryParams.types" :placeholder="$t('请选择')" multiple clearable  class="w-200">
lanbaoming's avatar
lanbaoming committed
143 144 145 146 147 148
          <el-option :label="$t('普通订单')" :value="0"></el-option>
          <el-option :label="$t('集运服务')" :value="1"></el-option>
          <el-option :label="$t('海外仓')" :value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('出货渠道')" prop="number">
149
        <selector clearable :options="channelList" :label-field="$l('name')" value-field="channelId" v-model="queryParams.channelIds" multiple  class="w-200"></selector>
lanbaoming's avatar
lanbaoming committed
150
      </el-form-item>
余金瑶's avatar
余金瑶 committed
151
      <el-form-item :label="$t('特需')" prop="packageType" v-show="showSearch">
152
        <el-select v-model="queryParams.packageTypeArr" multiple :placeholder="$t('请选择')" clearable  class="w-200">
lanbaoming's avatar
lanbaoming committed
153 154 155 156 157
          <template v-for="item in getDictDatas(DICT_TYPE.ORDER_SPECIAL_NEEDS)">
            <el-option :label="$l(item, 'label')" :value="item.value"></el-option>
          </template>
        </el-select>
      </el-form-item>
158 159 160 161 162 163
      <div class="flex pb-20">
        <dict-selector :type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME" :filter="(item) => item.value != 'PickTime'" v-model="dateFilterType" defaultable class="w-200 mr-5" />
        <el-date-picker v-model="dateFilter" type="datetimerange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd HH:mm:ss" @change="handleQuery"> </el-date-picker>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery" :loading="loading" class="ml-10">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{ $t("重置") }}</el-button>
      </div>
lanbaoming's avatar
lanbaoming committed
164 165 166 167 168 169 170 171 172 173
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button :disabled="!multipleSelection.length" type="primary" plain size="mini" @click="batchCanShipment" v-hasPermi="['ecw:order:peddingList:batch_can_shipment']">{{$t('批量可出')}}</el-button>
        <el-button :disabled="!multipleSelection.length" type="primary" plain size="mini" @click="batchException" v-hasPermi="['ecw:order:peddingList:batch_exception']">{{$t('批量转异')}}</el-button>
        <el-button :disabled="!multipleSelection.length" type="primary" :loading="exporting" plain size="mini" @click="exportXls(ids)" v-hasPermi="['ecw:order:peddingList:export_selected']">{{$t('导出所选')}}</el-button>
        <el-button type="primary" :loading="exporting" plain size="mini" @click="exportXls(queryParams)" v-hasPermi="['ecw:order:peddingList:export_search']">{{$t('导出搜索')}}</el-button>
      </el-col>
余金瑶's avatar
余金瑶 committed
174 175 176 177
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
lanbaoming's avatar
lanbaoming committed
178 179 180
    </el-row>

    <!-- 列表 -->
zhengyi's avatar
zhengyi committed
181
    <el-table v-loading="loading" border :data="list" @selection-change="handleSelectionChange">
lanbaoming's avatar
lanbaoming committed
182 183
      <el-table-column type="selection" width="55" align="center" />

zhengyi's avatar
zhengyi committed
184
      <el-table-column :label="$t('订单编号')" width="120px" align="center" prop="orderNo" fixed>
lanbaoming's avatar
lanbaoming committed
185 186 187 188 189 190 191 192 193
        <template slot-scope="scope">
          <router-link :to="{path: '/order/detail',query: {orderId: scope.row.orderId}}" class="link-type">
            <span>{{ scope.row.orderNo }}</span>
          </router-link>
          <div style="display: flex;flex-wrap: wrap;" v-if="scope.row.advanceType">
            <el-button @click="deleteSpecial(item.value,scope.row.orderId)" size="mini" style="margin-left: 20px" type="danger" circle v-for="(item,index) in specialRendering(scope.row.advanceType)" :key="index">{{item.label[0]}}</el-button>
          </div>
        </template>
      </el-table-column>
zhengyi's avatar
zhengyi committed
194
      <el-table-column :label="$t('唛头')" align="center" prop="marks" fixed/>
lanbaoming's avatar
lanbaoming committed
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
      <el-table-column :label="$t('总箱数/入仓箱数')" align="center" prop="sumNum">
        <template slot-scope="{row}">
          <div :style="{color:row.customsType != 1 ? 'red' : null}">{{row.totalNum}}{{$t('')}}/{{row.sumNum}}{{$t('')}}</div>
          <dict-tag v-if="row.customsType != 1" style="color:red" :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="row.customsType"></dict-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('体积/重量')" align="center" prop="sumWeight">
        <template slot-scope="{row}">
          <!--入仓前是填单数据,入仓后是入仓数据,装柜审核通过等状态inwarehouseState会变成0,所以只能通过sumNum来判断-->
          <component
            :is="row.orderType > 1 ? 'el-tooltip' : 'div'"
            class="item"
            :style="{
            color: row.orderType > 1 ? 'red' : null
          }"
            effect="dark"
            :content="row.orderType===2 ? (row.wvolume||0)+'m³' : (row.vweight || 0) + 'kg'"
            placement="bottom">
            <div v-if="row.sumNum > 0">{{row.sumVolume}}m³ /{{row.sumWeight}}Kg</div>
            <div v-else>{{row.costVO.totalVolume}}m³ /{{row.costVO.totalWeight}}Kg</div>
          </component>
        </template>
      </el-table-column>
      <el-table-column :label="$t('始发仓')" align="center" prop="startWarehouseName">
        <template slot-scope="{row}">
          {{row.startWarehouseName}}
          <span style="color:red" v-if="row.isExternalWarehouse">({{$t('外部仓')}})</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('运输方式/目的地')" align="center" prop="transportId">
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportId" /> / {{row.dstWarehouseName}}
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
229
      <el-table-column :label="$t('控货')" align="center" prop="isCargoControl" v-show="showSearch">
lanbaoming's avatar
lanbaoming committed
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
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.isCargoControl" />
        </template>
      </el-table-column>
      <el-table-column :label="$t('订单状态')" align="center" prop="status">
        <template slot-scope="scope">
          <!-- <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" /> -->
          {{scope.row.statusMsg}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('预计运费/清关费')" align="center" prop="status">
        <template slot-scope="{row}">
          <div v-if="row.costVO">
            <template v-for="item in row.costVO.feeDtoList">
              <div v-if="[1,2].indexOf(item.feeType) > -1">
                {{item.feeType == 1 ? $t('运费'):$t('清关费')}}
                {{item.amount}}
                {{currencyMap[item.currencyId]}}
              </div>
            </template>
          </div>
        </template>
      </el-table-column>
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width actions" width="150px">
        <template slot-scope="scope">
            <el-button type="text" @click="setCanShipment(scope.row)"  v-hasPermi="['ecw:order:peddingList:can_shipment']">{{$t('可出')}}</el-button>
            <el-button type="text" @click="printTagOrderId=scope.row.orderId" v-hasPermi="['ecw:order:peddingList:print_tag']">{{$t('打印标签')}}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows"
      @pagination="getList" />

    <print-tag v-if="printTagOrderId !== null" :order-id="printTagOrderId" @close="printTagOrderId=null" />

    <el-dialog :title="$t('订单转异')" center :visible.sync="showBatchException">
      <el-form label-position="top" label-width="200" ref="batchExceptionForm" :model="batchExceptionForm" :rules="exceptionRules">
        <el-form-item :label="$t('订单号')" prop="manualExceptionType">
          {{multipleSelection.map(item => item.orderNo).join(',')}}
        </el-form-item>
        <el-form-item :label="$t('原因类型')" prop="manualExceptionType">
          <dict-selector v-model="batchExceptionForm.manualExceptionType" form-type="checkbox" :type="DICT_TYPE.MANUAL_EXCEPTION_TYPE" multiple ></dict-selector>
        </el-form-item>
        <el-form-item :label="$t('附件')">
          <image-and-video-upload v-model="batchExceptionForm.exceptionUrls"></image-and-video-upload>
        </el-form-item>
        <el-form-item :label="$t('详细信息')">
          <el-input v-model="batchExceptionForm.descZh" type="textarea"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button  type="primary" @click="handleBatchException">{{$t('确认转异')}}</el-button>
        <el-button @click="showBatchException = false">{{$t('取消')}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import Selector from '@/components/Selector'
import ProductSelector from '@/components/ProductSelector'
import { getProductAttrList } from '@/api/ecw/productAttr'
import CustomerSelector from '@/components/CustomerSelector'
import specialNeeds from '@/views/ecw/order/components/specialNeeds';
import {
    setCanShipment,
    canShipmentPage,
    batchCanShipment,
    batchException,
    waitingShipmentPage,
    orderSpecialNeed, exportCanShipment, exportWaitingShipment
} from "@/api/ecw/order";
import PrintTag from './components/PrintTag'
import PrintWarehouseReceipt from './components/PrintWarehouseReceipt'
import PrintLadingBill from './components/PrintLadingBill'
import BatchPickup from './components/BatchPickup'
import withdrawal from "@/views/ecw/order/withdrawal";
import UserSelector from '@/components/UserSelector'
import BatchSingleApplication from "@/views/ecw/order/batchSingleApplication";
import FeeApplication from "@/views/ecw/order/feeApplication";
import MergeLog from '@/views/ecw/order/components/MergeLog'
import PickupLog from './components/PickupLog'
import {getWarehouseList} from '@/api/ecw/warehouse'
import { getCurrencyPage } from "@/api/ecw/currency";
import SplitRevoke from "@/views/ecw/order/components/SplitRevoke";
import {getChannelList} from "@/api/ecw/channel";
import ImageAndVideoUpload from "@/components/ImageAndVideoUpload";
import Template from "@/views/cms/template/index.vue";
yujinyao's avatar
yujinyao committed
319 320
import {getRegionList} from "@/api/ecw/order"

lanbaoming's avatar
lanbaoming committed
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
export default {
  name: "EcwOrderPenddinglist",
  components: {
    Template,
    UserSelector,
    FeeApplication,
    BatchSingleApplication,
    MergeLog,
    PickupLog,
    SplitRevoke,
    ImageAndVideoUpload,
    CustomerSelector, ProductSelector, Selector,specialNeeds,PrintTag, PrintWarehouseReceipt, PrintLadingBill, BatchPickup,withdrawal
  },
  data() {
    return {
yujinyao's avatar
yujinyao committed
336
      // 显示搜索条件
337
      showSearch: false,
yujinyao's avatar
yujinyao committed
338 339
      // 导出中
      exporting: false,
lanbaoming's avatar
lanbaoming committed
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 订单列表
      list: [],

      // 查询参数
      queryParams: {
        page: 1,
        rows: 10
      },
      warehouseList:[],
      productAttrList: [],  // 商品属性
      molecule: '', //重货比分子
      denominator: '', //重货比分母
      dateFilterType: '', //日期筛选类别
      dateFilter: [], //筛选日期

      printTagOrderId: null, // 显示打印标签的订单ID
      isShow:false,//特殊显示
      multipleSelection:[],
      params: {
        page: 1,
        rows: 20,
      },
      currencyList:[],
      channelList:[],
      // 是否显示批量转异弹层
      showBatchException: false,
      // 批量转异表单
      batchExceptionForm: {},
      // 批量转异表单验证规则
      exceptionRules: {
        manualExceptionType: [
          { required: true, message: '请勾选原因类型', trigger: 'change' },
          {
            validator: (rule, value, callback) => {
              if (value.length <= 0) {
                callback(new Error('请勾选原因类型'))
              }
              callback()
            }, trigger: 'change'
          }
        ]
yujinyao's avatar
yujinyao committed
391 392 393 394 395 396 397
      },
      AddressProvince: [],
      AddressCity: [],
      AddressTown: [],
      destCountryId: null,
      objectiveId: null,
      destWarehouseId: null,
lanbaoming's avatar
lanbaoming committed
398 399 400 401 402
    };
  },
  watch:{
    isChinese(){
      this.getList()
yujinyao's avatar
yujinyao committed
403 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 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
    },
    destCountryId: {
      //监听当前地区值的变化,于与上方地区值进行了双向绑定
      deep: true, //深度监听
      handler() {
        //每当值省份值改变时其下地区值进行清空
        this.AddressCity = [];
        this.AddressTown = [];
        this.objectiveId = "";
        this.destWarehouseId = "";
        this.findByprovinceCode();
        if (this.destCountryId == "") {
          this.getAddressCity()
          this.getAddressTown()
        } else if (
          this.destCountryId != "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          this.getAddressTown()
        }
      },
    },
    objectiveId: {
      deep: true, //深度监听
      handler() {
        this.AddressTown = [];
        this.destWarehouseId = "";
        this.findBycityCode();

        if (
          this.objectiveId != "" &&
          this.destCountryId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
        } else if (
          this.destCountryId == "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          this.getAddressTown()
        } else if (
          this.destCountryId != "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          this.findByprovinceCode();
          this.getAddressTown()
        }
      },
    },
    destWarehouseId: {
      deep: true, //深度监听
      handler() {
        if (
          this.objectiveId != "" &&
          this.destCountryId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          this.findBycityCode();
        } else if (
          this.destCountryId != "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          this.getAddressTown()
        }
      },
    },
lanbaoming's avatar
lanbaoming committed
474 475 476 477 478 479 480 481 482 483 484 485 486
  },
  computed: {
    isChinese(){
      return this.$i18n.locale === 'zh_CN'
    },
    exportWarehouseList(){
      /* tradeType 1 进口,2出口,3进出口 */
      return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
    },
    importWarehouseList(){
      return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
    },
    combinedQueryParams(){
yujinyao's avatar
yujinyao committed
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
      let timeParams = {}
      if(this.dateFilterType && this.dateFilter){
        timeParams['begin' + this.dateFilterType] = this.dateFilter[0]
        timeParams['end' + this.dateFilterType] = this.dateFilter[1]
      }
      let queryParams = {}
      //目的国
      if (this.destCountryId != null && this.destCountryId != "") {
        queryParams.destCountryIds = this.destCountryId;
      }
      //目的城市
      if (this.objectiveId != null && this.objectiveId != "") {
        queryParams.objectiveIds = this.objectiveId;
      }
      //目的仓
      if (this.destWarehouseId != null && this.destWarehouseId != "") {
        queryParams.destWarehouseIds = this.destWarehouseId;
      }
      return Object.assign({}, this.queryParams, timeParams, queryParams)
lanbaoming's avatar
lanbaoming committed
506 507 508 509 510 511 512 513 514 515 516 517
    },
    currencyMap(){
      let map = {}
      this.currencyList.forEach(item => {
        map[item.id] = this.$l(item, 'title')
      })
      return map
    }
  },
  activated(){
    this.getList()
    this.$store.dispatch('getBadgeData')
yujinyao's avatar
yujinyao committed
518

lanbaoming's avatar
lanbaoming committed
519 520 521 522 523 524 525 526 527 528
  },
  created() {
    this.getList();
    getProductAttrList().then(res => this.productAttrList = res.data)
    getWarehouseList().then(res => this.warehouseList = res.data)

    getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
    getChannelList().then(res => this.channelList = res.data)

    this.$store.dispatch('getBadgeData')
yujinyao's avatar
yujinyao committed
529 530 531
    this.getAddressProvince()
    this.getAddressCity()
    this.getAddressTown()
lanbaoming's avatar
lanbaoming committed
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      const query = {...this.combinedQueryParams}
      if(query.packageTypeArr && query.packageTypeArr.length){
        query.packageType = query.packageTypeArr.join(',')
      }
      // 执行查询
      waitingShipmentPage(query).then(response => {
        // 部分情况下,订单后面的操作下拉菜单会显示按钮,但是下来没有选项,在elTable组件更新的时候会导致渲染错误,所以要在更新渲染前清空一次list让table彻底重新渲染,避免部分更新导致异常
        this.list = []
        this.$nextTick(() => {
          this.list = response.data.list
        })
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.$nextTick(this.getList)
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        page: 1,
        rows: 10
      }
      this.dateFilter = []
564 565 566 567 568
      this.destCountryId = null
      this.destWarehouseId = null
      this.objectiveId = null

      this.queryParams.channelIds = null
lanbaoming's avatar
lanbaoming committed
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push('create')
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push('edit?id=' + row.orderId)
    },
    // 表格多选
    handleSelectionChange(selection) {
      this.multipleSelection = selection
      this.ids = selection.map(item => item.orderId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    // 设置可出
    setCanShipment(row){
      this.$confirm(this.$t(`您确定要将订单{orderNo}设置为可出吗?`, {orderNo: row.orderNo})).then(() =>{
        return setCanShipment(row.orderId)
      }).then(res =>{
        this.$message.success(res.message || this.$t('操作成功'))
        this.getList()
      })
    },
    // 批量可出
    batchCanShipment(){
      let orderNo = this.multipleSelection.map(item => item.orderNo).join(', ')
      this.$confirm(this.$t(`您确定要将订单{orderNo}设置为可出吗?`, {orderNo})).then(() =>{
        return batchCanShipment(this.ids)
      }).then(res =>{
        this.$message.success(res.message || this.$t('操作成功'))
        this.getList()
      })
    },
    // 批量转异
    batchException(){
      if(!this.multipleSelection.length){
        return this.$message.error("暂无选择订单")
      }
      this.showBatchException = true
      this.batchExceptionForm.exceptionUrls = []
    },
    handleBatchException(){
      // 以下代码是copilot生成,暂无接口,回头在改
      this.$refs.batchExceptionForm.validate(valid => {
        if (valid) {
          let params = Object.assign({}, this.batchExceptionForm, {orderIds: this.ids})
          params.manualExceptionType = params.manualExceptionType.join(',')
          batchException(params).then(res =>{
            this.$message.success(res.message || this.$t('操作成功'))
            this.showBatchException = false
            this.getList()
          })
        }
      })
    },
yujinyao's avatar
yujinyao committed
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
    specialRendering(val){
        console.log('val', val)
        if(val !== undefined){
            let i = val.split(',')
            return this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS).filter(e => {
                return i.indexOf(e.value) > -1
            }).map(item => {
                // 打字开头的用最后一个字,否则取第一个字
                item.symbol = item.label[0] == '' ? item.label[item.label.length-1]: item.label[0]
                return item
            })
        }
    },
    deleteSpecial(id,orderId){
        this.$confirm(this.$t('确定删除此特需么?')).then(() => {
            return orderSpecialNeed({orderId:orderId,advanceType:id})
        }).then(() => {
            this.getList()
        })
    },
    exportXls(params){
        this.exporting = true
        const exportParams = Array.isArray(params) ? {orderIdList: params} : {...params}
        exportWaitingShipment(exportParams).then(res => {
            this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
        }).finally(() => {
            this.exporting = false
        })
    },
    getAddressProvince() {
      getRegionList(1, 1).then(({ data }) => {
        this.AddressProvince = data;
      })
    },
    getAddressCity() {
      getRegionList(4, 4).then(({ data }) => {
        this.AddressCity = data;
      })
    },
    getAddressTown() {
      getRegionList(5, 5).then(({ data }) => {
        this.AddressTown = data;
      })
    },
    findByprovinceCode() {
      if (this.destCountryId != null && this.destCountryId != '') {
        //获取当前省份值id,获取该省份下城市 destCountryId provinceCode
        getRegionList(2, this.destCountryId).then(({ data }) => {
          this.AddressCity = data;
        })
lanbaoming's avatar
lanbaoming committed
677
      }
yujinyao's avatar
yujinyao committed
678 679 680 681 682 683 684 685
    },
    findBycityCode() {
      if (this.objectiveId != null && this.objectiveId != '') {
        //获取当前城市值id,获取该城市下区域
        getRegionList(3, this.objectiveId).then(({ data }) => {
          this.AddressTown = data;
        })
      }
686 687 688 689
    },
    // 自动去除空格
    replaceSpace(obj, field) {
      obj[field] = obj[field].replace(/\s+/g, "")
yujinyao's avatar
yujinyao committed
690
    }
lanbaoming's avatar
lanbaoming committed
691 692 693 694 695 696 697 698 699 700 701 702 703
  }
};
</script>
<style lang="scss" scoped>
::v-deep .actions{
    .el-dropdown{
      margin-right: 10px;
      &:last-child {
        margin-right: 0;
      }
    }
}
</style>