代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -1,106 +0,0 @@
<template>
<!-- 数据循环 timeId 时间戳加随机数唯一值 -->
<block v-for="(v, i) in adList" :key="v.timeId">
<view class="ad-item">
<view class="ad-img-wrapper">
<view class="title">广告图片</view>
<view style="flex:1">
<JeepayUploadImg v-model:src="v.imgUrl" bizType="notice" />
</view>
</view>
<view class="ad-sort" :class="{ 'border-none': adList.length - 1 == i }">
<view class="title">广告排序</view>
<input type="number" v-model="v.sort" placeholder="请输入广告排序"
placeholder-style="color: #b3b3b3ff; font-size: 32rpx;" maxlength="5" />
<view class="del-but" hover-class="jeepay-hover-button" @tap="delAdData(v.timeId)">删除该条</view>
</view>
</view>
</block>
<!-- 添加数据 -->
<view class="add-img-but" hover-class="jeepay-hover-button" @tap="addAdData">
<image class="add-icon-img" src="/pageDevice/static/icon/ad-add.svg"></image>
添加广告图片 </view>
</template>
<script setup>
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({
adList: { type: Array, default: () => ([]) }
});
// 添加数据方法
const addAdData = () => {
props.adList.push({ timeId: new Date().getTime() + Math.random() })
}
// 删除数据方法
const delAdData = (key) => {
if(props.adList.length<=1) return infoBox.showToast('最后一条数据不可删除。')
const index = props.adList.findIndex(v => v.timeId == key)
props.adList.splice(index, 1)
}
</script>
<style lang="scss" scoped>
.title {
margin-right: 70rpx;
color: #4d4d4dff;
font-size: 32rpx;
font-weight: 400;
white-space: nowrap;
}
.ad-item {
padding: 40rpx 0 0 40rpx;
}
.ad-img-wrapper {
display: flex;
align-items: center;
}
.ad-sort {
display: flex;
align-items: center;
margin-top: 40rpx;
height: 120rpx;
border-bottom: 1rpx solid #edededff;
}
.del-but {
display: flex;
justify-content: center;
align-items: center;
margin-right: 40rpx;
width: 148rpx;
height: 70rpx;
color: #ff0000ff;
font-size: 27rpx;
border-radius: 10rpx;
background: #ff00000f;
}
.add-img-but {
margin: 40rpx;
margin-top: 20rpx;
display: flex;
justify-content: center;
align-items: center;
height: 110rpx;
color: #2d2d2dff;
font-size: 32rpx;
border: 2rpx dashed #0000001a;
background: #00000005;
border-radius: 10rpx;
}
.border-none {
border: none !important;
}
.jeepay-hover-button{
opacity: 0.5;
background-color: rgba($color: #000000, $alpha: 0.09);
}
.add-icon-img{
margin-right: 20rpx;
width: 25rpx;
}
</style>

View File

@@ -1,144 +0,0 @@
<template>
<view class="page-wrapper">
<JeepayCustomNavbar textColor="#000" bgDefaultColor="#fff" :title="vdata.advertId ? '广告编辑' : '广告创建'"
backCtrl="back" />
<view class="ad-title-wrapper">
<view class="ad-title">广告标题</view>
<input type="text" v-model="vdata.title" placeholder="请输入广告标题"
placeholder-style="color: #b3b3b3ff; font-size: 32rpx;font-weight: 400;" maxlength="12">
</view>
<JSwitchCard borderWidth="0" title="是否发布" :tipsWidth='410' tips="发布后,刷脸设备上仅展示当前广告中包含的图片" v-if='!vdata.advertId'>
<template #right>
<JeepayStateSwitch v-model:state="vdata.releaseState" :showSwitchType="true" :confirm="false" />
</template>
</JSwitchCard>
<view class="ad-content">
<AdItems :adList="vdata.adList" />
</view>
<!-- 保存编辑 -->
<view class="footer-wrapper">
<view class="footer-button footer-button-style">
<button hover-class="hover-button" hover-stay-time="150" class="flex-center" @tap="addOrEdit">{{ vdata.advertId ?
'保存编辑' : '确认创建' }}</button>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive } from "vue"
import { onLoad } from '@dcloudio/uni-app'
import infoBox from '@/commons/utils/infoBox.js'
import { reqLoad, API_URI_PAY_AD_LIST } from "@/http/apiManager.js"
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import AdItems from "./components/AdItems.vue"
onLoad((options) => {
if (options.id) {
vdata.advertId = options.id
getDetails()
}
})
const vdata = reactive({
advertType: 1,
releaseState: 1,
adList: [{ timeId: new Date().getTime() + Math.random() }]
})
const addOrEdit = () => {
// 上传前格式化数据
if(!vdata.title) return infoBox.showToast('请填写广告标题')
if (formatAdData()) return
vdata.appContent = JSON.stringify(vdata.adList)
reqLoad.addOrUpdate(vdata.advertId ? vdata.advertId : false, API_URI_PAY_AD_LIST, vdata).then(res => {
go.back(1, emit.ENAME_REF_AD_DETAILS)
emit.refPageAndSearchEmit(emit.ENAME_REF_AD_LIST)
})
}
const getDetails = () => {
reqLoad.getById(API_URI_PAY_AD_LIST, vdata.advertId).then(({ bizData }) => {
bizData.adList = JSON.parse(bizData.appContent)
bizData.adList.forEach(v => {
v.timeId = new Date().getTime() + Math.random()
})
Object.assign(vdata, bizData)
})
}
const formatAdData = () => {
if (vdata.adList.findIndex(v => v.imgUrl) == '-1') return infoBox.showToast('空数据不可保存')
vdata.adList = vdata.adList.filter(v=>v.imgUrl) // 筛选有值字段
vdata.adList.forEach((v, i) => {
delete v.timeId //删除唯一值 后端不许要存储
if(!v.sort){
v.sort = i+1 //如果没有填写 排序字段 将 下标赋值给 排序字段
}
})
return false
}
</script>
<style lang="scss" scoped>
.title {
color: #4d4d4dff;
font-size: 32rpx;
font-weight: 400;
}
.ad-content {
margin-top: 20rpx;
padding: 0.1rpx;
background-color: #fff;
}
.ad-title-wrapper {
display: flex;
align-items: center;
padding: 0 40rpx;
height: 120rpx;
background-color: #fff;
input {
margin-left: 70rpx;
}
margin-bottom: 20rpx;
}
.footer-wrapper {
height: 170rpx;
background-color: transparent;
.footer-button {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
padding: 30rpx;
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
height: 1rpx;
background-color: #edededff;
}
button {
height: 110rpx;
font-size: 33rpx;
font-weight: 500;
color: $J-color-tff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
.hover-button {
opacity: 0.5;
}
}
}
</style>

View File

@@ -1,123 +0,0 @@
<template>
<view class="page-wrapper">
<view class="search-header">
<view class="search-mian">
<image src="/static/iconImg/icon-search.svg" mode=""></image> <input type="text" disabled placeholder="搜索广告标题"
placeholder-style="color: #00000059;font-size: 27rpx;font-weight: 400;" @tap="toSearch">
</view>
</view>
<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc">
<template #tableBody="{ record }">
<FaceCardRender :title="record.title" :advertId="record.advertId" :imgUrl="record.imgUrl"
:releaseState="record.releaseState" />
</template>
</JeepayTableList>
<view class="footer-wrapper">
<view class="footer-button footer-button-style">
<button hover-class="hover-button" hover-stay-time="150" class="flex-center" @tap="createdAd">创建广告</button>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from "vue"
import { reqLoad, API_URI_PAY_AD_LIST } from "@/http/apiManager"
import { onLoad, onUnload } from '@dcloudio/uni-app'
import FaceCardRender from "/pages/list/render/FaceCardRender.vue"
import emit from '@/commons/utils/emit.js'
import go from '@/commons/utils/go.js'
uni.$on(emit.ENAME_REF_AD_LIST, (data) => {
jeepayTableListRef.value.refTable(true)
})
onUnload(() => {
uni.$off(emit.ENAME_REF_AD_LIST)
})
const jeepayTableListRef = ref(null)
const reqTableDataFunc = (params) => {
params.advertType = 1
return reqLoad.list(API_URI_PAY_AD_LIST, params)
}
const createdAd = () => {
go.to('PAGES_AD_EDIT')
}
const toSearch = () => {
go.toSearchPage('faceImgAd', 'faceImgAd')
}
</script>
<style lang="scss" scoped>
.page-wrapper {
min-height: calc(100vh - 160rpx);
}
.search-header {
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
padding: 20rpx 30rpx;
height: 110rpx;
background-color: #fff;
image {
padding: 20rpx;
width: 25rpx;
height: 25rpx;
}
.search-mian {
flex: 1;
display: flex;
height: 100%;
border-radius: 12rpx;
opacity: 1;
background: #f5f5f5ff;
input {
height: 100%;
}
}
}
.footer-wrapper {
height: 170rpx;
background-color: transparent;
.footer-button {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 30rpx;
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
height: 1rpx;
background-color: #edededff;
}
button {
height: 110rpx;
font-size: 33rpx;
font-weight: 500;
color: $J-color-tff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
.hover-button {
opacity: 0.5;
}
}
}
.block {
height: 150rpx;
}
</style>

View File

@@ -1,125 +0,0 @@
<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/icon/ad-white.svg"
:title="vdata.title" :subtitle="vdata.advertId" :moreBtnList="list" />
<view class="create-time">
<view class="time-title">创建时间</view>
<view class="time-info">{{ vdata.createdAt }}</view>
</view>
<JeepayCard editText="编辑广告" @editTap="toEditAd">
<JeepayDescview>
<block v-for="(v, i) in vdata.appContent">
<JeepayDescviewItem :title="`广告图片(${i + 1}`">
<template #desc>
<image class="ad-img" :src="v.imgUrl" mode="aspectFill">
</image>
</template>
</JeepayDescviewItem>
</block>
</JeepayDescview>
</JeepayCard>
<JeepayCard title='其他设置' viewStyle="margin-top:30rpx">
<JSwitchCard title="是否发布" :tipsWidth='410' tips="发布后,刷脸设备上仅展示当前广告中包含的图片">
<template #right>
<JeepayStateSwitch v-model:state="vdata.releaseState" :showSwitchType="true"
:updateStateFunc="updateStateFunc" />
</template>
</JSwitchCard>
</JeepayCard>
<JeepayPopupConfirm ref="refTips" />
<JSinglePopup ref="refMore" :list="list" activeColor="#FF5B4C" />
</JeepayBackground>
</template>
<script setup>
import { reqLoad, API_URI_PAY_AD_LIST } from "@/http/apiManager.js"
import http from "@/http/http"
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
import { reactive, ref } from "vue"
import go from '@/commons/utils/go.js'
import { onLoad,onUnload } from '@dcloudio/uni-app'
onLoad((options) => {
vdata.advertId = options.id
getDetails()
})
uni.$on(emit.ENAME_REF_AD_DETAILS, (data) => {
getDetails()
})
const list = reactive([{
label: '编辑广告',
value: 'editAd',
fun: toEditAd,
},
{
label: '删除广告',
value: 'deleteAd',
color: '#FF5B4C',
fun: function () {
refTips.value.open('是否确认删除该条广告?').then(() => {
http.req(API_URI_PAY_AD_LIST, { delAdvertIds: vdata.advertId }, "DELETE").then(res => {
infoBox.showSuccessToast('删除成功').then(res => {
go.back(1,emit.ENAME_REF_AD_LIST)
})
})
}).catch(() => {
refMore.value.open()
})
}
},
])
const refTips = ref(null)
const refMore = ref(null)
const vdata = reactive({})
function toEditAd () {
go.to('PAGES_AD_EDIT', { id: vdata.advertId })
}
// 获取详情
const getDetails = () => {
reqLoad.getById(API_URI_PAY_AD_LIST, vdata.advertId).then(({ bizData }) => {
bizData.appContent = JSON.parse(bizData.appContent)
Object.assign(vdata, bizData)
})
}
// 修改发布状态
const updateStateFunc = (state) => {
reqLoad.addOrUpdate(vdata.advertId, API_URI_PAY_AD_LIST, { releaseState: state }).then(res=>{
emit.refPageAndSearchEmit( emit.ENAME_REF_AD_LIST)
})
}
onUnload(() => uni.$off(emit.ENAME_REF_AD_DETAILS))
</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;
}
}
.ad-img {
width: 150rpx;
height: 150rpx;
border-radius: 20rpx;
}
.c-desc-view-item ::v-deep .title {
justify-content: flex-start !important;
}
</style>

View File

