payable.vue 13.6 KB
Newer Older
1 2
<template>
  <div class="app-container">
吴滔's avatar
吴滔 committed
3
    <div slot="header" class="card-title">{{ $t('应付款') }}</div>
4
    <!-- 搜索工作栏 -->
吴滔's avatar
吴滔 committed
5 6 7 8 9 10 11 12 13 14
    <el-card v-show="showSearch">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        label-width="100px"
        class="card"
      >
        <el-row>
吴滔's avatar
吴滔 committed
15
          <el-form-item :label="$t('柜号')">
吴滔's avatar
吴滔 committed
16 17
            <el-input
              style="max-width: 188px"
我在何方's avatar
我在何方 committed
18
              v-model="queryParams.containerNo"
吴滔's avatar
吴滔 committed
19
              :placeholder="$t('请输入柜号')"
吴滔's avatar
吴滔 committed
20 21 22 23
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
吴滔's avatar
吴滔 committed
24
          <el-form-item :label="$t('自编号')">
吴滔's avatar
吴滔 committed
25 26
            <el-input
              style="max-width: 188px"
我在何方's avatar
我在何方 committed
27
              v-model="queryParams.payableNo"
吴滔's avatar
吴滔 committed
28
              :placeholder="$t('请输入自编号')"
吴滔's avatar
吴滔 committed
29 30 31 32 33
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!--              <el-form-item label="订单号:" >
Marcus's avatar
Marcus committed
34
                  <el-input style="max-width: 188px;" v-model="queryParams.orderNo" :placeholder="$t('请输入订单号')" clearable @keyup.enter.native="handleQuery"/>
我在何方's avatar
我在何方 committed
35
              </el-form-item> -->
我在何方's avatar
我在何方 committed
36
          <el-form-item :label="$t('始发仓')">
吴滔's avatar
吴滔 committed
37 38
            <el-select
              v-model="queryParams.departureId"
我在何方's avatar
我在何方 committed
39
              :placeholder="$t('请选择始发仓')"
我在何方's avatar
我在何方 committed
40
              clearable
吴滔's avatar
吴滔 committed
41 42
            >
              <el-option
43 44
                v-for="item in exportWarehouseList"
                :label="$l(item, 'title')"
吴滔's avatar
吴滔 committed
45 46 47 48 49
                :value="item.id"
                :key="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
我在何方's avatar
我在何方 committed
50
          <el-form-item :label="$t('目的仓')">
吴滔's avatar
吴滔 committed
51 52
            <el-select
              v-model="queryParams.objectiveId"
我在何方's avatar
我在何方 committed
53
              :placeholder="$t('请选择目的仓')"
我在何方's avatar
我在何方 committed
54
              clearable
吴滔's avatar
吴滔 committed
55 56
            >
              <el-option
57 58
                v-for="item in importWarehouseList"
                :label="$l(item, 'title')"
吴滔's avatar
吴滔 committed
59 60 61 62 63
                :value="item.id"
                :key="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
吴滔's avatar
吴滔 committed
64
          <el-form-item :label="$t('运输方式')">
吴滔's avatar
吴滔 committed
65 66 67 68
            <dict-selector
              :type="DICT_TYPE.ECW_TRANSPORT_TYPE"
              v-model="queryParams.transportId"
              formatter="number"
我在何方's avatar
我在何方 committed
69
              clearable
吴滔's avatar
吴滔 committed
70 71 72
            />
          </el-form-item>
        </el-row>
我在何方's avatar
我在何方 committed
73

吴滔's avatar
吴滔 committed
74
        <!--              <el-form-item label="付款单号:" >
Marcus's avatar
Marcus committed
75
                  <el-input style="max-width: 188px;" v-model="queryParams.orderNo" :placeholder="$t('请输入付款单号')" clearable @keyup.enter.native="handleQuery"/>
我在何方's avatar
我在何方 committed
76 77
              </el-form-item> -->

吴滔's avatar
吴滔 committed
78
        <!--              <el-form-item label="状态:">
79 80 81
                  <dict-selector :type="DICT_TYPE.ECW_RECEIPT_STATE" v-model="queryParams.control" />
              </el-form-item>
               <el-form-item label="业务员:">
Marcus's avatar
Marcus committed
82
                  <el-select v-model="form.salesmanId" :placeholder="$t('请选择业务员')">
83 84
                    <el-option v-for="item in creatorData" :key="item.id" :label="item.nickname" :value="item.id"/>
                  </el-select>
我在何方's avatar
我在何方 committed
85 86
               </el-form-item> -->

