You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
3.3 KiB
176 lines
3.3 KiB
// pages/order-detail/order-detail.js
|
|
|
|
var http = require('../../utils/http.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orderItemDtos: [],
|
|
remarks: "",
|
|
actualTotal: 0,
|
|
userAddrDto: null,
|
|
orderNumber: "",
|
|
createTime: "",
|
|
status: 0,
|
|
productTotalAmount: '',
|
|
transfee: '',
|
|
reduceAmount: '',
|
|
shopId: '',
|
|
prodid: ''
|
|
},
|
|
|
|
//跳转商品详情页
|
|
toProdPage: function(e) {
|
|
var prodid = e.currentTarget.dataset.prodid;
|
|
wx.navigateTo({
|
|
url: '/pages/prod/prod?prodid=' + prodid,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 加入购物车
|
|
*/
|
|
addToCart: function(event) {
|
|
let index = event.currentTarget.dataset.index
|
|
// if (!this.orderItemDtos) {
|
|
// console.log(1213)
|
|
// return;
|
|
// }
|
|
var ths = this;
|
|
wx.showLoading({
|
|
mask: true
|
|
});
|
|
var params = {
|
|
url: "/p/shopCart/changeItem",
|
|
method: "POST",
|
|
data: {
|
|
basketId: 0,
|
|
count: this.data.orderItemDtos[index].prodCount,
|
|
prodId: this.data.orderItemDtos[index].prodId,
|
|
shopId: this.data.shopId,
|
|
skuId: this.data.orderItemDtos[index].skuId
|
|
},
|
|
callBack: function(res) {
|
|
//console.log(res);
|
|
wx.hideLoading();
|
|
wx.showToast({
|
|
title: "加入购物车成功",
|
|
icon: "none"
|
|
})
|
|
wx.switchTab({
|
|
url: '/pages/basket/basket',
|
|
})
|
|
}
|
|
};
|
|
http.request(params);
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
this.loadOrderDetail(options.orderNum);
|
|
},
|
|
|
|
/**
|
|
* 加载订单数据
|
|
*/
|
|
loadOrderDetail: function(orderNum) {
|
|
var ths = this;
|
|
wx.showLoading();
|
|
//加载订单详情
|
|
var params = {
|
|
url: "/p/myOrder/orderDetail",
|
|
method: "GET",
|
|
data: {
|
|
orderNumber: orderNum
|
|
},
|
|
callBack: function(res) {
|
|
ths.setData({
|
|
orderNumber: orderNum,
|
|
actualTotal: res.actualTotal,
|
|
userAddrDto: res.userAddrDto,
|
|
remarks: res.remarks,
|
|
orderItemDtos: res.orderItemDtos,
|
|
createTime: res.createTime,
|
|
status: res.status,
|
|
productTotalAmount: res.orderItemDtos[0].productTotalAmount,
|
|
transfee: res.transfee,
|
|
reduceAmount: res.reduceAmount,
|
|
actualTotal: res.actualTotal,
|
|
shopId: res.shopId
|
|
});
|
|
wx.hideLoading();
|
|
}
|
|
};
|
|
http.request(params);
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
|
|
|
|
// 一键复制事件
|
|
copyBtn: function(e) {
|
|
var ths = this;
|
|
wx.setClipboardData({
|
|
//准备复制的数据
|
|
data: ths.data.orderNumber,
|
|
success: function(res) {
|
|
wx.showToast({
|
|
title: '复制成功',
|
|
});
|
|
}
|
|
})
|
|
},
|
|
}) |