index.vue 26.1 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
4
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
lanbaoming's avatar
lanbaoming committed
5
      <el-form-item :label="$t('编号')" prop="searchNumber">
332784038@qq.com's avatar
6  
332784038@qq.com committed
6
        <el-input v-model.trim="queryParams.searchNumber" :placeholder="$t('请输入报价单号、订单号')" clearable @keyup.enter.native="handleQuery" />
lanbaoming's avatar
lanbaoming committed
7 8 9
      </el-form-item>

      <el-form-item :label="$t('客户')" prop="searchCustomer">
332784038@qq.com's avatar
6  
332784038@qq.com committed
10
        <el-input v-model.trim="queryParams.searchCustomer" clearable @keyup.enter.native="handleQuery" />
lanbaoming's avatar
lanbaoming committed
11 12
      </el-form-item>

1483922988@qq.com's avatar
6  
1483922988@qq.com committed
13
      <el-form-item :label="$t('联系方式')" prop="relationPhone">
332784038@qq.com's avatar
6  
332784038@qq.com committed
14
        <el-input v-model.trim="queryParams.relationPhone" clearable @keyup.enter.native="handleQuery" @input="queryParams.relationPhone = queryParams.relationPhone.replace(/\s+/g, '')" />
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
15 16 17 18 19 20
      </el-form-item>

      <el-form-item :label="$t('区号')" prop="relationAreaCode">
        <el-input v-model.trim="queryParams.relationAreaCode" :placeholder="$t('请输入客户')" clearable @keyup.enter.native="handleQuery" @input="queryParams.relationAreaCode = queryParams.relationAreaCode.replace(/\s+/g, '')" />
      </el-form-item>

21 22 23
      <el-form-item :label="$t('始发仓')" prop="startWarehouseId">
        <el-select v-model="queryParams.startWarehouseId" multiple :placeholder="$t('请选择始发仓')" clearable @change="handleQuery">
          <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
lanbaoming's avatar
lanbaoming committed
24 25
        </el-select>
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
26

332784038@qq.com's avatar
6  
332784038@qq.com committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
      <el-form-item :label="$t('目的国')" prop="destCountryId">
        <el-select v-model="destCountryId" multiple :label="destCountryId" :placeholder="$t('请选择目的国')" clearable @change="handleQuery">
          <el-option v-for="item in AddressProvince" :key="item.guojia" :label="item.guojiaName" :value="item.guojia"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('目的城市')" prop="objectiveId">
        <el-select v-model="objectiveId" multiple :placeholder="$t('请选择目的城市')" style="width: 200px" clearable @change="handleQuery">
          <el-option v-for="item in AddressCity" :key="item.shi" :label="item.shiName" :value="item.shi"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
        <el-select v-model="destWarehouseId" multiple :placeholder="$t('请选择目的仓')" style="width: 200px" clearable @change="handleQuery">
          <el-option v-for="item in AddressTown" :key="item.id" :label="item.titleZh" :value="item.id"></el-option>
        </el-select>
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
42 43 44 45 46 47 48 49 50 51

      <el-form-item :label="$t('客户经理')" prop="salesmanIds">
        <user-selector v-model="queryParams.salesmanIds" multiple clearable @change="handleQuery" />
      </el-form-item>
      <el-form-item :label="$t('销售阶段')" prop="statusList">
        <dict-selector :type="DICT_TYPE.ECW_OFFER_STATUS" multiple v-model="queryParams.statusList" clearable @change="handleQuery" />
      </el-form-item>
      <el-form-item :label="$t('重要程度')" prop="importances">
        <el-select v-model="queryParams.importances" multiple :placeholder="$t('请选择')" clearable @change="handleQuery">
          <el-option v-for="item in [1, 2, 3, 4, 5]" :label="item" :value="item" :key="item"></el-option>
lanbaoming's avatar
lanbaoming committed
52 53 54
        </el-select>
      </el-form-item>

332784038@qq.com's avatar
6  
332784038@qq.com committed
55 56 57 58
      <el-form-item :label="$t('创建时间')">
        <el-date-picker v-model="queryTmp.createTime" type="datetimerange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd HH:mm:ss" @change="handleQuery"> </el-date-picker>
      </el-form-item>

