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.
yanzong_qianduan/pages/news/recycling/timer.vue

246 lines
5.1 KiB

10 months ago
<template>
<view class="recycling">
<scroll-view scroll-x class="recycling-hd">
10 months ago
<view class="item" v-for="(i,index) in dataList" :key="i" :class="tabIndex == index?'item-on':''"
@click="tabItem(index,i)">
<text>{{i.name}}</text>{{i.date}}
</view>
</scroll-view>
<view class="recycling-bd">
10 months ago
<view class="item" :style="i.status==1?'color:#212121':'color:#999'" v-for="(i,index) in timeList" :key="i"
:class="(tabIndex1 == index &&i.status==1)?'item-on':''" @click="tabItem1(index,i)">
{{i.value}}
<text>{{i.status==1?'可约':'不可约'}}</text>
</view>
10 months ago
</view>
<view class="recycling-fd">
<view class="a">
<u-divider>实际到达时间可能会有30分钟浮动</u-divider>
</view>
<view class="b" @click="onSend()">确定选择</view>
</view>
</view>
</template>
<script>
import * as newFunApi from '@/api/newFun'
export default {
data() {
return {
tabIndex1: 1,
10 months ago
tabIndex: 0,
dataList: [],
timeList: [],
infor: {},
time: '',
type: 3
10 months ago
}
},
onLoad(op) {
if(op.infor){
this.infor = op.infor ? JSON.parse(decodeURIComponent(op.infor)) : ''
}
this.type = op.type?op.type:""
10 months ago
this.getstopTimes(op.shop_id)
},
methods: {
10 months ago
async onSend() {
if (!this.time) {
uni.showToast({
title: '请选择时间',
icon: 'none'
})
return
}
if(this.type == 1){
uni.setStorageSync("yuyueTime",this.infor.yuyueTime)
uni.navigateBack({
delta: 1
})
return ;
}
10 months ago
let {
status,
message,
data
} = await newFunApi.updateOrder(this.infor);
if (status == 200) {
uni.reLaunch({
url: "/pages/news/recycling/recoveryList"
10 months ago
})
}
},
/**
* 时间
*/
async getstopTimes(shop_id) {
const that = this;
10 months ago
let {
status,
message,
data
} = await newFunApi.stopTimes({
shop_id: shop_id
});
if (status == 200) {
let arr = []
if(data && data.length> 0){
data.map(a=>{
if(a.list && a.list.length > 0){
a.list.map(b=>{
b.date = a.date
})
}
})
}
if(this.type == 1 && uni.getStorageSync("yuyueTime").time){
if(data && data.length> 0){
data.map((a,idx)=>{
if(a.date == uni.getStorageSync("yuyueTime").date){
that.tabIndex = idx
}
if(a.list && a.list.length > 0){
a.list.map((b,idx1)=>{
if(b.value == uni.getStorageSync("yuyueTime").value){
that.tabIndex1 = idx1
}
})
}
})
}
}
10 months ago
this.dataList = data;
this.timeList = data[this.tabIndex].list
10 months ago
}
},
tabItem1(i, item) {
this.tabIndex1 = i
10 months ago
this.time = item.value
this.infor.server_time = item.time
this.infor.yuyueTime = item
},
10 months ago
tabItem(index, item) {
this.tabIndex = index;
this.timeList = item.list
},
10 months ago
}
}
</script>
<style lang="scss" scoped>
.recycling {
min-height: 100vh;
padding-bottom: 210rpx;
overflow: hidden;
10 months ago
&-hd {
padding: 30rpx;
background-color: #FFFFFF;
white-space: nowrap;
box-sizing: border-box;
10 months ago
.item {
width: 220rpx;
height: 130rpx;
text-align: center;
font-size: 26rpx;
border-radius: 12rpx;
display: inline-block;
margin-left: 20rpx;
color: #5c5c5c;
border: 1px solid #f5f5f5;
background-color: #f5f5f5;
10 months ago
text {
display: block;
font-size: 30rpx;
margin-top: 20rpx;
margin-bottom: 10rpx;
}
10 months ago
&:first-child {
margin-left: 0;
}
10 months ago
&-on {
border-color: #fdeded;
color: #D22C24;
background-color: #fdeded;
}
}
10 months ago
}
&-bd {
overflow: hidden;
10 months ago
.item {
width: 160rpx;
height: 90rpx;
text-align: center;
font-size: 28rpx;
color: #212121;
border-radius: 10rpx;
float: left;
margin-left: 20rpx;
margin-top: 30rpx;
background-color: #FFFFFF;
line-height: 90rpx;
text-align: center;
position: relative;
overflow: hidden;
border: 1px solid #FFFFFF;
10 months ago
text {
position: absolute;
right: 0;
top: 0;
display: block;
10 months ago
padding: 0 5rpx;
line-height: 30rpx;
10 months ago
background: #F3E7D7;
font-size: 20rpx;
font-weight: 500;
color: #B18A55;
border-radius: 0 5rpx 0 5rpx;
}
10 months ago
&-on {
border-color: #D22C24;
background-color: #FDEDED;
color: #D22C24;
}
}
}
10 months ago
&-fd {
width: 100%;
height: 200rpx;
background-color: #FFFFFF;
padding: 15rpx 25rpx;
box-sizing: border-box;
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
.a {
font-size: 28rpx;
font-weight: 400;
color: #727272;
}
.b {
width: 100%;
height: 90rpx;
line-height: 90rpx;
background: #D22C24;
border-radius: 90rpx;
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #FFFFFF;
margin: 0 auto;
10 months ago
margin-top: 20rpx;
}
}
}
</style>