cargoControl.vue 29.3 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
4
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="140px" class="search-z">
yujinyao's avatar
yujinyao committed
5
      <el-form-item :label="$t('编号')" prop="orderNo">
6
        <el-input class="w-200" v-model.trim="noParam.value" :placeholder="$t('请输入订单号、唛头、提单号')" clearable @keyup.enter.native="handleQuery" @input="replaceSpace(noParam, 'value')">
yujinyao's avatar
yujinyao committed
7
          <template slot="prepend">
8
            <dict-selector :type="DICT_TYPE.ORDER_QUERY_NO_FIELD" defaultable v-model="noParam.key"/>
yujinyao's avatar
yujinyao committed
9 10 11
          </template>
        </el-input>
      </el-form-item>
12
      <el-form-item :label="$t('发货人')" prop="consignorKey">
13
        <el-input v-model.trim="queryParams.consignorKey" :placeholder="$t('发货人')" clearable @keyup.enter.native="handleQuery" class="w-200"/>
14 15
      </el-form-item>
      <el-form-item :label="$t('收货人')" prop="consigneeKey">
16
        <el-input v-model.trim="queryParams.consigneeKey" :placeholder="$t('收货人')" clearable @keyup.enter.native="handleQuery" class="w-200"/>
17 18
      </el-form-item>
      <el-form-item :label="$t('控货状态')" prop="isCargoControl">
19
        <dict-selector v-model="queryParams.cargoControlStatusList" multiple :type="DICT_TYPE.CONTROL_GOODS_STATUS" clearable @change="handleQuery" class="w-200"/>
lanbaoming's avatar
lanbaoming committed
20
      </el-form-item>
余金瑶's avatar
余金瑶 committed
21 22
      <div>
        <el-form-item :label="$t('始发仓')" prop="startWarehouseIds">
23
          <el-select v-model="queryParams.startWarehouseIds" multiple :placeholder="$t('请选择始发仓')" clearable @change="handleQuery" class="w-200">
余金瑶's avatar
余金瑶 committed
24 25 26 27
            <el-option v-for="item in exportWarehouseList" :label="item.titleZh" :value="item.id" :key="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的国')" prop="destCountryId">
28
          <el-select v-model="destCountryId" multiple :label="destCountryId" :placeholder="$t('请选择目的国')" clearable @change="handleQuery" class="w-200">
332784038@qq.com's avatar
6  
332784038@qq.com committed
29
            <el-option v-for="item in AddressProvince" :key="item.guojia" :label="item.guojiaName" :value="item.guojia"></el-option>
余金瑶's avatar
余金瑶 committed
30 31 32
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的城市')" prop="objectiveId">
33
          <el-select v-model="objectiveId" multiple :placeholder="$t('请选择目的城市')" style="width: 200px" clearable @change="handleQuery" class="w-200">
332784038@qq.com's avatar
6  
332784038@qq.com committed
34
            <el-option v-for="item in AddressCity" :key="item.shi" :label="item.shiName" :value="item.shi"></el-option>
余金瑶's avatar
余金瑶 committed
35 36 37
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
38
          <el-select v-model="destWarehouseId" multiple :placeholder="$t('请选择目的仓')" style="width: 200px" clearable @change="handleQuery" class="w-200">
332784038@qq.com's avatar
6  
332784038@qq.com committed
39
            <el-option v-for="item in AddressTown" :key="item.id" :label="item.titleZh" :value="item.id"></el-option>
余金瑶's avatar
余金瑶 committed
40 41 42 43
          </el-select>
        </el-form-item>
      </div>
      <el-form-item :label="$t('客户经理')">
44
        <user-selector manage v-model="queryParams.salesmanIds" multiple clearable @change="handleQuery" :prepend="{ id: 0, nickname: $t('未分配客户经理') }" class="w-200"/>
yujinyao's avatar
yujinyao committed
45
      </el-form-item>
余金瑶's avatar
余金瑶 committed
46
      <el-form-item :label="$t('运输方式')" prop="transportId" v-show="showSearch">
47
        <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model.number="queryParams.transportId" clearable @change="handleQuery" class="w-200"/>
lanbaoming's avatar
lanbaoming committed
48
      </el-form-item>
余金瑶's avatar
余金瑶 committed
49
      <el-form-item :label="$t('出货渠道')" prop="channelIds">
50
        <selector clearable :options="channelList" :label-field="$l('name')" value-field="channelId" v-model="queryParams.channelIds" multiple class="w-200"></selector>
余金瑶's avatar
余金瑶 committed
51
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
52
      <!--<el-form-item :label="$t('订单编号')" prop="orderNo">
yujinyao's avatar
yujinyao committed
53
        <el-input v-model="queryParams.orderNo" :placeholder="$t('订单编号')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/\s+/g, '')" />
dragondean@qq.com's avatar
dragondean@qq.com committed
54
      </el-form-item>-->
yujinyao's avatar
yujinyao committed
55
      <el-form-item :label="$t('商品') + ':'" v-show="showSearch">
56
        <el-input v-model.trim="prodParam.value" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery" class="w-200">
dragondean@qq.com's avatar
dragondean@qq.com committed
57
          <template slot="prepend">
58
            <dict-selector :type="DICT_TYPE.ORDER_QUERY_PROD_FIELD" defaultable v-model="prodParam.key"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
