<template>
<view class="machine-info">
<u-navbar title="Machine详情" background-color="#2979ff" color="#fff">
<u-navbar-left>
<u-icon name="back" color="#fff" @click="goBack"></u-icon>
</u-navbar-left>
</u-navbar>
<view class="machine-card">
<view class="info-item">
<view class="item-label">编号:</view>
<view class="item-value">{{ machine_no }}</view>
</view>
<view class="info-item">
<view class="item-label">时间:</view>
<view class="item-value">{{ info.created_at }}</view>
</view>
<view class="info-item">
<view class="item-label">备注:</view>
<view class="item-value">{{ info.remark }}</view>
</view>
</view>
<view>
<u-button type="primary" size="small" text="history" style="width: 100rpx;" @click="showHistory"></u-button>
</view>
<u-calendar :show="show" :mode="mode" @confirm="confirm" @close="close"></u-calendar>
</view>
</template>
<script>
export default {
data() {
return {
machine_no: 0,
info: {},
show: false,
mode: 'single'
};
},
methods: {
showHistory() {
this.show = true
},
close(e) {
console.log("关闭");
this.show = false
},
confirm(e) {
let date = e[0]
uni.navigateTo({
url: "/pages/machine/history?date=" + date + "&machine_no=" + this.machine_no
});
},
goBack() {
uni.navigateBack();
},
getMachine() {
uni.request({
url: this.$baseUrl + "/api/machine?machine_no="+this.machine_no,
success: (res) => {
console.log('show info', res.data);
this.info = res.data.data;
}
});
},
},
onShow() {
this.machine_no = this.$route.query.machine_no
this.getMachine(this.machine_no)
},
};
</script>