From 5ceb922ffb15d380b77f5ea8802085165b2b133a Mon Sep 17 00:00:00 2001
From: aihe <961836564@qq.com>
Date: Mon, 15 Jul 2024 23:18:27 +0800
Subject: [PATCH] uu
---
.../buns-revtime-sheet/buns-revtime-sheet.vue | 66 ++++++++++++++-----
pages/post/model.js | 4 +-
pages/post/post.vue | 7 +-
3 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/components/buns-revtime-sheet/buns-revtime-sheet.vue b/components/buns-revtime-sheet/buns-revtime-sheet.vue
index b7f89ea..bec8f67 100644
--- a/components/buns-revtime-sheet/buns-revtime-sheet.vue
+++ b/components/buns-revtime-sheet/buns-revtime-sheet.vue
@@ -59,8 +59,25 @@
import { setClipboardData } from "@/common/untool"
import { numberToChinese } from "@/common/util"
import dayjs from 'dayjs'
+
+ let dayFormat = 'YYYY-MM-DD'
+ let dateTimeFormat = 'YYYY-MM-DD HH:mm:ss'
+
export default {
+ watch:{
+ show: {
+ handler: function(cval, oval) {
+ cval && this.initData()
+ },
+ deep: true
+ }
+ },
computed: {
+ modelInfo: {
+ get(){
+ return this.value
+ }
+ },
timeFilterList() {
const _this = this
let list = []
@@ -77,9 +94,9 @@
},
value: {
default () {
- return ''
+ return { }
}
- }
+ },
},
data() {
return {
@@ -106,15 +123,20 @@
methods: {
initData() {
this.makeList()
+ let { pickStartDate, pickFinishDate } = this.modelInfo || {}
// 默认值
this.model.date = this.dayList[0].val
+ if(pickStartDate && pickFinishDate) {
+ this.model.date = dayjs(pickStartDate).format(dayFormat)
+ this.model.time = `${pickStartDate}~${pickFinishDate}`
+ }
},
makeList() {
const _this = this
const now = dayjs(new Date())
- const nowDate = dayjs(now).format('YYYY-MM-DD')
- const plus1Date = dayjs(nowDate).add(1, 'day').format('YYYY-MM-DD')
- const plus2Date = dayjs(nowDate).add(2, 'day').format('YYYY-MM-DD')
+ const nowDate = dayjs(now).format(dayFormat)
+ const plus1Date = dayjs(nowDate).add(1, 'day').format(dayFormat)
+ const plus2Date = dayjs(nowDate).add(2, 'day').format(dayFormat)
const nowHour = now.get("hours")
let dayList = [
{ title: '今天', val: nowDate },
@@ -129,17 +151,16 @@
start = nowHour + 1
}
for(var tIndex = start; tIndex <= end; tIndex ++) {
- let cTlt = '', cVal
- let timeStr = `${tIndex < 10?'0':''}${tIndex}:00`
- let timeNextStr = `${(tIndex + 1) < 10?'0':''}${(tIndex + 1)}:00`
- cVal = timeStr
- cTlt = `${timeStr}-${timeNextStr}`
+ let tItem = {}
+ tItem.startTime = dayjs(`${dItem.val} ${tIndex}`).format(dateTimeFormat)
+ tItem.endTime = dayjs(`${dItem.val} ${tIndex + 1}`).format(dateTimeFormat)
+
+ tItem.val = `${tItem.startTime}~${tItem.endTime}`
+ tItem.title = `${dayjs(tItem.startTime).format("HH:mm")}-${dayjs(tItem.endTime).format("HH:mm")}`
if(dIndex == 0 && tIndex == start) {
- cTlt = `${numberToChinese(start - nowHour)}小时内`
+ tItem.title = `${numberToChinese(start - nowHour)}小时内`
}
- timeList.push({
- title: cTlt , val: cVal
- })
+ timeList.push(tItem)
}
dItem.timeList = timeList
})
@@ -152,8 +173,21 @@
handleEditItem() {
const { date, time } = this.model
const value = `${date} ${time}`
- this.$emit('onChange', this.model)
- this.$emit('update:value', value)
+ let curItem
+ this.dayList.map(d=> {
+ if(d.val == date) {
+ d.timeList.map(t=> {
+ if(t.val == time) {
+ curItem = t
+ }
+ })
+ }
+ })
+ this.$emit('onChange', curItem)
+ if(curItem){
+ this.modelInfo.pickStartDate = curItem.startTime
+ this.modelInfo.pickFinishDate = curItem.endTime
+ }
this.handleCloseModal()
}
}
diff --git a/pages/post/model.js b/pages/post/model.js
index 09f937a..24cb5b9 100644
--- a/pages/post/model.js
+++ b/pages/post/model.js
@@ -45,8 +45,8 @@ export const getOrderModels = () => {
packType: 2, // 包装类型
dispatchMethod: undefined, // 派送方式
pickupMethod: undefined, // 取件方式
- pickStartDate: undefined,
- pickFinishDate: undefined,
+ pickStartDate: undefined, // 上门取货-开始时间
+ pickFinishDate: undefined,// 上门取货-结束时间
intoWarehouseCode: undefined, // 入仓仓库code
intoWarehouseName: undefined, // 仓库名称
intoWarehouseAddress: undefined, // 仓库地址
diff --git a/pages/post/post.vue b/pages/post/post.vue
index 1441bf4..4bc539d 100644
--- a/pages/post/post.vue
+++ b/pages/post/post.vue
@@ -59,7 +59,10 @@
预计入仓时间
- {{ '' || '请选择'}}
+
+ {{submitParam.pickStartDate}}
+
+ 请选择
@@ -153,7 +156,7 @@
-
+