59 60
          </template>
        </el-input>
lanbaoming's avatar
lanbaoming committed
61
      </el-form-item>
62

余金瑶's avatar
余金瑶 committed
63
      <el-form-item :label="$t('订单状态')" prop="statusList" v-show="showSearch">
64
        <dict-selector :type="DICT_TYPE.ORDER_STATUS" multiple v-model="queryParams.statusList" @keyup.enter.native="handleQuery" clearable @change="handleQuery" class="w-200"/>
lanbaoming's avatar
lanbaoming committed
65
      </el-form-item>
332784038@qq.com's avatar
6  
332784038@qq.com committed
66
      <!--<el-form-item :label="$t('提单号')" prop="tidanNo">
yujinyao's avatar
yujinyao committed
67
        <el-input v-model.trim="queryParams.tidanNo" :placeholder="$t('提单号')" clearable @keyup.enter.native="handleQuery" />
dragondean@qq.com's avatar
dragondean@qq.com committed
68
      </el-form-item>-->
69

lanbaoming's avatar
lanbaoming committed
70

71
      <el-form-item :label="$t('报关方式')" prop="customsTypes" v-show="showSearch">
72
        <dict-selector :type="DICT_TYPE.ECW_CUSTOMS_TYPE" multiple v-model="queryParams.customsTypes" clearable @change="handleQuery" class="w-200"/>
lanbaoming's avatar
lanbaoming committed
73 74
      </el-form-item>

dragondean@qq.com's avatar
dragondean@qq.com committed
75
      <!--<el-form-item :label="$t('唛头')" prop="marks">
yujinyao's avatar
yujinyao committed
76
        <el-input v-model="queryParams.marks" :placeholder="$t('唛头')" clearable @keyup.enter.native="handleQuery" />
dragondean@qq.com's avatar
dragondean@qq.com committed
77
      </el-form-item>-->
余金瑶's avatar
余金瑶 committed
78
      <el-form-item :label="$t('备案属性')" prop="productRecords" v-show="showSearch">
79
        <dict-selector :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" multiple v-model="queryParams.productRecords" clearable @change="handleQuery" class="w-200"/>
余金瑶's avatar
余金瑶 committed
80 81
      </el-form-item>
      <el-form-item :label="$t('外部仓')" prop="isExternalWarehouse" v-show="showSearch">
82
        <el-select v-model="queryParams.isExternalWarehouse" :placeholder="$t('请选择')" clearable @change="handleQuery" class="w-200">
lanbaoming's avatar
lanbaoming committed
83 84 85 86
          <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
87
      <el-form-item :label="$t('增值服务')" prop="types" v-show="showSearch">
88
        <el-select v-model="queryParams.types" :placeholder="$t('请选择')" clearable multiple @change="handleQuery" class="w-200">
lanbaoming's avatar
lanbaoming committed
89 90 91 92 93
          <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>
yujinyao's avatar
yujinyao committed
94
      <el-form-item :label="$t('商品类型')" prop="goodsTypes" v-show="showSearch">
95
        <selector v-model="queryParams.goodsTypes" multiple :options="productAttrList" label-field="attrName" value-field="id" class="w-200"> </selector>
yujinyao's avatar
yujinyao committed
96
      </el-form-item>
97 98 99
      <!--<el-form-item :label="$t('订单放货锁定收货人到期时间')" prop="lockConsigneeTime">

      </el-form-item>-->
100
      <el-form-item :label="$t('提货状态')" v-show="showSearch">
101
        <dict-selector :type="DICT_TYPE.PICK_STATE" multiple v-model="queryParams.pickStateList" clearable @change="handleQuery" class="w-200"/>
102
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
103
      <el-form-item :label="$t('放货率')" v-show="showSearch">
104
        <el-input type="number" v-model.trim="releaseRatio.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" class="w-200">
dragondean@qq.com's avatar
dragondean@qq.com committed
105
          <template slot="prepend">
106
            <dict-selector :type="DICT_TYPE.RELEASE_RATIO_FIELD" defaultable v-model="releaseRatio.key"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
107 108 109
          </template>
        </el-input>
      </el-form-item>
110
      <el-form-item :label="$t('提货率')" v-show="showSearch">
111
        <el-input type="number" v-model.trim="pickRatio.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" class="w-200">
112
          <template slot="prepend">
113
            <dict-selector :type="DICT_TYPE.PICK_RATIO_FIELD" defaultable v-model="pickRatio.key"/>
114 115 116
          </template>
        </el-input>
      </el-form-item>
117
      <el-form-item :label="$t('特需')" prop="packageTypeArr" v-show="showSearch">
118
        <el-select v-model="queryParams.packageTypeArr" multiple :placeholder="$t('请选择')" clearable class="w-200">
119
          <template v-for="item in getDictDatas(DICT_TYPE.ORDER_SPECIAL_NEEDS)">
332784038@qq.com's avatar
6  
332784038@qq.com committed
120
            <el-option :label="$l(item, 'label')" :value="item.value"></el-option>
121 122 123
          </template>
        </el-select>
      </el-form-item>
124
      <el-form-item :label="$t('订单限制修改收货人')" prop="isLimitUpdateConsignee">
125
        <el-select v-model="queryParams.isLimitUpdateConsignee" :placeholder="$t('请选择')" clearable @change="handleQuery" class="w-200">