@@ -1,98 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{}">
<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"
:title="vdata.record.appName" :subtitle="vdata.record.appId" :moreBtnList="list" />
<JeepayCard editText="编辑信息"
@editTap="go.to('/pageDevice/editPage/editPage', { navTitle: '应用名称', info: vdata.record.appName, id: vdata.record.appId, field: 'appName', api: 'app' })"
>
<JeepayDescview>
<JeepayDescviewItem title="应用名称" :desc="vdata.record.appName" />
<JeepayDescviewItem title="AppId" :desc="vdata.record.appId" />
<JeepayDescviewItem title="创建时间" :desc="vdata.record.createdAt" />
</JeepayDescview>
</JeepayCard>
<JeepayCard title="其他设置" viewStyle="margin-top: 30rpx;">
<JeepayTableListItem title="应用状态" subtitle="状态禁用后,当前应用将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JeepayTableListItem>
<JeepayTableListItem title="是否默认" subtitle="设为默认后,该门店将成为当前商户的默认下单门店">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.defaultFlag" :showSwitchType="vdata.record.defaultFlag == 0" :updateStateFunc="updateDefault" />
</template>
</JeepayTableListItem>
</JeepayCard>
</JeepayBackground>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad,onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_MCH_APP_LIST } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
onLoad((options) => {
reqLoad.getById(API_URL_MCH_APP_LIST, options.appId).then(({ bizData }) => {
vdata.record = bizData
})
})
onUnload( () => uni.$off(emit.ENAME_REF_TABLE_MCH_APP_DETAILS) )
uni.$on(emit.ENAME_REF_TABLE_MCH_APP_DETAILS, function(data){
reqLoad.getById(API_URL_MCH_APP_LIST, vdata.record.appId).then(({ bizData }) => {
vdata.record = bizData
})
})
const vdata = reactive({
record: {},
})
const payConfig = () => go.to("PAGES_APP_CONFIG", {appId: vdata.record.appId } )
const deleteApp = () => {
reqLoad.delById(API_URL_MCH_APP_LIST, vdata.record.appId).then(() => {
infoBox.showSuccessToast('删除成功')
return go.back(1, emit.ENAME_REF_TABLE_MCH_APP)
})
}
const list = reactive([
{ label: '支付配置', value: 'pay', fun: payConfig },
{ label: '删除应用', value: 'delete', color: 'red', confirmText:'您确认删除应用吗?', fun: deleteApp },
])
// 更新状态
function updateState(state) {
return reqLoad.updateById(API_URL_MCH_APP_LIST, vdata.record.appId, { state: state }).then(() => {
emit.pageEmit(emit.ENAME_REF_TABLE_MCH_APP) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
// 更新状态
function updateDefault(defaultFlag) {
return reqLoad.updateById(API_URL_MCH_APP_LIST, vdata.record.appId, { defaultFlag: defaultFlag }).then(() => {
emit.pageEmit(emit.ENAME_REF_TABLE_MCH_APP) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
</script>
<style lang="scss" scoped>
.default-image {
width: 50rpx;
height: 50rpx;
}
</style>

View File

@@ -1,40 +0,0 @@
<template>
<view class="page-wrapper">
<JeepayCustomNavbar title="应用管理" backCtrl="back" />
<JSearchTitle place="搜索应用" @tap="go.toSearchPage('mchApp')" />
<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc">
<template #tableBody="{ record }">
<MchAppRender :record="record" />
</template>
</JeepayTableList>
</view>
</template>
<script setup>
import { nextTick, reactive, ref } from "vue"
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import { reqLoad, API_URL_MCH_APP_LIST } from "@/http/apiManager.js"
import MchAppRender from '@/pages/list/render/MchAppRender.vue'
const jeepayTableListRef = ref()
onReachBottom(() => { })
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_TABLE_MCH_APP) )
uni.$on(emit.ENAME_REF_TABLE_MCH_APP, function(data){
jeepayTableListRef.value.refTable(true)
})
// 请求
function reqTableDataFunc (params) {
return reqLoad.list(API_URL_MCH_APP_LIST, params)
}
</script>
<style lang="scss" scoped></style>

View File

@@ -1,98 +0,0 @@
<template>
<JeepayBackground >
<JeepayCustomNavbar title="应用支付配置" backCtrl="back" />
<JSearchTitle place="搜索支付方式代码、名称" @click=" () => go.toSearchPage('payPassage', {appId: vdata.searchData.appId})">
<template #right>
<view class="pay-type" @tap="single.open(vdata.searchData.wayType)">
{{ getSearchWayTypeStr() }}
<image src="/pageDevice/static/devIconImg/icon-arrow-down.svg" mode="scaleToFill" />
</view>
</template>
</JSearchTitle>
<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc" :searchData="vdata.searchData" >
<template #tableBody="{ record }">
<AppConfigRender :record="record" :configAppId="vdata.searchData.appId" />
</template>
</JeepayTableList>
<JSinglePopup title="请选择支付类型" ref="single" :list="list" @confirm="confirm" />
</JeepayBackground>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload, onReachBottom } from '@dcloudio/uni-app'
import { reqLoad, API_URL_PAY_PASSAGE_LIST } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
import AppConfigRender from '@/pages/list/render/AppConfigRender.vue'
// 触底刷新
onReachBottom(() => { })
const jeepayTableListRef = ref(null)
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_PAY_PASSAGE_LIST) )
uni.$on(emit.ENAME_REF_PAY_PASSAGE_LIST, function(data){
jeepayTableListRef.value.refTable(true)
})
const vdata = reactive({
searchData: {},
})
onLoad((options) => {
vdata.searchData.appId = options.appId
})
// 请求
function reqTableDataFunc (params) {
return reqLoad.list(API_URL_PAY_PASSAGE_LIST, params)
}
const single = ref(null)
const list = reactive([
{ label: '全部类型', value: '' },
{ label: '微信', value: 'WECHAT' },
{ label: '支付宝', value: 'ALIPAY' },
{ label: '云闪付', value: 'YSFPAY' },
{ label: '银联', value: 'UNIONPAY' },
{ label: '其他', value: 'OTHER' },
])
const confirm = (e) => {
vdata.searchData.wayType = e.value
jeepayTableListRef.value.refTable(true)
}
function getSearchWayTypeStr(){
if(!vdata.searchData.wayType){
return "全部类型"
}
return list.filter(r => r.value == vdata.searchData.wayType)[0].label
}
</script>
<style lang="scss" scoped>
.pay-type {
display: flex;
align-items: center;
margin-left: 40rpx;
font-size: 30rpx;
font-weight: 400;
color: #222425;
image {
margin-left: 10rpx;
width: 40rpx;
height: 40rpx;
}
}
</style>

View File

@@ -1,187 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar :title=" vdata.isAdd? '绑定智能POS' : '修改智能POS信息'" backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="120">
<uni-forms-item v-if="vdata.isAdd" required label="设备号" name="deviceNo">
<uni-easyinput v-model="vdata.formData.deviceNo" placeholder="请输入设备号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="设备名称" name="deviceName">
<uni-easyinput v-model="vdata.formData.deviceName" placeholder="请输入设备名称" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="选择应用" name="appId">
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="vdata.formData.appId" :showName="vdata.bindAppName" />
</uni-forms-item>
<uni-forms-item required label="选择门店" name="storeId">
<JeepayBizsPopupView :hasTitle="false" bizType="store" v-model:value="vdata.formData.storeId" :showName="vdata.bindStoreName" />
</uni-forms-item>
<JeepayTableListItem title="状态" subtitle="状态禁用后, 设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
</uni-forms>
<view class="confirm-wrapper">
<Button @tap="confirmFunc">{{ vdata.deviceId ? '确认修改' : '确认创建' }}</Button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
const formRef = ref()
onLoad((options) => {
// 修改页面
if(options.deviceId){
vdata.isAdd = false
vdata.deviceId = options.deviceId
reqLoad.getById(API_URL_SYS_DEVICE_LIST, vdata.deviceId).then(({bizData}) => {
vdata.formData = bizData
vdata.bindAppName = bizData.appName
vdata.bindStoreName = bizData.storeName
})
}
// 参数赋值。
if(options.deviceNo){
vdata.formData.deviceNo = options.deviceNo
}
})
const rules = {
appId: {
rules:[ formUtil.rules.requiredSelect('应用') ],
},
storeId: {
rules:[ formUtil.rules.requiredSelect('门店') ],
},
deviceNo: {
rules:[ formUtil.rules.requiredInput('') ],
},
deviceName: {
rules:[ formUtil.rules.requiredInput('') ],
},
}
const vdata = reactive({
deviceId: null, // 新建 or 修改
isAdd: true, // 是否新增页面
bindAppName: '',
bindStoreName: '',
// 表单数据
formData: {
state: 1 // 默认启用
}
})
function confirmFunc(){
formUtil.validate(formRef.value).then(() => {
let reqData = Object.assign({}, vdata.formData)
reqData.deviceType = 4 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, reqData)
})
.then(( {bizData} ) => {
emit.pageEmit(emit.ENAME_REF_AUTOPOS_LIST) // 更新列表
go.back(1, emit.ENAME_REF_AUTOPOS_DETAIL) // 返回详情 && 更新详情 && search
})
}
</script>
<style lang="scss">
input {
font-size: 32rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #b3b3b3;
image {
flex-shrink: 0;
width: 120rpx;
height: 120rpx;
}
}
.line {
margin-bottom: 20rpx;
}
.confirm-wrapper {
padding: 50rpx 30rpx;
.confirm-button {
height: 110rpx;
color: #fff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
}
.align-top {
align-items: flex-start;
padding: 40rpx 0;
height: auto;
min-height: auto;
image {
width: 120rpx;
height: 40rpx;
transform: rotate(90deg);
}
}
.border-tb {
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
&::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
}
</style>

View File

@@ -1,68 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="智能POS管理"
searchTitle="搜索设备名称、编号"
searchType="device"
:searchParams="{deviceType: 4}"
:bottomBtnTitle="ak.ent.has('ENT_DEVICE_AUTO_POS_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
>
</CommonPageByDevice>
<JSinglePopup ref="jsinglePopupRef" :list="codeBindList" activeColor="#FF5B4C" />
</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 } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
const jsinglePopupRef = ref(null)
const commonPageByDeviceRef = ref()
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_AUTOPOS_LIST) )
uni.$on(emit.ENAME_REF_AUTOPOS_LIST, function(data){
commonPageByDeviceRef.value.refTable(true)
})
const reqTableDataFunc = (params) => {
params.deviceType = 4 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
function bottomBtnClickFunc(){
jsinglePopupRef.value.open()
}
const codeBindList = [
{ label: '扫码绑定', value: 'scanCode', fun: () => {
uni.scanCode().then(({ result }) => {
go.to('PAGES_APP_POS_BIND', { deviceNo: result })
})
}
},
{ label: '手动绑定', value: 'handBind', fun: () => {
go.to('PAGES_APP_POS_BIND')
}
},
]
onReachBottom(() => {})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -1,92 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{}">
<JeepayCustomNavbar textColor="#fff" bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" title="智能POS详情" backCtrl="back" />
<JeepayTableListItem viewClass="list-item-by-detail"
logo="/pageDevice/static/detailsLislImg/pos-white.svg"
:title="vdata.record.deviceName" :subtitle="vdata.record.deviceNo" :moreBtnList="list" />
<JeepayCard editText="编辑信息" @editTap="go.to('PAGES_APP_POS_BIND', {deviceId: vdata.record.deviceId})">
<JeepayDescview>
<JeepayDescviewItem title="设备名称" :desc="vdata.record.deviceName" />
<JeepayDescviewItem title="绑定应用" :desc="vdata.record.appId" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
</JeepayDescview>
</JeepayCard>
<JeepayCard title="其他设置" viewStyle="margin-top: 30rpx;">
<JeepayTableListItem title="终端状态" subtitle="状态禁用后,当前终端将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JeepayTableListItem>
</JeepayCard>
</JeepayBackground>
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST, $deviceUnbind } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
const jeepayPopupConfirmRef = ref()
onLoad((options) => {
refData(options.deviceId)
})
const vdata = reactive({
record: {},
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_AUTOPOS_DETAIL))
uni.$on(emit.ENAME_REF_AUTOPOS_DETAIL, function(data){
refData(vdata.record.deviceId)
})
function refData(id){
reqLoad.getById(API_URL_SYS_DEVICE_LIST, id).then(({ bizData }) => {
vdata.record = bizData
})
}
function deleteFunc () {
jeepayPopupConfirmRef.value.open('您确认解绑设备吗?',{ confirmColor: '#FF5B4C' }).then(() => {
$deviceUnbind(vdata.record.deviceId).then(() => {
infoBox.showSuccessToast('解绑成功')
return go.back(1, emit.ENAME_REF_AUTOPOS_LIST)
})
})
}
const list = reactive([
{ label: '解绑设备', value: 'delete', color: 'red', fun: deleteFunc },
])
// 更新状态
function updateState(state) {
return reqLoad.updateById(API_URL_SYS_DEVICE_LIST, vdata.record.deviceId, { state: state }).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_AUTOPOS_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
</script>
<style lang="scss" scoped>
.default-image {
width: 50rpx;
height: 50rpx;
}
</style>

View File

@@ -1,158 +0,0 @@
<!--
组件功能 设备通用页面
@author terrfly
@site https://www.jeequan.com
@date 2022/12/06 11:30
-->
<template>
<JeepayBackground>
<JeepayCustomNavbar bgDefaultColor="#fff" :title="props.navTitle" backCtrl="back" />
<!-- 搜索 -->
<JSearchTitle :place="props.searchTitle" @click="go.toSearchPage(props.searchType, props.searchParams)">
<template #right>
<JeepayStateSelect v-model:state="vdata.searchData[props.searchStateField]" @change="refTable()"/>
</template>
</JSearchTitle>
<!-- 数据列表 -->
<JeepayTableList ref="codeTable" :reqTableDataFunc="reqTableDataFunc" :searchData="vdata.searchData">
<template #tableBody="{ record }">
<DeviceCommonsRender :type="props.searchType" :record="record" />
</template>
</JeepayTableList>
<!-- 底部固定按钮 -->
<view class="list-footer">
<view class="button-wrapper">
<view class="store-name flex-center" hover-class="touch-hover" @tap="selectedStore">
{{ vdata.selectedStrore.storeName || '全部门店' }}
<image src="/pageDevice/static/devIconImg/icon-arrow-down.svg" mode="scaleToFill" />
</view>
<Button v-if="props.bottomBtnTitle" @tap="emit('bottomBtnClickFunc')">{{ props.bottomBtnTitle }}</Button>
</view>
</view>
<JeepayBizinfoSelect :isShowAllBiz="true" ref="jeepayStoreSelect" />
</JeepayBackground>
<!-- 门店选择 -->
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue'
import { onReachBottom } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
onReachBottom(() => {})
const codeTable = ref() // 表格实例
const jeepayStoreSelect = ref() // 获取门店选择弹窗实例
const bindPopup = ref() // 绑定新码的提示信息
// emit 父组件使用: v-model="val" 进行双向绑定。
const emit = defineEmits(['bottomBtnClickFunc'])
// 定义组件参数
const props = defineProps({
// 导航
navTitle: { type: String },
// 搜索标题
searchTitle: { type: String },
// 搜索类型
searchType: { type: String },
// 搜索条件
searchParams: { type: Object },
// 搜索状态帅选字段
searchStateField: { type: String, default: 'state' },
// 底部按钮显示标题
bottomBtnTitle: { type: String },
// 搜索事件
reqTableDataFunc: { type: Function },
})
const vdata = reactive({
searchData: { }, // 搜索条件
selectedStrore: { }, // 当前选择门店
})
const reqTableDataFunc = (params) => {
return props.reqTableDataFunc(params)
}
// 选择门店
function selectedStore (){
jeepayStoreSelect.value.open(vdata.selectedStrore).then((selected) => {
// 当前选择的门店
vdata.selectedStrore = selected || { }
vdata.searchData.storeId = vdata.selectedStrore.storeId
refTable()
})
}
function refTable(v){
codeTable.value.refTable(v || true )
}
onMounted(()=>{
vdata.searchData[props.searchStateField] = ""
})
defineExpose({refTable})
</script>
<style lang="scss" scoped>
.list-footer{
height: 180rpx;
}
.code-state {
display: flex;
align-items: center;
margin-left: 40rpx;
font-size: 30rpx;
color: #222425;
image {
margin-left: 10rpx;
width: 40rpx;
height: 40rpx;
}
}
.store-name {
position: absolute;
top: -100rpx;
left: 0;
right: 0;
height: 100rpx;
font-size: 30rpx;
background-color: #fff;
border-top: 1rpx solid #ededed;
border-bottom: 1rpx solid #ededed;
background-color: rgba(252, 252, 252, 0.85);
backdrop-filter: blur(20rpx);
image {
margin-left: 10rpx;
width: 40rpx;
height: 40rpx;
transform: rotate(180deg);
}
}
</style>

View File

@@ -1,26 +0,0 @@
<template>
<view class="page-wrapper">
<JeepayNavigation :navList="navList" type="grid" :space="10" :radiusSize="20" />
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
const navList = [
{ title: '码牌立牌', icon: '/pageDevice/static/devIconImg/icon-code.svg', pageUrl: 'PAGES_APP_CODE' },
{ title: '智能云音响', icon: '/pageDevice/static/devIconImg/icon-horn.svg', pageUrl: 'PAGES_APP_HORN' },
{ title: '云打印机', icon: '/pageDevice/static/devIconImg/icon-print.svg', pageUrl: 'PAGES_APP_PRINT' },
{ title: '扫码王', icon: '/pageDevice/static/devIconImg/icon-scanPos.svg', pageUrl: 'PAGES_APP_SCANPOS' },
{ title: '智能POS', icon: '/pageDevice/static/devIconImg/icon-pos.svg', pageUrl: 'PAGES_APP_POS' },
// { title: '辅助终端', icon: '/pageDevice/static/devIconImg/icon-term.svg', pageUrl: 'PAGES_APP_TERMINAL' },
// { title: '刷脸设备', icon: '/pageDevice/static/devIconImg/icon-face-1.svg', pageUrl: 'PAGES_APP_FACE_LIST' },
// { title: '如意Lite', icon: '/pageDevice/static/detailsLislImg/icon-lite.svg', pageUrl: 'PAGES_LITE_LIST' }
];
</script>
<style lang="scss" scoped>
.page-wrapper {
padding: 0.1rpx;
min-height: 100vh;
}
</style>

View File

@@ -1,81 +0,0 @@
<template>
<view class="edit-wrapper">
<view class="edit-input" style="padding: 40rpx">
<view class="edit-title">
<view>固定金额</view>
<JSwitch />
</view>
<view class="edit-tips">启用后可自定义码牌固定收款金额</view>
</view>
<view class="edit-input flex-center" style="margin-top: 30rpx">
<view class="input-title">自定义金额</view>
<uni-easyinput
:inputBorder="false"
v-model="params.info"
type="digit"
:clearable="false"
placeholderStyle=" font-size: 30rpx;color:#ADADAD"
placeholder="请输入自定义金额"
:styles="styles"
/>
<view class="input-title unit">()</view>
</view>
<view class="confirm-button flex-center" hover-class="touch-button">确认修改</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const styles = reactive({
backgroundColor: 'transparent',
color: '#000',
fontSize: '32rpx',
})
const params = reactive({
info: '',
})
</script>
<style lang="scss" scoped>
.edit-input {
padding: 0 20rpx;
margin: 0 35rpx;
margin-top: 150rpx;
min-height: 120rpx;
border-radius: 32rpx;
background-color: #f7f7f7;
}
.input-title {
margin-left: 40rpx;
font-size: 30rpx;
color: #4d4d4d;
}
.unit {
margin: 0 40rpx 0 0;
}
.confirm-button {
margin: 0 auto;
margin-top: 90rpx;
width: 400rpx;
height: 110rpx;
border-radius: 20rpx;
font-size: 33rpx;
font-weight: 500;
color: #fff;
background: $jeepay-bg-primary;
}
.edit-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30rpx;
color: #4d4d4d;
}
.edit-tips {
margin-top: 12rpx;
font-size: 25rpx;
color: #808080;
}
</style>

View File

@@ -1,74 +0,0 @@
<template>
<view class="edit-wrapper">
<view class="edit-input flex-center">
<uni-easyinput :inputBorder="false" clearable v-model="params.info" type="text" :styles="styles" />
</view>
<view class="tips" v-if="params.tips">修改设备编号将有可能导致已报备渠道无法使用</view>
<view class="confirm-button flex-center" hover-class="touch-button" @tap="updateState">确认修改</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_MCH_APP_LIST, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js'
import emit from '@/commons/utils/emit.js'
import go from '@/commons/utils/go.js'
onLoad((options) => {
console.log('options', options)
uni.setNavigationBarTitle({
title: '修改' + options.navTitle,
})
Object.assign(params, options)
})
const styles = reactive({
backgroundColor: 'transparent',
color: '#000',
fontSize: '32rpx',
})
const params = reactive({})
const apiObf = {
app: API_URL_MCH_APP_LIST,
horn: API_URL_SYS_DEVICE_LIST,
}
function updateState() {
const data = {}
data[params.field] = params.info
if (!data[params.field]) return infoBox.showToast('修改内容不能为空')
return reqLoad.updateById(apiObf[params.api], params.id, data).then(() => {
emit.pageEmit(emit.ENAME_REF_TABLE_MCH_APP) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
go.back(1, emit.ENAME_REF_TABLE_MCH_APP_DETAILS)
})
}
</script>
<style lang="scss" scoped>
.edit-input {
padding: 0 20rpx;
margin: 0 35rpx;
margin-top: 150rpx;
height: 120rpx;
border-radius: 32rpx;
background-color: #f7f7f7;
}
.tips {
margin-top: 30rpx;
text-align: center;
font-size: 27rpx;
color: #808080;
}
.confirm-button {
margin: 0 auto;
margin-top: 90rpx;
width: 400rpx;
height: 110rpx;
border-radius: 20rpx;
font-size: 33rpx;
font-weight: 500;
color: #fff;
background: $jeepay-bg-primary;
}
</style>

View File

@@ -1,61 +0,0 @@
<template>
<view class="gps-wrapper">
<view class="title">布放位置</view>
<view>江苏省苏州市姑苏区相门后庄1-13 </view>
<image src="/pageDevice/static/devIconImg/icon-gps.svg" mode="scaleToFill" />
</view>
<view class="gps-wrapper edit-wrapper">
<view class="title">省市区</view>
<view>江苏省/苏州市/姑苏区 </view>
<image src="/pageDevice/static/devIconImg/icon-arrow-sex.svg" mode="scaleToFill" />
</view>
<view class="gps-wrapper edit-wrapper">
<view class="title">经纬度</view>
<view>116.78946/38.307682 </view>
</view>
<view class="confirm-button flex-center" hover-class="touch-button">确认修改</view>
</template>
<script setup></script>
<style lang="scss" scoped>
.gps-wrapper {
display: flex;
margin: 30rpx;
padding: 40rpx 0;
padding-left: 40rpx;
background-color: #f7f7f7;
font-size: 30rpx;
border-radius: 32rpx;
.title {
width: 198rpx;
white-space: nowrap;
color: #4c4c4c;
}
image {
flex-shrink: 0;
width: 108rpx;
height: 40rpx;
}
}
.edit-wrapper {
align-items: center;
padding: 0 0 0 40rpx;
height: 120rpx;
image {
width: 120rpx;
height: 120rpx;
}
}
.confirm-button {
margin: 0 auto;
margin-top: 90rpx;
width: 400rpx;
height: 110rpx;
border-radius: 20rpx;
font-size: 33rpx;
font-weight: 500;
color: #fff;
background: $jeepay-bg-primary;
}
</style>

View File

@@ -1,64 +0,0 @@
<template>
<view class="edit-wrapper">
<view class="edit-input flex-center">
<view class="reduce flex-center">-</view>
<uni-easyinput :inputBorder="false" v-model="params.info" :clearable="false" type="number" :styles="styles" />
<view class="add flex-center">+</view>
</view>
<view class="confirm-button flex-center" hover-class="touch-button">确认修改</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const styles = reactive({
backgroundColor: 'transparent',
color: '#000',
fontSize: '32rpx',
})
const params = reactive({
info: 1,
})
</script>
<style lang="scss" scoped>
.edit-input {
padding: 0 10rpx;
margin: 0 35rpx;
margin-top: 150rpx;
height: 120rpx;
border-radius: 32rpx;
background-color: #f7f7f7;
}
.tips {
margin-top: 30rpx;
text-align: center;
font-size: 27rpx;
color: #808080;
}
.confirm-button {
margin: 0 auto;
margin-top: 90rpx;
width: 400rpx;
height: 110rpx;
border-radius: 20rpx;
font-size: 33rpx;
font-weight: 500;
color: #fff;
background: $jeepay-bg-primary;
}
.add,
.reduce {
width: 100rpx;
height: 100rpx;
font-size: 50rpx;
border-radius: 20rpx;
background-color: #fff;
}
.reduce {
opacity: 0.5;
}
</style>

View File

@@ -1,162 +0,0 @@
<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>

View File

@@ -1,68 +0,0 @@
<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>

View File

@@ -1,147 +0,0 @@
<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>

View File

