index.vue 12.9 KB
Newer Older
1 2 3 4
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
dragondean@qq.com's avatar
dragondean@qq.com committed
5
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
6 7
      <el-form-item :label="$t('编号')" prop="searchNumber">
        <el-input v-model="queryParams.searchNumber" :placeholder="$t('请输入报价单号、订单号')" clearable @keyup.enter.native="handleQuery"/>
8
      </el-form-item>
9

10 11
      <el-form-item :label="$t('客户')" prop="searchCustomer">
        <el-input v-model="queryParams.searchCustomer" :placeholder="$t('请输入客户')" clearable @keyup.enter.native="handleQuery"/>
dragondean@qq.com's avatar
dragondean@qq.com committed
12
      </el-form-item>
13

dragondean@qq.com's avatar
dragondean@qq.com committed
14
      <el-form-item :label="$t('创建时间')" prop="orderNo">
15
        <el-date-picker    type="datetime" v-model="queryParams.beginCreateTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>{{ $t('') }}<el-date-picker v-model="queryParams.endCreateTime"    type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
dragondean@qq.com's avatar
dragondean@qq.com committed
16
      </el-form-item>
17

dragondean@qq.com's avatar
dragondean@qq.com committed
18
      <el-form-item :label="$t('始发地')" prop="departureId">
dragondean@qq.com's avatar
dragondean@qq.com committed
19
        <el-select v-model="queryParams.departureId" :placeholder="$t('请选择始发地')" clearable>
dragondean@qq.com's avatar
dragondean@qq.com committed
20 21 22 23
          <el-option v-for="item in exportCityList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('目的地')" prop="objectiveId">
dragondean@qq.com's avatar
dragondean@qq.com committed
24
        <el-select v-model="queryParams.objectiveId" :placeholder="$t('请选择目的地')" clearable>
dragondean@qq.com's avatar
dragondean@qq.com committed
25 26
          <el-option v-for="item in importCityList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
        </el-select>
27
      </el-form-item>
28

29
      <el-form-item :label="$t('运输方式')" prop="transportId">
dragondean@qq.com's avatar
dragondean@qq.com committed
30
        <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportId" formatter="number" clearable />
dragondean@qq.com's avatar
dragondean@qq.com committed
31
      </el-form-item>
32 33
      <el-form-item :label="$t('商品')" prop="prodTitle">
        <el-input v-model="queryParams.prodTitle" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery"/>
34
      </el-form-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
35
      <el-form-item :label="$t('控货')" prop="control">
dragondean@qq.com's avatar
dragondean@qq.com committed
36
        <dict-selector :type="DICT_TYPE.INFRA_BOOLEAN_STRING" v-model="queryParams.control" clearable />
dragondean@qq.com's avatar
dragondean@qq.com committed
37
      </el-form-item>
38
      <el-form-item :label="$t('客户经理')" prop="followUpSalesmanId">
dragondean@qq.com's avatar
dragondean@qq.com committed
39
        <user-selector v-model="queryParams.followUpSalesmanId" clearable />
dragondean@qq.com's avatar
dragondean@qq.com committed
40 41
      </el-form-item>
      <el-form-item :label="$t('销售阶段')" prop="status">
dragondean@qq.com's avatar
dragondean@qq.com committed
42
        <dict-selector :type="DICT_TYPE.ECW_OFFER_STATUS" v-model="queryParams.status" clearable />
dragondean@qq.com's avatar
dragondean@qq.com committed
43 44
      </el-form-item>
      <el-form-item :label="$t('报关方式')" prop="customsType">
dragondean@qq.com's avatar
dragondean@qq.com committed
45
        <dict-selector :type="DICT_TYPE.ECW_CUSTOMS_TYPE" v-model="queryParams.customsType" clearable />
dragondean@qq.com's avatar
dragondean@qq.com committed
46 47 48 49
      </el-form-item>

      <div>
        <el-form-item :label="$t('预计结束时间')" prop="orderNo">
50
            <el-date-picker  type="datetime" v-model="queryParams.beginStopTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>{{ $t('') }}<el-date-picker  type="datetime" v-model="queryParams.endStopTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
dragondean@qq.com's avatar
dragondean@qq.com committed
51 52 53 54 55 56
        </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>
      </div>
57

58 59 60 61 62 63
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
dragondean@qq.com's avatar
dragondean@qq.com committed
64
                   v-hasPermi="['ecw:offer:create']">{{$t('新增')}}</el-button>
65 66 67
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
dragondean@qq.com's avatar
dragondean@qq.com committed
68
                   v-hasPermi="['ecw:offer:export']">{{$t('导出')}}</el-button>
69 70 71 72 73
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
74
    <el-table v-loading="loading" :data="list" border>
dragondean@qq.com's avatar
dragondean@qq.com committed
75 76 77 78 79
      <el-table-column :label="$t('报价单号')" align="left" prop="number" width="200px">
        <template slot-scope="{row}">
          <el-link type="primary" @click.native="$router.push('detail?offerId=' + row.offerId)">{{row.number}}</el-link>
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
80 81 82 83
      <el-table-column :label="$t('订单编号')" align="left" prop="orderNo" />
      <el-table-column :label="$t('客户名称')" align="left" prop="relationName" />
      <el-table-column :label="$t('目的地')" align="center" prop="objectiveName" />
      <el-table-column :label="$t('销售阶段')" align="left" width="180">
84 85
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.ECW_OFFER_STATUS" :value="row.status" />
86 87
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
88
      <el-table-column :label="$t('预计结束时间')" align="left">
89
        <template slot-scope="scope">
90
          <span>{{ parseTime(scope.row.stopTime, "{y}-{m}-{d}") }}</span>
91 92
        </template>
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
93
      <el-table-column :label="$t('运输方式')" align="left">
94 95
        <template slot-scope="scope" >
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="scope.row.transportId" />
96 97
        </template>
      </el-table-column>
98

99

100
      <el-table-column :label="$t('预计销售额')" align="left" prop="estCost">
101
        <template slot-scope="{row}">
dragondean@qq.com's avatar
dragondean@qq.com committed
102
          <div class="" v-for="(item, feeIndex) in row.estCostVO.feeDtoList" :key="feeIndex">
103 104
            <dict-tag :type="DICT_TYPE.ECW_COST_FEE_TYPE" :value="item.feeType" />
            {{item.amount}} {{currencyMap[item.currencyId]}}
105
          </div>
106 107
        </template>
      </el-table-column>
108 109
      <el-table-column :label="$t('客户经理')" align="left" prop="creatorName">
      </el-table-column>
dragondean@qq.com's avatar
dragondean@qq.com committed
110
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
111
        <template slot-scope="scope">
112
          <!--
dragondean@qq.com's avatar
dragondean@qq.com committed
113 114 115 116 117 118 119
          0 取消                                        恢复
          1 特价审批    编辑、跟进、          取消    删除
          2 草稿        编辑、                       删除
          3 需求确认    编辑、跟进、结果、特价、取消   删除
          4 赢单                                    删除
          5 输单                                    删除
          6 完成                                    删除
dragondean@qq.com's avatar
dragondean@qq.com committed
120
          7 跟进中      编辑、跟进、结果、特价、取消、 删除
dragondean@qq.com's avatar
dragondean@qq.com committed
121
          -->
dragondean@qq.com's avatar
dragondean@qq.com committed
122 123 124
          <el-dropdown>
            <el-button icon="el-icon-plus" circle type="primary"></el-button>
            <el-dropdown-menu slot="dropdown">
125
              <el-dropdown-item @click.native="$router.push('detail?offerId=' + scope.row.offerId)"                                                                                   v-hasPermi="['ecw:offer:show']">{{$t('详情')}}</el-dropdown-item>
dragondean@qq.com's avatar
dragondean@qq.com committed
126
              <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>
127 128
              <el-dropdown-item @click.native="$router.push('logList?offerId=' + scope.row.offerId)"                           v-if="[1,3,7].indexOf(scope.row.status) > -1"          v-hasPermi="['ecw:offer:loglist']">{{$t('跟进')}}</el-dropdown-item>
              <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>
129
              <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>
130 131
              <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>
dragondean@qq.com's avatar
dragondean@qq.com committed
132
              <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>
dragondean@qq.com's avatar
dragondean@qq.com committed
133
            </el-dropdown-menu>
134
          </el-dropdown>
135 136 137 138 139 140 141 142 143 144 145
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

  </div>
</template>

