1
jhzh
2024-08-14 d8f87c52c32750897c145785dbeb5ba30917edb5
src/page/deliveryContract/position.vue
@@ -55,7 +55,7 @@
      </div>
      <div class="position-div1">
        <span class="position-text1">{{ $t("到期时间") }}</span>
        <span class="position-text2 textColor">{{ item.close_time }}</span>
        <span class="position-text2 textColor">{{ getnewtime(item.close_time) }}</span>
      </div>
      <div class="position-div1">
        <span class="position-text1">{{ $t("操作") }}</span>
@@ -112,10 +112,36 @@
  },
  methods: {
    onDetail(item) {
      // 详细界面
      // 详细界面
      this.show = true;
      this.detailData = item;
    },
   getnewtime(e){
// 给定的时间字符串 (中国时间)
const inputDateStr = e;
// 创建一个 Date 对象,注意这里输入的时间是 CST,实际上是 UTC+8
const inputDate = new Date(inputDateStr + ' UTC+0800');
// 转换为韩国时间 (KST),KST = UTC + 9 小时
const kstDate = new Date(inputDate.getTime() + 1 * 60 * 60 * 1000); // 8小时 + 1小时 = 9小时
// 获取年、月、日、小时、分钟和秒
const year = kstDate.getFullYear();
const month = kstDate.getMonth() + 1; // getMonth() 返回 0 到 11,需要加 1
const day = kstDate.getDate();
const hours = kstDate.getHours(); // 小时部分
const minutes = kstDate.getMinutes(); // 分钟部分
const seconds = kstDate.getSeconds(); // 秒部分
// 格式化时间为“年-月-日 小时:分钟:秒”格式
const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
const formattedTime = `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
           return formattedDate +' '+ formattedTime
   }
  },
  mounted(){
  },
};
</script>