智能柜开门拒绝授权

This commit is contained in:
weiwei committed 2025-04-17 14:34:42 +08:00
1 parent 3a5eae8646
commit 587858fc74
4 files changed
+92 -81

No files matched your search

+7
View File
@@ -328,6 +328,13 @@
"navigationBarTitleText": "选择支付方式",
"disableScroll": true
}
},
{
"path": "cabinetList",
"style": {
"navigationBarTitleText": "智能柜列表",
"disableScroll": true
}
}
]
},
+7 -6
View File
@@ -82,7 +82,8 @@
height="800rpx"
cancelText="拒绝"
confirmText="同意"
@confirm="appAuthHardDoorConfirm"
@confirm="appAuthHardDoor(1)"
@cancel="appAuthHardDoor(0)"
>
<tm-text color="#999999">{{ state.authDesc }}</tm-text>
</tm-modal>
@@ -166,16 +167,16 @@ const openDoor = async () => {
// 支付方式tab改变
const payMethodTabChange = (e: number) => {}
// 确认协议
const appAuthHardDoorConfirm = async () => {
// 确认或拒绝协议
const appAuthHardDoor = async (type: 1 | 0) => {
try {
uni.showLoading({ title: "授权中", mask: true })
uni.showLoading({ title: type ? "授权中" : "加载中", mask: true })
const res = await hardApi.appAuthHardDoor({
authId: state.authId,
authStatus: 1,
authStatus: type ? 1 : 0,
})
if (res.code == 0) {
uni.showToast({ title: "授权成功", icon: "none" })
if (type) uni.showToast({ title: "授权成功", icon: "none" })
state.show = false
}
} catch (error: any) {
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch, provide, getCurrentInstance, PropType, computed, inject, onMounted } from 'vue'
import { ref, watch, provide, getCurrentInstance, computed, inject, onMounted } from 'vue'
import { arrayNumberValid, arrayNumberValidByStyleMP, covetUniNumber, linearValid, getUnit, getUid } from "../../libs/tool";
import { useTmConfig } from "../../libs/config";
import { getDefaultColor, setTextColorLightByDark, getOutlineColorObj, getTextColorObj, getThinColorObj } from "../../libs/colors";
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { ref, watch, provide, onBeforeMount, PropType, computed } from 'vue'
import { arrayNumberValid, arrayNumberValidByStyleMP, covetUniNumber, linearValid, getUnit, getUid } from "../../libs/tool";
import { useTmConfig } from "../../libs/config";
import { getDefaultColor, setTextColorLightByDark, getOutlineColorObj, getTextColorObj, getThinColorObj } from "../../libs/colors";
import { ref, watch, provide, onBeforeMount, computed } from "vue"
import { arrayNumberValid, arrayNumberValidByStyleMP, covetUniNumber, linearValid, getUnit, getUid } from "../../libs/tool"
import { useTmConfig } from "../../libs/config"
import { getDefaultColor, setTextColorLightByDark, getOutlineColorObj, getTextColorObj, getThinColorObj } from "../../libs/colors"
/**
* @displayName 折叠面板
@@ -14,100 +14,103 @@ import { getDefaultColor, setTextColorLightByDark, getOutlineColorObj, getTextCo
| --- | --- | --- | --- |
| ☑️| ☑️ | ☑️ | ☑️ | ☑️ | 1.0.0 |
*/
defineOptions({ name: 'TmCollapse' });
defineOptions({ name: "TmCollapse" })
const { config } = useTmConfig()
const props = defineProps({
/**
* 当前子项值。可v-model,类型兼容性高,因此不管你提供的是不是数组,最终同步时会被设置成数组
*/
modelValue: {
type: [Array<string | number>, String, Number],
default: (): string[] => [] as string[]
},
/**
* 是否允许打开多个。
*/
multiple: {
type: Boolean,
default: true
}
/**
* 当前子项值。可v-model,类型兼容性高,因此不管你提供的是不是数组,最终同步时会被设置成数组
*/
modelValue: {
type: [Array<string | number>, String, Number],
default: (): string[] => [] as string[],
},
/**
* 是否允许打开多个。
*/
multiple: {
type: Boolean,
default: true,
},
})
const emit = defineEmits([
/**
* 变换时触发
* @param {String[]} value - 当前打开的值
*/
'change',
'update:modelValue'
/**
* 变换时触发
* @param {String[]} value - 当前打开的值
*/
"change",
"update:modelValue",
])
const activeName = ref<Array<string | number>>([])
onBeforeMount(() => {
toggleActivate(props.modelValue)
toggleActivate(props.modelValue)
})
provide('tmCollapseDefaultName', computed((): Array<string | number> => activeName.value))
provide(
"tmCollapseDefaultName",
computed((): Array<string | number> => activeName.value),
)
watch(() => props.modelValue, (newValue: Array<string | number> | string | number) => {
if(newValue == activeName.value.join('')) return;
if(Array.isArray(newValue)){
if(newValue.join('') == activeName.value.join('')) return;
}
toggleActivate(newValue)
})
watch(
() => props.modelValue,
(newValue: Array<string | number> | string | number) => {
if (newValue == activeName.value.join("")) return
if (Array.isArray(newValue)) {
if (newValue.join("") == activeName.value.join("")) return
}
toggleActivate(newValue)
},
)
/**
* 切换选中
*/
const toggleActivate = (name: Array<string | number> | string | number, isEmits = false) => {
let ar = [] as Array<string | number>
if (Array.isArray(name)) {
ar = name
} else if(name !==''&&name!=undefined&&name!=null) {
ar = [name]
}
if (ar.length == 0) {
activeName.value = []
} else {
if (props.multiple) {
let diff = activeName.value.filter((item: string | number) => {
return ar.indexOf(item) == -1
})
let diffname = ar.filter((item: string | number) => {
return activeName.value.indexOf(item) == -1
})
activeName.value = [...diff, ...diffname].slice(0)
} else {
if (activeName.value.indexOf(ar[0]) != -1) {
activeName.value = []
} else {
activeName.value = [ar[0]]
}
}
}
if (isEmits) {
let covervalue:string|number|Array<string|number> = activeName.value.slice(0)
emit('update:modelValue', covervalue)
emit('change', covervalue)
}
let ar = [] as Array<string | number>
if (Array.isArray(name)) {
ar = name
} else if (name !== "" && name != undefined && name != null) {
ar = [name]
}
if (ar.length == 0) {
activeName.value = []
} else {
if (props.multiple) {
let diff = activeName.value.filter((item: string | number) => {
return ar.indexOf(item) == -1
})
let diffname = ar.filter((item: string | number) => {
return activeName.value.indexOf(item) == -1
})
activeName.value = [...diff, ...diffname].slice(0)
} else {
if (activeName.value.indexOf(ar[0]) != -1) {
activeName.value = []
} else {
activeName.value = [ar[0]]
}
}
}
if (isEmits) {
let covervalue: string | number | Array<string | number> = activeName.value.slice(0)
emit("update:modelValue", covervalue)
emit("change", covervalue)
}
}
defineExpose({ toggleActivate })
</script>
<template>
<view>
<!--
<view>
<!--
@slot 默认插槽,可放置tm-collapse-item子节点
-->
<slot></slot>
</view>
<slot></slot>
</view>
</template>
<style scoped></style>
<style scoped></style>