index.vue 55.4 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2
<template>
  <div class="app-container">
lanbaoming's avatar
lanbaoming committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
    <div class="page-title">
      {{
        $route.query.product_id
          ? productTitle + "-" + $t("路线价格列表")
          : routeName
      }}
    </div>
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item
        :label="$t('商品名称')"
        prop="titleZh"
        v-if="!$route.query.product_id"
      >
        <el-input
          v-model="queryParams.titleZh"
          :placeholder="$t('请输入中英文名称、商品编码、海关编码')"
          clearable
          @keyup.enter.native="handleQuery"
        >
          <template #prepend>
            <el-select v-model="queryParams.searchType" style="width: 100px">
              <el-option :value="1" :label="$t('包含')"></el-option>
              <el-option :value="2" :label="$t('不包含')"></el-option>
              <el-option :value="3" :label="$t('等于')"></el-option>
            </el-select>
          </template>
        </el-input>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
38

lanbaoming's avatar
lanbaoming committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
      <el-form-item
        :label="$t('商品类型')"
        prop="typeId"
        v-if="!$route.query.product_id"
      >
        <el-select
          v-model="queryParams.typeId"
          :placeholder="$t('选择商品类型')"
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="type in typeList"
            :key="type.id"
            :label="$l(type, 'titleZh')"
            :value="type.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item
        :label="$t('商品属性')"
        prop="typeId"
        v-if="!$route.query.product_id"
      >
        <el-select
          v-model="queryParams.attrId"
          :placeholder="$t('选择商品类型')"
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="attr in attrList"
            :key="attr.id"
            :label="$l(attr, 'attrName')"
            :value="attr.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item
        :label="$t('运输方式')"
        prop="transportType"
        v-if="!transportType"
      >
lanbaoming's avatar
lanbaoming committed
82
      <!--控件对类型值有影响,不能在此处使用
lanbaoming's avatar
lanbaoming committed
83 84 85 86 87 88
        <dict-selector
          :type="DICT_TYPE.ECW_TRANSPORT_TYPE"
          v-model="queryParams.transportType"
          formatter="number"
          clearable
          @change="handleQuery"
lanbaoming's avatar
lanbaoming committed
89 90 91 92 93 94 95 96 97
        />-->
        <el-select
          v-model="queryParams.transportType"
          clearable
          @change="handleQuery"
        >
         <el-option value="1" label="海运拼柜"></el-option>
         <el-option value="3" label="专线空运"></el-option>
        </el-select>
lanbaoming's avatar
lanbaoming committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
      </el-form-item>
      <!--海运不显示渠道-->
      <el-form-item
        :label="$t('出货渠道')"
        prop="shippingChannelId"
        v-if="type !== 'sea'"
      >
        <el-select
          v-model="queryParams.shippingChannelId"
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="item in channelList"
            :key="item.id"
            :label="$l(item, 'name')"
            :value="item.channelId"
          />
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('始发地')" prop="startCityId">
        <el-select
          v-model="queryParams.startCityId"
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="city in startCityList"
            :key="city.id"
            :label="$l(city, 'title')"
            :value="city.id"
          />
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
132
      <el-form-item :label="$t('目的国')" prop="destCountryId">
lanbaoming's avatar
lanbaoming committed
133
        <el-select
lanbaoming's avatar
lanbaoming committed
134 135
          v-model="destCountryId"
          :label="destCountryId"
lanbaoming's avatar
lanbaoming committed
136 137 138 139 140 141 142 143 144 145 146 147
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="item in countryList"
            :key="item.id"
            :label="$l(item, 'title')"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
148
      <el-form-item :label="$t('目的地')" prop="destCityId">
lanbaoming's avatar
lanbaoming committed
149
        <el-select v-model="destCityId" clearable @change="handleQuery">
lanbaoming's avatar
lanbaoming committed
150
          <el-option
lanbaoming's avatar
lanbaoming committed
151 152 153 154 155
            v-for="item in AddressCity"
            :key="item.shi"
            :label="item.shiName"
            :value="item.shi"
          ></el-option>
lanbaoming's avatar
lanbaoming committed
156 157
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
158 159
      <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
        <el-select v-model="destWarehouseId" clearable @change="handleQuery">
lanbaoming's avatar
lanbaoming committed
160
          <el-option
lanbaoming's avatar
lanbaoming committed
161 162 163 164 165
            v-for="item in AddressTown"
            :key="item.id"
            :label="item.titleZh"
            :value="item.id"
          ></el-option>
lanbaoming's avatar
lanbaoming committed
166 167 168
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('是否预付')" prop="needPay">
lanbaoming's avatar
lanbaoming committed
169 170 171 172 173 174
        <el-select
          v-model="queryParams.needPay"
          :placeholder="$t('请选择')"
          clearable
          @change="handleQuery"
        >
lanbaoming's avatar
lanbaoming committed
175 176 177 178 179
          <el-option :label="$t('是')" value="1"></el-option>
          <el-option :label="$t('否')" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('上架状态')" prop="auditStatus">
lanbaoming's avatar
lanbaoming committed
180 181 182 183 184 185
        <dict-selector
          :type="DICT_TYPE.ECW_PRICE_AUDIT_STATUS"
          v-model="queryParams.auditStatus"
          clearable
          @change="handleQuery"
        />
lanbaoming's avatar
lanbaoming committed
186 187
      </el-form-item>
      <el-form-item :label="$t('状态')" prop="combStatus">
lanbaoming's avatar
lanbaoming committed
188 189 190 191 192 193
        <el-select
          v-model="queryParams.combStatus"
          :placeholder="$t('请选择状态')"
          clearable
          @change="handleQuery"
        >
lanbaoming's avatar
lanbaoming committed
194
          <el-option :label="$t('未设置价格')" value="setPrice_1"></el-option>
lanbaoming's avatar
lanbaoming committed
195
          <el-option :label="$t('未过期')" value="setPrice_2"></el-option>
lanbaoming's avatar
lanbaoming committed
196 197 198 199
          <el-option :label="$t('黑名单')" value="blacklist_1"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('是否单询')" prop="needOrderInquiry">
lanbaoming's avatar
lanbaoming committed
200 201 202 203 204 205
        <el-select
          v-model="queryParams.needOrderInquiry"
          :placeholder="$t('请选择')"
          clearable
          @change="handleQuery"
        >
lanbaoming's avatar
lanbaoming committed
206 207 208 209
          <el-option :label="$t('是')" value="1"></el-option>
          <el-option :label="$t('否')" value="0"></el-option>
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
210 211 212 213 214 215 216 217 218 219 220
      <el-form-item :label="$t('单价模式')" prop="priceType">
        <el-select
          v-model="queryParams.priceType"
          :placeholder="$t('请选择')"
          clearable
          @change="handleQuery"
        >
          <el-option :label="$t('运费+清关费')" value="0"></el-option>
          <el-option :label="$t('全包价')" value="1"></el-option>
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
221
      <el-form-item>
lanbaoming's avatar
lanbaoming committed
222 223 224 225 226 227
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
          $t("搜索")
        }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{
          $t("重置")
        }}</el-button>
lanbaoming's avatar
lanbaoming committed
228 229 230 231 232 233 234
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线-->
      <el-col :span="1.5" v-if="$route.query.product_id">
lanbaoming's avatar
lanbaoming committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd('air')"
          v-hasPermi="['ecw:product-price:create']"
          >{{ $t("新建空运价格") }}</el-button
        >
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd('sea')"
          v-hasPermi="['ecw:product-price:create']"
          >{{ $t("新建海运价格") }}</el-button
        >
lanbaoming's avatar
lanbaoming committed
253 254 255 256 257
      </el-col>
      <el-col :span="1.5">
        <!--未指定商品-->
        <template v-if="!$route.query.product_id">
          <!--<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit">{{$t('批量设置价格')}}</el-button>-->
