123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- <template>
- <view class="pad16">
- <view class="getuserInfo">
- <view class="getuserInfoimg">
- <u--image :src="src" width="96rpx" height="96rpx" style="border-radius: 4px;"></u--image>
- </view>
- <view class="getuserInfoname">
- <h3>{{getuserInfo.realName}}</h3>
- <view>安保组</view>
- </view>
- <view class="getuserInfophone">
- <view class="getuserInfophone1">
- <u-icon name="phone" color="#2979ff" size="36"></u-icon>
- </view>
- <view class="getuserInfophone2">{{getuserInfo.mobile}}</view>
- </view>
- </view>
- <!--打卡-->
- <view class="Punchin">
- <view class="dakaweizhi">
- <view class="dakaweizhi1">
- <u-icon name="map" color="#6DD400" size="36"></u-icon>
- </view>
- <view class="dakaweizhi2">当前打卡位置:{{Punchposition}}</view>
- </view>
- <view class="shexiangji" @click="Punchindata">
- <view class="shexiangji1">扫码打卡</view>
- <view class="shexiangji2">
- <u-icon name="camera" color="#ffffff" size="90"></u-icon>
- </view>
- </view>
- </view>
- <view class="dakajilv">今日打卡记录</view>
- <view class="u-listdata">
- <view style="padding:16rpx 0 16rpx 32rpx">
- 共有 <span style="color: red">{{totalnumber}}</span>条记录
- </view>
- <u-list @scrolltolower="scrolltolower" :pagingEnabled='true' style="height: 100px;flex:1;">
- <u-list-item v-for="(item, index) in indexList" :key="index">
- <view class="companylist">
- <h3>{{item.position}}</h3>
- <view class="Currentamount">
- 巡检时间:{{item.circuitTime}}
- </view>
- </view>
- </u-list-item>
- </u-list>
- </view>
- <u-notify ref="uNotify" message=""></u-notify>
- </view>
- </template>
- <script>
- import {
- getCurrentTime
- } from "@/utils/index";
- export default {
- data() {
- return {
- Punchposition: '',
- getuserInfo: {},
- pd: true,
- totalnumber: 0,
- indexList: [],
- src: 'https://cdn.uviewui.com/uview/album/1.jpg',
- dataForm: {
- page: 1,
- limit: 99999,
- circuitType: "",
- startDate: "",
- endDate: "",
- buildingId: "",
- storeyId: "",
- circuitPersonId: "",
- },
- }
- },
- //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
- onLoad() {
- this.getuserInfo = uni.getStorageSync('getuserInfo');
- var date = new Date();
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate();
- // this.circuitPosition = this.$route.query.circuitPosition;
- this.dataForm.startDate = `${year}-${month}-${day}` + " 00:00:00";
- this.dataForm.endDate = `${year}-${month}-${day}` + " 23:59:59";
- this.dataForm.circuitPersonId = this.getuserInfo.id;
- // this.dataForm.circuitType = this.userInfo.circuitType;
- this.getDataList();
- },
- //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
- onReady() {},
- //监听页面隐藏
- onHide() {},
- //监听窗口尺寸变化
- onResize() {},
- //监听页面卸载
- onUnload() {},
- //监听用户下拉动作,一般用于下拉刷新
- onPullDownRefresh() {},
- methods: {
- goback() {
- uni.navigateTo({
- url: '/pages/index/index'
- })
- },
-
- Punchindata() {
- uni.scanCode({
- //是否只能从相机扫码,不能从相册扫码
- onlyFromCamera: false,
- //规定扫码类型 字节跳动小程序不支持此参数
- // barcode就是一维码(条形码) qrcode就是(er)维码
- // datamatrix就是Data Matrix码 pdf417就是PDF417条码
- scanType: ['barCode', 'qrCode', ],
- // 是否启动自动识别字符编码功能
- autoDecodeCharset: false,
- // 是否开启自动放大功能 仅 App-Android (3.5.4+) 支持
- autoZoom: false,
- // 是否支持手动输入条形码 仅飞书小程序(V3.14.0)支持
- barCodeInput: false,
- success: (res) => {
- let lsdata =res.result;
- if(lsdata.indexOf('houseId')=='-1'){
- //没有房间号
- this.Punchposition = lsdata.substr(lsdata.indexOf('position')+11,lsdata.indexOf('projectId')-(lsdata.indexOf('position')+14));
- let postdata = {
- "buildingId":lsdata.substr(lsdata.indexOf('buildingId')+12,19), //楼宇id
- "storeyId":lsdata.substr(lsdata.indexOf('storeyId')+10,19), //楼层id
- "houseId":'', //房间id
- "position": this.Punchposition, //位置信息
- "circuitPersonId": this.getuserInfo.id, //巡检人员id
- "circuitTime": getCurrentTime(), //巡检时间
- // "circuitType": this.getuserInfo.circuitType,//巡检类型
- "circuitType": '', //巡检类型
- "remark": lsdata.substr(lsdata.indexOf('remark')+8,lsdata.indexOf('buildingId')-(lsdata.indexOf('remark')+10)), //备注
- }
-
- this.$api.post('/circuitrecord', postdata)
- .then(res => {
- if (res.data.code == 0) {
- this.$refs.uNotify.success('打卡成功')
- this.getDataListtwo();
-
- } else {
- this.$refs.uNotify.error('打卡失败')
- }
- })
-
- }else{
- this.Punchposition = lsdata.substr(lsdata.indexOf('position')+11,lsdata.indexOf('projectId')-(lsdata.indexOf('position')+14));
- let postdata = {
- "buildingId":lsdata.substr(lsdata.indexOf('buildingId')+12,19), //楼宇id
- "storeyId":lsdata.substr(lsdata.indexOf('storeyId')+10,19), //楼层id
- "houseId":lsdata.substr(lsdata.indexOf('houseId')+9,19), //房间id
- "position": this.Punchposition, //位置信息
- "circuitPersonId": this.getuserInfo.id, //巡检人员id
- "circuitTime": getCurrentTime(), //巡检时间
- // "circuitType": this.getuserInfo.circuitType,//巡检类型
- "circuitType": '', //巡检类型
- "remark": lsdata.substr(lsdata.indexOf('remark')+8,lsdata.indexOf('buildingId')-(lsdata.indexOf('remark')+10)), //备注
- }
-
- this.$api.post('/circuitrecord', postdata)
- .then(res => {
- if (res.data.code == 0) {
- this.$refs.uNotify.success('打卡成功')
- this.getDataListtwo();
-
- } else {
- this.$refs.uNotify.error('打卡失败')
- }
- })
- }
-
-
- },
- fail: (error) => {
- this.$refs.uNotify.error(error)
- }
- })
- },
- getDataListtwo() {
- this.dataForm.page = 1;
- this.$api.get('/circuitrecord/page', this.dataForm)
- .then(res => {
- this.totalnumber = res.data.data.total;
- this.indexList = res.data.data.list;
- })
- },
- scrolltolower() {
- if (this.pd) {
- this.getalldata();
- } else {
- return
- }
- },
- getDataList() {
- this.$api.get('/circuitrecord/page', this.dataForm)
- .then(res => {
- //console.log('111111111111111111',res.data.data)
- this.totalnumber = res.data.data.total;
- if (res.data.data.list.length != 0) {
- this.indexList.push(...res.data.data.list);
- this.dataForm.page = this.dataForm.page + 1;
- this.pd = true;
- } else {
- uni.showToast({
- title: '暂无更多数据了',
- icon: 'none',
- duration: 1500
- })
- this.pd = false;
- }
- })
- },
- }
- }
- </script>
- <style lang="scss">
- page{height:100%}
- .pad16{
- height:100%;
- padding: 32rpx;
- display: flex;
- flex-direction: column;
- }
- .u-listdata{height:100px;flex:1;display:flex;flex-direction: column;}
- .dakajilv {
- color: #666;
- font-size: 32rpx;
- padding-left: 30rpx;
- }
- .Currentamount {
- padding-left: 30rpx;
- height: 50rpx;
- line-height: 50rpx;
- color: #BCB3A7;
- span {
- color: #FA5555;
- padding-left: 9rpx;
- }
- }
- .topname {
- height: 44px;
- width: 750rpx;
- display: flex;
- align-items: center;
- }
- .companylist {
- margin: 20rpx 30rpx;
- background: #fff;
- height: 140rpx;
- border-radius: 10px;
- position: relative;
- h3 {
- height: 70rpx;
- line-height: 70rpx;
- padding-left: 30rpx;
- }
- }
- .settled {
- background-color: #09C700;
- width: 100rpx;
- height: 40rpx;
- text-align: center;
- line-height: 40rpx;
- color: #fff;
- font-size: 14rpx;
- position: absolute;
- top: 0px;
- right: 0px;
- border-top-right-radius: 10rpx;
- border-bottom-left-radius: 10rpx;
- }
- .outstanding {
- background-color: #30D3A2;
- width: 100rpx;
- height: 40rpx;
- text-align: center;
- line-height: 40rpx;
- color: #fff;
- font-size: 14rpx;
- position: absolute;
- top: 0px;
- right: 0px;
- border-top-right-radius: 10rpx;
- border-bottom-left-radius: 10rpx;
- }
- .billall {}
- .topbill {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100rpx;
- background-color: #e6e6e6;
- }
- .topbilledit {
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .changetime1 {
- padding-right: 10rpx;
- }
- .shexiangji1 {
- color: #fff;
- font-size: 36rpx;
- font-weight: bold;
- }
- .shexiangji {
- width: 300rpx;
- height: 300rpx;
- border-radius: 50%;
- background: #5C8FFF;
- margin: 0 auto;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- }
- .dakaweizhi2 {
- color: #999;
- font-size: 26rpx;
- }
- .dakaweizhi {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 690rpx;
- height: 270rpx;
- }
- .Punchin {
- width: 690rpx;
- margin: 32rpx auto 40rpx;
- background: #fff;
- height: 690rpx;
- }
- .getuserInfo {
- display: flex;
- background: #fff;
- border-radius: 4px;
- padding: 24rpx 32rpx;
- }
- .getuserInfoimg {
- margin-right: 24rpx;
-
- }
- .getuserInfoname {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin-right: 20rpx;
- h3 {
- color: #333;
- font-size: 32rpx;
- }
- view {
- color: #999;
- font-size: 24rpx;
- }
- }
- .getuserInfophone {
- display: flex;
- align-items: flex-start;
- }
- .getuserInfophone2 {
- color: #666;
- font-size: 28rpx;
- }
- </style>
|