吴滔's avatar
吴滔 committed
87
        <!--          <el-row>
88 89 90 91 92 93 94 95 96
              <el-form-item label="收款时间:" >
                  <el-date-picker
                    v-model="dateType"
                    type="datetimerange"
                    range-separator="到"
                    start-placeholder="请选择日期"
                    end-placeholder="请选择日期">
                  </el-date-picker>
              </el-form-item>
我在何方's avatar
我在何方 committed
97
          </el-row> -->
吴滔's avatar
吴滔 committed
98 99
        <el-row>
          <!--              <el-form-item label="商品名称:" >
Marcus's avatar
Marcus committed
100
                <el-input style="max-width: 188px;" v-model="queryParams.orderNo" :placeholder="$t('请输入商品名称')" clearable @keyup.enter.native="handleQuery"/>
我在何方's avatar
我在何方 committed
101
              </el-form-item> -->
吴滔's avatar
吴滔 committed
102
          <el-form-item :label="$t('供应商名称')">
吴滔's avatar
吴滔 committed
103 104
            <el-input
              style="max-width: 188px"
邓春圆's avatar
邓春圆 committed
105
              v-model="queryParams.supplierName"
吴滔's avatar
吴滔 committed
106
              :placeholder="$t('请输入供应商名称')"
吴滔's avatar
吴滔 committed
107 108 109 110
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
吴滔's avatar
吴滔 committed
111
          <el-form-item :label="$t('费用类型')">
吴滔's avatar
吴滔 committed
112 113 114
            <dict-selector
              :type="DICT_TYPE.FEE_TYPE"
              v-model="queryParams.feeType"
115
              clearable
吴滔's avatar
吴滔 committed
116 117 118
            ></dict-selector>
          </el-form-item>
          <el-form-item>
吴滔's avatar
吴滔 committed
119
            <el-button type="primary" @click="handleQuery">{{ $t('查找') }}</el-button>
吴滔's avatar
吴滔 committed
120 121 122
            <el-button
              style="margin-left: 10px"
              type="success"
123
              v-hasPermi="['ecw:payable:create']"
吴滔's avatar
吴滔 committed
124
              @click="handleAdd(0)"
吴滔's avatar
吴滔 committed
125
              >{{ $t('新增请款单') }}</el-button
吴滔's avatar
吴滔 committed
126 127 128 129 130 131
            >
          </el-form-item>
        </el-row>
      </el-form>
    </el-card>
    <el-table v-loading="loadings" :data="list" border class="card">
吴滔's avatar
吴滔 committed
132 133 134 135
      <el-table-column :label="$t('自编号')" align="center" prop="payableNo" />
      <el-table-column :label="$t('货柜号')" align="center" prop="containerNo" />
      <el-table-column :label="$t('供应商')" align="center" prop="supplierName" />
      <el-table-column :label="$t('费用类型')" align="center" prop="feeType">
吴滔's avatar
吴滔 committed
136 137 138 139 140 141 142
        <template slot-scope="scope">
          <dict-tag
            :type="DICT_TYPE.FEE_TYPE"
            :value="scope.row.feeType"
          ></dict-tag>
        </template>
      </el-table-column>
吴滔's avatar
吴滔 committed
143
      <el-table-column :label="$t('金额')" align="center" prop="totalAmount">
吴滔's avatar
吴滔 committed
144 145
        <template slot-scope="scope">
          <span>{{ scope.row.totalAmount }}</span>
我在何方's avatar
我在何方 committed
146
            <span>{{getCurrencyLabel(scope.row.currencyId)}}</span>
吴滔's avatar
吴滔 committed
147 148
        </template>
      </el-table-column>
Marcus's avatar
Marcus committed
149 150
      <!--            <el-table-column :label="$t('创建时间')" align="center" prop="channelName" />
            <el-table-column :label="$t('创建人')" align="center" prop="toDepartureId" /> -->
吴滔's avatar
吴滔 committed
151
      <el-table-column
吴滔's avatar
吴滔 committed
152
        :label="$t('操作')"
吴滔's avatar
吴滔 committed
153 154 155 156
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
邓春圆's avatar
邓春圆 committed
157 158 159
          <el-button
           size="mini"
           type="text"
160 161 162
           v-hasPermi="['ecw:payable:edit']"
           @click="editClick(scope.row)"
            >{{ $t('编辑') }}</el-button>
163
          <el-button size="mini" type="text" v-hasPermi="['ecw:payable:add']"  @click="handleAdd(scope.row.id)"
