This commit is contained in:
李彪 2025-04-30 13:01:47 +08:00
parent b6c8c07cf0
commit 3c78631953
3 changed files with 128 additions and 170 deletions

View File

@ -37,57 +37,57 @@
</view> </view>
</template> </template>
<script> <script>
import { GetHomeDataApi } from "@/api/apiAdmin"; import { GetHomeDataApi } from '@/api/apiAdmin'
export default { export default {
data() { data() {
return { return {
form: { form: {
"regionCount": 0, regionCount: 0,
"areaCount": 0, areaCount: 0,
"bindnfc": 0, bindnfc: 0,
"noBindnfc": 0 noBindnfc: 0
} }
}; }
}, },
mounted() { mounted() {
uni.hideLoading(); // Loading uni.hideLoading() // Loading
}, },
onLoad() { }, onLoad() {},
onShow() { onShow() {
this.getDataFn() this.getDataFn()
}, },
methods: { methods: {
async getDataFn() { async getDataFn() {
const res = await GetHomeDataApi(); const res = await GetHomeDataApi()
console.log(res, "首页数据"); console.log(res, '首页数据')
Object.assign(this.form, res.data); this.form = Object.assign(this.form, res.data)
}, },
testFn() { testFn() {
let u = navigator.userAgent; let u = navigator.userAgent
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try { try {
if (isAndroid && AndroidJs) { if (isAndroid && AndroidJs) {
console.log("%c%s", "color:red", "安卓--调用方法"); console.log('%c%s', 'color:red', '安卓--调用方法')
const reqRow = { const reqRow = {
name: "input", name: 'input',
data: "", data: ''
}; }
AndroidJs.func(JSON.stringify(reqRow)); // AndroidJs.func(JSON.stringify(reqRow)) //
} else { } else {
console.log("%c%s", "color:red", "苹果--调用方法"); console.log('%c%s', 'color:red', '苹果--调用方法')
const reqRow = { const reqRow = {
name: "back-iphone", name: 'back-iphone',
data: "", data: ''
}; }
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // ios window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)) // ios
} }
} catch (e) { } catch (e) {
console.log(e, "e-----判断安卓苹果类型出错"); console.log(e, 'e-----判断安卓苹果类型出错')
} }
}, }
}, }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {

View File

@ -40,6 +40,7 @@
<u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty> <u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty>
</scroll-view> </scroll-view>
</view> </view>
<!-- 筛选的下拉 --> <!-- 筛选的下拉 -->
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet> <u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<!-- 弹窗 --> <!-- 弹窗 -->

View File

@ -1,19 +1,9 @@
<template> <template>
<view class="content"> <view class="content">
<u-navbar <u-navbar :is-back="false" title="" :background="{ backgroundColor: '#DFEEFD' }" :border-bottom="false">
:is-back="false"
title=""
:background="{ backgroundColor: '#DFEEFD' }"
:border-bottom="false"
>
<view class="slot-wrap"> <view class="slot-wrap">
<u-dropdown :title-size="42" active-color="#211D2F"> <u-dropdown :title-size="42" active-color="#211D2F">
<u-dropdown-item <u-dropdown-item v-model="dropdownValue" :title="dataInfo.planName" :options="dropdownOptions" @change="changeDropdown"></u-dropdown-item>
v-model="dropdownValue"
:title="dataInfo.planName"
:options="dropdownOptions"
@change="changeDropdown"
></u-dropdown-item>
</u-dropdown> </u-dropdown>
<view class="back-icon" @click="backFn"> <view class="back-icon" @click="backFn">
<!-- <u-icon name="arrow-left" size="50rpx" color="#606266"></u-icon> --> <!-- <u-icon name="arrow-left" size="50rpx" color="#606266"></u-icon> -->
@ -33,27 +23,14 @@
</span> </span>
</view> </view>
<view class="tabs"> <view class="tabs">
<view <view @click="changeTab(i)" class="tab-item" v-for="(v, i) in selectTabs" :key="i" :class="{ select: selectIdx === i }">
@click="changeTab(i)"
class="tab-item"
v-for="(v, i) in selectTabs"
:key="i"
:class="{ select: selectIdx === i }"
>
{{ v.name }} {{ v.name }}
</view> </view>
</view> </view>
</view> </view>
<view class="arealist" v-if="dataInfo.areas.length > 0"> <view class="arealist" v-if="dataInfo.areas.length > 0">
<view <view class="block-info" v-for="item in dataInfo.areas" :key="item.id" @click="toItemPage(item)">
class="block-info" <view v-if="!item.isCompleted" class="schedule schedule-wait">待保洁</view>
v-for="item in dataInfo.areas"
:key="item.id"
@click="toItemPage(item)"
>
<view v-if="!item.isCompleted" class="schedule schedule-wait"
>待保洁</view
>
<view v-else class="schedule schedule-completed">已完成</view> <view v-else class="schedule schedule-completed">已完成</view>
<view class="name"> <view class="name">
@ -62,18 +39,13 @@
</view> </view>
<view class="type"> <view class="type">
<view class="value">区域类型</view> <view class="value">区域类型</view>
<u-tag <u-tag :text="item.areaType" class="tag" border-color="transparent" :type="
:text="item.areaType"
class="tag"
border-color="transparent"
:type="
item.areaType === '室外' item.areaType === '室外'
? 'success' ? 'success'
: item.areaType === '特殊' : item.areaType === '特殊'
? 'warning' ? 'warning'
: 'primary' : 'primary'
" " />
/>
<!-- 特殊先隐藏没有这个字段 --> <!-- 特殊先隐藏没有这个字段 -->
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> --> <!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
</view> </view>
@ -89,11 +61,7 @@
<view class="success-box"> <view class="success-box">
<view class="box-content"> <view class="box-content">
<view class="logo"> <view class="logo">
<image <image style="width: 100%; height: 100%" src="/static/images/msg-success.png" alt="" />
style="width: 100%; height: 100%"
src="/static/images/msg-success.png"
alt=""
/>
</view> </view>
<view class="content-title">刷卡成功</view> <view class="content-title">刷卡成功</view>
<view class="btn-box"> <view class="btn-box">
@ -108,11 +76,7 @@
<view class="error-box"> <view class="error-box">
<view class="box-content"> <view class="box-content">
<view class="logo"> <view class="logo">
<image <image style="width: 100%; height: 100%" src="/static/images/msg-error.png" alt="" />
style="width: 100%; height: 100%"
src="/static/images/msg-error.png"
alt=""
/>
</view> </view>
<view class="content-title"> <view class="content-title">
{{ errorMsg }} {{ errorMsg }}
@ -129,60 +93,56 @@
</template> </template>
<script> <script>
import { import { GetPlanInfoAreaList, GetTodayPlanList, GetAwaitUploadAreaApi } from '@/api/apiList'
GetPlanInfoAreaList,
GetTodayPlanList,
GetAwaitUploadAreaApi,
} from "@/api/apiList";
import { minutesToTime } from "@/utils/utils"; import { minutesToTime } from '@/utils/utils'
export default { export default {
data() { data() {
return { return {
posIcon: require("@/static/images/pos-icon.png"), posIcon: require('@/static/images/pos-icon.png'),
selectIdx: 0, selectIdx: 0,
dropdownValue: "", dropdownValue: '',
dropdownOptions: [ dropdownOptions: [
{ {
label: "保洁计划1", label: '保洁计划1',
value: 1, value: 1
}, },
{ {
label: "保洁计划2", label: '保洁计划2',
value: 2, value: 2
}, },
{ {
label: "保洁计划3", label: '保洁计划3',
value: 3, value: 3
}, },
{ {
label: "保洁计划4", label: '保洁计划4',
value: 4, value: 4
}, }
], ],
selectTabs: [ selectTabs: [
{ {
name: "全部", name: '全部',
value: 0, value: 0
}, },
{ {
name: "待保洁", name: '待保洁',
value: 1, value: 1
}, }
], ],
paramsId: "", paramsId: '',
// //
successShow: false, successShow: false,
// //
errorShow: false, errorShow: false,
errorMsg: "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息", errorMsg: 'NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息',
dataInfo: { dataInfo: {
planName: "", planName: '',
areas: [], areas: []
}, }
}; }
}, },
computed: { computed: {
@ -197,14 +157,14 @@ export default {
onLoad(options) { onLoad(options) {
// this.paramsId = options.id; // this.paramsId = options.id;
this.dropdownValue = options.id; this.dropdownValue = options.id
window.nfcFn = this.nfcResFn; window.nfcFn = this.nfcResFn
// this.nfcResFn(); // this.nfcResFn();
}, },
created() { created() {
this.getTodayPlanList(); this.getTodayPlanList()
this.getPlanInfoAreaList(); this.getPlanInfoAreaList()
}, },
methods: { methods: {
@ -213,132 +173,129 @@ export default {
backFn() { backFn() {
// console.log("%c%s", "color:red", ""); // console.log("%c%s", "color:red", "");
uni.navigateBack(); uni.navigateBack()
}, },
async nfcResFn(data) { async nfcResFn(data) {
if (!data) { if (!data) {
return uni.showToast({ title: "未传入参数 initFn", icon: "none" }); return uni.showToast({ title: '未传入参数 initFn', icon: 'none' })
} }
uni.showModal({ // uni.showModal({
title: "开发调试查看nimei", // title: "nimei",
content: JSON.stringify(data) || "未传入参数 initFn", // content: JSON.stringify(data) || " initFn",
showCancel: true, // showCancel: true,
success: function (res) {}, // success: function (res) {},
}); // });
let cardID = data.cardID; let cardID = data.cardID
// let nimei = data.nimei; // let nimei = data.nimei;
let nimei = data.uuid; let nimei = data.uuid
const req = { const req = {
Nimei: nimei, Nimei: nimei
// Nimei:'"78F04BC3E9A6DE4782C11A2346F39C68' // Nimei:'"78F04BC3E9A6DE4782C11A2346F39C68'
}; }
const res = await GetAwaitUploadAreaApi(req); const res = await GetAwaitUploadAreaApi(req)
console.log(res, "res---"); console.log(res, 'res---')
// //
if (!res.succeed) { if (!res.succeed) {
console.log("%c%s", "color:red", "刷卡失败"); console.log('%c%s', 'color:red', '刷卡失败')
// //
this.errorMsg = this.errorMsg = res.error || 'NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息'
res.error || "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息"; this.errorShow = true
this.errorShow = true;
// //
this.successShow = false; this.successShow = false
return; return
} }
// //
this.successShow = true; this.successShow = true
// //
this.errorShow = false; this.errorShow = false
return; return
if (data) { if (data) {
console.log("%c%s", "color:red", "nfc刷卡成功"); console.log('%c%s', 'color:red', 'nfc刷卡成功')
this.successShow = true; this.successShow = true
// //
this.errorShow = false; this.errorShow = false
} else { } else {
console.log("%c%s", "color:red", "刷卡失败"); console.log('%c%s', 'color:red', '刷卡失败')
this.errorShow = true; this.errorShow = true
// //
this.successShow = false; this.successShow = false
} }
}, },
// //
toUploadPage() { toUploadPage() {
console.log("%c%s", "color:red", "上传图片"); console.log('%c%s', 'color:red', '上传图片')
const params = { const params = {
planName: this.dataInfo.planName, planName: this.dataInfo.planName,
id: this.dataInfo.areas[this.dataInfo.areas.length - 1].id, id: this.dataInfo.areas[this.dataInfo.areas.length - 1].id,
aeraNmae: this.dataInfo.areas[this.dataInfo.areas.length - 1].aeraNmae, aeraNmae: this.dataInfo.areas[this.dataInfo.areas.length - 1].aeraNmae
}; }
console.log(params); console.log(params)
// //
this.successShow = false; this.successShow = false
uni.navigateTo({ uni.navigateTo({
url: url: '/pages/index/uploadPhoto?params=' + encodeURIComponent(JSON.stringify(params))
"/pages/index/uploadPhoto?params=" + })
encodeURIComponent(JSON.stringify(params)),
});
}, },
// //
exceptionReportFn() { exceptionReportFn() {
console.log("%c%s", "color:red", "异常上报"); console.log('%c%s', 'color:red', '异常上报')
// //
this.errorShow = false; this.errorShow = false
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/list", url: '/pages/index/list'
}); })
}, },
toItemPage(item) { toItemPage(item) {
console.log("%c%s", "color:red", "跳转至详情页", item); console.log('%c%s', 'color:red', '跳转至详情页', item)
const combinedData = { const combinedData = {
...item, // item ...item, // item
planName: this.dataInfo.planName, // planName planName: this.dataInfo.planName // planName
}; }
const params = encodeURIComponent(JSON.stringify(combinedData)); const params = encodeURIComponent(JSON.stringify(combinedData))
if (item.isCompleted) { if (item.isCompleted) {
// //
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/cleanDetails?params=" + params, url: '/pages/index/cleanDetails?params=' + params
}); })
return; return
} else { } else {
// //
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/list?params=" + params, url: '/pages/index/list?params=' + params
}); })
} }
}, },
openFn() {}, openFn() {},
closeFn() {}, closeFn() {},
changeTab(i) { changeTab(i) {
this.selectIdx = i; this.selectIdx = i
this.getPlanInfoAreaList(); this.getPlanInfoAreaList()
}, },
changeDropdown(e) { changeDropdown(e) {
this.dropdownValue = e; this.dropdownValue = e
this.getPlanInfoAreaList(); this.getPlanInfoAreaList()
}, },
// //
async getTodayPlanList() { async getTodayPlanList() {
const res = await GetTodayPlanList(); const res = await GetTodayPlanList()
if (res.succeed) { if (res.succeed) {
this.dropdownOptions = res.data.map((item) => ({ this.dropdownOptions = res.data.map(item => ({
label: item.name, label: item.name,
value: item.id, value: item.id
})); }))
} }
}, },
@ -346,14 +303,14 @@ export default {
async getPlanInfoAreaList() { async getPlanInfoAreaList() {
const res = await GetPlanInfoAreaList({ const res = await GetPlanInfoAreaList({
id: this.dropdownValue, id: this.dropdownValue,
isCompleted: this.selectIdx === 0 ? true : false, isCompleted: this.selectIdx === 0 ? true : false
}); })
if (res.succeed) { if (res.succeed) {
this.dataInfo = res.data; this.dataInfo = res.data
} }
}, }
}, }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -395,7 +352,7 @@ page {
padding-top: 72rpx; padding-top: 72rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: url("@/static/images/plan-icon-bg2.png") no-repeat 95% 40%; background: url('@/static/images/plan-icon-bg2.png') no-repeat 95% 40%;
background-size: 40%; background-size: 40%;
background-color: #dfeefd; background-color: #dfeefd;
.name { .name {