Commit c1fe147e authored by lei's avatar lei

add:商户首页接口对接

parent 36fce0eb
......@@ -117,8 +117,6 @@ window.onload = function () {
merId: strUrl.searchParams.get('merId'),
accessType: strUrl.searchParams.get('accessType')
};
console.log('扫码成功', data, param);
// location.href = 'shanghu_home.html'
// let param = {
// accessType: 'saoma',
......
......@@ -11,7 +11,17 @@ window.onload = function () {
if (!gemhoUtil.getCookie('token')) {
getUserInfo()
} else {
gemhoUtil.navigatePage('home.html', '跳转中...')
let accessType = gemhoUtil.getParameter('accessType')
if (accessType == 'saoma') {
let param = {
accessType: accessType,
merId: gemhoUtil.getParameter('merId')
}
let url = gemhoUtil.setParameter(`./src/_shanghu_home.html`, param)
gemhoUtil.navigatePage(url, '跳转中...')
} else {
gemhoUtil.navigatePage('home.html', '跳转中...')
}
}
}
......
......@@ -63,9 +63,9 @@
</div>
<!-- 第三行:商家和箭头 -->
<div style="display: flex; justify-content: start; gap: .4rem; align-items: center;">
<span>检查人{{item.checkPeopleName}}</span>
<span>隐患数{{item.hiddenCount}}</span>
<span>未整改{{item.notRectifiedCount}}</span>
<span>检查人:{{item.checkPeopleName}}</span>
<span>隐患数:{{item.hiddenCount}}</span>
<span>未整改:{{item.notRectifiedCount}}</span>
</div>
</div>
</van-cell>
......
......@@ -14,22 +14,22 @@
<div class="header">
<!-- <div class="level">安全等级</div> -->
<div class="title">
<img src="../image/code/sj.png" alt=""><span>威海市宝威酒店有限公司</span><span class="tag">安全等级-绿</span>
<img src="../image/code/sj.png" alt=""><span>{{merInformation.unitName}}</span><span class="tag">安全等级-绿</span>
</div>
<div class="detail">
<van-row>
<van-col span="24">场所类型: 小餐饮</van-col>
<van-col span="24">场所类型: {{merInformation.smallPlaceTypeName}}</van-col>
<div class="detail_link" @click="navTo('shanghu_detail')">详情<van-icon name="arrow" /></div>
</van-row>
<van-row type="flex" justify="space-around"
style="width:100%; margin-top: .3rem; margin-bottom: .3rem;">
<van-col span="6">自查数:75</van-col>
<van-col span="6">检查数:75</van-col>
<van-col span="6">隐患数:75</van-col>
<van-col span="6">未整改:75</van-col>
<van-col span="6">自查数:{{merInformation.checkSelfCount}}</van-col>
<van-col span="6">检查数:{{merInformation.checkCount}}</van-col>
<van-col span="6">隐患数:{{merInformation.hiddenCount}}</van-col>
<van-col span="6">未整改:{{merInformation.hiddenNoReCount}}</van-col>
</van-row>
<van-row>
<van-col span="24">山东省威海市环翠区和谐街35-6</van-col>
<van-col span="24">{{merInformation.businessAddress}}-6</van-col>
</van-row>
</div>
......@@ -39,12 +39,12 @@
<button type="info" class="func_btn" @click="navTo('check_info')"><span>+</span>安全检查</button>
<!-- Tab栏 -->
<van-tabs v-model:active="activeTab" title-active-color="#1989fa" line-height="2px"
<van-tabs v-model:active="activeTab" @click="clickTab" title-active-color="#1989fa" line-height="2px"
style="margin-bottom: 15px;">
<van-tab title="隐患整改"></van-tab>
<van-tab title="检查记录"></van-tab>
<van-tab title="自查记录"></van-tab>
<van-tab title="培训演练"></van-tab>
<!-- <van-tab title="培训演练"></van-tab> -->
</van-tabs>
<div v-show="activeTab===0" class="subNavWrapper">
......@@ -59,7 +59,7 @@
</van-tabs>
<!-- 隐患列表 -->
<van-list>
<van-cell v-for="item in filteredHazards" :key="item.id">
<van-cell v-for="item in filteredHazards" :key="item.id" >
<div style="width: 100%;">
<!-- 第一行:隐患描述 -->
<div style="
......@@ -74,18 +74,18 @@
<!-- 第二行:状态和时间 -->
<div style="display: flex; justify-content: start; gap: .34rem; margin: 8px 0;">
<van-tag :type="statusTagType(item.status)">
{{ item.status }}
<van-tag :type="statusTagType(item.rectificationStatusName)">
{{ item.rectificationStatusName }}
</van-tag>
<span
style="color: #737373; font-size: 0.28rem;margin-left: -1.6rem;">检查时间:{{ item.date }}</span>
<van-icon name="arrow" class="navToBtn" @click="viewDetail(item.id)" />
style="color: #737373; font-size: 0.28rem;margin-left: -1.6rem;">检查时间:{{ item.checkDate }}</span>
<van-icon name="arrow" class="navToBtn" @click="viewDetail(item,'YH_XQ')" />
</div>
<!-- 第三行:商家和箭头 -->
<div style="display: flex; justify-content: space-between; align-items: center;">
<span style="color: #666; font-size: 0.28rem;">商家名称:威海市宝威酒店有限公司{{ item.shop }}</span>
<span style="color: #666; font-size: 0.28rem;">商家名称:{{ item.merName }}</span>
</div>
</div>
</van-cell>
......@@ -95,9 +95,8 @@
<!-- 检查记录 -->
<div v-show="activeTab>0" class="subNavWrapper">
<!-- 隐患列表 -->
<van-list>
<van-cell v-for="item in filteredHazards" :key="item.id">
<van-cell v-for="item in jcLisk" :key="item.id" @click="viewDetail(item,,'JC_XQ')" >
<div style="width: 100%;">
<!-- 第一行:隐患描述 -->
<div style="
......@@ -108,19 +107,20 @@
font-size: 0.3rem;
font-weight: bold;
font-family: PingFang SC;
">{{ item.description }}</div>
">九小场所消防安全检查清单</div>
<!-- ">{{ item.description }}</div> -->
<!-- 第二行:状态和时间 -->
<div style="display: flex; justify-content: space-between; margin: 8px 0;">
<span style="color: #737373; font-size: 0.28rem;">时间:{{ item.date }}</span>
<span style="color: #737373; font-size: 0.28rem;">时间:{{ item.checkTime }}</span>
</div>
<!-- 第三行:商家和箭头 -->
<div>
<van-row type="flex" justify="start" style="width:100%;">
<van-col span="8">检查人:xxx</van-col>
<van-col span="8">隐患数:75</van-col>
<van-col span="8">未整改:75</van-col>
<van-col span="8">检查人:{{item.checkPeopleName}}</van-col>
<van-col span="8">隐患数:{{item.hiddenCount}}</van-col>
<van-col span="8">未整改:{{item.notRectifiedCount}}</van-col>
</van-row>
</div>
</div>
......
......@@ -51,14 +51,31 @@ window.addEventListener("load", function () {
date: '2024-03-14',
result: '不合格'
}
]
],
merId: '',
merInformation: { // 新增商户信息对象
},
jcLisk: [{ // 新增检查列表数据
}]
}
},
created() {
let params = gemhoUtil.getUrlParams()
console.log(params);
this.merId = params.merId
},
mounted() {
this.getShopInfo() // 获取商户信息
this.getShopDate() // 获取商户统计信息
this.getYhList() // 获取隐患记录
this.getJcList() // 获取检查列表
},
computed: {
filteredHazards() {
const statusMap = ['全部', '待审核', '待整改', '已整改'];
return this.hazardList.filter(item =>
this.subActiveTab === 0 ? true : item.status === statusMap[this.subActiveTab]
this.subActiveTab === 0 ? true : item.rectificationStatusName === statusMap[this.subActiveTab]
);
}
},
......@@ -73,7 +90,14 @@ window.addEventListener("load", function () {
pageName: '_shanghu_home'
}
}
gemhoUtil.navigatePage(`_${url}.html`, params)
let strurl = gemhoUtil.setParameter(`_${url}.html`, params)
gemhoUtil.navigatePage(strurl, '跳转中...')
},
clickTab() {
console.log(this.activeTab);
if (this.activeTab > 0) {
this.getJcList() // 获取检查列表
}
},
// 新增选择确认方法
onConfirmType(value) {
......@@ -93,15 +117,204 @@ window.addEventListener("load", function () {
};
return types[status] || '';
},
viewDetail(item) {
console.log('查看详情:', id);
viewDetail(item, type) {
let params = {
id: item.id,
pageName: '_shanghu_home'
}
// 这里添加跳转逻辑
if (item.status == '01') { // 待审核
this.navTo('check_info', item.id)
// gemhoUtil.navigatePage(`_${url}.html`)
if (type === 'YH_XQ') {
params = {
...params,
flag: item.rectificationStatusName,
}
} else {
params = {
...params,
flag: 'JC_XQ',
}
}
let url = gemhoUtil.setParameter('_check_info.html', param)
gemhoUtil.navigatePage(url, '跳转中...')
}
},
//获取商户统计信息
getShopDate() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 6,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
merId: this.merId,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
this.merInformation = { ...this.merInformation, ...result.data }
}
}
)
}, 0)
},
//获取商户信息
getShopInfo() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 11,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
merId: this.merId,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
this.merInformation = { ...this.merInformation, ...result.data }
}
}
)
}, 0)
},
//获取隐患记录
getYhList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['page']['id'],
interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: {
sign: 3,
merId: this.merId,
status: this.activeTab,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
this.hazardList = result.rows
console.log(result)
}
}
)
}, 0)
},
//获取隐患记录获取检查列表
getJcList() {
// 更多示例数据...
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['page']['id'],
interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: {
sign: 1,
type: this.activeTab,
merId: this.merId,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
if (result.code !== 200 && result.data == null) {
return
}
this.jcLisk = result.rows
if (this.page * this.size >= this.total) {
this.finished = true // 下滑不在刷新数据
}
}
this.loading = false
setTimeout(() => {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0)
this.$nextTick(() => {
// 滚动条跳转位置
window.scrollTo(0, gemhoUtil.getCookie('scrollPosition'))
})
}
)
}, 0)
}
}
});
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment