Commit f0dc0e8b by liimin

fix(ReturnAddressBox): 修正快递单号输入限制并优化代码

将快递单号输入的最大长度从50改为20,符合实际业务需求
移除快递单号输入时的特殊字符过滤,允许用户自由输入
清理代码中的console.log和优化对象合并方式
1 parent 17652223
......@@ -34,11 +34,8 @@ Component({
},
onSubmitLogistics() {
const {
express,
orderInfo,
} = this.data;
console.log("🚀 ~ onSubmitLogistics ~ orderInfo:", orderInfo)
const { express, orderInfo } = this.data;
console.log("🚀 ~ onSubmitLogistics ~ orderInfo:", orderInfo);
if (!express.expressCode) {
wx.p.wxApi.showToast("请选择物流公司");
return;
......@@ -49,7 +46,7 @@ Component({
}
const params = {
tparReturnOrderCode: orderInfo.tparReturnOrderCode,
...express
...express,
};
wx.p.wxApi.showLoading("提交中");
wx.p.api.shopmallApi
......@@ -57,7 +54,8 @@ Component({
.then((res) => {
if (res) {
wx.p.wxApi.showToast("提交成功");
if (orderInfo.goodsSource === GoodsSource.YZH) { //云中鹤不允许再修改
if (orderInfo.goodsSource === GoodsSource.YZH) {
//云中鹤不允许再修改
const update = Object.assign({}, orderInfo, express);
this.setData({
orderInfo: update,
......@@ -72,9 +70,9 @@ Component({
onExpressNoInput(e) {
const value = e.detail.value;
// 只保留数字、英文字母、下划线和连字符
const filteredValue = value.replace(/[^a-zA-Z0-9_-]/g, "");
// const filteredValue = value.replace(/[^a-zA-Z0-9_-]/g, "");
this.setData({
"express.expressNo": filteredValue,
"express.expressNo": value,
});
},
onSelectExpress(e) {
......
......@@ -26,7 +26,7 @@
<view class="item">
<view class="label">快递单号:</view>
<view class="value">
<input type="text" value="{{express.expressNo}}" maxlength="50" placeholder="请输入" placeholder-style="color: #999999;" bindinput="onExpressNoInput" />
<input type="text" value="{{express.expressNo}}" maxlength="20" placeholder="请输入" placeholder-style="color: #999999;" bindinput="onExpressNoInput" />
</view>
</view>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!