@@ -1,225 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar :title="vdata.isAdd ? '绑定如意Lite' : '修改如意Lite信息'" backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="120">
<uni-forms-item v-if="vdata.isAdd" required label="设备号" name="deviceNo">
<view class="scan-wrapper">
<uni-easyinput v-model="vdata.formData.deviceNo" placeholder="请输入设备号" :inputBorder="false"></uni-easyinput>
<image src="/pageDevice/static/devIconImg/icon-scan-code.svg" mode="scaleToFill" @tap="scanCode" />
</view>
</uni-forms-item>
<uni-forms-item required label="设备名称" name="deviceName">
<uni-easyinput v-model="vdata.formData.deviceName" placeholder="请输入设备名称" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="选择应用" name="appId">
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="vdata.formData.appId"
:showName="vdata.bindAppName" />
</uni-forms-item>
<uni-forms-item required label="选择门店" name="storeId">
<JeepayBizsPopupView :hasTitle="false" bizType="store" v-model:value="vdata.formData.storeId"
:showName="vdata.bindStoreName" />
</uni-forms-item>
<JeepayTableListItem title="状态" subtitle="状态禁用后, 设备将无法使用" v-if="!vdata.formData.deviceId">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
</uni-forms>
<view class="confirm-wrapper">
<Button @tap="confirmFunc">{{ vdata.deviceId ? '确认修改' : '确认创建' }}</Button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
const formRef = ref()
onLoad((options) => {
// 修改页面
if (options.deviceId) {
vdata.isAdd = false
vdata.deviceId = options.deviceId
reqLoad.getById(API_URL_SYS_DEVICE_LIST, vdata.deviceId).then(({ bizData }) => {
vdata.formData = bizData
vdata.bindAppName = bizData.appName
vdata.bindStoreName = bizData.storeName
})
}
// 参数赋值。
if (options.deviceNo) {
vdata.formData.deviceNo = options.deviceNo
}
})
// 扫码
const scanCode = () => {
uni.scanCode({
success: ({ result }) => {
vdata.formData.deviceNo = result
},
fail: (err) => {
infoBox.showErrorToast('扫码失败')
},
})
}
const rules = {
appId: {
rules: [formUtil.rules.requiredSelect('应用')],
},
storeId: {
rules: [formUtil.rules.requiredSelect('门店')],
},
deviceNo: {
rules: [formUtil.rules.requiredInput('')],
},
deviceName: {
rules: [formUtil.rules.requiredInput('')],
},
}
const vdata = reactive({
deviceId: null, // 新建 or 修改
isAdd: true, // 是否新增页面
bindAppName: '',
bindStoreName: '',
// 表单数据
formData: {
state: 1 // 默认启用
}
})
function confirmFunc () {
formUtil.validate(formRef.value).then(() => {
let reqData = Object.assign({}, vdata.formData)
reqData.deviceType = 7 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件 7-如意lite
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, reqData)
})
.then(({ bizData }) => {
emit.pageEmit(emit.ENAME_REF_AUTOPOS_LIST) // 更新列表
go.back(1, emit.ENAME_REF_AUTOPOS_DETAIL) // 返回详情 && 更新详情 && search
})
}
</script>
<style lang="scss">
input {
font-size: 32rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #b3b3b3;
image {
flex-shrink: 0;
width: 120rpx;
height: 120rpx;
}
}
.line {
margin-bottom: 20rpx;
}
.confirm-wrapper {
padding: 50rpx 30rpx;
.confirm-button {
height: 110rpx;
color: #fff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
}
.align-top {
align-items: flex-start;
padding: 40rpx 0;
height: auto;
min-height: auto;
image {
width: 120rpx;
height: 40rpx;
transform: rotate(90deg);
}
}
.border-tb {
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
&::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
}
.scan-wrapper {
display: flex;
align-items: center;
input {
flex: 1;
}
image {
width: 120rpx;
height: 120rpx;
}
}
</style>

View File

@@ -1,68 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="如意Lite管理"
searchTitle="搜索设备名称、编号"
searchType="device"
:searchParams="{deviceType: 7}"
:bottomBtnTitle="ak.ent.has('ENT_DEVICE_AUTO_POS_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
>
</CommonPageByDevice>
<JSinglePopup ref="jsinglePopupRef" :list="codeBindList" activeColor="#FF5B4C" />
</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 } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
const jsinglePopupRef = ref(null)
const commonPageByDeviceRef = ref()
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_AUTOPOS_LIST) )
uni.$on(emit.ENAME_REF_AUTOPOS_LIST, function(data){
commonPageByDeviceRef.value.refTable(true)
})
const reqTableDataFunc = (params) => {
params.deviceType = 7 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件 7 如意lite
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
function bottomBtnClickFunc(){
jsinglePopupRef.value.open()
}
const codeBindList = [
{ label: '扫码绑定', value: 'scanCode', fun: () => {
uni.scanCode().then(({ result }) => {
go.to('PAGES_LITE_EDIT', { deviceNo: result })
})
}
},
{ label: '手动绑定', value: 'handBind', fun: () => {
go.to('PAGES_LITE_EDIT')
}
},
]
onReachBottom(() => {})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -1,160 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{}">
<JeepayCustomNavbar textColor="#fff"
bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" title="如意Lite详情"
backCtrl="back" />
<JeepayTableListItem viewClass="list-item-by-detail" logo="/pageDevice/static/detailsLislImg/lite-white.svg"
:title="vdata.record.deviceName" :subtitle="vdata.record.deviceNo" :moreBtnList="list" />
<JeepayCard editText="编辑信息" @editTap="go.to('PAGES_LITE_EDIT', { deviceId: vdata.record.deviceId })">
<JeepayDescview>
<JeepayDescviewItem title="设备名称" :desc="vdata.record.deviceName" />
<JeepayDescviewItem title="绑定应用" :desc="vdata.record.appId" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
</JeepayDescview>
</JeepayCard>
<JeepayCard title="其他设置" viewStyle="margin-top: 30rpx;">
<JeepayTableListItem title="终端状态" subtitle="状态禁用后,当前终端将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JeepayTableListItem>
</JeepayCard>
<JeepayCard :title="`${!vdata.record.alipayBindState ? '' : '已'}绑定至蚂蚁店铺`" @clickTitle="bindingAlitStore"
viewStyle="margin-top: 30rpx;" :isTitleBorder="vdata.record.alipayBindState">
<template #titleRight>
<image class="selected-qrcId" src="/static/iconImg/icon-arrow-black.svg" mode="scaleToFill"
v-if="!vdata.record.alipayBindState" />
</template>
<JeepayTableListItem :title="vdata.aliStoreInfo.storeName" :subtitle="vdata.aliStoreInfo.alipayShopId"
v-if="vdata.record.alipayBindState" />
<view class="un-binding" hover-stay-time="50" hover-class="hover-button" v-if="vdata.record.alipayBindState"
@tap="unBindIng">解绑蚂蚁店铺</view>
</JeepayCard>
</JeepayBackground>
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
<JeepayBizinfoSelect ref="refSelectedStore" :params="{alipayShopStatus: 99}" bizType="store" />
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST, $deviceUnbind, API_URL_MCH_STORE_LIST, $BindLite } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
const jeepayPopupConfirmRef = ref()
onLoad((options) => {
refData(options.deviceId)
})
const refSelectedStore = ref(null)
const vdata = reactive({
record: {},
aliStoreInfo: {}
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_AUTOPOS_DETAIL))
uni.$on(emit.ENAME_REF_AUTOPOS_DETAIL, function (data) {
refData(vdata.record.deviceId)
})
function refData (id) {
reqLoad.getById(API_URL_SYS_DEVICE_LIST, id).then(({ bizData }) => {
vdata.record = bizData
getAliStoreInfo()
})
}
function deleteFunc () {
jeepayPopupConfirmRef.value.open('您确认解绑设备吗?', { confirmColor: '#FF5B4C' }).then(() => {
$deviceUnbind(vdata.record.deviceId).then(() => {
infoBox.showSuccessToast('解绑成功')
return go.back(1, emit.ENAME_REF_AUTOPOS_LIST)
})
})
}
const list = reactive([
{ label: '解绑设备', value: 'delete', color: 'red', fun: deleteFunc },
{ label: '编辑设备', value: 'edit', fun: ()=>{
go.to('PAGES_LITE_EDIT', { deviceId: vdata.record.deviceId })
} },
])
// 更新状态
function updateState (state) {
return reqLoad.updateById(API_URL_SYS_DEVICE_LIST, vdata.record.deviceId, { state: state }).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_AUTOPOS_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
// 绑定蚂蚁门店
const bindingAlitStore = () => {
refSelectedStore.value.open().then(res => {
const data = {
alipayBindState: 1,
deviceId: vdata.record.deviceId,
storeId: res.storeId,
}
jeepayPopupConfirmRef.value.open(`您确认要把[${res.storeName}]绑定至蚂蚁店铺吗?`).then(r => {
$BindLite(data).then(res => {
infoBox.showSuccessToast('蚂蚁店铺绑定成功')
refData(vdata.record.deviceId)
})
}).catch(er=>{
bindingAlitStore()
})
})
}
// 获取蚂蚁店铺信息
const getAliStoreInfo = () => {
reqLoad.list(API_URL_MCH_STORE_LIST, { pageSize: '-1', alipayShopStatus: 99 }).then(({ bizData }) => {
vdata.aliStoreInfo = bizData.records.find(v => v.storeId == vdata.record.storeId)
})
}
// 解绑店铺
const unBindIng = () => {
const data = {
alipayBindState: 0,
deviceId: vdata.record.deviceId,
storeId: vdata.record.storeId,
}
jeepayPopupConfirmRef.value.open('您确认要解绑蚂蚁店铺吗?', { confirmColor: '#FF5B4C' }).then(res => {
$BindLite(data).then(res => {
infoBox.showSuccessToast('蚂蚁店铺解绑成功')
refData(vdata.record.deviceId)
})
})
}
</script>
<style lang="scss" scoped>
.default-image {
width: 50rpx;
height: 50rpx;
}
.selected-qrcId {
width: 40rpx;
height: 40rpx;
transform: rotate(90deg);
}
.un-binding {
display: flex;
justify-content: center;
align-items: center;
margin: 15px;
margin-top: 0;
height: 110rpx;
background-color: rgba($color: #ec4444, $alpha: 0.1);
color: #ec4444;
border-radius: 10rpx;
}
.hover-button {
opacity: 0.5;
}
</style>

View File

@@ -1,190 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar bgDefaultColor="#fff" :title=" vdata.isAdd ? '绑定云打印机' : '修改云打印机信息'" backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="120">
<uni-forms-item v-if="vdata.isAdd" required label="设备号" name="deviceNo">
<uni-easyinput v-model="vdata.formData.deviceNo" placeholder="请输入设备号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="设备名称" name="deviceName">
<uni-easyinput v-model="vdata.formData.deviceName" placeholder="请输入设备名称" :inputBorder="false"></uni-easyinput>
</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="vdata.formData.storeId" :showName="vdata.bindStoreName" />
</uni-forms-item>
<view class="line"></view>
<JeepayTableListItem title="状态" subtitle="状态禁用后, 设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
<view class="line"></view>
<uni-forms-item required label="打印参数" name="printMode">
<JeepayRadioPopupView label="请选择参数" v-model:value="vdata.formData.printMode" :list="[{ label: '仅打印', value: 1}, { label: '仅播报', value: 2}, { label: '打印并播报', value: 3}]">
</JeepayRadioPopupView>
</uni-forms-item>
<uni-forms-item required label="打印联数" name="printNum">
<uni-easyinput type="number" v-model="vdata.formData.printNum" placeholder="请输入联数" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
</uni-forms>
<view class="confirm-wrapper">
<Button @tap="confirmFunc">{{ vdata.deviceId ? '确认修改' : '确认创建' }}</Button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
const rules = {
storeId: {
rules:[ formUtil.rules.requiredSelect('门店') ],
},
deviceNo: {
rules:[ formUtil.rules.requiredInput('') ],
},
deviceName: {
rules:[ formUtil.rules.requiredInput('') ],
},
printMode: {
rules:[ formUtil.rules.requiredSelect('打印参数') ],
},
printNum: {
rules:[ formUtil.rules.requiredInput('') ],
},
}
const formRef = ref()
const vdata = reactive({
deviceId: null, // 新建 or 修改
isAdd: true, // 是否新增页面
bindStoreName: '',
// 表单数据
formData: {
state: 1 // 默认启用
}
})
onLoad((options) => {
// 修改页面
if(options.deviceId){
vdata.isAdd = false
vdata.deviceId = options.deviceId
reqLoad.getById(API_URL_SYS_DEVICE_LIST, vdata.deviceId).then(({bizData}) => {
bizData.printMode = JSON.parse(bizData.bizConfigParams).printMode
bizData.printNum = JSON.parse(bizData.bizConfigParams).printNum
vdata.formData = bizData
vdata.bindStoreName = bizData.storeName
})
}
// 参数赋值。
if(options.deviceNo){
vdata.formData.deviceNo = options.deviceNo
}
})
function confirmFunc(){
formUtil.validate(formRef.value).then(() => {
if (!(/^[1-9]\d*$/.test(vdata.formData.printNum))) {
return infoBox.showToast('请输入正整数')
}
let reqData = Object.assign({}, vdata.formData)
reqData.deviceType = 2 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
reqData.bizConfigParams = {
printMode: vdata.formData.printMode,
printNum: vdata.formData.printNum
}
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, reqData)
})
.then(( {bizData} ) => {
emit.pageEmit(emit.ENAME_REF_PRINTER_LIST) // 更新列表
go.back(1, emit.ENAME_REF_PRINTER_DETAIL) // 返回详情 && 更新详情 && search
})
}
</script>
<style lang="scss">
.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;
.name {
width: 392rpx;
color: #000;
}
.store-id {
color: #a1a1a1;
font-size: 30rpx;
}
}
.name-wrapper {
display: flex;
image {
align-self: center;
height: 80rpx;
}
}
</style>

View File

@@ -1,66 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="打印机管理"
searchTitle="搜索设备名称、编号"
searchType="device"
:searchParams="{deviceType: 2}"
:bottomBtnTitle="ak.ent.has('ENT_DEVICE_PRINTER_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
>
</CommonPageByDevice>
<JSinglePopup ref="jsinglePopupRef" :list="codeBindList" />
</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 } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
const jsinglePopupRef = ref(null)
const commonPageByDeviceRef = ref()
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_PRINTER_LIST) )
uni.$on(emit.ENAME_REF_PRINTER_LIST, function(data){
commonPageByDeviceRef.value.refTable(true)
})
const reqTableDataFunc = (params) => {
params.deviceType = 2 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
function bottomBtnClickFunc(){
jsinglePopupRef.value.open()
}
const codeBindList = [
{ label: '扫码绑定', value: 'scanCode', fun: () => {
uni.scanCode().then(({ result }) => {
go.to('PAGES_APP_PRINT_BIND', { deviceNo: result })
})
}
},
{ label: '手动绑定', value: 'handBind', fun: () => {
go.to('PAGES_APP_PRINT_BIND')
}
},
]
onReachBottom(() => {})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -1,155 +0,0 @@
<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/detailsLislImg/print-white.svg"
:title="vdata.record.deviceName"
:subtitle="vdata.record.deviceId"
:moreBtnList="list" />
<view class="create-time">
<view class="time-title">设备厂商</view>
<view class="dev-info">{{ datamap.provider(vdata.record.provider) }}</view>
</view>
<view class="create-time" style="border: none; padding-top: 0">
<view class="time-title">创建时间</view>
<view class="time-info">{{ vdata.record.createdAt }}</view>
</view>
<JeepayCard editText="编辑信息" @editTap="go.to('PAGES_APP_PRINT_BIND', {deviceId: vdata.record.deviceId})">
<JeepayDescview>
<JeepayDescviewItem title="设备名称" :desc="vdata.record.deviceName" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
<JeepayDescviewItem title="打印参数" :desc="['仅打印', '仅播报', '打印并播报'][vdata.record.bizConfigParams?.printMode - 1]" />
<JeepayDescviewItem title="打印联数" :desc="vdata.record.bizConfigParams?.printNum" />
</JeepayDescview>
</JeepayCard>
<JDetailsSwitch title="设备状态" subTitle="状态禁用后,该设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JDetailsSwitch>
</JeepayBackground>
<JSinglePopup ref="more" :list="list" activeColor="#FF5B4C" />
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
<uni-popup ref="popupDialog" type="dialog" :mask-click="false">
<uni-popup-dialog mode="base" title="金额" :before-close="true" @close="close" @confirm="testDevice">
<uni-easyinput v-model="vdata.amount" type="digit" placeholder="请输入金额" />
</uni-popup-dialog>
</uni-popup>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST, $printTest, $deviceUnbind } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
import datamap from '@/commons/utils/datamap.js'
const jeepayPopupConfirmRef = ref()
const popupDialog = ref(null)
const more = ref(null)
onLoad((options) => {
refData(options.deviceId)
})
const vdata = reactive({
record: {},
amount: ''
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_PRINTER_DETAIL))
uni.$on(emit.ENAME_REF_PRINTER_DETAIL, function(data){
refData(vdata.record.deviceId)
})
// 获取设备详情
const refData = (id) => {
reqLoad.getById(API_URL_SYS_DEVICE_LIST, id).then(({ bizData }) => {
bizData.bizConfigParams = JSON.parse(bizData.bizConfigParams)
vdata.record = bizData
})
}
function deleteFunc () {
jeepayPopupConfirmRef.value.open('您确认解绑设备吗?',{ confirmColor: '#FF5B4C' }).then(() => {
$deviceUnbind(vdata.record.deviceId).then(() => {
infoBox.showSuccessToast('解绑成功')
return go.back(1, emit.ENAME_REF_PRINTER_LIST)
})
})
}
const list = reactive([
{ label: '打印测试', value: 'test', fun: () => {
vdata.amount = ''
popupDialog.value.open()
}},
{ label: '解除绑定', value: 'remove', color: '#FF5B4C', fun: deleteFunc },
])
// 更新状态
function updateState(state) {
return reqLoad.updateById(API_URL_SYS_DEVICE_LIST, vdata.record.deviceId, { state: state }).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_PRINTER_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
// 关闭金额弹出框
function close() {
popupDialog.value.close()
more.value.open()
}
// 打印测试
function testDevice() {
if (!vdata.amount) {
return infoBox.showToast('请输入金额')
}
$printTest(vdata.record.deviceId, vdata.amount).then(() => {
popupDialog.value.close()
})
}
</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;
}
.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;
}
</style>

View File

@@ -1,49 +0,0 @@
<template>
<view class="h-wrapper">
<image style="width: 90rpx; height: 90rpx" :src="imgList[flag ? 1 : 0]" mode="scaleToFill" />
<view class="h-info">
<view class="h-title">{{ title }} <view class="state" :style="{ backgroundColor: flag ? '#168FFF' : '#d9d9d9' }"></view></view>
<view class="h-code">{{ subTitle }}</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
const props = defineProps({
title: { type: String }, //标题
subTitle: { type: String }, //副标题
flag: { type: Boolean }, //状态,
})
const imgList = reactive(['/pageDevice/static/detailsLislImg/horn-none.svg', '/pageDevice/static/devIconImg/icon-horn.svg'])
</script>
<style lang="scss" scoped>
.h-wrapper {
display: flex;
align-items: center;
padding-left: 40rpx;
height: 170rpx;
.h-info {
flex: 1;
margin-left: 20rpx;
.h-title {
display: flex;
justify-content: space-between;
align-items: center;
.state {
margin-right: 30rpx;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
}
margin-bottom: 16rpx;
font-size: 30rpx;
}
.h-code {
font-size: 26rpx;
color: #999;
}
}
}
</style>

View File

