1***@qq.com
1***@qq.com
  • 发布:2022-06-08 13:52
  • 更新:2022-06-08 19:07
  • 阅读:252

【报Bug】接口返回fail导致整个程序崩溃。

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: w11

HBuilderX类型: 正式

HBuilderX版本号: 3.4.14

第三方开发者工具版本号: 1.05

基础库版本号: 2.23.4

项目创建方式: HBuilderX

示例代码:

submitOrder2() {
let vm = this;
this.saleOrderParams.productIds = [];
this.saleOrderParams.specs = [];
this.saleOrderParams.textures = [];
this.saleOrderParams.colors = [];
this.saleOrderParams.directions = [];
this.saleOrderParams.markPrices = [];
this.saleOrderParams.sellPrices = [];
this.saleOrderParams.sellCounts = [];
this.saleOrderParams.pcss = [];
this.saleOrderParams.userIds = [];
this.saleOrderParams.dess = [];
this.saleOrderParams.sendTimes = [];
this.saleOrderParams.specialeds = [];
this.saleOrderParams.notes = [];

  if (this.fromProductList.length == 0) {  
    uni.showToast({  
      title: "请选择产品",  
      icon: "none",  
      mask: true,  
    });  
    return;  
  }  
  if (this.fromDealer.dealerName == "") {  
    uni.showToast({  
      title: "请选择客户",  
      icon: "none",  
      mask: true,  
    });  
    return;  
  }  
  if (this.saleOrderParams.settleMoney > this.totalPrice) {  
    uni.showToast({  
      title: "定金不能大于订单总售价",  
      icon: "none",  
      mask: true,  
    });  
    return;  
  }  
  if (this.saleOrderParams.settleMoney) {  
    if (!this.typeName) {  
      uni.showToast({  
        title: "有定金请选择结款方式",  
        icon: "none",  
        mask: true,  
      });  
      return;  
    }  
  }  
  //合并提交参数  

  for (const val of this.fromProductList) {  
    this.saleOrderParams.productIds.push(val.productId);  
    this.saleOrderParams.specs.push(val.spec);  
    this.saleOrderParams.textures.push(val.texture);  
    this.saleOrderParams.colors.push(val.color);  
    this.saleOrderParams.directions.push(val.direction);  
    this.saleOrderParams.markPrices.push(val.markPrice);  
    this.saleOrderParams.sellPrices.push(val.sellPrice);  
    this.saleOrderParams.sellCounts.push(val.sellCount);  
    this.saleOrderParams.pcss.push(val.pcs);  
    this.saleOrderParams.sendTimes.push(val.sendTime);  
    this.saleOrderParams.dess.push(val.description);  
    this.saleOrderParams.notes.push(val.note);  
    this.saleOrderParams.specialeds.push(val.config.specialed);  
  }  
  this.saleOrderParams["saleOrder.province"] = this.fromDealer.province;  
  this.saleOrderParams["saleOrder.discountPrice"] =  
    this.saleOrderParams.discountPrice;  
  this.saleOrderParams["saleOrder.city"] = this.fromDealer.city;  
  this.saleOrderParams["saleOrder.county"] = this.fromDealer.county;  
  this.saleOrderParams["saleOrder.buyerName"] = this.fromDealer.buyerName;  
  this.saleOrderParams["saleOrder.buyerPhone"] = this.fromDealer.buyerPhone;  
  this.saleOrderParams["saleOrder.address"] = this.fromDealer.address;  

  this.saleOrderParams["saleOrder.consignee"] = this.fromDealer.consignee;  
  this.saleOrderParams["saleOrder.consigneePhone"] =  
    this.fromDealer.consigneePhone;  
  this.saleOrderParams["saleOrder.consigneeAddr"] =  
    this.fromDealer.consigneeAddr;  

  this.saleOrderParams["saleOrder.bookSettleType"] =  
    this.saleOrderParams.payType;  
  this.saleOrderParams["saleOrder.logisticsName"] =  
    this.fromDealer.logisticsName;  
  this.saleOrderParams["saleOrder.logisticsPhone"] =  
    this.fromDealer.logisticsPhone;  
  this.saleOrderParams["saleOrder.logisticsAddr"] =  
    this.fromDealer.logisticsAddr;  
  this.saleOrderParams["saleOrder.description"] =  
    this.saleOrderParams.description;  
  this.saleOrderParams["saleOrder.dealer.dealerId"] =  
    this.fromDealer.dealerId;  
  this.saleOrderParams["saleOrder.orderId"] = this.orderId;  
  this.saleOrderParams["version"] = this.version;  
  let params = qs.stringify(this.saleOrderParams, {  
    arrayFormat: "repeat",  
  });  
  vm.$postGet({  
    url: "sgl/saleOrder_edit.html",  
    data: params,  
    success: function (res) {  
      if (res.info == "success") {  
        uni.showToast({  
          title: res.msg,  
          mask: true,  
        });  

        uni.redirectTo({  
          url:  
            "/pages/saleOrder/saleOrder_info/saleOrder_info" +  
            `?orderId=${res.saleOrder.orderId}`,  
        });  
        // vm.fromProductList = [];  
        // vm.fromDealer = {};  
        uni.$emit("refreshs");  
      }  
    },  
  });  
},

操作步骤:

点击修改,接口返回info=="fail",然后点击页面的任何按钮都会报错。

预期结果:

再次点击应该不报错,能够继续执行。

实际结果:

点击报错后,点任何东西都不能再次点击。

bug描述:

接口返回info=="fail",然后点击页面的任何按钮都会报错。

2022-06-08 13:52 负责人:无 分享
已邀请:
小枫叶

小枫叶 - 外包接单加v:wlmk1234567 注明来意

报了 fail 以后你有做处理么 可能是连锁反应,你注释一部分看一下 如果无法解决 你把你能复现demo发一下看看

该问题目前已经被锁定, 无法添加新回复