splitOrder.vue 40.1 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1
<template>
huhaiqing's avatar
huhaiqing committed
2
  <div class="app-container shipping-split-order">
huhaiqing's avatar
huhaiqing committed
3
    <el-card>
4
      <div slot="header" class="card-title">{{$t('拆单申请')}}-{{orderData.orderNo||''}}</div>
huhaiqing's avatar
huhaiqing committed
5
      <div class="btn-header">
6
        <span class="card-title">{{$t('原单信息')}}</span>
huhaiqing's avatar
huhaiqing committed
7 8
      </div>
      <el-descriptions :column="4">
9 10
        <el-descriptions-item :label="$t('唛头')">
          {{orderData.marks?orderData.marks:$t('')}}
huhaiqing's avatar
huhaiqing committed
11
        </el-descriptions-item>
huhaiqing's avatar
huhaiqing committed
12
        <el-descriptions-item :label="$t('已实装箱数/总箱数')">
13
          <span>{{currRow.installNum||0}}/{{currRow.num||0}}</span>
huhaiqing's avatar
huhaiqing committed
14
        </el-descriptions-item>
15
        <el-descriptions-item :label="$t('订单状态')">
huhaiqing's avatar
huhaiqing committed
16
          {{orderData.status==99? $t('异常'):$t('正常')}}
huhaiqing's avatar
huhaiqing committed
17
        </el-descriptions-item>
18
        <el-descriptions-item :label="$t('送货日期')">
19
          {{orderData.deliveryDate}}
huhaiqing's avatar
huhaiqing committed
20 21 22
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="4">
23
        <el-descriptions-item :label="$t('运输方式')">
huhaiqing's avatar
huhaiqing committed
24 25
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="orderData.transportId" />
        </el-descriptions-item>
26 27
        <el-descriptions-item :label="$t('始发地')">
          {{orderData.logisticsInfoDto?$l(orderData.logisticsInfoDto, 'startTitle'):$t('')}}
huhaiqing's avatar
huhaiqing committed
28
        </el-descriptions-item>
29 30
        <el-descriptions-item :label="$t('目的地')">
          {{orderData.logisticsInfoDto?$l(orderData.logisticsInfoDto, 'destTitle'):$t('')}}
huhaiqing's avatar
huhaiqing committed
31 32 33
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="4">
34 35
        <el-descriptions-item :label="$t('发货人姓名')">
          {{orderData.consignorVO?orderData.consignorVO.name||$t(''):$t('')}}
huhaiqing's avatar
huhaiqing committed
36
        </el-descriptions-item>
37 38
        <el-descriptions-item :label="$t('发货公司')">
          {{orderData.consignorVO?orderData.consignorVO.company||$t(''):$t('')}}
huhaiqing's avatar
huhaiqing committed
39
        </el-descriptions-item>
40 41
        <el-descriptions-item :label="$t('发货电话')">
          {{orderData.consignorVO?(orderData.consignorVO.phone?("+"+orderData.consignorVO.countryCode+orderData.consignorVO.phone):$t('')):$t('')}}
huhaiqing's avatar
huhaiqing committed
42 43 44
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions :column="4">
45 46
        <el-descriptions-item :label="$t('收货人姓名')">
          {{orderData.consigneeVO?orderData.consigneeVO.name||$t(''):$t('')}}
huhaiqing's avatar
huhaiqing committed
47
        </el-descriptions-item>
48 49
        <el-descriptions-item :label="$t('收货公司')">
          {{orderData.consigneeVO?orderData.consigneeVO.company||$t(''):$t('')}}
huhaiqing's avatar
huhaiqing committed
50
        </el-descriptions-item>
51 52
        <el-descriptions-item :label="$t('收货电话')">
          {{orderData.consigneeVO?orderData.consigneeVO.phone?"+"+orderData.consigneeVO.countryCode+orderData.consigneeVO.phone :$t(''):$t('')}}
huhaiqing's avatar
huhaiqing committed
53 54 55
        </el-descriptions-item>
      </el-descriptions>
    </el-card>
huhaiqing's avatar
huhaiqing committed
56

huhaiqing's avatar
huhaiqing committed
57 58
    <el-card class="card">
      <!-- 列表 -->
59
      <div slot="header" class="card-title">{{$t('货物信息')}}</div>
huhaiqing's avatar
huhaiqing committed
60
      <el-table id='table' v-loading="loading" border :data="orderData.orderItemVOList" :summary-method="getSummaries" show-summary>
61
        <el-table-column :label="$t('序号')" align="center" prop="id" type="index" width="60">
huhaiqing's avatar
huhaiqing committed
62 63 64 65
          <template slot-scope="scope">
            <span>{{scope.$index + 1}}</span>
          </template>
        </el-table-column>
66
        <el-table-column :label="$t('品名')" align="center">
huhaiqing's avatar
huhaiqing committed
67 68 69 70 71
          <template slot-scope="scope">
            <el-row>{{scope.row.prodTitleZh}}</el-row>
            <el-row>{{scope.row.prodTitleEn}}</el-row>
          </template>
        </el-table-column>
72
        <el-table-column :label="$t('装柜货物属性')" align="center" width="600">
huhaiqing's avatar
huhaiqing committed
73
          <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
74 75
            <el-row style="text-align:left;">
              <el-row>
huhaiqing's avatar
huhaiqing committed
76
                <span>{{$t('规格')}}{{scope.row.warehouseInInfoVO ? scope.row.warehouseInInfoVO.boxGauge : ''}}</span>
huhaiqing's avatar
huhaiqing committed
77 78
              </el-row>
              <el-row>
79
                <span>{{$t('品牌')}}
80 81
                  <template v-if="scope.row.brandName">{{scope.row.brandName}}</template>
                  <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="scope.row.brandType" />
huhaiqing's avatar
huhaiqing committed
82
                </span>
83 84 85
                <span style="margin-left: 10px;">{{$t('箱数')}}:{{scope.row.warehouseInInfoVO ? scope.row.warehouseInInfoVO.cartonsNum : 0 }}</span>
                <span style="margin-left: 10px;">{{$t('体积')}}:{{scope.row.warehouseInInfoVO ? scope.row.warehouseInInfoVO.volume : 0 }}m³</span>
                <span style="margin-left: 10px;">{{$t('重量')}}:{{scope.row.warehouseInInfoVO ? scope.row.warehouseInInfoVO.weight : 0 }}kg</span>
