|
|
@@ -342,14 +342,14 @@
|
|
|
<div class="collection_author_right" @click="follow">{{ info.follow ? '已关注' : '关注' }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- <div class="appointment_process">
|
|
|
+ <div class="appointment_process" v-if="info.hasSubscribe">
|
|
|
<div class="appointment_process_con">
|
|
|
<div class="appointment_process_title">预约流程</div>
|
|
|
<van-divider />
|
|
|
<van-steps :active="active" active-color="#F3E0BC">
|
|
|
<van-step>开放预约</van-step>
|
|
|
<van-step>预约结束</van-step>
|
|
|
- <van-step>抽签及付款</van-step>
|
|
|
+ <van-step>预约公布</van-step>
|
|
|
<van-step>开放购买</van-step>
|
|
|
</van-steps>
|
|
|
<div class="appointment_process_time">
|
|
|
@@ -373,7 +373,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
<div class="work_story">
|
|
|
<div class="work_story_con">
|
|
|
<div class="work_story_title">作品故事</div>
|
|
|
@@ -532,13 +532,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="transaction_button_right">
|
|
|
- <div class="coming_on_sale" v-if="isAppointmenta" block round>
|
|
|
+ <!-- <div class="coming_on_sale" v-if="isAppointmenta" block round>
|
|
|
<div class="coming_on_sale_con">即将开售</div>
|
|
|
- <div class="coming_on_sale_time">{{ startTime }}</div>
|
|
|
- <!-- <van-count-down :time="time" format="DD天 HH:mm:ss" class="coming_on_sale_time" /> -->
|
|
|
- </div>
|
|
|
+ <div class="coming_on_sale_time">{{ startTime }}</div> -->
|
|
|
+ <!-- <van-count-down :time="time" format="DD天 HH:mm:ss" class="coming_on_sale_time" /> -->
|
|
|
+ <!-- </div> -->
|
|
|
<!-- 预约 -->
|
|
|
- <div class="buy_now" v-if="isAppointment" block round>
|
|
|
+ <div class="buy_now" v-if="info.subscribeStatus == 'NOT_STARTED' && info.hasSubscribe">
|
|
|
+ <!-- v-if="isAppointment" block round -->
|
|
|
<div class="buy_now_con">敬请期待</div>
|
|
|
<div class="buy_now_time">{{ comingSoonTime }} 开放预约</div>
|
|
|
</div>
|
|
|
@@ -552,28 +553,56 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="transaction_button_right">
|
|
|
- <div class="coming_on_sale" v-if="isAppointmenta" block round>
|
|
|
+ <!-- <div class="coming_on_sale" v-if="isAppointmenta" block round>
|
|
|
<div class="coming_on_sale_con">即将开售</div>
|
|
|
<div class="coming_on_sale_time">{{ startTime }}</div>
|
|
|
- </div>
|
|
|
- <div class="sold_out" v-else-if="isSolded" block round>已售罄</div>
|
|
|
- <div class="sold_out" v-else-if="isSold" block round>即将售罄</div>
|
|
|
- <div class="sold_out" v-else-if="limit.limit > 0 && limit.count >= limit.limit" block round>
|
|
|
+ </div> -->
|
|
|
+ <div class="sold_out" v-if="isSolded" block round>已售罄</div>
|
|
|
+ <div class="sold_out" v-if="isSold" block round>即将售罄</div>
|
|
|
+ <div class="sold_out" v-if="limit.limit > 0 && limit.count >= limit.limit" block round>
|
|
|
限购{{ limit.limit }}件
|
|
|
</div>
|
|
|
<!-- 预约 -->
|
|
|
- <div class="buy_now" v-if="isAppointment" block round>
|
|
|
+ <div class="buy_now" v-if="info.subscribeStatus == 'NOT_STARTED' && info.hasSubscribe">
|
|
|
+ <!-- v-if="isAppointment" block round -->
|
|
|
<div class="buy_now_con">敬请期待</div>
|
|
|
<div class="buy_now_time">{{ comingSoonTime }} 开放预约</div>
|
|
|
</div>
|
|
|
- <!-- <div v-else class="buy_now" @click="appointment">
|
|
|
- <div class="buy_now_con_two">立即预约</div>
|
|
|
- </div> -->
|
|
|
- <div class="buy_now" v-else @click="buyNow">
|
|
|
- <div class="buy_now_con">立即购买</div>
|
|
|
- <div>
|
|
|
- <span class="purchase_sold">已售 {{ info.sale }}</span>
|
|
|
- <span class="Purchase_surplus">剩余{{ info.stock }}</span>
|
|
|
+ <div v-else-if="info.subscribeStatus == 'ONGOING' && info.hasSubscribe">
|
|
|
+ <div class="buy_now" @click="appointment" v-if="!info.subscribed">
|
|
|
+ <div class="buy_now_con_two">立即预约</div>
|
|
|
+ </div>
|
|
|
+ <div class="sold_out" v-else>已预约</div>
|
|
|
+ </div>
|
|
|
+ <div class="sold_out" v-else-if="info.subscribeStatus == 'SUBSCRIBE_ENDING' && info.hasSubscribe">
|
|
|
+ <!-- v-if="!isAppointment && info.state == 'CLOSESUBSCRIBE'" -->
|
|
|
+ 预约结束
|
|
|
+ </div>
|
|
|
+ <div v-else-if="info.subscribeStatus == 'ANNOUNCING' && info.hasSubscribe">
|
|
|
+ <!-- v-if="!isAppointment && info.state == 'PUBLISH'" class="button_three" -->
|
|
|
+ <div class="buy_now" v-if="info.purchaseQualifications">
|
|
|
+ <div class="buy_now_con_two">已获取购买资格</div>
|
|
|
+ </div>
|
|
|
+ <div class="sold_out" v-else>未获取购买资格</div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="info.subscribeStatus == 'ON_SALE' && info.hasSubscribe">
|
|
|
+ <!-- v-if="!isAppointment && info.state == 'PURCHASE'" -->
|
|
|
+ <div class="buy_now" @click="buyNow" v-if="info.purchaseQualifications">
|
|
|
+ <div class="buy_now_con">立即购买</div>
|
|
|
+ <div>
|
|
|
+ <span class="purchase_sold">已售 {{ info.sale }}</span>
|
|
|
+ <span class="Purchase_surplus">剩余{{ info.stock }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="sold_out">已售罄</div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="!info.hasSubscribe">
|
|
|
+ <div class="buy_now" @click="buyNow">
|
|
|
+ <div class="buy_now_con">立即购买</div>
|
|
|
+ <div>
|
|
|
+ <span class="purchase_sold">已售 {{ info.sale }}</span>
|
|
|
+ <span class="Purchase_surplus">剩余{{ info.stock }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 预约 -->
|
|
|
@@ -609,6 +638,7 @@ import { ImagePreview } from 'vant';
|
|
|
import { Toast } from 'vant';
|
|
|
import product from '../../mixins/product';
|
|
|
import coupon from '../../mixins/coupon';
|
|
|
+import common from '../../mixins/common';
|
|
|
// import HashCode from '../../components/product/HashCode.vue';
|
|
|
// import ProductTitle from '../../components/product/ProductTitle.vue';
|
|
|
// import { Swiper, SwiperSlide } from 'swiper/vue';
|
|
|
@@ -631,10 +661,6 @@ import HashCode from '../../components/product/HashCode.vue';
|
|
|
// import HashCode from '../../components/product/HashCode.vue';
|
|
|
import { ref } from 'vue';
|
|
|
export default {
|
|
|
- setup() {
|
|
|
- const active = ref(1);
|
|
|
- return { active };
|
|
|
- },
|
|
|
components: {
|
|
|
// HashCode,
|
|
|
// ProductTitle,
|
|
|
@@ -647,12 +673,19 @@ export default {
|
|
|
// Tasks,
|
|
|
// TopNavigation
|
|
|
},
|
|
|
- mixins: [product, coupon],
|
|
|
+ mixins: [product, coupon, common],
|
|
|
name: 'productDetail',
|
|
|
data() {
|
|
|
return {
|
|
|
activeName: '1',
|
|
|
info: {},
|
|
|
+ timeNode: 0,
|
|
|
+ appointmentStartTime: 0,
|
|
|
+ endTime: 0,
|
|
|
+ publishTime: 0,
|
|
|
+ purchaseTime: 0,
|
|
|
+ activeValue: 0,
|
|
|
+ millisecond: 0,
|
|
|
liked: false,
|
|
|
btn: null,
|
|
|
blindBoxItems: [],
|
|
|
@@ -674,9 +707,14 @@ export default {
|
|
|
deposit: false,
|
|
|
showOnly: false,
|
|
|
noLikes: require('@assets/icon-dianzan.png'),
|
|
|
- likes: require('@assets/icon-dianzan@2x.png')
|
|
|
+ likes: require('@assets/icon-dianzan@2x.png'),
|
|
|
+ startTime: null
|
|
|
};
|
|
|
},
|
|
|
+ setup() {
|
|
|
+ const active = ref(0);
|
|
|
+ return { active };
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(['userInfo']),
|
|
|
banners() {
|
|
|
@@ -761,6 +799,7 @@ export default {
|
|
|
this.limit = res;
|
|
|
});
|
|
|
this.getProduct();
|
|
|
+ this.timer();
|
|
|
// if (this.isLogin) {
|
|
|
// this.$http
|
|
|
// .post(
|
|
|
@@ -781,6 +820,11 @@ export default {
|
|
|
// });
|
|
|
// }
|
|
|
},
|
|
|
+ beforeUnmount() {
|
|
|
+ if (this.startTime) {
|
|
|
+ clearTimeout(this.startTime);
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
preview(index = 0, list = []) {
|
|
|
ImagePreview({
|
|
|
@@ -790,8 +834,76 @@ export default {
|
|
|
startPosition: index
|
|
|
});
|
|
|
},
|
|
|
+ // 时间赋值
|
|
|
+ // timeAssignment() {
|
|
|
+ // this.timeNode = parseFloat(new Date(this.info.startTime).getTime());
|
|
|
+ // if (this.info.state == 'OPENSUBSCRIBE') {
|
|
|
+ // this.timeNode = new Date(this.info.startTime).getTime();
|
|
|
+ // } else if (this.info.state == 'CLOSESUBSCRIBE') {
|
|
|
+ // this.timeNode = new Date(this.info.endTime).getTime();
|
|
|
+ // } else if (this.info.state == 'PUBLISH') {
|
|
|
+ // this.timeNode = new Date(this.info.publishTime).getTime();
|
|
|
+ // } else if (this.info.state == 'PURCHASE') {
|
|
|
+ // this.timeNode = new Date(this.info.purchaseTime).getTime();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 定时器
|
|
|
+ timer() {
|
|
|
+ console.log("qddddddag",this.millisecond)
|
|
|
+ if (this.startTime) {
|
|
|
+ clearTimeout(this.startTime);
|
|
|
+ }
|
|
|
+ this.startTime = setTimeout(() => {
|
|
|
+ this.getProduct();
|
|
|
+ }, this.millisecond);
|
|
|
+ },
|
|
|
+ // timer() {
|
|
|
+ // let startTime = setInterval(() => {
|
|
|
+ // let currentTime = new Date().getTime();
|
|
|
+ // if (currentTime < this.appointmentStartTime) {
|
|
|
+ // let beforeAppointment = this.$refs.beforeAppointment
|
|
|
+ // beforeAppointment.style.display = 'block';
|
|
|
+ // } else if (this.appointmentStartTime <= currentTime && currentTime < this.endTime) {
|
|
|
+ // let beforeAppointment = this.$refs.beforeAppointment
|
|
|
+ // let buttonOne = this.$refs.appointmentStartTime;
|
|
|
+ // beforeAppointment.style.display = 'none';
|
|
|
+ // buttonOne.style.display = 'block';
|
|
|
+ // this.active = 0;
|
|
|
+ // } else if (this.endTime <= currentTime && currentTime < this.publishTime) {
|
|
|
+ // let buttonOne = this.$refs.appointmentStartTime;
|
|
|
+ // let buttonTwo = this.$refs.endTime;
|
|
|
+ // buttonOne.style.display = 'none';
|
|
|
+ // buttonTwo.style.display = 'block';
|
|
|
+ // this.active = 1;
|
|
|
+ // } else if (this.publishTime <= currentTime && currentTime < this.purchaseTime) {
|
|
|
+ // let buttonTwo = this.$refs.endTime;
|
|
|
+ // let buttonThree = this.$refs.publishTime;
|
|
|
+ // buttonTwo.style.display = 'none';
|
|
|
+ // buttonThree.style.display = 'block';
|
|
|
+ // this.active = 2;
|
|
|
+ // } else if (this.purchaseTime <= currentTime) {
|
|
|
+ // let buttonThree = this.$refs.publishTime;
|
|
|
+ // let buttonFour = this.$refs.purchaseTime;
|
|
|
+ // buttonThree.style.display = 'none';
|
|
|
+ // buttonFour.style.display = 'block';
|
|
|
+ // this.active = 3;
|
|
|
+ // console.log("122123154134")
|
|
|
+ // // if (this.isSolded || this.isSold) {
|
|
|
+ // // let buttonFour = this.$refs.purchaseTime;
|
|
|
+ // // buttonFour.style.display = 'none';
|
|
|
+ // // }
|
|
|
+ // }
|
|
|
+ // }, 500);
|
|
|
+ // // if(startTime){
|
|
|
+ // // clearTimeout(startTime)
|
|
|
+ // // }
|
|
|
+ // },
|
|
|
// 关注
|
|
|
follow() {
|
|
|
+ if (!this.isLogin) {
|
|
|
+ this.checkLogin();
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!this.info.follow) {
|
|
|
this.$http.get(`/user/${this.info.id}/follow`).then(res => {
|
|
|
this.getInfo();
|
|
|
@@ -806,11 +918,19 @@ export default {
|
|
|
},
|
|
|
// 藏品预约
|
|
|
appointment() {
|
|
|
- console.log('121212', typeof this.info.id);
|
|
|
- let data = {collectionId: this.info.id, userId: this.userInfo.id};
|
|
|
+ if (!this.isLogin) {
|
|
|
+ this.checkLogin();
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.$http
|
|
|
- .post('subscribe/makeAnAppointment', data)
|
|
|
- .then(res => {})
|
|
|
+ .get('/subscribe/makeAnAppointment', {
|
|
|
+ collectionId: this.info.id,
|
|
|
+ userId: this.userInfo.id
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ Toast.success('预约成功');
|
|
|
+ this.getProduct();
|
|
|
+ })
|
|
|
.catch(e => {
|
|
|
Toast(e.error);
|
|
|
// if (e.error) {
|
|
|
@@ -835,10 +955,10 @@ export default {
|
|
|
// this.getData(true);
|
|
|
// });
|
|
|
getProduct() {
|
|
|
- this.$toast.loading({
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true
|
|
|
- });
|
|
|
+ // this.$toast.loading({
|
|
|
+ // message: '加载中...',
|
|
|
+ // forbidClick: true
|
|
|
+ // });
|
|
|
this.$http
|
|
|
.get('/collection/get/' + this.collectionId)
|
|
|
.then(res => {
|
|
|
@@ -846,8 +966,43 @@ export default {
|
|
|
res.onShelf = true;
|
|
|
this.checkLogin();
|
|
|
}
|
|
|
- console.log(res);
|
|
|
+ // console.log(res);
|
|
|
this.info = res;
|
|
|
+ // this.appointmentStartTime = new Date(this.info.startTime).getTime();
|
|
|
+ // this.endTime = new Date(this.info.endTime).getTime();
|
|
|
+ // this.publishTime = new Date(this.info.publishTime).getTime();
|
|
|
+ // this.purchaseTime = new Date(this.info.purchaseTime).getTime();
|
|
|
+ if (res.subscribeStatus == 'NOT_STARTED') {
|
|
|
+ this.millisecond = this.dayjs(res.startTime, 'YYYY-MM-DD HH:mm:ss').diff(
|
|
|
+ this.dayjs(),
|
|
|
+ 'Millisecond'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (res.subscribeStatus == 'ONGOING') {
|
|
|
+ this.millisecond = this.dayjs(res.endTime, 'YYYY-MM-DD HH:mm:ss').diff(
|
|
|
+ this.dayjs(),
|
|
|
+ 'Millisecond'
|
|
|
+ );
|
|
|
+ this.active = 0;
|
|
|
+ // this.timeNode = new Date(this.info.startTime).getTime();
|
|
|
+ } else if (res.subscribeStatus == 'SUBSCRIBE_ENDING') {
|
|
|
+ this.millisecond = this.dayjs(res.publishTime, 'YYYY-MM-DD HH:mm:ss').diff(
|
|
|
+ this.dayjs(),
|
|
|
+ 'Millisecond'
|
|
|
+ );
|
|
|
+ this.active = 1;
|
|
|
+ // this.timeNode = new Date(this.info.endTime).getTime();
|
|
|
+ } else if (res.subscribeStatus == 'ANNOUNCING') {
|
|
|
+ this.millisecond = this.dayjs(res.purchaseTime, 'YYYY-MM-DD HH:mm:ss').diff(
|
|
|
+ this.dayjs(),
|
|
|
+ 'Millisecond'
|
|
|
+ );
|
|
|
+ this.active = 2;
|
|
|
+ // this.timeNode = new Date(this.info.publishTime).getTime();
|
|
|
+ } else if (res.subscribeStatus == 'ON_SALE') {
|
|
|
+ this.active = 3;
|
|
|
+ // this.timeNode = new Date(this.info.purchaseTime).getTime();
|
|
|
+ }
|
|
|
//优惠券
|
|
|
if (res.couponPayment) {
|
|
|
this.getCouponList();
|
|
|
@@ -903,7 +1058,7 @@ export default {
|
|
|
this.btn = this.$refs.btn;
|
|
|
}
|
|
|
});
|
|
|
- this.$toast.clear();
|
|
|
+ // this.$toast.clear();
|
|
|
|
|
|
if (res.type === 'BLIND_BOX') {
|
|
|
return this.$http.post(
|
|
|
@@ -1034,6 +1189,21 @@ export default {
|
|
|
width: 100%;
|
|
|
height: 44px;
|
|
|
}
|
|
|
+.buttonOne {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.button_two {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.button_three {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.button_four {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.beforeAppointment_con {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
.detail_content {
|
|
|
width: 100%;
|
|
|
background: #191d27;
|