Commit 79267a73 by liimin

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

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