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.
291 lines
7.2 KiB
291 lines
7.2 KiB
//index.js
|
|
//获取应用实例
|
|
const app = getApp()
|
|
|
|
Page({
|
|
data: {
|
|
currentTap: 0,
|
|
'iscart': false,
|
|
'goodsDate': '2018-11-11',
|
|
'totalCount': 0,
|
|
'totalPrice': 0,
|
|
'address': '湖南师范大学理学院',
|
|
'consignee': "杨盼成",
|
|
'phone': '12345678912',
|
|
'unpaidList': [], //待付款
|
|
'dueinList': [], //待收货
|
|
'deliverList': [], //待发货
|
|
'checkList': [],
|
|
|
|
// 'unpaidLists': [ //待付款
|
|
// {
|
|
// 'cover': '../index/image/suanfa.jpg',
|
|
// 'isbn': '9787535482051',
|
|
// 'desc': '计算机算法设计',
|
|
// 'price': 20,
|
|
// 'count': 2
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/jichu.jpg',
|
|
// 'isbn': '9787540455958',
|
|
// 'desc': '计算机基础',
|
|
// 'price': 30,
|
|
// 'count': 1
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/rjgcdl.jpg',
|
|
// 'isbn': '9787539982830',
|
|
// 'desc': '软件工程导论',
|
|
// 'price': 25,
|
|
// 'count': 5
|
|
// }
|
|
// ],
|
|
// 'deliverLists': [ //待发货
|
|
// {
|
|
// 'cover': '../index/image/suanfa.jpg',
|
|
// 'isbn': '9787535482051',
|
|
// 'desc': '计算机算法设计',
|
|
// 'count': 2
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/jichu.jpg',
|
|
// 'isbn': '9787540455958',
|
|
// 'desc': '计算机基础',
|
|
// 'count': 1
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/rjgcdl.jpg',
|
|
// 'isbn': '9787539982830',
|
|
// 'desc': '软件工程导论',
|
|
// 'count': 5
|
|
// }
|
|
// ],
|
|
// 'dueinLists': [ //待收货
|
|
// {
|
|
// 'cover': '../index/image/suanfa.jpg',
|
|
// 'isbn': '9787535482051',
|
|
// 'desc': '计算机算法设计',
|
|
// 'count': 2
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/jichu.jpg',
|
|
// 'isbn': '9787540455958',
|
|
// 'desc': '计算机基础',
|
|
// 'count': 1
|
|
// },
|
|
// {
|
|
// 'cover': '../index/image/rjgcdl.jpg',
|
|
// 'isbn': '9787539982830',
|
|
// 'desc': '软件工程导论',
|
|
// 'count': 5
|
|
// }
|
|
// ],
|
|
},
|
|
|
|
onLoad: function(options) {
|
|
var that = this
|
|
//获取待付款订单信息
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=1",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
console.log(res.data)
|
|
if (res.statusCode == 200) {
|
|
that.setData({
|
|
unpaidList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
|
|
//获取待收货订单信息
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=3",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
console.log(res.data)
|
|
that.setData({
|
|
dueinList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
|
|
//获取待发货信息
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=2",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
console.log(res.data)
|
|
that.setData({
|
|
deliverList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
|
|
that.setData({
|
|
currentTap: options.typeId,
|
|
// unpaidList: that.data.checkList
|
|
})
|
|
// var unpaidList = that.data.unpaidList;
|
|
// var totalCount = 0;
|
|
// var totalPrice = 0;
|
|
// for (var i = 0; i < that.data.unpaidList.length; i++) {
|
|
// var book = that.data.unpaidList[i];
|
|
// totalCount += book.Count*1;
|
|
// totalPrice += book.Count * book.Price;
|
|
// }
|
|
// totalPrice = totalPrice.toFixed(2);
|
|
// that.setData({
|
|
// 'totalCount': totalCount,
|
|
// 'totalPrice': totalPrice
|
|
// })
|
|
},
|
|
|
|
// deleteList: function(e) {
|
|
// var that = this
|
|
// var index= e.currentTarget.dataset.index
|
|
// this.setData({
|
|
// 'unpaidList': null
|
|
// });
|
|
|
|
// //删除订单
|
|
// wx.request({
|
|
// url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&OderId="+that.unpaidList[i].OrderID,
|
|
// header: {
|
|
// "content-type": "json"
|
|
// },
|
|
// success: function (res) {
|
|
// if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
// that.setData({
|
|
// checkList: res.data
|
|
// })
|
|
// //wx.hideNavigationBarLoading()
|
|
// }
|
|
// }
|
|
// })
|
|
|
|
// },
|
|
|
|
order_status: function(e) {
|
|
var that = this
|
|
var current = e.currentTarget.dataset.current
|
|
console.log("current=")
|
|
console.log(current)
|
|
if (current == 0) {
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=1",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
that.setData({
|
|
unpaidList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
} else if (current == 1) {
|
|
//获取待收货订单信息
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=3",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
that.setData({
|
|
dueinList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
} else if (current == 2) {
|
|
//获取待发货信息
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=2",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
that.setData({
|
|
deliverList: res.data
|
|
})
|
|
console.log(that.data.deliverList)
|
|
wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
this.setData({
|
|
currentTap: current
|
|
})
|
|
},
|
|
|
|
toPay: function(e) {
|
|
var that = this
|
|
var id = e.currentTarget.dataset.id
|
|
|
|
wx.showToast({
|
|
title: '付款成功!',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/ModifyStatus.do?OrderID=" + id + "&status=2",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function(res) {
|
|
if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
// that.setData({
|
|
// deliverList: res.data
|
|
// })
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
|
|
wx.request({
|
|
url: "https://hunjianghu.xuanjis.com/web/CheckOrders.do?UserID=1&status=1",
|
|
header: {
|
|
"content-type": "json"
|
|
},
|
|
success: function (res) {
|
|
if (res.statusCode == 200) {
|
|
// console.log(res.data)
|
|
that.setData({
|
|
unpaidList: res.data
|
|
})
|
|
//wx.hideNavigationBarLoading()
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
|
|
}) |