126 127 128 129
          <el-option :label="$t('是')" :value="1"></el-option>
          <el-option :label="$t('否')" :value="0"></el-option>
        </el-select>
      </el-form-item>
130
      <div class="flex pb-20">
131
        <dict-selector :type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME"  v-model="dateFilterType" defaultable class="w-200 mr-5" />
132 133 134
        <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>
135
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" v-hasPermi="['ecw:cargo:export:search']">{{ $t("导出") }}</el-button>
136
      </div>
lanbaoming's avatar
lanbaoming committed
137 138 139 140 141
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="2">
332784038@qq.com's avatar
6  
332784038@qq.com committed
142
        <el-button v-hasPermi="['ecw:cargo_control:batch_review']" type="primary" plain icon="el-icon-setting" size="mini" :disabled="multiple" @click="batchReview">{{ $t("批量复核") }}</el-button>
lanbaoming's avatar
lanbaoming committed
143 144 145 146 147 148 149 150
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />

332784038@qq.com's avatar
6  
332784038@qq.com committed
151
      <el-table-column :label="$t('订单编号')" width="120px" align="center" prop="orderNo">
lanbaoming's avatar
lanbaoming committed
152 153 154 155 156
        <template slot-scope="scope">
          <router-link :to="`detail?orderId=` + scope.row.orderId">{{ scope.row.orderNo }}</router-link>
        </template>
      </el-table-column>
      <el-table-column :label="$t('唛头')" align="center" prop="marks" />
332784038@qq.com's avatar
6  
332784038@qq.com committed
157 158 159
      <el-table-column :label="$t('箱数')" align="center" prop="sumNum">
        <template v-slot="{ row }">
          {{ row.sumNum > 0 ? row.sumNum : row.totalNum }}
lanbaoming's avatar
lanbaoming committed
160 161 162
        </template>
      </el-table-column>
      <el-table-column :label="$t('已放箱数')" align="center" prop="sumWeight">
332784038@qq.com's avatar
6  
332784038@qq.com committed
163
        <template slot-scope="{ row }">{{ row.releaseNum }}</template>
lanbaoming's avatar
lanbaoming committed
164
      </el-table-column>
165
      <el-table-column :label="$t('放货率')" align="left" prop="status">
332784038@qq.com's avatar
332784038@qq.com committed
166
        <template slot-scope="{ row }"> {{ row.releaseRatio }}% </template>
167
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
168
      <el-table-column :label="$t('订单状态')" align="left" prop="status">
332784038@qq.com's avatar
6  
332784038@qq.com committed
169 170
        <template slot-scope="{ row }">
          {{ row.statusMsg }}
lanbaoming's avatar
lanbaoming committed
171 172
        </template>
      </el-table-column>
173
      <el-table-column :label="$t('提货率')" align="left" prop="status">
332784038@qq.com's avatar
332784038@qq.com committed
174
        <template slot-scope="{ row }"> {{ row.pickRatio || 0 }}% </template>
175
      </el-table-column>
176
      <el-table-column :label="$t('已卸柜/已到仓时间')" align="left" prop="status">
332784038@qq.com's avatar
6  
332784038@qq.com committed
177 178
        <template slot-scope="{ row }">
          {{ row.unloadTime }}
179 180
        </template>
      </el-table-column>
181
      <el-table-column :label="$t('放货锁定收货人到期时间')" align="left" prop="status">
332784038@qq.com's avatar
6  
332784038@qq.com committed
182 183
        <template slot-scope="{ row }">
          {{ row.lockConsigneeTime }}
184 185 186
        </template>
      </el-table-column>
      <el-table-column :label="$t('订单限制修改收货人')" align="left" prop="status">
332784038@qq.com's avatar
6  
332784038@qq.com committed
187 188
        <template slot-scope="{ row }">
          {{ row.isLimitUpdateConsignee ? $t("") : $t("") }}
189 190
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
191
      <!--<el-table-column :label="$t('提单号')" align="center" prop="status">
lanbaoming's avatar
lanbaoming committed
192 193 194
        <template slot-scope="scope">
          {{scope.row.tidanNo}}
        </template>
dragondean@qq.com's avatar
dragondean@qq.com committed
195
      </el-table-column>-->
lanbaoming's avatar
lanbaoming committed
196
      <el-table-column :label="$t('放货人')" align="center" prop="sumWeight">
332784038@qq.com's avatar
6  
332784038@qq.com committed
197
        <template slot-scope="{ row }">{{ row.cargoControlName }}</template>
lanbaoming's avatar
lanbaoming committed
198 199
      </el-table-column>
      <el-table-column :label="$t('控货状态')" align="center" prop="transportId">
332784038@qq.com's avatar
6  
332784038@qq.com committed
200 201
        <template slot-scope="{ row }">
          <template v-if="row.cargoControlStatus == 1 && row.isToReview">{{ $t("放货中") }}</template>
lanbaoming's avatar
lanbaoming committed
202 203 204 205 206 207
          <dict-tag v-else :type="DICT_TYPE.CONTROL_GOODS_STATUS" :value="row.cargoControlStatus" />
        </template>
      </el-table-column>

      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="150px">
        <template slot-scope="scope">
208 209 210 211
          <!--
            2408新需求,当订单放货状态不等于已放完货,按钮可点击,佛足额置灰不可点击
            https://czxy.cpolar.cn/task-view-266.html
            -->