1483922988@qq.com's avatar
6  
1483922988@qq.com committed
59 60 61
      <el-form-item :label="$t('运输方式')" prop="transportId" v-show="showSearch">
        <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportId" multiple formatter="number" clearable @change="handleQuery" />
      </el-form-item>
332784038@qq.com's avatar
6  
332784038@qq.com committed
62
      <el-form-item :label="$t('出货渠道')" prop="channelIds" v-show="showSearch">
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
63
        <selector :clearable="true" :options="channelList" :label-field="$l('name')" value-field="channelId" v-model="queryParams.channelIds" multiple @change="handleQuery"></selector>
lanbaoming's avatar
lanbaoming committed
64
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
65
      <el-form-item :label="$t('商品')" prop="prodTitle" v-show="showSearch">
332784038@qq.com's avatar
6  
332784038@qq.com committed
66
        <el-input v-model.trim="queryParams.prodTitle" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery" />
lanbaoming's avatar
lanbaoming committed
67
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
68 69
      <el-form-item :label="$t('控货')" prop="control" v-show="showSearch">
        <dict-selector :type="DICT_TYPE.INFRA_BOOLEAN_STRING" v-model="queryParams.control" clearable @change="handleQuery" />
lanbaoming's avatar
lanbaoming committed
70
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
71 72
      <el-form-item :label="$t('报关方式')" prop="customsType" v-show="showSearch">
        <dict-selector :type="DICT_TYPE.ECW_CUSTOMS_TYPE" v-model="queryParams.customsType" clearable @change="handleQuery" />
lanbaoming's avatar
lanbaoming committed
73
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
74 75 76 77 78 79 80

      <el-form-item :label="$t('增值服务')" prop="serviceType" v-show="showSearch">
        <el-select v-model="queryParams.serviceType" :placeholder="$t('请选择')" clearable @change="handleQuery">
          <el-option :label="$t('普通订单')" :value="0"></el-option>
          <el-option :label="$t('集运服务')" :value="1"></el-option>
          <el-option :label="$t('海外仓')" :value="2"></el-option>
        </el-select>
lanbaoming's avatar
lanbaoming committed
81
      </el-form-item>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
82 83
      <el-form-item :label="$t('客户来源')" prop="sourceIds" v-show="showSearch">
        <dict-selector :type="DICT_TYPE.CUSTOMER_SOURCE" multiple v-model="queryParams.sourceIds" clearable @change="handleQuery" />
lanbaoming's avatar
lanbaoming committed
84
      </el-form-item>
332784038@qq.com's avatar
6  
332784038@qq.com committed
85
      <el-form-item :label="$t('有效期开始')" v-show="showSearch">
332784038@qq.com's avatar
6  
332784038@qq.com committed
86
        <el-date-picker v-model="queryTmp.startTime" type="daterange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd" @change="handleQuery"> </el-date-picker>
332784038@qq.com's avatar
6  
332784038@qq.com committed
87 88
      </el-form-item>
      <el-form-item :label="$t('有效期结束')" v-show="showSearch">
332784038@qq.com's avatar
6  
332784038@qq.com committed
89
        <el-date-picker v-model="queryTmp.endTime" type="daterange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd" @change="handleQuery"> </el-date-picker>
332784038@qq.com's avatar
6  
332784038@qq.com committed
90 91 92
      </el-form-item>

      <el-form-item :label="$t('预计结束时间')" v-show="showSearch">
332784038@qq.com's avatar
6  
332784038@qq.com committed
93
        <el-date-picker v-model="queryTmp.stopTime" type="datetimerange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd HH:mm:ss" @change="handleQuery"> </el-date-picker>
332784038@qq.com's avatar
6  
332784038@qq.com committed
94 95 96 97 98
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{ $t("重置") }}</el-button>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
99 100 101 102 103
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
332784038@qq.com's avatar
6  
332784038@qq.com committed
104
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:offer:create']">{{ $t("新增") }}</el-button>
lanbaoming's avatar
lanbaoming committed
105 106
      </el-col>
      <el-col :span="1.5">
332784038@qq.com's avatar
6  
332784038@qq.com committed
107
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" v-hasPermi="['ecw:offer:export']">{{ $t("导出") }}</el-button>
lanbaoming's avatar
lanbaoming committed
108 109 110 111 112 113
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list" border>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
114
      <el-table-column :label="$t('报价单号')" align="left" prop="number" width="150">
332784038@qq.com's avatar
6  
332784038@qq.com committed
115 116
        <template slot-scope="{ row }">
          <el-link type="primary" @click.native="$router.push('detail?offerId=' + row.offerId)">{{ row.number }}</el-link>
lanbaoming's avatar
lanbaoming committed
117 118
        </template>
      </el-table-column>
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
119 120 121 122 123 124 125
      <el-table-column :label="$t('订单编号')" align="left" width="120">
        <template slot-scope="{ row }">
          <a class="el-link el-link--primary is-underline" href="javascript:;" @click="$router.push(`/order/detail?orderId=${row.orderId}`)">{{ row.orderNo }}</a>
        </template>
      </el-table-column>
      <el-table-column :label="$t('联系人')" align="left" prop="relationName" width="120" />
      <el-table-column :label="$t('联系电话')" align="left" prop="relationPhone" width="150" />
332784038@qq.com's avatar
6  
332784038@qq.com committed
126
      <el-table-column :label="$t('重要程序')" align="center" prop="importance" />
127 128
      <el-table-column :label="$t('始发仓')" align="left" prop="startWarehouseName" />
      <el-table-column :label="$t('运输方式-渠道/目的仓')">
332784038@qq.com's avatar
6  
332784038@qq.com committed
129
        <template slot-scope="{ row }">
130 131 132
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportId" />
          <template v-if="row.channelName"> - {{ row.channelName }} </template>
          / {{ row.destWarehouseName }}
332784038@qq.com's avatar
6  
332784038@qq.com committed
133 134
        </template>
      </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
135
      <el-table-column :label="$t('销售阶段')" align="left" width="100">
332784038@qq.com's avatar
6  
332784038@qq.com committed
136
        <template slot-scope="{ row }">
lanbaoming's avatar
lanbaoming committed
137 138 139
          <dict-tag :type="DICT_TYPE.ECW_OFFER_STATUS" :value="row.status" />
        </template>
      </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
140
      <el-table-column :label="$t('预计结束时间')" align="left" width="100">
lanbaoming's avatar
lanbaoming committed
141 142 143 144
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.stopTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
145
      <el-table-column :label="$t('预计销售额')" align="left" prop="estCost" width="160">
332784038@qq.com's avatar
6  
332784038@qq.com committed
146
        <template slot-scope="{ row }">
lanbaoming's avatar
lanbaoming committed
147 148
          <div class="" v-for="(item, feeIndex) in row.estCostVO.feeDtoList" :key="feeIndex">
            <dict-tag :type="DICT_TYPE.ECW_COST_FEE_TYPE" :value="item.feeType" />
332784038@qq.com's avatar
6  
332784038@qq.com committed
149
            {{ item.amount }} {{ currencyMap[item.currencyId] }}
lanbaoming's avatar
lanbaoming committed
150 151 152
          </div>
        </template>
      </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
153
      <el-table-column :label="$t('客户经理')" align="left" prop="creatorName"> </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
154
      <el-table-column :label="$t('创建时间')" align="left" width="120">
