Commit 79267a73 by liimin

fix(ui): 修复组件交互和样式问题

- 修改 FinishStep 组件中的关闭事件处理器名称
- 为输入框添加 change 事件监听器以处理输入变化
- 重新布局底部按钮为并排显示并添加间距
- 修复 MessageBox 关闭逻辑并添加专门的关闭回调函数
- 修正对象属性比较操作符的一致性
- 移除未使用的组件实例导入
- 优化 FinishStep 组件中的空行和代码结构
- 调整 MessageBox 组件的关闭按钮事件处理逻辑
- 修复页面组件中的空行格式化问题
- 修正阿里云上传策略中的状态码比较操作符
1 parent dd95686c
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:is-footer="false" :is-footer="false"
position="center" position="center"
:title="step == 1 ? '客户信息完善' : '结果反馈'" :title="step == 1 ? '客户信息完善' : '结果反馈'"
@close="close"> @close="onMessageBoxClose">
<view class="popup-content"> <view class="popup-content">
<!-- 内容区域 --> <!-- 内容区域 -->
<scroll-view class="popup-body" scroll-y> <scroll-view class="popup-body" scroll-y>
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
:placeholder="i.placeholder" :placeholder="i.placeholder"
style="flex: 1;" style="flex: 1;"
:type="i.inputType" /> :type="i.inputType"
@change="onInputChange(i.key)" />
</template> </template>
<template v-else> <template v-else>
<view :key="selectKey" <view :key="selectKey"
...@@ -79,18 +80,25 @@ ...@@ -79,18 +80,25 @@
</template> </template>
</view> </view>
</scroll-view> </scroll-view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="popup-footer"> <view class="popup-footer">
<un-button round="4px" <view class="flex-1" style="margin-right: 12px;">
size="normal" <un-button :block="true"
:text="step == 1 ? '取消' : '上一步'" round="4px"
@click="cancel" /> size="normal"
<un-button round="4px" :text="step == 1 ? '取消' : '上一步'"
size="normal" @click="cancel" />
:text="sceneType == 0 ? (step == 1 ? '下一步' : '完成接待') : '完成接待'" </view>
type="primary" <view class="flex-1">
@click="submit" /> <un-button :block="true"
round="4px"
size="normal"
:text="sceneType == 0 ? (step == 1 ? '下一步' : '完成接待') : '完成接待'"
type="primary"
@click="submit" />
</view>
</view> </view>
</view> </view>
</MessageBox> </MessageBox>
...@@ -110,7 +118,7 @@ ...@@ -110,7 +118,7 @@
</uni-popup-message> </uni-popup-message>
</uni-popup> --> </uni-popup> -->
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
...@@ -283,15 +291,23 @@ const close = (): void => { ...@@ -283,15 +291,23 @@ const close = (): void => {
showPopup.value = false; showPopup.value = false;
errorTip.value = false; errorTip.value = false;
receptionStatus.value = ""; receptionStatus.value = "";
// 同时关闭 MessageBox
if (successRef.value != null) { if (successRef.value != null) {
(successRef.value as ComponentPublicInstance).$callMethod("close"); (successRef.value as ComponentPublicInstance).$callMethod("hide");
} }
}; };
// MessageBox 关闭时的回调
const onMessageBoxClose = (): void => {
// 只清理本地状态,不再调用 MessageBox.close()
errorTip.value = false;
receptionStatus.value = "";
};
// 显示成功提示 // 显示成功提示
const showSuccess = (): void => { const showSuccess = (): void => {
if (successRef.value != null) { if (successRef.value != null) {
successRef.value.$callMethod("open"); (successRef.value as ComponentPublicInstance).$callMethod("open");
} }
}; };
...@@ -336,7 +352,7 @@ function showError(key: string): boolean { ...@@ -336,7 +352,7 @@ function showError(key: string): boolean {
} }
function showSelectPopup(item: FormObjectItem): void { function showSelectPopup(item: FormObjectItem): void {
if (props.customerType == 0 || (item.disabled === true)) return; if (props.customerType == 0 || (item.disabled == true)) return;
const popKey = item.popKey !== null ? item.popKey : ""; const popKey = item.popKey !== null ? item.popKey : "";
const refValue = getRefValue(popKey); const refValue = getRefValue(popKey);
if (refValue != null) { if (refValue != null) {
...@@ -366,7 +382,7 @@ function check(all: boolean = false): boolean { ...@@ -366,7 +382,7 @@ function check(all: boolean = false): boolean {
icon: "none" icon: "none"
}); });
flag = false; flag = false;
} }
} }
} }
...@@ -385,7 +401,7 @@ const showSuccessMessage = (): void => { ...@@ -385,7 +401,7 @@ const showSuccessMessage = (): void => {
const submit = (): void => { const submit = (): void => {
if (step.value == 1) { if (step.value == 1) {
errorTip.value = true; errorTip.value = true;
if (check()) { if (check()) {
const sceneType = props.sceneType; const sceneType = props.sceneType;
if (sceneType == 0) { if (sceneType == 0) {
...@@ -419,7 +435,7 @@ const onInputChange = (key: string): void => { ...@@ -419,7 +435,7 @@ const onInputChange = (key: string): void => {
const handleSelect = (item: IUTSObject, popkey: string): void => { const handleSelect = (item: IUTSObject, popkey: string): void => {
const value = formData.value as UTSJSONObject; const value = formData.value as UTSJSONObject;
const itemObj = item as UTSJSONObject; const itemObj = item as UTSJSONObject;
if (popkey === "employeeBoxVisible") { if (popkey === "employeeBoxVisible") {
value.salesUuid = itemObj.uuid as string; value.salesUuid = itemObj.uuid as string;
value.staffName = itemObj.staffName as string; value.staffName = itemObj.staffName as string;
...@@ -434,7 +450,7 @@ const handleSelect = (item: IUTSObject, popkey: string): void => { ...@@ -434,7 +450,7 @@ const handleSelect = (item: IUTSObject, popkey: string): void => {
value.carModel = itemObj.name as string; value.carModel = itemObj.name as string;
value.carModelId = itemObj.id as number; value.carModelId = itemObj.id as number;
} }
formData.value = value; formData.value = value;
selectKey.value = Date.now(); selectKey.value = Date.now();
}; };
...@@ -442,10 +458,9 @@ const handleSelect = (item: IUTSObject, popkey: string): void => { ...@@ -442,10 +458,9 @@ const handleSelect = (item: IUTSObject, popkey: string): void => {
// 打开弹窗 // 打开弹窗
const open = (): void => { const open = (): void => {
isLoading.value = true; isLoading.value = true;
recordService.getBusinessData().then((data: any) => { recordService.getBusinessData().then((data: any) => {
const customerInfo = (data != null ? data as UTSJSONObject : null); const customerInfo = (data != null ? data as UTSJSONObject : null);
if (customerInfo != null) { if (customerInfo != null) {
// 填充表单数据 // 填充表单数据
formData.value = { formData.value = {
...@@ -456,11 +471,11 @@ const open = (): void => { ...@@ -456,11 +471,11 @@ const open = (): void => {
staffName: customerInfo.staffName != null && customerInfo.staffName != "null" ? customerInfo.staffName : "", staffName: customerInfo.staffName != null && customerInfo.staffName != "null" ? customerInfo.staffName : "",
salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "", salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != "null" ? customerInfo.salesUuid : "",
}; };
const _sceneType = props.sceneType; const _sceneType = props.sceneType;
const _customerType = props.customerType; const _customerType = props.customerType;
let stepValue = 1; let stepValue = 1;
// 检查必填字段 // 检查必填字段
const keys = ["customerName", "carModel", "phoneNumber"]; const keys = ["customerName", "carModel", "phoneNumber"];
for (const key of keys) { for (const key of keys) {
...@@ -471,9 +486,9 @@ const open = (): void => { ...@@ -471,9 +486,9 @@ const open = (): void => {
} }
stepValue = 2; stepValue = 2;
} }
errorTip.value = false; errorTip.value = false;
if (_sceneType == 1) { if (_sceneType == 1) {
stepValue = 1; stepValue = 1;
formObject.value = formObject_boutique; formObject.value = formObject_boutique;
...@@ -484,7 +499,7 @@ const open = (): void => { ...@@ -484,7 +499,7 @@ const open = (): void => {
return; return;
} }
} }
if (stepValue == 2) { if (stepValue == 2) {
const checkResult = check(); const checkResult = check();
if (!checkResult) { if (!checkResult) {
...@@ -492,16 +507,16 @@ const open = (): void => { ...@@ -492,16 +507,16 @@ const open = (): void => {
stepValue = 1; stepValue = 1;
} }
} }
step.value = stepValue; step.value = stepValue;
// 打开弹窗 // 打开弹窗
if (successRef.value != null) { if (successRef.value != null) {
(successRef.value as ComponentPublicInstance).$callMethod("open"); (successRef.value as ComponentPublicInstance).$callMethod("open");
} }
updateViewKey.value = Date.now(); updateViewKey.value = Date.now();
} }
isLoading.value = false; isLoading.value = false;
}).catch(() => { }).catch(() => {
isLoading.value = false; isLoading.value = false;
...@@ -516,7 +531,7 @@ const chooseResult = (val: string): void => { ...@@ -516,7 +531,7 @@ const chooseResult = (val: string): void => {
// 暴露方法 // 暴露方法
defineExpose({ open, close }); defineExpose({ open, close });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -532,22 +547,21 @@ defineExpose({ open, close }); ...@@ -532,22 +547,21 @@ defineExpose({ open, close });
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.popup-body { .popup-body {
padding: 0 20px; padding: 0 20px;
max-height: 500px; max-height: 500px;
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
} }
.popup-footer { .popup-footer {
display: flex; display: flex;
padding: 12px 20px; padding: 12px 20px;
border-top: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0;
gap: 10px; gap: 12px;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
justify-content: space-between;
} }
} }
...@@ -561,7 +575,7 @@ defineExpose({ open, close }); ...@@ -561,7 +575,7 @@ defineExpose({ open, close });
padding: 12px 5px 12px; padding: 12px 5px 12px;
/* padding: 12px 40px 12px; */ /* padding: 12px 40px 12px; */
margin-top: 15px; margin-top: 15px;
text { text {
color: #2c66f7; color: #2c66f7;
font-size: 14px; font-size: 14px;
...@@ -574,16 +588,16 @@ defineExpose({ open, close }); ...@@ -574,16 +588,16 @@ defineExpose({ open, close });
margin-top: 15px; margin-top: 15px;
text-align: center; text-align: center;
background-color: rgb(254, 237, 234); background-color: rgb(254, 237, 234);
text { text {
color: #f45c3d; color: #f45c3d;
font-size: 14px; font-size: 14px;
} }
} }
.pop-tips-wrapper { .pop-tips-wrapper {
margin-top: 8px; margin-top: 8px;
.pop-tips { .pop-tips {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -592,7 +606,7 @@ defineExpose({ open, close }); ...@@ -592,7 +606,7 @@ defineExpose({ open, close });
padding: 10px 14px; padding: 10px 14px;
background: rgba(44, 102, 247, 0.08); background: rgba(44, 102, 247, 0.08);
border-radius: 6px; border-radius: 6px;
text { text {
color: #2c66f7; color: #2c66f7;
font-size: 13px; font-size: 13px;
...@@ -611,19 +625,19 @@ defineExpose({ open, close }); ...@@ -611,19 +625,19 @@ defineExpose({ open, close });
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto 12px; margin: 0 auto 12px;
flex-direction: row; flex-direction: row;
.label { .label {
position: relative; position: relative;
flex-shrink: 0; flex-shrink: 0;
width: 80px; width: 80px;
display: flex; display: flex;
align-items: center; align-items: center;
text { text {
color: #6c6c70; color: #6c6c70;
font-size: 15px; font-size: 15px;
} }
.required{ .required{
text { text {
color: #ff0000; color: #ff0000;
...@@ -649,7 +663,7 @@ defineExpose({ open, close }); ...@@ -649,7 +663,7 @@ defineExpose({ open, close });
&.disabled { &.disabled {
background: #f4f4f4; background: #f4f4f4;
} }
.select { .select {
width: 100%; width: 100%;
height: 40px; height: 40px;
...@@ -660,37 +674,37 @@ defineExpose({ open, close }); ...@@ -660,37 +674,37 @@ defineExpose({ open, close });
border: 1px solid #e8e8ea; border: 1px solid #e8e8ea;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
text { text {
font-size: 15px; font-size: 15px;
color: #333333; color: #333333;
} }
&.placeholder { &.placeholder {
text { text {
color: #c9c9c9; color: #c9c9c9;
} }
} }
.arrow { .arrow {
flex-shrink: 0; flex-shrink: 0;
margin-left: auto; margin-left: auto;
} }
} }
.select-content { .select-content {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
height: 100%; height: 100%;
text { text {
flex: 1; flex: 1;
font-size: 15px; font-size: 15px;
color: #333333; color: #333333;
} }
.arrow { .arrow {
flex-shrink: 0; flex-shrink: 0;
margin-left: auto; margin-left: auto;
...@@ -714,7 +728,7 @@ defineExpose({ open, close }); ...@@ -714,7 +728,7 @@ defineExpose({ open, close });
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 12px; margin-top: 12px;
text { text {
/* 选择按钮内的文字样式 */ /* 选择按钮内的文字样式 */
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
:style="popupStyle"> :style="popupStyle">
<view class="tips-content"> <view class="tips-content">
<view class="icon-close-box flex" <view class="icon-close-box flex"
@click="hide"> @click="handleHide">
<uni-icons class="icon-close" <uni-icons class="icon-close"
color="#1A1A1A" color="#1A1A1A"
:size="18" :size="18"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="tips-title"> <view class="tips-title">
<template v-if="back"> <template v-if="back">
<view class="sprite-icon icon-back" <view class="sprite-icon icon-back"
@click="hide"> @click="handleHide">
</view> </view>
</template> </template>
{{ title }} {{ title }}
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ComponentPublicInstance } from "vue";
const props = defineProps({ const props = defineProps({
isAutoClose: { isAutoClose: {
...@@ -110,17 +109,10 @@ const popupStyle = computed(() => { ...@@ -110,17 +109,10 @@ const popupStyle = computed(() => {
maxHeight: props.maxHeight != null && props.maxHeight > 0 ? `${props.maxHeight ?? 0 }px` : "100%" maxHeight: props.maxHeight != null && props.maxHeight > 0 ? `${props.maxHeight ?? 0 }px` : "100%"
}; };
}); });
function onClose(): void {
emit("close");
}
function close(): void { function close(): void {
if (props.isAutoClose) { if (props.isAutoClose) {
visible.value = false; visible.value = false;
} else {
if (popupRef.value != null) {
(popupRef.value as ComponentPublicInstance).$callMethod("close");
}
} }
emit("close"); emit("close");
} }
...@@ -145,6 +137,11 @@ function confirm(): void { ...@@ -145,6 +137,11 @@ function confirm(): void {
emit("confirm"); emit("confirm");
} }
// 处理关闭按钮点击(不触发事件,只隐藏)
function handleHide(): void {
hide();
}
defineExpose({ open, close, hide }); defineExpose({ open, close, hide });
</script> </script>
...@@ -183,7 +180,7 @@ defineExpose({ open, close, hide }); ...@@ -183,7 +180,7 @@ defineExpose({ open, close, hide });
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text { text {
font-weight: 500; font-weight: 500;
font-size: 18px; font-size: 18px;
...@@ -204,7 +201,7 @@ defineExpose({ open, close, hide }); ...@@ -204,7 +201,7 @@ defineExpose({ open, close, hide });
display: block; display: block;
text-align: center; text-align: center;
margin-top: 24px; margin-top: 24px;
text { text {
font-size: 15px; font-size: 15px;
color: #5a5e66; color: #5a5e66;
...@@ -222,7 +219,7 @@ defineExpose({ open, close, hide }); ...@@ -222,7 +219,7 @@ defineExpose({ open, close, hide });
flex-shrink: 0; flex-shrink: 0;
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
flex-direction: row; flex-direction: row;
.close { .close {
text { text {
color: #6c6c70; color: #6c6c70;
...@@ -241,7 +238,7 @@ defineExpose({ open, close, hide }); ...@@ -241,7 +238,7 @@ defineExpose({ open, close, hide });
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text { text {
text-align: center; text-align: center;
font-size: 16px; font-size: 16px;
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
</view> </view>
<!-- <BackPress ref="backpressRef" @openStep="openStep" @backHome="backHome" /> --> <!-- <BackPress ref="backpressRef" @openStep="openStep" @backHome="backHome" /> -->
<FinishStep ref="stepRef" <FinishStep ref="stepRef"
:title-tips="finishTips" :title-tips="finishTips"
@submit="done" /> @submit="done" />
...@@ -219,7 +219,7 @@ const watchStatus = computed(() => { ...@@ -219,7 +219,7 @@ const watchStatus = computed(() => {
return false; return false;
} }
}); });
const isPreview = computed<boolean>(() => { const isPreview = computed<boolean>(() => {
return type.value == "preview"; return type.value == "preview";
}); });
...@@ -246,7 +246,7 @@ const finishTips = computed(() => { ...@@ -246,7 +246,7 @@ const finishTips = computed(() => {
return text; return text;
}); });
function setViewInfo(data: any): void { function setViewInfo(data: any): void {
if (data == null) return; if (data == null) return;
...@@ -281,15 +281,15 @@ function setViewInfo(data: any): void { ...@@ -281,15 +281,15 @@ function setViewInfo(data: any): void {
} else { } else {
dataObj = data as UTSJSONObject; dataObj = data as UTSJSONObject;
} }
// 处理 moduleList 的空值情况 // 处理 moduleList 的空值情况
const moduleListData: Array<any> = dataObj.moduleList != null ? dataObj.moduleList as Array<any> : []; const moduleListData: Array<any> = dataObj.moduleList != null ? dataObj.moduleList as Array<any> : [];
moduleList.value = moduleListData; moduleList.value = moduleListData;
// 处理 toolList 的空值情况 // 处理 toolList 的空值情况
const toolListData: Array<any> = dataObj.toolList != null ? dataObj.toolList as Array<any> : []; const toolListData: Array<any> = dataObj.toolList != null ? dataObj.toolList as Array<any> : [];
pageToolList.value = toolListData; pageToolList.value = toolListData;
useCarConfig.value = true; useCarConfig.value = true;
if (id.value != currentMediaId.value) { if (id.value != currentMediaId.value) {
let jumpItem: UTSJSONObject = {} as UTSJSONObject; let jumpItem: UTSJSONObject = {} as UTSJSONObject;
...@@ -348,7 +348,7 @@ onMounted(() => { ...@@ -348,7 +348,7 @@ onMounted(() => {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
screenWidth.value = systemInfo.screenWidth; screenWidth.value = systemInfo.screenWidth;
}); });
// 查询门店支付配置 // 查询门店支付配置
async function findPayInfo(): Promise<void> { async function findPayInfo(): Promise<void> {
...@@ -396,7 +396,7 @@ onLoad((options) => { ...@@ -396,7 +396,7 @@ onLoad((options) => {
const storageKey = `source_${sceneType.value}_${shopMerchantId.value}`; const storageKey = `source_${sceneType.value}_${shopMerchantId.value}`;
const storageData = uni.getStorageSync(storageKey); const storageData = uni.getStorageSync(storageKey);
let data: null | UTSJSONObject = null; let data: null | UTSJSONObject = null;
if (storageData != null && storageData != "" && storageData != "null") { if (storageData != null && storageData != "" && storageData != "null") {
data = typeof storageData === "string" ? JSON.parse(storageData) as UTSJSONObject : storageData as UTSJSONObject; data = typeof storageData === "string" ? JSON.parse(storageData) as UTSJSONObject : storageData as UTSJSONObject;
} }
...@@ -471,7 +471,7 @@ function choose(e: ToolItem): void { ...@@ -471,7 +471,7 @@ function choose(e: ToolItem): void {
id.value = (itemId ?? "") as string; id.value = (itemId ?? "") as string;
// uni.$logger.local.info(`预览${e.title}`) // uni.$logger.local.info(`预览${e.title}`)
} }
function clearHistory():void{ function clearHistory():void{
dispatch("clearCustomerInfo"); dispatch("clearCustomerInfo");
dispatch("clearHistory"); dispatch("clearHistory");
...@@ -508,7 +508,7 @@ function done(val: string) { ...@@ -508,7 +508,7 @@ function done(val: string) {
// receptionTrackLeave() // receptionTrackLeave()
} }
function toPay(): void { function toPay(): void {
if (payRef.value != null) { if (payRef.value != null) {
(payRef.value as ComponentPublicInstance).$callMethod("show"); (payRef.value as ComponentPublicInstance).$callMethod("show");
...@@ -574,15 +574,15 @@ function touchEnd(e: any) { ...@@ -574,15 +574,15 @@ function touchEnd(e: any) {
} }
} }
function scale(e: number) { function scale(e: number) {
scaleValueObject.value[id.value] = e; scaleValueObject.value[id.value] = e;
} }
onBackPress((options: OnBackPressOptions) => { onBackPress((options: OnBackPressOptions) => {
console.log("返回键触发", options.from); console.log("返回键触发", options.from);
...@@ -601,7 +601,7 @@ onBackPress((options: OnBackPressOptions) => { ...@@ -601,7 +601,7 @@ onBackPress((options: OnBackPressOptions) => {
// 其他情况允许正常返回 // 其他情况允许正常返回
return false; return false;
}); });
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -65,7 +65,7 @@ export class AliUniUploadStrategy extends AliOSSBaseStrategy { ...@@ -65,7 +65,7 @@ export class AliUniUploadStrategy extends AliOSSBaseStrategy {
name: "file", name: "file",
formData: formData as UTSJSONObject, formData: formData as UTSJSONObject,
success: (res) => { success: (res) => {
if (res.statusCode === 200 || res.statusCode === 204) { if (res.statusCode == 200 || res.statusCode == 204) {
logger.info(`[AliUniUploadStrategy] 上传成功: ${objectKey}`, "FileUploadService"); logger.info(`[AliUniUploadStrategy] 上传成功: ${objectKey}`, "FileUploadService");
const url = `${host}/${objectKey}`; const url = `${host}/${objectKey}`;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!