Commit ffe0e8d1 by Lin

Merge branch 'saas+v5.8.3' of http://192.168.3.233:8090/glsx/gl_tape into saas+v5.8.3

2 parents 19857bb6 f83300e2
......@@ -22,35 +22,15 @@
</view>
<view class="filter-row">
<input
class="filter-input"
v-model="keyword"
placeholder="关键字过滤,如 StoragePathMerge / PathUtils"
confirm-type="search"
/>
<input class="filter-input" v-model="keyword" placeholder="关键字过滤,如 StoragePathMerge / PathUtils" confirm-type="search" />
</view>
<view class="level-row">
<text
v-for="lv in levelOptions"
:key="lv.value"
:class="['level-chip', { active: levelFilter === lv.value }]"
@tap="levelFilter = lv.value"
>{{ lv.label }}</text>
<text v-for="lv in levelOptions" :key="lv.value" :class="['level-chip', { active: levelFilter === lv.value }]" @tap="levelFilter = lv.value">{{ lv.label }}</text>
</view>
<scroll-view
class="log-scroll"
scroll-y
:scroll-into-view="scrollIntoView"
:scroll-with-animation="false"
>
<view
v-for="item in displayLines"
:key="item.id"
:id="'log-' + item.id"
:class="['log-line', 'level-' + item.level]"
>
<scroll-view class="log-scroll" scroll-y :scroll-into-view="scrollIntoView" :scroll-with-animation="false">
<view v-for="item in displayLines" :key="item.id" :id="'log-' + item.id" :class="['log-line', 'level-' + item.level]">
<text class="log-time">{{ item.time }}</text>
<text class="log-tag">[{{ item.level }}]</text>
<text class="log-text">{{ item.text }}</text>
......@@ -59,12 +39,7 @@
</scroll-view>
<view class="tag-row">
<text
v-for="tag in quickTags"
:key="tag.label"
:class="['tag-chip', { active: keyword === tag.value }]"
@tap="setKeyword(tag.value)"
>{{ tag.label }}</text>
<text v-for="tag in quickTags" :key="tag.label" :class="['tag-chip', { active: keyword === tag.value }]" @tap="setKeyword(tag.value)">{{ tag.label }}</text>
</view>
</view>
</view>
......@@ -252,9 +227,7 @@ export default {
},
onCopy() {
const kw = (this.keyword || '').trim()
let list = this._isMergeKeyword(kw)
? [...loadPersistedMergeLogs(), ...FloatLogBus.getMergeLines()]
: FloatLogBus.getLines()
let list = this._isMergeKeyword(kw) ? [...loadPersistedMergeLogs(), ...FloatLogBus.getMergeLines()] : FloatLogBus.getLines()
if (this.levelFilter !== 'all') {
list = list.filter(l => l.level === this.levelFilter)
}
......@@ -262,9 +235,7 @@ export default {
if (kw && !this._isMergeKeyword(kw)) {
list = list.filter(l => l.text.toLowerCase().includes(kwLower))
}
const text = list
.map(l => `${l.time} [${l.level}] ${l.text}`)
.join('\n')
const text = list.map(l => `${l.time} [${l.level}] ${l.text}`).join('\n')
if (!text) {
uni.showToast({ title: '无内容', icon: 'none' })
return
......@@ -310,7 +281,7 @@ export default {
.float-log-fab {
position: fixed;
right: 24rpx;
bottom: 120rpx;
bottom: 20rpx;
width: 120rpx;
height: 120rpx;
z-index: 99999;
......
<template>
<view class="date-list">
<view v-if="ready && days.length" class="date-list">
<picker-view class="picker picker_max" :value="dateValues" indicator-class="indicator" @change="changeDate">
<picker-view-column>
<template v-for="(item, index) in days">
......@@ -29,158 +29,155 @@ import dayjs from 'dayjs'
export default {
name: 'DateTime',
inject: ['userInfo'],
props: {
defaultTime: {
type: String,
default: ''
}
},
data () {
return {
hours: [],
days: [],
minutes: [],
dateValues: [],
hourValues: [],
minuteValues: [],
loading: true
dateValues: [0],
hourValues: [0],
minuteValues: [0],
ready: false,
currentDate: '',
currentHour: '',
currentMinute: ''
}
},
props: {
},
mounted () {
this.initDate()
},
methods: {
initDate () {
this.dateValues = []
this.hourValues = []
this.minuteValues = []
const today = new Date()
this.getDateList('2019/01/01', new Date(today.getFullYear(), today.getMonth(), today.getDate()))
getList () {
this.ready = false
this.initDate()
},
getDateList (starDay, endDay) {
const arr = [];
const dates = [];
// 设置两个日期UTC时间
const db = new Date(starDay);
const de = new Date(endDay);
// 获取两个日期GTM时间
const s = db.getTime() - 24 * 60 * 60 * 1000;
const d = de.getTime() - 24 * 60 * 60 * 1000;
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d;) {
i = i + 24 * 60 * 60 * 1000;
arr.push(parseInt(String(i)));
}
// 获取每一天的时间 YY-MM-DD
for (const j in arr) {
const time = new Date(arr[j]);
const year = time.getFullYear();
const mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
const day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
const YYMMDD = year + '/' + mouth + '/' + day;
dates.push(YYMMDD);
buildDayList () {
const days = []
const start = dayjs('2019-01-01').startOf('day')
const end = dayjs().startOf('day')
let cur = start
while (cur.isBefore(end) || cur.isSame(end, 'day')) {
days.push(cur.format('YYYY/MM/DD'))
cur = cur.add(1, 'day')
}
this.getHourList(dates)
return days
},
getHourList (days) {
const hours = [], today = new Date();
for (let hour = 0; hour < today.getHours() + 1; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
this.getMinuteList(days, hours)
buildHourList (isToday) {
const len = isToday ? dayjs().hour() + 1 : 24
return Array.from({ length: len }, (_, i) => String(i).padStart(2, '0'))
},
getMinuteList (days, hours) {
const minutes = [];
const today = new Date()
for (let minute = 0; minute < today.getMinutes() + 1; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
// 设置默认时间
let { dateValues, hourValues, minuteValues } = this
const HOUR_STR = today.getHours().toString().padStart(2, '0')
const MUNTUE_STR = today.getMinutes().toString().padStart(2, '0')
// const defalutHIndex = hours.indexOf(HOUR_STR)
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
dateValues.push(days.length + 1)
hourValues.push(hours.length + 1)
minuteValues.push(minutes.length + 1)
this.currentDate = dayjs().format('YYYY/MM/DD')
this.currentHour = HOUR_STR
this.currentMinute = MUNTUE_STR
this.hours = hours
this.days = days
this.minutes = minutes
buildMinuteList (isToday, hour) {
const now = dayjs()
const isCurrentHour = isToday && hour === now.format('HH')
const len = isCurrentHour ? now.minute() + 1 : 60
return Array.from({ length: len }, (_, i) => String(i).padStart(2, '0'))
},
pickIndex (list, value, fallbackLast) {
const index = list.indexOf(value)
if (index >= 0) return index
return fallbackLast ? Math.max(list.length - 1, 0) : 0
},
applyPickerValues (dateValues, hourValues, minuteValues) {
this.$nextTick(() => {
this.dateValues = dateValues
this.hourValues = hourValues
this.minuteValues = minuteValues
this.loading = false
setTimeout(() => {
this.minuteValues = minuteValues
this.loading = false
}, 100)
this.ready = true
this.$emit('onComplete')
})
},
changeDate (e) {
const { days } = this
const { value } = e.detail
const index = value[0]
console.log( days[index],days,index)
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
changeHour (e) {
const { hours, days, dateValues } = this
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
initDate () {
const days = this.buildDayList()
if (!days.length) {
this.days = []
this.hours = []
this.minutes = []
this.ready = false
this.$emit('onComplete')
return
}
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
changeMinutes (e) {
const { minutes } = this
const { value } = e.detail
const index = value[0]
this.currentMinute = minutes[index]
},
getAllTimeOrPartTime (type) {
const today = new Date()
const hours = [], minutes = [], hour_len = type == 1 ? 24 : today.getHours() + 1, minute_len = type == 1 ? 60 : today.getMinutes() + 1;
for (let hour = 0; hour < hour_len; hour++) {
hours.push(hour.toString().padStart(2, '0'));
const today = dayjs()
const todayStr = today.format('YYYY/MM/DD')
let currentDate = todayStr
let currentHour = today.format('HH')
let currentMinute = today.format('mm')
if (this.defaultTime) {
const parsed = dayjs(this.defaultTime.replace(/-/g, '/'))
if (parsed.isValid()) {
currentDate = parsed.format('YYYY/MM/DD')
currentHour = parsed.format('HH')
currentMinute = parsed.format('mm')
}
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
const isToday = currentDate === todayStr
const hours = this.buildHourList(isToday)
const minutes = this.buildMinuteList(isToday, currentHour)
if (!hours.includes(currentHour)) currentHour = hours[hours.length - 1]
if (!minutes.includes(currentMinute)) currentMinute = minutes[minutes.length - 1]
this.currentDate = currentDate
this.currentHour = currentHour
this.currentMinute = currentMinute
this.days = days
this.hours = hours
this.minutes = minutes
this.applyPickerValues(
[this.pickIndex(days, currentDate, true)],
[this.pickIndex(hours, currentHour, true)],
[this.pickIndex(minutes, currentMinute, true)]
)
},
getAllTimeOrPartTimeMinute (type) {
const today = new Date()
const currentHour = today.getHours()
const timeType = this.currentHour != currentHour ? 1 : 0
const minutes = [], minute_len = type == 1 || timeType == 1 ? 60 : today.getMinutes() + 1;
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
changeDate (e) {
const index = e.detail.value[0]
const date = this.days[index]
if (!date) return
this.currentDate = date
const isToday = this.currentDate === dayjs().format('YYYY/MM/DD')
this.hours = this.buildHourList(isToday)
if (!this.hours.includes(this.currentHour)) {
this.currentHour = this.hours[this.hours.length - 1]
}
const minutes = this.buildMinuteList(isToday, this.currentHour)
this.minutes = minutes
if (!this.minutes.includes(this.currentMinute)) {
this.currentMinute = this.minutes[this.minutes.length - 1]
}
this.$nextTick(() => {
this.hourValues = [this.pickIndex(this.hours, this.currentHour, true)]
this.minuteValues = [this.pickIndex(this.minutes, this.currentMinute, true)]
})
},
changeHour (e) {
const index = e.detail.value[0]
const hour = this.hours[index]
if (hour == null) return
this.currentHour = hour
const isToday = this.currentDate === dayjs().format('YYYY/MM/DD')
this.minutes = this.buildMinuteList(isToday, this.currentHour)
if (!this.minutes.includes(this.currentMinute)) {
this.currentMinute = this.minutes[this.minutes.length - 1]
}
this.$nextTick(() => {
this.minuteValues = [this.pickIndex(this.minutes, this.currentMinute, true)]
})
},
changeMinutes (e) {
const index = e.detail.value[0]
const minute = this.minutes[index]
if (minute == null) return
this.currentMinute = minute
},
getResult () {
console.log(this.currentDate,this.currentHour,this.currentMinute)
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute + ":00"
const result = dayjs(str).format('YYYY/MM/DD HH:mm:ss')
return result
const str = `${this.currentDate} ${this.currentHour}:${this.currentMinute}:00`
return dayjs(str.replace(/-/g, '/')).format('YYYY/MM/DD HH:mm:ss')
}
}
}
......
......@@ -17,7 +17,7 @@
</template>
<view v-if="componentObject[popupType]" :class="['popup-body', { 'hide-footer': componentObject[popupType].hideFooter }, { 'hide-search': componentObject[popupType].hideSearch }, { 'hide-footer-search': componentObject[popupType].hideFooter && componentObject[popupType].hideSearch }]">
<scroll-view scroll-y :class="['popup-scroll-view', { show: componentObject[popupType].loadComplete }]">
<component :is="componentObject[popupType].name" :params.sync="componentObject[popupType]" :data="data" :dataKey="dataKey" :isDefeatOrder="isDefeatOrder" :defaultTime="defaultTime" :positionTypeList="positionTypeList" :show-marketing-icon="showMarketingIcon" :boutique-order-types-only="boutiqueOrderTypesOnly" ref="componentRef" @choose="chooseContent = $event" @openSkuPopup="openSkuPopup" @onComplete="componentObject[popupType].loadComplete = true" @confirm="confirm"></component>
<component :is="componentObject[popupType].name" :params.sync="componentObject[popupType]" :data="data" :dataKey="dataKey" :isDefeatOrder="isDefeatOrder" :defaultTime="datePickerDefaultTime" :positionTypeList="positionTypeList" :show-marketing-icon="showMarketingIcon" :boutique-order-types-only="boutiqueOrderTypesOnly" ref="componentRef" @choose="chooseContent = $event" @openSkuPopup="openSkuPopup" @onComplete="componentObject[popupType].loadComplete = true" @confirm="confirm"></component>
<template v-if="componentObject[popupType].noData">
<view class="nothing flex">暂无数据</view>
</template>
......@@ -171,6 +171,11 @@ export default {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
},
datePickerDefaultTime () {
if (this.defaultTime) return this.defaultTime
const data = this.data || {}
return data.pay2Time || data.successDate || ''
}
},
mounted () {
},
......@@ -187,6 +192,9 @@ export default {
})
},
open () {
if (this.componentObject[this.popupType]) {
this.componentObject[this.popupType].loadComplete = false
}
this.$refs.popup.open()
// 等待当前 tick 的响应式 watcher(如 externalData → cacheData)执行完再初始化
this.$nextTick(() => {
......
......@@ -392,11 +392,15 @@ export default {
total_price += Number(item.finalPrice) || 0
})
const raw = data
const customer = raw.customer || {}
data = {
...data.customer,
...data.payOrder,
...data,
packageGoodsList: data.packageGoodsList,
...customer,
...raw.payOrder,
...raw,
customerPhone: customer.customerPhone || raw.customerPhone,
customerName: customer.customerName || raw.customerName,
packageGoodsList: raw.packageGoodsList,
couponName,
total_price: Number(utils.decimal(total_price, 2)).toFixed(2)
}
......
......@@ -66,10 +66,7 @@
<view class="meal-box" v-for="(item, index) in orderInfo.packageGoodsList">
<view class="meal-hd flex justify-between align-center">
<view class="meal-hd-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<view v-if="shouldShowMarketingIcon(item)" class="sprite-icon icon-activeIcon marketing-icon"></view>
<view>{{ item.packageAlias || item.packageName }}</view>
</view>
<view class="price">¥{{ item.finalPrice }}</view>
......@@ -94,10 +91,7 @@
<view class="good" v-for="(item, index) in orderInfo.subOrderList" :key="index">
<view class="flex justify-between align-center mb-20">
<view class="good-name flex align-center">
<view
v-if="shouldShowMarketingIcon(item)"
class="sprite-icon icon-activeIcon marketing-icon"
></view>
<view v-if="shouldShowMarketingIcon(item)" class="sprite-icon icon-activeIcon marketing-icon"></view>
<text class="good-name-text text-hide">商品名称:{{ replaceItemText(item.upgradeGoodsName) || '' }}</text>
</view>
<text class="good-price">¥{{ item.finalPrice }}</text>
......@@ -357,12 +351,7 @@ export default {
const rejected = { status: '驳回', statusColor: '#f56c6c' }
return [
{
name: '区域经理',
value: '1',
...(status === 1 ? pending : [2, 3, 4].includes(status) ? approved : empty)
},
{
name: '线上运营',
name: '运营',
value: '2',
...(status === 1 ? empty : status === 2 ? pending : status === 3 ? approved : status === 4 ? rejected : empty)
}
......@@ -491,13 +480,18 @@ export default {
})
}
const raw = data
const customer = raw.customer || {}
data = {
...data.customer,
...data.payOrder,
...data,
packageGoodsList: data.packageGoodsList,
...customer,
...raw.payOrder,
...raw,
// 根级 customerPhone 常为 null,会覆盖 customer 内真实手机号
customerPhone: customer.customerPhone || raw.customerPhone,
customerName: customer.customerName || raw.customerName,
packageGoodsList: raw.packageGoodsList,
couponName,
total_price: data.selectPayType == 0 ? 0 : Number(utils.decimal(total_price, 2)).toFixed(2)
total_price: raw.selectPayType == 0 ? 0 : Number(utils.decimal(total_price, 2)).toFixed(2)
}
if (data.customerCoupon) {
data.customerCoupon.customerCouponCode = data.customerCoupon.customerCouponCode.split('-')[0]
......@@ -584,11 +578,15 @@ export default {
},
getWorkWechatLiveQRCode() {
this.customerService = ''
let { failCustomerService, defaultCustomerService } = this
let { orderCode, customerPhone: phoneNumber, selectPayType } = this.orderInfo
// console.log(orderCode, phoneNumber, selectPayType)
const { failCustomerService, defaultCustomerService, orderInfo } = this
const { orderCode, selectPayType } = orderInfo
const phoneNumber = orderInfo.customerPhone || orderInfo.customer?.customerPhone
// 订单状态 1-升级订单 2-战败订单
let orderType = selectPayType == 0 ? 2 : 1
const orderType = selectPayType == 0 ? 2 : 1
if (!phoneNumber) {
this.customerService = defaultCustomerService
return
}
uni.$api.boutiqueApi
.getWorkWechatLiveQRCode({
orderCode,
......@@ -602,7 +600,9 @@ export default {
this.customerService = defaultCustomerService
}
})
// }, 3000)
.catch(() => {
this.customerService = failCustomerService
})
},
/** 获取服务商是否使用膜卷号 */
getServiceFilmRollSetting(yqMerchantId) {
......
<template>
<view class="date-list">
<view v-if="ready && days.length" class="date-list">
<picker-view class="picker picker_max" :value="dateValues" indicator-class="indicator" @change="changeDate">
<picker-view-column>
<template v-for="(item, index) in days">
......@@ -29,160 +29,141 @@ import dayjs from 'dayjs'
export default {
name: 'DateTime',
inject: ['userInfo'],
data() {
data () {
return {
hours: [],
days: [],
minutes: [],
dateValues: [],
hourValues: [],
minuteValues: [],
loading: true
dateValues: [0],
hourValues: [0],
minuteValues: [0],
ready: false,
currentDate: '',
currentHour: '',
currentMinute: ''
}
},
props: {
},
mounted() {
this.initDate()
params: Object,
startDate: String,
endDate: String
},
methods: {
initDate() {
this.dateValues = []
this.hourValues = []
this.minuteValues = []
const today = new Date()
this.getDateList('2019/01/01', new Date(today.getFullYear(), today.getMonth(), today.getDate()))
getList () {
this.ready = false
this.initDate()
},
getDateList(starDay, endDay) {
const arr = [];
const dates = [];
// 设置两个日期UTC时间
const db = new Date(starDay);
const de = new Date(endDay);
// 获取两个日期GTM时间
const s = db.getTime() - 24 * 60 * 60 * 1000;
const d = de.getTime() - 24 * 60 * 60 * 1000;
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d;) {
i = i + 24 * 60 * 60 * 1000;
arr.push(parseInt(String(i)));
}
// 获取每一天的时间 YY-MM-DD
for (const j in arr) {
const time = dayjs(arr[j]);
if (!time.isValid()) continue; // 跳过无效日期
const year = time.year();
const month = time.month() + 1; // 注意:dayjs 的 month() 返回 0-11
const day = time.date();
const mouthStr = month >= 10 ? month : '0' + month;
const dayStr = day >= 10 ? day : '0' + day;
const YYMMDD = year + '/' + mouthStr + '/' + dayStr;
dates.push(YYMMDD);
buildDayList () {
const days = []
const start = dayjs((this.startDate || '2019-01-01').replace(/\//g, '-')).startOf('day')
const end = dayjs((this.endDate || dayjs().format('YYYY-MM-DD')).replace(/\//g, '-')).startOf('day')
if (!start.isValid() || !end.isValid() || end.isBefore(start)) return days
let cur = start
while (cur.isBefore(end) || cur.isSame(end, 'day')) {
days.push(cur.format('YYYY/MM/DD'))
cur = cur.add(1, 'day')
}
this.getHourList(dates)
return days
},
getHourList(days) {
const hours = [], today = new Date();
for (let hour = 0; hour < today.getHours() + 1; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
this.getMinuteList(days, hours)
buildHourList (isToday) {
const len = isToday ? dayjs().hour() + 1 : 24
return Array.from({ length: len }, (_, i) => String(i).padStart(2, '0'))
},
getMinuteList(days, hours) {
const minutes = [];
const today = new Date()
for (let minute = 0; minute < today.getMinutes() + 1; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
// 设置默认时间
let { dateValues, hourValues, minuteValues } = this
const HOUR_STR = today.getHours().toString().padStart(2, '0')
const MUNTUE_STR = today.getMinutes().toString().padStart(2, '0')
// const defalutHIndex = hours.indexOf(HOUR_STR)
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
dateValues.push(days.length + 1)
hourValues.push(hours.length + 1)
minuteValues.push(minutes.length + 1)
this.currentDate = dayjs().format('YYYY/MM/DD')
this.currentHour = HOUR_STR
this.currentMinute = MUNTUE_STR
this.hours = hours
this.days = days
this.minutes = minutes
buildMinuteList (isToday, hour) {
const now = dayjs()
const isCurrentHour = isToday && hour === now.format('HH')
const len = isCurrentHour ? now.minute() + 1 : 60
return Array.from({ length: len }, (_, i) => String(i).padStart(2, '0'))
},
pickIndex (list, value, fallbackLast) {
const index = list.indexOf(value)
if (index >= 0) return index
return fallbackLast ? Math.max(list.length - 1, 0) : 0
},
applyPickerValues (dateValues, hourValues, minuteValues) {
this.$nextTick(() => {
this.dateValues = dateValues
this.hourValues = hourValues
this.minuteValues = minuteValues
this.loading = false
setTimeout(() => {
this.minuteValues = minuteValues
this.loading = false
}, 100)
this.ready = true
this.$emit('onComplete')
})
},
changeDate(e) {
const { days } = this
const { value } = e.detail
const index = value[0]
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
changeHour(e) {
const { hours, days, dateValues } = this
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
changeMinutes(e) {
const { minutes } = this
const { value } = e.detail
const index = value[0]
this.currentMinute = minutes[index]
},
getAllTimeOrPartTime(type) {
const today = new Date()
const hours = [], minutes = [], hour_len = type == 1 ? 24 : today.getHours() + 1, minute_len = type == 1 ? 60 : today.getMinutes() + 1;
for (let hour = 0; hour < hour_len; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
initDate () {
const days = this.buildDayList()
if (!days.length) {
this.days = []
this.hours = []
this.minutes = []
this.ready = false
this.$emit('onComplete')
return
}
const today = dayjs()
const todayStr = today.format('YYYY/MM/DD')
const currentDate = todayStr
const currentHour = today.format('HH')
const currentMinute = today.format('mm')
const hours = this.buildHourList(true)
const minutes = this.buildMinuteList(true, currentHour)
this.currentDate = currentDate
this.currentHour = currentHour
this.currentMinute = currentMinute
this.days = days
this.hours = hours
this.minutes = minutes
this.applyPickerValues(
[this.pickIndex(days, currentDate, true)],
[this.pickIndex(hours, currentHour, true)],
[this.pickIndex(minutes, currentMinute, true)]
)
},
getAllTimeOrPartTimeMinute(type) {
const today = new Date()
const currentHour = today.getHours()
const timeType = this.currentHour != currentHour ? 1 : 0
const minutes = [], minute_len = type == 1 || timeType == 1 ? 60 : today.getMinutes() + 1;
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
changeDate (e) {
const index = e.detail.value[0]
const date = this.days[index]
if (!date) return
this.currentDate = date
const isToday = this.currentDate === dayjs().format('YYYY/MM/DD')
this.hours = this.buildHourList(isToday)
if (!this.hours.includes(this.currentHour)) {
this.currentHour = this.hours[this.hours.length - 1]
}
const minutes = this.buildMinuteList(isToday, this.currentHour)
this.minutes = minutes
if (!this.minutes.includes(this.currentMinute)) {
this.currentMinute = this.minutes[this.minutes.length - 1]
}
this.$nextTick(() => {
this.hourValues = [this.pickIndex(this.hours, this.currentHour, true)]
this.minuteValues = [this.pickIndex(this.minutes, this.currentMinute, true)]
})
},
getResult() {
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute
// + ":00"
const result = dayjs(str).format('YYYY-MM-DD HH:mm')
return result
changeHour (e) {
const index = e.detail.value[0]
const hour = this.hours[index]
if (hour == null) return
this.currentHour = hour
const isToday = this.currentDate === dayjs().format('YYYY/MM/DD')
this.minutes = this.buildMinuteList(isToday, this.currentHour)
if (!this.minutes.includes(this.currentMinute)) {
this.currentMinute = this.minutes[this.minutes.length - 1]
}
this.$nextTick(() => {
this.minuteValues = [this.pickIndex(this.minutes, this.currentMinute, true)]
})
},
changeMinutes (e) {
const index = e.detail.value[0]
const minute = this.minutes[index]
if (minute == null) return
this.currentMinute = minute
},
getResult () {
const str = `${this.currentDate} ${this.currentHour}:${this.currentMinute}:00`
return dayjs(str.replace(/-/g, '/')).format('YYYY/MM/DD HH:mm:ss')
}
}
}
......@@ -193,11 +174,9 @@ export default {
height: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
.picker {
height: 100%;
text-align: center;
.view {
display: flex;
align-items: center;
......@@ -206,7 +185,6 @@ export default {
height: toRpx(72);
}
}
/deep/.indicator {
height: toRpx(72);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!