332784038@qq.com's avatar
6  
332784038@qq.com committed
155 156 157 158
        <template slot-scope="{ row }">
          <span>{{ parseTime(row.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
        </template>
      </el-table-column>
332784038@qq.com's avatar
6  
332784038@qq.com committed
159
      <el-table-column :label="$t('有效期')" align="left" width="120">
332784038@qq.com's avatar
6  
332784038@qq.com committed
160
        <template slot-scope="{ row }">
332784038@qq.com's avatar
6  
332784038@qq.com committed
161 162
          <div>{{ parseTime(row.startTime, "{y}-{m}-{d}") }}</div>
          {{ parseTime(row.endTime, "{y}-{m}-{d}") }}
332784038@qq.com's avatar
6  
332784038@qq.com committed
163
        </template>
lanbaoming's avatar
lanbaoming committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
      </el-table-column>
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <!--
          0 取消                                        恢复
          1 特价审批    编辑、跟进、          取消    删除
          2 草稿        编辑、                       删除
          3 需求确认    编辑、跟进、结果、特价、取消   删除
          4 赢单                                    删除
          5 输单                                    删除
          6 完成                                    删除
          7 跟进中      编辑、跟进、结果、特价、取消、 删除
          -->
          <el-dropdown>
            <el-button icon="el-icon-plus" circle type="primary"></el-button>
            <el-dropdown-menu slot="dropdown">
332784038@qq.com's avatar
6  
332784038@qq.com committed
180 181
              <el-dropdown-item @click.native="$router.push('detail?offerId=' + scope.row.offerId)" v-hasPermi="['ecw:offer:show']">{{ $t("详情") }}</el-dropdown-item>
              <el-dropdown-item @click.native="$router.push('edit?id=' + scope.row.offerId)" v-if="[1, 2, 3, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:update']">{{ $t("编辑") }}</el-dropdown-item>
332784038@qq.com's avatar
6  
332784038@qq.com committed
182
              <el-dropdown-item @click.native="$router.push('create?copyId=' + scope.row.offerId)" v-if="[1, 2, 3, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:update']">{{ $t("复制") }}</el-dropdown-item>
183
              <el-dropdown-item @click.native="handleAddOffer(scope.row)" v-if="[1, 3, 7].indexOf(scope.row.status) > -1">{{ $t("跟进") }}</el-dropdown-item>
332784038@qq.com's avatar
6  
332784038@qq.com committed
184 185 186 187 188
              <el-dropdown-item @click.native="$router.push(`result?offerId=${scope.row.offerId}&number=${scope.row.number}`)" v-if="[3, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:result']">{{ $t("结果") }}</el-dropdown-item>
              <el-dropdown-item @click.native="$router.push('/offer/special?offerId=' + scope.row.offerId)" v-if="[1, 3, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:discount', 'ecw:offer:commission']">{{ $t("特价") }}</el-dropdown-item>
              <el-dropdown-item @click.native="cancel(scope.row.offerId)" v-if="[1, 3, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:cancel']">{{ $t("取消") }}</el-dropdown-item>
              <el-dropdown-item @click.native="recovery(scope.row.offerId)" v-if="[0].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:recovery']">{{ $t("恢复") }}</el-dropdown-item>
              <el-dropdown-item @click.native="deleteOffer(scope.row.offerId)" v-if="[0, 1, 2, 3, 4, 5, 6, 7].indexOf(scope.row.status) > -1" v-hasPermi="['ecw:offer:delete']">{{ $t("删除") }}</el-dropdown-item>
lanbaoming's avatar
lanbaoming committed
189 190 191 192 193 194
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
332784038@qq.com's avatar
6  
332784038@qq.com committed
195
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" />
196
    <CustomerFollow ref="customerFollow" @refresh="handleQuery" v-if="customerFollowVisible" :customer-id="curData.relationId" :customerService="curData.salesmanId" :customerNumber="curData.customerNumber" :offerId="curData.offerId" />
lanbaoming's avatar
lanbaoming committed
197 198 199 200
  </div>
</template>

<script>
332784038@qq.com's avatar
6  
332784038@qq.com committed
201
import { deleteOffer, getOfferPage, exportOfferExcel, cancel, recovery, offerDeptPage, exportDeptOfferExcel } from "@/api/ecw/offer"
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
202 203
import { getChannelList } from "@/api/ecw/channel"
import { getRegionList } from "@/api/ecw/order"
332784038@qq.com's avatar
6  
332784038@qq.com committed
204 205
import { getCurrencyList } from "@/api/ecw/currency"
import { getTradeCityList } from "@/api/ecw/region"
206
import { getWarehouseList } from "@/api/ecw/warehouse"
332784038@qq.com's avatar
6  
332784038@qq.com committed
207
import UserSelector from "@/components/UserSelector"
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
208
import Selector from "@/components/Selector"
209 210
import Template from "@/views/cms/template/index.vue"
import CustomerFollow from "@/views/ecw/customer/components/customerFollow"
lanbaoming's avatar
lanbaoming committed
211 212 213
export default {
  name: "EcwOfferIndex",
  components: {
214
    Template,
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
215
    Selector,
216 217
    UserSelector,
    CustomerFollow
lanbaoming's avatar
lanbaoming committed
218 219 220
  },
  data() {
    return {
221
      customerFollowVisible: false,
lanbaoming's avatar
lanbaoming committed
222 223 224 225 226
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
332784038@qq.com's avatar
6  
332784038@qq.com committed
227
      showSearch: false,
lanbaoming's avatar
lanbaoming committed
228 229 230 231 232 233
      // 总条数
      total: 0,
      // 报价单管理列表
      list: [],
      // 查询参数
      queryParams: {
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
234 235 236 237 238
        salesmanIds: [],
        statusList: [],
        importances: [],
        channelIds: [],
        sourceIds: [],
lanbaoming's avatar
lanbaoming committed
239 240 241
        pageNo: 1,
        pageSize: 10
      },
332784038@qq.com's avatar
6  
332784038@qq.com committed
242 243 244 245 246 247
      queryTmp: {
        createTime: ["", ""],
        stopTime: ["", ""],
        startTime: ["", ""],
        endTime: ["", ""]
      },
248
      warehouseList: [],
lanbaoming's avatar
lanbaoming committed
249
      currencyList: [],
332784038@qq.com's avatar
6  
332784038@qq.com committed
250
      tradeCityList: [],
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
      channelList: [],
      AddressCity: [],
      AddressProvince: [],
      AddressTown: [],
      destCountryId: null,
      objectiveId: null,
      destWarehouseId: null,
      // 选中数组
      ids: [],
      //目的国
      countryList: [],
      //目的城市
      cityList: [],
      //目的仓
      destWarehouseList: [],
266
      curData: {},
332784038@qq.com's avatar
6  
332784038@qq.com committed
267 268
      dept: false // 是否部门订单
    }
lanbaoming's avatar
lanbaoming committed
269
  },
332784038@qq.com's avatar
6  
332784038@qq.com committed
270 271 272 273 274 275 276
  computed: {
    currencyMap() {
      let map = {}
      this.currencyList.forEach((item) => {
        map[item.id] = this.$l(item, "title")
      })
      return map
lanbaoming's avatar
lanbaoming committed
277
    },
278 279 280 281
    exportWarehouseList() {
      /* tradeType 1 进口,2出口,3进出口 */
      return this.warehouseList.filter((item) => item.tradeType == 2 || item.tradeType == 3)
    },
lanbaoming's avatar
lanbaoming committed
282
    exportCityList() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
283
      return this.tradeCityList.filter((item) => item.type == 2)
lanbaoming's avatar
lanbaoming committed
284 285
    },
    importCityList() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
286
      return this.tradeCityList.filter((item) => item.type == 1)
lanbaoming's avatar
lanbaoming committed
287
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
288 289 290 291 292 293 294
    transportTypes() {
      let obj = {}
      this.getDictDatas(this.DICT_TYPE.ECW_TRANSPORT_TYPE).forEach((item) => {
        obj[item.value] = item
      })
      return obj
    }
lanbaoming's avatar
lanbaoming committed
295
  },
332784038@qq.com's avatar
6  
332784038@qq.com committed
296
  activated() {
lanbaoming's avatar
lanbaoming committed
297 298 299
    this.getList()
  },
  created() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
300 301
    console.log(this.getDictDatas(this.DICT_TYPE.ECW_OFFER_STATUS))

lanbaoming's avatar
lanbaoming committed
302 303
    console.log("offer index", this.$route)
    // 部门订单
332784038@qq.com's avatar
6  
332784038@qq.com committed
304
    if (this.$route.fullPath.indexOf("dept") > -1) {
lanbaoming's avatar
lanbaoming committed
305 306
      this.dept = true
    }
307 308 309 310 311
    // getTradeCityList().then((res) => (this.tradeCityList = res.data))
    getWarehouseList().then((res) => {
      this.tradeCityList = res.data
      this.warehouseList = res.data
    })
332784038@qq.com's avatar
6  
332784038@qq.com committed
312
    getCurrencyList().then((res) => {
lanbaoming's avatar
lanbaoming committed
313 314 315
      this.currencyList = res.data
    })

332784038@qq.com's avatar
6  
332784038@qq.com committed
316
    this.getList()
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
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 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
    getChannelList().then((res) => (this.channelList = res.data))
    this.init()
  },
  watch: {
    destCountryId: {
      //监听当前地区值的变化,于与上方地区值进行了双向绑定
      deep: true, //深度监听
      handler() {
        //每当值省份值改变时其下地区值进行清空
        this.AddressCity = []
        this.AddressTown = []
        this.objectiveId = ""
        this.destWarehouseId = ""
        this.findByprovinceCode()
        if (this.destCountryId == "") {
          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)
            })
        }
        //重新加载目的城市
        //目的城市

        //  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);
        //   });
      }
    },
    objectiveId: {
      deep: true, //深度监听
      handler() {
        this.AddressTown = []
        this.destWarehouseId = ""
        this.findBycityCode()

        if (this.objectiveId != "" && this.destCountryId != "" && this.destWarehouseId == "") {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.objectiveId)
            .then(({ data }) => {
              this.AddressTown = data
            })
            .catch((error) => {
              console.log(error)
            })
        } else if (this.destCountryId == "" && this.objectiveId == "" && this.destWarehouseId == "") {
          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)
            })
        }
      }
    },
    destWarehouseId: {
      deep: true, //深度监听
      handler() {
        if (this.objectiveId != "" && this.destCountryId != "" && this.destWarehouseId == "") {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.objectiveId)
            .then(({ data }) => {
              this.AddressTown = data
            })
            .catch((error) => {
              console.log(error)
            })
        } else if (this.destCountryId != "" && this.objectiveId == "" && this.destWarehouseId == "") {
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data
            })
            .catch((error) => {
              console.log(error)
            })
        }
      }
    }
