shipped.js 3.7 KB
var e = require("../../../utils/network.js");

Page({
    data: {
        ouid: "",
        status: 2,
        orders: [],
        traces: []
    },
    my_order: function() {
        var t = this;
        e.POST({
            url: "User/my_order",
            header: "application/x-www-form-urlencoded",
            params: {
                ouid: t.data.ouid,
                status: t.data.status
            },
            success: function(e) {
                console.log(e), t.setData({
                    orders: e.data.orders
                });
            }
        });
    },
    pay_order: function(t) {
        var o = this, a = t.currentTarget.dataset.id, n = t.currentTarget.dataset.index, r = this.data.orders;
        wx.showModal({
            title: "确认收货",
            content: "确定已经收到货?",
            success: function(t) {
                t.confirm ? e.POST({
                    url: "User/order_finish",
                    header: "application/x-www-form-urlencoded",
                    params: {
                        ouid: o.data.ouid,
                        id: a
                    },
                    success: function(e) {
                        "success" == e.data.state ? (r.splice(n, 1), wx.showToast({
                            title: e.data.msg,
                            icon: "success"
                        }), o.setData({
                            orders: r
                        })) : wx.showToast({
                            title: e.data.msg,
                            icon: "none"
                        });
                    }
                }) : t.cancel && console.log("用户点击取消");
            }
        });
    },
    payment: function() {
        wx.redirectTo({
            url: "../payment/payment"
        });
    },
    delivery: function() {
        wx.redirectTo({
            url: "../delivery/delivery"
        });
    },
    shipped: function() {
        wx.redirectTo({
            url: "../shipped/shipped"
        });
    },
    completed: function() {
        wx.redirectTo({
            url: "../completed/completed"
        });
    },
    pay: function() {
        wx.navigateTo({
            url: "../pay/pay?type=2"
        });
    },
    onLoad: function(e) {
        var t = this;
        wx.getStorage({
            key: "ouid",
            success: function(e) {
                t.setData({
                    ouid: e.data
                }), t.my_order();
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
 onShareAppMessage: function (options) {
  let that = this;
  let ouid;
  // 设置菜单中的转发按钮触发转发事件时的转发内容
  var shareObj = {
   title: '嗒咕商场', // 默认是小程序的名称(可以写slogan等)
   path: '/pages/start/start?share_id=' + wx.getStorageSync('ouid'), // 默认是当前页面,必须是以‘/’开头的完整路径
   imgUrl: '',//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
   success: function (res) {
    // 转发成功之后的回调
    if (res.errMsg == 'shareAppMessage:ok') { }
   },
   fail: function () {
    // 转发失败之后的回调
    if (res.errMsg == 'shareAppMessage:fail cancel') {
     // 用户取消转发
    } else if (res.errMsg == 'shareAppMessage:fail') {
     // 转发失败,其中 detail message 为详细失败信息
    }
   },
   complete: function () {
    // 转发结束之后的回调(转发成不成功都会执行)
   }
  }
  return shareObj;
 },
});