parent
9f3535ad8d
commit
0aa8e81cce
@ -0,0 +1,58 @@
|
|||||||
|
import moment from "moment"
|
||||||
|
const app = getApp()
|
||||||
|
Component({
|
||||||
|
data: {
|
||||||
|
timelist: [],
|
||||||
|
sStartTime: '',
|
||||||
|
sEndTime: '',
|
||||||
|
sTimeType: '34',
|
||||||
|
intervalSel: 0,
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached() {
|
||||||
|
this.getData().then(() => {
|
||||||
|
let st = wx.getStorageSync('sTimeType2') || ''
|
||||||
|
if (st) {
|
||||||
|
let n = this.data.timelist.findIndex(ele => ele.key == st);
|
||||||
|
this.setData({
|
||||||
|
intervalSel: n
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.setStorageSync('sTimeType2', 34);
|
||||||
|
// wx.setStorageSync('sStartTime', '');
|
||||||
|
// wx.setStorageSync('sEndTime', '');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getData() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
app.globalData.request({
|
||||||
|
action: "getTime"
|
||||||
|
}).then(res => {
|
||||||
|
let arr = res || [];
|
||||||
|
this.setData({
|
||||||
|
timelist: arr
|
||||||
|
})
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
priceSel(e) {
|
||||||
|
let row = e.currentTarget.dataset.row;
|
||||||
|
let n = this.data.timelist.findIndex(ele => ele.key == row.key);
|
||||||
|
this.setData({
|
||||||
|
intervalSel: n
|
||||||
|
})
|
||||||
|
wx.setStorageSync('sTimeType2', row.key);
|
||||||
|
let start = "";
|
||||||
|
let end = "";
|
||||||
|
this.triggerEvent('change', {
|
||||||
|
sTimeType: row.key,
|
||||||
|
sStartTime: start,
|
||||||
|
sEndTime: end
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"component": true
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
<view class="timelist">
|
||||||
|
<view wx:for="{{timelist}}" class="{{index === intervalSel?'active':''}}" wx:key="index" data-row="{{item}}" bindtap="priceSel">{{item.value}}
|
||||||
|
</view>
|
||||||
|
</view>
|
@ -0,0 +1,46 @@
|
|||||||
|
.timelist {
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
margin:0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
background: white;
|
||||||
|
justify-content:space-between;
|
||||||
|
padding-left: 8rpx;
|
||||||
|
padding-right: 8rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timelist view {
|
||||||
|
text-align: center;
|
||||||
|
color: #999999;
|
||||||
|
font-size: 24rpx;
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timelist .active {
|
||||||
|
color: #027AFF;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
font-weight: bolder;
|
||||||
|
width: 166rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
line-height: 64rpx;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
}
|
||||||
|
.tc-d-t {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 15px 0px;
|
||||||
|
color: #909497;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.tp-btn {
|
||||||
|
color: #fff;
|
||||||
|
background: #1B89FA;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
Loading…
Reference in new issue