var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');

Page({
    data: {
        shippingNo: '',
        shippingCode: '',
        orderId: '',
        logistics: [],
        goodsType:''
    },
    onLoad: function (options) {
        // 页面初始化 options为页面跳转所带来的参数
        console.log(options.id);
        console.log(options.goodsType);
        this.setData({
            shippingNo: options.id,
            shippingCode: options.code,
            orderId: options.orderId,
            goodsType: options.goodsType
        });
    },
    onShow: function () {
        var that = this;
        //TODO: 获取物流信息
        util.request(api.GetLogistics, {
            shippingNo: that.data.shippingNo,
            shippingCode: that.data.shippingCode,
            orderId: that.data.orderId
        }).then(function (res) {
            if (res.errno === 0) {
              console.log(res.data.wuliu);
                that.setData({
                  logistics: res.data.wuliu
                });
            }
        });
    }
})
