first
This commit is contained in:
162
pageDevice/face/edit.vue
Normal file
162
pageDevice/face/edit.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<view class="page-wrapper jeepay-edit-form">
|
||||
<JeepayCustomNavbar bgDefaultColor="#fff" :title="qrcInfo.deviceId ? '修改刷脸设备' : '绑定刷脸设备'" backCtrl="back" />
|
||||
<uni-forms ref="refForm" :rules="rules" :model="qrcInfo" :label-width="120">
|
||||
<uni-forms-item label="设备号" name="deviceNo" v-if="!qrcInfo.deviceId">
|
||||
<view class="scan-wrapper">
|
||||
<uni-easyinput :inputBorder="false" type="text" v-model="qrcInfo.deviceNo" placeholder="请输入设备号" placeholderStyle="color:#B3B3B3" />
|
||||
<image src="/pageDevice/static/devIconImg/icon-scan-code.svg" mode="scaleToFill" @tap="scanCode" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备名称" name="deviceName">
|
||||
<uni-easyinput :inputBorder="false" type="text" v-model="qrcInfo.deviceName" placeholder="请输入设备名称" />
|
||||
</uni-forms-item>
|
||||
<view class="line"></view>
|
||||
<uni-forms-item required label="绑定门店" name="storeId">
|
||||
<template #label>
|
||||
<view class="f-label">绑定门店</view>
|
||||
</template>
|
||||
<JeepayBizsPopupView :hasTitle="false" bizType="store" v-model:value="qrcInfo.storeId" :showName="qrcInfo.bindAppName" />
|
||||
</uni-forms-item>
|
||||
<view class="line"></view>
|
||||
<uni-forms-item required label="选择应用" name="appId">
|
||||
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="qrcInfo.appId" :showName="qrcInfo.bindAppName" />
|
||||
</uni-forms-item>
|
||||
<view class="line"></view>
|
||||
</uni-forms>
|
||||
<JSwitchCard title="状态" tips="状态禁用后,设备将无法使用" borderWidth="100vw">
|
||||
<template #right>
|
||||
<JeepayStateSwitch v-model:state="qrcInfo.state" :showSwitchType="true" :confirm="false" />
|
||||
</template>
|
||||
</JSwitchCard>
|
||||
|
||||
<view class="confirm-wrapper">
|
||||
<Button @tap="confirmCreate">{{ qrcInfo.deviceId ? '保存' : '确认绑定' }}</Button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import formUtil from '@/commons/utils/formUtil.js'
|
||||
import emit from '@/commons/utils/emit.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
onLoad((options) => {
|
||||
console.log(options)
|
||||
if (options.devId) return getDetails(options.devId)
|
||||
if (options.deviceNo) return (qrcInfo.deviceNo = options.deviceNo)
|
||||
})
|
||||
const qrcInfo = reactive({
|
||||
state: 1,
|
||||
bindType: 0,
|
||||
deviceType: 6,
|
||||
bindAppName: '',
|
||||
})
|
||||
const refForm = ref(null)
|
||||
const rules = {
|
||||
deviceNo: {
|
||||
rules: [formUtil.rules.requiredInput('')],
|
||||
},
|
||||
deviceName: {
|
||||
rules: [formUtil.rules.requiredInput('')],
|
||||
},
|
||||
storeId: {
|
||||
rules: [formUtil.rules.requiredSelect('门店')],
|
||||
},
|
||||
}
|
||||
// 扫码
|
||||
const scanCode = () => {
|
||||
uni.scanCode({
|
||||
success: ({ result }) => {
|
||||
console.log('result', result)
|
||||
qrcInfo.deviceNo = result.includes('=') ? result.split('=')[1] : result.split('ciot_helper/')[1]
|
||||
},
|
||||
fail: (err) => {
|
||||
infoBox.showErrorToast('扫码失败')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const confirmCreate = () => {
|
||||
refForm.value.validate().then((res) => {
|
||||
reqLoad.addOrUpdate(qrcInfo.deviceId, API_URL_SYS_DEVICE_LIST, qrcInfo).then((res) => {
|
||||
emit.pageEmit(emit.ENAME_REF_QRC_LIST)
|
||||
go.back(1, emit.ENAME_REF_FACE_DETAIL)
|
||||
})
|
||||
})
|
||||
}
|
||||
const getDetails = (devId) => {
|
||||
reqLoad.getById(API_URL_SYS_DEVICE_LIST, devId).then(({ bizData }) => {
|
||||
console.log(bizData)
|
||||
qrcInfo.bindAppName = bizData.storeName
|
||||
Object.assign(qrcInfo, bizData)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
input {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.selected-sex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 32rpx;
|
||||
color: #b3b3b3;
|
||||
image {
|
||||
width: 120rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
.confirm-wrapper {
|
||||
padding: 50rpx 30rpx;
|
||||
.confirm-button {
|
||||
height: 110rpx;
|
||||
color: #fff;
|
||||
border-radius: 20rpx;
|
||||
background: $jeepay-bg-primary;
|
||||
}
|
||||
}
|
||||
.pay-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #000;
|
||||
image {
|
||||
width: 108rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
}
|
||||
.scan-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
input {
|
||||
flex: 1;
|
||||
}
|
||||
image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
}
|
||||
.store-name {
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
.name {
|
||||
width: 392rpx;
|
||||
color: #000;
|
||||
}
|
||||
.store-id {
|
||||
color: #a1a1a1;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
.name-wrapper {
|
||||
display: flex;
|
||||
image {
|
||||
align-self: center;
|
||||
height: 80rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
68
pageDevice/face/index.vue
Normal file
68
pageDevice/face/index.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<CommonPageByDevice
|
||||
ref="commonPageByDeviceRef"
|
||||
navTitle="刷脸设备管理"
|
||||
searchTitle="搜索设备名称、设备号"
|
||||
searchType="face"
|
||||
searchStateField="state"
|
||||
:bottomBtnTitle="ak.ent.has('ENT_MCH_QR_CODE_ADD') ? '绑定刷脸设备' : null"
|
||||
@bottomBtnClickFunc="bottomBtnClickFunc"
|
||||
:reqTableDataFunc="reqTableDataFunc"
|
||||
>
|
||||
</CommonPageByDevice>
|
||||
<JSinglePopup ref="bindPopup" :list="codeBind" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import { onReachBottom, onUnload } from '@dcloudio/uni-app'
|
||||
import emit from '@/commons/utils/emit.js'
|
||||
import CommonPageByDevice from '../commons/CommonPageByDevice.vue'
|
||||
import { reqLoad, API_URL_SYS_DEVICE_LIST, $parseQrCodeUrl } from '@/http/apiManager.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import ak from '@/commons/utils/ak.js'
|
||||
const bindPopup = ref(null)
|
||||
const reqTableDataFunc = (params) => {
|
||||
params.deviceType = 6
|
||||
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
|
||||
}
|
||||
function bottomBtnClickFunc() {
|
||||
bindPopup.value.open()
|
||||
}
|
||||
uni.$on(emit.ENAME_REF_QRC_LIST, (data) => {
|
||||
commonPageByDeviceRef.value.refTable(true)
|
||||
})
|
||||
const commonPageByDeviceRef = ref(null)
|
||||
// 点击绑定新码 事件
|
||||
const codeBind = [
|
||||
{
|
||||
label: '扫码绑定',
|
||||
value: 'scanCode',
|
||||
fun: () => {
|
||||
uni.scanCode({
|
||||
success: ({ result }) => {
|
||||
console.log('result', result)
|
||||
let deviceNo = result.includes('=') ? result.split('=')[1] : result.split('ciot_helper/')[1]
|
||||
go.to('PAGES_APP_FACE_EDIT', { deviceNo })
|
||||
},
|
||||
fail: (err) => {
|
||||
// infoBox.showErrorToast('扫码失败')
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '手动绑定',
|
||||
value: 'handBind',
|
||||
fun: () => {
|
||||
go.to('PAGES_APP_FACE_EDIT')
|
||||
},
|
||||
},
|
||||
]
|
||||
onUnload(() => uni.$off(emit.ENAME_REF_QRC_LIST))
|
||||
onReachBottom(() => {})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
147
pageDevice/face/view.vue
Normal file
147
pageDevice/face/view.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<JeepayBackground :bgColorStyle="{ height: '706rpx' }">
|
||||
<JeepayCustomNavbar textColor="#fff" bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" title="刷脸设备详情" backCtrl="back" />
|
||||
|
||||
<JeepayTableListItem
|
||||
viewClass="list-item-by-detail"
|
||||
logo="/pageDevice/static/devIconImg/icon-face-white.svg"
|
||||
:title="vdata.deviceName"
|
||||
:subtitle="vdata.deviceNo"
|
||||
:moreBtnList="list"
|
||||
/>
|
||||
|
||||
<view class="create-time">
|
||||
<view class="time-title">设备厂商</view>
|
||||
<view class="dev-info">{{ vdata.provider == 'wxpayQWPro' ? '青蛙刷脸Pro' : '蜻蜓F4' }}</view>
|
||||
</view>
|
||||
<view class="create-time" style="border: none; padding-top: 0">
|
||||
<view class="time-title">创建时间</view>
|
||||
<view class="time-info">{{ vdata.createdAt }}</view>
|
||||
</view>
|
||||
<JeepayCard editText="编辑信息" @editTap="toEdit">
|
||||
<JeepayDescview>
|
||||
<JeepayDescviewItem title="设备编号" :desc="vdata.deviceParams?.deviceNo" />
|
||||
<JeepayDescviewItem title="设备名称" :desc="vdata.deviceName" />
|
||||
<JeepayDescviewItem title="绑定门店" :desc="vdata.storeName" />
|
||||
<JeepayDescviewItem title="绑定应用" :desc="vdata.appName" />
|
||||
</JeepayDescview>
|
||||
</JeepayCard>
|
||||
<JDetailsSwitch title="设备状态" subTitle="状态禁用后,该设备将无法使用">
|
||||
<template #titleRight>
|
||||
<JeepayStateSwitch v-model:state="vdata.state" :showSwitchType="true" :updateStateFunc="confirmSwitch" />
|
||||
</template>
|
||||
</JDetailsSwitch>
|
||||
<JSinglePopup ref="more" :list="list" activeColor="#FF5B4C" />
|
||||
<JeepayPopupConfirm ref="tips" />
|
||||
</JeepayBackground>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import { reqLoad, API_URL_SYS_DEVICE_LIST, API_URL_SYS_CODE_LIST, $speakTest, $deviceUnbind } from '@/http/apiManager.js'
|
||||
import datamap from '@/commons/utils/datamap.js'
|
||||
import emit from '@/commons/utils/emit.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
// 监听 更新事件
|
||||
onUnload(() => uni.$off(emit.ENAME_REF_FACE_DETAIL))
|
||||
uni.$on(emit.ENAME_REF_FACE_DETAIL, function (data) {
|
||||
getDetails(vdata.deviceId)
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
getDetails(options.deviceId)
|
||||
})
|
||||
const more = ref(null)
|
||||
const tips = ref(null)
|
||||
const popupDialog = ref(null)
|
||||
|
||||
const vdata = reactive({
|
||||
|
||||
})
|
||||
|
||||
const list = reactive([
|
||||
{ label: '解除绑定', value: 'remove', color: '#FF5B4C', fun: confirm },
|
||||
])
|
||||
function confirm() {
|
||||
more.value.close()
|
||||
tips.value
|
||||
.open('确认解除绑定吗?', { confirmColor: '#FF5B4C' })
|
||||
.then((res) => {
|
||||
$deviceUnbind(vdata.deviceId).then((res) => {
|
||||
infoBox.showSuccessToast('解绑成功').then(() => {
|
||||
go.back(1, emit.ENAME_REF_QRC_LIST)
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
more.value.open('remove')
|
||||
})
|
||||
}
|
||||
const typeList = [
|
||||
{ label: '门店所有订单', value: 0 },
|
||||
{ label: '来自受支持码牌的订单', value: 1 },
|
||||
]
|
||||
const getDetails = (params) => {
|
||||
reqLoad.getById(API_URL_SYS_DEVICE_LIST, params).then(({ bizData }) => {
|
||||
Object.assign(vdata, bizData)
|
||||
|
||||
vdata.deviceParams = JSON.parse(vdata.deviceParams || '{}')
|
||||
})
|
||||
}
|
||||
// 修改设备状态
|
||||
const confirmSwitch = (bol) => {
|
||||
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, { state: bol }).then((res) => {
|
||||
emit.refPageAndSearchEmit(emit.ENAME_REF_SPEAKER_LIST)
|
||||
})
|
||||
}
|
||||
|
||||
// 去编辑页面
|
||||
const toEdit = () => {
|
||||
go.to('PAGES_APP_FACE_EDIT', { devId: vdata.deviceId })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.create-time {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 75rpx;
|
||||
padding: 50rpx 0;
|
||||
font-size: 30rpx;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||
.time-title {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
.time-info {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.store-info {
|
||||
padding: 0.1rpx;
|
||||
margin: 0 35rpx;
|
||||
background-color: #fff;
|
||||
border-radius: $J-b-r32;
|
||||
overflow: hidden;
|
||||
}
|
||||
.default-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.dev-info {
|
||||
padding: 3rpx 15rpx;
|
||||
border-radius: 6rpx;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.selected-qrcId {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user