lanbaoming's avatar
lanbaoming committed
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
          <el-button
            type="primary"
            v-hasPermi="['ecw:product-price:bartch_black']"
            size="mini"
            @click="batchBlock"
            :disabled="multiple"
            >{{ $t("批量加入黑名单") }}</el-button
          >
          <el-button
            type="primary"
            v-hasPermi="['ecw:product-price:batch_down']"
            size="mini"
            @click="batchOff"
            :disabled="multiple"
            >{{ $t("批量下架") }}</el-button
          >
          <el-button
            type="warning"
            v-hasPermi="['ecw:product-price:export']"
            size="mini"
            @click="handleExport"
            :loading="exportLoading"
            >{{ $t("导出") }}</el-button
          >
          <el-button
            type="primary"
            v-if="type != 'air'"
            v-hasPermi="['ecw:product-price:batch_update']"
            size="mini"
            @click="handleBatchEdit('sea')"
            >{{ $t("批量设置海运价格") }}</el-button
          >
          <el-button
            type="primary"
            v-if="type != 'sea'"
            v-hasPermi="['ecw:product-price:batch_update']"
            size="mini"
            @click="handleBatchEdit('air')"
            >{{ $t("批量设置空运价格") }}</el-button
          >
lanbaoming's avatar
lanbaoming committed
298 299 300 301
        </template>

        <!--指定商品-->
        <template v-else>
lanbaoming's avatar
lanbaoming committed
302 303 304 305 306 307 308 309 310 311 312 313 314 315
          <el-button
            type="primary"
            size="mini"
            v-hasPermi="['ecw:product-price:single_product']"
            @click="batchSetSingleProductPrice('sea')"
            >{{ $t("批量设置商品海运路线") }}</el-button
          >
          <el-button
            type="primary"
            size="mini"
            v-hasPermi="['ecw:product-price:single_product']"
            @click="batchSetSingleProductPrice('air')"
            >{{ $t("批量设置商品空运路线") }}</el-button
          >
lanbaoming's avatar
lanbaoming committed
316 317 318
        </template>
      </el-col>

lanbaoming's avatar
lanbaoming committed
319 320 321 322
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
lanbaoming's avatar
lanbaoming committed
323 324 325
    </el-row>

    <!-- 列表 -->
lanbaoming's avatar
lanbaoming committed
326 327 328 329 330 331 332 333 334 335
    <el-table
      v-loading="loading"
      :data="list"
      @selection-change="handleSelectionChange"
    >
      <el-table-column
        type="selection"
        width="55"
        align="center"
      ></el-table-column>
lanbaoming's avatar
lanbaoming committed
336 337
      <el-table-column :label="$t('序号')" prop="id" width="50" />

lanbaoming's avatar
lanbaoming committed
338 339 340 341 342 343 344 345 346 347 348
      <el-table-column
        :label="$t('商品编码')"
        align="center"
        prop="productCode"
      >
        <template slot-scope="{ row }">
          <el-link type="primary" @click.native="handleUpdate(row)">
            {{
              row.productDO ? row.productDO.productCode : $t("无productDO字段")
            }}
          </el-link>
lanbaoming's avatar
lanbaoming committed
349 350 351
        </template>
      </el-table-column>

lanbaoming's avatar
lanbaoming committed
352 353 354 355 356 357 358 359 360 361 362
      <el-table-column
        :label="$t('海关编码')"
        align="center"
        prop="customsCode"
      >
        <template slot-scope="{ row }">
          <div>
            {{
              row.productDO ? row.productDO.customsCode : $t("无productDO字段")
            }}
          </div>
lanbaoming's avatar
lanbaoming committed
363 364 365 366
        </template>
      </el-table-column>

      <el-table-column :label="$t('商品类型')" align="center" prop="typeId">
lanbaoming's avatar
lanbaoming committed
367 368 369 370 371 372
        <template slot-scope="{ row }">
          <span>{{
            row.productDO
              ? getTypeName(row.productDO.typeId)
              : $t("无productDO字段")
          }}</span>
lanbaoming's avatar
lanbaoming committed
373 374 375
        </template>
      </el-table-column>

lanbaoming's avatar
lanbaoming committed
376 377 378 379 380 381 382 383 384 385 386 387 388
      <el-table-column
        :label="$t('商品名称')"
        align="center"
        prop="productName"
      >
        <template slot-scope="{ row }">
          <el-link type="primary" @click.native="handleUpdate(row)">
            {{
              row.productDO
                ? row.productDO.titleZh + "/" + row.productDO.titleEn
                : $t("无productDO字段")
            }}
          </el-link>
lanbaoming's avatar
lanbaoming committed
389 390 391
        </template>
      </el-table-column>

lanbaoming's avatar
lanbaoming committed
392 393 394 395 396 397 398 399 400 401 402
      <el-table-column
        prop="tansportType"
        :label="$t('运输方式')"
        align="center"
        width="100"
      >
        <template slot-scope="scope">
          <div>
            {{ transportName(scope.row.warehouseLineDO.transportType) }}
          </div>
        </template>
lanbaoming's avatar
lanbaoming committed
403
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
404 405 406 407 408 409 410 411 412 413 414
      <el-table-column
        prop="tansportType"
        :label="$t('出货渠道')"
        align="center"
        width="100"
      >
        <template slot-scope="{ row }">
          <div>
            {{ channelName(row.shippingChannelId) }}
          </div>
        </template>
lanbaoming's avatar
lanbaoming committed
415
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
416 417 418 419 420 421 422 423 424 425 426 427
      <el-table-column
        prop="startDestTitle"
        :label="$t('始发地') + '/' + $t('目的地')"
        align="center"
      >
        <template slot-scope="scope">
          <div>
            {{ scope.row.warehouseLineDO.startTitleZh }}
            <br />
            {{ scope.row.warehouseLineDO.destTitleZh }}
          </div>
        </template>
lanbaoming's avatar
lanbaoming committed
428 429 430
      </el-table-column>

      <el-table-column prop="price" :label="$t('价格')" align="center">
lanbaoming's avatar
lanbaoming committed
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
        <template slot-scope="scope">
          <template v-if="scope.row.needOrderInquiry == 1">
            <div v-if="scope.row.needOrderInquiry == 1">
              {{ $t("单询无价格,请联系市场部") }}
            </div>
          </template>
          <template v-else>
            <template v-if="scope.row.stepPrice == 1">
              <!--全包价-->
              <div v-if="scope.row.priceType">
                <div
                  v-if="
                    !scope.row.fullPriceStepList ||
                    !scope.row.fullPriceStepList.length
                  "
                >
                  {{ $t("未设置全包价阶梯价") }}
                </div>
                <div v-else>
                  {{
                    $t("第{no}阶梯({start}~{end}{weightUnit}", {
liuzeheng's avatar
liuzeheng committed
452 453 454
                      no: 1,
                      start: scope.row.fullPriceStepList[0].startNum,
                      end: scope.row.fullPriceStepList[0].endNum,
lanbaoming's avatar
lanbaoming committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
                      weightUnit: getUnitTitle(
                        scope.row.fullPriceStepList[0].weightUnit
                      ),
                    })
                  }}<br />
                  {{ $t("全包价") }}:{{
                    getCurrencySymbol(
                      scope.row.fullPriceStepList[0].allPriceUnit
                    ) + scope.row.fullPriceStepList[0].allPrice
                  }}&nbsp;
                  {{
                    getCurrencyTitle(
                      scope.row.fullPriceStepList[0].allPriceUnit
                    ) +
                    "/" +
                    getUnitTitle(scope.row.fullPriceStepList[0].allVolumeUnit)
                  }}
liuzeheng's avatar
liuzeheng committed
472
                </div>
