123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- 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: '已完成'
- },
- detailData: {},
- list: [],
- total: 0,
- page: 1,
- index: 0,
- visible: false,
- currentItem: {},
- raterStatus: {
- 1: '差',
- 2: '较差',
- 3: '一般',
- 4: '满意',
- 5: '非常好',
- },
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options)
- this.setData({
- id: options.orderId
- },() => {
- this.getOrderInfo()
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getFeedbackList(1)
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- this.setData({
- visible: false
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- 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(e) {
- console.log(e)
- this.setData({
- visible: true,
- currentItem: e.currentTarget.dataset.item
- })
- },
- /**
- * 关闭弹框
- */
- onPopupState() {
- this.setData({
- visible: false
- })
- },
- /**
- * 预览图片和视频
- */
- previewMedia(e) {
- let { idx,index } = e.currentTarget.dataset;
- let arr = this.data.list[idx].media_list
- let current = index
- wx.previewMedia({
- sources: arr,
- current
- })
- },
- /**
- * 删除反馈记录
- * api/feedback/delete
- */
- onDelete(e) {
- post('api/feedback/delete',{
- id: this.data.currentItem.id
- },(res) => {
- wx.showToast({
- title: res.msg,
- icon: 'none'
- })
- this.setData({
- visible: false
- })
- this.getFeedbackList(1)
- })
- },
- /**
- * 获取订单详情
- */
- 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) => {
- if (_page == 1 || page == 1) {
- list = []
- this.data.page = 1
- }
- res.data.list.forEach((item,index) => {
- item.media_list = JSON.parse(item.media_list)
- })
- list.push(...res.data.list)
- this.setData({ list,total: res.data.total, })
- console.log(res)
- })
- }
- })
|