settlement.vue 1.88 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3 4
<template>
  <div>
    <el-form ref="settlementForm" :model="settlementObj" label-width="80px">
      <el-form-item label="可结算">
huhaiqing's avatar
huhaiqing committed
5
        <el-date-picker type="datetime" placeholder="请选择日期" v-model="settlementObj.slSettlementTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
6 7
      </el-form-item>
      <el-form-item label="已结算">
huhaiqing's avatar
huhaiqing committed
8
        <el-date-picker type="datetime" placeholder="请选择日期" v-model="settlementObj.slSettledTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
9 10 11 12
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
huhaiqing's avatar
huhaiqing committed
13 14
      <el-button type="primary" @click="onSubmit(1)">保存</el-button>
      <el-button type="success" @click="onSubmit(2)">提交</el-button>
huhaiqing's avatar
huhaiqing committed
15 16 17 18 19 20
      <el-button @click="cancel">关闭</el-button>
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
21 22
import { settlementCreate } from "@/api/ecw/boxSea";
import { formatDateStr, serviceMsg } from "../utils";
huhaiqing's avatar
huhaiqing committed
23 24 25 26 27
/**
 * 结算
 */
export default {
  name: "settlement",
huhaiqing's avatar
huhaiqing committed
28
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
29 30 31 32 33 34
  data() {
    return {
      // 结算对象
      settlementObj: {},
    };
  },
huhaiqing's avatar
huhaiqing committed
35 36 37 38 39 40
  created() {
    const voName = this.$attrs.currNode.voName;
    let oldData = { ...this.$attrs.shipmentObj[voName] };
    oldData = formatDateStr(oldData, ["slSettlementTime", "slSettledTime"]);
    this.settlementObj = oldData;
  },
huhaiqing's avatar
huhaiqing committed
41 42
  methods: {
    /** 提交 */
huhaiqing's avatar
huhaiqing committed
43
    onSubmit(operateType) {
huhaiqing's avatar
huhaiqing committed
44 45
      this.$refs["settlementForm"].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
46 47 48 49 50 51
          settlementCreate({
            ...this.settlementObj,
            shipmentId: this.$attrs.shipmentObj.id,
            operateType,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
huhaiqing's avatar
huhaiqing committed
52
              this.cancel("submit");
huhaiqing's avatar
huhaiqing committed
53 54
            });
          });
huhaiqing's avatar
huhaiqing committed
55 56 57 58
        }
      });
    },
    /** 取消 */
huhaiqing's avatar
huhaiqing committed
59 60
    cancel(type) {
      this.$emit("closeDialog", type);
huhaiqing's avatar
huhaiqing committed
61 62 63 64 65 66 67
    },
  },
};
</script>

<style lang="scss" scoped>
</style>