lanbaoming's avatar
lanbaoming committed
446 447
  },
  methods: {
448 449 450 451 452 453 454 455
    handleAddOffer(row) {
      console.log(row)
      this.curData = row
      this.customerFollowVisible = true
      this.$nextTick(() => {
        this.$refs["customerFollow"].handleAdd()
      })
    },
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
    init() {
      //加载时发起请求获取所有省份值
      getRegionList(1, 1)
        .then(({ data }) => {
          this.AddressProvince = data
          console.log(this.AddressProvince)
        })
        .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)
        })
    },
    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

          // 去重
          // let uniqueDataList = data.filter((item, index, self) => {
          // // 返回第一个匹配项的索引,用于判断当前项是否为第一个匹配项
          // const firstIndex = self.findIndex((obj) => obj.guojia === item.guojia);

          // // 如果当前项是第一个匹配项,则保留,否则过滤掉
          // return index === firstIndex;
          // });

          // this.AddressProvince = uniqueDataList
        })
        .catch((error) => {
          console.log(error)
        })
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
515
    formatQuery() {
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
516 517
      let obj = {}
      //目的国
518 519 520 521
      if (this.startWarehouseId != null && this.startWarehouseId != "") {
        obj.startWarehouseIds = this.startWarehouseId
      }
      //目的国
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
522 523 524 525 526 527 528 529 530 531 532
      if (this.destCountryId != null && this.destCountryId != "") {
        obj.destCountryIds = this.destCountryId
      }
      //目的城市
      if (this.objectiveId != null && this.objectiveId != "") {
        obj.objectiveIds = this.objectiveId
      }
      //目的仓
      if (this.destWarehouseId != null && this.destWarehouseId != "") {
        obj.destWarehouseIds = this.destWarehouseId
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
533 534 535 536 537 538 539 540 541 542 543 544 545 546
      obj.beginCreateTime = this.queryTmp.createTime[0]
      obj.endCreateTime = this.queryTmp.createTime[1]
      obj.beginStopTime = this.queryTmp.stopTime[0]
      obj.endStopTime = this.queryTmp.stopTime[1]
      obj.beginStartTime = this.queryTmp.startTime[0]
      obj.endStartTime = this.queryTmp.startTime[1]
      obj.beginEndTime = this.queryTmp.endTime[0]
      obj.endEndTime = this.queryTmp.endTime[1]
      return obj
    },
    /** 查询列表 */
    getList() {
      this.loading = true
      let func = this.dept ? offerDeptPage : getOfferPage
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
547

lanbaoming's avatar
lanbaoming committed
548
      // 执行查询
332784038@qq.com's avatar
6  
332784038@qq.com committed
549 550
      func({
        ...this.queryParams,
332784038@qq.com's avatar
6  
332784038@qq.com committed
551
        ...this.formatQuery()
332784038@qq.com's avatar
6  
332784038@qq.com committed
552 553 554 555 556
      }).then((response) => {
        this.list = response.data.list
        this.total = response.data.total
        this.loading = false
      })
lanbaoming's avatar
lanbaoming committed
557 558 559 560
    },

    /** 搜索按钮操作 */
    handleQuery() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
561 562
      this.queryParams.pageNo = 1
      this.getList()
lanbaoming's avatar
lanbaoming committed
563 564 565 566 567 568 569
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageNo: 1,
        pageSize: 10
      }
