|
|
@@ -36,6 +36,10 @@
|
|
|
{{ info.likes }}
|
|
|
</like-button>
|
|
|
</div>
|
|
|
+ <!-- <div class="sold xianliang" v-if="time && info.salable">
|
|
|
+ <img src="@assets/shizhong.png" alt="" />
|
|
|
+ <span>即将开售:{{ startTime || time }}</span>
|
|
|
+ </div> -->
|
|
|
<div class="sold" v-if="isSold">已售罄</div>
|
|
|
</div>
|
|
|
</router-link>
|
|
|
@@ -43,6 +47,11 @@
|
|
|
|
|
|
<script>
|
|
|
import product from '../../mixins/product';
|
|
|
+import dayjs from 'dayjs';
|
|
|
+var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
|
|
|
+dayjs.extend(isSameOrBefore);
|
|
|
+var duration = require('dayjs/plugin/duration');
|
|
|
+dayjs.extend(duration);
|
|
|
export default {
|
|
|
mixins: [product],
|
|
|
props: {
|
|
|
@@ -53,6 +62,28 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ time() {
|
|
|
+ if (this.info.startTime) {
|
|
|
+ if (dayjs().isSameOrBefore(this.info.startTime)) {
|
|
|
+ return dayjs(this.info.startTime).format('MM月DD日');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ if (this.info.startTime) {
|
|
|
+ var x = dayjs(this.info.startTime);
|
|
|
+ var y = dayjs();
|
|
|
+ let d = dayjs.duration(x.diff(y));
|
|
|
+ let day = parseInt(d.asDays());
|
|
|
+ if (day <= 0) {
|
|
|
+ this.getTime(this.info.startTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
likeProduct() {
|
|
|
if (!this.info.liked) {
|