receivable.vue 12.3 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 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 38 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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 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 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 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
<template>
  <div class="app-container">

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8" style="margin-right: 60px">
      <div class="card-title">{{ $t('待收款') }}</div>
      <el-button
        style="float: right; margin-left: 10px"
        type="primary"
        size="mini"
        v-hasPermi="['ecw:receivable:add']"
        @click="handleAdd(0)"
        >{{ $t('新增收款单') }}</el-button
      >
      <el-button
        v-if="showSearch"
        style="float: right"
        type="primary"
        size="mini"
        icon="el-icon-s-unfold"
        @click="showSearch = !showSearch"
      ></el-button>
      <el-button
        v-else
        style="float: right"
        type="primary"
        size="mini"
        icon="el-icon-s-fold"
        @click="showSearch = !showSearch"
      ></el-button>
    </el-row>
    <!-- 搜索工作栏 -->
    <el-card v-show="showSearch">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        label-width="80px"
        class="card"
      >
        <el-row>
          <el-form-item :label="$t('始发地')">
            <el-select
              v-model="queryParams.departureId"
              :placeholder="$t('请选择始发地')"
              clearable
            >
              <el-option
                v-for="item in exportWarehouseList"
                :label="$l(item, 'title')"
                :value="item.id"
                :key="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('目的地')">
            <el-select
              v-model="queryParams.objectiveId"
              :placeholder="$t('请选择目的地')"
              clearable
            >
              <el-option
                v-for="item in importWarehouseList"
                :label="$l(item, 'title')"
                :value="item.id"
                :key="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('运输方式')">
            <dict-selector
              :type="DICT_TYPE.ECW_TRANSPORT_TYPE"
              v-model="queryParams.transportId"
              formatter="number"
              clearable
            />
          </el-form-item>
          <el-form-item :label="$t('控货')">
            <dict-selector
              :type="DICT_TYPE.INFRA_BOOLEAN_STRING"
              v-model="queryParams.isCargoControl"
              clearable
            />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item :label="$t('订单状态')">
            <dict-selector
              :type="DICT_TYPE.ORDER_STATUS"
              v-model="queryParams.status"
              clearable
            />
          </el-form-item>
          <el-form-item :label="$t('报关方式')">
            <dict-selector
              :type="DICT_TYPE.ECW_CUSTOMS_TYPE"
              v-model="queryParams.customsType"
              clearable
            />
          </el-form-item>
          <el-form-item :label="$t('订单号')">
            <el-input
              style="max-width: 188px"
              v-model="queryParams.orderNo"
              :placeholder="$t('请输入订单编号')"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item :label="$t('品名')">
            <el-input
              style="max-width: 188px"
              v-model="queryParams.title"
              :placeholder="$t('请输入品名')"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item :label="$t('提单号')">
            <el-input
              style="max-width: 188px"
              v-model="queryParams.tidanNo"
              :placeholder="$t('请输入提单号')"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item :label="$t('唛头')">
            <el-input
              style="max-width: 188px"
              v-model="queryParams.marks"
              :placeholder="$t('请输入唛头')"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item :label="$t('费用类型')">
            <dict-selector
              :type="DICT_TYPE.FEE_TYPE"
              v-model="queryParams.feeType"
              clearable
            ></dict-selector>
          </el-form-item>
<!--          <el-form-item :label="$t('发货人')">
            <customer-selector
              v-model="queryParams.consignorNameOrPhone"
              @change="consignor = $event"
              clearable
            />
          </el-form-item> -->
            <el-form-item label="发货人:" >
              <el-input style="max-width: 188px;" v-model="queryParams.consignorNameOrPhone" :placeholder="$t('请输入发货人')" clearable @keyup.enter.native="handleQuery"/>
            </el-form-item>
        </el-row>
        <el-row>
          <el-form-item :label="$t('收货人')">
            <el-input style="max-width: 188px;" v-model="queryParams.consigneeNameOrPhone" :placeholder="$t('请输入收货人')" clearable @keyup.enter.native="handleQuery"/>
