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.
116 lines
2.5 KiB
116 lines
2.5 KiB
6 years ago
|
//index.js
|
||
|
//获取应用实例
|
||
|
const app = getApp()
|
||
|
|
||
|
Page({
|
||
|
data: {
|
||
|
currentTap: 0,
|
||
|
'iscart': false,
|
||
|
'goodsDate': '2018-11-11',
|
||
|
'totalCount': 0,
|
||
|
'totalPrice': 0,
|
||
|
'address':'湖南师范大学理学院',
|
||
|
'consignee': "杨盼成",
|
||
|
'phone': '12345678912',
|
||
|
'unpaidList': [//待付款
|
||
|
{
|
||
|
'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
|
||
|
}
|
||
|
],
|
||
|
'deliverList':[//待发货
|
||
|
{
|
||
|
'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
|
||
|
}
|
||
|
],
|
||
|
'dueinList': [//待收货
|
||
|
{
|
||
|
'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 () {
|
||
|
var unpaidList = this.data.unpaidList;
|
||
|
var totalCount = 0;
|
||
|
var totalPrice = 0;
|
||
|
for (var i = 0; i < unpaidList.length; i++) {
|
||
|
var good = unpaidList[i];
|
||
|
totalCount += good.count;
|
||
|
totalPrice += good.count * good.price;
|
||
|
}
|
||
|
totalPrice = totalPrice.toFixed(2);
|
||
|
this.setData({
|
||
|
'totalCount': totalCount,
|
||
|
'totalPrice': totalPrice
|
||
|
})
|
||
|
},
|
||
|
|
||
|
onLoad: function (options){
|
||
|
var that = this
|
||
|
this.setData({
|
||
|
currentTap: options.typeId
|
||
|
})
|
||
|
},
|
||
|
|
||
|
deleteList: function (e) {
|
||
|
this.setData({
|
||
|
'unpaidList':null
|
||
|
});
|
||
|
},
|
||
|
|
||
|
order_status: function(e) {
|
||
|
var current = e.currentTarget.dataset.current
|
||
|
this.setData({
|
||
|
currentTap: current
|
||
|
})
|
||
|
},
|
||
|
|
||
|
})
|