//ordertotal.js
var util = require('../../utils/util.js')
var request = require('../../utils/https.js')
var uri = 'orderapi/orderlist'
Page({
data: {
navTab: ["全部订单", "待付款", "待收货"],
currentNavtab: 0,
pageNo: 1,
hidden: false,
list: [],
newlist: [],
tips: '' //无数据
},
onLoad: function (options) {
this.setData({
currentNavtab: options.id
})
//刷新数据
this.getData();
},
//切换tab刷新数据
switchTab: function (o) {
var that = this;
var idx = o.currentTarget.dataset.idx;
if (idx !== that.data.currentNavtab) {
that.setData({
currentNavtab: idx,
list: [], //数据源清空
newlist: [],
pageNo: 1
})
//刷新数据
that.getData();
}
},
getData: function () {
var that = this;
var status = "";
var ordertype = that.data.currentNavtab;
if (ordertype == 0) {
status = "";
} else if (ordertype == 1) {
status = "10";
} else if (ordertype == 2) {
status = "30";
}
var pageNo = that.data.pageNo;
var CuserInfo = wx.getStorageSync('CuserInfo');
request.req(uri, {
ordersn: '1',
status: status,
pageNo: pageNo,
}, (err, res) => {
console.log(res.data)
if (res.data.result == 1) {
if (!res.data) { //无数据
that.setData({ tips: "没有数据~" })
} else {
that.setData({
hidden: true,
list: that.data.list.concat(res.data.data),
})
//处理数据
var list = that.data.list;
for (var i = 0; i < list.length; i++) {
var item = list[i] //状态状态
if (item.orderState == 10) { //待支付
that.data.newlist.push({
button: "去支付",
state: "待支付",
orderTotalPrice: item.orderTotalPrice, //总价
goodsImage: item.orderGoodsList[0].goodsImage,//图片地址
goodsName: item.orderGoodsList[0].goodsName, //商品介绍介绍
goodsNum: item.orderGoodsList[0].goodsNum //商品数量
});
} else if (item.orderState == 30) { //待收货
that.data.newlist.push({
button: "确认收货",
state: "待收货",
orderTotalPrice: item.orderTotalPrice, //总价
goodsImage: item.orderGoodsList[0].goodsImage,//图片地址
goodsName: item.orderGoodsList[0].goodsName, //商品介绍介绍
goodsNum: item.orderGoodsList[0].goodsNum //商品数量
});
} else {
that.data.newlist.push({
button: "查看详情",
state: "其他状态",
orderTotalPrice: item.orderTotalPrice, //总价
goodsImage: item.orderGoodsList[0].goodsImage,//图片地址
goodsName: item.orderGoodsList[0].goodsName, //商品介绍介绍
goodsNum: item.orderGoodsList[0].goodsNum //商品数量
});
}
}
console.log(that.data.newlist);
that.setData({
newlist: that.data.newlist
})
}
}
})
},
//点击到相应的页面
orderbutton: function (options) {
var type = options.currentTarget.dataset.button;
console.log(type)
if (type == "去支付") {
} else if (type == "查看详情") {
} else if (type == "确认收货") {
}
},
//下滑加载更多
lower: function () {
console.log("下滑啦");
var that = this;
that.setData({ pageNo: that.data.pageNo + 1 })
that.getData();
},
})
没有合适的资源?快使用搜索试试~ 我知道了~
小程序商城
共184个文件
js:43个
wxml:43个
wxss:40个
3星 · 超过75%的资源 需积分: 35 40 下载量 95 浏览量
2017-01-19
16:23:26
上传
评论 2
收藏 518KB RAR 举报
温馨提示
微信小程序,电商类,包含搜索,商品列表及详情,订单列表等
资源推荐
资源详情
资源评论
收起资源包目录
小程序商城 (184个子文件)
ordertotal.js 4KB
index.js 4KB
login.js 4KB
goodlist.js 3KB
https.js 3KB
mime.js 2KB
voice.js 2KB
background-audio.js 2KB
animation.js 2KB
goodshop.js 2KB
on-accelerometer-change.js 2KB
goodsearch.js 2KB
goodsDetail.js 2KB
file.js 1KB
image.js 1KB
storage.js 1KB
app.js 1KB
canvas.js 1KB
index.js 997B
coupon.js 876B
service.js 853B
get-user-info.js 602B
manager.js 567B
util.js 460B
get-location.js 455B
get-network-type.js 450B
orderConfirm.js 401B
login.js 365B
logs.js 331B
specValue.js 285B
open-location.js 282B
format-location.js 259B
pull-down-refresh.js 254B
get-system-info.js 251B
navigator.js 216B
on-compass-change.js 211B
set-navigation-bar-title.js 171B
navigation-bar-loading.js 171B
request-payment.js 10B
web-socket.js 9B
download-file.js 9B
request.js 9B
upload-file.js 9B
app.json 1KB
pull-down-refresh.json 84B
goodsDetail.json 84B
on-accelerometer-change.json 61B
get-network-type.json 61B
get-system-info.json 61B
navigation-bar-loading.json 58B
set-navigation-bar-title.json 55B
on-compass-change.json 55B
get-user-info.json 55B
get-location.json 49B
canvas.json 49B
download-file.json 49B
request.json 49B
storage.json 49B
open-location.json 49B
navigator.json 49B
upload-file.json 49B
request-payment.json 49B
login.json 49B
background-audio.json 48B
orderConfirm.json 48B
mime.json 48B
web-socket.json 47B
image.json 43B
animation.json 43B
file.json 43B
voice.json 43B
goodsearch.json 43B
ordertotal.json 43B
service.json 43B
manager.json 42B
goodshop.json 42B
coupon.json 40B
specValue.json 37B
login.json 37B
index.json 2B
goodlist.json 2B
logs.json 2B
icon.png 401KB
list_sx.png 18KB
pop_select_top.png 15KB
pop_select_down.png 15KB
pop_select_pray.png 15KB
mime_pressed.png 13KB
mime_nomal.png 13KB
classify_pressed.png 13KB
classify_nomal.png 13KB
shopping_pressed.png 12KB
shopping_nomal.png 12KB
icon_customer_service.png 10KB
icon_already_shipped.png 10KB
icon_no_comment.png 10KB
icon_already_complete.png 10KB
logo.png 6KB
book.png 2KB
searchLogo.png 788B
共 184 条
- 1
- 2
资源评论
- ygy85052017-08-09先感谢一下楼主
- a2713154932017-09-01没个说明,怎么管理
bestlbw
- 粉丝: 36
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功