332784038@qq.com's avatar
6  
332784038@qq.com committed
570
      this.handleQuery()
lanbaoming's avatar
lanbaoming committed
571 572 573
    },
    /** 新增按钮操作 */
    handleAdd() {
332784038@qq.com's avatar
6  
332784038@qq.com committed
574
      return this.$router.push("create")
lanbaoming's avatar
lanbaoming committed
575 576 577
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
332784038@qq.com's avatar
6  
332784038@qq.com committed
578
      return this.$router.push("edit?id=" + row.offerId)
lanbaoming's avatar
lanbaoming committed
579 580 581 582
    },

    /** 删除按钮操作 */
    handleDelete(row) {
332784038@qq.com's avatar
6  
332784038@qq.com committed
583 584 585 586 587 588 589 590 591 592 593
      const offerId = row.offerId
      this.$modal
        .confirm(this.$t("是否确认删除报价单管理编号为{offerId}的数据项?", { offerId }))
        .then(function () {
          return deleteOffer(offerId)
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess(this.$t("删除成功"))
        })
        .catch(() => {})
lanbaoming's avatar
lanbaoming committed
594 595 596 597
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
1483922988@qq.com's avatar
6  
1483922988@qq.com committed
598
      let params = { ...this.queryParams, ...this.formatQuery() }
332784038@qq.com's avatar
6  
332784038@qq.com committed
599 600
      params.pageNo = undefined
      params.pageSize = undefined
lanbaoming's avatar
lanbaoming committed
601
      // 执行导出
332784038@qq.com's avatar
6  
332784038@qq.com committed
602 603 604 605
      this.$confirm(this.$t("是否确认导出所有报价单管理数据项?"))
        .then(() => {
          this.exportLoading = true
          if (this.dept) {
lanbaoming's avatar
lanbaoming committed
606
            return exportDeptOfferExcel(params)
332784038@qq.com's avatar
6  
332784038@qq.com committed
607 608 609 610 611 612 613
          } else return exportOfferExcel(params)
        })
        .then((response) => {
          this.$download.excel(response, "报价列表.xls")
          this.exportLoading = false
        })
        .catch(() => {})
lanbaoming's avatar
lanbaoming committed
614
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
615 616
    cancel(id) {
      this.doAction(this.$t("确定要取消此报价单么?"), cancel, id)
lanbaoming's avatar
lanbaoming committed
617
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
618 619
    recovery(id) {
      this.doAction(this.$t("确定要恢复此报价单么?"), recovery, id)
lanbaoming's avatar
lanbaoming committed
620
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
621 622
    deleteOffer(id) {
      this.doAction(this.$t("确定要删除此报价单么?"), deleteOffer, id)
lanbaoming's avatar
lanbaoming committed
623
    },
332784038@qq.com's avatar
6  
332784038@qq.com committed
624 625 626 627 628 629 630 631 632
    doAction(tips, action, id) {
      this.$confirm(tips)
        .then((res) => {
          return action(id)
        })
        .then(() => {
          this.$message.success("操作成功")
          this.handleQuery()
        })
lanbaoming's avatar
lanbaoming committed
633 634
    }
  }
332784038@qq.com's avatar
6  
332784038@qq.com committed
635
}
lanbaoming's avatar
lanbaoming committed
636
</script>