You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
5.5 KiB

2 years ago
<template>
<view>
<u-popup v-model="show" mode="bottom">
<view class="date">
<view class="date-title">
<view>配送</view>
2 years ago
<view @click="closePop">
2 years ago
<u-icon name="close-circle-fill" color="#f0efed" size="32"></u-icon>
</view>
</view>
2 years ago
<view class="date-express">
<view v-for="(item,index) in express">
<view @click="chooseExpress(index,item)"
:class="{'date-express-item':true,'date-express-item_active':expressIndex==index}"
1 year ago
v-if="item.name">{{item.name}}</view>
2 years ago
</view>
</view>
<view class="date-stitle">送货时间</view>
<view class="date-list">
<view class="date-list-left">
<view v-for="(item,index) in data">
<view @click="chooseDate(index,item)"
:class="{'date-list-item':true,'date-list-item_active':dateIndex==index}" v-if="item">
{{item.ymd}}[{{item.week}}]
</view>
</view>
</view>
<view class="date-list-right">
1 year ago
<view class="lunarData" v-if="dateObj.lunarData">
2 years ago
{{dateObj.lunarData?dateObj.lunarData:''}}
1 year ago
<view>今日剩余可提货量{{dateObj.canUse.quantity - dateObj.canUse.booked}}</view>
2 years ago
</view>
<view class="hh">
1 year ago
<view @click="chooseHh(index,item)"
:class="{'hh-item':true,'hh-item_active':hhIndex==index}"
2 years ago
v-for="(item,index) in hhList">
{{item}}
</view>
</view>
</view>
</view>
<view class="date-btn">
<view @click="confirmPop"></view>
2 years ago
</view>
</view>
</u-popup>
</view>
</template>
1 year ago
<script>
import {
isEmptyObject,
isNull,
toast
} from "@/common/util.js"
2 years ago
export default {
props: {
// 日期
data: {
type: Array,
default () {
return []
}
},
// 快递
express: {
type: Array,
default () {
return []
}
}
},
data() {
return {
2 years ago
show: false,
1 year ago
expressIndex: -1,
expressObj: {},
2 years ago
dateIndex: -1,
dateObj: {},
hhList: ['09:00-15:00', '15:00-21:00'],
1 year ago
hhIndex: -1,
2 years ago
}
2 years ago
},
methods: {
1 year ago
chooseExpress(index, item) {
2 years ago
this.expressObj = item
this.expressIndex = index
},
chooseDate(index, item) {
this.dateIndex = index
this.dateObj = item
},
1 year ago
chooseHh(index, item) {
2 years ago
this.hhTime = item
this.hhIndex = index
1 year ago
},
closePop() {
this.show = false
},
confirmPop() {
if (isEmptyObject(this.dateObj)) {
toast('请选择日期')
return
}
if (isEmptyObject(this.expressObj)) {
toast('请选择快递')
return
}
if (isNull(this.hhTime)) {
toast('请选择时间')
return
}
// 将对象A的值插入到对象B中
for (const key in this.expressObj) {
if (this.expressObj.hasOwnProperty(key)) {
this.dateObj[`express${key}`] = this.expressObj[key];
}
}
this.dateObj.hhtime = this.hhTime
this.$emit('refresh', this.dateObj)
this.show = false
console.log("this.dateObj", this.dateObj)
2 years ago
},
2 years ago
}
}
</script>
2 years ago
<style lang="scss" scoped>
.u-drawer-content-visible {
border-radius: 30rpx 30rpx 0 0;
2 years ago
}
2 years ago
2 years ago
.date {
padding: 35rpx 0;
padding-right: 35rpx;
2 years ago
padding-bottom: 0;
2 years ago
&-title {
font-size: 32rpx;
color: #000;
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 35rpx;
2 years ago
}
&-express {
padding-left: 35rpx;
display: flex;
align-items: center;
margin-top: 35rpx;
margin-bottom: 15rpx;
&-item {
font-size: 24rpx;
color: #000;
background-color: #f0efed;
height: 57rpx;
line-height: 55rpx;
text-align: center;
min-width: 180rpx;
border: 1px solid transparent;
border-radius: 30rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
&-item_active {
color: #ba8b45;
background-color: #fef8ee;
border: 1px solid #ba8b45;
}
}
&-stitle {
font-size: 24rpx;
color: #000;
padding-left: 35rpx;
margin-bottom: 35rpx;
}
&-list {
display: flex;
height: 510rpx;
&-left {
width: 235rpx;
height: 510rpx;
overflow-y: scroll;
font-size: 0;
}
&-item {
font-size: 24rpx;
color: #787877;
background-color: #f0efed;
width: 235rpx;
height: 72rpx;
text-align: center;
line-height: 72rpx;
}
&-item_active {
background-color: #fff;
color: #000;
}
&-right {
width: calc(100% - 235rpx);
padding-top: 15rpx;
padding-left: 75rpx;
font-size: 24rpx;
color: #000;
.lunarData {
1 year ago
line-height: 45rpx;
margin-bottom: 20rpx;
2 years ago
}
.hh {
&-item {
border: 1px solid #f4f4f4;
border-radius: 10rpx;
height: 80rpx;
line-height: 80rpx;
width: 80%;
padding-left: 45rpx;
margin-bottom: 20rpx;
background-color: #fff;
}
&-item_active {
border: 1px solid #d1b384;
color: #ba8b45;
background-color: #fef8ee;
box-shadow: 0px 0px 8rpx #d1b384;
}
}
}
}
&-btn {
width: calc(100% + 35rpx);
text-align: center;
display: flex;
justify-content: center;
padding: 30rpx 0;
>view {
color: #f0efed;
font-size: 30rpx;
text-align: center;
width: 70%;
height: 75rpx;
line-height: 75rpx;
background-color: #ba8b45;
border-radius: 36rpx;
}
2 years ago
}
}
</style>