收藏
回答

小程序发布后IOS页面渲染数据显示异常?

页面是填写订单信息的页面,填写信息使用了<van-cell><van-field>组件,昨天一位IOS用户在使用流量且信号比较弱的情况下进入页面发现电话已经被赋值(如图);提交订单后发现数据(this.data.type变为服务类型)被赋成初值(正常是成功调用之后才赋为初值,如代码所示),价格也变为0(价格在onLoad()中根据服务类型判断),调用支付接口失败;在选择就诊人后页面显示的数据也出现过不更新的情况(在前面所述情况没出现),导致无法提交订单

wx.cloud.callFunction({
                    name: 'payService',
                    data: {
                      orderNum: num,
                      type: that.data.type,
                      price: that.data.price * 100// 单位为分
                    },
                    success: res => {
                      const type = that.data.type
                      const hos = that.data.hos
                      that.setData({
                        type: "服务类型",
                        phone: '',
                        content: '',
                        person: '请选择就诊人',
                        hos: '请选择要就诊的医院'
                      })
                      app.globalData.hosChoice = '请选择要就诊的医院'
                      const payment = res.result.payment
                      wx.requestPayment({
                        ...payment,
                        success(res) {
                          wx.cloud.callFunction({
                            name: 'sendMessage',
                            data: {
                              type: type,
                              num: num,
                              orderTime: that.data.currentDate,
                              price: that.data.price + '元',
                              hos: hos,
     
                            }
                          }).then(e => {
                            util.hideLoading()
                            wx.showToast({
                                title: '支付成功',
                                icon: "success",
                                duration: 2000,
                                mask: true
                              }),
                              wx.redirectTo({
                                url: '/pages/serving/serving?order=' + num,
                              })
                          })
                        },
                        fail(err) {
                          wx.showToast({
                            title: '您已取消支付',
                            icon: "error",
                            duration: 2000,
                            mask: true
                          })
                          wx.cloud.callFunction({
                            name: 'updateOrder',
                            data: {
                              outTradeNo: num,
                              timeStamp: payment.timeStamp,
                              nonceStr: payment.nonceStr,
                              package: payment.package,
                              signType: payment.signType,
                              paySign: payment.paySign,
                              appId: payment.appId
                            }
                          }).then(e => {
                            wx.redirectTo({
                              url: '/pages/paypage/paypage?order=' + num,
                            })
                          })
                        }
                      })
                    },
                    //fail: console.error,
                  })

回答关注问题邀请回答
收藏

1 个回答

  • 张老师
    张老师
    发表于小程序端
    2023-12-23

    看看其他用户(如安卓)在相同的环境下(如弱网)是否也会出现这样的情况呢?如果也会出现的话,看看正常网络环境下是否正常,如果正常,则可能需要做弱网优化了。

    2023-12-23
    有用 2
    回复 2
    • 张老师
      张老师
      发表于小程序端
      2023-12-23

      如果只是iOS出现这种情况,安卓正常,可能就需要做针对iOS的适配了。

      2023-12-23
      1
      回复
    • Wong
      Wong
      发表于移动端
      2023-12-23
      好的好的 谢谢老师!
      2023-12-23
      1
      回复
登录 后发表内容