From f07b70558d5b84f1070470229037629bc1ace006 Mon Sep 17 00:00:00 2001 From: wjt <1797368093@qq.com> Date: 星期六, 22 六月 2024 14:39:30 +0800 Subject: [PATCH] 接口对接 --- policy/scodePage/scodePage.vue | 114 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 83 insertions(+), 31 deletions(-) diff --git a/policy/scodePage/scodePage.vue b/policy/scodePage/scodePage.vue index 6ca01de..813ed64 100644 --- a/policy/scodePage/scodePage.vue +++ b/policy/scodePage/scodePage.vue @@ -29,66 +29,118 @@ <image src="/static/policy/qrcode-border.png" class="border" mode="widthFix"></image> <image :src="uqrcodeImage" mode="widthFix" class="qrcode-1"></image> <view class="code-time"> - <text>鎵爜鏃堕棿锛�</text>2024-05-12 12:00 + <text>鎵爜鏃堕棿锛�</text>{{$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')}} </view> </view> <view class="code"> <view class="item"> <text class="label">鎵ф硶浜哄憳</text> - <text class="value">鐜嬪皬涓�</text> + <text class="value">{{userInfo.nickName}}</text> </view> <view class="write-border"></view> <view class="item"> <text class="label">鎵ф硶閮ㄩ棬</text> - <text class="value">宸ュ晢绠$悊灞�</text> + <text class="value">{{userInfo.dept.deptName}}</text> </view> </view> <view class="hint-text"> - 褰撳墠浼佷笟瀛樺湪<text>1</text>鏉℃湭瀹屾垚鐨勬墽娉曚换鍔� + 褰撳墠浼佷笟瀛樺湪<text>{{list.length}}</text>鏉℃湭瀹屾垚鐨勬墽娉曚换鍔� </view> + <!-- <view class="hint-text"> + 褰撳墠浼佷笟鏈畬鎴愮殑鎵ф硶浠诲姟 + </view> --> <view class="down-block"> - <view class="box"> - <view class="title">24骞�5鏈堢獊鍑绘鏌ユ秷闃插畨鍏�</view> - <view class="user-news"> - <text>鐜嬫�濋洦</text> - <view class="driver"></view> - <text>宸ュ晢绠$悊灞�</text> - </view> - <view class="font-13"> - <text>鎵ф硶瀵硅薄锛�</text>娌冲崡瑙夐啋绉戞妧鏈夐檺鍏徃 - </view> - <view class="border"></view> - <view class="font-12 margin-bottom"> - <text>鎵ф硶鏃堕棿锛�</text>2024-05-12 12:00 - </view> - <view class="font-12"> - <text>鐢宠鏃堕棿锛�</text>2024-05-12 12:00:12 - </view> - </view> + <swiper style="height: 500rpx;" :indicator-dots="false" :interval="3000" :duration="1000"> + <swiper-item v-for="(item,index) in list" :key="index"> + <view class="box"> + <view class="title">{{item.enforceReason}}</view> + <view class="user-news"> + <text>{{item.applyUser}}</text> + <view class="driver"></view> + <text>{{item.applyDeptName}}</text> + </view> + <view class="font-13"> + <text>鎵ф硶瀵硅薄锛�</text>{{item.companyName}} + </view> + <view class="border"></view> + <view class="font-12 margin-bottom"> + <text>鎵ф硶鏃堕棿锛�</text>{{item.planTime}} + </view> + <view class="font-12"> + <text>鐢宠鏃堕棿锛�</text>{{item.applyTime}} + </view> + <view class="button-entery"> + <view class="button" @click="doScanOrder(item.orderId)">纭鎵ф硶</view> + </view> + </view> + </swiper-item> + </swiper> </view> </view> - <uqrcode class="hide-canvas" :size="470" sizeUnit="rpx" v-if="companyCode" ref="uqrcode" canvas-id="qrcode" :value="companyCode" :options="{ backgroundColor: 'green',useDynamicSize: true, areaColor: '#ffffff', foregroundColor: '#ffffff' }"></uqrcode> + <uqrcode class="hide-canvas" :size="470" sizeUnit="rpx" v-if="companyCode" ref="uqrcode" canvas-id="qrcode" :value="companyCode" :options="{ backgroundColor: color,useDynamicSize: true, areaColor: '#ffffff', foregroundColor: '#ffffff' }"></uqrcode> </view> </template> <script> + import { getScanList, doScanOrder } from '@/api/policy.js' + import { getInfo } from '@/api/auth.js' export default { data() { return { - companyCode: 'code===', - uqrcodeImage: '' + companyCode: '', + uqrcodeImage: '', + list: [], + userInfo: {}, + color: '' } }, onReady() { - this.$refs.uqrcode.toTempFilePath({ - success: res => { - this.uqrcodeImage = res.tempFilePath - } - }); + + }, + onLoad(options) { + this.getScanList(options.code) + + this.getInfo() + }, + onShow() { + }, methods: { - + getScanList(companyCode){ + getScanList({companyCode}).then(val => { + this.list = val.data.data + if(this.list.length) { + this.color = 'green' + } else { + this.color = 'red' + } + this.companyCode = companyCode + setTimeout(() => { + this.$refs.uqrcode.toTempFilePath({ + success: res => { + this.uqrcodeImage = res.tempFilePath + } + }); + }, 500) + }) + }, + getInfo() { + getInfo().then(val => { + console.log(val.data.data) + this.userInfo = val.data.data + }) + }, + doScanOrder(item) { + doScanOrder(item).then(val => { + if(val.data.code == 200) { + uni.showToast({ + title: '纭鎵ф硶鎴愬姛', + icon: 'none' + }) + } + }) + } } } </script> -- Gitblit v1.9.1