From 2a500686266b8fc6dae991c799800e37083a45c2 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 05 九月 2025 14:03:24 +0800 Subject: [PATCH] 客户拜访真机测试,bug修改 --- src/pages/cooperativeOffice/clientVisit/index.vue | 237 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 196 insertions(+), 41 deletions(-) diff --git a/src/pages/cooperativeOffice/clientVisit/index.vue b/src/pages/cooperativeOffice/clientVisit/index.vue index 6e22066..6ff2467 100644 --- a/src/pages/cooperativeOffice/clientVisit/index.vue +++ b/src/pages/cooperativeOffice/clientVisit/index.vue @@ -1,59 +1,214 @@ -// 瀹㈡埛鎷滆 <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="file-text" size="16" color="#ffffff"></up-icon> + </view> + <text class="item-id">瀹㈡埛锛歿{ item.customerName }}</text> + </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)" + > + 鏌ョ湅璇︽儏 + </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 } 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 getList = () => { + showLoadingToast('鍔犺浇涓�...') + const params = { + current: -1, + size: -1, + customerName: customerName.value, } + 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 = (item) => { + uni.setStorageSync('clientVisit', item) + // 鏌ョ湅璇︽儏璺宠浆鍒板彧璇诲睍绀洪〉闈� + uni.navigateTo({ + url: '/pages/cooperativeOffice/clientVisit/view' + }) +} + +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