源文件

This commit is contained in:
gyq
2024-05-23 14:39:33 +08:00
commit a1128dd791
2997 changed files with 500069 additions and 0 deletions

View File

@@ -0,0 +1,273 @@
<template>
<JeepayWrapper>
<view class="page">
<JHeaderTitle title="如意Lite管理" bgColor="#f2f2f2" />
<JSearchInput @search="searchHandle" @resetSearch="reset" ref="search" place="搜索商户号、名称、设备号">
<view class="header-assign" @tap="cancel">
<image src="/static/iconImg/icon-file.svg" mode="scaleToFill" />
划拨
</view>
</JSearchInput>
<view v-for="(item, index) in useDataResult.dataList">
<JPreview
v-bind="item.info"
:key="item.deviceId"
:activeBox="vdata.activeBox"
:isLast="index === useDataResult.dataList.length - 1"
@activeClick="handleActive(item.info)"
@click="toDetail(item.deviceId)"
>
<template #bottom>
<view class="info-wrapper">
<view class="info" v-if="!item.isSelf">
<image src="/static/iconImg/icon-mini-agent.svg" mode="aspectFit" class="mch-img" />
<view class="name">{{ item.agentName }}</view>
<view class="number">{{ item.agentNo }}</view>
</view>
<view class="info" v-if="!!item.bindState">
<image src="@/static/equipmentImg/mch-little.svg" mode="aspectFit" class="mch-img" />
<view class="name">{{ item.mchName }}</view>
<view class="number">{{ item.mchNo }}</view>
</view>
</view>
</template>
</JPreview>
</view>
<view class="footer-button" v-show="vdata.activeBox">
<view class="button-main">
<button @tap="cancel">取消</button>
<button class="confirm" @tap="openNext">下一步</button>
</view>
</view>
<jeepayListNull :isShow="true" :list="useDataResult.dataList.length" />
<JSinglePopup :list="selectedList" ref="refSingle" />
<SelectedAgent ref="refSelected" @confirm="toAgent" />
</view>
</JeepayWrapper>
</template>
<script setup>
import { reactive, ref, watch } from 'vue'
import { $getDeviceList, $getAcountInfo, $updateDeviceDetail, $allotORtakeBack } from '@/http/apiManager.js'
import { onBackPress, onShow } from '@dcloudio/uni-app'
import JSearchInput from '@/components/newComponents/JSearchInput/JSearchInput.vue'
import useGetList from '@/hooks/useList.js'
import jeepayListNull from '@/components/jeepayListNull/jeepayListNull.vue'
import JPreview from '@/components/newComponents/JPreview/JPreview.vue'
import SelectedAgent from '../deviceManagement/components/SelectedAgent.vue'
import JHeaderTitle from '@/components/newComponents/JHeaderTitle/JHeaderTitle.vue' //自定义导航栏
const dataHandle = (data) => {
data.forEach((item) => {
item.info = {
img: item.state == 1 ? '/static/equipmentImg/iqpos-open.svg' : '/static/equipmentImg/iqpos-close.svg',
title: item.deviceName ? item.deviceName : '未命名',
qrcId: item.deviceNo,
spot: item.state == 1 ? '#7737FE' : '#B2B2B2',
status: item.state == 1 ? '已启用' : '已禁用',
disabled: !!item.bindState,
deviceId: item.deviceId,
}
if (item.bindState) {
item.info.mchName = item.mchName
item.info.mchNo = item.mchNo
}
})
return data
}
const vdata = reactive({
activeBox: false,
})
const refSingle = ref(null)
const refSelected = ref(null)
const { useDataResult, getList } = useGetList({
requestFun: $getDeviceList,
params: { deviceType: 7 },
dataHandle,
})
const selectedList = [
{ label: '收回所有已选择设备', value: 'takeBack', confirmText: '确定要收回所有已选设备吗?', fun: takeBackDev },
{
label: '划拨已选设备至代理商',
value: 'toAgent',
fun: () => {
refSelected.value.open()
},
},
]
const search = ref(null) // 注册搜索组件
// 搜索
const searchHandle = (val) => getList({ appSearchData: val })
// 重置搜索
const reset = () => getList({ appSearchData: '' })
// 输入框存在内容时,清空文字,列表重置
onBackPress(() => {
if (search.value.searchText != '') {
search.value.searchText = ''
reset()
return true
}
return false
})
const toDetail = (e) => {
uni.navigateTo({
url: `./view?deviceId=${e}` + `&deviceType=` + 7,
})
}
// 设备号列表
const devNoList = []
// 勾选
const handleActive = (val) => {
if (val.disabled) return
if (val.active) {
devNoList.splice(
devNoList.findIndex((v) => v == val.deviceId),
1
)
val.active = false
return
}
devNoList.push(val.deviceId)
val.active = true
}
const openNext = () => {
if (devNoList.length == 0) return uni.showToast({ title: '请勾选要进行操作的设备', icon: 'none' })
refSingle.value.open()
}
// 收回划拨
function takeBackDev() {
const data = {
allotDeviceIds: devNoList.join(','),
allotOrRecover: 'recover',
allotType: 'select',
}
$allotORtakeBack(data).then((res) => {
uni.showToast({
title: '收回成功',
icon: 'success|none',
})
devNoList.length = 0
vdata.activeBox = false
getList({
pageNumber: 1,
})
})
}
// 划拨
function toAgent(e) {
const data = {
agentNo: e.text,
allotDeviceIds: devNoList.join(','),
allotOrRecover: 'allot',
allotType: 'select',
}
$allotORtakeBack(data).then((res) => {
uni.showToast({
title: '划拨成功',
icon: 'success|none',
})
devNoList.length = 0
vdata.activeBox = false
refSelected.value.close()
getList({
pageNumber: 1,
})
})
}
const cancel = () => {
if (!vdata.activeBox) return (vdata.activeBox = true)
useDataResult.dataList.forEach((v) => {
v.info.active = false
})
devNoList.length = 0
vdata.activeBox = false
}
</script>
<style lang="scss" scoped>
.header-assign {
display: flex;
align-items: center;
padding: 0 30rpx;
font-size: 30rpx;
font-weight: 500;
color: #404040;
image {
margin-right: 5rpx;
width: 36rpx;
height: 36rpx;
}
}
.info-wrapper {
margin-top: 20rpx;
width: 100%;
border-radius: 10rpx;
}
.info {
// width: 100%;
display: flex;
justify-content: center;
padding: 20rpx;
box-sizing: border-box;
background-color: #f7f7f7;
.mch-img {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
}
.name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 10rpx;
width: 350rpx;
color: #000;
font-size: 28rpx;
flex-grow: 1;
}
.number {
white-space: nowrap;
color: #8c8c8c;
font-size: 28rpx;
}
}
.footer-button {
height: 170rpx;
}
.button-main {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 1;
display: flex;
padding: 0 30rpx;
align-items: center;
height: 170rpx;
border-top: 1rpx solid #ededed;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(20rpx);
button {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
height: 110rpx;
font-size: 33rpx;
font-weight: 500;
color: #575757;
background-color: #e6e6e6;
&::after {
border: none;
}
}
.confirm {
margin-left: 30rpx;
background-color: $primaryColor;
color: #fff;
}
}
</style>

