| 1234567891011121314151617181920212223242526272829303132333435363738394041 | 'use strict';/** * * * @author Mai * @date 2018/8/14 * @version */const audit = require('../const/audit');module.exports = app => {    class ChangeAuditList extends app.BaseService {        /**         * 构造函数         *         * @param {Object} ctx - egg全局变量         * @return {void}         */        constructor(ctx) {            super(ctx);            this.tableName = 'change_audit_list';        }        async gatherBgBills (tid) {            const sql = 'SELECT code, name, unit, unit_price, Sum(camount) as quantity' +                '  FROM ' + this.tableName +                '  WHERE tid = ?' +                '  GROUP BY code, name, unit, unit_price';            const param = [tid];            const result = await this.db.query(sql, param);            for (const b of result) {                b.total_price = this.ctx.helper.mul(b.unit_price, b.quantity, this.ctx.tender.info.decimal.tp);            }            return result;        }    }    return ChangeAuditList;};
 |