commentDetails.js 2.02 KB
// packageMall/pages/commentDetails/commentDetails.js
import {
    shopmallApi
} from '../../../api/api'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        commentlist: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        wx.$router.getData(orderCode => {
            this.setData({
                orderCode
            })
            this.getOrderCommentDetails(orderCode)
        })
    },
    getOrderCommentDetails(orderCode) {
        let obj = {
            currentPage: 1,
            pageSize: 1000,
            orderCode: orderCode,
            containUnpublished:true
        }

        wx.$util.showLoading('加载中...')
        shopmallApi.getCommentList(obj).then(res => {
            console.log(res)
            if (res.code == '0') {
                if (res.data.list == 0) nothing = true;
                this.setData({
                    commentlist: res.data.list,
                })
                wx.hideLoading()
            }
        })
    },
    previewCommentImage(e) {
        let {
            current,
            item
        } = e.currentTarget.dataset
        let urls = []
        item.map(i => {
            urls.push(i)
        })
        wx.$util.previewImage({
            current,
            urls
        })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})