212
          <!--修改放货限制-->
332784038@qq.com's avatar
6  
332784038@qq.com committed
213
          <el-button type="text" size="mini" @click="showUpdateReleaseLimit = scope.row" v-hasPermi="['ecw:cargo_control:updateReleaseLimit']" :disabled="scope.row.cargoControlStatus == 1 && !scope.row.isToReview">{{ $t("修改放货限制") }}</el-button>
lanbaoming's avatar
lanbaoming committed
214
          <!--控货中,已入仓-->
332784038@qq.com's avatar
6  
332784038@qq.com committed
215
          <template v-if="[0, 2].indexOf(scope.row.cargoControlStatus) > -1 && scope.row.sumNum > 0">
216 217 218 219
            <!--
            2408新需求,如果有修改放货限制审批 和 海外仓修改申请在途则置灰
            https://czxy.cpolar.cn/task-view-266.html
            -->
332784038@qq.com's avatar
6  
332784038@qq.com committed
220 221
            <el-button type="text" size="mini" @click="showReleaseOrderId = scope.row.orderId" v-hasPermi="['ecw:cargo_control:release']" :disabled="scope.row.auditType == 61 || scope.row.auditType == 62">{{ $t("放货") }}</el-button>
            <el-button type="text" size="mini" @click="showTransferOrder = scope.row" v-hasPermi="['ecw:cargo_control:transfer']">{{ $t("控货权转移") }}</el-button>
lanbaoming's avatar
lanbaoming committed
222 223 224 225
          </template>

          <!--部分控货-->
          <template v-if="scope.row.cargoControlStatus == 2">
332784038@qq.com's avatar
6  
332784038@qq.com committed
226 227 228
            <el-button type="text" size="mini" @click="toDetail(scope.row)" v-hasPermi="['ecw:cargo_control:update']">{{ $t("修改") }}</el-button>
            <el-button type="text" size="mini" @click="toDetail(scope.row)" v-hasPermi="['ecw:cargo_control:cancel']">{{ $t("取消") }}</el-button>
            <el-button type="text" size="mini" @click="review(scope.row)" v-if="scope.row.isToReview" v-hasPermi="['ecw:cargo_control:review']">{{ $t("放货复核") }}</el-button>
lanbaoming's avatar
lanbaoming committed
229 230 231 232
          </template>

          <!--已全部放货,但是未复核-->
          <template v-if="scope.row.cargoControlStatus == 1 && scope.row.isToReview">
332784038@qq.com's avatar
6  
332784038@qq.com committed
233 234 235
            <el-button type="text" size="mini" @click="review(scope.row)" v-hasPermi="['ecw:cargo_control:review']">{{ $t("放货复核") }}</el-button>
            <el-button type="text" size="mini" @click="toDetail(scope.row)" v-hasPermi="['ecw:cargo_control:update']">{{ $t("修改") }}</el-button>
            <el-button type="text" size="mini" @click="toDetail(scope.row)" v-hasPermi="['ecw:cargo_control:cancel']">{{ $t("取消") }}</el-button>
lanbaoming's avatar
lanbaoming committed
236 237 238 239 240
          </template>

          <!--已完成放货,且没有待复核;真正的放货完成-->
          <template v-if="scope.row.cargoControlStatus == 1 && !scope.row.isToReview">
            <!-- <el-button type="text"  size="mini" @click="toDetail(scope.row)" >{{$t('查看')}}</el-button> -->
332784038@qq.com's avatar
6  
332784038@qq.com committed
241 242
            <el-button type="text" size="mini" @click="cargoTransfer(scope.row)" v-hasPermi="['ecw:cargo_control:cargo_transfer']">{{ $t("调货") }}</el-button>
            <el-button type="text" size="mini" @click="showFallbackOrder = scope.row" v-if="scope.row.isReleaseAfterGoods" v-hasPermi="['ecw:cargo_control:fallback']">{{ $t("反复核") }}</el-button>
lanbaoming's avatar
lanbaoming committed
243
          </template>
332784038@qq.com's avatar
6  
332784038@qq.com committed
244 245
          <el-button type="text" size="mini" @click="showLogOrderId = scope.row.orderId" v-hasPermi="['ecw:cargo_control:log']">{{ $t("控货日志") }}</el-button>
          <el-button type="text" size="mini" @click="toDetail(scope.row)" v-hasPermi="['ecw:cargo_control:show']">{{ $t("查看") }}</el-button>
lanbaoming's avatar
lanbaoming committed
246 247 248 249
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
332784038@qq.com's avatar
6  
332784038@qq.com committed
250
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows" @pagination="getList" />
lanbaoming's avatar
lanbaoming committed
251

332784038@qq.com's avatar
6  
332784038@qq.com committed
252 253 254 255
    <transfer v-if="showTransferOrder" v-bind="showTransferOrder" @close="showTransferOrder = null" />
    <release v-if="showReleaseOrderId" :order-id="showReleaseOrderId" @close="showReleaseOrderId = null" @success="onReleaseSuccess" />
    <transfer-cargo v-if="showTransferCargoOrderId" :order-id="showTransferCargoOrderId" @close="showTransferCargoOrderId = null" @success="onTransferCargoSuccess" :cargoControlPickId="pickInfo ? pickInfo.id : 0" />
    <fallback v-if="showFallbackOrder !== null" :order="showFallbackOrder" @close="showFallbackOrder = null" @success="onFallbackSuccess" :index="null" />
