|
|
|
@ -17,79 +17,76 @@ Page({
|
|
|
|
|
'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
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
// '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
|
|
|
|
|
if (options.checkLists != null) {
|
|
|
|
|
that.data.ccheckList = JSON.parse(options.checkLists);
|
|
|
|
|
//console.log(checkList[0].BookName)
|
|
|
|
|
} else {
|
|
|
|
|
//获取待付款订单信息
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
|
|
|
|
|
url: "http://45.76.158.31:8080/web/CheckOrders.do?UserID=1&status=1",
|
|
|
|
|
header: {
|
|
|
|
|
"content-type": "json"
|
|
|
|
|
},
|
|
|
|
@ -97,14 +94,14 @@ Page({
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
that.setData({
|
|
|
|
|
checkList :res.data
|
|
|
|
|
unpaidList :res.data
|
|
|
|
|
})
|
|
|
|
|
//wx.hideNavigationBarLoading()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取待收货订单信息
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
|
|
|
|
|
header: {
|
|
|
|
@ -121,6 +118,7 @@ Page({
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//获取待发货信息
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
|
|
|
|
|
header: {
|
|
|
|
@ -137,37 +135,121 @@ Page({
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.l; i++) {
|
|
|
|
|
var book = that.data.unpaidList[i];
|
|
|
|
|
totalCount += book.Count;
|
|
|
|
|
totalPrice += book.Count * book.Price;
|
|
|
|
|
}
|
|
|
|
|
totalPrice = totalPrice.toFixed(2);
|
|
|
|
|
that.setData({
|
|
|
|
|
'totalCount': totalCount,
|
|
|
|
|
'totalPrice': totalPrice
|
|
|
|
|
// 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: "http://45.76.158.31:8080/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
|
|
|
|
|
|
|
|
|
|
if(current==1){
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/CheckOrders.do?UserID=1&status=1",
|
|
|
|
|
header: {
|
|
|
|
|
"content-type": "json"
|
|
|
|
|
},
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
that.setData({
|
|
|
|
|
checkList: res.data
|
|
|
|
|
})
|
|
|
|
|
//wx.hideNavigationBarLoading()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else if(current==2){
|
|
|
|
|
//获取待收货订单信息
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
|
|
|
|
|
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==3){
|
|
|
|
|
//获取待发货信息
|
|
|
|
|
wx.request({
|
|
|
|
|
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
|
|
|
|
|
header: {
|
|
|
|
|
"content-type": "json"
|
|
|
|
|
},
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
that.setData({
|
|
|
|
|
deliverList: res.data
|
|
|
|
|
})
|
|
|
|
|
//wx.hideNavigationBarLoading()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
currentTap: current
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
toPay: function () {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '付款成功!',
|
|
|
|
|
icon: 'success',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
this.deleteList()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|