lanbaoming's avatar
lanbaoming committed
473 474 475 476 477 478 479 480 481 482 483 484 485
              </div>
              <template v-else>
                <div
                  v-if="
                    !scope.row.freightPriceStepList ||
                    !scope.row.freightPriceStepList.length
                  "
                >
                  {{ $t("未设置运费阶梯价") }}
                </div>
                <div v-else>
                  {{
                    $t("第{no}阶梯({start}~{end}{weightUnit}", {
liuzeheng's avatar
liuzeheng committed
486 487 488
                      no: 1,
                      start: scope.row.freightPriceStepList[0].startNum,
                      end: scope.row.freightPriceStepList[0].endNum,
lanbaoming's avatar
lanbaoming committed
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
                      weightUnit: getUnitTitle(
                        scope.row.freightPriceStepList[0].weightUnit
                      ),
                    })
                  }}<br />

                  <div>
                    {{ $t("运费") }}:{{
                      getCurrencySymbol(
                        scope.row.freightPriceStepList[0].transportPriceUnit
                      ) + scope.row.freightPriceStepList[0].transportPrice
                    }}&nbsp;
                    {{
                      getCurrencyTitle(
                        scope.row.freightPriceStepList[0].transportPriceUnit
                      ) +
                      "/" +
                      getUnitTitle(
                        scope.row.freightPriceStepList[0].transportVolumeUnit
                      )
                    }}
liuzeheng's avatar
liuzeheng committed
510 511 512
                  </div>
                </div>
              </template>
lanbaoming's avatar
lanbaoming committed
513 514 515 516 517
              <el-button
                type="text"
                @click="showMoreStepPriceItem = scope.row"
                >{{ $t("查看更多") }}</el-button
              >
liuzeheng's avatar
liuzeheng committed
518
            </template>
lanbaoming's avatar
lanbaoming committed
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555

            <template v-else>
              <div v-if="scope.row.priceType == 0">
                {{ $t("运费") }}:{{
                  getCurrencySymbol(scope.row.transportPriceUnit) +
                  scope.row.transportPrice
                }}&nbsp;
                {{
                  getCurrencyTitle(scope.row.transportPriceUnit) +
                  "/" +
                  getUnitTitle(scope.row.transportVolumeUnit)
                }}
                <br />
                {{ $t("清关费") }}:{{
                  getCurrencySymbol(scope.row.clearancePriceUnit) +
                  scope.row.clearancePrice
                }}&nbsp;
                {{
                  getCurrencyTitle(scope.row.clearancePriceUnit) +
                  "/" +
                  getUnitTitle(scope.row.clearanceVolumeUnit)
                }}
              </div>
              <div v-if="scope.row.priceType == 1">
                {{ $t("全包价") }}:{{
                  getCurrencySymbol(scope.row.allPriceUnit) +
                  scope.row.allPrice
                }}&nbsp;
                {{
                  getCurrencyTitle(scope.row.allPriceUnit) +
                  "/" +
                  getUnitTitle(scope.row.allVolumeUnit)
                }}
              </div>
            </template>
          </template>
          <!-- <template v-if="scope.row.stepPrice == 1">
lanbaoming's avatar
lanbaoming committed
556
              <!--全包价-->
lanbaoming's avatar
lanbaoming committed
557
          <!-- <div v-if="scope.row.priceType">
lanbaoming's avatar
lanbaoming 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 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
                <div v-if="!scope.row.fullPriceStepList || !scope.row.fullPriceStepList.length">{{$t('未设置全包价阶梯价')}}</div>
                <div v-else>
                  {{$t("第{no}阶梯({start}~{end}{weightUnit}", {
                    no: 1,
                    start: scope.row.fullPriceStepList[0].startNum,
                    end: scope.row.fullPriceStepList[0].endNum,
                    weightUnit:  getUnitTitle(scope.row.fullPriceStepList[0].weightUnit),
                  })}}<br/>
                  {{$t('全包价')}}:{{ getCurrencySymbol(scope.row.fullPriceStepList[0].allPriceUnit) + scope.row.fullPriceStepList[0].allPrice}}&nbsp;
                  {{ getCurrencyTitle(scope.row.fullPriceStepList[0].allPriceUnit) + '/' + getUnitTitle(scope.row.fullPriceStepList[0].allVolumeUnit)}}
                </div>
              </div>
              <template v-else>
                <div v-if="!scope.row.freightPriceStepList || !scope.row.freightPriceStepList.length">{{$t('未设置运费阶梯价')}}</div>
                <div v-else>
                  {{$t("第{no}阶梯({start}~{end}{weightUnit}", {
                    no: 1,
                    start: scope.row.freightPriceStepList[0].startNum,
                    end: scope.row.freightPriceStepList[0].endNum,
                    weightUnit:  getUnitTitle(scope.row.freightPriceStepList[0].weightUnit),
                  })}}<br/>

                  <div>
                    {{$t('运费')}}:{{ getCurrencySymbol(scope.row.freightPriceStepList[0].transportPriceUnit) + scope.row.freightPriceStepList[0].transportPrice}}&nbsp;
                    {{ getCurrencyTitle(scope.row.freightPriceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.freightPriceStepList[0].transportVolumeUnit)}}
                  </div>
                </div>
              </template>
              <el-button type="text" @click="showMoreStepPriceItem=scope.row">{{$t('查看更多')}}</el-button>
            </template>

            <template v-else>
              <div v-if="scope.row.priceType == 0">
                {{$t('运费')}}:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
                {{ getCurrencyTitle(scope.row.transportPriceUnit) + '/' + getUnitTitle(scope.row.transportVolumeUnit)}}
                <br />
                {{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
                {{ getCurrencyTitle(scope.row.clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearanceVolumeUnit)}}
              </div>
              <div v-if="scope.row.priceType == 1">
                {{$t('全包价')}}:{{ getCurrencySymbol(scope.row.allPriceUnit) + scope.row.allPrice}}&nbsp;
                {{ getCurrencyTitle(scope.row.allPriceUnit) + '/' + getUnitTitle(scope.row.allVolumeUnit)}}
              </div>
liuzeheng's avatar
liuzeheng committed
601
            </template>  -->
lanbaoming's avatar
lanbaoming committed
602
        </template>
lanbaoming's avatar
lanbaoming committed
603 604
      </el-table-column>

lanbaoming's avatar
lanbaoming committed
605 606 607 608 609 610
      <el-table-column
        prop="auditStatus"
        align="center"
        :label="$t('状态')"
        width="120"
      >
lanbaoming's avatar
lanbaoming committed
611 612
        <template slot-scope="scope">
          <div>
lanbaoming's avatar
lanbaoming committed
613 614 615 616 617 618 619 620 621 622 623
            {{ statusName(scope.row) }}
            <span
              style="color: red"
              v-if="
                (scope.row.validateStartDate &&
                  scope.row.validateStartDate > Date.now()) ||
                (scope.row.validateEndDate &&
                  scope.row.validateEndDate < Date.now())
              "
              >(已过期)</span
            >
lanbaoming's avatar
lanbaoming committed
624 625 626
          </div>
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
627 628 629 630 631 632
      <el-table-column
        prop="advanceStatus"
        :label="$t('单询')"
        align="center"
        width="80"
      >
lanbaoming's avatar
lanbaoming committed
633
        <template slot-scope="scope">
lanbaoming's avatar
lanbaoming committed
634 635 636 637
          <dict-tag
            :type="DICT_TYPE.NEED_ORDER_INQUIRY"
            :value="scope.row.needOrderInquiry"
          ></dict-tag>
lanbaoming's avatar
lanbaoming committed
638 639
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
      <el-table-column
        prop="advanceStatus"
        :label="$t('预付')"
        align="center"
        width="80"
      >
        <template slot-scope="scope">
          <div>
            <!-- {{ getAdvanceStatuTitle(scope.row.advanceStatus) }} -->
            <dict-tag
              :type="DICT_TYPE.ECW_PAY_ADVANCE"
              :value="scope.row.needPay"
            ></dict-tag>
          </div>
        </template>
lanbaoming's avatar
lanbaoming committed
655 656
      </el-table-column>
      <el-table-column :label="$t('最后修改时间')">
lanbaoming's avatar
lanbaoming committed
657
        <template slot-scope="{ row }">
lanbaoming's avatar
lanbaoming committed
658
          <div>
lanbaoming's avatar
lanbaoming committed
659
            {{ row.updateTime | parseTime }}
lanbaoming's avatar
lanbaoming committed
660 661 662
          </div>
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
663 664 665 666 667 668
      <el-table-column
        :label="$t('操作')"
        align="center"
        class-name="small-padding fixed-width"
        width="140"
      >
lanbaoming's avatar
lanbaoming committed
669
        <template slot-scope="scope">
lanbaoming's avatar
lanbaoming committed
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row, true)"
            v-hasPermi="['ecw:product-price:show']"
            >{{ $t("查看") }}</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['ecw:product-price:update']"
            >{{ $t("编辑") }}</el-button
          >
lanbaoming's avatar
lanbaoming committed
686

lanbaoming's avatar
lanbaoming committed
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="updateStatus(scope.row, 'blacklist')"
            v-hasPermi="['ecw:product-price:black']"
            >{{
              scope.row.blacklist == 0 ? $t("加入黑名单") : $t("移除黑名单")
            }}</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="updateStatus(scope.row, 'auditStatus')"
            v-hasPermi="['ecw:product-price:down']"
            >{{
              scope.row.auditStatus == AuditStatusEnum.PASS
                ? $t("下架")
                : $t("上架")
            }}</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ecw:product-price:delete']"
            >{{ $t("删除") }}</el-button
          >
          <el-button @click="copyTemplate(scope.row)" size="mini" type="text">{{
            $t("复制模板")
          }}</el-button>
          <el-button
            @click="setOrderInquiry(scope.row, 0)"
            v-if="scope.row.needOrderInquiry"
            size="mini"
            type="text"
            >{{ $t("取消单询") }}</el-button
          >
          <el-button
            @click="setOrderInquiry(scope.row, 1)"
            v-else
            size="mini"
            type="text"
            >{{ $t("单询异常") }}</el-button
          >
lanbaoming's avatar
lanbaoming committed
734 735 736 737
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
lanbaoming's avatar
lanbaoming committed
738 739 740 741 742 743 744
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
lanbaoming's avatar
lanbaoming committed
745

lanbaoming's avatar
lanbaoming committed
746 747 748 749 750
    <el-dialog
      :visible="!!showMoreStepPriceItem"
      :before-close="closeMoreStepPrice"
      :title="$t('查看阶梯价')"
    >
lanbaoming's avatar
lanbaoming committed
751 752 753 754
      <el-row :gutter="20" v-if="showMoreStepPriceItem">
        <el-col :span="12">
          <!--全包价-->
          <template v-if="showMoreStepPriceItem.priceType">
lanbaoming's avatar
lanbaoming committed
755 756 757
            <div
              v-for="(item, index) in showMoreStepPriceItem.fullPriceStepList"
            >
lanbaoming's avatar
lanbaoming committed
758 759 760 761 762 763
              <show-step-price-item
                :value="item"
                :unit-map="unitMap"
                :currency-map="currencyMap"
                :index="index"
                field-prefix="all"
lanbaoming's avatar
lanbaoming committed
764 765
                :price-name="$t('全包价')"
              ></show-step-price-item>
lanbaoming's avatar
lanbaoming committed
766 767 768 769
            </div>
          </template>
          <template v-else>
            <template v-if="showMoreStepPriceItem.freightPriceStepList">
lanbaoming's avatar
lanbaoming committed
770 771 772 773 774
              <div
                v-for="(
                  item, index
                ) in showMoreStepPriceItem.freightPriceStepList"
              >
