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

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