Commit e2b5557a by 宋毅

tj

parent 0a51d1db
...@@ -62,24 +62,28 @@ class OrderTmProductService extends ServiceBase { ...@@ -62,24 +62,28 @@ class OrderTmProductService extends ServiceBase {
if (productItem.status != 1) { if (productItem.status != 1) {
return system.getResult(null, "产品已禁用"); return system.getResult(null, "产品已禁用");
} }
if (productItem && productItem.verifyPrice == 1) { var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null);
var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null); if (verifyResult) {
if (verifyResult) { return verifyResult;
return verifyResult; }
} // if (productItem && productItem.verifyPrice == 1) {
} else { // var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null);
tm.nclOneCodes = []; // if (verifyResult) {
tm.nclCount = 0; // return verifyResult;
for (var i = 0; i < nclones.length; i++) { // }
var tbcode = await self.getBusUid("tb"); // } else {
var nclone = nclones[i]; // tm.nclOneCodes = [];
var nclthreeobj = nclone.nclThree; // tm.nclCount = 0;
if (nclone) { // for (var i = 0; i < nclones.length; i++) {
tm.nclOneCodes.push(nclone.code); // var tbcode = await self.getBusUid("tb");
tm.nclCount = tm.nclCount + nclthreeobj.length; // var nclone = nclones[i];
} // var nclthreeobj = nclone.nclThree;
} // if (nclone) {
} // tm.nclOneCodes.push(nclone.code);
// tm.nclCount = tm.nclCount + nclthreeobj.length;
// }
// }
// }
if (tm.tmFormType == "4") {//图形商标 if (tm.tmFormType == "4") {//图形商标
tm["name"] = "图形"; tm["name"] = "图形";
} }
...@@ -182,24 +186,29 @@ class OrderTmProductService extends ServiceBase { ...@@ -182,24 +186,29 @@ class OrderTmProductService extends ServiceBase {
if (productItem.status != 1) { if (productItem.status != 1) {
return system.getResult(null, "产品已禁用"); return system.getResult(null, "产品已禁用");
} }
if (productItem && productItem.verifyPrice == 1) { var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null);
var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null); if (verifyResult) {
if (verifyResult) { return verifyResult;
return verifyResult;
}
} else {
tm.nclOneCodes = [];
tm.nclCount = 0;
for (var i = 0; i < nclones.length; i++) {
var tbcode = await self.getBusUid("tb");
var nclone = nclones[i];
var nclthreeobj = nclone.nclThree;
if (nclone) {
tm.nclOneCodes.push(nclone.code);
tm.nclCount = tm.nclCount + nclthreeobj.length;
}
}
} }
// if (productItem && productItem.verifyPrice == 1) {
// var verifyResult = await self.isOrderVerify(user, 1, tm, productItem, nclones, null);
// if (verifyResult) {
// return verifyResult;
// }
// } else {
// tm.nclOneCodes = [];
// tm.nclCount = 0;
// for (var i = 0; i < nclones.length; i++) {
// var tbcode = await self.getBusUid("tb");
// var nclone = nclones[i];
// var nclthreeobj = nclone.nclThree;
// if (nclone) {
// tm.nclOneCodes.push(nclone.code);
// tm.nclCount = tm.nclCount + nclthreeobj.length;
// }
// }
// }
if (tm.tmFormType == "4") {//图形商标 if (tm.tmFormType == "4") {//图形商标
tm["name"] = "图形"; tm["name"] = "图形";
} }
...@@ -207,8 +216,8 @@ class OrderTmProductService extends ServiceBase { ...@@ -207,8 +216,8 @@ class OrderTmProductService extends ServiceBase {
//创建订单 //创建订单
var ordercode = await self.getBusUid("tm"); var ordercode = await self.getBusUid("tm");
var orderAmount = tm; var orderAmount = tm;
orderAmount.salesNum = tm.nclOneCodes.length; orderAmount.salesNum = tm.nclOneCodes ? tm.nclOneCodes.length : 0;
orderAmount.minitermNum = tm.nclCount; orderAmount.minitermNum = tm.nclCount ? tm.nclCount : 0;
channelOrder.payStatus = "dfk"; channelOrder.payStatus = "dfk";
var orderResult = await self.orderDao.addOrder(ordercode, orderType, user, app, productItem, channelOrder, channelUser, apply, orderAmount, t); var orderResult = await self.orderDao.addOrder(ordercode, orderType, user, app, productItem, channelOrder, channelUser, apply, orderAmount, t);
if (orderResult.status != 0) { if (orderResult.status != 0) {
...@@ -294,7 +303,6 @@ class OrderTmProductService extends ServiceBase { ...@@ -294,7 +303,6 @@ class OrderTmProductService extends ServiceBase {
/* /*
verifyType==1为商标注册验证,2为其他订单验证 verifyType==1为商标注册验证,2为其他订单验证
*/ */
tm.nclOneCodes = [];
var sveItemRateConfig = serviceitem.rateConfig ? Number(serviceitem.rateConfig) : 0;//产品费率 var sveItemRateConfig = serviceitem.rateConfig ? Number(serviceitem.rateConfig) : 0;//产品费率
var fwf = serviceitem.serviceCharge ? Number(serviceitem.serviceCharge) : 0;//服务费 var fwf = serviceitem.serviceCharge ? Number(serviceitem.serviceCharge) : 0;//服务费
var yhfl = serviceitem.discountsRateConfig ? Number(serviceitem.discountsRateConfig) : 0;//最大优惠费率 var yhfl = serviceitem.discountsRateConfig ? Number(serviceitem.discountsRateConfig) : 0;//最大优惠费率
...@@ -302,7 +310,7 @@ class OrderTmProductService extends ServiceBase { ...@@ -302,7 +310,7 @@ class OrderTmProductService extends ServiceBase {
var nclSmallPrice = gf / 10;//单个小类官费 var nclSmallPrice = gf / 10;//单个小类官费
nclSmallPrice = Number(nclSmallPrice.toFixed(2)); nclSmallPrice = Number(nclSmallPrice.toFixed(2));
var productCount = 1;//产品数量 var productCount = 1;//产品数量
var gfze = 0;//官费总额 var gfze = 0;//官费总额--------------------------------------------------------------------------------------------
if (verifyType == 1) { if (verifyType == 1) {
tm.nclOneCodes = []; tm.nclOneCodes = [];
tm.nclCount = 0; tm.nclCount = 0;
...@@ -310,7 +318,7 @@ class OrderTmProductService extends ServiceBase { ...@@ -310,7 +318,7 @@ class OrderTmProductService extends ServiceBase {
for (var a = 0; a < nclones.length; a++) { for (var a = 0; a < nclones.length; a++) {
var nclone = nclones[a]; var nclone = nclones[a];
tm.nclOneCodes.push(nclone.code); tm.nclOneCodes.push(nclone.code);
tm.nclCount = tm.nclCount + nclthreeobj.length; tm.nclCount = tm.nclCount + nclone.nclThree.length;
var nclthreeobj = nclone.nclThree; var nclthreeobj = nclone.nclThree;
gfze = gfze + gf; gfze = gfze + gf;
if (nclthreeobj.length > 10) { if (nclthreeobj.length > 10) {
...@@ -322,39 +330,55 @@ class OrderTmProductService extends ServiceBase { ...@@ -322,39 +330,55 @@ class OrderTmProductService extends ServiceBase {
productCount = buyProductCount; productCount = buyProductCount;
gfze = gf * Number(productCount); gfze = gf * Number(productCount);
} }
var fwfze = Number(fwf) * Number(productCount);//服务费总额 var fwfze = Number(fwf) * Number(productCount);//服务费总额--------------------------------------------------------------------------------------------
var sfze = Number(tm.totalSum) / (sveItemRateConfig + 100) * sveItemRateConfig; //totalTaxes 税费总额 var sfze = Number(tm.totalSum) / (sveItemRateConfig + 100) * sveItemRateConfig; //totalTaxes 税费总额
sfze = sfze.toFixed(2); sfze = sfze.toFixed(2);
sfze = Number(sfze); sfze = Number(sfze);//--------------------------------------------------------------------------------------------
var zdyhe = (gfze + fwfze) * yhfl / 100;//最大优惠额 var zdyhe = (gfze + fwfze) * yhfl / 100;//最大优惠额-------------------------------------------------------------------------------------------
zdyhe = zdyhe.toFixed(2); zdyhe = zdyhe.toFixed(2);
zdyhe = Number(zdyhe); zdyhe = Number(zdyhe);
//毛利总额=应付总额-官费总额 //毛利总额=应付总额-官费总额
var mlze = Number(tm.totalSum) - gfze;//totalProfitSum 毛利总额 var mlze = Number(tm.totalSum) - gfze;//totalProfitSum 毛利总额--------------------------------------------------------------------------------------------
mlze = mlze.toFixed(2); mlze = mlze.toFixed(2);
mlze = Number(mlze); mlze = Number(mlze);
//优惠金额=服务费+官费总额-应付总额(服务费、官费之和小于等于应付总额时,优惠金额为零) var ddze = Number(fwfze) + Number(gfze);//订单总额---------------------------------------------------
var yhje = fwfze + gfze - Number(tm.totalSum); if (Number(tm.totalSum) < Number(ddze)) {
if (yhje < 0) { return { code: -201, msg: "订单总额有误" };
yhje = 0;
}
yhje = yhje.toFixed(2);
yhje = Number(yhje);
if (fwfze != Number(tm.totalServiceCharge)) {
return { code: -201, msg: "服务费总额有误" };
}
if (gfze != Number(tm.totalPublicExpense)) {
return { code: -202, msg: "官费总额有误" };
}
if (sfze != Number(tm.totalTaxes)) {
return { code: -203, msg: "税费总额有误" };
}
if (mlze != Number(tm.totalProfitSum)) {
return { code: -204, msg: "毛利总额有误" };
}
if (yhje != Number(tm.totalDiscounts) || yhje > zdyhe) {
return { code: -205, msg: "优惠总额有误" };
} }
tm.totalServiceCharge = fwfze;// 服务费总额(产品配置的服务费*订单件数)
tm.totalPublicExpense = gfze;// 官费总额(产品配置的官费*订单件数)
tm.totalDiscounts = zdyhe;// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度)
tm.totalTaxes = sfze;// 税费总额(订单总额-(订单总额/(1+产品费率)))
return "";
// //优惠金额=服务费+官费总额-应付总额(服务费、官费之和小于等于应付总额时,优惠金额为零)
// var yhje = fwfze + gfze - Number(tm.totalSum);
// if (yhje < 0) {
// yhje = 0;
// }
// yhje = yhje.toFixed(2);
// yhje = Number(yhje);
// if (fwfze != Number(tm.totalServiceCharge)) {
// return { code: -201, msg: "服务费总额有误" };
// }
// if (gfze != Number(tm.totalPublicExpense)) {
// return { code: -202, msg: "官费总额有误" };
// }
// if (sfze != Number(tm.totalTaxes)) {
// return { code: -203, msg: "税费总额有误" };
// }
// if (mlze != Number(tm.totalProfitSum)) {
// return { code: -204, msg: "毛利总额有误" };
// }
// if (yhje != Number(tm.totalDiscounts) || yhje > zdyhe) {
// return { code: -205, msg: "优惠总额有误" };
// }
// var channelProfitSum = 0;//订单渠道分成毛利润总额 // var channelProfitSum = 0;//订单渠道分成毛利润总额
// var pfProfitSum = 0;//订单平台毛利润总额 // var pfProfitSum = 0;//订单平台毛利润总额
// var totalProfitSum = Number(tm.totalProfitSum);//订单毛利润总额 // var totalProfitSum = Number(tm.totalProfitSum);//订单毛利润总额
...@@ -375,7 +399,7 @@ class OrderTmProductService extends ServiceBase { ...@@ -375,7 +399,7 @@ class OrderTmProductService extends ServiceBase {
// pfProfitSum = mlze;//毛利总额 // pfProfitSum = mlze;//毛利总额
// } // }
// }//渠道利润分成比率(只分订单中毛利润总额的分成) // }//渠道利润分成比率(只分订单中毛利润总额的分成)
return ""; // return "";
} }
async opCustomerInfo(user, apply, orderObj, t) {//订单客户档案添加和修改 async opCustomerInfo(user, apply, orderObj, t) {//订单客户档案添加和修改
var customerInfoObj = { var customerInfoObj = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment