|
@@ -1,8 +1,6 @@
|
|
// pages/personorder/personorder.js
|
|
// pages/personorder/personorder.js
|
|
const app = getApp()
|
|
const app = getApp()
|
|
import orderApi from '../../api/order'
|
|
import orderApi from '../../api/order'
|
|
-import storeApi from '../../api/store'
|
|
|
|
-import productApi from '../../api/product'
|
|
|
|
Page({
|
|
Page({
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -57,7 +55,8 @@ Page({
|
|
getOrderList: async function (params) {
|
|
getOrderList: async function (params) {
|
|
var pageNo = this.data.pageNo;
|
|
var pageNo = this.data.pageNo;
|
|
var orderList = await orderApi.getAllOrderList(pageNo, 3);
|
|
var orderList = await orderApi.getAllOrderList(pageNo, 3);
|
|
- var list = await this.handelOrderList(orderList.list);
|
|
|
|
|
|
+ var list = orderList.list;
|
|
|
|
+ console.log(list)
|
|
//代消费订单
|
|
//代消费订单
|
|
var writeOffOrderList = [];
|
|
var writeOffOrderList = [];
|
|
//待评价订单
|
|
//待评价订单
|
|
@@ -68,12 +67,21 @@ Page({
|
|
if (item.status == 2 && item.writeOffStatus == 1) {
|
|
if (item.status == 2 && item.writeOffStatus == 1) {
|
|
writeOffOrderList.push(item)
|
|
writeOffOrderList.push(item)
|
|
}
|
|
}
|
|
- if (item.status == 2 && item.writeOffStatus == 2) {
|
|
|
|
|
|
+ if (item.status == 2 && item.writeOffStatus == 2 && item.discussId != '') {
|
|
finishOrderList.push(item)
|
|
finishOrderList.push(item)
|
|
}
|
|
}
|
|
|
|
+ if (item.status == 2 && item.writeOffStatus == 2 && item.discussId == '') {
|
|
|
|
+ commentOffOrderList.push(item)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
var tabs = this.data.tabs;
|
|
var tabs = this.data.tabs;
|
|
tabs[0].list = list;
|
|
tabs[0].list = list;
|
|
|
|
+ tabs[1].list = writeOffOrderList;
|
|
|
|
+ tabs[2].list = commentOffOrderList;
|
|
|
|
+ tabs[3].list = finishOrderList;
|
|
|
|
+ this.setData({
|
|
|
|
+ tabs
|
|
|
|
+ })
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
@@ -83,9 +91,8 @@ Page({
|
|
var pageNo = this.data.pageNo;
|
|
var pageNo = this.data.pageNo;
|
|
// 获取全部订单
|
|
// 获取全部订单
|
|
var orderList = await orderApi.getAllOrderList(pageNo, 4);
|
|
var orderList = await orderApi.getAllOrderList(pageNo, 4);
|
|
- var list = await this.handelOrderList(orderList.list);
|
|
|
|
var tabs = this.data.tabs;
|
|
var tabs = this.data.tabs;
|
|
- tabs[0].list = list;
|
|
|
|
|
|
+ tabs[0].list = orderList.list;
|
|
this.setData({
|
|
this.setData({
|
|
tabs
|
|
tabs
|
|
})
|
|
})
|
|
@@ -97,9 +104,8 @@ Page({
|
|
var pageNo = this.data.pageNo;
|
|
var pageNo = this.data.pageNo;
|
|
// 获取代消费订单
|
|
// 获取代消费订单
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
- var list = await this.handelOrderList(orderList.list);
|
|
|
|
var tabs = this.data.tabs;
|
|
var tabs = this.data.tabs;
|
|
- tabs[1].list = list;
|
|
|
|
|
|
+ tabs[1].list = orderList.list;
|
|
this.setData({
|
|
this.setData({
|
|
tabs
|
|
tabs
|
|
})
|
|
})
|
|
@@ -111,9 +117,8 @@ Page({
|
|
var pageNo = this.data.pageNo;
|
|
var pageNo = this.data.pageNo;
|
|
// 获取代消费订单
|
|
// 获取代消费订单
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
- var list = await this.handelOrderList(orderList.list);
|
|
|
|
var tabs = this.data.tabs;
|
|
var tabs = this.data.tabs;
|
|
- tabs[2].list = list;
|
|
|
|
|
|
+ tabs[2].list = orderList.list;
|
|
this.setData({
|
|
this.setData({
|
|
tabs
|
|
tabs
|
|
})
|
|
})
|
|
@@ -121,14 +126,13 @@ Page({
|
|
},
|
|
},
|
|
|
|
|
|
// 获取已经完成的列表
|
|
// 获取已经完成的列表
|
|
- getfinishOrderList: async function (params) {
|
|
|
|
|
|
+ getfinishOrderList: async function () {
|
|
const self = this
|
|
const self = this
|
|
var pageNo = this.data.pageNo;
|
|
var pageNo = this.data.pageNo;
|
|
// 获取代消费订单
|
|
// 获取代消费订单
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
var orderList = await orderApi.getOrderList(pageNo, 4, 2, 1);
|
|
- var list = await this.handelOrderList(orderList.list);
|
|
|
|
var tabs = this.data.tabs;
|
|
var tabs = this.data.tabs;
|
|
- tabs[3].list = list;
|
|
|
|
|
|
+ tabs[3].list = orderList.list;
|
|
this.setData({
|
|
this.setData({
|
|
tabs
|
|
tabs
|
|
})
|
|
})
|
|
@@ -152,33 +156,34 @@ Page({
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- handelOrderList: async function (list) {
|
|
|
|
-
|
|
|
|
- list.forEach(async function (item, i, array) {
|
|
|
|
- let store = await storeApi.getStoreById(item.storeId);
|
|
|
|
- let product = await productApi.getProductById(item.productId);
|
|
|
|
- item.address = store.info.address;
|
|
|
|
- item.productName = product.info.productName;
|
|
|
|
- item.productImg = product.info.productImg;
|
|
|
|
|
|
+ showOrderInfo: async function (e) {
|
|
|
|
+ console.log(e.currentTarget)
|
|
|
|
+ var orderId = e.currentTarget.dataset.orderid;
|
|
|
|
+ var status = e.currentTarget.dataset.status;
|
|
|
|
+ var writeStatus = e.currentTarget.dataset.writestatus;
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '/pages/order/order?id=' + orderId,
|
|
})
|
|
})
|
|
- return list
|
|
|
|
|
|
+ /* if(status==2&&writeStatus==1){
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: 'pages/order/order?orderId='+orderId,
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ } */
|
|
|
|
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|
|
- onReady: async function () {
|
|
|
|
- await this.getOrderList()
|
|
|
|
|
|
+ onReady: function () {
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
- onShow: function () {
|
|
|
|
-
|
|
|
|
|
|
+ onShow: async function () {
|
|
|
|
+ await this.getOrderList()
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -216,9 +221,23 @@ Page({
|
|
|
|
|
|
},
|
|
},
|
|
gotoComment: function (e) {
|
|
gotoComment: function (e) {
|
|
|
|
+ var orderId = e.currentTarget.dataset.orderid;
|
|
|
|
+ var shopId = e.currentTarget.dataset.shopid;
|
|
|
|
+ var productId = e.currentTarget.dataset.productid;
|
|
|
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
- url: '../commentinfo/commentinfo',
|
|
|
|
|
|
+ url: '../commentinfo/commentinfo?id=' + orderId + '&shopId=' + shopId + '&productId=' + productId,
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 再来一单
|
|
|
|
+ buyAgain: function (e) {
|
|
|
|
+ var shopId = e.currentTarget.dataset.shopid;
|
|
|
|
+ var productId = e.currentTarget.dataset.productid;
|
|
|
|
+ var productImg = e.currentTarget.dataset.productimg;
|
|
|
|
+ var productName = e.currentTarget.dataset.productname;
|
|
|
|
+ var price = e.currentTarget.dataset.price;
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../appointment/appointment?' + 'shopId=' + shopId + '&productId=' + productId + '&productImg=' + productImg + '&productName=' + productName + '&price=' + price,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|