Browse Source

Merge branch 'master' of ssh://8.134.10.79:222/Leadfyy.co/ec.uniapp-master

master
邓平艺 4 years ago
parent
commit
2541d95fa1
  1. 10
      common/styles/iconfont.css
  2. 6
      components/uni-countdown/i18n/en.json
  3. 8
      components/uni-countdown/i18n/index.js
  4. 6
      components/uni-countdown/i18n/zh-Hans.json
  5. 6
      components/uni-countdown/i18n/zh-Hant.json
  6. 260
      components/uni-countdown/uni-countdown.vue
  7. 2
      pages/order/confirm/confirm.vue
  8. 22
      pages/shop/seckillList.vue
  9. 9
      pages/user/my/center.vue

10
common/styles/iconfont.css

@ -1,8 +1,8 @@
@font-face {
font-family: "lf-iconfont"; /* Project id 2779107 */
src: url('//at.alicdn.com/t/font_2779107_gbe0eg36e0e.woff2?t=1632969325882') format('woff2'),
url('//at.alicdn.com/t/font_2779107_gbe0eg36e0e.woff?t=1632969325882') format('woff'),
url('//at.alicdn.com/t/font_2779107_gbe0eg36e0e.ttf?t=1632969325882') format('truetype');
src: url('//at.alicdn.com/t/font_2779107_6h2ufg0uxnx.woff2?t=1632991726658') format('woff2'),
url('//at.alicdn.com/t/font_2779107_6h2ufg0uxnx.woff?t=1632991726658') format('woff'),
url('//at.alicdn.com/t/font_2779107_6h2ufg0uxnx.ttf?t=1632991726658') format('truetype');
}
.lf-iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-kefufenxiermaikefu:before {
content: "\e889";
}
.icon-dianshangjiashangcheng-xianxing:before {
content: "\e79d";
}

6
components/uni-countdown/i18n/en.json

@ -0,0 +1,6 @@
{
"uni-countdown.day": "day",
"uni-countdown.h": "h",
"uni-countdown.m": "m",
"uni-countdown.s": "s"
}

8
components/uni-countdown/i18n/index.js

@ -0,0 +1,8 @@
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}

6
components/uni-countdown/i18n/zh-Hans.json

@ -0,0 +1,6 @@
{
"uni-countdown.day": "天",
"uni-countdown.h": "时",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}

6
components/uni-countdown/i18n/zh-Hant.json

@ -0,0 +1,6 @@
{
"uni-countdown.day": "天",
"uni-countdown.h": "時",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}

260
components/uni-countdown/uni-countdown.vue

@ -0,0 +1,260 @@
<template>
<view class="uni-countdown">
<text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ d }}</text>
<text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{dayText}}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ h }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : hourText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ i }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : minuteText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ s }}</text>
<text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{secondText}}</text>
</view>
</template>
<script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/**
* Countdown 倒计时
* @description 倒计时组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=25
* @property {String} backgroundColor 背景色
* @property {String} color 文字颜色
* @property {Number} day 天数
* @property {Number} hour 小时
* @property {Number} minute 分钟
* @property {Number} second
* @property {Number} timestamp 时间戳
* @property {Boolean} showDay = [true|false] 是否显示天数
* @property {Boolean} showColon = [true|false] 是否以冒号为分隔符
* @property {String} splitorColor 分割符号颜色
* @event {Function} timeup 倒计时时间到触发事件
* @example <uni-countdown :day="1" :hour="1" :minute="12" :second="40"></uni-countdown>
*/
export default {
name: 'UniCountdown',
emits:['timeup'],
props: {
showDay: {
type: Boolean,
default: true
},
showColon: {
type: Boolean,
default: true
},
start: {
type: Boolean,
default: true
},
backgroundColor: {
type: String,
default: '#FFFFFF'
},
borderColor: {
type: String,
default: '#000000'
},
color: {
type: String,
default: '#000000'
},
splitorColor: {
type: String,
default: '#000000'
},
day: {
type: Number,
default: 0
},
hour: {
type: Number,
default: 0
},
minute: {
type: Number,
default: 0
},
second: {
type: Number,
default: 0
},
timestamp: {
type: Number,
default: 0
}
},
data() {
return {
timer: null,
syncFlag: false,
d: '00',
h: '00',
i: '00',
s: '00',
leftTime: 0,
seconds: 0
}
},
computed: {
dayText() {
return t("uni-countdown.day")
},
hourText(val) {
return t("uni-countdown.h")
},
minuteText(val) {
return t("uni-countdown.m")
},
secondText(val) {
return t("uni-countdown.s")
},
},
watch: {
day(val) {
this.changeFlag()
},
hour(val) {
this.changeFlag()
},
minute(val) {
this.changeFlag()
},
second(val) {
this.changeFlag()
},
start: {
immediate: true,
handler(newVal, oldVal) {
if (newVal) {
this.startData();
} else {
if (!oldVal) return
clearInterval(this.timer)
}
}
}
},
created: function(e) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.countDown()
},
// #ifndef VUE3
destroyed() {
clearInterval(this.timer)
},
// #endif
// #ifdef VUE3
unmounted() {
clearInterval(this.timer)
},
// #endif
methods: {
toSeconds(timestamp, day, hours, minutes, seconds) {
if (timestamp) {
return timestamp - parseInt(new Date().getTime() / 1000, 10)
}
return day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
},
timeUp() {
clearInterval(this.timer)
this.$emit('timeup')
},
countDown() {
let seconds = this.seconds
let [day, hour, minute, second] = [0, 0, 0, 0]
if (seconds > 0) {
day = Math.floor(seconds / (60 * 60 * 24))
hour = Math.floor(seconds / (60 * 60)) - (day * 24)
minute = Math.floor(seconds / 60) - (day * 24 * 60) - (hour * 60)
second = Math.floor(seconds) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60)
} else {
this.timeUp()
}
if (day < 10) {
day = '0' + day
}
if (hour < 10) {
hour = '0' + hour
}
if (minute < 10) {
minute = '0' + minute
}
if (second < 10) {
second = '0' + second
}
this.d = day
this.h = hour
this.i = minute
this.s = second
},
startData() {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
if (this.seconds <= 0) {
return
}
clearInterval(this.timer)
this.countDown()
this.timer = setInterval(() => {
this.seconds--
if (this.seconds < 0) {
this.timeUp()
return
}
this.countDown()
}, 1000)
},
changeFlag() {
if (!this.syncFlag) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.startData();
this.syncFlag = true;
}
}
}
}
</script>
<style lang="scss" scoped>
$countdown-height: 48rpx;
$countdown-width: 52rpx;
.uni-countdown {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: flex-start;
padding: 2rpx 0;
}
.uni-countdown__splitor {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
line-height: $countdown-height;
padding: 5rpx;
font-size: $uni-font-size-sm;
}
.uni-countdown__number {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
width: $countdown-width;
height: $countdown-height;
line-height: $countdown-height;
margin: 5rpx;
text-align: center;
font-size: $uni-font-size-sm;
}
</style>