<!--           <customer-selector
              v-model="queryParams.consigneeNameOrPhone"
              @change="consignor = $event"
              clearable
            /> -->
          </el-form-item>
          <el-form-item :label="$t('创建时间')">
            <!-- <dict-selector :type="DICT_TYPE.BEGINTIME_TYPE_ENDTIME" v-model="queryParams.date"></dict-selector> -->
            <el-date-picker
              v-model="dateType"
              type="datetimerange"
              range-separator="-"
              value-format="yyyy-MM-dd"
              :start-placeholder="$t('请选择日期')"
              :end-placeholder="$t('请选择日期')"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="handleQuery"
            ></el-button>
          </el-form-item>
        </el-row>
      </el-form>
    </el-card>
    <el-table v-loading="loadings" :data="list" border class="card">
      <el-table-column :label="$t('订单号')" align="center" prop="orderNo" />
      <el-table-column :label="$t('唛头')" align="center" prop="marks" />
      <el-table-column :label="$t('品名')" align="center" prop="title">
        <template slot-scope="scope">
          {{ scope.row.titleZh? (scope.row.titleZh + "(" + scope.row.titleEn + ")"):'' }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('箱数')" align="center" prop="num" />
      <el-table-column :label="$t('体积/重量')" align="center" prop="weight" >
        <template slot-scope="scope">
            {{ scope.row.volume}}/ {{ scope.row.weight}}
          </template>
        </el-table-column>
      <el-table-column :label="$t('发货人')" align="center" prop="consignorName" />
      <el-table-column :label="$t('收货人')" align="center" prop="consigneeName" />
      <el-table-column :label="$t('付款方')" align="center" prop="weight" >
        <template slot-scope="scope">
            {{ scope.row.paymentUser==1?$t('发货人'):$t('收货人')}}
          </template>
        </el-table-column>
      <el-table-column :label="$t('订单状态')" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
      <el-table-column :label="$t('收入类型')" align="center" prop="feeType">
        <template slot-scope="scope">
          <dict-tag
            :type="DICT_TYPE.FEE_TYPE"
            :value="scope.row.feeType"
          ></dict-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('单价')" align="center" prop="unitPrice">
        <template slot-scope="scope">
          <span>{{ scope.row.unitPrice }}{{getCurrencyLabel(scope.row.currencyId)}}</span>
          <!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" /> -->
        </template>
      </el-table-column>
      <el-table-column :label="$t('总金额')" align="center" prop="totalAmount">
        <template slot-scope="scope">
          <span>{{ scope.row.totalAmount }}{{getCurrencyLabel(scope.row.currencyId)}}</span>
          <!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" /> -->
        </template>
      </el-table-column>
      <el-table-column
        :label="$t('操作')"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button size="mini" type="text" v-hasPermi="['ecw:receivable:collection']" @click="handleAdd(scope.row)" >{{ $t('收款') }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.rows"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { userList } from "@/api/system/user";
import { DICT_TYPE } from "@/utils/dict";
import CustomerSelector from "@/components/CustomerSelector";
import { getTradeCityList } from "@/api/ecw/region";
import { getReceivableList } from "@/api/ecw/financial";
import { getCurrencyPage } from "@/api/ecw/currency";
import {getWarehouseList} from '@/api/ecw/warehouse'

export default {
  name: "EcwFinancialReceivable",
  components: {
    CustomerSelector
  },
  data() {
    return {
      showSearch: true,
      loadings: false,
      form: {},
      creatorData: [],
      list: [],
      total: 0,
      dateType: [],
      loading: "",
      params: {
        page: 1,
        rows: 20,
      },
      queryParams: {
        page: 1,
        rows: 20,
      },
      tradeCityList: [],
	  params: {
	    page: 1,
	    rows: 20,
	  },
	  currencyList:[],
    warehouseList:[],
    };
  },
  activated(){
    console.log(11)
    this.getList();
  },
  created() {
    let that = this;
	getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
    userList("salesman").then((res) => (that.creatorData = res.data));
    getTradeCityList().then((res) => (that.tradeCityList = res.data));
    this.getList();
     getWarehouseList().then(res => this.warehouseList = res.data)
  },

  computed: {
    expoerCityList() {
      return this.tradeCityList.filter((item) => item.type == 2);
    },
    importCityList() {
      return this.tradeCityList.filter((item) => item.type == 1);
    },
    exportWarehouseList(){
      /* tradeType 1 进口,2出口,3进出口 */
      return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
    },
    importWarehouseList(){
      return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
    },
  },
  methods: {
	  getCurrencyLabel(id){
	    var label = this.currencyList.filter(item=>item.id == id)
	    if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn
	    return ''
	  },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      console.log(this.queryParams)
      let params = {};
      for(let key in this.queryParams){
        if(this.queryParams[key]&&this.queryParams[key]!= undefined){
          params[key] = this.queryParams[key]
        }
      }

      this.addBeginAndEndTime(params, this.dateType, "createTime");
      // 执行查询
      getReceivableList(params).then((response) => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 新增按钮操作 */
    handleAdd(row) {
       if(!row) return this.$router.push("creatCollection");
       return this.$router.push("creatCollection?orderId=" + row.orderId);
    },
    submitForm() {},
  },
};
</script>

 <style scoped>
.card {
  margin-top: 20px;
}
.dialog-footer {
  padding: 40px;
}
.card-title {
  font-size: 18px;
  font-weight: bold;
  display: inline-block;
}
</style>