| .. | .. |
|---|
| 14 | 14 | <view :style="{ height: marTop + 'px' }"></view> |
|---|
| 15 | 15 | <yueyangZone ref=yueyangZoneRef v-if="isYueyangZone" :zoneInfo="info" :careBeanRate="careBeanRate" |
|---|
| 16 | 16 | style="position: relative;z-index: 2;" @goLottery="goLottery" :relationKey="relationKey"></yueyangZone> |
|---|
| 17 | + <view v-if="isYueyangZone" class="detail-btn" @click="goDetail"> |
|---|
| 18 | + <text>消耗明细</text> |
|---|
| 19 | + </view> |
|---|
| 17 | 20 | <view v-else> |
|---|
| 18 | 21 | <view class="expireTime" v-if="expireTime && expireTime.length"> |
|---|
| 19 | 22 | <text>专区将在</text> |
|---|
| 20 | | - <text v-for="(val, index) in expireTime" :key="index"> |
|---|
| 21 | | - <text class="num">{{ val }}</text>{{ expireTimeUnit[index] }} |
|---|
| 23 | + <text v-for="(item, index) in expireTime" :key="index"> |
|---|
| 24 | + <text class="num"><text v-for="(char, ci) in item.digits" :key="ci" |
|---|
| 25 | + class="digit">{{ char }}</text></text>{{ item.unit }} |
|---|
| 22 | 26 | </text> |
|---|
| 23 | 27 | <text>{{ startOrEnd }}</text> |
|---|
| 24 | 28 | </view> |
|---|
| 25 | 29 | <view class="head_img"> |
|---|
| 26 | 30 | <image :src="info.image"></image> |
|---|
| 31 | + </view> |
|---|
| 32 | + <view v-if="info.zoneType == 8 && info.info" class="rich-content"> |
|---|
| 33 | + <rich-text :nodes="info.info"></rich-text> |
|---|
| 34 | + </view> |
|---|
| 35 | + <view v-if="info.zoneType == 8 && info.uploadVideo" class="video-wrap"> |
|---|
| 36 | + <view v-show="!videoControls" style="width:100%;height:750rpx"> |
|---|
| 37 | + <video id="zoneVideo" :src='info.uploadVideo' objectFit="contain" controls |
|---|
| 38 | + style="width:100%;height:100%" show-center-play-btn="true" show-mute-btn="true" muted="true" |
|---|
| 39 | + show-fullscreen-btn="true" auto-pause-if-navigate :custom-cache="false" |
|---|
| 40 | + :enable-progress-gesture="true" show-progress="false" |
|---|
| 41 | + :poster="info.uploadVideoImg || info.image" @pause="zoneVideoPause"></video> |
|---|
| 42 | + </view> |
|---|
| 43 | + <view class="video-poster" v-show="videoControls"> |
|---|
| 44 | + <image class="image" :src="info.uploadVideoImg || info.image"></image> |
|---|
| 45 | + </view> |
|---|
| 46 | + <view class="video-stop" v-show="videoControls" @tap="bindZoneVideoPlay"> |
|---|
| 47 | + <image class="image" src="https://ossacmall.bluedeer.com.cn/app/static/images/stop.png"></image> |
|---|
| 48 | + </view> |
|---|
| 27 | 49 | </view> |
|---|
| 28 | 50 | <view class="tag-wrap-container" :style="'top:' + (marTop) + 'px;'" v-if="info.zoneType == 7"> |
|---|
| 29 | 51 | <view class="tag-wrap"> |
|---|
| .. | .. |
|---|
| 67 | 89 | </view> |
|---|
| 68 | 90 | </view> |
|---|
| 69 | 91 | </view> |
|---|
| 70 | | - <view @click="goLottery" class="lottery_banner" v-if="info && info.isLottery"> |
|---|
| 71 | | - <image class="lottery_bannerImg" |
|---|
| 72 | | - src="https://ossacmall.bluedeer.com.cn/app/static/images/zone_lotteryBanner.gif" mode="widthFix"> |
|---|
| 92 | + <view @click="goLottery" class="lottery_banner" v-if="info && info.isLottery && info.lotteryBanner"> |
|---|
| 93 | + <image class="lottery_bannerImg" :src="info.lotteryBanner" mode="widthFix"> |
|---|
| 73 | 94 | </image> |
|---|
| 74 | 95 | </view> |
|---|
| 75 | 96 | <view class="tag-img-container" v-if="info.zoneType == 7"> |
|---|
| .. | .. |
|---|
| 586 | 607 | showMenu: false, |
|---|
| 587 | 608 | selectedMenuArr: [], |
|---|
| 588 | 609 | expireTime: [], |
|---|
| 589 | | - expireTimeUnit: [], |
|---|
| 610 | + countdownToken: 0, |
|---|
| 590 | 611 | isPageShow: false, |
|---|
| 591 | 612 | loginBackFn: null, |
|---|
| 592 | 613 | errText: '', |
|---|
| .. | .. |
|---|
| 596 | 617 | isYueyangZone: false, |
|---|
| 597 | 618 | isOpen: false, // 默认收起,false收起/true展开 |
|---|
| 598 | 619 | currentIndex: -1, // 默认选中第一个【全部】 |
|---|
| 620 | + videoControls: true, // 专区活动视频是否显示海报+播放按钮 |
|---|
| 621 | + zoneVideoContext: '', // 活动视频播放上下文 |
|---|
| 599 | 622 | partitionList: [], |
|---|
| 600 | 623 | partitionProject: {}, |
|---|
| 601 | 624 | tagList: [], |
|---|
| .. | .. |
|---|
| 835 | 858 | } |
|---|
| 836 | 859 | }, |
|---|
| 837 | 860 | methods: { |
|---|
| 861 | + /** |
|---|
| 862 | + * 专区活动视频:点击海报播放按钮后播放 |
|---|
| 863 | + */ |
|---|
| 864 | + bindZoneVideoPlay() { |
|---|
| 865 | + if (!this.zoneVideoContext) { |
|---|
| 866 | + this.zoneVideoContext = uni.createVideoContext('zoneVideo', this); |
|---|
| 867 | + } |
|---|
| 868 | + this.$set(this, 'videoControls', false); |
|---|
| 869 | + this.zoneVideoContext.play(); |
|---|
| 870 | + }, |
|---|
| 871 | + zoneVideoPause() { }, |
|---|
| 838 | 872 | handleCouponRule() { |
|---|
| 839 | 873 | this.$refs.personalAndShareCouponRuleRef.show(this.info.ruleContentText) |
|---|
| 840 | 874 | }, |
|---|
| .. | .. |
|---|
| 1195 | 1229 | // that.myCareBean = res2.data.totalCareBeans; |
|---|
| 1196 | 1230 | }); |
|---|
| 1197 | 1231 | }, |
|---|
| 1232 | + goDetail() { |
|---|
| 1233 | + uni.navigateTo({ |
|---|
| 1234 | + url: '/pages/consumption/index?zoneId=' + this.info.id |
|---|
| 1235 | + }) |
|---|
| 1236 | + }, |
|---|
| 1198 | 1237 | goLottery() { |
|---|
| 1199 | 1238 | let that = this; |
|---|
| 1200 | 1239 | var data = { |
|---|
| .. | .. |
|---|
| 1288 | 1327 | }) |
|---|
| 1289 | 1328 | }, |
|---|
| 1290 | 1329 | validAlert(data) { |
|---|
| 1330 | + // 每次重新计算前作废旧的倒计时链,避免多条定时器同时刷新导致数字跳动 |
|---|
| 1331 | + this.countdownToken++ |
|---|
| 1332 | + const token = this.countdownToken |
|---|
| 1291 | 1333 | const { |
|---|
| 1292 | 1334 | startTime, |
|---|
| 1293 | 1335 | expireTime |
|---|
| .. | .. |
|---|
| 1306 | 1348 | let minutes = startTimetamp.getMinutes() |
|---|
| 1307 | 1349 | minutes = minutes < 10 ? '0' + minutes : minutes; |
|---|
| 1308 | 1350 | |
|---|
| 1309 | | - this.countdownTimer(startTime.split('-').join('/'), 'start') |
|---|
| 1351 | + this.countdownTimer(startTime.split('-').join('/'), 'start', token) |
|---|
| 1310 | 1352 | this.startOrEnd = "后开启" |
|---|
| 1311 | 1353 | return |
|---|
| 1312 | | - } |
|---|
| 1313 | | - } |
|---|
| 1314 | | - if (expireTime) { |
|---|
| 1315 | | - const expireTimetamp = new Date(expireTime.split('-').join('/')).getTime(); |
|---|
| 1316 | | - if (expireTimetamp < nowTimestamp) { |
|---|
| 1354 | + } |
|---|
| 1355 | + } |
|---|
| 1356 | + if (expireTime) { |
|---|
| 1357 | + const expireTimetamp = new Date(expireTime.split('-').join('/')).getTime(); |
|---|
| 1358 | + if (expireTimetamp < nowTimestamp) { |
|---|
| 1317 | 1359 | return |
|---|
| 1318 | | - } |
|---|
| 1319 | | - this.countdownTimer(expireTime.split('-').join('/'), 'end') |
|---|
| 1360 | + } |
|---|
| 1361 | + this.countdownTimer(expireTime.split('-').join('/'), 'end', token) |
|---|
| 1320 | 1362 | this.startOrEnd = "后结束" |
|---|
| 1321 | 1363 | } |
|---|
| 1322 | 1364 | }, |
|---|
| .. | .. |
|---|
| 1445 | 1487 | console.log('专区详情入参::', params) |
|---|
| 1446 | 1488 | getZoneDetail(that.id, params).then(res => { |
|---|
| 1447 | 1489 | that.info = res.data; |
|---|
| 1490 | + //that.info.zoneType=8; |
|---|
| 1448 | 1491 | that.updateZoneShareMenu(); |
|---|
| 1449 | 1492 | if (res.data.zoneType == 6) { |
|---|
| 1450 | 1493 | that.setYueyangZone() |
|---|
| .. | .. |
|---|
| 1454 | 1497 | that.homeTop = that.getHomeTop(0.4) |
|---|
| 1455 | 1498 | } |
|---|
| 1456 | 1499 | that.expireTime = []; |
|---|
| 1457 | | - that.expireTimeUnit = []; |
|---|
| 1500 | + that.countdownToken++; |
|---|
| 1458 | 1501 | that.where.page = 1; |
|---|
| 1459 | 1502 | that.getGoodList() |
|---|
| 1460 | 1503 | that.validAlert(res.data) |
|---|
| .. | .. |
|---|
| 1480 | 1523 | } |
|---|
| 1481 | 1524 | }); |
|---|
| 1482 | 1525 | }, |
|---|
| 1483 | | - countdownTimer(expireTime, type) { |
|---|
| 1526 | + countdownTimer(expireTime, type, token) { |
|---|
| 1484 | 1527 | if (!expireTime) return |
|---|
| 1528 | + if (token !== undefined && token !== this.countdownToken) return |
|---|
| 1485 | 1529 | let that = this; |
|---|
| 1486 | 1530 | // 结束时间的时间戳(需传入一个有效的日期对象或时间戳) |
|---|
| 1487 | 1531 | const endTimestamp = new Date(expireTime).getTime(); |
|---|
| .. | .. |
|---|
| 1493 | 1537 | if (type == 'end') { |
|---|
| 1494 | 1538 | if (diff <= 0) { |
|---|
| 1495 | 1539 | this.expireTime = [] |
|---|
| 1496 | | - this.expireTimeUnit = [] |
|---|
| 1497 | 1540 | return |
|---|
| 1498 | 1541 | } else { } |
|---|
| 1499 | 1542 | } else if (type == 'start') { |
|---|
| 1500 | 1543 | if (diff <= 0) { |
|---|
| 1501 | 1544 | this.expireTime = [] |
|---|
| 1502 | | - this.expireTimeUnit = [] |
|---|
| 1503 | 1545 | const expireTime2 = that.info.expireTime |
|---|
| 1504 | 1546 | if (expireTime2) { |
|---|
| 1505 | 1547 | const expireTimetamp = new Date(expireTime2.split('-').join('/')).getTime(); |
|---|
| 1506 | 1548 | if (expireTimetamp < nowTimestamp) { |
|---|
| 1507 | 1549 | return |
|---|
| 1508 | 1550 | } |
|---|
| 1509 | | - this.countdownTimer(expireTime2.split('-').join('/'), 'end') |
|---|
| 1551 | + this.countdownTimer(expireTime2.split('-').join('/'), 'end', token) |
|---|
| 1510 | 1552 | this.startOrEnd = "后结束" |
|---|
| 1511 | 1553 | } |
|---|
| 1512 | 1554 | return |
|---|
| 1513 | 1555 | } |
|---|
| 1514 | 1556 | } |
|---|
| 1557 | + const pad = num => (num < 10 ? '0' + num : String(num)) |
|---|
| 1515 | 1558 | const res = [] |
|---|
| 1516 | | - const unit = [] |
|---|
| 1517 | 1559 | const days = Math.floor(diff / (1000 * 60 * 60 * 24)) |
|---|
| 1518 | 1560 | diff %= (1000 * 60 * 60 * 24) |
|---|
| 1519 | | - if (days > 0) { |
|---|
| 1520 | | - res.push(days); |
|---|
| 1521 | | - unit.push('日') |
|---|
| 1522 | | - } |
|---|
| 1523 | 1561 | // 转换为小时、分钟、秒 |
|---|
| 1524 | 1562 | const hours = Math.floor(diff / (1000 * 60 * 60)); |
|---|
| 1525 | 1563 | diff %= (1000 * 60 * 60); // 剩余毫秒数 |
|---|
| 1526 | | - if (hours > 0) { |
|---|
| 1527 | | - res.push(hours < 10 ? '0' + hours : hours); |
|---|
| 1528 | | - unit.push('时') |
|---|
| 1529 | | - } |
|---|
| 1530 | 1564 | const minutes = Math.floor(diff / (1000 * 60)); |
|---|
| 1531 | | - if (minutes > 0) { |
|---|
| 1532 | | - res.push(minutes < 10 ? '0' + minutes : minutes); |
|---|
| 1533 | | - unit.push('分') |
|---|
| 1534 | | - } |
|---|
| 1535 | 1565 | diff %= (1000 * 60); // 剩余毫秒数 |
|---|
| 1536 | 1566 | const seconds = Math.floor(diff / 1000); |
|---|
| 1537 | | - if (seconds > 0) { |
|---|
| 1538 | | - res.push(seconds < 10 ? '0' + seconds : seconds); |
|---|
| 1539 | | - unit.push('秒') |
|---|
| 1567 | + // 天数为 0 时不展示,时/分/秒始终展示(补 0),保证倒计时长度稳定 |
|---|
| 1568 | + if (days > 0) { |
|---|
| 1569 | + res.push({ |
|---|
| 1570 | + digits: pad(days).split(''), |
|---|
| 1571 | + unit: '日' |
|---|
| 1572 | + }) |
|---|
| 1540 | 1573 | } |
|---|
| 1574 | + res.push({ |
|---|
| 1575 | + digits: pad(hours).split(''), |
|---|
| 1576 | + unit: '时' |
|---|
| 1577 | + }) |
|---|
| 1578 | + res.push({ |
|---|
| 1579 | + digits: pad(minutes).split(''), |
|---|
| 1580 | + unit: '分' |
|---|
| 1581 | + }) |
|---|
| 1582 | + res.push({ |
|---|
| 1583 | + digits: pad(seconds).split(''), |
|---|
| 1584 | + unit: '秒' |
|---|
| 1585 | + }) |
|---|
| 1541 | 1586 | this.expireTime = res |
|---|
| 1542 | | - this.expireTimeUnit = unit |
|---|
| 1543 | 1587 | if (this.isPageShow) { |
|---|
| 1544 | 1588 | setTimeout(() => { |
|---|
| 1545 | | - that.countdownTimer(expireTime, type) |
|---|
| 1589 | + that.countdownTimer(expireTime, type, token) |
|---|
| 1546 | 1590 | }, 1000) |
|---|
| 1547 | 1591 | } |
|---|
| 1548 | 1592 | }, |
|---|
| .. | .. |
|---|
| 1629 | 1673 | .lottery_banner { |
|---|
| 1630 | 1674 | margin: 15rpx auto; |
|---|
| 1631 | 1675 | width: 690rpx; |
|---|
| 1632 | | - height: 120rpx; |
|---|
| 1633 | 1676 | text-align: center; |
|---|
| 1634 | 1677 | } |
|---|
| 1635 | 1678 | |
|---|
| 1636 | 1679 | .lottery_bannerImg { |
|---|
| 1637 | 1680 | width: 690rpx; |
|---|
| 1638 | | - height: 120rpx; |
|---|
| 1639 | 1681 | } |
|---|
| 1640 | 1682 | |
|---|
| 1641 | 1683 | .tag-wrap-container { |
|---|
| .. | .. |
|---|
| 1836 | 1878 | transform: translate(0, -50%); |
|---|
| 1837 | 1879 | } |
|---|
| 1838 | 1880 | |
|---|
| 1881 | +.detail-btn { |
|---|
| 1882 | + border: 2rpx solid #fff; |
|---|
| 1883 | + border-top-left-radius: 20rpx; |
|---|
| 1884 | + border-bottom-left-radius: 20rpx; |
|---|
| 1885 | + padding: 10rpx; |
|---|
| 1886 | + background-color: #daf2b2; |
|---|
| 1887 | + color: #1e984f; |
|---|
| 1888 | + width: 50rpx; |
|---|
| 1889 | + position: fixed; |
|---|
| 1890 | + top: 200rpx; |
|---|
| 1891 | + right: 0rpx; |
|---|
| 1892 | + line-height: 1rem; |
|---|
| 1893 | + z-index: 99; |
|---|
| 1894 | +} |
|---|
| 1895 | + |
|---|
| 1839 | 1896 | .head_img { |
|---|
| 1840 | 1897 | width: 750rpx; |
|---|
| 1841 | 1898 | height: 422rpx; |
|---|
| .. | .. |
|---|
| 1844 | 1901 | width: 750rpx; |
|---|
| 1845 | 1902 | height: 422rpx; |
|---|
| 1846 | 1903 | } |
|---|
| 1904 | +} |
|---|
| 1905 | + |
|---|
| 1906 | +.rich-content { |
|---|
| 1907 | + padding: 24rpx 30rpx; |
|---|
| 1908 | + background-color: #fff; |
|---|
| 1909 | +} |
|---|
| 1910 | + |
|---|
| 1911 | +.video-wrap { |
|---|
| 1912 | + position: relative; |
|---|
| 1913 | + width: 100%; |
|---|
| 1914 | + height: 750rpx; |
|---|
| 1915 | + background-color: #000; |
|---|
| 1916 | +} |
|---|
| 1917 | + |
|---|
| 1918 | +.video-wrap .video-poster { |
|---|
| 1919 | + position: absolute; |
|---|
| 1920 | + top: 0; |
|---|
| 1921 | + left: 0; |
|---|
| 1922 | + width: 100%; |
|---|
| 1923 | + height: 750rpx; |
|---|
| 1924 | + z-index: 9; |
|---|
| 1925 | +} |
|---|
| 1926 | + |
|---|
| 1927 | +.video-wrap .video-poster .image { |
|---|
| 1928 | + width: 100%; |
|---|
| 1929 | + height: 100%; |
|---|
| 1930 | +} |
|---|
| 1931 | + |
|---|
| 1932 | +.video-wrap .video-stop { |
|---|
| 1933 | + position: absolute; |
|---|
| 1934 | + top: 50%; |
|---|
| 1935 | + left: 50%; |
|---|
| 1936 | + width: 136rpx; |
|---|
| 1937 | + height: 136rpx; |
|---|
| 1938 | + margin-top: -68rpx; |
|---|
| 1939 | + margin-left: -68rpx; |
|---|
| 1940 | + z-index: 9; |
|---|
| 1941 | +} |
|---|
| 1942 | + |
|---|
| 1943 | +.video-wrap .video-stop .image { |
|---|
| 1944 | + width: 100%; |
|---|
| 1945 | + height: 100%; |
|---|
| 1847 | 1946 | } |
|---|
| 1848 | 1947 | |
|---|
| 1849 | 1948 | .toolbarList { |
|---|
| .. | .. |
|---|
| 2062 | 2161 | padding: 15rpx; |
|---|
| 2063 | 2162 | padding-left: 30rpx; |
|---|
| 2064 | 2163 | color: #979797; |
|---|
| 2164 | + font-size: 26rpx; |
|---|
| 2065 | 2165 | |
|---|
| 2066 | 2166 | .num { |
|---|
| 2167 | + display: inline-block; |
|---|
| 2067 | 2168 | color: #000000; |
|---|
| 2068 | 2169 | background: #FFE20E; |
|---|
| 2069 | | - padding: 0 10rpx; |
|---|
| 2170 | + padding: 0 6rpx; |
|---|
| 2171 | + margin: 0 4rpx; |
|---|
| 2172 | + vertical-align: middle; |
|---|
| 2173 | + } |
|---|
| 2174 | + |
|---|
| 2175 | + /* 每个数字固定宽度,避免倒计时跳动时宽度忽长忽短 */ |
|---|
| 2176 | + .digit { |
|---|
| 2177 | + display: inline-block; |
|---|
| 2178 | + width: 19rpx; |
|---|
| 2179 | + text-align: center; |
|---|
| 2070 | 2180 | } |
|---|
| 2071 | 2181 | } |
|---|
| 2072 | 2182 | </style> |
|---|