lanbaoming's avatar
lanbaoming committed
775 776 777 778 779 780
                <show-step-price-item
                  :value="item"
                  :unit-map="unitMap"
                  :currency-map="currencyMap"
                  :index="index"
                  field-prefix="transport"
lanbaoming's avatar
lanbaoming committed
781 782
                  :price-name="$t('运费')"
                ></show-step-price-item>
lanbaoming's avatar
lanbaoming committed
783 784 785
              </div>
            </template>
            <template v-if="showMoreStepPriceItem.clearancePriceStepList">
lanbaoming's avatar
lanbaoming committed
786 787 788 789 790
              <div
                v-for="(
                  item, index
                ) in showMoreStepPriceItem.clearancePriceStepList"
              >
lanbaoming's avatar
lanbaoming committed
791 792 793 794 795 796
                <show-step-price-item
                  :value="item"
                  :unit-map="unitMap"
                  :currency-map="currencyMap"
                  :index="index"
                  field-prefix="clearance"
lanbaoming's avatar
lanbaoming committed
797 798
                  :price-name="$t('清关费')"
                ></show-step-price-item>
lanbaoming's avatar
lanbaoming committed
799 800 801 802 803 804 805 806
              </div>
            </template>
          </template>
        </el-col>
        <!--空运的清关费单独显示-->
        <!--
        甲方要求不显示清关费 https://zentao.test.jdshangmen.com/bug-view-5298.html
        -->
lanbaoming's avatar
lanbaoming committed
807
        <!--        <el-col :span="12" v-if="[3,4].indexOf(+showMoreStepPriceItem.warehouseLineDO.transportType) > -1">
