Commit 6abe64d7 by chenwq

优化编辑申请页面,调整标题和提交按钮文本逻辑

1 parent 0a6cc528
......@@ -32,10 +32,21 @@ Page({
console.log(constantList);
wx.p.router.getRouterParams(options).then((params) => {
console.log("路由参数:", params);
const optType = params.optType || "add";
const titleMap = {
edit: "编辑申请",
republish: "重新发拍",
add: "新增申请",
};
this.setData({
["formData.id"]: params.id || null, // 编辑时会有id,新增时为null
title: params.optType == "edit" ? "编辑申请" : "新增申请",
optType: params.optType || "add",
title: titleMap[optType] || "新增申请",
optType,
}, () => {
wx.setNavigationBarTitle({
title: this.data.title,
});
});
if (params.optType != "add") {
this.getDetail();
......@@ -109,7 +120,12 @@ Page({
listName: "interiorColorList",
},
];
const inputAttrList = ["displacement", "mileage", "transferCount", "reservePrice"];
const inputAttrList = [
"displacement",
"mileage",
"transferCount",
"reservePrice",
];
selectAttrList.forEach((attr) => {
if (formData[attr.name]) {
formData[`${attr.name}Name`] = constantList[attr.listName].find(
......@@ -165,6 +181,25 @@ Page({
handlePrevStep() {
if (this.data.currentStep > 1) {
if (this.data.currentStep === 2) {
const secondStepComp = this.selectComponent("#SecondStep");
if (secondStepComp) {
const errorObj = secondStepComp.validate();
if (errorObj) return;
}
} else if (this.data.currentStep === 3) {
const thirdStepComp = this.selectComponent("#ThirdStep");
if (thirdStepComp) {
const errorObj = thirdStepComp.validate();
if (errorObj) return;
}
} else if (this.data.currentStep === 4) {
const fourthStepComp = this.selectComponent("#FourthStep");
if (fourthStepComp) {
const errorObj = fourthStepComp.validate();
if (errorObj) return;
}
}
this.saveOrderData("prev");
}
},
......@@ -287,7 +322,7 @@ Page({
case "submit":
wx.showToast({ title: "操作成功", icon: "success" });
// 提交发拍成功埋点
if (wx.$Track && wx.$Track.reportEvent) {
wx.$Track.reportEvent("tijiao_chenggong");
......
......@@ -70,7 +70,7 @@
<view wx:if="{{currentStep < 4}}" class="action-btn btn-next active" bindtap="handleNextStep">下一步</view>
<view wx:if="{{currentStep === 4}}" class="action-btn btn-submit active" bindtap="handleSubmitOrder">提交发拍</view>
<view wx:if="{{currentStep === 4}}" class="action-btn btn-submit active" bindtap="handleSubmitOrder">{{optType === 'republish' ? '确认重新发拍' : '提交发拍'}}</view>
</view>
</view>
</view>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!