const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class OrderService extends ServiceBase {
  constructor() {
    super();
  }

  async add(params) {
    var rs = await this.callms("order", "addOrder", params);
    return rs;
  }

  async myPage(params) {
    var rs = await this.callms("order", "myOrderPage", params);
    await this.transfield(rs.data.rows);
    return rs;
  }

  async info(params) {
    var rs = await this.callms("order", "orderInfoAll", params);
    await this.transfield([rs.data]);
    return rs;
  }
  async orderPay(params) {
    var rs = await this.callms("order", "orderPay", params);
    return rs;
  }

  async transfield(rows) {
    if (!rows) {
      return;
    }
    for (var item of rows) {
      if (!item) {
        continue;
      }
      item.price = system.f2y(item.price);
    }
  } 
}
module.exports = OrderService;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
//   console.log((result));
// }).catch(function(e){
//   console.log(e);
// });