fix(purchase): 修复采购产品报价单据详情页面单位名称显示错误

- 修正了单位名称的查询逻辑,使用正确的字段 'unit' 替代 'unit_id'
- 添加了买家名称的查询和显示
- 优化了代码结构,提高了可读性和维护性
This commit is contained in:
mkm 2024-11-20 13:57:34 +08:00
parent b44ee6e9eb
commit 590a4abc4b

View File

@ -13,6 +13,7 @@ use app\common\model\dict\DictData;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_price\StoreProductPrice;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\user\User;
use app\common\service\workWechat\ProductOffer;
use support\exception\BusinessException;
use think\facade\Db;
@ -139,7 +140,7 @@ class PurchaseProductOfferLogic extends BaseLogic
]);
$find = StoreProductPrice::where(['offer_id' => $params['id']])->find();
$product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('store_name,top_cate_id')->find();
$unit_name=StoreProductUnit::where('id', $offer['unit_id'])->value('name');
$unit_name=StoreProductUnit::where('id', $offer['unit'])->value('name');
$dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select();
$data = [];
$data['bhoid'] = $offer['order_id'];
@ -172,6 +173,7 @@ class PurchaseProductOfferLogic extends BaseLogic
Db::commit();
$offer['store_name']=$product['store_name'];
$offer['unit_name']=$unit_name;
$offer['buyer_name']=User::where('id',$offer['buyer_id'])->value('real_name');
if($offer['pay_type']==1){
$offer['pay_type_name']='赊账';
}elseif($offer['pay_type']==2){