@@ -1,230 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar bgDefaultColor="#fff" :title="qrcInfo.createdAt ? '修改二维码' : '绑定二维码'" backCtrl="back" />
<uni-forms ref="qrcForm" :rules="rules" :model="qrcInfo" :label-width="160">
<uni-forms-item required label="立牌编号" name="qrcId" v-if="!qrcInfo.createdAt">
<view class="scan-wrapper">
<uni-easyinput :inputBorder="false" type="number" v-model="qrcInfo.qrcId" placeholder="请输入立牌编号" />
<image src="/pageDevice/static/devIconImg/icon-scan-code.svg" mode="scaleToFill" @tap="scanCode" />
</view>
</uni-forms-item>
<uni-forms-item required label="二维码名称" name="qrcAlias">
<uni-easyinput :inputBorder="false" type="text" v-model="qrcInfo.qrcAlias" placeholder="请输入立牌名称" />
</uni-forms-item>
<uni-forms-item required label="二维码金额">
<JeepayRadioPopupView v-model:value="qrcInfo.fixedFlag" :list="moneyTye">
<template #view="{ record }">
<view class="selected-sex" style="color: #000">
{{ record.label }}
<image src="/pageDevice/static/devIconImg/icon-arrow-sex.svg" mode="scaleToFill" />
</view>
</template>
</JeepayRadioPopupView>
</uni-forms-item>
<uni-forms-item required label="自定义金额" name="fixedPayAmount" v-if="qrcInfo.fixedFlag == 1">
<view class="amount-input"> <uni-easyinput :inputBorder="false" type="digit" v-model="qrcInfo.fixedPayAmount" /></view>
</uni-forms-item>
<view class="code-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.storeName" />
</uni-forms-item>
<view class="code-line"></view>
<!-- <uni-forms-item required label="绑定应用" name="appId">
<template #label>
<view class="f-label">绑定应用</view>
</template>
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="qrcInfo.appId" :showName="qrcInfo.appName" />
</uni-forms-item> -->
</uni-forms>
<view class="code-line"></view>
<JSwitchCard title="状态" tips="状态禁用后,该立牌将不可使用">
<template #right>
<JSwitch :bol="qrcInfo.qrcState == 1" :confirmTips="false" @confirm="(val) => (qrcInfo.qrcState = val ? 1 : 0)" />
</template>
</JSwitchCard>
<!-- <JSwitchCard title="支付宝支付方式" tips="支付宝支付方式">
<template #right>
<JeepayRadioPopupView v-model:value="qrcInfo.alipayWayCode" :list="aliTypeList">
<template #view="{ record }">
<view class="pay-type"> {{ record.label }}<image src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" /> </view>
</template>
</JeepayRadioPopupView>
</template>
</JSwitchCard> -->
<JSwitchCard title="页面类型" tips="谨慎选择,确认后不可变更" borderWidth="100vw" v-if="!qrcInfo.createdAt">
<template #right>
<JeepayRadioPopupView v-model:value="qrcInfo.entryPage" :list="pageTypeList">
<template #view="{ record }">
<view class="pay-type">{{ record.label }} <image src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" /> </view>
</template>
</JeepayRadioPopupView>
</template>
</JSwitchCard>
<view class="confirm-wrapper">
<Button @tap="submitBindCodeData">{{ qrcInfo.createdAt ? '保存修改' : '确认绑定' }}</Button>
</view>
</view>
<JSinglePopup :list="pageTypeList" ref="refPageType" confirm="selectedPageType" />
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_CODE_LIST, $bindEmptyQR, $parseQrCodeUrl } from '@/http/apiManager.js'
import formUtil from '@/commons/utils/formUtil.js'
import infoBox from '@/commons/utils/infoBox.js'
import emit from '@/commons/utils/emit.js'
import go from '@/commons/utils/go.js'
import cal from '@/commons/utils/cal.js'
onLoad((options) => {
if (options.codeId) {
return getDetails(options.codeId)
}
if (options.qrcId) return (qrcInfo.qrcId = options.qrcId)
})
const qrcInfo = reactive({
qrcId: '',
qrcState: 1,
entryPage: 'default',
alipayWayCode: 'ALI_JSAPI',
fixedFlag: 0,
})
// 表单实例
const qrcForm = ref(null)
// 选择页面类型
const refPageType = ref(null)
// 页面类型
const pageTypeList = [
{ label: '未指定', value: 'default' },
{ label: '仅H5网页', value: 'h5' },
{ label: '仅小程序', value: 'lite' },
]
// 支付宝支付方式
const aliTypeList = [
{ label: 'ALI_JSAPI', value: 'ALI_JSAPI' },
{ label: 'ALI_WAP', value: 'ALI_WAP' },
]
// 是否固定金额
const moneyTye = [
{ label: '固定金额', value: 1 },
{ label: '任意金额', value: 0 },
]
const rules = {
qrcAlias: {
rules: [formUtil.rules.requiredInput('')],
},
qrcId: {
rules: [formUtil.rules.requiredInput('')],
},
fixedPayAmount: {
rules: [formUtil.rules.requiredInput('')],
},
storeId: {
rules: [formUtil.rules.requiredSelect('门店')],
},
appId: {
rules: [formUtil.rules.requiredSelect('应用')],
},
}
const scanCode = () => {
uni.scanCode({
success: ({ result }) => {
$parseQrCodeUrl(result).then(({ bizData }) => {
qrcInfo.qrcId = bizData
})
},
fail: (err) => {
infoBox.showErrorToast('扫码失败')
},
})
}
const REG_AMOUNT = /^([0-9]{1}|^[1-9]{1}\d{1,15})(\.\d{1,2})?$/
// 提交绑定立牌数据
const submitBindCodeData = () => {
qrcForm.value.validate().then((res) => {
if (qrcInfo.fixedFlag == 1 && !REG_AMOUNT.test(qrcInfo.fixedPayAmount)) {
return infoBox.showToast('请输入正数 保留两位小数')
}
if (qrcInfo.createdAt) return saveQrcInfo()
$bindEmptyQR(qrcInfo).then((res) => {
infoBox.showSuccessToast('绑定成功')
go.back(1, emit.ENAME_REF_TERMINAL_LIST)
})
})
}
// 保存修改后的数据
const saveQrcInfo = () => {
reqLoad.addOrUpdate(qrcInfo.qrcId, API_URL_SYS_CODE_LIST, qrcInfo).then((res) => {
emit.pageEmit(emit.ENAME_REF_TERMINAL_LIST)
go.back(1, emit.ENAME_REF_QRC_DETAIL)
})
}
const getDetails = (id) => {
reqLoad.getById(API_URL_SYS_CODE_LIST, id).then(({ bizData }) => {
bizData.fixedPayAmount = cal.cert2Dollar(bizData.fixedPayAmount)
Object.assign(qrcInfo, bizData)
})
}
</script>
<style lang="scss">
input {
font-size: 32rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #b3b3b3;
image {
width: 120rpx;
height: 120rpx;
}
}
.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;
transform: translateX(40rpx);
image {
width: 108rpx;
height: 42rpx;
}
}
.scan-wrapper {
display: flex;
align-items: center;
input {
flex: 1;
}
image {
width: 80rpx;
height: 120rpx;
}
}
.code-line {
height: 20rpx;
background-color: $v-color-bgrey;
}
.amount-input {
display: flex;
align-items: center;
}
</style>

View File

@@ -1,75 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="码牌立牌管理"
searchTitle="搜索立牌名称、编号"
searchType="qrc"
searchStateField="qrcState"
: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, onShow } from '@dcloudio/uni-app';
import emit from '@/commons/utils/emit.js';
import CommonPageByDevice from '../commons/CommonPageByDevice.vue';
import { reqLoad, API_URL_SYS_CODE_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) => {
return reqLoad.list(API_URL_SYS_CODE_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);
$parseQrCodeUrl(result).then(({ bizData }) => {
console.log('bizData', bizData);
go.to('PAGES_APP_CODE_BIND', { qrcId: bizData });
});
},
fail: (err) => {
// infoBox.showErrorToast('扫码失败')
}
});
}
},
{
label: '手动绑定',
value: 'handBind',
fun: () => {
go.to('PAGES_APP_CODE_BIND');
}
}
];
onUnload(() => uni.$off(emit.ENAME_REF_QRC_LIST));
onReachBottom(() => {});
onShow(() => {
console.log('进入页面了============');
reqTableDataFunc();
commonPageByDeviceRef.value.refTable(true);
});
</script>
<style lang="scss" scoped></style>

View File

@@ -1,243 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{ height: '776rpx' }">
<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/detailsLislImg/code-white.svg"
:title="vdata.record.qrcAlias"
:subtitle="vdata.record.qrcId"
:moreBtnList="list"
/>
<view class="create-time">
<view class="time-title">创建时间</view>
<view class="time-info">{{ vdata.record.updatedAt }}</view>
</view>
<JeepayCard editText="编辑信息" @editTap="toEdit">
<JeepayDescviewItem title="二维码名称" :desc="vdata.record.qrcAlias" />
<JeepayDescviewItem title="二维码金额" :desc="vdata.record.fixedFlag == 1 ? '固定金额' : '任意金额'" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
<JeepayDescviewItem title="绑定应用" :desc="vdata.record.appName" />
</JeepayCard>
<JDetailsSwitch title="设备状态" subTitle="状态禁用后,该设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.qrcState" :showSwitchType="true" :updateStateFunc="confirmState" />
</template>
</JDetailsSwitch>
<JeepayCard>
<view class="qr-code flex-center">
<image class="qr-code-img" :src="vdata.qrcImgUrl" mode="scaleToFill" />
</view>
<template #editContent>
<view class="card-edit flex-center" hover-class="touch-hover" @tap="downLoadImg">
<image style="width: 40rpx; height: 40rpx; margin-right: 10rpx" src="/pageDevice/static/devIconImg/icon-save.svg" mode="scaleToFill" />
保存至相册
</view>
</template>
</JeepayCard>
<JeepayCard viewStyle="margin-top:30rpx" title="受支持的云音响设备" subtitle="以下云音响设备将会播报来自当前码牌的订单">
<block v-for="v in hornList" :key="v.deviceNo">
<hornCard :flag="v.state == 1" :title="v.deviceName" :subTitle="v.deviceNo" />
</block>
</JeepayCard>
</JeepayBackground>
<JSinglePopup ref="more" :list="list" activeColor="#FF5B4C" />
<JeepayPopupConfirm ref="tips" />
<l-painter isCanvasToTempFilePath @success="vdata.qrcImgUrl = $event" hidden css="width: 750rpx;background-color:#fff;">
<l-painter-view css="width:750rpx;">
<l-painter-qrcode :text="vdata.record.qrUrl" css="width:750rpx;height:750rpx;"></l-painter-qrcode>
<l-painter-view css="width:200rpx;height:200rpx;position:absolute;top:50%;left:50%;margin-top:-100rpx;margin-left:-100rpx;background-color:#fff;">
<l-painter-image :src="vdata.logo" css="width:100%;height:100%;"></l-painter-image>
</l-painter-view>
</l-painter-view>
</l-painter>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import hornCard from './components/hornCard.vue';
import go from '@/commons/utils/go.js';
import { reqLoad, API_URL_SYS_CODE_LIST, $getHornList, $unBindQrc } from '@/http/apiManager.js';
// import qrCode from '@/commons/utils/qrCode.js';
import { saveHeadImgFile } from '@/commons/utils/saveImg.js';
import infoBox from '@/commons/utils/infoBox.js';
import emit from '@/commons/utils/emit.js';
const vdata = reactive({
record: {},
qrcImgUrl: '',
logo: ''
});
onLoad((options) => {
getDetails(options.codeId);
uni.$on(emit.ENAME_REF_QRC_DETAIL, () => {
getDetails(vdata.record.qrcId);
});
vdata.logo = uni.getStorageSync('siteInfos').siteInfo.sysMinLogoUrl;
console.log(vdata)
});
onUnload(() => uni.$off(emit.ENAME_REF_QRC_DETAIL));
const more = ref(null);
const tips = ref(null);
const params = {};
const hornList = reactive([]);
const list = reactive([
{ label: '保存二维码图片', value: 'save', fun: downLoadImg },
{ label: '解除绑定', value: 'remove', color: '#FF5B4C', fun: unBinding }
]);
function unBinding() {
more.value.close();
tips.value
.open('确认解除绑定吗?', { confirmColor: '#FF5B4C' })
.then((res) => {
if (vdata.record.qrcBelongType == 1) return infoBox.showErrorToast('自建立牌不能解绑');
$unBindQrc(vdata.record.qrcId).then((res) => {
infoBox.showSuccessToast('解绑成功');
go.back(1, emit.ENAME_REF_QRC_LIST);
});
})
.catch((err) => {
more.value.open('remove');
});
}
const getDetails = (id) => {
reqLoad.getById(API_URL_SYS_CODE_LIST, id).then(({ bizData }) => {
vdata.record = bizData;
// vdata.qrcImgUrl = qrCode.drawImg(bizData.qrUrl);
getHornList(id);
});
};
// 查询受支持的云喇叭设备
const getHornList = (id) => {
$getHornList(id).then(({ bizData }) => {
Object.assign(hornList, bizData.records);
console.log('hornList', hornList);
});
};
const confirmState = (bol) => {
console.log('bol', bol);
return reqLoad.addOrUpdate(vdata.record.qrcId, API_URL_SYS_CODE_LIST, { qrcState: bol }).then((res) => {
emit.refPageAndSearchEmit(emit.ENAME_REF_QRC_LIST);
});
};
// 保存二维码
function downLoadImg() {
// #ifdef APP-PLUS
saveHeadImgFile(vdata.qrcImgUrl, 80)
.then((success) => {
infoBox.showSuccessToast('保存成功');
})
.catch((err) => {
infoBox.showErrorToast('保存失败');
});
// #endif
//#ifdef MP-WEIXIN
downloadQR();
//#endif
}
//#ifdef MP-WEIXIN
function downloadQR() {
wx.getSetting({
//获取权限
success(res) {
if (res.authSetting['scope.writePhotosAlbum']) {
download(vdata.qrcImgUrl);
} else {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
download(vdata.qrcImgUrl);
}
});
}
}
});
}
function download(data) {
const fileManager = wx.getFileSystemManager();
const filePath = wx.env.USER_DATA_PATH + '/res.png';
//这块是定义图片的名称,可自定义其他
fileManager.writeFile({
filePath: filePath,
data: data.slice(22),
encoding: 'base64',
success: (res) => {
wx.saveImageToPhotosAlbum({
filePath: filePath,
success: function (res) {
//保存成功
infoBox.showSuccessToast('保存成功');
},
fail: function (err) {
console.log(err);
//保存失败
infoBox.showErrorToast('保存失败');
}
});
},
fail: (err) => {
infoBox.showErrorToast('保存失败');
}
});
}
//#endif
const toEdit = (val) => {
go.to('PAGES_APP_CODE_BIND', { codeId: vdata.record.qrcId });
};
</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;
}
.default-img {
width: 50rpx;
height: 50rpx;
}
.qr-code {
width: 680rpx;
height: 370rpx;
.qr-code-img {
width: 270rpx;
height: 270rpx;
}
}
.c-card-wrapper {
margin-top: 30rpx !important;
}
.card-edit {
height: 110rpx;
border-top: 1rpx solid #ededed;
color: #2980fd;
font-size: 33rpx;
font-weight: 400;
image {
width: 44rpx;
height: 44rpx;
margin-right: 10rpx;
}
}
</style>

View File

@@ -1,205 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar bgDefaultColor="#fff" :title=" vdata.isAdd ? '绑定扫码POS' : '修改扫码POS信息'" backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="120">
<uni-forms-item v-if="vdata.isAdd" required label="设备号" name="deviceNo">
<uni-easyinput v-model="vdata.formData.deviceNo" placeholder="请输入设备号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="设备名称" name="deviceName">
<uni-easyinput v-model="vdata.formData.deviceName" placeholder="请输入设备名称" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<view class="line"></view>
<uni-forms-item required label="选择应用" name="appId">
<template #label>
<view class="f-label">选择应用</view>
</template>
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="vdata.formData.appId" :showName="vdata.bindAppName" />
</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="vdata.formData.storeId" :showName="vdata.bindStoreName" />
</uni-forms-item>
<view class="line"></view>
<JeepayTableListItem title="状态" subtitle="状态禁用后, 设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
</uni-forms>
<view class="confirm-wrapper">
<Button @tap="confirmFunc">{{ vdata.deviceId ? '确认修改' : '确认创建' }}</Button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
const rules = {
appId: {
rules:[ formUtil.rules.requiredSelect('应用') ],
},
storeId: {
rules:[ formUtil.rules.requiredSelect('门店') ],
},
deviceNo: {
rules:[ formUtil.rules.requiredInput('') ],
},
deviceName: {
rules:[ formUtil.rules.requiredInput('') ],
},
}
const formRef = ref()
const vdata = reactive({
deviceId: null, // 新建 or 修改
isAdd: true, // 是否新增页面
bindAppName: '',
bindStoreName: '',
// 表单数据
formData: {
state: 1 // 默认启用
}
})
onLoad((options) => {
// 修改页面
if(options.deviceId){
vdata.isAdd = false
vdata.deviceId = options.deviceId
reqLoad.getById(API_URL_SYS_DEVICE_LIST, vdata.deviceId).then(({bizData}) => {
vdata.formData = bizData
vdata.bindAppName = bizData.appName
vdata.bindStoreName = bizData.storeName
})
}
// 参数赋值。
if(options.deviceNo){
vdata.formData.deviceNo = options.deviceNo
}
})
function confirmFunc(){
formUtil.validate(formRef.value).then(() => {
let reqData = Object.assign({}, vdata.formData)
reqData.deviceType = 3 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, reqData)
})
.then(( {bizData} ) => {
emit.pageEmit(emit.ENAME_REF_SCANPOS_LIST) // 更新列表
go.back(1, emit.ENAME_REF_SCANPOS_DETAIL) // 返回详情 && 更新详情 && search
})
}
// 选择门店
function showSelectStoreFunc (){
jeepayStoreSelect.value.open().then((selected) => {
// 当前选择的门店
vdata.selectedStoreInfo = selected || { }
vdata.formData.storeId = vdata.selectedStoreInfo.storeId
})
}
// 选择应用
function showSelectMchAppFunc (){
jeepayMchAppSelect.value.open().then((selected) => {
// 当前选择的门店
vdata.selectedMchAppInfo = selected || { }
vdata.formData.appId = vdata.selectedMchAppInfo.appId
})
}
</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;
.name {
width: 392rpx;
color: #000;
}
.store-id {
color: #a1a1a1;
font-size: 30rpx;
}
}
.name-wrapper {
display: flex;
image {
align-self: center;
height: 80rpx;
}
}
</style>

View File

