var app = getApp();

Page({
  data: {
    language: '',
  },
  onLoad: function(options) {
    console.log("ressss::::", 111);
    var that = this;
    var _url = "";
    if (options.mid) {
      console.log("ressss::::", 2222);
      _url = app.getNetAddresss("order.another-pay-detail");
      _url += '&pid=' + options.pid;
      _url += '&mid=' + options.mid;
    } else {
      _url = app.getNetAddresss("order.detail");
    }
    _url += "&order_id=" + options.order_id;
    app._getNetWork({
      url: _url,
      success: function(res) {
        console.log(res);
        var price = 0;
        var _data = res.data.data;
        if (res.data.result == 1) {
          console.log(res.data.data);
          //找人代付
          if (_data instanceof Array) {
            for (var i in _data) {
              for (var j in _data[i].has_many_order_goods) {
                price += parseFloat(_data[i].has_many_order_goods[j].price);
              }
            }
            price = price.toFixed(2);
          } else {
            price = _data.price;
          }

          that.setData({
            price: price
          });
        } else {
          console.log("错误", res);
          wx.showToast({
            title: '系统错误',
            icon: 'success',
            duration: 3000
          });
        }
      },
      fail: function(res) {}
    });
  },
  goto1: function() {
    wx.reLaunch({
      url: '/packageG/member_v2/member_v2'
    });
  },
  goto2: function() {
    wx.reLaunch({
      url: '/packageG/index/index'
    });
  },
  onReady: function() {
    let language = wx.getStorageSync('langIndex');
    this.setData({ 'language': language.en});
    // 页面渲染完成
  },
  onShow: function() {
    // 页面显示
  },
  onHide: function() {
    // 页面隐藏
  },
  onUnload: function() {
    // 页面关闭
  }
});