lanbaoming's avatar
lanbaoming committed
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
          <template v-if="showMoreStepPriceItem.clearPriceStepList.length">
            <div v-for="(item, index) in showMoreStepPriceItem.clearPriceStepList">
              <div  class="page-title">
                {{$t("第{no}阶梯({start}~{end}{weightUnit}", {
                no: index + 1,
                start: item.startNum,
                end: item.endNum,
                weightUnit:  getUnitTitle(item.weightUnit),
                })}}
              </div>
              {{$t('清关费')}}:{{ getCurrencySymbol(item.clearancePriceUnit) + item.clearancePrice}}&nbsp;
              {{ getCurrencyTitle(item.clearancePriceUnit) + '/' + getUnitTitle(item.clearanceVolumeUnit)}}
            </div>
          </template>
          <template v-else>{{$t('暂无清关费设置')}}</template>
        </el-col>-->
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
lanbaoming's avatar
lanbaoming committed
830
import { getRegionList } from "@/api/ecw/order";
lanbaoming's avatar
lanbaoming committed
831 832 833 834 835 836 837 838 839
import {
  createProductPrice,
  updateProductPrice,
  deleteProductPrice,
  getProductPrice,
  getProductPricePage,
  exportProductPriceExcel,
  batchBlock,
  batchOff,
lanbaoming's avatar
lanbaoming committed
840
  updateOrderInquiry,
lanbaoming's avatar
lanbaoming committed
841 842
} from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
lanbaoming's avatar
lanbaoming committed
843
import { getTradeCityList, getListTree } from "@/api/ecw/region";
lanbaoming's avatar
lanbaoming committed
844 845
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductAttrList } from "@/api/ecw/productAttr";
lanbaoming's avatar
lanbaoming committed
846 847 848 849 850 851 852 853 854
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
import { getCurrencyList } from "@/api/ecw/currency";
import { getUnitList } from "@/api/ecw/unit";
import { AuditStatusEnum } from "@/utils/constants";
import { getAllChannelList, getChannelList } from "@/api/ecw/channel";
import DictTag from "@/components/DictTag";
import { arrryToKeyedObjectBy } from "@/utils/index";
import { getProduct } from "@/api/ecw/product";
import { parseTime } from "@/utils/ruoyi";
lanbaoming's avatar
lanbaoming committed
855
import Template from "@/views/cms/template";
lanbaoming's avatar
lanbaoming committed
856
import { getStatusName } from "./util";
lanbaoming's avatar
lanbaoming committed
857 858 859
import ShowStepPriceItem from "@/views/ecw/productPrice/components/ShowStepPriceItem.vue";
export default {
  name: "EcwProductpriceIndex",
lanbaoming's avatar
lanbaoming committed
860
  filters: { parseTime },
lanbaoming's avatar
lanbaoming committed
861 862 863
  components: {
    ShowStepPriceItem,
    Template,
lanbaoming's avatar
lanbaoming committed
864
    DictTag,
lanbaoming's avatar
lanbaoming committed
865 866 867
  },
  data() {
    return {
lanbaoming's avatar
lanbaoming committed
868 869 870 871 872 873 874
      AddressCity: [], //目的城市
      AddressProvince: [], //省份
      AddressTown: [], //目的仓
      destCountryId: [],
      objectiveId: [],
      destCityId: null,
      destWarehouseId: "",
lanbaoming's avatar
lanbaoming committed
875 876 877 878 879 880 881
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      //特性列表
lanbaoming's avatar
lanbaoming committed
882
      attrList: [],
lanbaoming's avatar
lanbaoming committed
883 884
      typeList: [],
      product: null,
lanbaoming's avatar
lanbaoming committed
885 886
      countryList: [], //目的国
      warehouseList: [], //目前仓
lanbaoming's avatar
lanbaoming committed
887 888 889
      cityList: [],
      /* startCityList: [],  //始发地城市
      destCityList: [],   //目的地城市 */
lanbaoming's avatar
lanbaoming committed
890 891 892 893 894 895
      routedList: [], //已开头路线列表
      currencyList: [], //货币列表
      unitList: [], //单位列表
      channelList: [], // 渠道
      routeParams: {}, //路线搜索条件
      isUpdate: false, //更新操作
lanbaoming's avatar
lanbaoming committed
896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 产品价格列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        searchType: 1,
        pageNo: 1,
        pageSize: 10,
        productId: null,
        warehouseLineId: null,
        transportType: null,
        transportPrice: null,
        transportPriceUnit: null,
        transportVolumeUnit: null,
        clearancePrice: null,
        clearancePriceUnit: null,
        clearanceVolumeUnit: null,
        shippingChannelId: null,
        status: null,
lanbaoming's avatar
lanbaoming committed
927 928 929 930 931
        countryId: null, //国家
        objectiveId: null,
        destCityId: null, //目的城市
        destCountryId: null, //目的国
        destWarehouseId: null, //目的仓
lanbaoming's avatar
lanbaoming committed
932 933 934 935
      },
      // 表单参数
      form: {
        typeId: null,
lanbaoming's avatar
lanbaoming committed
936
        titleZh: null,
lanbaoming's avatar
lanbaoming committed
937 938 939
      },
      // 表单校验
      rules: {
lanbaoming's avatar
lanbaoming committed
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998
        typeId: [
          {
            required: true,
            message: this.$t("产品类型不能为空"),
            trigger: "blur",
          },
        ],
        titleZh: [
          {
            required: true,
            message: this.$t("产品名称不能为空"),
            trigger: "blur",
          },
        ],
        titleEn: [
          {
            required: true,
            message: this.$t("英文名称不能为空"),
            trigger: "blur",
          },
        ],
        transportPrice: [
          {
            required: true,
            message: this.$t("海运费不能为空"),
            trigger: "blur",
          },
        ],
        clearancePrice: [
          {
            required: true,
            message: this.$t("清关费不能为空"),
            trigger: "blur",
          },
        ],
        advanceStatus: [
          {
            required: true,
            message: this.$t("是否预付不能为空"),
            trigger: "blur",
          },
        ],
        containerLocation: [
          {
            required: true,
            message: this.$t("货柜位置不能为空"),
            trigger: "blur",
          },
        ],
        square: [
          { required: true, message: this.$t("方数不能为空"), trigger: "blur" },
        ],
        needBook: [
          {
            required: true,
            message: this.$t("预约入仓不能为空"),
            trigger: "blur",
          },
        ],
lanbaoming's avatar
lanbaoming committed
999 1000 1001 1002 1003 1004 1005 1006 1007
      },

      lineList: [],
      transportDatas: getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE),
      /* advanceStatusDictDatas: getDictDatas(DICT_TYPE.ADVANCE_STATUS), */
      AuditStatusEnum: AuditStatusEnum,
      locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
      // 查看更多阶梯价
      showMoreStepPriceItem: null,
lanbaoming's avatar
lanbaoming committed
1008
      entryPath: null,
lanbaoming's avatar
lanbaoming committed
1009 1010 1011 1012 1013 1014 1015
    };
  },

  computed: {
    // 路径中的运输方式参数
    transportType() {
      // product-price-1_2的格式,如果没有三段则最后一段不是运输方式
lanbaoming's avatar
lanbaoming committed
1016
      return this.$route.path.split("-")[2] || "";
lanbaoming's avatar
lanbaoming committed
1017 1018
    },
    // 路由中的标题
lanbaoming's avatar
lanbaoming committed
1019 1020
    routeName() {
      return this.$route.name;
lanbaoming's avatar
lanbaoming committed
1021 1022
    },
    // 类型,transportType是1和2(1_2用一个表示)表示海运,3和4表示空运
lanbaoming's avatar
lanbaoming committed
1023
    type() {
lanbaoming's avatar
lanbaoming committed
1024
      // 如果没有则表示商品路线价格
lanbaoming's avatar
lanbaoming committed
1025 1026
      if (!this.transportType) {
        return null;
lanbaoming's avatar
lanbaoming committed
1027
      }
lanbaoming's avatar
lanbaoming committed
1028
      return ["3", "4"].indexOf(this.transportType) > -1 ? "air" : "sea";
lanbaoming's avatar
lanbaoming committed
1029 1030
    },
    // 商品名称
lanbaoming's avatar
lanbaoming committed
1031 1032 1033
    productTitle() {
      if (!this.product) {
        return "";
lanbaoming's avatar
lanbaoming committed
1034
      }
lanbaoming's avatar
lanbaoming committed
1035
      return this.product.titleZh;
lanbaoming's avatar
lanbaoming committed
1036 1037
    },
    // 渠道用id做键值
lanbaoming's avatar
lanbaoming committed
1038 1039
    keyedChannel() {
      return arrryToKeyedObjectBy(this.channelList, "channelId");
lanbaoming's avatar
lanbaoming committed
1040 1041
    },
    // 根据渠道id获取渠道名
lanbaoming's avatar
lanbaoming committed
1042 1043 1044 1045
    channelName() {
      return (id) => {
        return this.keyedChannel[id] ? this.keyedChannel[id].nameZh : null;
      };
lanbaoming's avatar
lanbaoming committed
1046 1047 1048
    },
    // 根据类型获取类型名称
    getTypeName() {
lanbaoming's avatar
lanbaoming committed
1049 1050
      return (typeId) => {
        for (let index in this.typeList) {
lanbaoming's avatar
lanbaoming committed
1051
          let typeItem = this.typeList[index];
lanbaoming's avatar
lanbaoming committed
1052 1053
          if (typeItem.id == typeId) {
            return this.$l(typeItem, "title");
lanbaoming's avatar
lanbaoming committed
1054 1055
          }
        }
lanbaoming's avatar
lanbaoming committed
1056
      };
lanbaoming's avatar
lanbaoming committed
1057 1058 1059
    },
    // 根据状态获取状态名称 ,这个应该可以改成字典,目前接口缺少相关数据,待定
    statusName() {
lanbaoming's avatar
lanbaoming committed
1060
      return getStatusName;
lanbaoming's avatar
lanbaoming committed
1061 1062 1063 1064
    },

    // 根据运输方式获取名称
    transportName() {
lanbaoming's avatar
lanbaoming committed
1065 1066 1067 1068 1069 1070
      return (transportType) => {
        return this.getDictDataLabel(
          this.DICT_TYPE.ECW_TRANSPORT_TYPE,
          transportType
        );
      };
lanbaoming's avatar
lanbaoming committed
1071 1072 1073
    },
    // 显示币种符号
    getCurrencySymbol() {
lanbaoming's avatar
lanbaoming committed
1074 1075
      return (currencyId) => {
        for (let index in this.currencyList) {
lanbaoming's avatar
lanbaoming committed
1076
          let currecyItem = this.currencyList[index];
lanbaoming's avatar
lanbaoming committed
1077
          if (currecyItem.id == currencyId) {
lanbaoming's avatar
lanbaoming committed
1078 1079 1080
            return currecyItem.fuhao;
          }
        }
lanbaoming's avatar
lanbaoming committed
1081
      };
lanbaoming's avatar
lanbaoming committed
1082 1083 1084
    },
    // 显示币种名称
    getCurrencyTitle() {
lanbaoming's avatar
lanbaoming committed
1085 1086
      return (currencyId) => {
        for (let index in this.currencyList) {
lanbaoming's avatar
lanbaoming committed
1087
          let currecyItem = this.currencyList[index];
lanbaoming's avatar
lanbaoming committed
1088 1089
          if (currecyItem.id == currencyId) {
            return this.$l(currecyItem, "title");
lanbaoming's avatar
lanbaoming committed
1090 1091
          }
        }
lanbaoming's avatar
lanbaoming committed
1092
      };
lanbaoming's avatar
lanbaoming committed
1093 1094 1095
    },

    getUnitTitle() {
lanbaoming's avatar
lanbaoming committed
1096 1097
      return (unitId) => {
        for (let index in this.unitList) {
lanbaoming's avatar
lanbaoming committed
1098
          let unitItem = this.unitList[index];
lanbaoming's avatar
lanbaoming committed
1099 1100
          if (unitItem.id == unitId) {
            return this.$l(unitItem, "title");
lanbaoming's avatar
lanbaoming committed
1101 1102
          }
        }
lanbaoming's avatar
lanbaoming committed
1103
      };
lanbaoming's avatar
lanbaoming committed
1104 1105
    },

lanbaoming's avatar
lanbaoming committed
1106 1107 1108
    startCityList() {
      //字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口
      return this.cityList.filter((item) => item.type == 2 || item.type == 3);
lanbaoming's avatar
lanbaoming committed
1109
    },
lanbaoming's avatar
lanbaoming committed
1110 1111 1112
    destCityList() {
      //字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口
      return this.cityList.filter((item) => item.type == 1 || item.type == 3);
lanbaoming's avatar
lanbaoming committed
1113
    },
lanbaoming's avatar
lanbaoming committed
1114 1115 1116 1117 1118 1119
    currencyMap() {
      let map = {};
      this.currencyList.forEach((item) => {
        map[item.id] = this.$l(item, "title");
      });
      return map;
lanbaoming's avatar
lanbaoming committed
1120
    },
lanbaoming's avatar
lanbaoming committed
1121 1122 1123 1124 1125 1126
    unitMap() {
      let map = {};
      this.unitList.forEach((item) => {
        map[item.id] = this.$l(item, "title");
      });
      return map;
lanbaoming's avatar
lanbaoming committed
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
    },
  },
  activated() {
    // console.log('activated', Object.assign({}, this.$route.query))
    /* this.$set(this.queryParams, 'typeId', +this.$route.query.product_type || null)

    let productId = this.product?.id
    console.log(this.$route.query.product_id, productId, this.$route.query.product_id != productId)
    if(this.$route.query.product_id != productId){
      this.queryParams = {
        pageNo: 1,
        pageSize: 10
      }
    }
    this.handleQuery()
     */
lanbaoming's avatar
lanbaoming committed
1143 1144
    if (this.$route.query.product_type) {
      this.$set(this.queryParams, "typeId", +this.$route.query.product_type);
lanbaoming's avatar
lanbaoming committed
1145
    }
lanbaoming's avatar
lanbaoming committed
1146 1147 1148 1149 1150 1151
    if (this.$route.query.transportType) {
      this.$set(
        this.queryParams,
        "transportType",
        +this.$route.query.transportType
      );
lanbaoming's avatar
lanbaoming committed
1152 1153
    }
    // 指定产品获取产品信息
lanbaoming's avatar
lanbaoming committed
1154 1155 1156 1157 1158 1159
    if (this.$route.query.product_id) {
      this.$set(this.queryParams, "productId", +this.$route.query.product_id);
      getProduct(this.$route.query.product_id).then((res) => {
        this.product = res.data;
      });
    } else {
lanbaoming's avatar
lanbaoming committed
1160 1161
      if (this.transportType) {
        // 如果指定了单个的运输方式则赋值
lanbaoming's avatar
lanbaoming committed
1162 1163
        if (this.transportType.split("_").length == 1) {
          this.$set(this.queryParams, "transportType", +this.transportType);
lanbaoming's avatar
lanbaoming committed
1164 1165 1166 1167
        }
      }
    }
  },
