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.json | 7 + src/api/cooperativeOffice/clientVisit.js | 25 ----- src/pages/cooperativeOffice/clientVisit/view.vue | 178 +++++++++++++++++++++++++++++++++++ src/pages/cooperativeOffice/clientVisit/detail.vue | 11 +- src/pages/cooperativeOffice/clientVisit/index.vue | 75 +------------- 5 files changed, 198 insertions(+), 98 deletions(-) diff --git a/src/api/cooperativeOffice/clientVisit.js b/src/api/cooperativeOffice/clientVisit.js index 35790e0..64ba2a6 100644 --- a/src/api/cooperativeOffice/clientVisit.js +++ b/src/api/cooperativeOffice/clientVisit.js @@ -17,29 +17,4 @@ method: 'get', params: query }) -} - -// 鑾峰彇鎷滆璁板綍璇︽儏 -export function getVisitDetail(id) { - return request({ - url: `/cooperative/clientVisit/detail/${id}`, - method: 'get' - }) -} - -// 鏇存柊鎷滆璁板綍 -export function updateVisitRecord(data) { - return request({ - url: '/cooperative/clientVisit/update', - method: 'put', - data: data - }) -} - -// 鍒犻櫎鎷滆璁板綍 -export function deleteVisitRecord(id) { - return request({ - url: `/cooperative/clientVisit/delete/${id}`, - method: 'delete' - }) } \ No newline at end of file diff --git a/src/pages.json b/src/pages.json index b698f07..fb03449 100644 --- a/src/pages.json +++ b/src/pages.json @@ -282,6 +282,13 @@ } }, { + "path": "pages/cooperativeOffice/clientVisit/view", + "style": { + "navigationBarTitleText": "瀹㈡埛鎷滆璇︽儏", + "navigationStyle": "custom" + } + }, + { "path": "pages/cooperativeOffice/clientVisit/detail", "style": { "navigationBarTitleText": "娣诲姞瀹㈡埛鎷滆", diff --git a/src/pages/cooperativeOffice/clientVisit/detail.vue b/src/pages/cooperativeOffice/clientVisit/detail.vue index 2e4e416..9c0460e 100644 --- a/src/pages/cooperativeOffice/clientVisit/detail.vue +++ b/src/pages/cooperativeOffice/clientVisit/detail.vue @@ -37,7 +37,6 @@ <u-input v-model="form.purposeDate" placeholder="璇烽�夋嫨鎷滆鏃堕棿" - readonly @click="showTimePicker" /> <template #right> @@ -101,12 +100,10 @@ } import { ref, onMounted } from 'vue' -import { onShow } from '@dcloudio/uni-app' import PageHeader from '@/components/PageHeader.vue' import { clientVisitSignIn } from '@/api/cooperativeOffice/clientVisit' import useUserStore from "@/store/modules/user" import dayjs from "dayjs" -import { formatDateToYMD } from '@/utils/ruoyi' const userStore = useUserStore() @@ -135,6 +132,8 @@ // 杩斿洖涓婁竴椤� const goBack = () => { + // 杩斿洖鏃舵竻闄ゆ湰鍦板瓨鍌ㄧ殑ID + uni.removeStorageSync('clientVisit') uni.navigateBack() } @@ -146,7 +145,7 @@ // 纭鏃堕棿閫夋嫨 const onTimeConfirm = (e) => { console.log(e) - form.value.purposeDate = e.value + form.value.purposeDate = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss') currentTime.value = e.value showTime.value = false; } @@ -240,13 +239,14 @@ Object.keys(source).forEach((k) => { submitData[k] = source[k] }) + console.log('submitData', submitData) const { code } = await clientVisitSignIn(submitData) if (code === 200) { showToast('绛惧埌鎴愬姛') setTimeout(() => { - uni.navigateBack() + goBack() }, 500) } else { loading.value = false @@ -254,7 +254,6 @@ } } catch (e) { loading.value = false - showToast('绛惧埌澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�') console.error('绛惧埌澶辫触:', e) } } diff --git a/src/pages/cooperativeOffice/clientVisit/index.vue b/src/pages/cooperativeOffice/clientVisit/index.vue index 5b731d4..6ff2467 100644 --- a/src/pages/cooperativeOffice/clientVisit/index.vue +++ b/src/pages/cooperativeOffice/clientVisit/index.vue @@ -28,35 +28,9 @@ <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> @@ -98,18 +72,9 @@ 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> @@ -131,7 +96,7 @@ 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'}) @@ -157,19 +122,13 @@ 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) => { @@ -203,29 +162,11 @@ } // 鏌ョ湅璇︽儏 -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' }) } diff --git a/src/pages/cooperativeOffice/clientVisit/view.vue b/src/pages/cooperativeOffice/clientVisit/view.vue new file mode 100644 index 0000000..f56ddb2 --- /dev/null +++ b/src/pages/cooperativeOffice/clientVisit/view.vue @@ -0,0 +1,178 @@ +<template> + <view class="client-visit-detail"> + <PageHeader title="瀹㈡埛鎷滆璇︽儏" @back="goBack" /> + + <!-- 鍐呭瀹瑰櫒 --> + <view class="content-container"> + <!-- 瀹㈡埛淇℃伅 --> + <view class="section"> + <view class="section-title">瀹㈡埛淇℃伅</view> + <view class="info-item"> + <text class="info-label">瀹㈡埛鍚嶇О</text> + <text class="info-value">{{ form.customerName || '-' }}</text> + </view> + <view class="info-item"> + <text class="info-label">鑱旂郴浜�</text> + <text class="info-value">{{ form.contact || '-' }}</text> + </view> + <view class="info-item"> + <text class="info-label">鑱旂郴鐢佃瘽</text> + <text class="info-value">{{ form.contactPhone || '-' }}</text> + </view> + </view> + + <!-- 鎷滆淇℃伅 --> + <view class="section"> + <view class="section-title">鎷滆淇℃伅</view> + <view class="info-item"> + <text class="info-label">鎷滆鐩殑</text> + <text class="info-value">{{ form.purposeVisit || '-' }}</text> + </view> + <view class="info-item"> + <text class="info-label">鎷滆鏃堕棿</text> + <text class="info-value">{{ form.purposeDate || '-' }}</text> + </view> + <view class="info-item"> + <text class="info-label">鎷滆鍦扮偣</text> + <text class="info-value multi-line">{{ form.visitAddress || '-' }}</text> + </view> + <view class="info-item"> + <text class="info-label">鎷滆浜�</text> + <text class="info-value">{{ form.visitingPeople || '-' }}</text> + </view> + <view class="info-item" v-if="form.latitude && form.longitude"> + <text class="info-label">缁忕含搴�</text> + <text class="info-value">{{ form.latitude }}, {{ form.longitude }}</text> + </view> + </view> + + <!-- 澶囨敞淇℃伅 --> + <view class="section"> + <view class="section-title">澶囨敞淇℃伅</view> + <view class="info-item remark-item"> + <text class="info-label">澶囨敞</text> + <text class="info-value multi-line">{{ form.remark }}</text> + </view> + </view> + </view> + </view> +</template> + +<script setup> +// 鏇挎崲 toast 鏂规硶 +const showToast = (message) => { + uni.showToast({ + title: message, + icon: 'none' + }) +} + +import { ref, onMounted } from 'vue' +import PageHeader from '@/components/PageHeader.vue' +import useUserStore from "@/store/modules/user" + +const userStore = useUserStore() + +// 琛ㄥ崟鏁版嵁 +const form = ref({ + customerName: '', + contact: '', + contactPhone: '', + visitingPeople: '', + purposeVisit: '', + purposeDate: '', + visitAddress: '', + latitude: '', + longitude: '', + locationAddress: '', + remark: '' +}) + +// 杩斿洖涓婁竴椤� +const goBack = () => { + // 杩斿洖鏃舵竻闄ゆ湰鍦板瓨鍌ㄧ殑ID + uni.removeStorageSync('clientVisit') + uni.navigateBack() +} + +// 鍒濆鍖栭〉闈㈡暟鎹� +const initPageData = () => { + // 浠庢湰鍦板瓨鍌ㄨ幏鍙栨嫓璁胯褰曡鎯� + const row = uni.getStorageSync('clientVisit') + if (row) { + form.value = { ...row } + } else { + showToast('鏆傛棤鎷滆璁板綍鏁版嵁') + } +} + +onMounted(() => { + initPageData() +}) +</script> + +<style scoped lang="scss"> +@import '@/static/scss/form-common.scss'; + +.client-visit-detail { + min-height: 100vh; + background-color: #f8f9fa; +} + +.content-container { + padding: 16px; +} + +.section { + background-color: #ffffff; + border-radius: 12px; + margin-bottom: 16px; + overflow: hidden; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); +} + +.section-title { + font-size: 16px; + font-weight: 600; + color: #333333; + padding: 16px 16px 12px; + border-bottom: 1px solid #f0f0f0; +} + +.info-item { + display: flex; + padding: 14px 16px; + border-bottom: 1px solid #f8f8f8; + align-items: flex-start; +} + +.info-item:last-child { + border-bottom: none; +} + +.info-label { + font-size: 14px; + color: #666666; + min-width: 80px; + flex-shrink: 0; + line-height: 22px; +} + +.info-value { + font-size: 14px; + color: #333333; + flex: 1; + line-height: 22px; + text-align: right; +} + +.multi-line { + text-align: left; + word-break: break-all; + line-height: 1.6; +} + +.remark-item { + padding-bottom: 16px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3