From d2f0fae1021cd6bb0e541d259fea81ae47d78617 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 13 十月 2025 14:30:12 +0800
Subject: [PATCH] 打包修改
---
src/pages/cooperativeOffice/clientVisit/detail.vue | 217 +++++++++++++++++++++++++-----------------------------
1 files changed, 101 insertions(+), 116 deletions(-)
diff --git a/src/pages/cooperativeOffice/clientVisit/detail.vue b/src/pages/cooperativeOffice/clientVisit/detail.vue
index e22638a..9c0460e 100644
--- a/src/pages/cooperativeOffice/clientVisit/detail.vue
+++ b/src/pages/cooperativeOffice/clientVisit/detail.vue
@@ -1,122 +1,108 @@
<template>
- <view class="client-visit">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="瀹㈡埛鎷滆鐧昏" @back="goBack" />
+ <view class="client-visit-detail">
+ <PageHeader title="瀹㈡埛鎷滆璇︽儏" @back="goBack" />
- <!-- 绛惧埌琛ㄥ崟 -->
- <van-form @submit="handleSignIn" ref="formRef" label-width="110px" input-align="right" error-message-align="right">
+ <u-form @submit="handleSignIn" ref="formRef" label-width="90">
<!-- 瀹㈡埛淇℃伅 -->
- <van-cell-group title="瀹㈡埛淇℃伅" inset>
- <van-field
- v-model="form.customerName"
- label="瀹㈡埛鍚嶇О"
- placeholder="璇疯緭鍏ュ鎴峰悕绉�"
- required
- name="customerName"
- clearable
- />
- <van-field
- v-model="form.contact"
- label="鑱旂郴浜�"
- placeholder="璇疯緭鍏ヨ仈绯讳汉"
- name="contact"
- clearable
- />
- <van-field
- v-model="form.contactPhone"
- label="鑱旂郴鐢佃瘽"
- placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
- name="contactPhone"
- clearable
- />
- </van-cell-group>
-
+ <u-cell-group title="瀹㈡埛淇℃伅">
+ <u-form-item label="瀹㈡埛鍚嶇О" prop="customerName" required border-bottom>
+ <u-input
+ v-model="form.customerName"
+ placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+ />
+ </u-form-item>
+ <u-form-item label="鑱旂郴浜�" prop="contact" border-bottom>
+ <u-input
+ v-model="form.contact"
+ placeholder="璇疯緭鍏ヨ仈绯讳汉"
+ />
+ </u-form-item>
+ <u-form-item label="鑱旂郴鐢佃瘽" prop="contactPhone" border-bottom>
+ <u-input
+ v-model="form.contactPhone"
+ placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
+ />
+ </u-form-item>
+ </u-cell-group>
+
<!-- 鎷滆淇℃伅 -->
- <van-cell-group title="鎷滆淇℃伅" inset>
- <van-field
- v-model="form.visitingPeople"
- label="鎷滆浜�"
- placeholder="鎷滆浜�"
- name="visitingPeople"
- readonly
- clearable
- />
- <van-field
- v-model="form.purposeVisit"
- label="鎷滆鐩殑"
- placeholder="璇疯緭鍏ユ嫓璁跨洰鐨�"
- name="purposeVisit"
- required
- clearable
- />
- <van-field
- v-model="form.purposeDate"
- label="鎷滆鏃堕棿"
- placeholder="璇烽�夋嫨鎷滆鏃堕棿"
- name="purposeDate"
- required
- readonly
- @click="showTimePicker"
- clearable
- />
- <van-field
- v-model="form.visitAddress"
- label="褰撳墠浣嶇疆"
- placeholder="鐐瑰嚮鑾峰彇褰撳墠浣嶇疆"
- name="visitAddress"
- :readonly="true"
- :disabled="true"
- type="textarea"
- @click="getCurrentLocation"
- clearable
- >
- <template #right-icon>
- <van-icon name="location-o" @click.stop="getCurrentLocation" class="location-icon" />
- </template>
- </van-field>
- </van-cell-group>
-
+ <u-cell-group title="鎷滆淇℃伅">
+ <u-form-item label="鎷滆鐩殑" prop="purposeVisit" required border-bottom>
+ <u-input
+ v-model="form.purposeVisit"
+ placeholder="璇疯緭鍏ユ嫓璁跨洰鐨�"
+ />
+ </u-form-item>
+ <u-form-item label="鎷滆鏃堕棿" prop="purposeDate" required border-bottom>
+ <u-input
+ v-model="form.purposeDate"
+ placeholder="璇烽�夋嫨鎷滆鏃堕棿"
+ @click="showTimePicker"
+ />
+ <template #right>
+ <up-icon
+ name="arrow-right"
+ @click="showTimePicker"
+ ></up-icon>
+ </template>
+ </u-form-item>
+ <u-form-item label="鎷滆鍦扮偣" prop="visitAddress" required border-bottom>
+ <u-input
+ v-model="form.visitAddress"
+ placeholder="璇疯緭鍏ユ嫓璁垮湴鐐�"
+ >
+ <template #suffix>
+ <u-icon name="map" @click="getCurrentLocation" class="location-icon" />
+ </template>
+ </u-input>
+ </u-form-item>
+ </u-cell-group>
+
<!-- 澶囨敞淇℃伅 -->
- <van-cell-group title="澶囨敞淇℃伅" inset>
- <van-field
- v-model="form.remark"
- label="澶囨敞"
- name="remark"
- type="textarea"
- placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
- rows="3"
- autosize
- clearable
- />
- </van-cell-group>
-
+ <u-cell-group title="澶囨敞淇℃伅">
+ <u-form-item label="澶囨敞" prop="remark" border-bottom>
+ <u-textarea
+ v-model="form.remark"
+ placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
+ :maxlength="200"
+ count
+ :autoHeight="true"
+ />
+ </u-form-item>
+ </u-cell-group>
+
<!-- 鎻愪氦鎸夐挳 -->
<view class="footer-btns">
- <van-button class="cancel-btn" @click="goBack">鍙栨秷</van-button>
- <van-button class="sign-btn" native-type="submit" form-type="submit" :loading="loading">绛惧埌</van-button>
+ <u-button class="cancel-btn" @click="goBack">鍙栨秷</u-button>
+ <u-button class="sign-btn" type="primary" @click="handleSignIn" :loading="loading">绛惧埌</u-button>
</view>
- </van-form>
-
+ </u-form>
+
<!-- 鏃堕棿閫夋嫨鍣� -->
- <van-popup v-model:show="showTime" position="bottom">
- <van-date-picker
- v-model="currentTime"
- type="datetime"
- @confirm="onTimeConfirm"
- @cancel="showTime = false"
- title="閫夋嫨鎷滆鏃堕棿"
- />
- </van-popup>
+ <up-datetime-picker
+ :show="showTime"
+ v-model="currentTime"
+ @confirm="onTimeConfirm"
+ @cancel="showTime = false"
+ mode="datetime"
+ />
</view>
</template>
<script setup>
+// 鏇挎崲 toast 鏂规硶
+defineOptions({name: 'client-visit-detail'})
+const showToast = (message) => {
+ uni.showToast({
+ title: message,
+ icon: 'none'
+ })
+}
+
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 { showToast } from 'vant'
import dayjs from "dayjs"
const userStore = useUserStore()
@@ -141,11 +127,13 @@
const formRef = ref(null)
// 鏃堕棿鐩稿叧
-const currentTime = ref(new Date())
+const currentTime = ref(Date.now())
const showTime = ref(false)
// 杩斿洖涓婁竴椤�
const goBack = () => {
+ // 杩斿洖鏃舵竻闄ゆ湰鍦板瓨鍌ㄧ殑ID
+ uni.removeStorageSync('clientVisit')
uni.navigateBack()
}
@@ -155,10 +143,11 @@
}
// 纭鏃堕棿閫夋嫨
-const onTimeConfirm = ({ selectedValues }) => {
- form.value.purposeDate = selectedValues.join('-')
- currentTime.value = selectedValues.join('-')
- showTime.value = false
+const onTimeConfirm = (e) => {
+ console.log(e)
+ form.value.purposeDate = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
+ currentTime.value = e.value
+ showTime.value = false;
}
// 鑾峰彇褰撳墠浣嶇疆
@@ -222,8 +211,6 @@
// 鎻愪氦绛惧埌
const handleSignIn = async () => {
- console.log('form.value----', form.value);
-
if (!form.value.customerName) {
showToast('璇疯緭鍏ュ鎴峰悕绉�')
return
@@ -252,16 +239,14 @@
Object.keys(source).forEach((k) => {
submitData[k] = source[k]
})
-
- console.log('鎻愪氦鏁版嵁:', submitData)
-
+ console.log('submitData', submitData)
+
const { code } = await clientVisitSignIn(submitData)
- console.log('code----', code);
if (code === 200) {
showToast('绛惧埌鎴愬姛')
setTimeout(() => {
- uni.navigateBack()
+ goBack()
}, 500)
} else {
loading.value = false
@@ -269,7 +254,6 @@
}
} catch (e) {
loading.value = false
- showToast('绛惧埌澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�')
console.error('绛惧埌澶辫触:', e)
}
}
@@ -278,7 +262,7 @@
const initPageData = () => {
// 璁剧疆榛樿鎷滆鏃堕棿涓哄綋鍓嶆椂闂�
form.value.purposeDate = dayjs().format('YYYY-MM-DD HH:mm:ss')
- currentTime.value = new Date()
+ currentTime.value = Date.now()
// 璁剧疆鎷滆浜轰负褰撳墠鐧诲綍鐢ㄦ埛鐨勬樀绉�
form.value.visitingPeople = userStore.nickName || ''
@@ -290,6 +274,7 @@
</script>
<style scoped lang="scss">
+@import '@/static/scss/form-common.scss';
.client-visit {
min-height: 100vh;
background: #f8f9fa;
--
Gitblit v1.9.3