lanbaoming's avatar
lanbaoming committed
1168
  watch: {
lanbaoming's avatar
lanbaoming committed
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326
    destCountryId: {
      //监听当前地区值的变化,于与上方地区值进行了双向绑定
      deep: true, //深度监听
      handler() {
        //每当值省份值改变时其下地区值进行清空
        this.AddressCity = [];
        this.AddressTown = [];
        this.destWarehouseId = "";
        this.destCityId = "";
        this.findByprovinceCode();
        if (this.destCountryId == "") {
          //1 是所有区域,2 国家,3是市,
          getRegionList(4, 4)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });

          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(2, this.destCountryId)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },
    destCityId: {
      deep: true, //深度监听 目的仓
      handler() {
        this.AddressTown = [];
        this.destWarehouseId = "";
        this.findBycityCode();
        if (
          this.destCityId != "" &&
          this.destCountryId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(2, this.destCountryId)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },
    destWarehouseId: {
      deep: true, //深度监听
      handler() {
        if (
          this.destCountryId != "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },
lanbaoming's avatar
lanbaoming committed
1327
    "$route.query.product_id"() {
lanbaoming's avatar
lanbaoming committed
1328 1329 1330 1331 1332
      // if(!this.$route.query.product_id){
      //   return this.product = null
      // }
      // 价格列表 跟 商品的价格列表,有时候商品价格列表的路由变动会导致价格列表也执行此处代码,所以做一个判断排除
      // https://zentao.test.jdshangmen.com/bug-view-4928.html
lanbaoming's avatar
lanbaoming committed
1333
      if (this.$route.path != this.entryPath) return;
lanbaoming's avatar
lanbaoming committed
1334

lanbaoming's avatar
lanbaoming committed
1335 1336 1337
      let productId = this.product?.id;
      if (this.$route.name === "ProductPrice") {
        if (this.$route.query.product_id != productId) {
lanbaoming's avatar
lanbaoming committed
1338 1339 1340 1341 1342
          this.queryParams = {
            pageNo: 1,
            pageSize: 10,
            productId: this.$route.query.product_id,
            typeId: this.$route.query.product_type,
lanbaoming's avatar
lanbaoming committed
1343 1344
            transportType: this.$route.query.transportType,
          };
lanbaoming's avatar
lanbaoming committed
1345
        }
lanbaoming's avatar
lanbaoming committed
1346 1347 1348
        getProduct(this.$route.query.product_id).then((res) => {
          this.product = res.data;
        });
lanbaoming's avatar
lanbaoming committed
1349 1350
        this.getList();
      }
lanbaoming's avatar
lanbaoming committed
1351
    },
lanbaoming's avatar
lanbaoming committed
1352 1353
  },
  created() {
lanbaoming's avatar
lanbaoming committed
1354 1355 1356
    this.entryPath = this.$route.path;
    if (this.$route.query.product_type) {
      this.$set(this.queryParams, "typeId", +this.$route.query.product_type);
lanbaoming's avatar
lanbaoming committed
1357
    }
lanbaoming's avatar
lanbaoming committed
1358 1359 1360 1361 1362 1363
    if (this.$route.query.transportType) {
      this.$set(
        this.queryParams,
        "transportType",
        +this.$route.query.transportType
      );
lanbaoming's avatar
lanbaoming committed
1364 1365
    }
    // 指定产品获取产品信息
lanbaoming's avatar
lanbaoming committed
1366 1367 1368 1369 1370 1371 1372
    if (this.$route.query.product_id) {
      this.$set(this.queryParams, "productId", +this.$route.query.product_id);
      getProduct(this.$route.query.product_id).then((res) => {
        this.product = res.data;
      });
    } else {
      if (this.transportType) {
lanbaoming's avatar
lanbaoming committed
1373
        // 如果指定了单个的运输方式则赋值
lanbaoming's avatar
lanbaoming committed
1374 1375
        if (this.transportType.split("_").length == 1) {
          this.$set(this.queryParams, "transportType", +this.transportType);
lanbaoming's avatar
lanbaoming committed
1376 1377 1378 1379
        }
      }
      this.getAttrList();
    }
lanbaoming's avatar
lanbaoming committed
1380
    this.getData();
lanbaoming's avatar
lanbaoming committed
1381
    //获取城市列表
lanbaoming's avatar
lanbaoming committed
1382 1383 1384 1385
    this.getCountryList();
    this.getAllCityList();
    this.getChannelList();
    this.getTypeList();
lanbaoming's avatar
lanbaoming committed
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395

    this.getAttrList();

    //获取货币列表
    this.requestCurrencyList();
    //获取单位列表
    this.requestUnitList();

    this.$nextTick(() => {
      this.getList();
lanbaoming's avatar
lanbaoming committed
1396
    });
lanbaoming's avatar
lanbaoming committed
1397 1398
  },
  methods: {
lanbaoming's avatar
lanbaoming committed
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444
    findByprovinceCode() {
      //获取当前省份值id,获取该省份下城市 destCountryId provinceCode
      getRegionList(2, this.destCountryId)
        .then(({ data }) => {
          this.AddressCity = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },
    findBycityCode() {
      //获取当前城市值id,获取该城市下区域
      getRegionList(3, this.objectiveId)
        .then(({ data }) => {
          this.AddressTown = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },
    getData() {
      //加载时发起请求获取所有省份值
      getRegionList(1, 1)
        .then(({ data }) => {
          this.AddressProvince = data;
        })
        .catch((error) => {
          console.log(error);
        });
      //目的城市
      getRegionList(4, 4)
        .then(({ data }) => {
          this.AddressCity = data;
        })
        .catch((error) => {
          console.log(error);
        });
      //目的仓
      getRegionList(5, 5)
        .then(({ data }) => {
          this.AddressTown = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },
lanbaoming's avatar
lanbaoming committed
1445 1446 1447 1448 1449 1450 1451 1452 1453
    /* 国家 */
    getCountryList() {
      getListTree({ treeType: 1 }).then((response) => {
        this.countryList = response.data;
      });
    },
    //渠道
    getChannelList() {
      getAllChannelList().then((res) => (this.channelList = res.data));
lanbaoming's avatar
lanbaoming committed
1454 1455 1456
    },
    /** 获取产品属性列表 */
    getAttrList() {
lanbaoming's avatar
lanbaoming committed
1457 1458 1459
      getProductAttrList().then((response) => {
        this.attrList = response.data;
      });
lanbaoming's avatar
lanbaoming committed
1460 1461
    },

lanbaoming's avatar
lanbaoming committed
1462
    /** 获取产品类型列表 */
lanbaoming's avatar
lanbaoming committed
1463
    getTypeList() {
lanbaoming's avatar
lanbaoming committed
1464
      getProductTypeList().then((response) => {
lanbaoming's avatar
lanbaoming committed
1465
        this.typeList = response.data;
lanbaoming's avatar
lanbaoming committed
1466
      });
lanbaoming's avatar
lanbaoming committed
1467 1468 1469 1470
    },

    /**获取所有城市列表 */
    getAllCityList() {
lanbaoming's avatar
lanbaoming committed
1471 1472 1473
      getTradeCityList({}).then((response) => {
        this.cityList = response.data;
      });
lanbaoming's avatar
lanbaoming committed
1474 1475 1476 1477
    },

    /**获取已开通路线列表 */
    getOpenedRouterList() {
lanbaoming's avatar
lanbaoming committed
1478 1479 1480 1481
      openedRouterList(this.routeParams).then((response) => {
        this.routedList = response.data;
        this.setDefaultSelect();
      });
lanbaoming's avatar
lanbaoming committed
1482 1483 1484 1485
    },

    /**获取所有货币列表 */
    requestCurrencyList() {
lanbaoming's avatar
lanbaoming committed
1486
      getCurrencyList().then((response) => {
lanbaoming's avatar
lanbaoming committed
1487
        this.currencyList = response.data;
lanbaoming's avatar
lanbaoming committed
1488
      });
lanbaoming's avatar
lanbaoming committed
1489 1490 1491 1492
    },

    /**获取所有单位列表 */
    requestUnitList() {
lanbaoming's avatar
lanbaoming committed
1493
      getUnitList().then((response) => {
lanbaoming's avatar
lanbaoming committed
1494
        this.unitList = response.data;
lanbaoming's avatar
lanbaoming committed
1495
      });
lanbaoming's avatar
lanbaoming committed
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519
    },

    /*handleSelectionChange(val) {
        this.lineList = val;
    },*/

    /**运输线路改变 */
    transportTypeChange(newVal) {
      this.routeParams.transportType = this.form.transportType;
      this.getOpenedRouterList();
    },

    /**始发地改变 */
    startCityChange(newVal) {
      this.routeParams.startCityId = this.form.startCityId;
      this.getOpenedRouterList();
    },

    /**目的地改变 */
    destCityChange(newVal) {
      this.routeParams.destCityId = this.form.destCityId;
      this.getOpenedRouterList();
    },

lanbaoming's avatar
lanbaoming committed
1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530
    handleStatusChange(row) {
      updateProductPrice(row)
        .then(() => {
          this.$modal.msgSuccess(this.$t("修改成功"));
        })
        .catch(function () {
          row.auditStatus =
            row.auditStatus === AuditStatusEnum.PASS
              ? AuditStatusEnum.NOT_PASS
              : AuditStatusEnum.PASS;
        });
lanbaoming's avatar
lanbaoming committed
1531 1532 1533 1534 1535
    },

    /** 查询列表 */
    getList() {
      this.loading = true;
lanbaoming's avatar
lanbaoming committed
1536
      console.log(this.queryParams, "this.queryParams");
lanbaoming's avatar
lanbaoming committed
1537
      // 处理查询参数
lanbaoming's avatar
lanbaoming committed
1538 1539 1540
      let params = { ...this.queryParams };
      if (this.type == "sea") {
        params.transportType = 1;
lanbaoming's avatar
lanbaoming committed
1541
      }
lanbaoming's avatar
lanbaoming committed
1542 1543
      if (this.type == "air") {
        params.transportType = 3;
lanbaoming's avatar
lanbaoming committed
1544
      }
lanbaoming's avatar
lanbaoming committed
1545
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
lanbaoming's avatar
lanbaoming committed
1546
      // 执行查询
lanbaoming's avatar
lanbaoming committed
1547 1548
      console.log(params, "params");
      getProductPricePage(params).then((response) => {
lanbaoming's avatar
lanbaoming committed
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        productId: undefined,
        warehouseLineId: undefined,
        transportPrice: undefined,
        transportPriceUnit: undefined,
        transportVolumeUnit: undefined,
        clearancePrice: undefined,
        clearancePriceUnit: undefined,
        clearanceVolumeUnit: undefined,
        status: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
lanbaoming's avatar
lanbaoming committed
1578 1579
      this.queryParams.setPrice = undefined;
      this.queryParams.blacklist = undefined;
lanbaoming's avatar
lanbaoming committed
1580 1581 1582 1583 1584 1585
      //目的城市
      this.queryParams.destCityId = this.destCityId;
      //目的国
      this.queryParams.destCountryId = this.destCountryId;
      //目的仓
      this.queryParams.destWarehouseId = this.destWarehouseId;
lanbaoming's avatar
lanbaoming committed
1586 1587 1588
      if (this.queryParams.combStatus) {
        let tmp = this.queryParams.combStatus.split("_");
        this.queryParams[tmp[0]] = tmp[1];
lanbaoming's avatar
lanbaoming committed
1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599
      }
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd(type) {
lanbaoming's avatar
lanbaoming committed
1600 1601 1602 1603
      return this.$router.push(
        `../../lineProject/product-price/edit-${type}?` +
          new URLSearchParams(this.$route.query).toString()
      );
lanbaoming's avatar
lanbaoming committed
1604 1605
    },
    // 批量修改单个商品的价格(一条或者多条,后者全部路线)
lanbaoming's avatar
lanbaoming committed
1606 1607 1608 1609
    batchSetSingleProductPrice(type) {
      this.$router.push(
        `../../lineProject/product-price/edit-${type}?action=batchUpdate&type=${type}&product_id=${this.$route.query.product_id}&ids=${this.ids}`
      );
lanbaoming's avatar
lanbaoming committed
1610 1611 1612
    },
    // 批量设置路线
    handleBatchEdit(type) {
lanbaoming's avatar
lanbaoming committed
1613
      this.$router.push("../../lineProject/batch-edit-" + type);
lanbaoming's avatar
lanbaoming committed
1614 1615 1616
    },
    /** 修改按钮操作 */
    handleUpdate(row, readonly) {
lanbaoming's avatar
lanbaoming committed
1617 1618 1619 1620 1621
      let transportType = row.warehouseLineDO.transportType;
      let type = transportType == 3 || transportType == 4 ? "air" : "sea";
      let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`;
      if (readonly) url += "&readonly=1";
      return this.$router.push(url);
lanbaoming's avatar
lanbaoming committed
1622 1623 1624
    },

    updateStatus(row, type) {
lanbaoming's avatar
lanbaoming committed
1625 1626 1627 1628 1629 1630 1631
      if (type == "blacklist") {
        row.blacklist = row.blacklist == 0 ? 1 : 0;
      } else if (type == "auditStatus") {
        row.auditStatus =
          row.auditStatus === AuditStatusEnum.PASS
            ? AuditStatusEnum.NOT_PASS
            : AuditStatusEnum.PASS;
lanbaoming's avatar
lanbaoming committed
1632
      }
lanbaoming's avatar
lanbaoming committed
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646
      updateProductPrice(row)
        .then(() => {
          this.$modal.msgSuccess(this.$t("修改成功"));
        })
        .catch(function () {
          if (statusType == "blacklist") {
            row.blacklist = row.blacklist === 1 ? 0 : 1;
          } else {
            row.auditStatus =
              row.auditStatus === AuditStatusEnum.PASS
                ? AuditStatusEnum.NOT_PASS
                : AuditStatusEnum.PASS;
          }
        });
lanbaoming's avatar
lanbaoming committed
1647 1648 1649 1650 1651 1652 1653 1654 1655
    },

    checkSelectable() {
      return !this.isUpdate;
    },

    setDefaultSelect() {
      let vm = this;
      setTimeout(() => {
lanbaoming's avatar
lanbaoming committed
1656 1657 1658
        // 修改线路价格,选中已经选择的
        if (vm.isUpdate && vm.routedList && vm.routedList.length) {
          vm.$refs.routeTable.toggleRowSelection(vm.routedList[0]);
lanbaoming's avatar
lanbaoming committed
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702
        }
      }, 300);
    },

    /** 提交按钮 */
    /*submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }

        if(!this.lineList || !this.lineList.length) {
            this.$message.error(this.$t('请选择线路'));
            return;
        }
        let lineChannelList = [];
        //TODO  ,lineChannelList实体空运的时候需要传出货渠道ID--shippingChannelId
        this.lineList.map((item) => {
            lineChannelList.push({lineId: item.id});
            return item;
        });
        this.form.lineChannelList = lineChannelList;

        // 修改的提交
        if (this.form.id != null) {
          updateProductPrice(this.form).then(response => {
            this.$modal.msgSuccess(this.$t("修改成功"));
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        this.form.productId = this.product.id;
        createProductPrice(this.form).then(response => {
          this.$modal.msgSuccess(this.$t("请求成功"));
          this.open = false;
          this.getList();
        });
      });
    },*/
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
lanbaoming's avatar
lanbaoming committed
1703 1704 1705
      this.$modal
        .confirm(this.$t("是否确认删除产品价格编号为{id}的数据项?", { id }))
        .then(function () {
lanbaoming's avatar
lanbaoming committed
1706
          return deleteProductPrice(id);
lanbaoming's avatar
lanbaoming committed
1707 1708
        })
        .then(() => {
lanbaoming's avatar
lanbaoming committed
1709 1710
          this.getList();
          this.$modal.msgSuccess(this.$t("删除成功"));
lanbaoming's avatar
lanbaoming committed
1711 1712
        })
        .catch(() => {});
lanbaoming's avatar
lanbaoming committed
1713 1714 1715 1716
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
lanbaoming's avatar
lanbaoming committed
1717
      let params = { ...this.queryParams };
lanbaoming's avatar
lanbaoming committed
1718 1719
      params.pageNo = undefined;
      params.pageSize = undefined;
lanbaoming's avatar
lanbaoming committed
1720 1721
      if (this.type == "sea") {
        params.transportType = 1;
lanbaoming's avatar
lanbaoming committed
1722
      }
lanbaoming's avatar
lanbaoming committed
1723 1724
      if (this.type == "air") {
        params.transportType = 3;
lanbaoming's avatar
lanbaoming committed
1725 1726
      }

lanbaoming's avatar
lanbaoming committed
1727 1728 1729 1730
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
      this.$modal
        .confirm(this.$t("是否确认导出所有数据项?"))
        .then(() => {
lanbaoming's avatar
lanbaoming committed
1731 1732
          this.exportLoading = true;
          return exportProductPriceExcel(params);
lanbaoming's avatar
lanbaoming committed
1733 1734
        })
        .then((response) => {
lanbaoming's avatar
lanbaoming committed
1735 1736
          // this.$download.excel(response, '路线价格.xlsx');
          this.exportLoading = false;
lanbaoming's avatar
lanbaoming committed
1737 1738 1739 1740 1741
          this.$message.success(
            this.$t("已加入导出队列,请稍后在下载日志中下载")
          );
        })
        .catch(() => {
lanbaoming's avatar
lanbaoming committed
1742 1743 1744 1745 1746
          this.exportLoading = false;
        });
    },
    // 表格多选
    handleSelectionChange(selection) {
lanbaoming's avatar
lanbaoming committed
1747 1748 1749
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
lanbaoming's avatar
lanbaoming committed
1750
    },
lanbaoming's avatar
lanbaoming committed
1751 1752 1753 1754 1755
    batchBlock() {
      batchBlock({ ids: this.ids.join(",") }).then((res) => {
        this.$message.success(res.msg || this.$t("操作成功"));
        this.getList();
      });
lanbaoming's avatar
lanbaoming committed
1756
    },
lanbaoming's avatar
lanbaoming committed
1757 1758 1759 1760 1761
    batchOff() {
      batchOff({ ids: this.ids.join(",") }).then((res) => {
        this.$message.success(res.msg || this.$t("操作成功"));
        this.getList();
      });
lanbaoming's avatar
lanbaoming committed
1762 1763 1764
    },

    // 设置,取消単询
lanbaoming's avatar
lanbaoming committed
1765 1766 1767 1768 1769 1770
    setOrderInquiry(row, needOrderInquiry) {
      row.needOrderInquiry = needOrderInquiry;
      updateOrderInquiry(row).then((res) => {
        this.$message.success(res.msg || this.$t("操作成功"));
        this.getList();
      });
lanbaoming's avatar
lanbaoming committed
1771 1772
    },
    // 复制模板
lanbaoming's avatar
lanbaoming committed
1773
    copyTemplate(row) {
lanbaoming's avatar
lanbaoming committed
1774
      // 跳转到批量设置页面,并填充数据
lanbaoming's avatar
lanbaoming committed
1775 1776 1777 1778 1779 1780
      let transportType = row.warehouseLineDO.transportType;
      this.$router.push(
        `../../lineProject/batch-edit-${
          transportType == 3 || transportType == 4 ? "air" : "sea"
        }?templateId=${row.id}`
      );
lanbaoming's avatar
lanbaoming committed
1781 1782
    },
    // 关闭更多阶梯价格窗口
lanbaoming's avatar
lanbaoming committed
1783 1784 1785 1786
    closeMoreStepPrice() {
      this.showMoreStepPriceItem = null;
    },
  },
lanbaoming's avatar
lanbaoming committed
1787 1788 1789
};
</script>