settlement.vue 1.94 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3
<template>
  <div>
    <el-form ref="settlementForm" :model="settlementObj" label-width="80px">
4 5
      <el-form-item :label="$t('可结算')">
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="settlementObj.slSettlementTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
6
      </el-form-item>
7 8
      <el-form-item :label="$t('已结算')">
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" 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">
13 14 15
      <el-button type="primary" @click="onSubmit(1)">{{$t('保存')}}</el-button>
      <el-button type="success" @click="onSubmit(2)">{{$t('提交')}}</el-button>
      <el-button @click="cancel">{{$t('关闭')}}</el-button>
huhaiqing's avatar
huhaiqing committed
16 17 18 19 20
    </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>