const app = getApp(),
Api = require("../../../../utils/util.js");
Page({
  data: {

  },
  onLoad: function(options) {
    var data = {
        orderId: options.id,
      },
    that = this;
    that.setData({
      type: options.type,
      imgUrl: app.globalData.imgUrl
    })
    wx.showLoading({
      title: '加载中...',
    })   
    Api.req('sf/operationOrderFeedback/listFeedback', data, 'get')
      .then(res => {
        wx.hideLoading()
        if(res.code == 200){
          for (var i = 0; i < res.data.length; i++) {
            if (res.data[i].feedbackImg) {             
              // res.data[i].feedbackImg = res.data[i].feedbackImg.split(",").map(itm=>{return this.data.imgUrl + itm})
              res.data[i].feedbackImg = res.data[i].feedbackImg?res.data[i].feedbackImg.split(",").map(itm => {return {name: itm,url: this.data.imgUrl + itm}}): [];
            } else {
              res.data[i].feedbackImg = []
            }
          }
          that.setData({
            back: res.data,
          })
        }
      })
  },
  bigImg: function(e) {
    let photo_arr = new Array();   
    let current = e.currentTarget.dataset.url;
    photo_arr.push(current);
    wx.previewImage({
      current: current, // 当前显示图片的https链接
      urls: photo_arr, // 需要预览的图片https链接列表
    })
  },
//备用
  bigImg2: function(e) {
    let findex = e.currentTarget.dataset.findex
    let photo_arr = this.data.back[findex].feedbackImg;
    let current = e.currentTarget.dataset.url;       
    wx.previewImage({
      current: current, // 当前显示图片的https链接
      urls: photo_arr, // 需要预览的图片https链接列表
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  }, 
})