浏览代码

签约清单,新增签约清单问题

MaiXinRong 3 年之前
父节点
当前提交
6273ba5cd1
共有 1 个文件被更改,包括 5 次插入7 次删除
  1. 5 7
      app/service/deal_bills.js

+ 5 - 7
app/service/deal_bills.js

@@ -222,14 +222,12 @@ module.exports = app => {
                 const nd = { id: this.uuid.v4(), tender_id: this.ctx.tender.id };
                 nd.code = d.code;
                 nd.order = d.order;
-                if (d.name) nd.name = d.name;
-                if (d.unit) nd.unit = d.unit;
-                if (d.unit_price) nd.unit_price = this.ctx.helper.round(d.unit_price, info.decimal.up);
+                nd.name = d.name || '';
+                nd.unit = d.unit || '';
+                nd.unit_price = d.unit_price ? this.ctx.helper.round(d.unit_price, info.decimal.up) : 0;
                 const precision = this.ctx.helper.findPrecision(info.precision, d.unit);
-                if (d.quantity) {
-                    nd.quantity = this.ctx.helper.round(d.quantity, precision.value);
-                    nd.total_price = this.ctx.helper.mul(nd.unit_price, nd.quantity, info.decimal.tp);
-                }
+                nd.quantity = d.quantity ? this.ctx.helper.round(d.quantity, precision.value) : 0;
+                nd.total_price = this.ctx.helper.mul(nd.unit_price, nd.quantity, info.decimal.tp);
                 insertData.push(nd);
             }
             const result = await this.db.insert(this.tableName, insertData);