From 952240909a036a341300ec25a2259e6faed33362 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 04 九月 2025 16:09:49 +0800 Subject: [PATCH] 设备保修真机测试,bug修改 --- src/pages/cooperativeOffice/clientVisit/index.vue | 296 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 255 insertions(+), 41 deletions(-) diff --git a/src/pages/cooperativeOffice/clientVisit/index.vue b/src/pages/cooperativeOffice/clientVisit/index.vue index 6e22066..5b731d4 100644 --- a/src/pages/cooperativeOffice/clientVisit/index.vue +++ b/src/pages/cooperativeOffice/clientVisit/index.vue @@ -1,59 +1,273 @@ -// 瀹㈡埛鎷滆 <template> - <view> - <view class="page-header"> - <view class="header-left"> - <up-icon name="arrow-left" size="20" color="#333" @click="goBack"></up-icon> + <view class="sales-accoun"> + <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 --> + <PageHeader title="瀹㈡埛鎷滆" @back="goBack" /> + + <!-- 鎼滅储鍜岀瓫閫夊尯鍩� --> + <view class="search-section"> + <view class="search-bar"> + <view class="search-input"> + <up-input + class="search-text" + placeholder="璇疯緭鍏ュ鎴峰悕绉�" + v-model="customerName" + @blur="getList" + clearable + /> + </view> + <view class="filter-button" @click="getList"> + <u-icon name="search" size="24" color="#999"></u-icon> + </view> </view> - <view class="header-center"> - <text class="page-title">瀹㈡埛鎷滆</text> + </view> + + <!-- 鎷滆璁板綍鍒楄〃 --> + <view class="ledger-list" v-if="visitList.length > 0"> + <view v-for="(item, index) in visitList" :key="index"> + <view class="ledger-item"> + <view class="item-header"> + <view class="item-left"> + <view class="document-icon"> + <up-icon name="user" 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> + + <view class="item-details"> + <view class="detail-row"> + <text class="detail-label">鑱旂郴浜�</text> + <text class="detail-value">{{ item.contact || '-' }}</text> + </view> + <view class="detail-row"> + <text class="detail-label">鑱旂郴鐢佃瘽</text> + <text class="detail-value">{{ item.contactPhone || '-' }}</text> + </view> + <view class="detail-row"> + <text class="detail-label">鎷滆鐩殑</text> + <text class="detail-value">{{ item.purposeVisit || '-' }}</text> + </view> + <view class="detail-row"> + <text class="detail-label">鎷滆鏃堕棿</text> + <text class="detail-value">{{ item.purposeDate }}</text> + </view> + <view class="detail-row"> + <text class="detail-label">鎷滆鍦板潃</text> + <text class="detail-value">{{ item.visitAddress || '-' }}</text> + </view> + <view class="detail-row"> + <text class="detail-label">鎷滆浜�</text> + <text class="detail-value">{{ item.visitingPeople || '-' }}</text> + </view> + <view class="detail-row" v-if="item.remark"> + <text class="detail-label">澶囨敞</text> + <text class="detail-value">{{ item.remark }}</text> + </view> + </view> + + <!-- 鎸夐挳鍖哄煙 --> + <view class="action-buttons"> + <u-button + type="primary" + size="small" + class="action-btn" + @click="viewDetail(item.id)" + > + 鏌ョ湅璇︽儏 + </u-button> + <u-button + type="error" + size="small" + plain + class="action-btn" + @click="deleteRecord(item.id)" + > + 鍒犻櫎 + </u-button> + </view> + </view> </view> + </view> + + <view v-else class="no-data"> + <text>鏆傛棤鎷滆璁板綍</text> + </view> + + <!-- 娴姩鏂板鎸夐挳 --> + <view class="fab-button" @click="addVisit"> + <up-icon name="plus" size="24" color="#ffffff"></up-icon> </view> </view> </template> -<script> -export default { - data() { - return { - title: '瀹㈡埛鎷滆' - } - }, - methods: { - goBack() { - uni.navigateBack({ - delta: 1 - }) - } + +<script setup> +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 useUserStore from "@/store/modules/user" +// 鏇挎崲 toast 鏂规硶 +defineOptions({name: 'client-visit-index'}) +const showToast = (message) => { + uni.showToast({ + title: message, + icon: 'none' + }) +} + +import dayjs from "dayjs" + +const userStore = useUserStore() + +// 鎼滅储鍏抽敭璇� +const customerName = ref('') + +// 鎷滆璁板綍鏁版嵁 +const visitList = ref([]) + +// 杩斿洖涓婁竴椤� +const goBack = () => { + 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, } + getVisitRecords(params) + .then((res) => { + visitList.value = res.records || res.data?.records || [] + closeToast() + }) + .catch(() => { + closeToast() + showToast('鑾峰彇鏁版嵁澶辫触') + }) } + +// 鏄剧ず鍔犺浇鎻愮ず +const showLoadingToast = (message) => { + uni.showLoading({ + title: message, + mask: true + }); +}; + +// 鍏抽棴鎻愮ず +const closeToast = () => { + uni.hideLoading(); +}; + +// 鏂板鎷滆 - 璺宠浆鍒扮櫥璁伴〉闈� +const addVisit = () => { + uni.navigateTo({ + url: '/pages/cooperativeOffice/clientVisit/detail' + }) +} + +// 鏌ョ湅璇︽儏 +const viewDetail = (id) => { + if (!id) return + 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('鍒犻櫎澶辫触') + } + } + }) +} + +onMounted(() => { + getList() +}) + +onShow(() => { + getList() +}) </script> -<style> -.page-header { - display: flex; - align-items: center; - justify-content: space-between; - padding: 10px 20px; - background-color: #f5f5f5; + +<style scoped lang="scss"> +@import "../../../styles/sales-common.scss"; + +// 椤甸潰鐗瑰畾鐨勬牱寮忚鐩� +.sales-accoun { + min-height: 100vh; + background: #f8f9fa; position: relative; + padding-bottom: 80px; } -.header-left { + +// 鐗瑰畾鐨勫浘鏍囨牱寮� +.document-icon { + background: #667eea; // 淇濇寔椤甸潰鐗规湁鐨勮儗鏅壊 +} + +// 鐗规湁鏍峰紡 +.visit-status { display: flex; align-items: center; } -.header-center { - flex: 1; - display: flex; - justify-content: center; - align-items: center; - position: absolute; - left: 0; - right: 0; - pointer-events: none; + +.detail-value { + word-break: break-all; // 淇濈暀椤甸潰鐗规湁鐨勬枃鏈崲琛屾牱寮� } -.page-title { - font-size: 18px; - font-weight: bold; - pointer-events: auto; + +// 鐗瑰畾鐨勬诞鍔ㄦ寜閽牱寮� +.fab-button { + background: #667eea; // 淇濇寔椤甸潰鐗规湁鐨勮儗鏅壊 + box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // 淇濇寔椤甸潰鐗规湁鐨勯槾褰辨晥鏋� } </style> -- Gitblit v1.9.3