huhaiqing's avatar
huhaiqing committed
86 87
              </el-row>
              <el-row>
huhaiqing's avatar
huhaiqing committed
88
                <span>{{$t('计划装柜')}}:{{planCabinet}}</span>
huhaiqing's avatar
huhaiqing committed
89
              </el-row>
huhaiqing's avatar
huhaiqing committed
90 91 92
            </el-row>
          </template>
        </el-table-column>
93
        <el-table-column :label="$t('最后操作时间')" align="center">
huhaiqing's avatar
huhaiqing committed
94 95 96 97
          <template slot-scope="scope">
            <span>{{parseTime(scope.row.updateTime)}}</span>
          </template>
        </el-table-column>
98
        <el-table-column :label="$t('状态')" align="center">
99 100
          {{orderData.abnormalState!=0?$t('异常'):$t('正常')}}
          <!-- <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
101
            <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" />
102
          </template> -->
huhaiqing's avatar
huhaiqing committed
103 104 105
        </el-table-column>
      </el-table>
    </el-card>
huhaiqing's avatar
huhaiqing committed
106

huhaiqing's avatar
huhaiqing committed
107
    <el-card class="card" v-if="splitData.id">
huhaiqing's avatar
huhaiqing committed
108
      <!-- 列表 -->
109
      <div slot="header" class="card-title">{{$t('拆单信息')}}</div>
huhaiqing's avatar
huhaiqing committed
110
      <div>
huhaiqing's avatar
huhaiqing committed
111 112 113 114
        <div class="btn-header">
          <div>
            <p class="card-info">
              <span class="card-title">
huhaiqing's avatar
huhaiqing committed
115
                {{splitData.orderNo}}
huhaiqing's avatar
huhaiqing committed
116
              </span>
117 118
              <span>{{orderData.logisticsInfoDto?$l(orderData.logisticsInfoDto, 'startTitle'):$t('无')}}</span>
              <span>{{$t('发往')}}:{{splitData.dstWarehouseName}}</span>
huhaiqing's avatar
huhaiqing committed
119 120 121
            </p>
          </div>
          <div>
122
            <el-button type="primary" :disabled="isAudit" @click="addShop">{{$t('放入')}}</el-button>
huhaiqing's avatar
huhaiqing committed
123 124
          </div>
        </div>
huhaiqing's avatar
huhaiqing committed
125
        <el-table border :data="splitData.orderSplitItemBackVOList">
126
          <el-table-column :label="$t('序号')" align="center" prop="id" type="index">
huhaiqing's avatar
huhaiqing committed
127 128 129 130
            <template slot-scope="scope">
              <span>{{scope.$index + 1}}</span>
            </template>
          </el-table-column>
131
          <el-table-column :label="$t('品名')" align="center">
huhaiqing's avatar
huhaiqing committed
132 133 134 135 136
            <template slot-scope="scope">
              <el-row>{{scope.row.prodTitleZh}}</el-row>
              <el-row>{{scope.row.prodTitleEn}}</el-row>
            </template>
          </el-table-column>
137
          <el-table-column :label="$t('品牌')" align="center">
huhaiqing's avatar
huhaiqing committed
138 139 140 141
            <template slot-scope="scope">
              <dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="scope.row.brandType" />
            </template>
          </el-table-column>
142
          <el-table-column :label="$t('入仓体积')" align="center" >
huhaiqing's avatar
huhaiqing committed
143
            <template slot-scope="scope">
144 145
              {{scope.row.volume}}
              <!--<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" disabled>
146
                <span slot="append"></span>
147
              </el-input>-->
huhaiqing's avatar
huhaiqing committed
148 149
            </template>
          </el-table-column>
150
          <el-table-column :label="$t('收费体积')" align="center" >
huhaiqing's avatar
huhaiqing committed
151
            <template slot-scope="scope">
152 153
              {{scope.row.chargeVolume}}
              <!--<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled>
154
                <span slot="append"></span>
155
              </el-input>-->
156 157 158 159
            </template>
          </el-table-column>
          <el-table-column :label="$t('入仓重量')" align="center">
            <template slot-scope="scope">
160 161
              {{scope.row.weight}}kg
              <!--<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini" disabled>
162
                <span slot="append">kg</span>
163
              </el-input>-->
164 165 166 167
            </template>
          </el-table-column>
          <el-table-column :label="$t('收费重量')" align="center">
            <template slot-scope="scope">
168 169
              {{scope.row.chargeWeight}}kg
              <!--<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled>
170
                <span slot="append">kg</span>
171
              </el-input>-->
huhaiqing's avatar
huhaiqing committed
172 173
            </template>
          </el-table-column>
174 175
          <el-table-column :label="$t('货值')" align="center">
            <template slot-scope="scope">
dragondean@qq.com's avatar
dragondean@qq.com committed
176
              <el-input v-model="scope.row.worth" @change="updateField(scope.row, 'worth')" size="mini">
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
177
                <span slot="append">{{ $t('') }}</span>
178 179 180
              </el-input>
            </template>
          </el-table-column>
181
          <el-table-column :label="$t('箱数')" align="center">
huhaiqing's avatar
huhaiqing committed
182
            <template slot-scope="scope">
dragondean@qq.com's avatar
dragondean@qq.com committed
183 184 185
              <el-button type="text" @click="showWarehouse(scope.row)">{{scope.row.num}}</el-button>
            </template>
          </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
186
          <el-table-column :label="$t('数量(个)')" align="center">
dragondean@qq.com's avatar
dragondean@qq.com committed
187 188
            <template slot-scope="scope">
              <span>{{scope.row.quantity}}</span>
huhaiqing's avatar
huhaiqing committed
189 190
            </template>
          </el-table-column>
191

192
          <el-table-column :label="$t('计划装柜')" align="center">
193
            {{planCabinet}}
huhaiqing's avatar
huhaiqing committed
194
          </el-table-column>
195
          <el-table-column :label="$t('操作')" align="center">
huhaiqing's avatar
huhaiqing committed
196
            <template slot-scope="scope">
197
              <el-button size="mini" :disabled="isAudit" type="text" icon="el-icon-delete" @click="removeShop(scope.row.id)">{{$t('移出')}}</el-button>
huhaiqing's avatar
huhaiqing committed
198 199 200 201 202
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
huhaiqing's avatar
huhaiqing committed
203 204 205 206 207

    <el-row style="marginTop:15px;">
      <work-flow xmlkey="split_order" v-model="selectedUsers"></work-flow>
    </el-row>

208
    <div slot="footer" class="card footer_btn">
209 210 211 212 213
      <el-button v-if="!isAudit" type="primary" @click="submitForm">{{$t('提交申请')}}</el-button>
      <el-button v-if="!isAudit" plain type="primary" @click="$emit('closeDialog2')">{{$t('取消')}}</el-button>
      <el-button v-if="isAudit" type="primary" @click="jumpReviewDetail">{{$t('审核中')}}</el-button>
      <el-button v-if="isAudit" plain type="primary" @click="cancelSplit">{{$t('取消审核')}}</el-button>
      <el-button v-if="isAudit" plain type="primary" @click="$emit('closeDialog2')">{{$t('返回')}}</el-button>
huhaiqing's avatar
huhaiqing committed
214 215 216
    </div>

    <!-- 对话框(添加 / 修改) -->
dragondean@qq.com's avatar
dragondean@qq.com committed
217
    <el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="1500px" append-to-body>
218 219 220
      <el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px" inline>
        <el-form-item :label="$t('中文品名')+':'" prop="orderItemId">
          <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')">
dragondean@qq.com's avatar
dragondean@qq.com committed
221
            <el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id"></el-option>
222 223 224 225
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('英文品名')+':'" prop="orderItemId">
          <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')">
dragondean@qq.com's avatar
dragondean@qq.com committed
226
            <el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id"></el-option>
227 228
          </el-select>
        </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
229

230 231
        <div class="page-title">{{$t('品名可拆数据')}}</div>
        <div class="pl-20">
dragondean@qq.com's avatar
dragondean@qq.com committed
232
          <span class="mr-10">{{$t('箱数')}}:{{ Math.min(mainOrderItem.num, maxNum) || 0 }}</span>