164 165
            >{{ $t('请款') }}</el-button>
          <el-button size="mini" type="text" v-hasPermi="['ecw:payable:delete']" @click="deleteClick(scope.row)">{{ $t('删除') }}</el-button>
吴滔's avatar
吴滔 committed
166 167 168 169 170 171 172 173 174 175 176 177 178
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.rows"
      @pagination="getList"
    />
    <!-- 对话框(添加 / 修改) -->
    <el-dialog
吴滔's avatar
吴滔 committed
179
      :title="$t('费用登记')"
吴滔's avatar
吴滔 committed
180 181 182 183 184 185
      :visible.sync="open"
      width="500px"
      append-to-body
    >
      <el-form ref="costForm" :model="costObj" label-width="80px">

吴滔's avatar
吴滔 committed
186 187
        <el-form-item :label="$t('操作步骤')">
          <el-select v-model="costObj.stepsId" :placeholder="$t('请选择操作步骤')">
我在何方's avatar
我在何方 committed
188
            <el-option v-for="item in this.getDictDatas(DICT_TYPE.BOX_SHIPPING_PROCESS)" :key="item.value" :label="item.label" :value="item.value"></el-option>
吴滔's avatar
吴滔 committed
189 190 191
          </el-select>
        </el-form-item>

吴滔's avatar
吴滔 committed
192 193
        <el-form-item :label="$t('费用类型')">
          <el-select v-model="costObj.feeType" :placeholder="$t('请选择费用类型')">
我在何方's avatar
我在何方 committed
194
            <el-option v-for="item in this.getDictDatas(DICT_TYPE.FEE_TYPE)" :key="item.value" :label="item.label" :value="item.value"></el-option>
吴滔's avatar
吴滔 committed
195 196 197
          </el-select>
        </el-form-item>

吴滔's avatar
吴滔 committed
198 199
        <el-form-item :label="$t('供应商')">
          <el-select v-model="costObj.supplierId" :placeholder="$t('请选择供应商')">
吴滔's avatar
吴滔 committed
200 201 202 203 204
            <el-option v-for="supplier in allSupplier" :key="supplier.id" :label="supplier.companyZh" :value="supplier.id"></el-option>
          </el-select>
        </el-form-item>

        <el-row class="two-element">
吴滔's avatar
吴滔 committed
205
          <el-form-item :label="$t('金额')">
吴滔's avatar
吴滔 committed
206 207 208
            <el-input-number v-model="costObj.totalAmount" controls-position="right" :min="1"></el-input-number>
          </el-form-item>
          <el-form-item label="" label-width="0px">
吴滔's avatar
吴滔 committed
209
            <el-select v-model="costObj.currencyId" :placeholder="$t('请选择单位')">
我在何方's avatar
我在何方 committed
210
              <el-option v-for="item in currencyList" :key="item.id" :label="$i18n.locale=='zh_CN'?item.titleZh:item.titleEn" :value="item.id"></el-option>
吴滔's avatar
吴滔 committed
211 212 213 214
            </el-select>
          </el-form-item>
        </el-row>

吴滔's avatar
吴滔 committed
215 216
        <el-form-item :label="$t('备注')">
          <el-input v-model="costObj.remark" type="textarea" rows="2" :placeholder="$t('请输入备注')"></el-input>
吴滔's avatar
吴滔 committed
217 218 219 220
        </el-form-item>

      </el-form>
      <div slot="footer" class="operate-button">
吴滔's avatar
吴滔 committed
221 222
        <el-button type="primary" @click="submitEditForm">{{ $t('确定') }}</el-button>
        <el-button @click="cancelEditForm">{{ $t('取消') }}</el-button>
吴滔's avatar
吴滔 committed
223 224
      </div>
    </el-dialog>
225 226 227 228
  </div>
</template>

<script>
吴滔's avatar
吴滔 committed
229 230 231 232 233
import { userList } from "@/api/system/user";
import { DICT_TYPE } from "@/utils/dict";
import { getTradeCityList } from "@/api/ecw/region";
import { getPayableList, deletePayable, updatePayable } from "@/api/ecw/financial"
import { getSupplierPage } from "@/api/ecw/supplier";
我在何方's avatar
我在何方 committed
234
import { getCurrencyPage } from "@/api/ecw/currency";
235
import {getWarehouseList} from '@/api/ecw/warehouse'
我在何方's avatar
我在何方 committed
236

吴滔's avatar
吴滔 committed
237
export default {
238
  name: "EcwFinancialPayable",
吴滔's avatar
吴滔 committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
  components: {},
  data() {
    return {
      open: false,
      showSearch: true,
      loadings: false,
      tradeCityList: [],
      costObj: {},
      creatorData: [],
      list: [],
      total: 0,
      dateType: [],
      loading: "",
      params: {
        page: 1,
        rows: 20,
      },
      queryParams: {
        page: 1,
        rows: 20,
      },
      allSupplier: [],
261 262
      currencyList:[],
        warehouseList:[],
吴滔's avatar
吴滔 committed
263 264 265 266 267 268 269 270 271
    };
  },
  computed: {
    expoerCityList() {
      return this.tradeCityList.filter((item) => item.type == 2);
    },
    importCityList() {
      return this.tradeCityList.filter((item) => item.type == 1);
    },
272 273 274 275 276 277 278
    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)
    },
吴滔's avatar
吴滔 committed
279
  },
280 281 282
  activated(){
    this.handleQuery()
  },
吴滔's avatar
吴滔 committed
283 284
  created() {
    let that = this;
285
    getWarehouseList().then(res => this.warehouseList = res.data)
我在何方's avatar
我在何方 committed
286
    getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
吴滔's avatar
吴滔 committed
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
    userList("salesman").then((res) => (that.creatorData = res.data));
    getTradeCityList().then((res) => (that.tradeCityList = res.data));
    this.getList()
    getSupplierPage({ pageNo: "1", pageSize: "10000" }).then((res) => {
      const { data } = res;
      this.allSupplier = data.list;
    });
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = { ...this.queryParams };
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
      // 执行查询
      getPayableList(params).then((response) => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
我在何方's avatar
我在何方 committed
309 310
    getCurrencyLabel(id){
      var label = this.currencyList.filter(item=>item.id == id)
我在何方's avatar
我在何方 committed
311
      if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn
我在何方's avatar
我在何方 committed
312 313
      return ''
    },
吴滔's avatar
吴滔 committed
314 315 316 317 318 319 320
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 新增按钮操作 */
    handleAdd(id) {
吴滔's avatar
吴滔 committed
321
      return this.$router.push("creatPayment?payableId=" + id);
吴滔's avatar
吴滔 committed
322 323 324 325 326 327 328 329 330 331 332 333 334
    },
    submitEditForm() {
      const params = {
        invoiceNumber: this.costObj.invoiceNumber,
        id: this.costObj.id,
        stepsId: this.costObj.stepsId,
        feeType: this.costObj.feeType,
        supplierId: this.costObj.supplierId,
        totalAmount: this.costObj.totalAmount,
        currencyId: this.costObj.currencyId,
        remark: this.costObj.remark
      }
      updatePayable(params).then(res => {
吴滔's avatar
吴滔 committed
335
        this.$modal.msgSuccess(this.$t('修改成功'));
吴滔's avatar
吴滔 committed
336 337 338 339 340 341 342 343 344 345 346
        this.getList();
        this.open = false;
      })
    },
    /** 取消按钮 */
    cancelEditForm() {
      this.open = false;
    },
    editClick(row) {
      row.stepsId = String(row.stepsId)
      row.feeType = String(row.feeType)
我在何方's avatar
我在何方 committed
347 348
      row.currencyId =  row.currencyId
      console.log(row)
吴滔's avatar
吴滔 committed
349 350 351 352 353
      this.costObj = { ...row }
      this.open = true;
    },
    deleteClick(row) {
      const id = row.id;
我在何方's avatar
我在何方 committed
354
      this.$modal.confirm(this.$t('是否确认删除该应付款')+'?').then(function() {
吴滔's avatar
吴滔 committed
355 356 357
        return deletePayable(id);
      }).then(() => {
        this.getList();
吴滔's avatar
吴滔 committed
358
        this.$modal.msgSuccess(this.$t('删除成功'));
吴滔's avatar
吴滔 committed
359 360 361 362 363
      }).catch(() => {});
    },
  },
};
</script>
364

吴滔's avatar
吴滔 committed
365 366
<style lang="scss" scoped>
  .small-padding ::v-deep .el-button {
367

吴滔's avatar
吴滔 committed
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
  }
  // 页面内元素弹窗form控件宽度设置
  ::v-deep .el-form-item__content {
    > div:not(.el-input-number) {
      width: 100%;
    }
  }
  .operate-button {
    text-align: center;
  }
  .two-element {
    display: flex;
    > :last-child {
      width: 100%;
      margin-left: 10px;
    }
  }
  .card {
    margin-top: 20px;
  }
  .dialog-footer {
    padding: 40px;
  }
  .card-title {
    font-size: 18px;
    font-weight: bold;
  }
</style>