Commit 6abe64d7 by chenwq

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

1 parent 0a6cc528
...@@ -32,10 +32,21 @@ Page({ ...@@ -32,10 +32,21 @@ Page({
console.log(constantList); console.log(constantList);
wx.p.router.getRouterParams(options).then((params) => { wx.p.router.getRouterParams(options).then((params) => {
console.log("路由参数:", params); console.log("路由参数:", params);
const optType = params.optType || "add";
const titleMap = {
edit: "编辑申请",
republish: "重新发拍",
add: "新增申请",
};
this.setData({ this.setData({
["formData.id"]: params.id || null, // 编辑时会有id,新增时为null ["formData.id"]: params.id || null, // 编辑时会有id,新增时为null
title: params.optType == "edit" ? "编辑申请" : "新增申请", title: titleMap[optType] || "新增申请",
optType: params.optType || "add", optType,
}, () => {
wx.setNavigationBarTitle({
title: this.data.title,
});
}); });
if (params.optType != "add") { if (params.optType != "add") {
this.getDetail(); this.getDetail();
...@@ -109,7 +120,12 @@ Page({ ...@@ -109,7 +120,12 @@ Page({
listName: "interiorColorList", listName: "interiorColorList",
}, },
]; ];
const inputAttrList = ["displacement", "mileage", "transferCount", "reservePrice"]; const inputAttrList = [
"displacement",
"mileage",
"transferCount",
"reservePrice",
];
selectAttrList.forEach((attr) => { selectAttrList.forEach((attr) => {
if (formData[attr.name]) { if (formData[attr.name]) {
formData[`${attr.name}Name`] = constantList[attr.listName].find( formData[`${attr.name}Name`] = constantList[attr.listName].find(
...@@ -165,6 +181,25 @@ Page({ ...@@ -165,6 +181,25 @@ Page({
handlePrevStep() { handlePrevStep() {
if (this.data.currentStep > 1) { 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"); this.saveOrderData("prev");
} }
}, },
......
...@@ -70,7 +70,7 @@ ...@@ -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-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> </view>
</view> </view>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!