@@ -1,64 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="扫码pos管理"
searchTitle="搜索设备名称、编号"
searchType="device"
:searchParams="{deviceType: 3}"
:bottomBtnTitle="ak.ent.has('ENT_DEVICE_POS_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
>
</CommonPageByDevice>
<JSinglePopup ref="jsinglePopupRef" :list="codeBindList" />
</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 } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
const jsinglePopupRef = ref(null)
const commonPageByDeviceRef = ref()
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_SCANPOS_LIST) )
uni.$on(emit.ENAME_REF_SCANPOS_LIST, function(data){
commonPageByDeviceRef.value.refTable(true)
})
const reqTableDataFunc = (params) => {
params.deviceType = 3 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
function bottomBtnClickFunc(){
jsinglePopupRef.value.open()
}
const codeBindList = [
{ label: '扫码绑定', value: 'scanCode', fun: () => {
uni.scanCode().then(({ result }) => {
go.to('PAGES_APP_SCANPOS_BIND', { deviceNo: result })
})
}
},
{ label: '手动绑定', value: 'handBind', fun: () => {
go.to('PAGES_APP_SCANPOS_BIND')
}
},
]
onReachBottom(() => {})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -1,126 +0,0 @@
<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="扫码POS详情" backCtrl="back" />
<JeepayTableListItem viewClass="list-item-by-detail"
logo="/pageDevice/static/detailsLislImg/scanPos-white.svg"
:title="vdata.record.deviceName"
:subtitle="vdata.record.deviceId"
:moreBtnList="list" />
<view class="create-time">
<view class="time-title">设备厂商</view>
<view class="dev-info">{{ datamap.provider(vdata.record.provider) }}</view>
</view>
<view class="create-time" style="border: none; padding-top: 0">
<view class="time-title">创建时间</view>
<view class="time-info">{{ vdata.record.createdAt }}</view>
</view>
<JeepayCard editText="编辑信息" @editTap="go.to('PAGES_APP_SCANPOS_BIND', {deviceId: vdata.record.deviceId})">
<JeepayDescview>
<JeepayDescviewItem title="设备名称" :desc="vdata.record.deviceName" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
<JeepayDescviewItem title="绑定应用" :desc="vdata.record.appId" />
</JeepayDescview>
</JeepayCard>
<JDetailsSwitch title="设备状态" subTitle="状态禁用后,该设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JDetailsSwitch>
</JeepayBackground>
<JSinglePopup ref="more" :list="list" activeColor="#FF5B4C" />
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_DEVICE_LIST, $deviceUnbind } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
import datamap from '@/commons/utils/datamap.js'
const jeepayPopupConfirmRef = ref()
onLoad((options) => {
refData(options.deviceId)
})
const vdata = reactive({
record: {},
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_SCANPOS_DETAIL))
uni.$on(emit.ENAME_REF_SCANPOS_DETAIL, function(data){
refData(vdata.record.deviceId)
})
// 获取设备详情
const refData = (id) => {
reqLoad.getById(API_URL_SYS_DEVICE_LIST, id).then(({ bizData }) => {
vdata.record = bizData
})
}
function deleteFunc () {
jeepayPopupConfirmRef.value.open('您确认解绑设备吗?',{ confirmColor: '#FF5B4C' }).then(() => {
$deviceUnbind(vdata.record.deviceId).then(() => {
infoBox.showSuccessToast('解绑成功')
return go.back(1, emit.ENAME_REF_SCANPOS_LIST)
})
})
}
const list = reactive([
{ label: '解除绑定', value: 'remove', color: '#FF5B4C', fun: deleteFunc }
])
// 更新状态
function updateState(state) {
return reqLoad.updateById(API_URL_SYS_DEVICE_LIST, vdata.record.deviceId, { state: state }).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_SCANPOS_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
</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;
}
.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;
}
</style>

View File

@@ -1,53 +0,0 @@
<template>
<view class="h-wrapper">
<image style="width: 90rpx; height: 90rpx" src="/static/devIconImg/icon-code.svg" mode="scaleToFill" />
<view class="h-info">
<view class="h-title">{{ title }}</view>
<view class="h-code">{{ subTitle }}</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
const props = defineProps({
title: { type: String }, //标题
subTitle: { type: String }, //副标题
flag: { type: Boolean }, //状态,
})
</script>
<style lang="scss" scoped>
.h-wrapper {
display: flex;
align-items: center;
padding-left: 40rpx;
height: 170rpx;
.h-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 15rpx;
margin-left: 20rpx;
.h-title {
display: flex;
justify-content: space-between;
align-items: center;
.state {
margin-right: 30rpx;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
}
margin-bottom: 16rpx;
font-size: 30rpx;
}
.h-code {
font-size: 26rpx;
color: #999;
}
}
}
</style>

View File

@@ -1,165 +0,0 @@
<template>
<uni-popup ref="popup" type="bottom" mask-background-color="rgba(0,0,0,.5)" :safe-area="false">
<view class="card-wrapper">
<view class="card-title flex-center">请勾选播报的码牌</view>
<!-- 循环部分 start -->
<JeepayTableList ref="refQrcTable" :reqTableDataFunc="reqTableDataFunc" :searchData="vdata.searchData" :initData="false">
<template #tableBody="{ record }">
<view class="h-wrapper" :style="{ opacity: vdata.qrcList.includes(record.qrcId) ? 1 : 0.6 }">
<image style="width: 90rpx; height: 90rpx" :src="vdata.imageList[record.qrcState]" mode="scaleToFill" />
<view class="h-info">
<view class="h-title">{{ record.qrcAlias }}</view>
<view class="h-code">{{ record.qrcId }}</view>
</view>
<JSwitch
:bol="vdata.qrcList.includes(record.qrcId)"
:confirmTips="false"
@confirm="change($event, record.qrcId)"
:disabled="vdata.bindQrcId == record.qrcId"
@click="isDefaultQrc(record.qrcId)"
/>
</view>
</template>
</JeepayTableList>
<!-- 循环部分end -->
<view class="footer-wrapper">
<view class="footer-main">
<view class="footer-button">
<view class="flex-center" hover-class="touch-button" @tap="popup.close()">取消</view>
<view class="confirm flex-center" hover-class="touch-button" @tap="saveQrcId">确认</view>
</view>
</view>
</view>
</view>
</uni-popup>
</template>
<script setup>
import { nextTick, reactive, ref } from 'vue'
const popup = ref(null)
import { reqLoad, API_URL_SYS_CODE_LIST, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js'
const refQrcTable = ref(null)
const emits = defineEmits(['updateDetails'])
const vdata = reactive({
searchData: {},
imageList: ['/pageDevice/static/detailsLislImg/code-none.svg', '/pageDevice/static/devIconImg/icon-code.svg'],
})
const open = (storeId, qrcList, deviceId, bindQrcId) => {
vdata.qrcList = JSON.parse(JSON.stringify(qrcList))
vdata.deviceId = deviceId
vdata.bindQrcId = bindQrcId
vdata.searchData = {
qrcBelongType: 2,
storeId,
}
popup.value.open()
nextTick(() => {
refQrcTable.value.refTable(true)
})
}
const reqTableDataFunc = (params) => {
return reqLoad.list(API_URL_SYS_CODE_LIST, params)
}
const change = (e, qrcId) => {
if (e) {
vdata.qrcList.push(qrcId)
} else {
vdata.qrcList.splice(
vdata.qrcList.findIndex((val) => val == qrcId),
1
)
}
}
const isDefaultQrc = (qrcId) => {
if (vdata.bindQrcId == qrcId) return infoBox.showToast('平台指定默认码牌不可更改状态')
}
// 保存
const saveQrcId = () => {
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, { qrcIdList: vdata.qrcList, bindType: 1 }).then((res) => {
emits('updateDetails')
popup.value.close()
})
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
.card-wrapper {
border-radius: 32rpx 32rpx 0 0;
background-color: #fff;
padding-bottom: 60rpx;
max-height: 70vh;
overflow-y: auto;
.card-title {
margin-bottom: 20rpx;
height: 110rpx;
font-size: 30rpx;
font-weight: 400;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.07);
}
.footer-wrapper {
height: 186rpx;
.footer-main {
position: fixed;
left: 0;
right: 0;
bottom: env(safe-area-inset-bottom);
backdrop-filter: blur(20rpx);
border-top: 1rpx solid #ededed;
.footer-button {
padding: 0 30rpx;
margin-top: 30rpx;
padding-bottom: 30rpx;
display: flex;
justify-content: space-between;
view {
width: 330rpx;
height: 110rpx;
font-size: 33rpx;
font-weight: 500;
color: rgba(0, 0, 0, 0.5);
border-radius: 20rpx;
background-color: #f7f7f7;
}
.confirm {
color: #fff;
background: $jeepay-bg-primary;
}
}
}
}
}
.h-wrapper {
display: flex;
align-items: center;
padding: 0 40rpx;
height: 170rpx;
.h-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 15rpx;
margin-left: 20rpx;
.h-title {
display: flex;
justify-content: space-between;
align-items: center;
.state {
margin-right: 30rpx;
width: 20rpx;
height: 20rpx;
border-radius: 50%;
}
margin-bottom: 16rpx;
font-size: 30rpx;
}
.h-code {
font-size: 26rpx;
color: #999;
}
}
}
</style>

View File

