| | |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="document-icon"> |
| | | <up-icon name="user" size="16" color="#ffffff"></up-icon> |
| | | <up-icon name="file-text" size="16" color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-id">客户:{{ item.customerName }}</text> |
| | | </view> |
| | | <view class="visit-status"> |
| | | <!-- 替换标签和按钮 --> |
| | | <template> |
| | | <u-tag type="success">已完成</u-tag> |
| | | |
| | | <!-- 操作按钮 --> |
| | | <view class="action-buttons"> |
| | | <u-button |
| | | type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | @click="openDetail(item)" |
| | | > |
| | | 查看详情 |
| | | </u-button> |
| | | <u-button |
| | | type="warning" |
| | | size="small" |
| | | class="action-btn" |
| | | @click="editVisit(item)" |
| | | > |
| | | 编辑 |
| | | </u-button> |
| | | </view> |
| | | </template> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | |
| | | type="primary" |
| | | size="small" |
| | | class="action-btn" |
| | | @click="viewDetail(item.id)" |
| | | @click="viewDetail(item)" |
| | | > |
| | | 查看详情 |
| | | </u-button> |
| | | <u-button |
| | | type="error" |
| | | size="small" |
| | | plain |
| | | class="action-btn" |
| | | @click="deleteRecord(item.id)" |
| | | > |
| | | 删除 |
| | | </u-button> |
| | | </view> |
| | | </view> |
| | |
| | | import { ref, onMounted } from 'vue' |
| | | import { onShow } from '@dcloudio/uni-app' |
| | | import PageHeader from '@/components/PageHeader.vue' |
| | | import { getVisitRecords, deleteVisitRecord } from '@/api/cooperativeOffice/clientVisit' |
| | | import { getVisitRecords } from '@/api/cooperativeOffice/clientVisit' |
| | | import useUserStore from "@/store/modules/user" |
| | | // 替换 toast 方法 |
| | | defineOptions({name: 'client-visit-index'}) |
| | |
| | | uni.navigateBack() |
| | | } |
| | | |
| | | // 格式化日期时间 |
| | | const formatDateTime = (dateStr) => { |
| | | if (!dateStr) return '' |
| | | return dayjs(dateStr).format("YYYY-MM-DD HH:mm") |
| | | } |
| | | |
| | | // 查询列表 |
| | | const getList = () => { |
| | | showLoadingToast('加载中...') |
| | | const params = { |
| | | current: -1, |
| | | size: -1, |
| | | customerName: customerName.value || undefined, |
| | | customerName: customerName.value, |
| | | } |
| | | getVisitRecords(params) |
| | | .then((res) => { |
| | |
| | | } |
| | | |
| | | // 查看详情 |
| | | const viewDetail = (id) => { |
| | | if (!id) return |
| | | const viewDetail = (item) => { |
| | | uni.setStorageSync('clientVisit', item) |
| | | // 查看详情跳转到只读展示页面 |
| | | uni.navigateTo({ |
| | | url: `/pages/cooperativeOffice/clientVisit/detail?id=${id}` |
| | | }) |
| | | } |
| | | |
| | | // 删除记录 |
| | | const deleteRecord = async (id) => { |
| | | if (!id) return |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '此操作将永久删除该拜访记录, 是否继续?', |
| | | success: async (res) => { |
| | | if (!res.confirm) return |
| | | try { |
| | | await deleteVisitRecord(id) |
| | | showToast('删除成功') |
| | | getList() |
| | | } catch (e) { |
| | | showToast('删除失败') |
| | | } |
| | | } |
| | | url: '/pages/cooperativeOffice/clientVisit/view' |
| | | }) |
| | | } |
| | | |