diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue
index 10b1dca..8e1048c 100644
--- a/pages/goods_details/index.vue
+++ b/pages/goods_details/index.vue
@@ -62,16 +62,23 @@
|
{{ $t(`起购`) }}{{ storeInfo.min_qty + storeInfo.unit_name }}
+
+ 下架时间:{{formatterDate(storeInfo.down_time)}}
+
- {{ $t(`划线价`) }} : {{ $t(`¥`) }}{{ storeInfo.ot_price || 0 }}
+
+
{{ $t(`销量`) }} : {{ storeInfo.fsales || 0 }}
{{ $t(storeInfo.unit_name) || '' }}
+
+ {{ $t(`商品距下架还有`) }} : {{ timestampToDays(storeInfo.down_time) || 0 }}天
+
+
{{ $t(`开通“超级会员”立省`) }}{{ diff }}{{ $t(`元`) }}
@@ -693,6 +700,28 @@ export default {
this.currentPage = !this.currentPage;
},
methods: {
+ formatterDate(timestamp){
+ // 创建一个新的Date对象,传入时间戳
+ var date = new Date(timestamp*1000);
+
+ // 格式化日期
+ var year = date.getFullYear();
+ var month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份是从0开始的
+ var day = ('0' + date.getDate()).slice(-2);
+ // var hours = ('0' + date.getHours()).slice(-2);
+ // var minutes = ('0' + date.getMinutes()).slice(-2);
+ // var seconds = ('0' + date.getSeconds()).slice(-2);
+
+ // 组合成YYYY-MM-DD HH:MM:SS格式
+ var formattedDate = year + '-' + month + '-' + day;
+ return formattedDate
+ },
+ timestampToDays(timestamp) {
+ const targetDate = new Date().getTime(); // Unix Epoch (1970-01-01T00:00:00Z)
+ const startDate = new Date(timestamp*1000);
+ const diff = startDate - targetDate; // Difference in milliseconds
+ return Math.ceil(diff / (1000 * 60 * 60 * 24)); // Convert to days
+ },
// 操作菜单
moreNav() {
this.currentPage = !this.currentPage;