@@ -1,158 +0,0 @@
<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>
<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: 1,
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
},
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_TERMINAL_LIST)
go.back(1, emit.ENAME_REF_SPEAKER_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>

View File

@@ -1,67 +0,0 @@
<template>
<CommonPageByDevice
navTitle="云音响管理"
searchTitle="搜索设备名称、设备编号"
searchType="device"
:searchParams="{ deviceType: 1 }"
:bottomBtnTitle="ak.ent.has('ENT_DEVICE_SPEAKER_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
ref="commonPageByDeviceRef"
>
</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 infoBox from '@/commons/utils/infoBox.js'
import CommonPageByDevice from '../commons/CommonPageByDevice.vue'
import { reqLoad, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
uni.$on(emit.ENAME_REF_SPEAKER_LIST, (data) => {
commonPageByDeviceRef.value.refTable(true)
})
const commonPageByDeviceRef = ref(null)
const reqTableDataFunc = (params) => {
params.deviceType = 1 // 1-云喇叭, 2-云打印, 3-扫码pos, 4-智能pos, 5-收银插件
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
const bindPopup = ref(null)
function bottomBtnClickFunc() {
bindPopup.value.open()
}
const codeBind = reactive([
{
label: '扫码绑定',
value: 'scanCode',
fun: () => {
uni.scanCode({
success: ({ result }) => {
go.to('PAGES_APP_HORN_BIND', { deviceNo: result })
},
fail: (err) => {
},
})
},
},
{
label: '手动绑定',
value: 'handBind',
fun: () => {
go.to('PAGES_APP_HORN_BIND')
},
},
])
onUnload(() => uni.$off(emit.ENAME_REF_SPEAKER_LIST))
onReachBottom(() => {})
</script>
<style lang="scss" scoped></style>

View File

@@ -1,225 +0,0 @@
<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/detailsLislImg/horn-white.svg"
:title="vdata.deviceName"
:subtitle="vdata.deviceNo"
:moreBtnList="list"
/>
<view class="create-time">
<view class="time-title">设备厂商</view>
<view class="dev-info">{{ datamap?.provider(vdata.provider) }}</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" />
</JeepayDescview>
</JeepayCard>
<JDetailsSwitch title="设备状态" subTitle="状态禁用后,该设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.state" :showSwitchType="true" :updateStateFunc="confirmSwitch" />
</template>
</JDetailsSwitch>
<view class="store-info">
<JDetailsCell title="播报类型" :info="vdata.bindType == 0 ? '门店所有订单' : '来自受支持码牌的订单'" @tap="refBindType.open(vdata.bindType)" />
</view>
<JeepayCard
viewStyle="margin-top:30rpx"
title="受支持的云音响设备"
subtitle="以下云音响设备将会播报来自当前码牌的订单"
v-if="vdata.bindType == 1"
@clickTitle="qrcId.open(vdata.storeId, vdata.qrcIdList, vdata.deviceId, vdata.bindQrcId)"
>
<template #titleRight>
<image class="selected-qrcId" src="/static/iconImg/icon-arrow-black.svg" mode="scaleToFill" />
</template>
<block v-for="v in vdata.qrcList" :key="v.qrcId">
<qrcCode :title="v.qrcAlias" :subTitle="v.qrcId" />
</block>
</JeepayCard>
<JSinglePopup ref="more" :list="list" activeColor="#FF5B4C" />
<JSinglePopup ref="refBindType" :list="typeList" @confirm="editBindType" />
<JeepayPopupConfirm ref="tips" />
<uni-popup ref="popupDialog" type="dialog">
<uni-popup-dialog
mode="base"
:before-close="true"
title="播报金额"
@close="
() => {
popupDialog.close();
more.open();
}
"
@confirm="testDevice"
>
<uni-easyinput :inputBorder="false" :clearable="false" v-model="vdata.amount" type="digit" placeholder="请输入播报金额" />
</uni-popup-dialog>
</uni-popup>
<selectedQrcId ref="qrcId" @updateDetails="getDetails(vdata.deviceId)" />
<view class="launch-box" v-if="vdata.provider === 'lkls'">
<button @click="toLaunch(vdata.deviceNo)" style="background: #41b5ff; margin: 0 40rpx; margin-top: 40rpx; color: #fff">发布投放</button>
</view>
</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 qrcCode from './components/qrcCode.vue';
import datamap from '@/commons/utils/datamap.js';
import selectedQrcId from './components/selectedQrcId.vue';
import emit from '@/commons/utils/emit.js';
import go from '@/commons/utils/go.js';
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_SPEAKER_DETAIL));
uni.$on(emit.ENAME_REF_SPEAKER_DETAIL, function (data) {
getDetails(vdata.deviceId);
});
onLoad((options) => {
getDetails(options.deviceId);
});
const more = ref(null);
const tips = ref(null);
const refBindType = ref(null);
const popupDialog = ref(null);
const qrcId = ref(null);
const vdata = reactive({
amount: ''
});
// 发布投放
const toLaunch = (deviceNo) => {
uni.navigateTo({
url: `/pages/release/release?deviceNo=${deviceNo}`
});
};
const list = reactive([
{
label: '播报测试',
value: 'test',
fun: () => {
vdata.amount = '';
popupDialog.value.open();
}
},
{ 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_SPEAKER_LIST);
});
});
})
.catch((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 }) => {
vdata.provider = bizData.provider;
console.log(bizData, 'bizDatabizDatabizData');
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);
});
};
// 播报测试
function testDevice() {
if (!vdata.amount) {
return infoBox.showErrorToast('请输入播报金额');
}
$speakTest(vdata.deviceId, { amount: vdata.amount }).then((res) => {
popupDialog.value.close();
});
}
// 修改绑定设备信息
const editBindType = (val) => {
tips.value
.open('确认修改播报类型吗?')
.then((res) => {
vdata.bindType = val.value;
return reqLoad.addOrUpdate(vdata.deviceId, API_URL_SYS_DEVICE_LIST, { bindType: vdata.bindType, qrcIdList: vdata.qrcIdList || [] });
})
.catch(() => {
refBindType.value.open(vdata.bindType);
});
};
// 去编辑页面
const toEdit = () => {
go.to('PAGES_APP_HORN_BIND', { 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>

View File

@@ -1,322 +0,0 @@
<template>
<JeepayBackground>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar :title="vdata.sysUserId ? '修改' : '创建' " backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="140">
<uni-forms-item required label="姓名" name="realname">
<uni-easyinput v-model="vdata.formData.realname" placeholder="请输入姓名" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item v-if="!vdata.sysUserId" required label="登录用户名" name="loginUsername">
<uni-easyinput v-model="vdata.formData.loginUsername" placeholder="6-18位字母开头且不包含符号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="手机号" name="telphone">
<uni-easyinput v-model="vdata.formData.telphone" placeholder="请输入手机号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="编号">
<uni-easyinput v-model="vdata.formData.userNo" placeholder="请输入用户编号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="性别" name="sex">
<JeepayRadioPopupView label="请选择性别" v-model:value="vdata.formData.sex" :list="[{ label: '男', value: 1}, { label: '女', value: 2}]">
</JeepayRadioPopupView>
</uni-forms-item>
<view class="line"></view>
<!-- -->
<uni-forms-item required v-if="showUserType()" label="类型" name="userType">
<JeepayRadioPopupView label="请选择用户类型" v-model:value="vdata.formData.userType" :list="appendUserTypeList()" @change="changeUserTypeFunc">
</JeepayRadioPopupView>
</uni-forms-item>
<!-- 选择用户类型后需要显示当前已绑定的门店列表 -->
<uni-forms-item v-if="vdata.formData.userType && vdata.formData.userType != 1" required label="绑定门店" name="storeList">
<template #label>
<view class="f-label">绑定门店</view>
</template>
<view class="selected-sex" @tap="showStoreFunc">
<view class="selected-box">
<view v-for="(item) in vdata.selectedStoreList">{{item.storeName}} - {{item.storeId}}</view>
</view>
<image src="/pageDevice/static/devIconImg/icon-arrow-sex.svg" mode="scaleToFill" />
</view>
</uni-forms-item>
<view class="line"></view>
<uni-forms-item v-if="!vdata.sysUserId" required label="密码设置" name="pwdDefaultByPage">
<JeepayRadioPopupView label="请选择密码设置类型" v-model:value="vdata.formData.pwdDefaultByPage" :list="[{ label: '默认密码', value: 1}, { label: '自定义密码', value: 0}]">
</JeepayRadioPopupView>
</uni-forms-item>
<uni-forms-item v-if="vdata.formData.pwdDefaultByPage == 0" required label="自定义密码" name="loginPassword">
<uni-easyinput v-model="vdata.formData.loginPassword" placeholder="请输入自定义密码" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<view class="line"></view>
</uni-forms>
<template v-if="!vdata.sysUserId">
<JeepayTableListItem title="状态" subtitle="状态禁用后用户将无法登录APP和后台管理系统">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
<JeepayTableListItem title="开通提醒" subtitle="启用后,用户创建完成时,将发送开通提醒短信至用户手机号">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.isNotify" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
</template>
<view class="confirm-wrapper">
<view class="confirm-button flex-center" hover-class="touch-button" @tap="confirmFunc"> {{ vdata.sysUserId ? '确认修改' : '确认创建' }}</view>
</view>
</view>
<!-- 选择门店, 店长支持多选 -->
<JeepayPopupListSelect
ref="storeSelectRef"
:reqTableDataFunc="reqTableDataByStoreFunc"
:isCheckbox="vdata.formData.userType == 11"
searchInputName="storeName"
:fields="{ key: 'storeId', left: 'storeName', right: 'storeId' }"
/>
</JeepayBackground>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { $getPasswordRules, reqLoad, API_URL_SYS_USER_LIST, API_URL_MCH_STORE_LIST, API_URL_USER_BIND_STORE_LIST,$getBindStoreList } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
import storageManage from '@/commons/utils/storageManage.js'
const formRef = ref()
const storeSelectRef = ref()
onLoad((options) => {
// test() // 本地测试。
// 获取密码规则
$getPasswordRules().then(({bizData}) => {
vdata.passwordRules = bizData
})
// 修改页面
if(options.sysUserId){
vdata.sysUserId = options.sysUserId
reqLoad.getById(API_URL_SYS_USER_LIST, vdata.sysUserId).then(({bizData}) => {
vdata.formData = bizData
// 查询已绑定门店
reqLoad.list(API_URL_USER_BIND_STORE_LIST, {sysUserId: options.sysUserId, pageSize: -1}).then((storeRes) => {
vdata.selectedStoreList = storeRes.bizData.records
})
})
}
})
const rules = {
realname: {
rules:[ formUtil.rules.requiredInput() ],
},
loginUsername: {
rules:[ formUtil.rules.requiredInput(), formUtil.rules.patternRule('登录用户名', formUtil.regexp.loginUsername) ],
},
telphone: {
rules:[ formUtil.rules.requiredInput(), formUtil.rules.patternRule('联系人电话', formUtil.regexp.mobile) ],
},
sex: {
rules:[ formUtil.rules.requiredSelect('性别', 'number') ],
},
userType: {
rules:[ formUtil.rules.requiredSelect('用户类型', 'number') ],
},
pwdDefaultByPage: {
rules:[ formUtil.rules.requiredSelect('密码类型', 'number') ],
},
loginPassword: {
rules:[{ format: 'string', required: true, errorMessage: '请输入密码', validateFunction: function(rule,value,data,callback){
if(!new RegExp(vdata.passwordRules.regexpRules).test(value)){
callback(vdata.passwordRules.errTips)
return false;
}
return true;
}
}],
}
}
const vdata = reactive({
sysUserId: null, // 新建 or 修改
// 表单数据
formData: {
state: 1,
isNotify: 0,
pwdDefaultByPage: undefined, // 1-默认, 0-自定义 注意, 前端的值, 后端无需该字段
},
passwordRules: { }, // 密码验证规则
selectedStoreList: [], // 选择的门店
})
// 切换用户类型后, 绑定的门店取消。
function changeUserTypeFunc(){
vdata.selectedStoreList = []
}
function reqTableDataByStoreFunc(params) {
params.userType = vdata.formData.userType
return $getBindStoreList(params)
}
function showStoreFunc(){
// 选择门店
storeSelectRef.value.open().then((selected) => {
vdata.selectedStoreList = []
if(selected){
vdata.selectedStoreList = vdata.formData.userType == 11 ? selected : [selected]
}
storeSelectRef.value.close() //自行关闭
})
}
function confirmFunc(){
formUtil.validate(formRef.value).then(() => {
// 超管, 必须选择门店。
if(vdata.formData.userType != 1 && vdata.selectedStoreList.length <= 0){
infoBox.showToast("请选择绑定门店")
return Promise.reject()
}
// 处理选择门店
let reqData = Object.assign({}, vdata.formData)
let storeIdList = []
vdata.selectedStoreList.forEach(r => storeIdList.push(r.storeId) )
reqData.storeIdList = storeIdList.join() // 后端需要是 逗号拼接类型。
// 处理 密码
if(vdata.formData.pwdDefaultByPage == 1){
reqData.loginPassword = ""
}
return reqLoad.addOrUpdate(vdata.sysUserId, API_URL_SYS_USER_LIST, reqData)
})
.then(( {bizData} ) => {
emit.pageEmit(emit.ENAME_REF_SYS_USER_LIST) // 更新列表
go.back(1, emit.ENAME_REF_SYS_USER_DETAIL) // 返回详情 && 更新详情
})
}
function appendUserTypeList(){
// 店长 && 新增
if(storageManage.userInfo().userType == 11){
return [{ label: '店员', value: 12}]
}
return [{ label: '超级管理员', value: 1}, { label: '店长', value: 11}, { label: '店员', value: 12}]
}
function showUserType(){
// 新增页面都显示
if(!vdata.sysUserId){
return true;
}
// 店长 && 修改 不显示
if(storageManage.userInfo().userType == 11){
return false;
}
}
function test(){
let time = new Date().getTime()
vdata.formData.realname = '张三'
vdata.formData.loginUsername = 'A'+ time
vdata.formData.telphone = ('12' + time + '').substring(0, 11)
vdata.formData.userNo = 'A'+ time
vdata.formData.sex = 1
vdata.formData.userType = 12
vdata.formData.pwdDefaultByPage = 1
}
</script>
<style lang="scss" scoped>
input {
font-size: 32rpx;
}
.f-label {
width: 240rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-top: 45rpx;
margin-bottom: 10rpx;
font-size: 32rpx;
color: #b3b3b3;
image {
width: 120rpx;
height: 120rpx;
margin-top: -40rpx;
}
.selected-box {
color: #000;
}
}
.confirm-wrapper {
padding: 50rpx 30rpx;
.confirm-button {
height: 110rpx;
color: #fff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
}
</style>

View File

@@ -1,249 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{}">
<JeepayCustomNavbar textColor="#fff" bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" title="详情" backCtrl="back" />
<view class="sta-info">
<image class="sta-photo" :src="vdata.record.avatarUrl" mode="scaleToFill" />
<view class="info-main">
<view class="info-name">
{{ vdata.record.realname }}
<image src="/pageDevice/static/devIconImg/icon-more-white.svg" mode="scaleToFill" @tap="single.open('delete')" />
</view>
<view class="info-phone">{{ vdata.record.telphone }}</view>
</view>
</view>
<JeepayCard viewStyle="margin-top: 50rpx" editText="编辑信息" @editTap="go.to('PAGES_USER_EDIT', {sysUserId: vdata.record.sysUserId})">
<JeepayDescview>
<JeepayDescviewItem title="用户ID" :desc="vdata.record.sysUserId" />
<JeepayDescviewItem title="完整手机号" :desc="vdata.record.telphone" />
<JeepayDescviewItem title="用户登录名" :desc="vdata.record.loginUsername" />
<JeepayDescviewItem title="用户性别" >
<template #desc>
<view class="sex-info-text">
<template v-if="vdata.record.sex == 1">
<image src="/pageDevice/static/devIconImg/icon-man.svg" mode="scaleToFill" />
</template>
<template v-else-if="vdata.record.sex == 2">
<image src="/pageDevice/static/devIconImg/icon-woman.svg" mode="scaleToFill" />
</template>
<template v-else>
未知
</template>
</view>
</template>
</JeepayDescviewItem>
<JeepayDescviewItem title="用户编号" :desc="vdata.record.userNo" />
<JeepayDescviewItem title="用户类型" >
<template #desc>
<JeepayTag :type="datamap.userType(vdata.record.userType).type">{{ datamap.userType(vdata.record.userType).text }}</JeepayTag>
</template>
</JeepayDescviewItem>
<JeepayDescviewItem title="创建时间" :desc="vdata.record.createdAt" />
</JeepayDescview>
</JeepayCard>
<!-- 仅非超管显示 -->
<JeepayCard v-if="vdata.record.userType != 1" title="已绑定门店" viewStyle="margin-top: 40rpx">
<JeepayDescview>
<template v-for="(r) in vdata.selectedStoreList">
<JeepayDescviewItem :title="r.storeName" :desc="r.storeId" />
</template>
</JeepayDescview>
</JeepayCard>
<JeepayCard title="权限管理" viewStyle="margin-top: 40rpx">
<JeepayTableListItem v-if="ent.has('ENT_UR_USER_EDIT')" title="用户状态" subtitle="状态禁用后用户将无法登录APP和后台管理系统">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateStateFunc"/>
</template>
</JeepayTableListItem>
<JeepayTableListItem v-if="vdata.record.userType == 11" title="门店编辑权限" subtitle="权限禁用后,该用户将不支持编辑门店信息功能">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.userRules['STORE']" :showSwitchType="true" :updateStateFunc="(state) => updateRuleFunc('STORE', state)"/>
</template>
</JeepayTableListItem>
<JeepayTableListItem v-if="vdata.record.userType == 12" title="收银权限" subtitle="权限禁用后,该用户将不支持快捷收银功能">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.userRules['QUICK_PAY']" :showSwitchType="true" :updateStateFunc="(state) => updateRuleFunc('QUICK_PAY', state)"/>
</template>
</JeepayTableListItem>
<JeepayTableListItem v-if="vdata.record.userType == 12" title="订单退款权限" subtitle="权限禁用后,该用户将不支持订单退款操作">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.userRules['REFUND']" :showSwitchType="true" :updateStateFunc="(state) => updateRuleFunc('REFUND', state)"/>
</template>
</JeepayTableListItem>
<JeepayTableListItem v-if="vdata.record.userType == 12" title="设备管理权限" subtitle="权限禁用后,该用户将不支持门店设备管理功能">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.userRules['DEVICE']" :showSwitchType="true" :updateStateFunc="(state) => updateRuleFunc('DEVICE', state)"/>
</template>
</JeepayTableListItem>
<JeepayTableListItem v-if="vdata.record.userType == 12" title="统计报表权限" subtitle="权限禁用后,该用户将不支持查看门店统计报表数据">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.userRules['STATS']" :showSwitchType="true" :updateStateFunc="(state) => updateRuleFunc('STATS', state)"/>
</template>
</JeepayTableListItem>
</JeepayCard>
<JSinglePopup ref="single" :list="list" activeColor="#FF5B4C" />
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
</JeepayBackground>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_USER_LIST, API_URL_USER_BIND_STORE_LIST, $getUserEntRoles, $updateUserEntRoles } from '@/http/apiManager.js'
import datamap from '@/commons/utils/datamap.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
import ent from '@/commons/utils/ent.js'
const single = ref()
const jeepayPopupConfirmRef = ref()
const list = reactive([
{ label: '删除用户', value: 'delete', fun: confirmFunc},
])
onLoad((options) => {
refData(options.sysUserId)
})
const vdata = reactive({
record : { },
selectedStoreList: [],
// 用户权限集合
userRules: {
"STORE": 0, "QUICK_PAY": 0, "REFUND": 0, "DEVICE": 0, "STATS": 0,
},
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_SYS_USER_DETAIL))
uni.$on(emit.ENAME_REF_SYS_USER_DETAIL, function(data){
refData(vdata.record.sysUserId)
})
function refData(sysUserId){
reqLoad.getById(API_URL_SYS_USER_LIST, sysUserId).then(({bizData}) => {
vdata.record = bizData
vdata.selectedStoreList = []
// 店长 or 店员。 查询权限
if(bizData.userType == 11 || bizData.userType == 12){
// 查询已绑定门店
reqLoad.list(API_URL_USER_BIND_STORE_LIST, {sysUserId: sysUserId, pageSize: -1}).then((storeRes) => {
vdata.selectedStoreList = storeRes.bizData.records
})
$getUserEntRoles(sysUserId).then(roleRes => {
let roleBizData = roleRes.bizData;
if(roleBizData && roleBizData.rules){
let ruleList = JSON.parse(roleBizData.rules)
Object.keys(vdata.userRules).forEach(k => {
vdata.userRules[k] = ruleList.indexOf(k) >= 0 ? 1: 0
})
}
})
}
})
}
function updateStateFunc(state){
return reqLoad.updateById(API_URL_SYS_USER_LIST, vdata.record.sysUserId, { state: state }).then(() => {
emit.pageEmit(emit.ENAME_REF_SYS_USER_LIST)
infoBox.showSuccessToast("修改成功");
})
}
// 修改用户权限。
function updateRuleFunc(ruleName, state){
return $updateUserEntRoles(vdata.record.sysUserId, ruleName, state).then(() => {
infoBox.showSuccessToast("修改成功",{mask:false});
})
}
function confirmFunc() {
jeepayPopupConfirmRef.value.open('确定删除用户?').then(() => {
deleteFunc()
}).catch(() => {
single.value.open('delete')
})
}
function deleteFunc(){
return reqLoad.delById(API_URL_SYS_USER_LIST, vdata.record.sysUserId).then(() => {
infoBox.showSuccessToast("删除成功");
go.back(1, emit.ENAME_REF_SYS_USER_LIST) // 返回页面 && 更新
})
}
</script>
<style lang="scss" scoped>
.sex-info-text {
image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
}
.sta-info {
display: flex;
margin-top: 50rpx;
padding: 0 50rpx;
.sta-photo {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
image {
width: 100%;
height: 100%;
}
}
.info-main {
flex: 1;
margin-left: 30rpx;
color: #fff;
.info-name {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 33rpx;
font-weight: 400;
image {
width: 70rpx;
height: 70rpx;
}
}
.info-phone {
margin-top: 16rpx;
color: rgba(251, 252, 253, 0.7);
font-size: 25rpx;
font-weight: 400;
}
}
}
</style>

View File

@@ -1,126 +0,0 @@
<template>
<view class="page-wrapper">
<JeepayCustomNavbar title="成员管理" backCtrl="back" />
<view class="sta-input" @tap="go.toSearchPage('sysUser')">
<view class="input-main">
<image src="/static/iconImg/icon-search.svg" mode="scaleToFill" />
搜索成员姓名
</view>
<!-- <image class="icon-more" src="/static/iconImg/icon-more.svg" mode="scaleToFill" /> -->
</view>
<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc">
<template #tableBody="{ record }">
<SysUserRender :record="record" />
</template>
</JeepayTableList>
<view class="footer-wrapper">
<view class="footer-button footer-button-style">
<button hover-class="hover-button" hover-stay-time="150" class="flex-center"
@tap="createStaff">创建</button>
</view>
</view>
</view>
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
</template>
<script setup>
import {
nextTick,
reactive,
ref
} from 'vue';
import {
onReachBottom,
onShow,
onUnload
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import emit from '@/commons/utils/emit.js';
import SysUserRender from '@/pages/list/render/SysUserRender.vue';
import {rolesGet } from '@/http/yskApi/requestAll.js';
const jeepayTableListRef = ref();
const jeepayPopupConfirmRef = ref();
onReachBottom(() => {});
// // 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_SYS_USER_LIST));
uni.$on(emit.ENAME_REF_SYS_USER_LIST, function(data) {
jeepayTableListRef.value.refTable(true);
});
// 请求
function reqTableDataFunc(params) {
// 不查询普通用户
params.isNotHasType2 = 1;
rolesGet({
}).then((res) => {
})
return res.content
}
// 创建员工
const createStaff = () => {
go.to('PAGES_USER_EDIT');
};
</script>
<style lang="scss" scoped>
.sta-input {
display: flex;
align-items: center;
padding: 0 30rpx;
height: 110rpx;
background-color: $J-bg-ff;
.input-main {
flex: 1;
display: flex;
align-items: center;
height: 70rpx;
background-color: $J-bg-f5;
border-radius: $J-b-r12;
color: rgba(0, 0, 0, 0.35);
font-size: 27rpx;
font-weight: 400;
image {
padding: 22rpx;
width: 26rpx;
height: 26rpx;
}
}
.icon-more {
margin-left: 30rpx;
width: 70rpx;
height: 70rpx;
}
}
.footer-wrapper {
height: 170rpx;
background-color: transparent;
.footer-button {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 30rpx;
button {
height: 110rpx;
font-size: 33rpx;
font-weight: 500;
color: $J-color-tff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
.hover-button {
opacity: 0.5;
}
}
}
</style>

View File

@@ -1,329 +0,0 @@
<!--
订单列表页面 数据渲染
业务 进件
@author terrfly
@site https://www.jeequan.com
@date 2022/11/29 09:17
-->
<template>
<!-- 草稿 灰色 失败红色 审核中 黄色 -->
<!-- 列表卡片 -->
<view class="apply-card">
<view class="apply-title" @tap="toViewPage">
<view class="pay-img-wrapper flex-center" :style="{ backgroundColor: record.bgColor }">
<image :src="props.record.icon" mode="scaleToFill" />
</view>
<view class="apply-title-wrapper">
<view class="apply-title-info">
<text class="single-text-beyond" style="width: 340rpx">{{ props.record.mchFullName }}</text>
<view class="apply-state">
<text>{{ stateList[record.state]?.text }}</text>
<view class="apply-dot" :style="{ backgroundColor: stateList[record.state]?.bgColor }"></view>
</view>
</view>
<view class="apply-time">{{ props.record.createdAt }}</view>
</view>
</view>
<view class="apply-info-title" @tap="toViewPage">
<view class="title">进件渠道</view>
<view class="info">{{ props.record.ifName }}</view>
</view>
<view class="apply-info-title" @tap="toViewPage">
<view class="title">进件单号</view>
<view class="info">{{ props.record.applyId }}</view>
</view>
<view class="apply-button">
<view
v-if="
ent.has('ENT_MCH_APPLYMENT_SIGN') &&
(props.record.state == 1 || props.record.state == 2 || props.record.state == 4 || props.record.state == 5 || props.record.state == 6)
"
class="sign flex-center"
hover-class="touch-hover"
@tap="toSignPage"
>
签约开通
</view>
<view
v-if="ent.has('ENT_MCH_APPLYMENT_GET_INFO') && (props.record.state == 1 || props.record.state == 4 || props.record.state == 5)"
class="new-state flex-center"
hover-class="touch-button"
>
获取最新状态
</view>
<view v-if="ent.has('ENT_MCH_APPLYMENT_ADD')" class="new-state flex-center" hover-class="touch-button" @tap="toShowSelectIfCode()">复用信息</view>
</view>
<!-- 选择支付 接口 -->
<JeepayPopupListSelect
ref="selectIfcodeRef"
title="请选择渠道"
:reqTableDataFunc="reqTableDataByIfcodeFunc"
:fields="{ key: 'ifCode', left: 'ifName', right: 'ifCode' }"
@confirm="confirmIfCode"
>
<!-- 小程序, 插槽不生效, 待排查! TODO -->
<!-- 详见: https://ask.dcloud.net.cn/question/158765 -->
<!-- JeepayPopupListSelect.js 修改 "content-" + i0, 改为: content 即可。 -->
<!-- #ifdef APP-PLUS || H5 -->
<template #content="{ record }">
<view class="pay-wrapper">
<view class="pay-info">
<view class="pay-logo flex-center" :style="{ backgroundColor: record.bgColor }">
<image :src="record.icon" mode="scaleToFill" />
</view>
<view>
<view class="pay-title">{{ record.ifName }}</view>
</view>
</view>
</view>
</template>
<!-- #endif -->
</JeepayPopupListSelect>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import cal from '@/commons/utils/cal.js';
import go from '@/commons/utils/go.js';
import datamap from '@/commons/utils/datamap.js';
import ent from '@/commons/utils/ent.js';
import ak from '@/commons/utils/ak.js';
import { $getAllAllowApplymentIfCodeList } from '@/http/apiManager.js';
const selectIfcodeRef = ref();
const vdata = reactive({
addIfCodeList: [] // 可以选择的接口集合
});
function toH5ApplyOptionPage(applyId, configPage) {
uni.navigateTo({ url: `/pageApply/applyDetailH5ApplyOption?applyId=${applyId}&configPage=${configPage}` });
}
// 去进件详情 / 修改页
function toViewPage() {
let isView = 1;
if ([0, 3, 8].indexOf(props.record.state) >= 0) {
isView = 0;
}
go.to('PAGES_APPLYMENT_H5_DETAIL', { autoConfigMchAppId: props.record.autoConfigMchAppId, isvNo: props.record.isvNo, applyId: props.record.applyId, isView: isView });
}
// 签约开通
function toSignPage() {
go.to('PAGES_APPLYMENT_H5_OPTION', { applyId: props.record.applyId, configPage: 'NEXT_BIZS' });
}
// 定义传入属性
const props = defineProps({
record: { type: Object, default: () => {} } // 渲染对象
});
const stateList = reactive([
{
text: '草稿', //0
bgColor: '#D9D9D9'
},
{
text: '审核中', //1
bgColor: '#FFCC66'
},
{
text: '已开通', //2
bgColor: '#18BC73'
},
{
text: '申请被驳回', //3
bgColor: '#FF4D5B'
},
{
text: '待验证', //4
bgColor: '#FFCC66'
},
{
text: '待签约', //5
bgColor: '#2980FD'
},
{
text: '', //6 占位
bgColor: ''
},
{
text: '等待预审', //7
bgColor: '#FFCC66'
},
{
text: '预审拒绝', //8
bgColor: '#FF4D5B'
}
]);
// 打开选择渠道页面
function toShowSelectIfCode() {
ak.go.to('PAGES_APPLYMENT_SELECETDPAY', { applyId: props.record.applyId, ifCode: props.record.ifCode, range: props.record.range });
return;
$getAllAllowApplymentIfCodeList().then(({ bizData }) => {
vdata.addIfCodeList = bizData;
selectIfcodeRef.value.open();
});
}
// 请求可以选择的支付渠道
function reqTableDataByIfcodeFunc() {
// 模拟请求数据
return Promise.resolve({ bizData: { records: vdata.addIfCodeList, hasNext: false } });
}
function confirmIfCode(selected) {
if (!selected) {
ak.infoBox.showToast('请选择进件渠道');
return false;
}
selectIfcodeRef.value.close();
ak.go.to('PAGES_APPLYMENT_H5_DETAIL', { isView: 0, ifCode: selected.ifCode, copyInfoSourceApplyId: props.record.applyId });
}
function toCopyPage() {}
</script>
<style lang="scss" scoped>
// 列表卡片样式
.apply-card {
padding: 0.1rpx 30rpx;
padding-bottom: 10rpx;
margin: 20rpx;
background-color: #fff;
border-radius: $J-b-r32;
.apply-title {
display: flex;
margin-top: 30rpx;
margin-bottom: 40rpx;
font-size: 30rpx;
.pay-img-wrapper {
margin-right: 20rpx;
width: 90rpx;
height: 90rpx;
border-radius: 20rpx;
image {
width: 65%;
height: 65%;
}
}
.apply-title-wrapper {
flex: 1;
.apply-title-info {
display: flex;
justify-content: space-between;
height: 40rpx;
.apply-state {
display: flex;
align-items: center;
font-size: 26rpx;
color: #999;
white-space: nowrap;
text {
transform: translateX(-10rpx);
}
.apply-dot {
width: 20rpx;
height: 20rpx;
border-radius: 50%;
background-color: #2980fd;
}
}
}
.apply-time {
color: #999;
margin-top: 10rpx;
font-size: 26rpx;
}
}
}
.apply-info-title {
margin: 20rpx 0;
display: flex;
font-size: 26rpx;
.title {
color: #808080;
}
.info {
text-indent: 56rpx;
}
}
.apply-button {
display: flex;
justify-content: flex-end;
margin-bottom: 20rpx;
view {
font-size: 26rpx;
font-weight: 500;
height: 62rpx;
border-radius: 12rpx;
}
.sign {
width: 164rpx;
border: 1rpx solid #d3d3d4;
}
.new-state {
margin-left: 20rpx;
width: 216rpx;
color: #fff;
background: $jeepay-bg-primary;
}
}
}
.pay-wrapper {
display: flex;
align-items: center;
height: 170rpx;
.dot {
position: relative;
width: 36rpx;
height: 36rpx;
border-radius: 50%;
background-color: #d7d8d9;
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 50%;
height: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
background-color: #fff;
}
}
.dot-active {
background-color: #2980fd;
}
.pay-info {
display: flex;
.pay-logo {
margin: 0 20rpx 0 0rpx;
width: 90rpx;
height: 90rpx;
border-radius: $v-b-r20;
background-color: #07112d;
image {
width: 50rpx;
height: 50rpx;
}
}
.pay-title {
font-size: 30rpx;
font-weight: 400;
}
}
}
</style>

View File

@@ -1,345 +0,0 @@
<template>
<view class="page-wrapper store jeepay-edit-form">
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="140">
<uni-forms-item required label="选择商户" name="mchApplyId">
<view class="selected-sex" :style="{ color: vdata.formData.mchApplyId ? '#000' : '' }" @tap="showShopList">
{{ shopName || '请选择商户' }}
<image class="left-image" src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" />
</view>
</uni-forms-item>
<uni-forms-item required label="门店名称" name="storeName">
<uni-easyinput v-model="vdata.formData.storeName" placeholder="请输入门店名称" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="联系人电话" name="contactPhone">
<uni-easyinput v-model="vdata.formData.contactPhone" placeholder="联系人电话" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="备注" name="remark" class="line">
<uni-easyinput v-model="vdata.formData.remark" placeholder="备注" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="门店地址" name="address">
<view class="selected-sex" :style="{ alignItems: vdata.formData.address ? 'flex-end' : '', color: vdata.formData.lng ? '#000' : '' }" @tap="showMap">
{{ vdata.formData.address || '选择地址后自动回显' }}
<image class="left-image" src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" />
</view>
</uni-forms-item>
<uni-forms-item required label="省市区/县" name="areaCode">
<JeepayAreacodeSelect ref="jeepayAreacodeSelect" v-model:areacodeList="vdata.formData.areaCode" />
</uni-forms-item>
<uni-forms-item required label="经纬度" name="lngAndLat" class="line">
<view class="selected-sex" :style="{ color: vdata.formData.lng ? '#000' : '' }">{{ vdata.formData.lng }}/{{ vdata.formData.lat }}</view>
</uni-forms-item>
<uni-forms-item required label="门店类目" name="shopCategory" v-if="vdata.type">
<JeepayAreacodeSelect ref="jeepayAreacodeSelect" type="mccAli" v-model:areacodeList="vdata.formData.shopCategory" />
</uni-forms-item>
<uni-forms-item required label="经营类型" name="shopType" v-if="vdata.type && !['99', '031'].includes(vdata.aliStatus)">
<JeepayRadioPopupView
label="请选门店经营类型"
v-model:value="vdata.formData.shopType"
:list="[
{ label: '直营', value: '01' },
{ label: '加盟', value: '02' }
]"
></JeepayRadioPopupView>
</uni-forms-item>
<uni-forms-item required label="门店Logo" name="storeLogo" v-if="!vdata.type">
<view class="selected-sex">
<JeepayUploadImg v-model:src="vdata.formData.storeLogo" bizType="applyment" />
</view>
</uni-forms-item>
<uni-forms-item required label="门头照" name="storeOuterImg" v-if="!vdata.type">
<view class="selected-sex">
<JeepayUploadImg v-model:src="vdata.formData.storeOuterImg" bizType="applyment" />
</view>
</uni-forms-item>
<uni-forms-item required label="门店内景照" name="storeInnerImg" v-if="!vdata.type">
<view class="selected-sex">
<JeepayUploadImg v-model:src="vdata.formData.storeInnerImg" bizType="applyment" />
</view>
</uni-forms-item>
</uni-forms>
<view class="confirm-wrapper" v-if="vdata.aliStatus">
<view class="confirm-button flex-center" hover-class="touch-button" @tap="confirmFunc">保存</view>
</view>
<view class="confirm-wrapper" v-else>
<view class="confirm-button flex-center" hover-class="touch-button" @tap="confirmFunc">
{{ vdata.storeId ? '确认修改' : '确认创建' }}
</view>
</view>
</view>
<JeepayPopupListSelect
ref="selectIncomingRef"
title="请选择商户"
searchInputName="appName"
:reqTableDataFunc="reqTableDataFunc"
:fields="{ key: 'applyId', left: 'mchApplyName', right: 'isvNo' }"
@confirm="confirmIncoming"
></JeepayPopupListSelect>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { $location2areacode, reqLoad, API_URL_MCH_STORE_LIST, API_URI_DEV_RUYI, API_URL_MCH_APPLYMENT_LIST } from '@/http/apiManager.js';
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js';
import formUtil from '@/commons/utils/formUtil.js';
import emit from '@/commons/utils/emit.js';
import cal from '@/commons/utils/cal.js';
const jeepayAreacodeSelect = ref();
const formRef = ref();
const selectIncomingRef = ref(null);
const shopList = ref([]);
const shopName = ref('');
function showShopList() {
selectIncomingRef.value.open();
}
function confirmIncoming(selected) {
// console.log(selected.applyId);
selectIncomingRef.value.close();
vdata.formData.mchApplyId = selected.applyId;
shopName.value = selected.mchShortName;
}
function reqTableDataFunc(params) {
// if(!params.state){
// params.state = 99
// }
return reqLoad.list(API_URL_MCH_APPLYMENT_LIST, params);
}
onLoad((options) => {
if (options.type == 'aliStore' && options.aliStatus == '0') {
uni.setNavigationBarTitle({
title: '同步蚂蚁店铺'
});
} else if (options.type) {
uni.setNavigationBarTitle({
title: '修改蚂蚁店铺'
});
}
// 修改页面
if (options.storeId) {
vdata.storeId = options.storeId;
vdata.type = options.type;
vdata.aliStatus = options.aliStatus;
reqLoad.getById(options.type == 'aliStore' && ['99', '031'].includes(vdata.aliStatus) ? API_URI_DEV_RUYI : API_URL_MCH_STORE_LIST, vdata.storeId).then(({ bizData }) => {
vdata.formData = bizData;
});
}
reqTableDataFunc();
});
const rules = {
mchApplyId: {
rules: [formUtil.rules.requiredSelect('请选择商户')]
},
storeName: {
rules: [formUtil.rules.requiredInput('')]
},
contactPhone: {
rules: [formUtil.rules.requiredInput(''), formUtil.rules.patternRule('联系人电话', formUtil.regexp.mobile)]
},
address: {
rules: [formUtil.rules.requiredSelect('门店地址')]
},
areaCode: {
rules: [formUtil.rules.requiredInput('省市县')]
},
storeLogo: {
rules: [formUtil.rules.requiredUpload('门店Logo')]
},
storeOuterImg: {
rules: [formUtil.rules.requiredUpload('门头照')]
},
storeInnerImg: {
rules: [formUtil.rules.requiredUpload('门店内景照')]
},
shopCategory: {
rules: [formUtil.rules.requiredInput('门店类型')]
},
shopType: {
rules: [formUtil.rules.requiredInput('经营类型')]
}
};
const vdata = reactive({
storeId: null, // 新建 or 修改
formData: {} // 表单数据
});
// 选择地图
function showMap() {
// 本地 测试选择
// return test();
// 打开地图 && 获取省市县
uni.chooseLocation().then((res) => {
console.log(res);
vdata.formData.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。
vdata.formData.lat = res.latitude.toFixed(6);
vdata.formData.address = res.name;
// 经纬度 --》 获取到省市县编码
$location2areacode(vdata.formData.lng + ',' + vdata.formData.lat).then(({ bizData }) => {
if (bizData && bizData.areacode) {
jeepayAreacodeSelect.value.resetBySingleAreacode(bizData.areacode);
}
});
});
}
function test() {
vdata.formData.lng = '116.099';
vdata.formData.lat = '39.84548';
vdata.formData.address = '测试地址';
// 经纬度 --》 获取到省市县编码
$location2areacode(vdata.formData.lng + ',' + vdata.formData.lat).then(({ bizData }) => {
if (bizData && bizData.areacode) {
jeepayAreacodeSelect.value.resetBySingleAreacode(bizData.areacode);
}
});
}
function confirmFunc() {
const goBack = () => {
emit.pageEmit(emit.ENAME_REF_STORE_LIST); // 更新列表
go.back(1, emit.ENAME_REF_STORE_DETAIL); // 返回详情 && 更新详情
};
// 修改或更新店铺信息
if (!vdata.type) {
formUtil
.validate(formRef.value)
.then(() => {
return reqLoad.addOrUpdate(vdata.storeId, API_URL_MCH_STORE_LIST, vdata.formData);
})
.then(({ bizData }) => {
goBack();
});
} else {
// 同步蚂蚁店铺
formUtil.validate(formRef.value).then(() => {
vdata.formData.shopCategory = vdata.formData.shopCategory.join('_');
if (['99', '031'].includes(vdata.aliStatus)) {
reqLoad.updateById(API_URI_DEV_RUYI, vdata.storeId, vdata.formData).then((res) => {
goBack();
});
} else {
reqLoad.add(`${API_URI_DEV_RUYI}/${vdata.storeId}`, vdata.formData).then((res) => {
goBack();
});
}
});
}
}
</script>
<style lang="scss">
.store {
/* #ifdef MP-WEIXIN */
jeepay-upload-img[is='components/JeepayUploadImg/JeepayUploadImg'] {
flex-grow: 1;
}
/* #endif */
.upload-wrapper-store {
padding-top: 40rpx;
}
.upload-wrapper-store-last {
padding-bottom: 40rpx;
}
}
input {
font-size: 32rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #b3b3b3;
image {
flex-shrink: 0;
width: 120rpx;
height: 120rpx;
}
}
.selected-sex :nth-child(2) {
margin: 30rpx 0;
}
.line {
margin-bottom: 20rpx;
}
.confirm-wrapper {
padding: 50rpx 30rpx;
.confirm-button {
height: 110rpx;
color: #fff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
}
.align-top {
align-items: flex-start;
padding: 40rpx 0;
height: auto;
min-height: auto;
image {
width: 120rpx;
height: 40rpx;
transform: rotate(90deg);
}
}
.border-tb {
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
&::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
}
.left-image {
width: 120rpx;
height: 40rpx;
}
</style>

View File

@@ -1,216 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{ height: '776rpx' }" class="store-wrapper">
<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"
:title="vdata.record.storeName" :subtitle="vdata.record.storeId" :logo="vdata.record.storeLogo || '/static/indexImg/icon-store.svg'" :moreBtnList="moreBtnList" ref="refTabel"/>
<view class="create-time">
<view class="time-title">创建时间</view>
<view class="time-info">{{ vdata.record.createdAt }}</view>
</view>
<JeepayCard :editText="ak.ent.has('ENT_MCH_STORE_EDIT') ? '修改门店' : null" @editTap="go.to('PAGES_APP_STORE_EDIT', {storeId: vdata.record.storeId})">
<JeepayDescview>
<JeepayDescviewItem title="门店名称" :desc="vdata.record.storeName"/>
<JeepayDescviewItem title="联系人电话" :desc="vdata.record.contactPhone" />
<JeepayDescviewItem title="门店地址" :desc="vdata.record.address" />
<JeepayDescviewItem title="蚂蚁店铺">
<template #desc>
<JeepayTag type="blue">{{ calcAliStatusText() }}</JeepayTag>
</template>
</JeepayDescviewItem>
<JeepayDescviewItem title="备注" :desc="vdata.record.remark || '未填写'" :bottomBorder="true" />
<JeepayDescviewItem title="门店Logo" :desc="vdata.record.storeLogo" :descIsImg="true" />
<JeepayDescviewItem title="门店内景照" :desc="vdata.record.storeInnerImg" :descIsImg="true" />
<JeepayDescviewItem title="门头照" :desc="vdata.record.storeOuterImg" :descIsImg="true" />
</JeepayDescview>
</JeepayCard>
<!-- <JeepayCard title="其他设置" viewStyle="margin-top: 30rpx">
<JeepayTableListItem title="是否默认" subtitle="设为默认后,该门店将成为当前商户的默认下单门店">
<template #titleRight> -->
<!-- 显示条件 1. 权限支持 2. 仅支持 非默认 调整为 默认 反向不支持 -->
<!-- <JeepayStateSwitch v-model:state="vdata.record.defaultFlag" :showSwitchType="ent.has('ENT_MCH_STORE_EDIT') && vdata.record.defaultFlag == 0" :updateStateFunc="updateDefaultFlagFunc"/>
</template>
</JeepayTableListItem>
</JeepayCard> -->
</JeepayBackground>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { $location2areacode, reqLoad, API_URL_MCH_STORE_LIST,$queryAliStore,API_URI_DEV_RUYI } from '@/http/apiManager.js'
import ak from '@/commons/utils/ak.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
import ent from '@/commons/utils/ent.js'
const moreBtnList = reactive([
{ label: '删除门店', value: 'delete', color: 'red', entId: "ENT_MCH_STORE_DELETE", confirmText: '确认删除门店?', fun: deleteFunc},
{ label: '同步蚂蚁店铺', value: 'aliStore', entId: "ENT_MCH_ALIPAY_SHOP_ADD", fun: ()=>{ go.to('PAGES_APP_STORE_EDIT', {storeId: vdata.record.storeId,type:'aliStore',aliStatus:vdata.record.alipayShopStatus}) }},
{ label: '解除蚂蚁店铺', value: 'delAliStore', confirmText: '是否确认解除该蚂蚁店铺同步?', entId: "ENT_MCH_ALIPAY_SHOP_DELETE", fun: ()=>{ closeAliStore()}},
{ label: '刷新蚂蚁店铺状态', value: 'queryAliStore', entId: "ENT_MCH_ALIPAY_SHOP_STATUS", fun: ()=>{ queryAliStoreStatus()}},
])
onLoad((options) => {
refData(options.storeId)
})
const vdata = reactive({
record : { }
})
const refTabel = ref(null)
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_STORE_DETAIL))
uni.$on(emit.ENAME_REF_STORE_DETAIL, function(data){
refData(vdata.record.storeId)
})
function refData (storeId) {
reqLoad.getById(API_URL_MCH_STORE_LIST, storeId).then(({ bizData }) => {
vdata.record = bizData
if(bizData.alipayShopStatus !=0){
queryAliStoreStatus(true)
}else{
calcTabelList(bizData.alipayShopStatus)
}
})
}
// 针对 列表按钮 处理
const orgTabelArray = []
function calcTabelList (key) {
const orgTabelArrayIncludesData = (index)=>{
if (orgTabelArray.findIndex(ite => ite.value == moreBtnList[index].value) == '-1') {
orgTabelArray.push(moreBtnList[index]) // 存储 列表数据 以便状态更新 时 恢复列表
}
}
const delValue = ['delAliStore', 'queryAliStore']
const i = moreBtnList.findIndex(v => v.value == 'aliStore')
if(i !='-1'){
moreBtnList[i].label = '同步蚂蚁店铺'
}
if (['0', '-1'].includes(key)) {
const index = delValue.map((v) => moreBtnList.findIndex(ite => ite.value == v)) //筛选出 需要删除的下标
if (index.length) {
index.sort((a, b) => b - a) //排序 从大到小
index.forEach(v => {
orgTabelArrayIncludesData(v)
moreBtnList.splice(v, 1)
})
}
} else if(key !='031') {
const queryIndex = moreBtnList.findIndex(v=>v.value=='queryAliStore')
if(queryIndex != '-1' && orgTabelArray.findIndex(v=>v.value =='queryAliStore') !='-1'){
moreBtnList.splice(queryIndex,1)
}
moreBtnList.push(...orgTabelArray)
const i = moreBtnList.findIndex(v => v.value == 'aliStore')
if (i != '-1') {
moreBtnList[i].label = '修改蚂蚁店铺'
moreBtnList.sort((a, b) => a.label.length - b.label.length) //对列表进行排序
}
}
const delIndex = moreBtnList.findIndex(v => v.value == 'delAliStore')
if (key == '031') {
if(moreBtnList.findIndex(v=>v.value=='queryAliStore')=='-1'){
moreBtnList.push(orgTabelArray.find(v=>v.value == 'queryAliStore'))
}
if (delIndex != '-1') {
moreBtnList.splice(delIndex, 1)
}
if(i !='-1'){
orgTabelArrayIncludesData(i)
moreBtnList.splice(i, 1)
}
}
}
function updateDefaultFlagFunc(isDefault){
return reqLoad.updateById(API_URL_MCH_STORE_LIST, vdata.record.storeId, { defaultFlag: isDefault }).then(() => {
emit.pageEmit(emit.ENAME_REF_STORE_LIST)
infoBox.showSuccessToast("修改成功");
})
}
function deleteFunc(){
return reqLoad.delById(API_URL_MCH_STORE_LIST, vdata.record.storeId).then(() => {
infoBox.showSuccessToast("删除成功");
go.back(1, emit.ENAME_REF_STORE_LIST) // 返回页面 && 更新
})
}
const closeAliStore = ()=>{
reqLoad.delById(API_URI_DEV_RUYI,vdata.record.storeId).then(res=>{
infoBox.showSuccessToast("解除成功");
refData(vdata.record.storeId)
})
}
const queryAliStoreStatus =(tooast) =>{
$queryAliStore(vdata.record.storeId).then(({bizData})=>{
if(bizData){
vdata.record.alipayShopStatus = bizData.alipayShopStatus
calcTabelList(bizData.alipayShopStatus)
if(!tooast){
infoBox.showToast('刷新蚂蚁店铺状态成功。')
}
}
})
}
// 计算 蚂蚁店铺 状态 文字
const calcAliStatusText =()=>{
let text = ''
switch (vdata.record.alipayShopStatus){
case '0' :
text = '未同步'
break
case '-1':
text = '同步失败'
break
case '031':
text = '已提交审核'
break
case '99':
text = '已同步'
break
}
return text
}
</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;
}
.default-img {
width: 50rpx;
height: 50rpx;
}
.store-wrapper {
padding-bottom: 30rpx;
}
</style>

View File

@@ -1,153 +0,0 @@
<template>
<view class="page-wrapper">
<!-- 搜索栏头部 -->
<view class="search-title">
<view class="search-input">
<!-- <view class="search-input" @tap="go.toSearchPage('mchApplyment')"> -->
<image src="/static/iconImg/icon-search.svg" mode="scaleToFill" class="search-img" />
<input placeholder="搜索门店名称、编号" v-model="searchValue" placeholder-class="input-placeholder" @confirm="searchHandle" />
<view class="close" v-if="searchValue" @click="clearHandle">
<image src="/static/iconImg/icon-x.svg" mode="scaleToFill" class="del-img" />
</view>
</view>
<view class="search-state" @click="searchHandle">
<div class="btn-wrap">
<view class="s-wrap flex-center">搜索</view>
</div>
</view>
</view>
<!-- <JSearchTitle place="搜索门店名称、编号" @tap="ak.go.toSearchPage('mchStore')" /> -->
<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc" :searchData="vdata.searchData">
<template #tableBody="{ record }">
<!-- <MchStoreRender :record="record" /> -->
<MchStoreListRender :record="record" />
</template>
</JeepayTableList>
<view v-if="ak.ent.has('ENT_MCH_STORE_ADD')" class="list-footer">
<view class="button-wrapper">
<Button @tap="createStore">创建门店</Button>
</view>
</view>
</view>
</template>
<script setup>
import { nextTick, reactive, ref } from 'vue';
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app';
import ak from '@/commons/utils/ak.js';
import { reqLoad, API_URL_MCH_STORE_LIST } from '@/http/apiManager.js';
import MchStoreRender from '@/pages/list/render/MchStoreRender.vue';
import MchStoreListRender from '@/pages/list/render/MchStoreListRender.vue';
const jeepayTableListRef = ref();
const searchValue = ref('');
const vdata = reactive({
searchData: {
mchApplyName: ''
}
});
// 清空搜索
function clearHandle() {
searchValue.value = '';
vdata.searchData.mchApplyName = searchValue.value;
jeepayTableListRef.value.refTable(true);
}
// 搜索
function searchHandle() {
// reqTableDataFunc({ mchApplyName: searchValue });
vdata.searchData.mchApplyName = searchValue.value;
jeepayTableListRef.value.refTable(true);
}
onReachBottom(() => {});
// 监听 更新事件
onUnload(() => uni.$off(ak.emit.ENAME_REF_STORE_LIST));
uni.$on(ak.emit.ENAME_REF_STORE_LIST, function (data) {
jeepayTableListRef.value.refTable(true);
});
// 请求
function reqTableDataFunc(params) {
return reqLoad.list(API_URL_MCH_STORE_LIST, params);
}
const createStore = () => ak.go.to('PAGES_APP_STORE_EDIT');
</script>
<style lang="scss" scoped>
.page-wrapper {
min-height: calc(100vh - 80rpx);
// 搜索栏样式
.search-title {
display: flex;
align-items: center;
padding: 0 30rpx;
background-color: #fff;
height: 110rpx;
.search-input {
flex: 1;
display: flex;
align-items: center;
height: 70rpx;
background-color: #efefef;
border-radius: 12rpx;
position: relative;
padding-right: 70upx;
.search-img {
padding: 22rpx;
width: 26rpx;
height: 26rpx;
}
.close {
$closeSize: 70upx;
width: $closeSize;
height: $closeSize;
position: absolute;
top: 50;
right: 0;
display: flex;
align-items: center;
justify-content: center;
.del-img {
$size: 34upx;
width: $size;
height: $size;
}
}
}
.search-state {
$height: 40upx;
width: 80upx;
height: $height;
margin-left: 30rpx;
font-size: 30rpx;
color: #222425;
position: relative;
overflow: hidden;
transition: all 0.1s ease-in-out;
&.active {
width: 80upx;
}
.arrow {
margin-left: 10rpx;
width: 40rpx;
height: 40rpx;
transform: rotate(180deg);
}
.btn-wrap {
width: 100%;
position: absolute;
top: 0;
left: 0;
transition: all 0.1s ease-in-out;
.s-wrap {
height: $height;
}
}
}
}
}
</style>

View File

@@ -1,300 +0,0 @@
<template>
<view class="page-wrapper jeepay-edit-form">
<JeepayCustomNavbar :title=" vdata.isAdd? '添加新辅助终端' : '修改辅助终端'" backCtrl="back" />
<uni-forms ref="formRef" :rules="rules" :model="vdata.formData" :label-width="120">
<uni-forms-item v-if="vdata.isAdd" required label="选择应用" name="appId">
<JeepayBizsPopupView :hasTitle="false" bizType="mchApp" v-model:value="vdata.formData.appId" :showName="vdata.bindAppName" />
</uni-forms-item>
<uni-forms-item v-if="vdata.isAdd" required label="选择门店" name="storeId">
<JeepayBizsPopupView :hasTitle="false" bizType="store" v-model:value="vdata.formData.storeId" :showName="vdata.bindStoreName" />
</uni-forms-item>
<template v-if="isSelectedStoreAndMchApp()" >
<uni-forms-item v-if="vdata.isAdd" required label="设备类型" name="trmType">
<JeepayRadioPopupView label="请选择设备类型" v-model:value="vdata.formData.trmType" :list="[{ label: '辅助终端', value: 1}, { label: '扫码POS', value: 2}]" @change="changeTrmTypeFunc">
</JeepayRadioPopupView>
</uni-forms-item>
<uni-forms-item required label="设备名称" name="trmName">
<uni-easyinput v-model="vdata.formData.trmName" placeholder="请输入设备名称" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="设备编号" name="trmNo">
<uni-easyinput v-model="vdata.formData.trmNo" placeholder="请输入设备编号" :inputBorder="false"></uni-easyinput>
</uni-forms-item>
<uni-forms-item required label="布放位置" name="detailAddress">
<view class="selected-sex align-top" style="align-items: flex-start" @tap="showMap">
{{ vdata.formData.detailAddress || '选择地址后自动回显' }}
<image src="/static/iconImg/icon-arrow-black.svg" mode="scaleToFill" />
</view>
</uni-forms-item>
<uni-forms-item required label="省市区/县" name="areaCode">
<JeepayAreacodeSelect ref="jeepayAreacodeSelect" v-model:areacodeList="vdata.formData.areaCode" />
</uni-forms-item>
<uni-forms-item required label="经纬度" name="lngAndLat" class="line">
<view class="selected-sex"> {{ vdata.formData.lng }}/{{ vdata.formData.lat }} </view>
</uni-forms-item>
<JeepayTableListItem title="状态" subtitle="状态禁用后, 设备将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.formData.state" :showSwitchType="true" :confirm='false' />
</template>
</JeepayTableListItem>
</template>
</uni-forms>
<view class="confirm-wrapper">
<Button @tap="confirmFunc">{{ vdata.trmId ? '确认修改' : '确认创建' }}</Button>
</view>
<!-- 扫码pos选择 -->
<JeepayPopupListSelect
ref="jeepayPopupListSelectByScanPos"
:reqTableDataFunc="reqTableDataByScanPosFunc"
searchInputName="deviceName"
:fields="{ key: 'deviceId', left: 'deviceName', right: 'deviceNo' }"
/>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { $location2areacode, reqLoad, API_URL_MCH_STORE_LIST, API_URL_SYS_TERMINALS, API_URL_SYS_DEVICE_LIST } from '@/http/apiManager.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import formUtil from '@/commons/utils/formUtil.js'
import emit from '@/commons/utils/emit.js'
const jeepayAreacodeSelect = ref()
const formRef = ref()
const jeepayPopupListSelectByScanPos = ref() // 扫码pos列表
onLoad((options) => {
// test()
// 修改页面
if(options.trmId){
vdata.isAdd = false
vdata.trmId = options.trmId
reqLoad.getById(API_URL_SYS_TERMINALS, vdata.trmId).then(({bizData}) => {
vdata.formData = bizData
vdata.formData.areaCode = JSON.parse(bizData.areacode)
})
}
})
const rules = {
appId: {
rules:[ formUtil.rules.requiredSelect('应用') ],
},
storeId: {
rules:[ formUtil.rules.requiredSelect('门店') ],
},
trmNo: {
rules:[ formUtil.rules.requiredInput('') ],
},
trmName: {
rules:[ formUtil.rules.requiredInput('') ],
},
trmType: {
rules:[ formUtil.rules.requiredSelect('设备类型') ],
},
detailAddress: {
rules:[ formUtil.rules.requiredSelect('地址') ],
}
}
const vdata = reactive({
trmId: null, // 新建 or 修改
isAdd: true, // 是否新增页面
// 表单数据
formData: {
state: 1 // 默认启用
},
bindAppName: '', // 为了组件的回显使用
bindStoreName: '',
})
// 选择地图
function showMap(){
// return testMap()
// 打开地图 && 获取省市县
uni.chooseLocation().then((res) => {
vdata.formData.lng = res.longitude
vdata.formData.lat = res.latitude
vdata.formData.detailAddress = res.name
// 经纬度 --》 获取到省市县编码
$location2areacode(res.longitude + "," + res.latitude).then(( {bizData} ) => {
if(bizData && bizData.areacode){
jeepayAreacodeSelect.value.resetBySingleAreacode(bizData.areacode)
}
})
})
}
function test(){
vdata.formData.storeId = 1006
vdata.formData.appId= '6247b241e4b016d586ee28c4'
vdata.formData.trmType = 1
vdata.formData.trmNo = '123'
vdata.formData.trmName = '123东方闪电'
}
function testMap(){
vdata.formData.lng = '116.099'
vdata.formData.lat = '39.84548'
vdata.formData.detailAddress = '北京市ccc测试地址'
// 经纬度 --》 获取到省市县编码
$location2areacode(vdata.formData.lng + "," + vdata.formData.lat).then(( {bizData} ) => {
if(bizData && bizData.areacode){
jeepayAreacodeSelect.value.resetBySingleAreacode(bizData.areacode)
}
})
}
function confirmFunc(){
formUtil.validate(formRef.value).then(() => {
let reqData = Object.assign({}, vdata.formData)
delete reqData.areaCode
reqData.areacode = JSON.stringify(vdata.formData.areaCode)
reqData.areacodeNames = JSON.stringify(jeepayAreacodeSelect.value.getNameListBySingleAreacode(vdata.formData.areaCode[2]))
return reqLoad.addOrUpdate(vdata.trmId, API_URL_SYS_TERMINALS, reqData)
})
.then(( {bizData} ) => {
emit.pageEmit(emit.ENAME_REF_TERMINAL_LIST) // 更新列表
go.back(1, emit.ENAME_REF_TERMINAL_DETAIL) // 返回详情 && 更新详情 && search
})
}
// 切换设备类型的函数
function changeTrmTypeFunc(){
// 扫码pos , 选择一个
if(vdata.formData.trmType == 2){
jeepayPopupListSelectByScanPos.value.open().then((v) => {
if(v){
vdata.formData.trmNo = v.deviceNo
vdata.formData.trmName = v.deviceName
jeepayPopupListSelectByScanPos.value.close()
}
})
}
}
// 是否选中了门店和设备
function isSelectedStoreAndMchApp(){
return ( vdata.formData.appId && vdata.formData.storeId )
}
function reqTableDataByScanPosFunc(params){
params.appId = vdata.formData.appId
params.storeId = vdata.formData.storeId
params.deviceType = 3 // 扫码pos
return reqLoad.list(API_URL_SYS_DEVICE_LIST, params)
}
</script>
<style lang="scss">
input {
font-size: 32rpx;
}
.selected-sex {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #b3b3b3;
image {
flex-shrink: 0;
width: 120rpx;
height: 120rpx;
}
}
.line {
margin-bottom: 20rpx;
}
.confirm-wrapper {
padding: 50rpx 30rpx;
.confirm-button {
height: 110rpx;
color: #fff;
border-radius: 20rpx;
background: $jeepay-bg-primary;
}
}
.align-top {
align-items: flex-start;
padding: 40rpx 0;
height: auto;
min-height: auto;
image {
width: 120rpx;
height: 40rpx;
transform: rotate(90deg);
}
}
.border-tb {
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
&::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: 10;
width: 90vw;
height: 1rpx;
background-color: #ededed;
}
}
</style>