lanbaoming's avatar
lanbaoming committed
256
    <!--控货日志-->
332784038@qq.com's avatar
6  
332784038@qq.com committed
257
    <cargo-log-list v-if="showLogOrderId" :order-id="showLogOrderId" @close="showLogOrderId = null" />
258 259

    <!--修改放货限制-->
332784038@qq.com's avatar
6  
332784038@qq.com committed
260
    <update-release-limit v-if="showUpdateReleaseLimit" :order="showUpdateReleaseLimit" @close="showUpdateReleaseLimit = null" @success="onUpdateReleaseLimitSuccess" />
lanbaoming's avatar
lanbaoming committed
261 262 263 264
  </div>
</template>

<script>
332784038@qq.com's avatar
6  
332784038@qq.com committed
265 266 267 268 269
import Selector from "@/components/Selector"
import ProductSelector from "@/components/ProductSelector"
import { getProductAttrList } from "@/api/ecw/productAttr"
import CustomerSelector from "@/components/CustomerSelector"
import UpdateReleaseLimit from "@/views/ecw/order/components/updateReleaseLimit.vue"
lanbaoming's avatar
lanbaoming committed
270
/* import { getTradeCityList } from '@/api/ecw/region' */
332784038@qq.com's avatar
6  
332784038@qq.com committed
271 272 273
import Transfer from "@/views/ecw/order/components/Transfer"
import Release from "./components/Release"
import CargoControlEdit from "./components/CargoControlEdit"
lanbaoming's avatar
lanbaoming committed
274
import { getCargoControlOrderPage, batchReview, orderReview, getPickRleaseInfo, exportCargoControl } from "@/api/ecw/orderCargoControl"
332784038@qq.com's avatar
6  
332784038@qq.com committed
275 276 277 278 279 280 281
import TransferCargo from "@/views/ecw/order/components/TransferCargo"
import Fallback from "./components/Fallback"
import { getWarehouseList } from "@/api/ecw/warehouse"
import CargoLogList from "@/views/ecw/order/components/CargoLogList.vue"
import { getRegionList } from "@/api/ecw/order"
import UserSelector from "@/components/UserSelector"
import { getChannelList } from "@/api/ecw/channel"
lanbaoming's avatar
lanbaoming committed
282 283 284
export default {
  name: "EcwOrderCargocontrol",
  components: {
285
    UpdateReleaseLimit,
lanbaoming's avatar
lanbaoming committed
286
    CargoLogList,
余金瑶's avatar
余金瑶 committed
287
    UserSelector,
332784038@qq.com's avatar
6  
332784038@qq.com committed
288 289 290 291 292 293 294 295
    CustomerSelector,
    ProductSelector,
    Selector,
    Transfer,
    Release,
    CargoControlEdit,
    TransferCargo,
    Fallback
lanbaoming's avatar
lanbaoming committed
296 297 298 299 300 301 302 303 304 305 306 307 308 309
  },
  data() {
    return {
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
310
      showSearch: false,
lanbaoming's avatar
lanbaoming committed
311 312 313 314 315 316 317 318 319 320 321 322 323
      // 总条数
      total: 0,
      // 订单列表
      list: [],
      // 弹出层标题
      title: "",
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10
      },
      tradeCityList: [],
      warehouseList: [],
332784038@qq.com's avatar
6  
332784038@qq.com committed
324 325 326 327
      productAttrList: [], // 商品属性
      molecule: "", //重货比分子
      denominator: "", //重货比分母
      dateFilterType: "", //日期筛选类别
lanbaoming's avatar
lanbaoming committed
328 329 330 331 332 333 334
      dateFilter: [], //筛选日期
      showTransferOrder: null, // 控制权转移操作订单
      showReleaseOrderId: null, // 放货ID
      showTransferCargoOrderId: null, // 调货ID
      showFallbackOrder: null, // 调货订单
      pickInfo: null, // 当前操作的提货信息
      showLogOrderId: null, // 显示控货日志的订单ID
335
      showUpdateReleaseLimit: null, // 显示修改放货限制的订单
yujinyao's avatar
yujinyao committed
336 337 338
      // 编号搜索条件
      noParam: {
        key: "numberKey",
332784038@qq.com's avatar
6  
332784038@qq.com committed
339
        value: ""
yujinyao's avatar
yujinyao committed
340
      },
dragondean@qq.com's avatar
dragondean@qq.com committed
341 342 343
      // 商品搜索条件
      prodParam: {
        key: "prodKey",
332784038@qq.com's avatar
6  
332784038@qq.com committed
344
        value: ""
dragondean@qq.com's avatar
dragondean@qq.com committed
345 346
      },
      // 放货率
332784038@qq.com's avatar
6  
332784038@qq.com committed
347 348 349
      releaseRatio: {
        key: "geReleaseRatio",
        value: ""
dragondean@qq.com's avatar
dragondean@qq.com committed
350
      },
余金瑶's avatar
余金瑶 committed
351
      channelList: [],
yujinyao's avatar
yujinyao committed
352 353 354 355 356 357
      AddressProvince: [],
      AddressCity: [],
      AddressTown: [],
      destCountryId: null,
      objectiveId: null,
      destWarehouseId: null,
358
      pickRatio: {
dragondean@qq.com's avatar
dragondean@qq.com committed
359
        key: "gePickRatio",
332784038@qq.com's avatar
6  
332784038@qq.com committed
360
        value: ""
361
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
362
    }
lanbaoming's avatar
lanbaoming committed
363 364 365
  },
  computed: {
    expoerCityList() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
366
      return this.tradeCityList.filter((item) => item.type == 2)
lanbaoming's avatar
lanbaoming committed
367 368
    },
    importCityList() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
369
      return this.tradeCityList.filter((item) => item.type == 1)
lanbaoming's avatar
lanbaoming committed
370
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
371 372
    exportWarehouseList() {
      return this.warehouseList.filter((item) => item.tradeType == 2 || item.tradeType == 3)
lanbaoming's avatar
lanbaoming committed
373
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
374 375
    importWarehouseList() {
      return this.warehouseList.filter((item) => item.tradeType == 1 || item.tradeType == 3)
lanbaoming's avatar
lanbaoming committed
376
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
377
    combinedQueryParams() {
yujinyao's avatar
yujinyao committed
378
      let timeParams = {}
332784038@qq.com's avatar
6  
332784038@qq.com committed
379 380 381
      if (this.dateFilterType && this.dateFilter) {
        timeParams["begin" + this.dateFilterType] = this.dateFilter[0]
        timeParams["end" + this.dateFilterType] = this.dateFilter[1]
yujinyao's avatar
yujinyao committed
382
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
383
      let queryParams = { ...this.queryParams }
yujinyao's avatar
yujinyao committed
384
      if (this.noParam.value) {
332784038@qq.com's avatar
6  
332784038@qq.com committed
385
        queryParams[this.noParam.key] = this.noParam.value
yujinyao's avatar
yujinyao committed
386
      }
yujinyao's avatar
yujinyao committed
387 388
      //目的国
      if (this.destCountryId != null && this.destCountryId != "") {
332784038@qq.com's avatar
6  
332784038@qq.com committed
389
        queryParams.destCountryIds = this.destCountryId
yujinyao's avatar
yujinyao committed
390 391 392
      }
      //目的城市
      if (this.objectiveId != null && this.objectiveId != "") {
332784038@qq.com's avatar
6  
332784038@qq.com committed
393
        queryParams.objectiveIds = this.objectiveId
yujinyao's avatar
yujinyao committed
394 395 396
      }
      //目的仓
      if (this.destWarehouseId != null && this.destWarehouseId != "") {
332784038@qq.com's avatar
6  
332784038@qq.com committed
397
        queryParams.destWarehouseIds = this.destWarehouseId
yujinyao's avatar
yujinyao committed
398
      }
399 400
      // 提货率
      if (this.pickRatio.value) {
dragondean@qq.com's avatar
dragondean@qq.com committed
401
        queryParams[this.pickRatio.key] = this.pickRatio.value
402
      }
dragondean@qq.com's avatar
dragondean@qq.com committed
403
      // 放货率
332784038@qq.com's avatar
6  
332784038@qq.com committed
404
      if (this.releaseRatio.value) {
dragondean@qq.com's avatar
dragondean@qq.com committed
405 406
        queryParams[this.releaseRatio.key] = this.releaseRatio.value
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
407
      if (this.prodParam.value) {
dragondean@qq.com's avatar
dragondean@qq.com committed
408 409
        queryParams[this.prodParam.key] = this.prodParam.value
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
410
      if (queryParams.statusList?.length) {
dragondean@qq.com's avatar
dragondean@qq.com committed
411 412 413 414
        queryParams.statusString = queryParams.statusList.join(",")
        delete queryParams.statusList
      }
      return Object.assign({}, timeParams, queryParams)
lanbaoming's avatar
lanbaoming committed
415 416
    }
  },
yujinyao's avatar
yujinyao committed
417 418 419 420 421 422
  watch: {
    destCountryId: {
      //监听当前地区值的变化,于与上方地区值进行了双向绑定
      deep: true, //深度监听
      handler() {
        //每当值省份值改变时其下地区值进行清空
332784038@qq.com's avatar
6  
332784038@qq.com committed
423 424 425 426 427
        this.AddressCity = []
        this.AddressTown = []
        this.objectiveId = ""
        this.destWarehouseId = ""
        this.findByprovinceCode()
yujinyao's avatar
yujinyao committed
428 429 430
        if (this.destCountryId == "") {
          this.getAddressCity()
          this.getAddressTown()
332784038@qq.com's avatar
6  
332784038@qq.com committed
431
        } else if (this.destCountryId != "" && this.objectiveId == "" && this.destWarehouseId == "") {
yujinyao's avatar
yujinyao committed
432 433
          this.getAddressTown()
        }
332784038@qq.com's avatar
6  
332784038@qq.com committed
434
      }
yujinyao's avatar
yujinyao committed
435 436 437 438
    },
    objectiveId: {
      deep: true, //深度监听
      handler() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
439 440 441
        this.AddressTown = []
        this.destWarehouseId = ""
        this.findBycityCode()
yujinyao's avatar
yujinyao committed
442

332784038@qq.com's avatar
6  
332784038@qq.com committed
443
        if (this.objectiveId != "" && this.destCountryId != "" && this.destWarehouseId == "") {
yujinyao's avatar
yujinyao committed
444
          //获取当前城市值id,获取该城市下区域
332784038@qq.com's avatar
6  
332784038@qq.com committed
445
        } else if (this.destCountryId == "" && this.objectiveId == "" && this.destWarehouseId == "") {
yujinyao's avatar
yujinyao committed
446
          this.getAddressTown()
332784038@qq.com's avatar
6  
332784038@qq.com committed
447 448
        } else if (this.destCountryId != "" && this.objectiveId == "" && this.destWarehouseId == "") {
          this.findByprovinceCode()
yujinyao's avatar
yujinyao committed
449 450
          this.getAddressTown()
        }
332784038@qq.com's avatar
6  
332784038@qq.com committed
451
      }
yujinyao's avatar
yujinyao committed
452 453 454 455
    },
    destWarehouseId: {
      deep: true, //深度监听
      handler() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
456
        if (this.objectiveId != "" && this.destCountryId != "" && this.destWarehouseId == "") {
yujinyao's avatar
yujinyao committed
457
          //获取当前城市值id,获取该城市下区域
332784038@qq.com's avatar
6  
332784038@qq.com committed
458 459
          this.findBycityCode()
        } else if (this.destCountryId != "" && this.objectiveId == "" && this.destWarehouseId == "") {
yujinyao's avatar
yujinyao committed
460 461
          this.getAddressTown()
        }
332784038@qq.com's avatar
6  
332784038@qq.com committed
462 463
      }
    }
yujinyao's avatar
yujinyao committed
464
  },
332784038@qq.com's avatar
6  
332784038@qq.com committed
465
  activated() {
lanbaoming's avatar
lanbaoming committed
466 467 468 469
    // 要求保留页码 https://zentao.test.jdshangmen.com/bug-view-3079.html
    this.getList()
  },
  created() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
470 471
    this.getList()
    getProductAttrList().then((res) => (this.productAttrList = res.data))
lanbaoming's avatar
lanbaoming committed
472
    // getTradeCityList().then(res => this.tradeCityList = res.data)
332784038@qq.com's avatar
6  
332784038@qq.com committed
473 474
    getWarehouseList().then((res) => (this.warehouseList = res.data))
    getChannelList().then((res) => (this.channelList = res.data))
yujinyao's avatar
yujinyao committed
475 476 477
    this.getAddressProvince()
    this.getAddressCity()
    this.getAddressTown()
lanbaoming's avatar
lanbaoming committed
478 479 480 481
  },
  methods: {
    /** 查询列表 */
    getList() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
482
      this.loading = true
lanbaoming's avatar
lanbaoming committed
483
      // 执行查询
332784038@qq.com's avatar
332784038@qq.com committed
484
      const query = { ...this.combinedQueryParams }
485
      if (query.packageTypeArr && query.packageTypeArr.length) {
332784038@qq.com's avatar
332784038@qq.com committed
486
        query.packageType = query.packageTypeArr.join(",")
487
      }
332784038@qq.com's avatar
332784038@qq.com committed
488
      getCargoControlOrderPage(query).then((response) => {
lanbaoming's avatar
lanbaoming committed
489 490
        this.list = []
        // 直接更细数据,可能因为elTable的部分渲染产生bug,比如权限控制异常
332784038@qq.com's avatar
6  
332784038@qq.com committed
491 492 493
        this.$nextTick(() => {
          this.list = response.data.list
          this.total = response.data.total
lanbaoming's avatar
lanbaoming committed
494 495
        })

332784038@qq.com's avatar
6  
332784038@qq.com committed
496 497
        this.loading = false
      })
lanbaoming's avatar
lanbaoming committed
498 499 500 501
    },

    /** 搜索按钮操作 */
    handleQuery() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
502
      this.queryParams.page = 1
lanbaoming's avatar
lanbaoming committed
503 504 505 506
      this.$nextTick(this.getList)
    },
    /** 重置按钮操作 */
    resetQuery() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
507
      this.resetForm("queryForm")
508 509 510 511 512 513 514 515 516 517 518 519 520
      this.queryParams = {
        page: 1,
        rows: 10,
        packageTypeArr: [],
        channelId: null,
        channelIds: null,
        customsTypes: null,
        productRecords: null,
        goodsTypes: null
      }
      this.destCountryId = null
      this.destWarehouseId = null
      this.objectiveId = null
332784038@qq.com's avatar
6  
332784038@qq.com committed
521
      this.pickRatio.value = ""
522 523 524
      this.noParam.value = ""
      this.prodParam.value = ""
      this.dateFilter = []
332784038@qq.com's avatar
6  
332784038@qq.com committed
525
      this.handleQuery()
lanbaoming's avatar
lanbaoming committed
526 527 528 529 530 531
    },

    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      // 执行导出
