Commit 6fdf9f04 authored by xinzhedeai's avatar xinzhedeai

fix:消费者日期问题处理、首页无用数据注释处理

parent 0bd1c3fb
...@@ -222,11 +222,13 @@ ...@@ -222,11 +222,13 @@
<van-datetime-picker <van-datetime-picker
v-model="selectedDate" v-model="selectedDate"
:min-date="minDate" :min-date="minDate"
:max-date="maxDate"
type="year-month" type="year-month"
title="选择年月" title="选择年月"
@confirm="confirm4completionDate" @confirm="confirm4completionDate"
@cancel="showPopup4completionDate=false" @cancel="showPopup4completionDate=false"
:formatter="needData" :formatter="needData"
:filter1="filterYear"
/> />
</van-popup> </van-popup>
<!-- </van-cell-group> --> <!-- </van-cell-group> -->
......
...@@ -10,33 +10,34 @@ window.onload = function () { ...@@ -10,33 +10,34 @@ window.onload = function () {
// 控制日期选择器弹窗的显示与隐藏 // 控制日期选择器弹窗的显示与隐藏
showPicker: false, showPicker: false,
// 存储选择的日期 // 存储选择的日期
selectedDate: currentDate, // '', // gemhoUtil.formatDate(new Date(value)), selectedDate: new Date(currentDate), // '', // gemhoUtil.formatDate(new Date(value)),
//显示的日期 //显示的日期
showDate: currentDate, showDate: currentDate,
// 日期选择的最小范围,这里设置为当前日期的前 10 年 // 日期选择的最小范围,这里设置为当前日期的前 10 年
minDate: new Date(new Date().getFullYear() - 10, 0), minDate: new Date(new Date().getFullYear() - 10, 0),
// 日期选择的最大范围,这里设置为当前日期的后 10 年 // 日期选择的最大范围,这里设置为当前日期的后 10 年
maxDate: new Date(new Date().getFullYear() + 10, 11), // maxDate: new Date(new Date().getFullYear() + 10, 11),
checkModules: [ maxDate: new Date(),
{ // checkModules: [
intro: '提交检查反馈', // {
}, // intro: '提交检查反馈',
{ // },
intro: '查看检查历史记录', // {
}, // intro: '查看检查历史记录',
{ // },
intro: '提交检查反馈', // {
}, // intro: '提交检查反馈',
{ // },
intro: '下载检查报告', // {
}, // intro: '下载检查报告',
{ // },
intro: '查看隐患详情', // {
}, // intro: '查看隐患详情',
{ // },
intro: '设置检查提醒', // {
}, // intro: '设置检查提醒',
], // },
// ],
userInfo: { userInfo: {
userType: 'sj1', // 登录用户type userType: 'sj1', // 登录用户type
userType: 'consumers', // 登录用户type userType: 'consumers', // 登录用户type
...@@ -51,50 +52,50 @@ window.onload = function () { ...@@ -51,50 +52,50 @@ window.onload = function () {
showOrg: false, //是否显示组织 showOrg: false, //是否显示组织
showShop: false, //是否显示店铺 showShop: false, //是否显示店铺
// 登录用户type // 登录用户type
defaultMenuList: [ // defaultMenuList: [
{ // {
className: 'saoma', // className: 'saoma',
title: '扫码检查', // title: '扫码检查',
remark: '', // remark: '',
navTo: false, // navTo: false,
}, // },
{ // {
className: 'jiancha', // className: 'jiancha',
title: '检查记录', // title: '检查记录',
remark: '', // remark: '',
navTo: 'checkrecord-all', // navTo: 'checkrecord-all',
}, // },
{ // {
className: 'yinhuan', // className: 'yinhuan',
title: '隐患记录', // title: '隐患记录',
remark: '', // remark: '',
navTo: 'yh_check', // navTo: 'yh_check',
}, // },
{ // {
className: 'yinhuan', // className: 'yinhuan',
title: '隐患整改', // title: '隐患整改',
remark: '', // remark: '',
navTo: 'yh_check', // navTo: 'yh_check',
}, // },
{ // {
className: 'shangjia', // className: 'shangjia',
title: '商家信息', // title: '商家信息',
remark: '', // remark: '',
navTo: 'shanghu_detail-edit', // navTo: 'shanghu_detail-edit',
}, // },
{ // {
className: 'zicha', // className: 'zicha',
title: '安全自查', // title: '安全自查',
remark: '', // remark: '',
navTo: 'check_info', // navTo: 'check_info',
}, // },
{ // {
className: 'shangbao', // className: 'shangbao',
title: '隐患上报', // title: '隐患上报',
remark: '', // remark: '',
navTo: 'shangbao-list', // navTo: 'shangbao-list',
}, // },
], // ],
// 修改默认菜单结构为最小化配置 // 修改默认菜单结构为最小化配置
menuList: [], menuList: [],
// 初始化为空数组,等待接口数据填充 // 初始化为空数组,等待接口数据填充
...@@ -107,7 +108,7 @@ window.onload = function () { ...@@ -107,7 +108,7 @@ window.onload = function () {
page: 1, // 页码 page: 1, // 页码
size: 10, // 每页显示的数量 size: 10, // 每页显示的数量
accessType: 'manage', // 访问类型 shop商家 saoma 扫码 manage 管理 accessType: 'manage', // 访问类型 shop商家 saoma 扫码 manage 管理
remindStatistic: [] remindStatistic: []
} }
}, },
mounted() { mounted() {
...@@ -117,38 +118,47 @@ window.onload = function () { ...@@ -117,38 +118,47 @@ window.onload = function () {
}, },
computed: {}, computed: {},
methods: { methods: {
getRemindStatistic(){ // 新增:年份倒序过滤函数
http2.post( filterYear(type, options) {
{ console.log(options, 'options')
serviceId: API_KEY_MAP['no-page']['id'], if (type === 'year') {
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'], return options.reverse(); // 仅对年份类型反转选项数组
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'], }
reqParams: { return options; // 其他类型保持原顺序
sign: 23, // 商户首页统计 },
}, getRemindStatistic() {
}, http2.post(
(res) => { {
if (!res) { serviceId: API_KEY_MAP['no-page']['id'],
// 中台返回为undefined 重新请求 interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
setTimeout(() => { interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
this.getRemindStatistic() reqParams: {
}, 0) sign: 23, // 商户首页统计
return },
} },
if (res) { (res) => {
var result = JSON.parse(res) if (!res) {
this.remindStatistic = result.data // 中台返回为undefined 重新请求
} setTimeout(() => {
} this.getRemindStatistic()
)}, }, 0)
openDebug(){ // 双击开启debugg模式,再次双击则关闭 return
console.log('开启关闭debug') }
if(localStorage.getItem('debug')=='Y'){ if (res) {
var result = JSON.parse(res)
this.remindStatistic = result.data
}
}
)
},
openDebug() { // 双击开启debugg模式,再次双击则关闭
console.log('开启关闭debug')
if (localStorage.getItem('debug') == 'Y') {
localStorage.setItem('debug', 'N') localStorage.setItem('debug', 'N')
}else{ } else {
localStorage.setItem('debug', 'Y') localStorage.setItem('debug', 'Y')
} }
}, },
scanCode(toData) { scanCode(toData) {
if (toData === false) { if (toData === false) {
lightAppJssdk.device.scan({ lightAppJssdk.device.scan({
...@@ -182,7 +192,7 @@ window.onload = function () { ...@@ -182,7 +192,7 @@ window.onload = function () {
// } // }
let param = { let param = {
accessType: this.accessType, accessType: this.accessType,
merId: this.userInfo.merId||'', merId: this.userInfo.merId || '',
unitName: this.userInfo.unitName, unitName: this.userInfo.unitName,
smallPlaceTypeName: this.userInfo.smallPlaceTypeName, smallPlaceTypeName: this.userInfo.smallPlaceTypeName,
} }
...@@ -207,12 +217,12 @@ window.onload = function () { ...@@ -207,12 +217,12 @@ window.onload = function () {
} }
}, },
navTo(type) { // 消息统计跳转 navTo(type) { // 消息统计跳转
const param = { const param = {
type, type,
merId: this.userInfo.merId merId: this.userInfo.merId
}; };
let url = gemhoUtil.setParameter(`./src/_yh_check.html`, param) let url = gemhoUtil.setParameter(`./src/_yh_check.html`, param)
gemhoUtil.navigatePage(url, '跳转中...') gemhoUtil.navigatePage(url, '跳转中...')
}, },
gotoPage(stringifyUrl) { gotoPage(stringifyUrl) {
let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`) let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`)
...@@ -302,7 +312,7 @@ window.onload = function () { ...@@ -302,7 +312,7 @@ window.onload = function () {
if (this.userInfo.userType === 'shop') { // 2025年5月14日新增消费者逻辑 if (this.userInfo.userType === 'shop') { // 2025年5月14日新增消费者逻辑
this.showOrg = false //是否显示组织 this.showOrg = false //是否显示组织
this.showShop = true //是否显示店铺 this.showShop = true //是否显示店铺
this.getRemindStatistic() // 2025年6月9日 新增珊瑚提醒 this.getRemindStatistic() // 2025年6月9日 新增珊瑚提醒
} else if (['admin', 'common', 'industry', 'street', 'wgy'].includes(this.userInfo.userType)) { } else if (['admin', 'common', 'industry', 'street', 'wgy'].includes(this.userInfo.userType)) {
this.showOrg = true //是否显示组织 this.showOrg = true //是否显示组织
...@@ -339,20 +349,21 @@ window.onload = function () { ...@@ -339,20 +349,21 @@ window.onload = function () {
// } else { // } else {
// this.defaultMenuList[1].navTo = 'shanghu_list' // this.defaultMenuList[1].navTo = 'shanghu_list'
// } // }
// // 2025年6月9日 跳转检查记录 统一跳转新页面。 // // 2025年6月9日 跳转检查记录 统一跳转新页面。
// this.defaultMenuList[1].navTo = 'checkrecord-all' // this.defaultMenuList[1].navTo = 'checkrecord-all'
console.log('菜单', result.data.modules)
// 生成最终菜单列表 // 生成最终菜单列表
this.menuList = (result.data.modules || []).map( this.menuList = result.data.modules
(moduleItem) => ({ // this.menuList = (result.data.modules || []).map(
...(this.defaultMenuList.find( // (moduleItem) => ({
(d) => d.title === moduleItem.title // ...(this.defaultMenuList.find(
) || {}), // (d) => d.title === moduleItem.title
...moduleItem, // ) || {}),
remark: moduleItem.remark || '', // ...moduleItem,
}) // remark: moduleItem.remark || '',
) // })
// )
} }
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -235,13 +235,14 @@ ...@@ -235,13 +235,14 @@
<van-cell @click="showDatePicker=true" >日期<span class="formValue">{{formData.date}}</span></van-cell> <van-cell @click="showDatePicker=true" >日期<span class="formValue">{{formData.date}}</span></van-cell>
</div> --> </div> -->
<van-popup v-model="showDatePicker" position="bottom"> <!-- <van-popup v-model="showDatePicker" position="bottom">
<van-datetime-picker <van-datetime-picker
type="date" type="date"
:min-date="minDate":max-date="maxDate"
@confirm="onDateConfirm" @confirm="onDateConfirm"
@cancel="showDatePicker = false" @cancel="showDatePicker = false"
/> />
</van-popup> </van-popup> -->
<div class="form-item date-wrapper"> <div class="form-item date-wrapper">
...@@ -250,10 +251,7 @@ ...@@ -250,10 +251,7 @@
<van-field <van-field
readonly readonly
v-model="formData.date" v-model="formData.date"
:min-date="minDate"
:max-date="maxDate"
placeholder="请选择日期" placeholder="请选择日期"
@click="showDatePicker = true"
class="form-input" class="form-input"
/> />
</div> </div>
......
...@@ -9,37 +9,21 @@ window.addEventListener("load", function () { ...@@ -9,37 +9,21 @@ window.addEventListener("load", function () {
el: '#app', el: '#app',
data() { data() {
return { return {
showDatePicker: false, // 控制日期选择器显示 // showDatePicker: false, // 控制日期选择器显示
minDate: new Date(gemhoUtil.getTargetDateYMD()), // 最小可选日期 // minDate: new Date(gemhoUtil.getTargetDateYMD()), // 最小可选日期
maxDate: new Date(2099, 11, 31), // 最大可选日期 // maxDate: new Date(2099, 11, 31), // 最大可选日期
// 新增子Tab数据 // 日期选择的最小范围,这里设置为当前日期的前 10 年
subActiveTab: 0, // maxDate: new Date(new Date().getFullYear() + 10, 11),
hazardList: [// 更多示例数据...
],
activeTab: 0,
showTimePicker: false,
// 新增以下数据 // 新增以下数据
showTypePicker: false,
typeOptions: ['小餐饮', '酒店', '商场', '学校', '医疗机构'],
formData: { formData: {
submitDate: gemhoUtil.getTargetDateYMD(), submitDate: gemhoUtil.getTargetDateYMD(),
createDate: gemhoUtil.getTargetDateYMD(), createDate: gemhoUtil.getTargetDateYMD(),
date: gemhoUtil.getTargetDateYMD(),
phone: '', phone: '',
area: '', area: '',
businessHours: '', businessHours: '',
type: '', // 新增类型字段 type: '', // 新增类型字段
}, },
checkList: [{
id: 1,
date: '2024-03-15',
result: '合格'
},
{
id: 2,
date: '2024-03-14',
result: '不合格'
}
],
merId: '', merId: '',
merInformation: { // 新增商户信息对象 merInformation: { // 新增商户信息对象
...@@ -54,40 +38,31 @@ window.addEventListener("load", function () { ...@@ -54,40 +38,31 @@ window.addEventListener("load", function () {
mounted() { mounted() {
this.getShopInfo() // 获取商户信息 this.getShopInfo() // 获取商户信息
}, },
watch: { // watch: {
'formData.date': { // 'formData.date': {
handler(newVal) { // handler(newVal) {
console.log('date 属性变化:', newVal); // console.log('date 属性变化:', newVal);
}, // },
deep: true // 深度监听对象属性 // deep: true // 深度监听对象属性
} // }
}, // },
methods: { methods: {
// 日期格式化函数(确保格式为 YYYY-MM-DD)
dateFormatter(type, value) {
if (type === 'year') {
return `${value}年`;
} else if (type === 'month') {
return `${value}月`;
}
return `${value}日`;
},
gotoPage(stringifyUrl) { gotoPage(stringifyUrl) {
let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`) let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`)
gemhoUtil.navigatePage(url, '跳转中...') gemhoUtil.navigatePage(url, '跳转中...')
}, },
// 确认日期选择 // 确认日期选择
onDateConfirm(date) { // onDateConfirm(date) {
// 将 Date 对象格式化为 YYYY-MM-DD 字符串 // // 将 Date 对象格式化为 YYYY-MM-DD 字符串
const year = date.getFullYear(); // const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0'); // const day = String(date.getDate()).padStart(2, '0');
this.formData.date = `${year}-${month}-${day}`; // this.formData.date = `${year}-${month}-${day}`;
this.showDatePicker = false; // this.showDatePicker = false;
}, // },
dateChange(e) { // dateChange(e) {
console.log('date 属性变化22222:', e); // console.log('date 属性变化22222:', e);
}, // },
// 文件上传处理 // 文件上传处理
handleFileUpload(file) { handleFileUpload(file) {
console.log('上传文件:', file); console.log('上传文件:', file);
......
...@@ -485,7 +485,7 @@ ...@@ -485,7 +485,7 @@
<!-- 消费者安全建议列表 --> <!-- 消费者安全建议列表 -->
<div v-if="activeTab==2"> <div v-if="activeTab==2">
<van-list v-model:loading="loading" :offset="10" :finished="finished" finished-text="没有更多了" @load="getList" :immediate-check="false"> <van-list v-model:loading="loading" :offset="10" :finished="finished" finished-text="没有更多了" @load="getConsumerSuggestList" :immediate-check="false">
<van-cell <van-cell
v-for="(item, index) in consumerSuggestList" v-for="(item, index) in consumerSuggestList"
:key="item.id" :key="item.id"
......
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