收藏
回答

微信小程序被 搜索降权,不太明白问题的原因及如何解决? 求解答!

小程序被搜索降权,问题自己这面无法复现,不知道具体原因是什么,要怎么解决?求大神解答!

source map 文件 源码如下:

"// pages/bills/bills.js
const app = getApp()
import { zouweiApi } from '../../api/api'
import util from '../../utils/util'
Page({


  /**
   * 页面的初始数据
   */
  data: {
    tabList: ['可开票订单', '开票记录'],
    key: 0,
    pageNo: 1,
    pageSize: 10,
    bottom:0,
    hasData: true,
    orderList: [],
    selectedIds: [],
    billActualAmount:0,
    selectedPrice:[],
    qxBJ:false,
    yuModal: false,
    yuModal2: false,
    yuModal3: false,
    //开票信息
    userType:'2',
    invoiceType:'1',
    userInfo: {
      receiveName: '',
      receivePhone: '',
      province: '',
      city: '',
      region: '',
      receiveAddress: '',
      agentName: '',
      taxIdentificationNumber: '',
      companyAddress: '',
      phone: '',
      bank: '',
      bankNo: '',
    },
    region: ['选择省', '选择市', '选择区'],
    //开票记录
    invoiceList:[],
    invoiceOrderList: [],
    expressCode: '',
    expressDeliveryNumber: '',
    phone: '',
    logisticsInfoShow:false
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let userName = wx.getStorageSync('user').name
    let billInfo = wx.getStorageSync('billInfo')
    this.setData({
      userName,
      userInfo: billInfo
    })
    // iphone ten
    if (app.globalData.isIpx) {
      this.setData({
        pd: '64rpx',
        bottom: 60,
      })
    }
    let agentId = options.agentId
    let userId = options.userId
    this.getBillingOrder()
    this.getBillingOrderCount()
  },
  // 获取可开票订单
  getBillingOrder() {
    let orderList = this.data.orderList
    let pageNo = this.data.pageNo
    let pageSize = this.data.pageSize
    zouweiApi.getBillingOrder({ pageNo, pageSize}).then(res => {
      if (res.code == 0) {
        if (res.data && res.data.rows && res.data.rows != null) {
          res.data.rows.forEach(item => {
            item.createTime = util.timestampToTime(item.createTime)
            item.selected = false
          })
          if (pageNo == 1) {
            orderList = []
          }
          this.setData({
            orderList: orderList.concat(res.data.rows)
          })
          this.pagemount(res.data.rows)
        }else {
          if (pageNo == 1) {
            this.setData({
              orderList: []
            })
          }
        }
      }
      wx.stopPullDownRefresh()
    })
  },
  // 获取可开票统计数据
  getBillingOrderCount() {
    zouweiApi.getBillingOrderCount({}).then(res => {
      if (res.code == 0) {
        this.setData({
          billingOrderCount: res.data
        })
      }
    })
  },
  // 获取开票记录
  getInvoiceList() {
    let invoiceList = this.data.invoiceList
    let pageNo = this.data.pageNo
    let pageSize = this.data.pageSize
    zouweiApi.getInvoiceList({ pageNo, pageSize}).then(res => {
      if (res.code == 0) {
        if (res.data && res.data.rows && res.data.rows != null) {
          res.data.rows.forEach(item => {
            item.createTime = util.timestampToTime(item.createTime)
            item.orderIds = JSON.parse(item.orderIds)
          })
          if (pageNo == 1) {
            invoiceList = []
          }
          this.setData({
            invoiceList: invoiceList.concat(res.data.rows)
          })
          this.pagemount(res.data.rows)
        }
      }
      wx.stopPullDownRefresh()
    })
  },


  // 获取开票记录内订单
  getInvoiceOrder(e) {
    let id = e.currentTarget.dataset.id
    let invoiceList = this.data.invoiceList
    zouweiApi.getInvoiceOrder(id).then(res => {
      if (res.code == 0) {
        if (res.data && res.data != null) {
          res.data.forEach(item => {
            item.createTime = util.timestampToTime(item.createTime)
          })
          this.setData({
            invoiceOrderList: res.data
          })
          this.showModal3()
        }
      }
    })
  },
  // 选择订单
  selectOrder: function (e) {
    let qxBJ = this.data.qxBJ
    let orderList = this.data.orderList
    let index = e.currentTarget.dataset.index
    let selectedIds = this.data.selectedIds
    let selectedPrice = this.data.selectedPrice
    orderList[index].selected = !orderList[index].selected
    if (orderList[index].selected) {
      selectedIds.push(orderList[index].id)
      selectedPrice.push(orderList[index].actualAmount)
    }else{
      qxBJ = false
      selectedIds.splice(selectedIds.indexOf(orderList[index].id), 1)
      selectedPrice.splice(selectedPrice.indexOf(orderList[index].actualAmount),1)
    }
    this.setData({
      qxBJ,
      orderList,
      selectedIds,
      selectedPrice
    })
    this.countPrice()
  },
  // 全选
  quanxuan: function(){
    let qxBJ = !this.data.qxBJ
    let orderList = this.data.orderList
    let selectedPrice = []
    let selectedIds = []
    orderList.forEach(item => {
      if (qxBJ){
        item.selected = true
        selectedIds.push(item.id)
        selectedPrice.push(item.actualAmount)
      }else{
        item.selected = false
      }
    })
    this.setData({
      qxBJ,
      orderList,
      selectedIds,
      selectedPrice
    })
    this.countPrice()
  },
  countPrice:function(){
    let selectedPrice = this.data.selectedPrice
    let billActualAmount = 0
    selectedPrice.forEach(item=>{
      billActualAmount += Number(item)
    })
    this.setData({
      billActualAmount
    })
  },
  // 开票类型切换
  userTypeChange(e){
    let type = e.currentTarget.dataset.type
    let invoiceType = this.data.invoiceType
    this.setData({
      userType: type,
      invoiceType: type == '1' ? invoiceType:'1'
    })
    this.hideModal()
    this.showModal2()
  },
  invoiceTypeChange(e) {
    let type = e.currentTarget.dataset.type
    this.setData({
      invoiceType: type
    })
    this.hideModal()
    this.showModal2()
  },
  // 输入框
  userInfoChange(e) {
    let key = e.currentTarget.dataset.key
    let value = e.detail.value
    switch (key) {
      case 'receiveName':
        this.setData({
          'userInfo.receiveName': value
        })
        break
      case 'receivePhone':
        this.setData({
          'userInfo.receivePhone': value
        })
        break
      case 'receiveAddress':
        this.setData({
          'userInfo.receiveAddress': value
        })
        break
      case 'agentName':
        this.setData({
          'userInfo.agentName': value
        })
        break
      case 'taxIdentificationNumber':
        this.setData({
          'userInfo.taxIdentificationNumber': value
        })
        break
      case 'companyAddress':
        this.setData({
          'userInfo.companyAddress': value
        })
        break
      case 'phone':
        this.setData({
          'userInfo.phone': value
        })
        break
      case 'bank':
        this.setData({
          'userInfo.bank': value
        })
        break
      case 'bankNo':
        this.setData({
          'userInfo.bankNo': value
        })
        break
    }
  },
  // 地址切换
  bindRegionChange(e) {
    this.setData({
      region: e.detail.value,
      'userInfo.province': e.detail.value[0],
      'userInfo.city': e.detail.value[1],
      'userInfo.region': e.detail.value[2],
    })
  },
  // 选择微信地址
  chooseAddress() {
    app.globalData.isUpload = true
    wx.getSetting({
      success: res => {
        if (res.authSetting["scope.address"] == true) {
          wx.chooseAddress({
            success: res => {
              let region = []
              region.push(res.provinceName, res.cityName, res.countyName)
              this.setData({
                region,
                'userInfo.province': res.provinceName,
                'userInfo.city': res.cityName,
                'userInfo.region': res.countyName,
                'userInfo.receiveAddress': res.detailInfo,
                'userInfo.receivePhone': res.telNumber,
                'userInfo.receiveName': res.userName
              })
            }
          })
        } else {
          let status = res.authSetting["scope.address"]
          if (typeof (status) == "undefined") {
            wx.chooseAddress({
              success: res => {
                let region = []
                region.push(res.provinceName, res.cityName, res.countyName)
                this.setData({
                  region,
                  'userInfo.province': res.provinceName,
                  'userInfo.city': res.cityName,
                  'userInfo.region': res.countyName,
                  'userInfo.receiveAddress': res.detailInfo,
                  'userInfo.receivePhone': res.telNumber,
                  'userInfo.receiveName': res.userName
                })
              }
            })
          } else {
            wx.showModal({
              title: '地址访问授权',
              content: '地址访问授权未开启,无法完成操作',
              confirmText: '开启授权',
              confirmColor: '#345391',
              cancelText: '仍然拒绝',
              cancelColor: '#999999',
              success: res => {
                if (res.confirm) {
                  wx.openSetting({
                  })
                }
                if (res.cancel) {
                  wx.showModal({
                    title: '操作失败',
                    content: '地址访问授权未开启,操作失败',
                    confirmText: '太遗憾了',
                    confirmColor: '#345391',
                    showCancel: false
                  })
                }
              }
            })
          }
        }
      }
    })
  },
  // 提交
  submit: function () {
    let userType = this.data.userType
    let invoiceType = this.data.invoiceType
    let userInfo = this.data.userInfo
    let selectedIds = this.data.selectedIds
    userInfo.userType = userType
    userInfo.invoiceType = invoiceType
    userInfo.orderIdList = selectedIds
    console.log(userInfo)
    let message = this.checkUnity(userInfo)
    if (message) {
      wx.showToast({
        title: message,
        icon: 'none'
      })
    } else {
      zouweiApi.getInvoiceApply(userInfo).then(res => {
        if (res.code == 0) {
          if(res.data){
            wx.showToast({
              title: '提交成功!',
              icon: 'success',
              mask: true
            })
            wx.setStorageSync('billInfo', userInfo)
            // 发票开具成功提醒
            app.dingyue('cJNZdZKkokdXQyAII9yAWr3mSWA2scgoqka8YRRBTUo')
            setTimeout(() => {
              this.hideModal()
              this.setData({
                key:1,
                selectedIds:[]
              })
              this.getInvoiceList()
              wx.pageScrollTo({
                scrollTop: 0
              })
            }, 1500);
          }else{
            wx.showToast({
              title: '提交失败!',
              icon: 'none',
              mask: true
            })
          }
        }else{
          wx.showToast({
            title: res.msg,
            icon: 'none',
            mask: true
          })
        }
      })
    }
  },
  // 确认开票信息
  submit2: function () {
    let userInfo = this.data.userInfo
    let userType = this.data.userType
    userInfo.userType = userType
    console.log(userInfo)
    let message = this.checkUnity1(userInfo)
    if (message) {
      wx.showToast({
        title: message,
        icon: 'none'
      })
      return;
    }
    this.hideModal2(1)
  },
  // 判断
  checkUnity(submitData) {
    let phoneReg = /^(13[0-9]|14[5-9]|15[0-3,5-9]|16[2,5,6,7]|17[0-8]|18[0-9]|19[1,3,5,8,9])\d{8}$/
    let idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
    let receiveName = (submitData.receiveName).trim()
    if (!receiveName) {
      return '收货姓名不能为空'
    }
    if (!phoneReg.test(submitData.receivePhone)) {
      return '请输入正确收货手机号码'
    }
    if (!submitData.province) {
      return '请选择收货地址'
    }
    if (!submitData.receiveAddress) {
      return '请填写收货详细地址'
    }
    if (submitData.userType == '1'){
      if (!submitData.agentName) {
        return '请填写开票名称'
      }
      if (!submitData.taxIdentificationNumber) {
        return '请填写纳税识别号'
      }
      if (submitData.invoiceType == '2') {
        if (!submitData.companyAddress) {
          return '请填写公司地址'
        }
        if (!submitData.phone) {
          return '请填写公司电话'
        } 
        if (!submitData.bank) {
          return '请填写开户银行'
        }
        if (!submitData.bankNo) {
          return '请填写开户账号'
        }
      }
    }
    if (submitData.userType == '2') {
      if (!submitData.agentName) {
        return '请填写开票姓名'
      }
      if (!phoneReg.test(submitData.phone)) {
        return '开票信息请填写正确手机号码'
      }
    }
  },
  // 判断
  checkUnity1(submitData) {
    let phoneReg = /^(13[0-9]|14[5-9]|15[0-3,5-9]|16[2,5,6,7]|17[0-8]|18[0-9]|19[1,3,5,8,9])\d{8}$/
    let idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
    if (submitData.userType == '1') {
      if (!submitData.agentName) {
        return '请填写开票名称'
      }
      if (!submitData.taxIdentificationNumber) {
        return '请填写纳税识别号'
      }
      if (submitData.invoiceType == '2') {
        if (!submitData.companyAddress) {
          return '请填写公司地址'
        }
        if (!submitData.phone) {
          return '请填写公司电话'
        }
        if (!submitData.bank) {
          return '请填写开户银行'
        }
        if (!submitData.bankNo) {
          return '请填写开户账号'
        }
      }
    }
    if (submitData.userType == '2') {
      if (!submitData.agentName) {
        return '请填写开票姓名'
      }
      if (!phoneReg.test(submitData.phone)) {
        return '请填写正确手机号码'
      }
    }
  },
  tabChange: function (e) {
    let key = e.currentTarget.dataset.key
    this.setData({
      pageNo: 1,
      key: key
    })
    if (key == 1) {
      this.getInvoiceList()
    }
    if (key == 0) {
      this.getBillingOrder()
      this.getBillingOrderCount()
    }


    wx.pageScrollTo({
      scrollTop: 0
    })
  },
  // 查看物流
  toLogistics(e) {
    let expressCode = e.currentTarget.dataset.expresscode
    let expressDeliveryNumber = e.currentTarget.dataset.expressdeliverynumber
    let phone = e.currentTarget.dataset.phone
    console.log(expressCode)
    console.log(expressDeliveryNumber)
    console.log(phone)
    this.setData({
      expressCode,
      expressDeliveryNumber,
      phone,
      logisticsInfoShow: true
    })
  },
  logisticsChange: function (e) {
    console.log(e)
    this.setData({
      logisticsInfo: e.detail
    })
  },
  hideLogistics: function () {
    this.setData({
      logisticsInfoShow: false
    })
  },
  //分页计算 ,是否有下一页
  pagemount: function (list) {
    let pageNo = this.data.pageNo
    let pageSize = this.data.pageSize
    if (list == null) {
      this.setData({
        hasData: false
      })
      return;
    }
    if (list.length < pageSize) {
      this.setData({
        hasData: false
      })
    } else {
      this.setData({
        pageNo: pageNo + 1,
        hasData: true
      })
    }
  },
  onPullDownRefresh() {
    this.setData({
      pageNo: 1
    })
    let key = this.data.key
    if (key == 1) {
      this.getInvoiceList()
    }
    if (key == 0) {
      this.getBillingOrder()
    }
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let hasData = this.data.hasData
    let key = this.data.key
    if (key == 1) {
      if (hasData) {
        this.getInvoiceList()
      }
    }
    if (key == 0) {
      if (hasData) {
        this.getBillingOrder()
      }
    }
  },
  // 显示遮罩层
  showModal: function (e) {
    var that = this;
    let modalInfo = {}
    that.setData({
      yuModal: true,
      modalInfo: modalInfo
    })
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速,ease->动画以低速开始,然后加快,在结束前变慢
    })
    that.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },


  // 隐藏遮罩层
  hideModal: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        yuModal: false
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画,再隐藏模块


  },
  //动画 -- 滑入
  slideIn: function () {
    this.animation.translateY(0).step()
    this.setData({
      animationData: this.animation.export()
    })
  },
  //动画 -- 滑出
  slideDown: function () {
    this.animation.translateY(500).step()
    this.setData({
      animationData: this.animation.export(),
    })
  },
  // 显示遮罩层
  showModal2: function (e) {
    var that = this;
    let modalInfo2 = {}
    that.setData({
      yuModal2: true,
      modalInfo2: modalInfo2
    })
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速,ease->动画以低速开始,然后加快,在结束前变慢
    })
    that.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that.slideIn2();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  // 隐藏遮罩层
  hideModal2: function (close) {
    if (close == '1') this.showModal()
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown2();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        yuModal2: false
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画,再隐藏模块


  },
  //动画 -- 滑入
  slideIn2: function () {
    this.animation.translateY(0).step()
    this.setData({
      animationData2: this.animation.export()
    })
  },
  //动画 -- 滑出
  slideDown2: function () {
    this.animation.translateY(500).step()
    this.setData({
      animationData2: this.animation.export(),
    })
  },
  modalBack:function(){
    this.hideModal2(1)
  },
  // 显示遮罩层
  showModal3: function (e) {
    var that = this;
    let modalInfo3 = {}
    that.setData({
      yuModal3: true,
      modalInfo3: modalInfo3
    })
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速,ease->动画以低速开始,然后加快,在结束前变慢
    })
    that.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that.slideIn3();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  // 隐藏遮罩层
  hideModal3: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown3();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        yuModal3: false
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画,再隐藏模块


  },
  //动画 -- 滑入
  slideIn3: function () {
    this.animation.translateY(0).step()
    this.setData({
      animationData3: this.animation.export()
    })
  },
  //动画 -- 滑出
  slideDown3: function () {
    this.animation.translateY(500).step()
    this.setData({
      animationData3: this.animation.export(),
    })
  },
})"
回答关注问题邀请回答
收藏

2 个回答

  • Cjiang
    Cjiang
    2020-10-19

    你好,根据截图提示进行整改即可恢复。

    2020-10-19
    有用
    回复
  • .
    .
    2020-10-19

    建议重点查看下动画、以及 有没有死循环等。

    2020-10-19
    有用
    回复 5
    • New
      New
      2020-10-19
      这段代码已经有段时间了,而且上版本发布也快一个月了,自己没遇到过这个问题,也没有客户反映过有什么问题,所以还是挺难定位的
      2020-10-19
      回复
    • .
      .
      2020-10-19回复New
      如果有就需要逐一排查了,找个性能差的手机试试 开真机调试,打断点
      2020-10-19
      回复
    • New
      New
      2020-10-19回复.
      嗯嗯  先看看   谢谢啦
      2020-10-19
      回复
    • 黄浙庭👍
      黄浙庭👍
      2020-12-26
      站内信在哪里可以看到。
      2020-12-26
      回复
    • .
      .
      2020-12-26回复黄浙庭👍
      后台管理
      2020-12-26
      回复
登录 后发表内容
问题标签