const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")

class StOrderService extends ServiceBase {
  constructor() {
    super("deliver", ServiceBase.getDaoName(StOrderService));
    this.deliveruserDao = system.getObject("db.deliver.deliveruserDao");
    this.deliverorgDao = system.getObject("db.deliver.deliverorgDao");
  }

  async test(params) {
    return system.getResultSuccess("test");
  }

  // 订单列表页

  // 详情

  // 解析打款详情 excel

  // 保存打款信息

  // 付款申请提交

  // 一审

  // 二审

  // 打款

  // 结果反馈-批量

  // 交易列表页



  async page(params) {
    let currentPage = Number(params.currentPage || 1);
    let pageSize = Number(params.pageSize || 10);

    let where = {};
    if(params.id){
      where.id=this.trim(params.id);
    }
    if(params.name){
      where.name=this.trim(params.name);
    }
    let orderby = [
      ["id", 'desc']
    ];

    let page = await this.getPageList(currentPage, pageSize, where, orderby, null);
    if (page && page.rows) {
      for (var row of page.rows) {
        this.handleDate(row, ["created_at"], null, -8);
      }
      await this.setUser(page.rows);
    }
    return system.getResultSuccess(page);
  }

}

module.exports = StOrderService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
//   console.log((result));
// }).catch(function(e){
//   console.log(e);
// });