233 234 235 236 237
          <span class="mr-10">{{ $t('入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³</span>
          <span class="mr-10">{{ $t('收费方数') }}:{{ mainOrderItem.chargeVolume || 0 }}m³</span>
          <span class="mr-10">{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg</span>
          <span class="mr-10">{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg</span>
          <span class="mr-10">{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}</span>
238
          <span class="mr-10">{{ $t('剩余可拆货值') }}:{{ leftWorth}}{{ $t('元') }}</span>
239 240 241 242 243 244 245
        </div>
        <div class="page-title">{{$t('可拆入仓记录')}}</div>
        <el-table
          :data="getOrderItemWarehouseIn(shopForm.orderItemId)"
          style="width: 100%">
          <el-table-column :label="$t('箱数')">
            <template v-slot="{row,$index}">
dragondean@qq.com's avatar
dragondean@qq.com committed
246
              {{Math.min(getWarehouseLeftData(row, 'num'), leftSplitNum)}}
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
              <dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
            </template>
          </el-table-column>
          <el-table-column :label="$t('包装类型')">
            <template v-slot="{row,$index}">
              <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
            </template>
          </el-table-column>
          <el-table-column label="长(cm)">
            <template v-slot="{row,$index}">
              {{row.boxGauge1}}
            </template>
          </el-table-column>
          <el-table-column label="宽(cm)">
            <template v-slot="{row,$index}">
              {{ row.boxGauge2 }}
            </template>
          </el-table-column>
          <el-table-column label="高(cm)">
            <template v-slot="{row,$index}">
              {{ row.boxGauge3 }}
            </template>
          </el-table-column>
          <el-table-column label="入仓体积(m³)">
            <template v-slot="{row,$index}">
272 273 274 275 276 277 278 279 280 281 282
              {{getWarehouseLeftData(row, 'volume')}}
            </template>
          </el-table-column>
          <el-table-column label="入仓重量(Kg)" prop="weight">
            <template v-slot="{row,$index}">
              {{getWarehouseLeftData(row, 'weight')}}
            </template>
          </el-table-column>
          <el-table-column :label="$t('数量')" prop="quantity">
            <template v-slot="{row,$index}">
              {{getWarehouseLeftData(row, 'quantity')}}
283 284 285 286 287
            </template>
          </el-table-column>
          <el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
          <el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
            <template v-slot="{ row, column, $index }">
288 289 290 291 292
              <warehouse-area-select
                v-model="row.orderLocationBackVOList"
                readonly
                :warehouse-id="currentWarehouseId"
              ></warehouse-area-select>
293 294 295 296 297
            </template>
          </el-table-column>
          <el-table-column :label="$t('操作')">
            <template v-slot="{ row, column, $index}">
              <el-tag v-if="getWarehouseInSplitData(row.id,'num') >= row.cartonsNum" disabled size="mini" type="primary" >{{$t('已拆完')}}</el-tag>
298
              <el-button v-else size="mini" type="primary" @click="putInRecord(row)" :disabled="leftSplitNum <= 0">{{$t('放入')}}</el-button>
299 300 301
            </template>
          </el-table-column>
        </el-table>
302 303 304 305
        <div class="flex-between mt-20 mb-10">
          <div class="page-title" style="margin: 0">
            {{$t('已放入入仓记录')}}
          </div>
306
          <el-button type="danger" size="mini" @click="clearAll">{{$t('清空放入数据')}}</el-button>
307 308
        </div>

309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
        <el-table
          :data="shopForm.specsRecordVOList"
          style="width: 100%">
          <el-table-column :label="$t('箱数')" width="200px">
            <template v-slot="{row,$index}">
              {{row.num}}
              <dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
            </template>
          </el-table-column>
          <el-table-column :label="$t('包装类型')" width="100px">
            <template v-slot="{row,$index}">
              <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
            </template>
          </el-table-column>
          <el-table-column label="长(cm)">
            <template v-slot="{row,$index}">
              {{row.boxGauge1}}
            </template>
          </el-table-column>
          <el-table-column label="宽(cm)">
            <template v-slot="{row,$index}">
              {{ row.boxGauge2 }}
            </template>
          </el-table-column>
          <el-table-column label="高(cm)">
            <template v-slot="{row,$index}">
              {{ row.boxGauge3 }}
            </template>
          </el-table-column>
          <el-table-column label="入仓体积(m³)">
            <template v-slot="{row,$index}">
              {{row.volume}}
            </template>
          </el-table-column>
          <!--<el-table-column label="收费体积(m³)" prop="chargeVolume"></el-table-column>-->
          <el-table-column label="入仓重量(Kg)" prop="weight"></el-table-column>
          <!--<el-table-column label="收费重量(Kg)" prop="chargeWeight"></el-table-column>-->
          <el-table-column :label="$t('数量')" width="130px" prop="quantity"></el-table-column>
          <el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
          <el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
            <template v-slot="{ row, column, $index }">
              {{getLocationName(row.orderLocationList)}}
            </template>
          </el-table-column>
          <el-table-column :label="$t('操作')">
            <template v-slot="{ row, column, $index}">
355
              <el-button size="mini" type="primary" @click="deleteRow($index)">{{$t('删除')}}</el-button>
356 357 358 359
            </template>
          </el-table-column>
        </el-table>

360
        <div class="page-title">{{$t('放入数据')}}</div>
361 362 363 364 365 366 367 368 369 370 371 372 373 374
        <div class="pl-20 mb-10">
          <span class="mr-10">{{$t('箱数')}}:{{ putin.num || 0 }},</span>
          <span class="mr-10">{{ $t('数量(个)') }}:{{ putin.quantity || 0 }},</span>
          <span class="mr-10">{{ $t('入仓方数') }}:{{ putin.volume || 0 }}m³, </span>
          <span class="mr-10">{{ $t('入仓重量') }}:{{ putin.weight || 0 }}kg</span>
        </div>
        <el-form-item :label="$t('收费方数')" prop="chargeVolume">
          <el-input-number v-model="shopForm.chargeVolume" controls-position="right"></el-input-number>
        </el-form-item>
        <el-form-item :label="$t('收费重量')" prop="chargeWeight">
          <el-input-number v-model="shopForm.chargeWeight" controls-position="right"></el-input-number>kg
        </el-form-item>

        <el-form-item :label="$t('放入货值')">
375
          <el-input-number v-model="shopForm.worth" controls-position="right"  :min="0" :max="leftWorth">
376 377 378 379 380 381
            <template slot="append">{{ $t('') }}</template>
          </el-input-number>
        </el-form-item>
        <el-form-item :label="$t('备注信息')">
          <el-input v-model="shopForm.remark"></el-input>
        </el-form-item>
huhaiqing's avatar
huhaiqing committed
382 383
      </el-form>
      <div slot="footer" class="dialog-footer">
384 385
        <el-button type="primary" @click="shopAdd">{{$t('确定')}}</el-button>
        <el-button @click="shopCancel">{{$t('取消')}}</el-button>
huhaiqing's avatar
huhaiqing committed
386 387
      </div>
    </el-dialog>
dragondean@qq.com's avatar
dragondean@qq.com committed
388 389

    <warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body></warehouse-record>
390 391 392 393 394 395
    <put-in
      v-if="currentPutIn"
      :warehouse-record="currentPutIn"
      @close="currentPutIn=null"
      @submit="handlePutin"
      :warehouse-id="currentWarehouseId"
dragondean@qq.com's avatar
dragondean@qq.com committed
396
      :maxNum="leftSplitNum"
397 398
      append-to-body
    ></put-in>
huhaiqing's avatar
huhaiqing committed
399 400 401 402 403 404
  </div>
</template>

<script>
import {
  getSplitList,
405
  // quantitycheck,
huhaiqing's avatar
huhaiqing committed
406
  createSplitItem,
407
  deleteSplitItem, splitItemWorthCheck,
huhaiqing's avatar
huhaiqing committed
408
} from "@/api/ecw/orderHandle";
409
import  {quantityRequired} from "@/api/ecw/warehouse";
huhaiqing's avatar
huhaiqing committed
410 411
import { getTradeCityList } from "@/api/ecw/region";
import WorkFlow from "@/components/WorkFlow";
412
import {getOrder, getOrderWarehouseIn, splitItemUpdate} from "@/api/ecw/order";
413
import { serviceMsg, toReviewDetail } from "../../utils";
414
import { createApproval, approvalCancel, splitList } from "@/api/ecw/boxSea";
415
import Decimal from "decimal.js";
dragondean@qq.com's avatar
dragondean@qq.com committed
416 417 418
import Warehouse from "@/views/ecw/order/warehousing/components/Warehouse";
import WarehouseRecord from "@/views/ecw/order/splitApply/components/WarehouseRecord";
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect";
419
import PutIn from "@/views/ecw/order/splitApply/components/PutIn.vue";
huhaiqing's avatar
huhaiqing committed
420 421 422

export default {
  name: "splitOrder",
huhaiqing's avatar
huhaiqing committed
423
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
424
  components: {
425
    PutIn,
dragondean@qq.com's avatar
dragondean@qq.com committed
426 427 428
    WarehouseAreaSelect,
    WarehouseRecord,
    Warehouse,
429
    WorkFlow
huhaiqing's avatar
huhaiqing committed
430 431 432 433 434 435 436
  },
  props: {
    currRow: Object,
  },
  data() {
    return {
      orderData: {},
huhaiqing's avatar
huhaiqing committed
437 438
      splitData: {},
      detail: {},
huhaiqing's avatar
huhaiqing committed
439 440
      loading: false,
      selectedUsers: [],
huhaiqing's avatar
huhaiqing committed
441
      tradeCityList: [],
442
      planCabinet: "",
huhaiqing's avatar
huhaiqing committed
443

huhaiqing's avatar
huhaiqing committed
444 445
      shopOpen: false,
      orderItems: [],
huhaiqing's avatar
huhaiqing committed
446 447 448
      shopForm: {},
      // 表单校验
      shopRules: {
449 450 451 452 453 454
        zhId: [
          {
            required: true,
            message: this.$t("请选择中文品名"),
            trigger: "change",
          },
huhaiqing's avatar
huhaiqing committed
455
        ],
456 457 458 459 460 461 462
        enId: [
          {
            required: true,
            message: this.$t("请选择英文品名"),
            trigger: "change",
          },
        ],
huhaiqing's avatar
huhaiqing committed
463 464
      },
      queryParams: {
huhaiqing's avatar
huhaiqing committed
465
        orderId: 0,
huhaiqing's avatar
huhaiqing committed
466 467
        lang: 0,
      },
huhaiqing's avatar
huhaiqing committed
468
      isQuantity: false,
469 470

      // 主单数据
dragondean@qq.com's avatar
dragondean@qq.com committed
471 472
      mainOrder: {orderSplitItemBackVOList: {}},
      // 当前查看的入仓记录
473 474 475 476
      currentWarehouseRecord: null,
      // 订单入仓记录
      warehouseInList: [],
      // 当前选择的入仓记录ID
477 478
      selectedWarehouseInId: null,
      // 当前正在放入的入仓记录
479
      currentPutIn: null,
480 481
      /*// 订单剩余数据
      orderLeftData: null*/
huhaiqing's avatar
huhaiqing committed
482 483 484
    };
  },
  created() {
485
    const { shipmentObj } = this.$attrs;
huhaiqing's avatar
huhaiqing committed
486
    this.planCabinet = `${shipmentObj.selfNo}-${this.currRow.sectionName}`;
huhaiqing's avatar
huhaiqing committed
487 488
    getTradeCityList().then((res) => (this.tradeCityList = res.data));
    this.queryParams.orderId = this.currRow.orderId;
huhaiqing's avatar
huhaiqing committed
489 490
    this.getOrderDetail();
    this.getSplit();
491 492 493 494 495

    // 获取入仓记录
    getOrderWarehouseIn(this.queryParams.orderId).then(res => {
      this.warehouseInList = res.data
    })
dragondean@qq.com's avatar
dragondean@qq.com committed
496 497 498 499

    this.$nextTick(() => {
      window.$vm = this
    })
huhaiqing's avatar
huhaiqing committed
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
  },
  watch: {
    //监听table这个对象
    tableData: {
      // 立即监听
      immediate: true,
      handler() {
        this.$nextTick(() => {
          const tds = document.querySelectorAll(
            "#table .el-table__footer-wrapper tr>td"
          );
          // colSpan合并列
          tds[1].colSpan = 5;
          tds[1].style.textAlign = "left";
          tds[2].style.display = "none";
          tds[3].style.display = "none";
          tds[4].style.display = "none";
        });
      },
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
520 521 522 523
    // 切换放入品名
    'shopForm.orderItemId'(){
      // 默认取以前放入的品名
      this.shopForm.specsRecordVOList = []
524 525
      const splitItem = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
      let specsRecordVOList = splitItem?.specsRecordVOList || []
dragondean@qq.com's avatar
dragondean@qq.com committed
526 527 528 529
      specsRecordVOList.forEach(item => {
        const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
        this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
      })
530 531 532 533 534

      // 显示原来默认的收费数据
      this.$set(this.shopForm, 'chargeVolume', splitItem.chargeVolume)
      this.$set(this.shopForm, 'chargeWeight', splitItem.chargeWeight)
      this.$set(this.shopForm, 'worth', splitItem.worth)
dragondean@qq.com's avatar
dragondean@qq.com committed
535
    }
huhaiqing's avatar
huhaiqing committed
536
  },
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
  computed: {
    isAudit() {
      const { shipmentObj } = this.$attrs;
      const { cabinetSplitInfo } = shipmentObj;
      if (cabinetSplitInfo) {
        /**
         * PROCESS(1, "处理中"),
         * APPROVE(2, "通过"),
         * REJECT(3, "不通过"),
         * CANCEL(4, "已取消");
         */
        const { approvalStatus } = cabinetSplitInfo;
        if (approvalStatus === 1) return true;
      }
      return false;
    },
553
    // 订单项数据,默认要返回一个如下的空json结构体,避免报错
554 555 556 557
    // 装柜拆单只能拆一个出来,所以直接用原单数据作为放入品名的最大值限制即可,跟订单操作中的拆单有所区别
    mainOrderItem(){
      if(!this.shopForm.orderItemId || !this.mainOrder.orderSplitItemBackVOList.length) return {}
      return this.mainOrder.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId) || {}
dragondean@qq.com's avatar
dragondean@qq.com committed
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
    },
    // 放入数据
    putin(){
      let data = {
        num: new Decimal(0),
        volume: new Decimal(0),
        chargeVolume: new Decimal(0),
        weight: new Decimal(0),
        chargeWeight: new Decimal(0),
        quantity: new Decimal(0)
      }
      this.shopForm.specsRecordVOList && this.shopForm.specsRecordVOList.forEach(item => {
        data.num = data.num.plus(new Decimal(item.num || 0))
        data.volume = data.volume.plus(new Decimal(item.volume || 0))
        data.chargeVolume = data.chargeVolume.plus(new Decimal(item.chargeVolume || 0))
        data.weight = data.weight.plus(new Decimal(item.weight || 0))
        data.chargeWeight = data.chargeWeight.plus(new Decimal(item.chargeWeight || 0))
        data.quantity = data.quantity.plus(new Decimal(item.quantity || 0))
      })
      return {
        num: data.num.toNumber(),
        volume: data.volume.toNumber(),
        chargeVolume: data.chargeVolume.toNumber(),
        weight: data.weight.toNumber(),
        chargeWeight: data.chargeWeight.toNumber(),
        quantity: data.quantity.toNumber()
      }
585 586 587 588 589 590
    },
    // 当前仓库ID
    currentWarehouseId(){
      return this.orderData.adjustToDestWarehouseId || this.orderData.logisticsInfoDto.startWarehouseId
    },
    // 当前选择的入仓记录
591
    /*currentWarehouseItem(){
592
      return this.getOrderItemWarehouseIn(this.shopForm.orderItemId).find(item => item.id === this.selectedWarehouseInId)
593
    },*/
594 595 596 597 598 599 600 601 602 603 604 605
    // 根据orderItemId获取入仓记录
    getOrderItemWarehouseIn() {
      return orderItemId => {
        const list = this.warehouseInList.find(item => item.orderItemId == orderItemId)?.orderWarehouseInBackItemDoList || []
        return list.map(item => {
          let [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
          item.boxGauge1 = boxGauge1
          item.boxGauge2 = boxGauge2
          item.boxGauge3 = boxGauge3
          return item
        })
      }
606 607 608 609 610 611 612 613 614 615 616 617
    },
    // 根据入仓记录ID筛选出他的全部拆出记录(不含主单的)
    getWarehouseInspecsRecordVOList(){
      return warehouseInId => {
        let specsRecordVOList = []
        // 这里是正在操作放入,但是还没确定提交的
        this.shopForm.specsRecordVOList.forEach(item => {
          if(item.warehouseInId == warehouseInId)specsRecordVOList.push(item)
        })
        return specsRecordVOList
      }
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
618
    // 根据入仓ID获取拆出数据
619 620 621 622 623 624 625 626
    getWarehouseInSplitData(){
      return (warehouseInId, field) => {
        let total = new Decimal(0)
        this.getWarehouseInspecsRecordVOList(warehouseInId).forEach(item => {
          total = total.plus(new Decimal(item[field] || 0))
        })
        return total.toNumber()
      }
627 628 629 630
    },
    // 获取入仓记录的剩余数据
    getWarehouseLeftData(){
      return (warehouseRecord, field) => {
631 632 633 634 635 636 637 638
        let warehouseField = field
        if(field === 'num'){
          warehouseField = 'cartonsNum'
        }
        if(field === 'quantity'){
          warehouseField = 'quantityAll'
        }
        let total = new Decimal(warehouseRecord[ warehouseField ] || 0)
639 640 641 642 643
        this.getWarehouseInspecsRecordVOList(warehouseRecord.id).forEach(item => {
          total = total.minus(new Decimal(item[field] || 0))
        })
        return total.toNumber()
      }
dragondean@qq.com's avatar
dragondean@qq.com committed
644 645 646 647
    },
    // 最大可装箱数 原单箱数 - 已装箱数
    maxNum(){
      return this.currRow.num - this.currRow.installNum
dragondean@qq.com's avatar
dragondean@qq.com committed
648 649 650 651
    },
    // 剩余可拆箱数
    leftSplitNum(){
      let num = this.maxNum - this.putin.num
dragondean@qq.com's avatar
dragondean@qq.com committed
652
      /*this.splitData.orderSplitItemBackVOList.forEach(item =>{
dragondean@qq.com's avatar
dragondean@qq.com committed
653
        num -= item.num
dragondean@qq.com's avatar
dragondean@qq.com committed
654
      })*/
dragondean@qq.com's avatar
dragondean@qq.com committed
655
      return num
656 657 658 659
    },
    // 订单剩余可拆货值
    leftWorth(){
      if(!this.orderData?.costVO?.totalWorth)return 0;
660
      let worth = new Decimal(this.orderData.costVO.totalWorth)
661
      this.splitData.orderSplitItemBackVOList.forEach(item =>{
662
        worth = worth.minus(item.worth || 0)
663
      })
664 665 666 667 668 669 670 671
      // 包当前选择的品名之前填写的货值包含进去
      if(this.shopForm.orderItemId){
        let splitItem = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
        if(splitItem){
          worth = worth.plus(splitItem.worth || 0)
        }
      }
      return worth.toNumber()
672
    },
673
  },
huhaiqing's avatar
huhaiqing committed
674
  methods: {
675 676 677 678 679 680 681 682 683 684 685 686 687
    /*检查并提交字段(体积,重量)修改*/
    updateField(row, field){
      let val = parseFloat(row[field])
      if(!val || val < 0){
        this.$message.error(this.$t('数据无效'))
        return this.getList()
      }
      splitItemUpdate(row).then(() => {
        this.$message.success(this.$t('修改成功'))
      }).catch(() => {
        this.getList()
      })
    },
688 689
    /* 拆箱总数,默认计算箱数,传递quantity可计算个数 */
    totalSplit(field = 'num') {
huhaiqing's avatar
huhaiqing committed
690 691 692
      let _total = 0;
      const { orderSplitItemBackVOList = [] } = this.splitData;
      orderSplitItemBackVOList.forEach((v) => {
693
        _total = Decimal.add(_total, Number(v[field])).toNumber();
huhaiqing's avatar
huhaiqing committed
694 695
      });
      return _total;
huhaiqing's avatar
huhaiqing committed
696
    },
huhaiqing's avatar
huhaiqing committed
697 698
    /* 打开拆单 */
    getSplit() {
699 700 701 702 703 704
      this.orderItems = this.currRow.goodsList ?? [];
      const { shipmentObj } = this.$attrs;
      splitList({
        orderId: this.currRow.orderId,
        shipmentId: shipmentObj.id,
      }).then((res) => {
705
        const data = res.data;
706
        // 取拆单项
707
        this.splitData = data.filter((item) => !item.isMaster)?.[0] ?? {};
708 709
        // 取主单,用语判断放入品名的数据上限
        this.mainOrder = data.find(item => item.isMaster)
710
      });
huhaiqing's avatar
huhaiqing committed
711
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
712
    /*itemDisabled(data) {
713 714 715 716 717
      const { orderSplitItemBackVOList = [] } = this.splitData;
      const isExist = orderSplitItemBackVOList.find(
        (item) => item.orderItemId === data.orderItemId
      );
      return isExist ? true : false;
dragondean@qq.com's avatar
dragondean@qq.com committed
718
    },*/
huhaiqing's avatar
huhaiqing committed
719 720
    /* 查询拆单项 */
    querySplitGoods() {
721 722 723 724 725
      getSplitList({
        lang: 0,
        orderId: this.currRow.orderId,
        shipmentType: 1,
      }).then((res) => {
726 727 728 729 730 731
        const { orderSplitBackVOList } = res.data; // 取拆单项
        const list =
          orderSplitBackVOList.filter((item) => !item.isMaster)?.[0] ?? {};

        this.splitData.orderSplitItemBackVOList =
          list.orderSplitItemBackVOList ?? [];
huhaiqing's avatar
huhaiqing committed
732
      });
huhaiqing's avatar
huhaiqing committed
733
    },
huhaiqing's avatar
huhaiqing committed
734
    getOrderDetail() {
huhaiqing's avatar
huhaiqing committed
735 736 737 738 739 740 741 742 743
      this.loading = true;
      getOrder(this.queryParams.orderId).then((response) => {
        this.orderData = response.data;
        this.loading = false;
      });
    },
    getSummaries() {
      const sums = [];

744
      sums[0] = this.$t("小计");
huhaiqing's avatar
huhaiqing committed
745 746 747 748 749 750 751
      if (
        !this.orderData ||
        !this.orderData.orderItemVOList ||
        this.orderData.length == 0
      ) {
        return sums;
      }
huhaiqing's avatar
huhaiqing committed
752 753 754 755 756 757
      let orderSum = 0;
      let orderV = 0;
      let orderW = 0;
      let leviteSum = 0;
      let leviteV = 0;
      let leviteW = 0;
huhaiqing's avatar
huhaiqing committed
758
      this.orderData.orderItemVOList.forEach((column, index) => {
759 760 761
        orderSum = Decimal.add(orderSum, column.num ?? 0).toNumber();
        orderV = Decimal.add(orderV, column.volume ?? 0).toFixed(2);
        orderW = Decimal.add(orderW, column.weight ?? 0).toFixed(2);
762 763 764
        leviteSum = Decimal.add(
          leviteSum,
          column.warehouseInInfoVO?.cartonsNum ?? 0
765
        ).toNumber();
766
        leviteV = Decimal.add(
huhaiqing's avatar
huhaiqing committed
767 768 769
          leviteV,
          column.warehouseInInfoVO?.volume ?? 0
        ).toFixed(2);
770
        leviteW = Decimal.add(
huhaiqing's avatar
huhaiqing committed
771 772 773
          leviteW,
          column.warehouseInInfoVO?.weight ?? 0
        ).toFixed(2);
huhaiqing's avatar
huhaiqing committed
774
      });
775
      sums[1] = this.$t(
huhaiqing's avatar
huhaiqing committed
776
        "下单统计:{orderSum} 箱 {orderV} m³ {orderW} kg 入仓统计:{leviteSum} 箱 {leviteV} m³ {leviteW} kg",
777 778 779 780 781 782 783 784 785
        {
          orderSum,
          orderV,
          orderW,
          leviteSum,
          leviteV,
          leviteW,
        }
      );
huhaiqing's avatar
huhaiqing committed
786 787 788
      return sums;
    },
    importCityName(id) {
huhaiqing's avatar
huhaiqing committed
789
      let arr = this.tradeCityList.filter((item) => item.id == id);
790
      return arr.length > 0 ? this.$l(arr[0], "title") : this.$t("");
huhaiqing's avatar
huhaiqing committed
791 792
    },
    submitForm() {
huhaiqing's avatar
huhaiqing committed
793 794 795
      const { shipmentObj } = this.$attrs;
      // 创建拆单审核
      createApproval({
Marcus's avatar
Marcus committed
796
        applyReason: this.$t("拆单审核"),
huhaiqing's avatar
huhaiqing committed
797 798
        approvalStatus: 0,
        approvalType: 8,
huhaiqing's avatar
huhaiqing committed
799
        copyUserId: this.selectedUsers,
huhaiqing's avatar
huhaiqing committed
800 801 802 803
        orderId: this.currRow.orderId,
        shipmentId: shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then((res) => {
804
          this.$emit("getBoxInfo");
805
          this.querySplitGoods();
huhaiqing's avatar
huhaiqing committed
806
        });
huhaiqing's avatar
huhaiqing committed
807 808
      });
    },
huhaiqing's avatar
huhaiqing committed
809
    addShop() {
huhaiqing's avatar
huhaiqing committed
810
      this.shopForm = {};
huhaiqing's avatar
huhaiqing committed
811
      this.shopOpen = true;
huhaiqing's avatar
huhaiqing committed
812
      this.isQuantity = false;
813 814
      // 重置表单数据
      this.shopForm = {specsRecordVOList:[]}
huhaiqing's avatar
huhaiqing committed
815 816 817
    },
    shopAdd() {
      this.$refs["shopForm"].validate((valid) => {
huhaiqing's avatar
huhaiqing committed
818
        if (valid) {
dragondean@qq.com's avatar
dragondean@qq.com committed
819
          if (this.putin.num === 0) {
820
            this.$message.error(this.$t("放入箱数不能为0"));
huhaiqing's avatar
huhaiqing committed
821 822
            return;
          }
dragondean@qq.com's avatar
dragondean@qq.com committed
823
          if (this.putin.quantity === 0 && this.isQuantity) {
824 825 826
            this.$message.error(this.$t("放入数量(个)不能为0"));
            return;
          }
dragondean@qq.com's avatar
dragondean@qq.com committed
827 828 829
          this.shopForm.specsRecordVOList.forEach(item => {
            item.boxGauge = `${item.boxGauge1}*${item.boxGauge2}*${item.boxGauge3}`
          })
huhaiqing's avatar
huhaiqing committed
830
          let params = {
dragondean@qq.com's avatar
dragondean@qq.com committed
831
            num: this.putin.num,
832
            // quantity: this.shopForm.quantity,
huhaiqing's avatar
huhaiqing committed
833 834 835
            orderItemId: this.shopForm.orderItemId,
            orderSplitId: this.splitData.id,
            remarks: this.shopForm.remarks,
dragondean@qq.com's avatar
dragondean@qq.com committed
836 837
            volume: this.putin.volume,
            weight: this.putin.weight,
838 839
            chargeWeight: this.shopForm.chargeWeight,
            chargeVolume: this.shopForm.chargeVolume,
dragondean@qq.com's avatar
dragondean@qq.com committed
840
            worth: this.shopForm.worth || 0,
841 842
            specsRecordVOList:this.shopForm.specsRecordVOList,
            shipmentSplit: true
huhaiqing's avatar
huhaiqing committed
843
          };
844 845
          // 按数量计费的才需要传递数量
          if(this.isQuantity){
dragondean@qq.com's avatar
dragondean@qq.com committed
846
            params.quantity = this.putin.quantity
847
          }
848 849 850 851
          // 货值不能超过剩余货值
          if(params.worth > this.leftWorth){
            return this.$message.error(this.$t("货值不能超过剩余货值"));
          }
huhaiqing's avatar
huhaiqing committed
852
          createSplitItem(params).then((res) => {
853
            this.$message.success(this.$t("放入成功"));
854
            this.querySplitGoods();
855
            this.$refs["shopForm"].resetFields();
856
            this.shopOpen = false;
huhaiqing's avatar
huhaiqing committed
857
          });
huhaiqing's avatar
huhaiqing committed
858 859 860 861 862
        }
      });
    },
    removeShop(id) {
      let that = this;
863
      that.$confirm(this.$t("是否移除货物吗?")).then(function () {
huhaiqing's avatar
huhaiqing committed
864
        deleteSplitItem(id).then((res) => {
865 866
          that.$message.success(that.$t("移除成功"));
          that.querySplitGoods();
huhaiqing's avatar
huhaiqing committed
867 868 869 870
        });
      });
    },
    cancelSplit() {
huhaiqing's avatar
huhaiqing committed
871 872
      const { shipmentObj } = this.$attrs;
      approvalCancel({
873
        applyReason: this.$t("取消审核"),
874
        id: shipmentObj["cabinetSplitInfo"].id,
huhaiqing's avatar
huhaiqing committed
875 876 877
        shipmentId: shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then(() => {
878
          this.$emit("getBoxInfo");
879
          this.querySplitGoods();
huhaiqing's avatar
huhaiqing committed
880 881 882 883
        });
      });
    },
    shopCancel() {
884
      this.$refs["shopForm"].resetFields();
huhaiqing's avatar
huhaiqing committed
885 886 887
      this.shopOpen = false;
      this.shopForm = {};
    },
888 889 890 891 892
    jumpReviewDetail() {
      const { cabinetSplitInfo } = this.$attrs.shipmentObj;
      toReviewDetail.apply(this, [cabinetSplitInfo.bpmProcessId]);
      this.$emit("closeDialog2", "close");
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
893 894 895 896 897
    // 添加一行
    addRow(){
      if(!this.shopForm.specsRecordVOList){
        this.$set(this.shopForm,'specsRecordVOList',[])
      }
898 899 900 901 902 903
      if(!this.currentWarehouseItem){
        return this.$message.info(this.$t("请选择入仓记录"))
      }
      let { specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight } = this.currentWarehouseItem
      let num = this.currentWarehouseItem.cartonsNum
      // 根据入仓记录添加一行
dragondean@qq.com's avatar
dragondean@qq.com committed
904
      this.shopForm.specsRecordVOList.push({
905 906
        specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight,num,
        orderLocationList: this.currentWarehouseItem.orderLocationBackVOList
dragondean@qq.com's avatar
dragondean@qq.com committed
907 908 909 910 911 912
      })
    },
    // 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
    deleteRow(index){
      const spliceIndex = typeof index !== 'number' ? this.shopForm.specsRecordVOList.length - 1 : index
      this.shopForm.specsRecordVOList.splice(spliceIndex, 1)
913
      this.calcDefaultData()
dragondean@qq.com's avatar
dragondean@qq.com committed
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931
    },
    // 计算体积
    calcVolume(row){
      let volume = Decimal(row.boxGauge1 || 0)
        .times(Decimal(row.boxGauge2 || 0))
        .times(Decimal(row.boxGauge3 || 0)).div(1000000)
      // 如果是箱的单位要乘以箱数
      if(row.specificationType === 1) {
        row.volume = volume.times(Decimal(row.num || 0))
      }

      // 最低0.01
      volume = Math.max(0.01, volume.toNumber().toFixed(2))
      this.$set(row, 'volume', volume)
      this.$set(row, 'chargeVolume', volume)
    },
    // 显示入库记录
    showWarehouse(row){
dragondean@qq.com's avatar
dragondean@qq.com committed
932 933 934
      if(!row.specsRecordVOList){
        return this.$message.info(this.$t('暂无入仓记录'))
      }
dragondean@qq.com's avatar
dragondean@qq.com committed
935
      this.currentWarehouseRecord = row.specsRecordVOList
936 937 938 939 940 941
    },
    // 获取储位名称
    getLocationName(locationArr){
      if(!locationArr || !locationArr.length) return ''
      let arr = []
      locationArr.forEach(item => {
942
        arr.push(`${item.areaName || ''}${item.locationName || ''}`)
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960
      })
      return Array.from(new Set(arr)).join(",")
    },
    // 根据入仓记录打开放入弹层
    putInRecord(row){
      this.currentPutIn = row
      // 此条入仓记录已拆出的入仓记录,这样在放入的时候可以确保不超过此入仓记录的数量
      this.currentPutIn.specsRecordVOList = this.getWarehouseInspecsRecordVOList(row.id)
    },
    // 放入回调
    handlePutin(list){
      if(!list.length){
        return this.$message.error(this.$t("请至少放入一条数据"))
      }
      list.forEach(item => {
        this.shopForm.specsRecordVOList.push({...item})
      })
      this.currentPutIn = null
961

962 963 964 965 966 967 968 969 970 971 972
      this.calcDefaultData()
    },
    // 清空放入记录
    clearAll(){
      this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
        this.shopForm.specsRecordVOList = []
        this.calcDefaultData()
      })
    },
    // 计算默认的收费数据
    calcDefaultData() {
973 974 975
      // 根据比例计算默认的收费方数和收费重量
      const orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
      const rate = this.putin.num / orderItem.warehouseInInfoVO.cartonsNum
976 977 978 979 980 981 982 983 984 985 986

      /*
      * 1 普货 2 重货 3 泡货
      * 普货 收费数据=入仓数据
      * 泡货 收费方数=入仓方数 收费重量 = 品名收费重量*比例
      * 重货 收费方数=品名收费方数*比例 收费重量 = 入仓重量
      * */
      const chargeVolume = orderItem.itemType === 2 ? (orderItem.chargeVolume*rate).toFixed(2) : this.putin.volume
      const chargeWeight = orderItem.itemType === 3 ? (orderItem.chargeWeight*rate).toFixed(2) : this.putin.weight
      this.$set(this.shopForm, 'chargeVolume', chargeVolume)
      this.$set(this.shopForm, 'chargeWeight', chargeWeight)
987 988 989 990

      // 货值按照主单的总货值*订单的箱数比例
      let worth = (this.orderData.costVO.totalWorth * this.putin.num / this.orderData.sumNum).toFixed(2)
      this.$set(this.shopForm, 'worth', worth)
991 992
    },
    // 查询订单剩余数据
993
    /*getOrderLeftData(){
994 995 996
      splitItemWorthCheck(this.orderData.orderId).then(res => {
        this.orderLeftData = res.data
      })
997
    }*/
998
  }
huhaiqing's avatar
huhaiqing committed
999 1000
};
</script>
huhaiqing's avatar
huhaiqing committed
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031

<style lang="scss">
.shipping-split-order {
  .card-title {
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
  }
  .card-info {
    font-size: 16px;
    > span {
      margin-right: 10px;
    }
  }
  .card {
    margin-top: 20px;
  }
  .btn-header {
    width: 90%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
  }
  .red {
    color: #ff3430;
    font-size: 15px;
  }
  .footer_btn {
    padding-bottom: 60px;
  }
huhaiqing's avatar
huhaiqing committed
1032 1033
}
</style>