View File

@@ -1,64 +0,0 @@
<template>
<CommonPageByDevice
ref="commonPageByDeviceRef"
navTitle="辅助终端管理"
searchTitle="搜索辅助终端名称"
searchType="storeTerminal"
:bottomBtnTitle="ak.ent.has('ENT_TERMINAL_ADD') ? '绑定设备' : null "
@bottomBtnClickFunc="bottomBtnClickFunc"
:reqTableDataFunc="reqTableDataFunc"
>
</CommonPageByDevice>
</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_TERMINALS } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import DeviceCommonsRender from '@/pages/list/render/DeviceCommonsRender.vue'
import ak from '@/commons/utils/ak.js'
const commonPageByDeviceRef = ref()
// 监听 更新事件
onUnload( () => uni.$off(emit.ENAME_REF_TERMINAL_LIST) )
uni.$on(emit.ENAME_REF_TERMINAL_LIST, function(data){
commonPageByDeviceRef.value.refTable(true)
})
const reqTableDataFunc = (params) => {
return reqLoad.list(API_URL_SYS_TERMINALS, params)
}
function bottomBtnClickFunc(){
go.to('PAGES_APP_TERMINAL_CREATETERM')
}
const codeBind = reactive([
{
label: '扫码绑定',
value: 'scanCode',
},
{
label: '手动绑定',
value: 'handBind',
fun: () => {
go.to('/pageDevice/hornManage/bindHorn')
},
},
])
const bindPopup = ref(null)
onReachBottom(() => {})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -1,162 +0,0 @@
<template>
<JeepayBackground :bgColorStyle="{}">
<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/detailsLislImg/term-white.svg"
:title="vdata.record.trmName" :subtitle="vdata.record.trmNo" :moreBtnList="list" />
<JeepayCard editText="编辑信息" @editTap="go.to('PAGES_APP_TERMINAL_CREATETERM', {trmId: vdata.record.trmId})">
<JeepayDescview>
<JeepayDescviewItem title="设备名称" :desc="vdata.record.trmName" />
<JeepayDescviewItem title="绑定应用" :desc="vdata.record.appId" />
<JeepayDescviewItem title="绑定门店" :desc="vdata.record.storeName" />
<JeepayDescviewItem title="布放位置" :desc="vdata.record.detailAddress" />
</JeepayDescview>
</JeepayCard>
<JeepayCard title="其他设置" viewStyle="margin-top: 30rpx;">
<JeepayTableListItem title="终端状态" subtitle="状态禁用后,当前终端将无法使用">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.state" :showSwitchType="true" :updateStateFunc="updateState" />
</template>
</JeepayTableListItem>
<JeepayTableListItem title="门店默认设备" subtitle="设为门店默认辅助终端设备后, 该门店将默认使用该设备下单">
<template #titleRight>
<JeepayStateSwitch v-model:state="vdata.record.defaultFlag" :showSwitchType="vdata.record.defaultFlag == 0" :updateStateFunc="updateDefault" />
</template>
</JeepayTableListItem>
</JeepayCard>
<JeepayCard v-if="ak.ent.has('ENT_TERMINAL_SENDUP')" title="报备管理" viewStyle="margin-top: 30rpx;">
<template v-for="(item) in vdata.channelList">
<JeepayTableListItem :logo="item.icon" :logoStyle="{'background': item.bgColor, 'border-radius': '50rpx'}" :title="item.ifName" :subtitle="item.ifCode">
<template #subtitle>
<template v-if="item.channelBindInfo.state == 2 && item.channelBindInfo.errInfo">
<text style="color: red;">{{item.channelBindInfo.errInfo}}</text>
</template>
</template>
<template #titleRight>
<template v-if="item.channelBindInfo.state == 0" >
<text class="state-dot state-dot-disable"></text> &nbsp;<text @tap="terminalChannelBindSendFunc(item.ifCode)">未报备</text>
</template>
<template v-if="item.channelBindInfo.state == 1">
<text class="state-dot state-dot-enable"></text> &nbsp;<text >报备成功</text>
</template>
<template v-if="item.channelBindInfo.state == 2">
<view class="state-dot state-dot-error"></view> &nbsp;<text @tap="terminalChannelBindSendFunc(item.ifCode)">报备失败</text>
</template>
</template>
</JeepayTableListItem>
</template>
</JeepayCard>
</JeepayBackground>
<JeepayPopupConfirm ref="jeepayPopupConfirmRef" />
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { reqLoad, API_URL_SYS_TERMINALS, $updateTrmDefault, $terminalChannelBindList, $terminalChannelBindSend } from '@/http/apiManager.js'
import go from '@/commons/utils/go.js'
import emit from '@/commons/utils/emit.js'
import infoBox from '@/commons/utils/infoBox.js'
import ak from '@/commons/utils/ak.js'
const jeepayPopupConfirmRef = ref()
onLoad((options) => {
refData(options.trmId)
})
const vdata = reactive({
record: {},
channelList: [], //渠道列表
})
// 监听 更新事件
onUnload(() => uni.$off(emit.ENAME_REF_TERMINAL_DETAIL))
uni.$on(emit.ENAME_REF_TERMINAL_DETAIL, function(data){
refData(vdata.record.trmId)
})
function refData(id){
reqLoad.getById(API_URL_SYS_TERMINALS, id).then(({ bizData }) => {
vdata.record = bizData
})
if(ak.ent.has('ENT_TERMINAL_SENDUP')){
// 查询渠道报备列表
$terminalChannelBindList(id).then(({bizData}) => {
vdata.channelList = bizData
})
}
}
function deleteFunc () {
jeepayPopupConfirmRef.value.open('您确认删除终端吗?').then(() => {
reqLoad.delById(API_URL_SYS_TERMINALS, vdata.record.trmId).then(() => {
infoBox.showSuccessToast('删除成功')
return go.back(1, emit.ENAME_REF_TERMINAL_LIST)
})
})
}
const list = reactive([
{ label: '删除终端', value: 'delete', color: 'red', fun: deleteFunc },
])
// 更新状态
function updateState(state) {
return reqLoad.updateById(API_URL_SYS_TERMINALS, vdata.record.trmId, { state: state }).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_TERMINAL_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
// 更新状态
function updateDefault(defaultFlag) {
return $updateTrmDefault(vdata.record.trmId, defaultFlag).then(() => {
emit.refPageAndSearchEmit(emit.ENAME_REF_TERMINAL_LIST) // 修改列表页面。
infoBox.showSuccessToast('修改成功')
})
}
function terminalChannelBindSendFunc(ifCode){
$terminalChannelBindSend(vdata.record.trmId, ifCode).then(() => {
infoBox.showToast('操作完成').then(() => {
refData(vdata.record.trmId)
})
})
}
</script>
<style lang="scss" scoped>
.default-image {
width: 50rpx;
height: 50rpx;
}
</style>