This commit is contained in:
cjb 2025-05-07 08:53:05 +08:00
parent 035cc138eb
commit 5c303e6e02
5 changed files with 141 additions and 19 deletions

View File

@ -102,3 +102,17 @@ export function publicKey(stationCode:any) {
} }
}) })
} }
//获取小程序二维码
interface Rcode{
path:String
width:String
}
export function getCode(params:Rcode) {
return server.request({
url: '/cloud/batterystation/xcx/qrcode/create',
method: 'get',
params,
responseType:'blob'
})
}

View File

@ -15,7 +15,8 @@
<div v-if="showcode" style="display: flex;align-items: center;padding-right: 30px;color: #80aedd;cursor: pointer;"> <div v-if="showcode" style="display: flex;align-items: center;padding-right: 30px;color: #80aedd;cursor: pointer;">
<div @click="setpublicKey" style="padding-right: 40px;color: #b88230;">生成公钥</div> <div @click="setpublicKey" style="padding-right: 40px;color: #b88230;">生成公钥</div>
<div @click="xcxcode" style="padding-right: 6px;">查看小程序码</div> <div @click="xcxcode(1)" style="padding-right: 20px;">生成小程序码</div>
<!-- <div @click="xcxcode(2)" style="padding-right: 6px;color: #aeaf96;">生成预约二维码</div> -->
<!-- <el-icon><Download /></el-icon> --> <!-- <el-icon><Download /></el-icon> -->
</div> </div>
@ -51,24 +52,37 @@
> >
<img :src="urlcode" width="400" height="400" /> <img :src="urlcode" width="400" height="400" />
<div style="text-align: right;">
<el-button @click="downloadImage()">下载</el-button> <el-button @click="downloadImage()">下载</el-button>
</div>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import{ getqrcode,publicKey } from '@/api/swapstation/hdz' import{
getqrcode,
publicKey,
getCode
} from '@/api/swapstation/hdz'
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
name?:string name?:string
showjt?:boolean showjt?:boolean
showcls?:boolean showcls?:boolean
showcode?:boolean, showcode?:boolean,
hdzcode?:string hdzcode?:string,
openAllDay?:string|number,
startTime?:string,
endTime?:string
}>(), { }>(), {
name:'', name:'',
showjt:true, showjt:true,
showcls:true, showcls:true,
showcode:false showcode:false,
openAllDay:'',
startTime:'',
endTime:''
}) })
//${import.meta.env.VITE_APP_BASE_API} http://192.168.5.200:9103 //${import.meta.env.VITE_APP_BASE_API} http://192.168.5.200:9103
let url = `${import.meta.env.VITE_APP_BASE_API}/cloud/batterystation/xcx/qrcode/get?path=pages/home/index?code=${props.hdzcode}&width=400&env_version=trial` let url = `${import.meta.env.VITE_APP_BASE_API}/cloud/batterystation/xcx/qrcode/get?path=pages/home/index?code=${props.hdzcode}&width=400&env_version=trial`
@ -110,12 +124,8 @@
let openpop = ref(false) let openpop = ref(false)
let urlcode = ref<any>('') let urlcode = ref<any>('')
// //
function xcxcode(){ function xcxcode(type:number){
getqrcode({ codehand(type).then((rps:any) => {
path:`pages/home/index?code=${props.hdzcode}`,
width:'400',
env_version:'trial' //"release""trial""develop"
}).then((rps:any) => {
openpop.value = true openpop.value = true
let reader = new FileReader() let reader = new FileReader()
@ -130,9 +140,26 @@
function downloadImage() { function downloadImage() {
const a = document.createElement('a'); const a = document.createElement('a');
a.href = urlcode.value a.href = urlcode.value
a.download = props.name a.download = props.name+'.jpg'
// a.setAttribute('download', props.name+'.jpg');
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
document.body.removeChild(a); document.body.removeChild(a);
} }
//
function codehand(type:number) {
if(type == 1){
return getqrcode({
path: `pages/home/index?hdzcode=${props.hdzcode}&hdzname=${props.name}&openAllDay=${props.openAllDay}&stiem=${props.startTime}&etime=${props.endTime}`, //`code=${props.hdzcode}&hdzname=${props.name}`,
width:'400',
env_version:'release' //"release""trial""develop"
})
}
return getCode({
path:`homePages/reservation/index?code=${props.hdzcode}&hdzname=${props.name}`, //`pages/home/index?code=${props.hdzcode}&hdzname=${props.name}`, //`code=${props.hdzcode}&hdzname=${props.name}`,
width:'400',
})
}
</script> </script>

View File

@ -302,8 +302,8 @@
ucode:'', //ID ucode:'', //ID
status:'', status:'',
plateNum:'', // plateNum:'', //
swapDayBegin:getDateDaysAgo(30), //,(yyyyMMdd) swapDayBegin:getDateDaysAgo(30).replace(/-/g,''), //,(yyyyMMdd)
swapDayEnd:getDateDaysAgo(), // swapDayEnd:getDateDaysAgo().replace(/-/g,''), //
stationCode:'' // stationCode:'' //
}) })

View File

@ -371,7 +371,15 @@
:with-header="false" :with-header="false"
size="70%" size="70%"
> >
<tit @close="handleClose" :name="addata.name" :hdzcode="addata.code" :showcode="true" /> <tit
@close="handleClose"
:name="addata.name"
:hdzcode="addata.code"
:showcode="true"
:openAllDay="addata.openAllDay"
:startTime="addata.runStartTime"
:endTime="addata.runEndTime"
/>
<el-row :gutter="25"> <el-row :gutter="25">
<el-col :span="24" style="margin-bottom: 20px;"> <el-col :span="24" style="margin-bottom: 20px;">
<div style="padding: 0;border: 2px solid #73b9c9;border-radius: 10px;"> <div style="padding: 0;border: 2px solid #73b9c9;border-radius: 10px;">

View File

@ -221,6 +221,20 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" v-if="userType == 1">
<el-form-item label="关联微信用户" prop="wxuser">
<el-autocomplete
style="width: 100%"
v-model="wxuser"
:fetch-suggestions="querySearchAsync"
placeholder="请输入手机号查询"
clearable
@blur="autoblur"
@select="handleSelect"
@clear="autoclear"
/>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<template #footer> <template #footer>
@ -311,6 +325,10 @@
import Fphdz from './fphdz.vue' import Fphdz from './fphdz.vue'
import {
getwxlist
} from '@/api/operation/wxuser'
import { ref,reactive,nextTick } from 'vue' import { ref,reactive,nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
@ -421,7 +439,8 @@
readonly:'2', // readonly:'2', //
avatar:'', // avatar:'', //
businessCode:'', //code code businessCode:'', //code code
businessCode1:'' //code code businessCode1:'', //code code
wuid:''
}) })
const rules = ref({ const rules = ref({
@ -498,6 +517,8 @@
} }
//userform.avatar = row.avatar //userform.avatar = row.avatar
userform.wuid = row.wuid?row.wuid:''
wxuser.value = row.wuid?row.wuid:''
}else{ }else{
userform.pkId = '' userform.pkId = ''
userform.uid = '' userform.uid = ''
@ -514,6 +535,9 @@
//userform.avatar = '' //userform.avatar = ''
userform.businessCode = '' userform.businessCode = ''
userform.businessCode1 = '' userform.businessCode1 = ''
userform.wuid = ''
wxuser.value = ''
} }
} }
@ -669,6 +693,55 @@
hdzcode.value = row.stationCodes hdzcode.value = row.stationCodes
} }
//
let wxuser = ref('')
async function querySearchAsync (queryString: string, cb:any) {
getwxlist({
pageSize:100, //
pageNo:1, //
phoneNumber:queryString, //
// nickName:queryString, //
// name:queryString //
}).then((res) => {
if (res.data && (res.data as any).records.length > 0) {
// mapList.value = res.data;
let listss = (res.data as any).records.map((n:any) => {
return {
value: `${n.name?n.name:'暂未设置姓名'}${n.phoneNumber?n.phoneNumber:'暂未绑定手机号'}`,
name: n.name,
phoneNumber:n.phoneNumber,
id:n.wuid //??
}
})
cb(listss)
//return listss
// callback(mapList.value);
}else{
cb([])
}
}).catch(() => {
cb([])
})
}
function autoblur() {
if(userform.userId === ''){
wxuser.value = ''
}
}
function autoclear() {
// addata.userId = ''
// addata.plateNum = ''
// carlist.value.splice(0)
userform.wuid = ''
}
function handleSelect(v: any) {
userform.wuid = v.id
}
function handhdx() { function handhdx() {
hdzpop.value = false hdzpop.value = false
handleQuery() handleQuery()