Commit f0dc0e8b by liimin

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

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