|
@@ -1,12 +1,16 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
- <image src="" mode="" class="to-bg"></image>
|
|
|
+ <image src="../../static/img/wh-bg.png" mode="" class="to-bg"></image>
|
|
|
<view class="top-tit">
|
|
|
{{state}}
|
|
|
</view>
|
|
|
- <view class="top-time">
|
|
|
- {{showTime()}}
|
|
|
+ <view class="top-time" v-if="status != 1">
|
|
|
+ {{showTime}}
|
|
|
</view>
|
|
|
+ <view class="top-time" v-if="status == 1">
|
|
|
+ {{stopTimeH + ':' + stopTimeM + ':' + stopTimeS}}
|
|
|
+ </view>
|
|
|
+
|
|
|
<view class="center-btn flex" @click="navto('/pages/user/myWholesale')">
|
|
|
<image src="" mode="" class="center-logo"></image>
|
|
|
<view class="center-tit">
|
|
@@ -42,6 +46,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ timeComputed
|
|
|
+ } from '@/utils/rocessor.js'
|
|
|
+ import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
|
|
|
+ import { getWholeList } from '@/api/whole.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -53,8 +62,13 @@
|
|
|
loaded: false,
|
|
|
bin: '',
|
|
|
stop: '',
|
|
|
- status: 0,
|
|
|
- state: ''
|
|
|
+ status: '',
|
|
|
+ state: '',
|
|
|
+ stopTimeH: '',
|
|
|
+ stopTimeM: '',
|
|
|
+ stopTimeS: '',
|
|
|
+ timer: '',
|
|
|
+ wid: ''
|
|
|
}
|
|
|
},
|
|
|
onReady(res) {
|
|
@@ -75,9 +89,36 @@
|
|
|
let obj = this
|
|
|
obj.bin = decodeURI(opt.bin)
|
|
|
obj.stop = opt.stp
|
|
|
- obj.stauts = opt.status
|
|
|
+ obj.status = opt.status
|
|
|
obj.state = opt.state
|
|
|
- console.log(obj.bin, obj.stop)
|
|
|
+ obj.wid = opt.wid
|
|
|
+
|
|
|
+ obj.getWholeList()
|
|
|
+ console.log(obj.bin, obj.stop, obj.status)
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ let obj = this
|
|
|
+ if (obj.status == 1) {
|
|
|
+ if(obj.timer) {
|
|
|
+ clearTimeout(obj.timer)
|
|
|
+ }
|
|
|
+ this.getSyTime()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ showTime() {
|
|
|
+ let obj = this
|
|
|
+ console.log(obj.status, obj.state, 'obj.status++++++++')
|
|
|
+ if (obj.status == 1) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ if (obj.status == 0) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ if (obj.status == 2) {
|
|
|
+ return obj.bin
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
navto(url) {
|
|
@@ -85,18 +126,36 @@
|
|
|
url: url
|
|
|
})
|
|
|
},
|
|
|
- showTime() {
|
|
|
- let obj =this
|
|
|
- console.log(obj.status,'obj.status++++++++')
|
|
|
- if(obj.status == 1) {
|
|
|
- return '距离结束'
|
|
|
+ // 获取剩余时间
|
|
|
+ getSyTime() {
|
|
|
+ let obj = this
|
|
|
+ let stopTime = timeComputed(obj.stop * 1000)
|
|
|
+ console.log(stopTime, 'stopTime')
|
|
|
+ obj.stopTimeH = stopTime.hours
|
|
|
+ obj.stopTimeM = stopTime.minutes >= 10 ? stopTime.minutes : ('0' + stopTime.minutes)
|
|
|
+ obj.stopTimeS = stopTime.seconds >= 10 ? stopTime.seconds : ('0' + stopTime.seconds)
|
|
|
+ if(stopTime.hours == 0 && stopTime.minutes == 0 && stopTime.seconds == 0) {
|
|
|
+ obj.status = 0
|
|
|
}
|
|
|
- if(obj.status == 0) {
|
|
|
- return ''
|
|
|
- }
|
|
|
- if(obj.status == 2) {
|
|
|
- return obj.bin + '开始'
|
|
|
+ if(!obj.timer) {
|
|
|
+ if(obj.status == 1) {
|
|
|
+ obj.timer = setTimeout(this.getSyTime,1000)
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ clearTimeout(obj.timer)
|
|
|
+ if(obj.status == 1) {
|
|
|
+ obj.timer = setTimeout(this.getSyTime,1000)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // console.log(obj.stopTimeH + ':' + obj.stopTimeM + ':' + obj.stopTimeS)
|
|
|
+ },
|
|
|
+ getWholeList() {
|
|
|
+ let obj = this
|
|
|
+ getWholeList({},obj.wid).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -106,7 +165,7 @@
|
|
|
.to-bg {
|
|
|
width: 750rpx;
|
|
|
height: 427rpx;
|
|
|
- background-color: #ff8a57;
|
|
|
+ background-color: #fff;
|
|
|
}
|
|
|
|
|
|
.top-tit {
|