2
pages/order/confirm/confirm.vue

@ -81,7 +81,7 @@
</view>
<view class="lf-row-between lf-m-t-20" v-if="mode == 0">
<view class="lf-font-28 lf-color-777">运费</view>
<view class="lf-font-26" style="color: #F63434;">+¥{{ order_detail.order.payable_freight }}</view>
<view class="lf-font-26" style="color: #F63434;">+¥{{ order_detail.order.payable_freight_yuan }}</view>
</view>
<view class="lf-row-between lf-m-t-20">
<view class="lf-font-28 lf-color-777">优惠</view>

22
pages/shop/seckillList.vue

@ -19,8 +19,9 @@
<view class="desc" v-if="item.seckill.start_left_time.length==0">距离结束还剩余
{{item.seckill.end_left_time[0]}}{{item.seckill.end_left_time[1]}}{{item.seckill.end_left_time[2]}}{{item.seckill.end_left_time[3]}}
</view> -->
<view class="desc" v-if="item.ifStart">距离结束还剩余
<countdown-timer :time="item.countTime" :autoStart="true" @finish="dateFinish" v-if="item.countTime">
<!-- <view class="desc" v-if="item.ifStart">距离结束还剩余
<countdown-timer :time="item.countTime" :autoStart="true" @finish="dateFinish">
<template v-slot="{day,hour,minute, second}">
<view class="lf-flex">
<view class="lf-font-24">{{ day >= 10 ? day : "0" + day }}</view>
@ -36,7 +37,7 @@
</countdown-timer>
</view>
<view class="desc" v-else>距离开始还剩余
<countdown-timer :time="item.countTime" :autoStart="true" @finish="dateFinish" v-if="item.countTime">
<countdown-timer :time="item.countTime" :autoStart="true" @finish="dateFinish">
<template v-slot="{day,hour,minute, second}">
<view class="lf-flex">
<view class="lf-font-24">{{ day >= 10 ? day : "0" + day }}</view>
@ -50,6 +51,17 @@
</view>
</template>
</countdown-timer>
</view> -->
<view class="desc" v-if="item.seckill.end_left_time.length==0">
距离开始还剩余
<countdown-time :day="item.seckill.end_left_time[0]" :hour="item.seckill.end_left_time[1]" :minute="item.seckill.end_left_time[2]" :second="item.seckill.end_left_time[3]">
</countdown-time>
</view>
<view class="desc" v-if="item.seckill.start_left_time.length==0">
距离结束还剩余
<countdown-time :day="item.seckill.end_left_time[0]" :hour="item.seckill.end_left_time[1]" :minute="item.seckill.end_left_time[2]" :second="item.seckill.end_left_time[3]">
</countdown-time>
</view>
</view>
<view class="lf-row-between">
@ -74,6 +86,7 @@
<script>
import countdownTimer from '@/components/countdown-timer/countdown-timer';
import countdownTime from '@/components/uni-countdown/uni-countdown.vue';
export default {
data() {
return {
@ -94,7 +107,8 @@
}
},
components: {
countdownTimer
countdownTimer,
countdownTime
},
computed: {
autoHeight() {

9
pages/user/my/center.vue

@ -16,11 +16,20 @@
<view class="lf-iconfont icon-xiangyou lf-font-20 lf-m-l-10 lf-color-white"></view>
</view>
</view>
<view class="lf-row-between">
<button open-type="contact" style="background:none;height: 88rpx;padding: 0;margin: 0;line-height: 1.6;" class="lf-font-24 lf-m-r-30 lf-color-white lf-row-center lf-flex-column">
<view class="lf-iconfont icon-kefufenxiermaikefu lf-color-white"></view>
<view>
客服
</view>
</button>
<view class="lf-row-center lf-flex-column" style="position: relative; z-index: 9;" @click="$url('/pages/user/member/code')">
<view class="lf-iconfont icon-erweima lf-color-white"></view>
<view class="lf-font-24 lf-color-white">支付码</view>
</view>
</view>
</view>
<view class="lf-flex lf-row-between center-tag">
<view class="lf-row-center lf-flex-column" @click="$url('/pages/point/detail/detail')">
<view class="lf-font-36 lf-color-white">{{centerInfo.point || 0}}</view>

Loading…
Cancel
Save