Commit 7a6c9f6f by v_vjyjiang

d

parent 75d36e4a
...@@ -467,6 +467,24 @@ class UserService extends ServiceBase { ...@@ -467,6 +467,24 @@ class UserService extends ServiceBase {
}) })
} }
async findCostBySkuCode (skucode) {
let productpricetmp = await this.db.models.productprice.findOne({
where: { skucode: skucode, isEnabled: true },
include: [
{ model: this.db.models.productcost, where: { expensetype: 'service' }, as: "costs", attributes: ['id', 'expensetype', 'costamount'] }
],
raw: true,
}
)
let costAmount = 0
//获取服务费成本
if (productpricetmp && productpricetmp['costs.costamount']) {
costAmount = Number(productpricetmp['costs.costamount'])
} else {
console.log("skucode not find product:", skucode)
}
return costAmount
}
/** /**
* *
* @param {*} clientMobile 客户电话 * @param {*} clientMobile 客户电话
...@@ -480,23 +498,7 @@ class UserService extends ServiceBase { ...@@ -480,23 +498,7 @@ class UserService extends ServiceBase {
var self = this var self = this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
return this.db.transaction(async function (t) { return this.db.transaction(async function (t) {
//按照产品简码,查询服务成本
let productpricetmp = await self.db.models.productprice.findOne({
where: { skucode: skucode },
include: [
{ model: self.db.models.productcost, where: { expensetype: 'service' }, as: "costs", attributes: ['id', 'expensetype', 'costamount'] }
],
raw: true,
transaction: t
}
)
let costAmount = 0 let costAmount = 0
//获取服务费成本
if (productpricetmp['costs.costamount']) {
costAmount = Number(productpricetmp['costs.costamount'])
}
//先检查缓存是否存在bizuser todo key再加个字母d //先检查缓存是否存在bizuser todo key再加个字母d
var resultcache = await self.cacheManager["ClientBindBizUserCache"].getCache(clientMobile) var resultcache = await self.cacheManager["ClientBindBizUserCache"].getCache(clientMobile)
let isGoExec = false let isGoExec = false
......
...@@ -14,7 +14,7 @@ class TxHandler { ...@@ -14,7 +14,7 @@ class TxHandler {
* @param {*} datajson * @param {*} datajson
*/ */
//新商机处理 //新商机处理
async addChance(datajson) { async addChance (datajson) {
console.log("put in queue", datajson); console.log("put in queue", datajson);
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -101,7 +101,7 @@ class TxHandler { ...@@ -101,7 +101,7 @@ class TxHandler {
} }
//退回商机处理 //退回商机处理
async needClose(datajson) { async needClose (datajson) {
console.log("put in queue" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); console.log("put in queue" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -179,7 +179,7 @@ class TxHandler { ...@@ -179,7 +179,7 @@ class TxHandler {
} }
//交付单处理 //交付单处理
async orderSubmit(datajson) { async orderSubmit (datajson) {
console.log("put in queue-----------------------------------------------------------------------------------------------------", datajson); console.log("put in queue-----------------------------------------------------------------------------------------------------", datajson);
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -246,6 +246,10 @@ class TxHandler { ...@@ -246,6 +246,10 @@ class TxHandler {
params.costPrice = salesmanInfo.comInfo.cost; params.costPrice = salesmanInfo.comInfo.cost;
params.servicerCode = salesmanInfo.comInfo.compId; params.servicerCode = salesmanInfo.comInfo.compId;
} }
//设置成本 tocheck
let costprice = await this.userService.findCostBySkuCode(datajson.actionBody.txPriceCode)
params.costPrice = costprice
if (salesmanInfo.userInfo && salesmanInfo.userInfo != 'undefined') { if (salesmanInfo.userInfo && salesmanInfo.userInfo != 'undefined') {
params.clerkOpcode = salesmanInfo.userInfo.opath; params.clerkOpcode = salesmanInfo.userInfo.opath;
params.clerkId = salesmanInfo.userInfo.userId; params.clerkId = salesmanInfo.userInfo.userId;
...@@ -464,7 +468,7 @@ class TxHandler { ...@@ -464,7 +468,7 @@ class TxHandler {
} }
//关闭交付单处理 //关闭交付单处理
async orderClose(datajson) { async orderClose (datajson) {
console.log("put in queue", datajson); console.log("put in queue", datajson);
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
......
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