import { get, post } from '../../utils/http'; Page({ /** * 页面的初始数据 */ data: { urls: [ "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto", "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto", "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto", "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto", "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto", "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto", "https://img0.baidu.com/it/u=3098615520,360170704&fm=26&fmt=auto", "https://img1.baidu.com/it/u=510862345,2249984174&fm=26&fmt=auto", "https://img2.baidu.com/it/u=2222750380,2392750381&fm=26&fmt=auto", ], status: { 1: '待进行', 2: '进行中', 3: '已完成' }, list: [], total: 0, page: 1, index: 0, visible: false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) this.setData({ id: options.orderId },() => { this.getOrderInfo() this.getFeedbackList() }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if(this.data.page * 10 < this.data.total) { this.getFeedbackList(++this.data.page) } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, /** * 复制订单号 */ onCopyOrderNum(e) { wx.setClipboardData({ data: e.currentTarget.dataset.num || '', success(res) { console.log(res) } }) }, /** * 打开弹框 */ onEditItem() { this.setData({ visible: true }) }, /** * 关闭弹框 */ onPopupState() { this.setData({ visible: false }) }, /** * 图片预览 */ previewImage(e) { wx.previewImage({ current: e.currentTarget.dataset.index, urls: this.data.urls }) }, /** * 获取订单详情 */ getOrderInfo(id) { get('api/order/info',{ order_id: this.data.id },(res) => { this.setData({ detailData: res.data // detailData: {} }) }) }, /** * 获取反馈记录列表 * api/feedback/list/order */ getFeedbackList(_page) { let { list,page } = this.data; get('api/feedback/list/order',{ order_id: this.data.id, page: _page || page, limit: 10 },(res) => { list.push(...res.data.list) this.setData({ list,total: res.data.total, }) console.log(res) }) } })