| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | var app = getApp();var util = require('../../utils/util.js');var api = require('../../config/api.js');Page({  data: {    orderIds: [],    actualPrice: 0.00,    isMergePay: ''  },  onLoad: function (options) {    // 页面初始化 options为页面跳转所带来的参数    this.setData({      orderIds: options.orderIds,      actualPrice: options.actualPrice,      isMergePay: options.isMergePay    })    console.log(this.data.orderIds);  },  onReady: function () {  },  onShow: function () {    // 页面显示  },  onHide: function () {    // 页面隐藏  },  onUnload: function () {    // 页面关闭  },  //向服务请求支付参数  requestPayParam() {    let that = this;    // 测试领取优惠券    // wx.redirectTo({    //   url: '/pages/payResult/payResult?status=1&orderId=' + that.data.orderId,    // })    // todo    util.request(api.PayPrepayId, {      orderIds: that.data.orderIds, payType: 1,      isMergePay: that.data.isMergePay      }).then(function (res) {      if (res.errno === 0) {        let payParam = res.data;        wx.requestPayment({          'timeStamp': payParam.timeStamp,          'nonceStr': payParam.nonceStr,          'package': payParam.package,          'signType': payParam.signType,          'paySign': payParam.paySign,          'success': function (res) {            wx.redirectTo({              url: '/pages/payResult/payResult?status=1&orderIds=' + that.data.orderIds,            })          },          'fail': function (res) {            wx.redirectTo({              url: '/pages/payResult/payResult?status=0&orderIds=' + that.data.orderIds,            })          }        })      }else {        // util.showErrorToast(res.errmsg)        wx.showModal({          title: '',          content: res.errmsg,          showCancel: false        });      }    });  },  startPay() {    this.requestPayParam();  }})
 |