332784038@qq.com's avatar
6  
332784038@qq.com committed
532 533 534 535 536 537 538 539 540 541 542
      this.$modal
        .confirm("是否确认导出所有订单数据项?")
        .then(() => {
          this.exportLoading = true
          return exportCargoControl(this.combinedQueryParams)
        })
        .then((response) => {
          this.$message.success(this.$t("已加入导出队列,请稍后在下载日志中下载"))
          this.exportLoading = false
        })
        .catch(() => {})
lanbaoming's avatar
lanbaoming committed
543 544 545
    },
    // 表格多选
    handleSelectionChange(selection) {
332784038@qq.com's avatar
6  
332784038@qq.com committed
546
      this.ids = selection.map((item) => item.orderId)
lanbaoming's avatar
lanbaoming committed
547 548 549
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
550 551
    toDetail(row) {
      this.$router.push("cargo_control/detail?id=" + row.orderId)
lanbaoming's avatar
lanbaoming committed
552 553
    },
    // 复核
332784038@qq.com's avatar
6  
332784038@qq.com committed
554 555 556 557 558 559 560 561 562 563 564 565 566
    review(row) {
      // 未放货完成则打开详情,已完成放货则弹窗
      if (row.releaseNum < row.sumNum) {
        return this.toDetail(row)
      }
      this.$confirm("已核实放货信息,确认放货?")
        .then((res) => {
          return orderReview(row.orderId)
        })
        .then((res) => {
          this.$message.success("操作成功")
          this.getList()
        })
lanbaoming's avatar
lanbaoming committed
567 568
    },
    // 批量复核
332784038@qq.com's avatar
6  
332784038@qq.com committed
569 570 571 572 573 574 575 576 577
    batchReview() {
      this.$confirm(this.$t("确定复核选中的订单么?"))
        .then(() => {
          return batchReview("orderIds=" + this.ids.join(","))
        })
        .then(() => {
          this.$message.success(this.$t("操作成功"))
          this.getList()
        })
lanbaoming's avatar
lanbaoming committed
578
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
579 580 581
    cargoTransfer(row) {
      getPickRleaseInfo(row.orderId).then((res) => {
        if (res.data.cargoControlPickBackVOList && res.data.cargoControlPickBackVOList.length > 1) {
lanbaoming's avatar
lanbaoming committed
582 583 584
          this.toDetail(row)
        }
        this.pickInfo = res.data.cargoControlPickBackVOList[0]
332784038@qq.com's avatar
6  
332784038@qq.com committed
585
        this.showTransferCargoOrderId = row.orderId
lanbaoming's avatar
lanbaoming committed
586 587
      })
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
588
    onReleaseSuccess() {
lanbaoming's avatar
lanbaoming committed
589 590 591
      this.showReleaseOrderId = null
      this.getList()
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
592
    onFallbackSuccess() {
lanbaoming's avatar
lanbaoming committed
593 594 595
      this.showFallbackOrder = null
      this.getList()
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
596
    onTransferCargoSuccess() {
lanbaoming's avatar
lanbaoming committed
597 598
      this.showTransferCargoOrderId = null
      this.getList()
yujinyao's avatar
yujinyao committed
599
    },
600
    // 修改放货审批限制成功
332784038@qq.com's avatar
6  
332784038@qq.com committed
601
    onUpdateReleaseLimitSuccess() {
602 603
      this.showUpdateReleaseLimit = null
      this.getList()
604
    },
yujinyao's avatar
yujinyao committed
605 606 607 608 609
    getAddressProvince() {
      /*getListTree({ treeType: 1 }).then((response) => {
        this.countryList = response.data;
      })*/
      getRegionList(1, 1).then(({ data }) => {
332784038@qq.com's avatar
6  
332784038@qq.com committed
610
        this.AddressProvince = data
yujinyao's avatar
yujinyao committed
611 612 613 614
      })
    },
    getAddressCity() {
      getRegionList(4, 4).then(({ data }) => {
332784038@qq.com's avatar
6  
332784038@qq.com committed
615
        this.AddressCity = data
yujinyao's avatar
yujinyao committed
616 617 618 619
      })
    },
    getAddressTown() {
      getRegionList(5, 5).then(({ data }) => {
332784038@qq.com's avatar
6  
332784038@qq.com committed
620
        this.AddressTown = data
yujinyao's avatar
yujinyao committed
621 622 623
      })
    },
    findByprovinceCode() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
624
      if (this.destCountryId != null && this.destCountryId != "") {
yujinyao's avatar
yujinyao committed
625 626
        //获取当前省份值id,获取该省份下城市 destCountryId provinceCode
        getRegionList(2, this.destCountryId).then(({ data }) => {
332784038@qq.com's avatar
6  
332784038@qq.com committed
627
          this.AddressCity = data
yujinyao's avatar
yujinyao committed
628 629 630 631
        })
      }
    },
    findBycityCode() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
632
      if (this.objectiveId != null && this.objectiveId != "") {
yujinyao's avatar
yujinyao committed
633 634
        //获取当前城市值id,获取该城市下区域
        getRegionList(3, this.objectiveId).then(({ data }) => {
332784038@qq.com's avatar
6  
332784038@qq.com committed
635
          this.AddressTown = data
yujinyao's avatar
yujinyao committed
636 637
        })
      }
dragondean@qq.com's avatar
dragondean@qq.com committed
638 639
    },
    // 自动去除空格
332784038@qq.com's avatar
6  
332784038@qq.com committed
640 641
    replaceSpace(obj, field) {
      obj[field] = obj[field].replace(/\s+/g, "")
lanbaoming's avatar
lanbaoming committed
642 643
    }
  }
332784038@qq.com's avatar
6  
332784038@qq.com committed
644
}
lanbaoming's avatar
lanbaoming committed
645
</script>