5 changed files with 385 additions and 7 deletions
@ -0,0 +1,352 @@ |
|||
<template> |
|||
<div v-if="visible" class="van-overlay"></div> |
|||
<div v-if="visible" class="popup"> |
|||
<!-- <div class="popup-title">企业搜索</div>--> |
|||
<!-- 关闭按钮 --> |
|||
<label class="close-button" @click="closePopup"></label> |
|||
|
|||
<!-- 弹窗的内容 --> |
|||
<div class="popup-content"> |
|||
<!-- <div class="warning-rule"> |
|||
<span><van-icon name="warning-o" /></span><span>请先选择不扫码原因(必选),搜索企业名称进行执法登记。</span> |
|||
</div>--> |
|||
<div class="subtitle">请选择不扫码的原因:</div> |
|||
<div class="item-box"> |
|||
<!-- <span :class="checkCss==1?'item-btn active':'item-btn'" |
|||
@click="checkReason('企业拒绝出示二维码', 1)">企业拒绝出示二维码</span>--> |
|||
<span :class="checkCss==2?'item-btn active':'item-btn'" |
|||
@click="checkReason('网络/设备故障', 2)">网络/设备故障</span> |
|||
<span :class="checkCss==3?'item-btn active':'item-btn'" |
|||
@click="checkReason('其它', 3)">其它</span> |
|||
<span :class="checkCss==4?'item-btn active':'item-btn'" |
|||
@click="checkReason('补录', 3)">补录</span> |
|||
|
|||
<span v-for="(item, index) in dicts" :key="index" :class="checkCss==item.dictValue?'item-btn active':'item-btn'" @click="checkReason(item.dictLabel, item.dictValue)">{{item.dictLabel}}</span> |
|||
</div> |
|||
<!-- <div class="btnbox"> |
|||
<button class='btn-reset' @click="">重置</button> |
|||
<button class='btn-search' @click="closeReason">确定</button> |
|||
</div>--> |
|||
|
|||
<div class="subtitle">请搜索企业名称:</div> |
|||
<div class="subsearch"> |
|||
<input class="searchbox" v-model="searchParam.enterpriseName" placeholder="请输入关键字" /> |
|||
<van-icon class="ibtn-reset" name="clear" @click="cancel()" title="重置" /> |
|||
<button class='btn-search' @click="search()">搜索</button> |
|||
</div> |
|||
|
|||
<div class="search-result"> |
|||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh"> |
|||
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> |
|||
<div class="case-item" v-for="(item, index) in dataList" :key="index" @click="selectData(item)"> |
|||
<div class="case-title">{{ item.enterpriseName }}</div> |
|||
<!-- <div class="case-depart">{{ item.phonenumber }}</div> |
|||
<div class="case-time">{{ item.loginName }}</div> --> |
|||
</div> |
|||
</van-list> |
|||
</van-pull-refresh> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import {ref} from 'vue' |
|||
// import {queryUsers} from '../../api/user' |
|||
import {queryEnterpriseInfoList} from '../../api/enterprise' |
|||
|
|||
const {useCommon} = $globalStore |
|||
export default { |
|||
props: { |
|||
visible: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
content: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
searchParam: { |
|||
//搜索框 |
|||
enterpriseName: '', |
|||
// 分页 |
|||
pageNum: 1, |
|||
pageSize: 6, |
|||
}, |
|||
dataList: [], |
|||
loading: false, |
|||
finished: false, |
|||
refreshing: false, |
|||
curPage: 1, |
|||
} |
|||
}, |
|||
created() { |
|||
}, |
|||
watch: { |
|||
'searchParam.enterpriseName': { |
|||
handler: function (newValue, oldValue) { |
|||
// 当person对象的age属性变化时,这个函数会被调用 |
|||
console.log(`age changed from ${oldValue} to ${newValue}`); |
|||
if (newValue.length > 0) { |
|||
// this.queryList(); |
|||
} else { |
|||
this.dataList = []; |
|||
} |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
closePopup() { |
|||
this.$emit('close'); |
|||
}, |
|||
queryList() { |
|||
this.searchParam.pageNum = (this.curPage-1)*this.searchParam.pageSize; |
|||
queryEnterpriseInfoList(this.searchParam, success => { |
|||
this.curPage++; |
|||
this.loading = false; // 查出结果停止加载 |
|||
if (success.total <= this.dataList.length) { |
|||
// 查到最后没数据 |
|||
this.finished = true; |
|||
return; |
|||
} |
|||
// this.dataList = success.data |
|||
this.dataList.push(...success.rows); |
|||
}, error => { |
|||
}) |
|||
}, |
|||
search() { |
|||
this.curPage = 1; |
|||
this.dataList = []; |
|||
this.onRefresh(); |
|||
}, |
|||
cancel() { |
|||
this.searchParam.enterpriseName = ''; |
|||
this.search() |
|||
}, |
|||
selectData(item) { |
|||
this.$emit("reciveData", item); |
|||
this.$emit('close'); |
|||
}, |
|||
|
|||
//下拉刷新 |
|||
onRefresh() { |
|||
// 清空列表数据 |
|||
this.enterpriseList = []; |
|||
this.finished = false; |
|||
|
|||
// 重新加载数据 |
|||
// 将 loading 设置为 true,表示处于加载状态 |
|||
this.loading = true; |
|||
this.onLoad(); |
|||
}, |
|||
// 触底加载 |
|||
onLoad() { |
|||
let that = this; |
|||
setTimeout(() => { |
|||
if (that.refreshing) { |
|||
that.refreshing = false; |
|||
} |
|||
that.queryList(); |
|||
}, 1000); |
|||
}, |
|||
} |
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.popup { |
|||
position: fixed; |
|||
z-index: 999; |
|||
top: 3rem; |
|||
left: 0; |
|||
width: 100%; |
|||
height: calc(100% - 3rem);; |
|||
background: #fff; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.popup-title { |
|||
margin: 0.3rem 0 0; |
|||
width: 100%; |
|||
height: 1rem; |
|||
border-bottom: 1px solid #f3f4f5; |
|||
text-align: center; |
|||
font-size: 0.45rem; |
|||
font-weight: 600; |
|||
} |
|||
|
|||
.close-button { |
|||
position: absolute; |
|||
top: 0.15rem; |
|||
right: 0.1rem; |
|||
width: 0.8rem; |
|||
height: 0.8rem; |
|||
background-color: rgba(255, 255, 255, .5); |
|||
border: 0.05rem solid rgba(255, 255, 255, .7); |
|||
border-radius: 50%; |
|||
transform: rotate(45deg); |
|||
} |
|||
|
|||
.close-button:before, |
|||
.close-button:after { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
background: #333; |
|||
border-radius: 50%; |
|||
transform: translate(-50%, -50%); |
|||
height: 0.4rem; |
|||
width: 0.02rem; |
|||
} |
|||
|
|||
.close-button:after { |
|||
height: 0.02rem; |
|||
width: 0.4rem; |
|||
} |
|||
|
|||
.popup-content { |
|||
margin: 0.25rem 3% 0; |
|||
padding-bottom: 3rem; |
|||
width: 94%; |
|||
height: calc(100% - 1.6rem); |
|||
overflow-y: auto; |
|||
font-size: 0.37rem; |
|||
} |
|||
|
|||
.subsearch { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
margin: 1%; |
|||
width: 96%; |
|||
height: 1.25rem; |
|||
font-size: 0.37rem; |
|||
} |
|||
|
|||
.subsearch .ibtn-reset { |
|||
margin: 0 0.5rem 0 -1rem; |
|||
width: 1rem; |
|||
color: #afabab; |
|||
font-size: 0.5rem; |
|||
} |
|||
|
|||
.subsearch .btn-search { |
|||
margin: 0 0 0 -0.5rem; |
|||
width: 20%; |
|||
height: 1rem; |
|||
border-radius: 0 0.15rem 0.15rem 0; |
|||
} |
|||
|
|||
.searchbox { |
|||
margin: 2% 0; |
|||
padding: 0.1rem 1.2rem 0.1rem 0.9rem; |
|||
width: 100%; |
|||
height: 1rem; |
|||
background: #f6f7fe url(../../assets/images/icon_sou.png) no-repeat; |
|||
background-position: left 0.25rem center; |
|||
background-size: auto 50%; |
|||
box-sizing: border-box; |
|||
border: 1px solid rgba(0, 0, 0, .1); |
|||
border-radius: 0.15rem 0 0 0.15rem; |
|||
color: #999999; |
|||
outline: none; |
|||
} |
|||
|
|||
.subtitle { |
|||
margin: 0.5rem 0 0.25rem; |
|||
color: #000; |
|||
font-size: 0.4rem; |
|||
/*font-weight: 600;*/ |
|||
clear: both; |
|||
} |
|||
|
|||
.item-btn { |
|||
display: inline-block; |
|||
margin: 0 0.3rem 0.2rem 0.1rem; |
|||
padding: 0.2rem 0.3rem; |
|||
background-color: #f2f3f4; |
|||
color: #999; |
|||
border-radius: 1rem; |
|||
font-size: 0.35rem; |
|||
} |
|||
|
|||
.item-btn.active { |
|||
background-color: #e9f2fb; |
|||
color: #1367fe; |
|||
} |
|||
|
|||
.btnbox { |
|||
display: flex; |
|||
justify-content: center; |
|||
margin: 5% 2%; |
|||
width: 96%; |
|||
height: 1.0rem; |
|||
} |
|||
|
|||
.btn-reset, |
|||
.btn-search { |
|||
display: inline-block; |
|||
margin: 0 2%; |
|||
padding: 0; |
|||
width: 60%; |
|||
color: #fff; |
|||
font-size: 0.35rem; |
|||
border-radius: 1rem; |
|||
background: #1367fe; |
|||
border: 1px solid #1367fe; |
|||
text-align: center; |
|||
} |
|||
|
|||
.btn-reset { |
|||
width: 35%; |
|||
background-color: #fff; |
|||
border-color: rgba(19, 103, 254, .7); |
|||
color: #1367fe; |
|||
} |
|||
|
|||
.search-result { |
|||
width: 100%; |
|||
padding-bottom: 2rem; |
|||
} |
|||
|
|||
.case-item { |
|||
margin: 3% 2%; |
|||
padding: 2% 0; |
|||
width: 96%; |
|||
font-size: 0.35rem; |
|||
border-bottom: 1px solid #f4f4f4; |
|||
color: #999; |
|||
line-height: 2; |
|||
} |
|||
|
|||
.case-title { |
|||
margin: 2% 0; |
|||
font-size: 0.37rem; |
|||
color: #333; |
|||
line-height: 1.25; |
|||
} |
|||
|
|||
.warning-rule { |
|||
display: flex; |
|||
align-items: center; |
|||
margin: 5% 3% 1% 0; |
|||
padding: 0.2rem 0; |
|||
width: 95%; |
|||
border-radius: 0.15rem; |
|||
/*background-color: #fff4e8;*/ |
|||
color: #fb710b; |
|||
font-size: 0.3rem; |
|||
line-height: 1.25; |
|||
} |
|||
|
|||
.warning-rule i { |
|||
margin: 0 0.1rem; |
|||
color: #f50; |
|||
font-size: 0.35rem; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue