This commit is contained in:
aihe 2024-07-15 23:18:27 +08:00
parent af1c5cc3c2
commit 5ceb922ffb
3 changed files with 57 additions and 20 deletions

View File

@ -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()
}
}

View File

@ -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, // 仓库地址

View File

@ -59,7 +59,10 @@
<view v-else>预计入仓时间</view>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
{{ '' || '请选择'}}
<view v-if="submitParam.pickStartDate && submitParam.pickFinishDate">
{{submitParam.pickStartDate}}
</view>
<view v-else>请选择</view>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
@ -153,7 +156,7 @@
</template>
</tpx-layout>
<buns-revtime-sheet v-model:show="revtimeModal.show" v-model:value="submitParam.revtime"></buns-revtime-sheet>
<buns-revtime-sheet v-model:show="revtimeModal.show" v-model:value="submitParam"></buns-revtime-sheet>
<buns-edit-sheet percentHeight="70" title="货物信息" v-model:show="goodChooseModal.show" v-model:value="submitParam" v-slot="tempObject" @onSure="handleGoodInfoSure">
<view class="">