提交 0ebf5291 作者: 王定

feat: 优化灵活用工列表上拉加载和删除功能,正在制作可信农资页面

上级 8753b984
# API 接口地址 # API 接口地址
VITE_GLOB_API_URL=http://111.22.182.169:49600 # VITE_GLOB_API_URL=http://111.22.182.169:49600
# VITE_GLOB_API_URL=http://36.133.16.81:42111 VITE_GLOB_API_URL=http://36.133.16.81:42111
# API 接口地址前缀 # API 接口地址前缀
VITE_GLOB_API_URL_PREFIX=/jeecgboot # VITE_GLOB_API_URL_PREFIX=/jeecgboot
# VITE_GLOB_API_URL_PREFIX=/jeecg-boot VITE_GLOB_API_URL_PREFIX=/jeecg-boot
...@@ -6,7 +6,19 @@ enum Api { ...@@ -6,7 +6,19 @@ enum Api {
productMarketList = '/online/cgform/api/getData/5b71e11020d44366b2d130e200c7a640', // 热门产地行情 productMarketList = '/online/cgform/api/getData/5b71e11020d44366b2d130e200c7a640', // 热门产地行情
serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗 serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗
agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂 agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂
warning = '/warningInfo/list' warning = '/warningInfo/list',
postConsultRecordAdd = '/server/consultRecord/add', // 添加咨询信息
}
/**
* @param params 添加
* @description: 添加咨询信息
*/
export function postConsultRecordAdd(params = {}) {
return otherHttp.post({
url: Api.postConsultRecordAdd,
params
})
} }
/** /**
......
...@@ -2,6 +2,7 @@ import { otherHttp } from '/@/utils/http/axios' ...@@ -2,6 +2,7 @@ import { otherHttp } from '/@/utils/http/axios'
enum Api { enum Api {
goodsList = '/trade/goods/list', // 农资列表 goodsList = '/trade/goods/list', // 农资列表
getEnterpriseList = '/server/enterprise/list', // 可信农资列表
} }
/** /**
...@@ -14,3 +15,17 @@ export function goodsList(params = {}) { ...@@ -14,3 +15,17 @@ export function goodsList(params = {}) {
params, params,
}) })
} }
/**
* @param params 请求参数
* @description: APP可信农资列表
*/
export function getEnterpriseList(params = {}) {
return otherHttp.get({
url: Api.getEnterpriseList,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
\ No newline at end of file
<template>
<view v-if="show" class="confirm-dialog-overlay" @click="handleCancel">
<view class="confirm-dialog-container" @click.stop>
<view class="confirm-dialog-content">
<image class="apply_success_icon" src="/static/images/comm/apply_success_icon.png" />
</view>
<!-- 标题 -->
<view class="dialog-title">{{ title }}</view>
<!-- 内容 -->
<view class="dialog-content">{{ content }}</view>
<!-- 按钮组 -->
<view class="dialog-buttons">
<!-- <view class="cancel-btn" @click="handleCancel">
<text class="cancel-text">{{ cancelText }}</text>
</view> -->
<view class="confirm-btn" @click="handleConfirm">
<text class="confirm-text">{{ confirmText }}</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
interface Props {
show?: boolean
title?: string
content?: string
cancelText?: string
confirmText?: string
}
const props = withDefaults(defineProps<Props>(), {
show: false,
title: '提示',
content: '',
cancelText: '取消',
confirmText: '确认',
})
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'cancel'): void
(e: 'confirm'): void
}>()
function handleCancel() {
emit('update:show', false)
emit('cancel')
}
function handleConfirm() {
emit('confirm')
}
</script>
<style lang="scss" scoped>
.confirm-dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.confirm-dialog-container {
position: relative;
width: 600rpx;
background: #FFFFFF;
border-radius: 32rpx;
box-sizing: border-box;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
padding-bottom: 28rpx;
}
.confirm-dialog-content{
width: 600rpx;
height: 240rpx;
border-radius: 32rpx;
opacity: 1;
background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%);
position: relative;
display: flex;
justify-content: center;
.apply_success_icon{
width: 240rpx;
height: 162rpx;
margin-top: 54rpx;
}
}
.close-btn {
position: absolute;
top: 24rpx;
right: 24rpx;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.close-icon {
font-size: 36rpx;
color: #999999;
font-weight: 300;
}
.dialog-title {
margin-top: -32rpx;
font-size: 36rpx;
font-weight: 600;
color: #333333;
text-align: center;
margin-bottom: 32rpx;
}
.dialog-content {
font-size: 28rpx;
color: #666666;
text-align: center;
line-height: 40rpx;
margin-bottom: 48rpx;
}
.dialog-buttons {
display: flex;
gap: 24rpx;
padding-left: 30rpx;
padding-right: 30rpx;
}
.cancel-btn,
.confirm-btn {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.cancel-btn {
background-color: #FFFFFF;
border: 2rpx solid #5DB66F;
}
.cancel-text {
font-size: 28rpx;
color: #5DB66F;
font-weight: 500;
}
.confirm-btn {
background: linear-gradient(135deg, #5DB66F 0%, #4CAF50 100%);
box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3);
}
.confirm-text {
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
}
.cancel-btn:active {
opacity: 0.8;
}
.confirm-btn:active {
opacity: 0.9;
transform: scale(0.98);
}
</style>
...@@ -685,6 +685,20 @@ ...@@ -685,6 +685,20 @@
"style": { "style": {
"navigationBarTitleText": "代理记账" "navigationBarTitleText": "代理记账"
} }
},
{
"path" : "pages/kexinnongzi/kexinnongzi",
"style" :
{
"navigationBarTitleText" : "可信农资"
}
},
{
"path" : "pages/kexinnongzi/detail",
"style" :
{
"navigationBarTitleText" : "详情"
}
} }
], ],
"easycom": { "easycom": {
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue';
import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const consultRecord = reactive({
id: '',
mobile: '',// 咨询人号码
consultTime:"" ,// 咨询时间
bizType:1, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:1324324324, // 意向企业
feedbackRemark:"" // 反馈备注
})
const pageData = reactive({
showLogoutDialog: false,
})
onShow(() => {
const { id, realname, phone } = userStore.getUserInfo;
consultRecord.id = id;
consultRecord.mobile = phone;
consultRecord.feedbackRemark = realname;
})
// 立即申请 // 立即申请
function onApplyClick() { function onApplyClick() {
Message.alert('申请功能暂不可用,敬请期待~', '温馨提示') consultRecord.consultTime = getCurrentDateTime();
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
if(res.success){
pageData.showLogoutDialog = true;
}else{
Message.alert(res.message, '温馨提示');
}
}).catch(error => {
Message.alert(error.message, '温馨提示');
});
} }
// 提交申请
function handleConfirmLogout(){
pageData.showLogoutDialog = false;
}
// 查看大图 // 查看大图
function onViewImage(imageUrl) { function onViewImage(imageUrl) {
uni.previewImage({ uni.previewImage({
...@@ -194,6 +228,14 @@ ...@@ -194,6 +228,14 @@
<text class="font_8 text_32">立即申请</text> <text class="font_8 text_32">立即申请</text>
</view> </view>
</view> </view>
<successfulDialog
v-model:show="pageData.showLogoutDialog"
title="申请成功"
content="平台已收到申请,将尽快与您取得联系!"
confirmText="我知道了"
@confirm="handleConfirmLogout"
/>
</view> </view>
</template> </template>
......
<template>
<view>
详情页的内容
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
<script setup lang="ts">
import { onLoad, onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { reactive, ref } from 'vue'
import * as NongzhiAPI from '@/api/model/nongzhi'
const model = reactive({
params: {
pageNo: 1,
pageSize: 10,
enterprise:{
bizCategory:2,
province:'湖南省'
}
}, // 分页参数
hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载
dataList:[]
})
async function getList(params) {
if (model.loading) return
model.loading = true
NongzhiAPI.getEnterpriseList(params).then((res) => {
if (res.records.length > 0) {
const { records } = res
if (model.params.pageNo === 1) {
model.dataList = records
} else {
model.dataList = [...model.dataList, ...records]
}
model.hasMore = records.length === model.params.pageSize
model.params.pageNo++
} else {
model.hasMore = false
}
})
model.loading = false
}
function toDetail(item) {
uni.navigateTo({
url: `/pages/kexinnongzi/detail?id=${item.id}`,
})
}
function resetData() {
model.params.pageNo = 1
model.hasMore = true
model.loading = false
}
onPullDownRefresh(() => {
resetData()
getList(model.params)
})
onShow(() => {
resetData()
getList(model.params)
})
</script>
<template>
<view class="w-full h-95vh bg-#E6F5E8 yr_page_view">
<!-- 列表 -->
<scroll-view
class="w-full h-full"
style="font-family: '思源黑体'; font-weight: 400"
scroll-y
@scrolltolower="getList(model.params)"
:show-scrollbar="false"
>
<view class="top_img">
<image class="agr_sup_img" src="/static/images/comm/agr_sup_img.png" />
</view>
<view class="page_content">
<view class="item_list" v-for="item in model.dataList" :key="item.id" @click="toDetail(item)">
<view class="item_left">
<image class="enterprise_logo" mode="aspectFit" :src="item.businessLicenseUrl" />
</view>
<view class="item_right">
<view class="item_name ellipsis">{{item.enterpriseName}}</view>
<view class="item_description ellipsis">{{item.businessScope}}</view>
<view class="item_details">
<view class="detail_btn">查看详情</view>
</view>
</view>
</view>
</view>
<!-- <view
v-for="news in newsList"
:key="news.id"
class="w-full h-auto flex flex-row justify-around p-2 bg-#fff border-rd-lg mb-2"
style="min-height: 120rpx"
@click="toNewsDetail(news)"
>
<view class="flex flex-col justify-between" :style="news.posterUrl ? 'width: 68%' : 'width: 100%'">
<view class="ellipsis-multiline fontsize_28 color-#333333">{{ news.title }}</view>
<view class="flex flex-row justify-between text-25 color-#686868">
<text>{{ dayjs(news.publishDate).format('YYYY年MM月DD日') }}</text>
<view class="mr-1 flex-center">
<image class="mt-0.5 mr-1 w-30 h-26" src="/static/images/news/views.png" />
<view class="flex-center text-24 lh-24rpx">{{ news.viewCount }}</view>
</view>
<view v-show="!news.posterUrl" class="w-4%"></view>
</view>
</view>
<view v-show="news.posterUrl" class="w-30% h-130">
<image class="w-full h-full border-rd" :src="news.posterUrl" />
</view>
</view> -->
<!-- 加载状态 -->
<view class="loading-status">
<text v-if="model.loading">加载中...</text>
<text v-else-if="!model.hasMore">没有更多数据了</text>
<text v-else>上拉加载更多</text>
</view>
</scroll-view>
</view>
</template>
<style lang="less" scoped>
.yr_page_view{
padding: 28rpx;
.top_img,.agr_sup_img{
height: 280rpx;
width: 690rpx;
}
.top_img{
margin-bottom: 24rpx;
}
.page_content{
border-radius: 16rpx;
background: #FFFFFF;
}
.ellipsis{
width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item_list{
display: flex;
align-items:flex-start;
justify-content: space-between;
padding-left: 24rpx;
padding-right: 30rpx;
padding-bottom: 24rpx;
padding-top: 24rpx;
border-bottom: 2rpx solid #EEEEEE;
.item_left,.enterprise_logo{
width: 192rpx;
max-height: 160rpx;
}
.item_right{
width: 436rpx;
.item_name{
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.item_description{
font-size: 24rpx;
font-weight: 400;
color: #999999;
margin-top: 16rpx;
margin-bottom: 12rpx;
}
.item_details{
display: flex;
justify-content: flex-end;
}
.detail_btn{
border-radius: 100rpx;
background: #5DB66F;
display: flex;
justify-content: center;
align-items: center;
padding: 20rpx;
width: 136rpx;
height: 48rpx;
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
}
}
}
.item_list:last-child{
border-bottom: none;
}
}
.loading-status {
text-align: center;
padding: 20rpx;
color: #999;
font-size: 28rpx;
}
.ellipsis-multiline {
display: -webkit-box; /* 必须 */
-webkit-box-orient: vertical; /* 垂直排列 */
-webkit-line-clamp: 2; /* 限制显示3行 */
overflow: hidden; /* 隐藏超出内容 */
text-overflow: ellipsis; /* 可选,部分浏览器不生效 */
}
</style>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="make-phone-view"> <view v-if="!pageData.workersParam" class="make-phone-view">
<fui-button text="电话沟通" bold radius="96rpx" @click="makePhoneCall()" height="80rpx"/> <fui-button text="电话沟通" bold radius="96rpx" @click="makePhoneCall()" height="80rpx"/>
</view> </view>
......
...@@ -28,12 +28,9 @@ ...@@ -28,12 +28,9 @@
publishstatu: 1, publishstatu: 1,
type: null, type: null,
createBy: '', createBy: '',
},
findSearch: {
pageNo: 1,
pageSize: 10,
keyword:"" keyword:""
}, },
hasMore:'more',
// 用工类型标签 // 用工类型标签
employmentTabs: [ employmentTabs: [
{ id: 2, name: '找人干活' }, { id: 2, name: '找人干活' },
...@@ -44,6 +41,7 @@ ...@@ -44,6 +41,7 @@
// 用工列表 // 用工列表
employmentList: [], employmentList: [],
total: 0, total: 0,
dataTotal: 0,
}) })
// 缓存已处理的区域数据,避免重复计算 // 缓存已处理的区域数据,避免重复计算
...@@ -89,8 +87,8 @@ ...@@ -89,8 +87,8 @@
function getEmploymentList() { function getEmploymentList() {
// 如果正在加载或没有更多数据,直接返回 // 如果正在加载或没有更多数据,直接返回
if (pageData.loading || (pageData.total > 0 && pageData.employmentList.length >= pageData.total)) { if (pageData.loading || pageData.hasMore == 'noMore') {
return return;
} }
pageData.loading = true; pageData.loading = true;
// 添加请求防抖,避免快速连续请求 // 添加请求防抖,避免快速连续请求
...@@ -99,10 +97,9 @@ ...@@ -99,10 +97,9 @@
} }
pageData.requestDebounce = setTimeout(async () => { pageData.requestDebounce = setTimeout(async () => {
try { try {
// const res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search)) let res = null;
let res = null;
if(pageData.currentEmploymentId == 2){ if(pageData.currentEmploymentId == 2){
res = await fetchWithRetry(() => LinghuoyonggongAPI.getLaborAppList(pageData.findSearch)) res = await fetchWithRetry(() => LinghuoyonggongAPI.getLaborAppList(pageData.search))
}else{ }else{
res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search)) res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search))
} }
...@@ -118,18 +115,21 @@ ...@@ -118,18 +115,21 @@
} }
return item return item
}) })
pageData.dataTotal += processedRecords.length;
// 一次性更新数据,避免多次响应式更新 // 一次性更新数据,避免多次响应式更新
if (pageData.search.pageNo === 1) { if (pageData.search.pageNo === 1) {
pageData.employmentList = processedRecords pageData.employmentList = processedRecords;
} else { } else {
// 避免重复数据加载 // 避免重复数据加载 感觉有坑
const existingIds = new Set(pageData.employmentList.map((item) => item.id)) /* const existingIds = new Set(pageData.employmentList.map((item) => item.id))
const newRecords = processedRecords.filter((item) => !existingIds.has(item.id)) const newRecords = processedRecords.filter((item) => !existingIds.has(item.id)) */
pageData.employmentList = [...pageData.employmentList, ...newRecords] pageData.employmentList = [...pageData.employmentList, ...processedRecords]
} }
pageData.total = total;
pageData.total = total if (pageData.dataTotal >= total) {
pageData.hasMore = 'noMore'
}
} catch (error) { } catch (error) {
console.error('获取用工列表失败:', error) console.error('获取用工列表失败:', error)
// 这里可以添加用户友好的错误提示 // 这里可以添加用户友好的错误提示
...@@ -193,15 +193,16 @@ ...@@ -193,15 +193,16 @@
return diffDays return diffDays
} }
function onSearch(res:any){ function onSearch(res:any){
pageData.employmentList = [] pageData.employmentList = [];
pageData.search.pageNo = 1;
pageData.dataTotal = 0;
pageData.hasMore = 'more';
if (pageData.currentEmploymentId === 1) { if (pageData.currentEmploymentId === 1) {
pageData.search.pageNo = 1
pageData.search.publishstatu = 1 pageData.search.publishstatu = 1
pageData.search.createBy = res.value pageData.search.createBy = res.value
} }
if (pageData.currentEmploymentId === 2) { if (pageData.currentEmploymentId === 2) {
pageData.findSearch.pageNo = 1; pageData.search.keyword = res.value;
pageData.findSearch.keyword = res.value;
} }
getEmploymentList() getEmploymentList()
} }
...@@ -212,25 +213,28 @@ ...@@ -212,25 +213,28 @@
function resetGetEmploymentList(){ function resetGetEmploymentList(){
pageData.employmentList = [] pageData.employmentList = []
pageData.searchValue = ""; pageData.searchValue = "";
pageData.search.pageNo = 1;
pageData.dataTotal = 0;
pageData.hasMore = 'more';
if (pageData.currentEmploymentId === 1) { if (pageData.currentEmploymentId === 1) {
pageData.search.pageNo = 1
pageData.search.publishstatu = 1 pageData.search.publishstatu = 1
pageData.search.createBy = '' pageData.search.createBy = ''
} }
if (pageData.currentEmploymentId === 2) { pageData.search.keyword = "";
pageData.findSearch.pageNo = 1; getEmploymentList()
pageData.findSearch.keyword = ""; }
} function loadMoreData(){
pageData.search.pageNo++
getEmploymentList() getEmploymentList()
} }
onReachBottom(() => { /* onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.total <= pageData.employmentList.length) { if (pageData.total <= pageData.employmentList.length) {
return return
} }
pageData.search.pageNo++ pageData.search.pageNo++
getEmploymentList() getEmploymentList()
}) }) */
onNavigationBarButtonTap(() => { onNavigationBarButtonTap(() => {
Navigate.to('/pages/linghuoyonggong/components/yonggongmap') Navigate.to('/pages/linghuoyonggong/components/yonggongmap')
...@@ -245,8 +249,8 @@ ...@@ -245,8 +249,8 @@
</script> </script>
<template> <template>
<view class="codefun-flex-col page"> <view class="page">
<view class="codefun-flex-col codefun-self-stretch"> <scroll-view scroll-y="true" style="height: 100%;" class="codefun-flex-col" @scrolltolower="loadMoreData">
<!-- <view class="codefun-mt-14 codefun-flex-row group_2 gap-2"> <!-- <view class="codefun-mt-14 codefun-flex-row group_2 gap-2">
<view <view
v-for="tab in pageData.categoryTabs" v-for="tab in pageData.categoryTabs"
...@@ -362,10 +366,11 @@ ...@@ -362,10 +366,11 @@
</view> </view>
</template> </template>
</template> </template>
</view> </view>
</view> </view>
</view> <view v-if="pageData.hasMore == 'noMore'" class="no-more">没有更多数据了</view>
</scroll-view>
</view> </view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
...@@ -497,7 +502,7 @@ ...@@ -497,7 +502,7 @@
} }
.group_3 { .group_3 {
padding: 0 28rpx; padding: 0 28rpx;
height: 685rpx; // height: 685rpx;
.top-search-view{ .top-search-view{
.uni-searchbar{ .uni-searchbar{
padding: 0rpx !important; padding: 0rpx !important;
...@@ -702,7 +707,13 @@ ...@@ -702,7 +707,13 @@
color: #FFFFFF; color: #FFFFFF;
} }
} }
} }
.no-more{
padding-top: 40rpx;
padding-bottom: 60rpx;
width: 750rpx;
text-align: center;
font-size: 28rpx;
color:#999999;
}
</style> </style>
...@@ -285,6 +285,15 @@ ...@@ -285,6 +285,15 @@
day = day > 9 ? day : '0' + day; day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
} }
// 删除人员
function delPersonData(name){
Message.confirm('你真的要删除【'+name+'】吗?', '温馨提示').then(async (confirm) => {
if(confirm){
pageData.workersParam.splice(pageData.editWorkersIndex, 1);
pageData.isPersonPopupShow = false
}
})
}
// 添加人员 // 添加人员
function addPersonData(){ function addPersonData(){
tempWorkersParam.gender = parseInt(tempWorkersParam.genderZh); tempWorkersParam.gender = parseInt(tempWorkersParam.genderZh);
...@@ -762,8 +771,8 @@ ...@@ -762,8 +771,8 @@
<view class="fui-custom__wrap yr_person_popup"> <view class="fui-custom__wrap yr_person_popup">
<view class="popup_top"> <view class="popup_top">
<uni-icons type="left" size="24" color="#333333" @click="pageData.isPersonPopupShow = false"></uni-icons> <uni-icons type="left" size="24" color="#333333" @click="pageData.isPersonPopupShow = false"></uni-icons>
<view class="add_person_text">添加人员</view> <view class="add_person_text">{{pageData.actionType == 'edit'?'编辑':'添加'}}人员</view>
<view class="del_person_btn" v-if="pageData.actionType == 'edit'" @click="pageData.isPersonPopupShow = false">删除</view> <view class="del_person_btn" v-if="pageData.actionType == 'edit'" @click="delPersonData(tempWorkersParam.name)">删除</view>
<view class="del_person_btn" v-else></view> <view class="del_person_btn" v-else></view>
</view> </view>
<view class="popup_content"> <view class="popup_content">
......
...@@ -300,6 +300,8 @@ function getServiceItems() { ...@@ -300,6 +300,8 @@ function getServiceItems() {
const { records } = res const { records } = res
pageData.serviceItems = [] pageData.serviceItems = []
pageData.serviceItems = records pageData.serviceItems = records
console.log("recordsrecordsrecordsrecords");
console.log(records);
}) })
} }
function getWarningInfo() { function getWarningInfo() {
......
<!-- src/pages/zhunongjinrong/zhunongjinrong.vue --> <!-- src/pages/zhunongjinrong/zhunongjinrong.vue -->
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue';
import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user'
onShow(() => {
const { id, realname, phone } = userStore.getUserInfo;
consultRecord.id = id;
consultRecord.mobile = phone;
consultRecord.feedbackRemark = realname;
})
// 定义银行类型 // 定义银行类型
type BankKey = 'nongye' | 'youzheng' | 'nongshang' type BankKey = 'nongye' | 'youzheng' | 'nongshang'
...@@ -158,9 +167,35 @@ ...@@ -158,9 +167,35 @@
currentBank.value = bank currentBank.value = bank
} }
const userStore = useUserStore();
const consultRecord = reactive({
id: "",
mobile: '',// 咨询人号码
consultTime:"" ,// 咨询时间
bizType:4, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:1324324324, // 意向企业
feedbackRemark:"" // 反馈备注
})
const pageData = reactive({
showLogoutDialog: false,
})
// 立即申请 // 立即申请
function onApplyClick() { function onApplyClick() {
Message.alert('申请功能暂不可用,敬请期待~', '温馨提示') consultRecord.consultTime = getCurrentDateTime();
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
if(res.success){
pageData.showLogoutDialog = true;
}else{
Message.alert(res.message, '温馨提示');
}
}).catch(error => {
Message.alert(error.message, '温馨提示');
});
}
// 提交申请
function handleConfirmLogout(){
pageData.showLogoutDialog = false;
} }
</script> </script>
...@@ -326,6 +361,13 @@ ...@@ -326,6 +361,13 @@
<text class="font_2 text_20">立即申请</text> <text class="font_2 text_20">立即申请</text>
</view> </view>
</view> </view>
<successfulDialog
v-model:show="pageData.showLogoutDialog"
title="申请成功"
content="平台已收到申请,将尽快与您取得联系!"
confirmText="我知道了"
@confirm="handleConfirmLogout"
/>
</view> </view>
</template> </template>
......
...@@ -49,3 +49,25 @@ export function getCalculateAge(birthDate: Date | string): number { ...@@ -49,3 +49,25 @@ export function getCalculateAge(birthDate: Date | string): number {
} }
return age; return age;
} }
/**
* 获取当前时间,格式为 yyyy-MM-dd HH:mm:ss
* @returns 当前日期字符串,格式为 yyyy-MM-dd HH:mm:ss
*/
export function getCurrentDateTime(): string {
const now = new Date()
const year = now.getFullYear()
// 获取月份,注意getMonth返回0-11,需要+1
const month = String(now.getMonth() + 1).padStart(2, '0')
// 获取日期,确保两位数格式
const day = String(now.getDate()).padStart(2, '0');
const hour = String(now.getHours()).padStart(2, '0');
const minute = String(now.getMinutes()).padStart(2, '0');
const second = String(now.getSeconds()).padStart(2, '0');
// 返回格式化后的日期字符串
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}
\ No newline at end of file
...@@ -7,6 +7,7 @@ export {} ...@@ -7,6 +7,7 @@ export {}
/* prettier-ignore */ /* prettier-ignore */
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
'副本': typeof import('./../src/components/ConfirmDialog/index - 副本.vue')['default']
AffixFilter: typeof import('./../src/components/Map/Widgets/AffixFilter/src/AffixFilter.vue')['default'] AffixFilter: typeof import('./../src/components/Map/Widgets/AffixFilter/src/AffixFilter.vue')['default']
BottomBar: typeof import('./../src/components/Map/Widgets/BottomBar/src/BottomBar.vue')['default'] BottomBar: typeof import('./../src/components/Map/Widgets/BottomBar/src/BottomBar.vue')['default']
CacheImage: typeof import('./../src/components/CacheImage/index.vue')['default'] CacheImage: typeof import('./../src/components/CacheImage/index.vue')['default']
...@@ -153,6 +154,7 @@ declare module 'vue' { ...@@ -153,6 +154,7 @@ declare module 'vue' {
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
Src: typeof import('./../src/components/Echarts/src/index.vue')['default'] Src: typeof import('./../src/components/Echarts/src/index.vue')['default']
SuccessfulDialog: typeof import('./../src/components/ConfirmDialog/successfulDialog.vue')['default']
Switch: typeof import('./../src/components/Map/Widgets/Switch/src/Switch.vue')['default'] Switch: typeof import('./../src/components/Map/Widgets/Switch/src/Switch.vue')['default']
ThumbnailPreview: typeof import('./../src/components/ThumbnailPreview/index.vue')['default'] ThumbnailPreview: typeof import('./../src/components/ThumbnailPreview/index.vue')['default']
TimeBar: typeof import('./../src/components/Map/Widgets/TimeBar/src/TimeBar.vue')['default'] TimeBar: typeof import('./../src/components/Map/Widgets/TimeBar/src/TimeBar.vue')['default']
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论