<script>
146
import { deleteOffer, getOfferPage, exportOfferExcel,cancel, recovery, offerDeptPage, exportDeptOfferExcel } from "@/api/ecw/offer";
147
import { getCurrencyList } from '@/api/ecw/currency';
dragondean@qq.com's avatar
dragondean@qq.com committed
148 149
import {getTradeCityList} from '@/api/ecw/region'
import UserSelector from '@/components/UserSelector'
150
export default {
151
  name: "EcwOfferIndex",
152
  components: {
dragondean@qq.com's avatar
dragondean@qq.com committed
153
    UserSelector
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报价单管理列表
      list: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
dragondean@qq.com's avatar
dragondean@qq.com committed
170
        pageSize: 10
171
      },
dragondean@qq.com's avatar
dragondean@qq.com committed
172
      currencyList: [],
173 174
      tradeCityList:[],
      dept: false, // 是否部门订单
175 176
    };
  },
177 178 179 180 181 182 183 184
  computed:{
    currencyMap(){
        let map = {}
        this.currencyList.forEach(item => {
            map[item.id] = this.$l(item, 'title')
        })
        return map
    },
dragondean@qq.com's avatar
dragondean@qq.com committed
185 186 187 188 189 190
    exportCityList() {
      return this.tradeCityList.filter(item => item.type == 2)
    },
    importCityList() {
      return this.tradeCityList.filter(item => item.type == 1)
    },
191
  },
192 193 194
  activated(){
    this.getList()
  },
195
  created() {
196 197 198 199 200
    console.log("offer index", this.$route)
    // 部门订单
    if(this.$route.fullPath.indexOf('dept') > -1){
      this.dept = true
    }
dragondean@qq.com's avatar
dragondean@qq.com committed
201 202
    getTradeCityList().then(res => this.tradeCityList = res.data)

203 204 205
    getCurrencyList().then(res => {
      this.currencyList = res.data
    })
dragondean@qq.com's avatar
dragondean@qq.com committed
206 207

    this.getList();
208 209 210 211 212
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
213
      let func = this.dept ? offerDeptPage : getOfferPage
214
      // 执行查询
215
      func(this.queryParams).then(response => {
216 217 218 219 220
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
221

222 223 224 225 226 227 228
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
dragondean@qq.com's avatar
dragondean@qq.com committed
229 230 231 232
      this.queryParams = {
        pageNo: 1,
        pageSize: 10
      }
233 234 235 236
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
dragondean@qq.com's avatar
dragondean@qq.com committed
237
      return this.$router.push('create')
238 239 240
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
241
      return this.$router.push('edit?id=' + row.offerId)
242
    },
243

244 245 246
    /** 删除按钮操作 */
    handleDelete(row) {
      const offerId = row.offerId;
dragondean@qq.com's avatar
dragondean@qq.com committed
247
      this.$modal.confirm(this.$t('是否确认删除报价单管理编号为{offerId}的数据项?', {offerId})).then(function() {
248 249 250
          return deleteOffer(offerId);
        }).then(() => {
          this.getList();
dragondean@qq.com's avatar
dragondean@qq.com committed
251
          this.$modal.msgSuccess(this.$t("删除成功"));
252 253 254 255 256 257 258 259 260
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      // 执行导出
dragondean@qq.com's avatar
dragondean@qq.com committed
261
      this.$confirm(this.$t('是否确认导出所有报价单管理数据项?')).then(() => {
262
          this.exportLoading = true;
263 264 265
          if(this.dept){
            return exportDeptOfferExcel(params)
          }else return exportOfferExcel(params);
266
        }).then(response => {
dragondean@qq.com's avatar
dragondean@qq.com committed
267
          this.$download.excel(response, '报价列表.xls');
268 269
          this.exportLoading = false;
        }).catch(() => {});
270 271
    },
    cancel(id){
dragondean@qq.com's avatar
dragondean@qq.com committed
272
      this.doAction(this.$t('确定要取消此报价单么?'), cancel, id);
273 274
    },
    recovery(id){
dragondean@qq.com's avatar
dragondean@qq.com committed
275
      this.doAction(this.$t('确定要恢复此报价单么?'), recovery, id);
276 277
    },
    deleteOffer(id){
dragondean@qq.com's avatar
dragondean@qq.com committed
278
      this.doAction(this.$t('确定要删除此报价单么?'), deleteOffer, id);
279 280 281 282 283 284 285 286 287
    },
    doAction(tips, action, id){
      this.$confirm(tips).then(res => {
        return action(id)
      })
      .then(() => {
        this.$message.success('操作成功')
        this.handleQuery()
      })
288 289 290
    }
  }
};
291
</script>