import apis from '../util/apis1.js'
let {
  getGoods
} = apis
//曝光商品
const exposureData = (content, paramsData, callBack) => {
  if (content.isTemplate) {
    var datasAll = content.templateData;
    if (datasAll) {
      if (datasAll.exposedData) {
        content.exposureList = datasAll.exposedData.exposedGoods;
        if (content.exposureList.length > 0) {
          content.isshow = true;
        } else {
          content.isshow = false;
        }
      }
    } else {
      content.isshow = true;
      content.exposureList = [{
          skuImg: '//img10.360buyimg.com/imgzone/jfs/t1/187416/31/4714/49523/60ab4c4cE3a8eca46/c49d115666efe94f.png',
          skuId: '1336052',
          skuName: '曝光商品1',
          skuPrice: '10'
        },
        {
          skuImg: '//img10.360buyimg.com/imgzone/jfs/t1/183810/37/5745/49914/60ab4c4cE278180de/a793c8be0d03673c.png',
          skuId: '100015054036',
          skuName: '曝光商品2',
          skuPrice: '10'
        },
        {
          skuImg: '//img10.360buyimg.com/imgzone/jfs/t1/190444/40/4785/42939/60ab4c4cEef774869/6c76610f0fefe403.png',
          skuId: '100009576107',
          skuName: '曝光商品3',
          skuPrice: '10'
        },
        {
          skuImg: '//img10.360buyimg.com/imgzone/jfs/t1/172186/12/11435/45891/60ab4c55E10ef3f21/0e82116a42c2d58b.png',
          skuId: '曝光商品4',
          skuName: '10',
          skuPrice: '10'
        }
      ];
    }
  } else {
    // 曝光商品
    var taskType = '0';
    // 获取曝光商品
    getGoods(taskType, initdatas => {
      console.log(initdatas.data);
      if (initdatas.data) {
        content.exposureList = initdatas.data;
      }
      if (content.exposureList.length > 0) {
        content.isshow = true;
      } else {
        content.isshow = false;
      }
    });
  }

}

export {
  exposureData
}