View File

@@ -0,0 +1,257 @@
<template>
<JeepayWrapper>
<!-- 顶部自定义导航栏 -->
<JHeaderTitle title="如意Lite详情" :bgColor="header.bgColor" color="#fff" imgUrl="/static/iconImg/left-white.svg" />
<JEquiCode bgImg="/pageWork/static/images/lite-bg.svg" icon="/pageWork/static/images/lite-white.svg" :qrcAlias="params.deviceName" :qrcId="params.deviceId" :editIsShow="false" />
<!-- 信息板块 -->
<JMainCard wrapPd="30rpx 50rpx" bgColor="rgba(0,0,0,0.1)" pd="25rpx 0">
<JInput name="设备名称" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.deviceName" pd="15rpx 40rpx" />
<JInput name="设备号" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.deviceId" pd="15rpx 40rpx" />
<JInput name="设备厂商" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="data.manufacturer" pd="15rpx 40rpx" />
<JInput name="设备状态" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" pd="15rpx 40rpx">
<view style="color: #fff; maggin-right: 16rpx; font-size: 30rpx" class="dis-wrapper">
{{ params.state ? '启用' : '禁用' }}
<switch :checked="params.state" style="margin-left: 20rpx; transform: scale(1.2)" color="#BF80FF" @change="switchChange" />
</view>
</JInput>
</JMainCard>
<view class="title">绑定/划拨信息</view>
<!-- 绑定商户 未绑定商户状态 -->
<JMainCard wrapPd="30rpx 50rpx" bgColor="rgba(0,0,0,0.2)" pd="0" v-if="!params.bindState && params.isSelf">
<JInput icon="/pageWork/static/images/bindMch.svg" @tap="bindMch" :isBorder="true" name="绑定至商户" textColor="#fff" size="33rpx" :img="true" />
</JMainCard>
<JMainCard wrapPd="0 50rpx" bgColor="rgba(0,0,0,0.2)" pd="0" v-if="params.isSelf && !params.bindState">
<JInput icon="/static/iconImg/icon-assign.svg" @tap="selectedAgent.open()" :isBorder="true" name="划拨至代理" textColor="#fff" size="33rpx" :img="true" />
</JMainCard>
<template v-if="!params.isSelf">
<JMainCard wrapPd="30rpx 50rpx" bgColor="rgba(0,0,0,0.1)" pd="0">
<JInput name="代理商名称" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.agentName" pd="15rpx 40rpx" />
<JInput name="代理商号" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.agentNo" pd="15rpx 40rpx" />
<JInput
bgColor="rgba(0,0,0,0.2)"
icon="/static/iconImg/icon-takeBack.svg"
@tap="refTakeBack.open('收回后代理商将无法使用该设备!')"
:isBorder="true"
name="收回"
textColor="#fff"
size="33rpx"
:img="true"
/>
<JInput
bgColor="rgba(0,0,0,0.2)"
icon="/static/iconImg/icon-assign.svg"
@tap="refAgain.open('确认重新划拨吗?')"
name="重新划拨"
borderBg="#7737fe"
textColor="#fff"
size="33rpx"
:img="true"
/>
</JMainCard>
</template>
<template v-if="params.bindState">
<view class="bind-title">绑定信息</view>
<JMainCard wrapPd="30rpx 50rpx" bgColor="rgba(0,0,0,0.1)" pd="0">
<JInput name="商户" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.mchName" pd="15rpx 40rpx" />
<JInput name="用户号" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" :right="params.mchNo" pd="15rpx 40rpx" />
<JInput name="门店" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" pd="15rpx 40rpx" :right="params.storeName" />
<JInput name="门店ID" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" pd="15rpx 40rpx" :right="params.storeId" />
<JInput name="应用名称" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" pd="15rpx 40rpx" :right="params.appName" />
<JInput name="AppID" textColor="rgba(255, 255,255, 0.6)" :isBorder="true" size="30rpx" pd="15rpx 40rpx" :right="params.appId" />
<JInput
bgColor="rgba(0,0,0,0.2)"
icon="/static/equipmentImg/bind.svg"
@tap="switchStatePopup.open('解绑后商户将无法使用该设备!')"
:isBorder="true"
name="解绑"
textColor="#fff"
size="33rpx"
:img="true"
/>
<JInput bgColor="rgba(0,0,0,0.2)" icon="/static/equipmentImg/bind-again.svg" @tap="bindMch" name="重新绑定" borderBg="#7737fe" textColor="#fff" size="33rpx" :img="true" />
</JMainCard>
</template>
<!-- 商户选择弹窗 -->
<!-- 选择弹窗 -->
<JDeletedTips ref="switchTips" @confirm="confirm" @cancel="cancel" />
<JDeletedTips ref="switchStatePopup" @confirm="unbound" />
<JDeletedTips ref="refTakeBack" @confirm="takeBack" />
<JDeletedTips ref="refAgain" @confirm="selectedAgent.open()" />
<SelectedAgent ref="selectedAgent" @confirm="again" />
</JeepayWrapper>
</template>
<script setup>
import { onLoad, onBackPress, onPageScroll, onShow } from '@dcloudio/uni-app'
import providerObj from '@/util/providerObj.js'
import { ref, reactive, toRaw, nextTick } from 'vue'
import { $updateDeviceDetail, $getDeviceDetail, $payIfDefines, $allotORtakeBack } from '@/http/apiManager.js'
import JDeletedTips from '@/components/newComponents/JDeletedTips/JDeletedTips'
import JPopup from '@/components/newComponents/JPopup/JPopup.vue'
import JEquiCode from '@/components/newComponents/JEquipment/JEquiCode.vue' // 设备信息
import JHeaderTitle from '@/components/newComponents/JHeaderTitle/JHeaderTitle.vue' // 导航栏
import JEquipmentCode from '@/components/newComponents/JEquipment/JEquipmentCode.vue' // 设备信息
import JMainCard from '@/components/newComponents/JMainCard/JMainCard.vue' // 卡片
import JInput from '@/components/newComponents/JInput/JInput.vue'
import JLine from '@/components/newComponents/JLine/JLine.vue'
import JScroll from '@/components/newComponents/JScroll/JScroll.vue'
import JButton from '@/components/newComponents/JButton/JButton.vue'
import JPreview from '@/components/newComponents/JPreview/JPreview.vue'
import SelectedAgent from '../deviceManagement/components/SelectedAgent.vue'
const data = reactive({
printState: '', // 打印参数 1. 仅打印 2. 仅播报 3.打印并播报
printNum: '', // 打印联数
deviceType: '', //设备类型 云打印=2
state: false,
deviceNo: '',
arrowImage: '../../static/img/arrow-right-gray.svg',
radioShow: false, //控制绑定结果的显示
cardList: [],
bindCard: false, //绑定到码牌还是门店
payCodeList: [], // 渠道名称列表,用于获取设备厂商字段
manufacturer: '', // 厂商字段,
})
const switchTips = ref(null)
const params = ref({}) // 传参对象
const switchStatePopup = ref()
const searchMch = ref()
const searchStore = ref()
const searchApp = ref()
const refTakeBack = ref(null)
const refAgain = ref(null)
const selectedAgent = ref(null)
onLoad((options) => {
data.deviceType = options.deviceType
data.deviceNo = options.deviceId
})
onShow(() => {
nextTick(() => {
// 设备厂商 && 支付接口 ,用于匹配查找设备厂商字段
getDetails()
})
})
const getDetails = () => {
$payIfDefines({ state: 1 })
.then(({ bizData }) => {
data.payCodeList = bizData
return $getDeviceDetail(data.deviceNo)
})
.then(({ bizData }) => {
params.value = bizData
data.state = bizData.state
// 获取厂商
data.manufacturer = data.payCodeList.find((item) => params.value.provider === item.ifCode).ifName
})
}
let flag = undefined
// 切换状态
function switchChange(e, item) {
flag = true
params.value.state = Number(e.detail.value)
switchTips.value.open('确认修改吗?')
}
const confirm = () => {
flag = false
$updateDeviceDetail(params.value.deviceId, { state: params.value.state }).then(() => {
uni.showToast({
title: '修改成功',
icon: 'success',
})
})
}
const cancel = () => {
if (!flag) return
params.value.state = Number(!params.value.state)
}
// 跳转至绑定页
const bindMch = () => {
uni.navigateTo({ url: '../deviceManagement/publicBind?id=' + params.value.deviceId + '&tag=pos&title=如意Lite绑定' })
}
// 跳转至编辑信息
const editInfo = () => {
uni.navigateTo({
url: './editPrint?id=' + params.value.deviceId,
})
}
// 解绑函数 打开提示弹窗
function unbound() {
$updateDeviceDetail(params.value.deviceId, { bindState: 0 }).then(({ bizData }) => {
uni.showToast({
icon: 'none',
title: '解绑成功',
})
uni.navigateBack({
delta: 1,
})
})
}
const takeBack = () => {
const data = {
agentNo: params.value.agentNo,
allotDeviceIds: params.value.deviceId,
allotOrRecover: 'recover',
allotType: 'select',
}
$allotORtakeBack(data).then((res) => {
getDetails()
uni.showToast({ title: '收回成功', icon: 'success' })
})
}
// 重新划拨
const again = (e) => {
const data = {
agentNo: e.text,
allotDeviceIds: params.value.deviceId,
allotOrRecover: 'allot',
allotType: 'select',
}
$allotORtakeBack(data).then((res) => {
uni.showToast({ title: '划拨成功', icon: 'success' })
getDetails()
selectedAgent.value.close()
})
}
// 监听页面滚动 用于给自定义导航栏换背景色
const header = reactive({ bgColor: 'transparent' })
onPageScroll((data) => {
if (data.scrollTop > 20) {
header.bgColor = '$primaryColor'
} else {
header.bgColor = 'transparent'
}
})
</script>
<style lang="scss">
page {
background: $primaryColor;
}
</style>
<style scoped lang="scss">
.title {
margin-top: 20rpx;
font-size: 33rpx;
font-weight: 500;
text-align: center;
color: #fff;
}
</style>