card-mini/pages/mine/order/orderdetail.js
2021-07-25 13:11:55 +08:00

69 lines
1.5 KiB
JavaScript

/**
* 订单详情
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
orderId: '',
shopId: '',
shopDetailBean: null,
orderList: [],
baseImg: app.urls.baseImgUrl
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
orderId: options.orderId,
shopId: options.shopId
})
this.getShopDetailById(this.data.shopId)
this.getOrderDetail()
},
//获取店铺详情
getShopDetailById(id) {
app.http.get(app.urls.getShopDetail.format({
shopId: id
}), {
header: {
token: app.globalData.token
}
})
.then(res => {
this.setData({
shopDetailBean: res.data
})
})
.catch(err => {
})
},
getOrderDetail() {
wx.showLoading({
title: '加载中...',
})
let _self = this
app.http.get(app.urls.getOrderDetail.format({
orderId: _self.data.orderId
}), {
header: {
token: app.globalData.token
}
})
.then(res => {
wx.hideLoading({})
this.setData({
orderList: res.data
})
})
.catch(err => {
wx.hideLoading({})
})
}
})