添加:省公司门店管理后台 - 员工编辑权限相关处理

添加:进货后 商品省公司发起人绑定信息、省公司提成金额、供应商提成金额同步,并且绑定供应商信息
This commit is contained in:
wuhui_zzw 2024-04-18 18:09:59 +08:00
parent 1d1c8fe40c
commit 9a4634b038
6 changed files with 78 additions and 9 deletions

View File

@ -283,6 +283,26 @@ class User extends BaseModel
return !empty($info) ? $info->toArray() : null;
}
// 用户是否存在省公司门店 有效店员信息
public function getProvinceServiceAttr(){
$info = (new StoreService())
->field('service_id,uid,nickname,avatar,customer,StoreService.mer_id,is_verify,is_goods,is_open')
->hasWhere('merchant',function($query){
$query->where('is_del', 0)
->where('mer_state', 1)
->where('merchant_type', 5)
->where('status', 1);
})
->where('uid',$this->uid)
->where('StoreService.mer_id','<>',0)
->where('StoreService.is_del',0)
->where('is_open',1)
->order('StoreService.is_verify DESC,StoreService.customer DESC')
// ->fetchSql()
->find();
return !empty($info) ? $info->toArray() : null;
}

View File

@ -529,7 +529,7 @@ class ProductRepository extends BaseRepository
// 按照批量购买设置
'is_batch' => $data['is_batch'] ?? 0,
'batch_num' => $data['batch_num'] ?? 0,
'batch_unit' => $data['batch_unit'] ?? ''
'batch_unit' => $data['batch_unit'] ?? '',
];
if (isset($data['extend'])) $result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : '';
if (isset($data['mer_id'])) $result['mer_id'] = $data['mer_id'];
@ -537,6 +537,11 @@ class ProductRepository extends BaseRepository
if (isset($data['product_type'])) $result['product_type'] = $data['product_type'];
if (isset($data['type']) && $data['type']) $result['type'] = $data['type'];
if (isset($data['param_temp_id'])) $result['param_temp_id'] = $data['param_temp_id'];
// 省公司及供应商提成
if (isset($data['agent_two_ids'])) $result['agent_two_ids'] = is_array($data['agent_two_ids']) ? implode(',',$data['agent_two_ids']) : $data['agent_two_ids'];
if (isset($data['agent_two_money'])) $result['agent_two_money'] = $data['agent_two_money'];
if (isset($data['supplier_money'])) $result['supplier_money'] = $data['supplier_money'];
return $result;
}

View File

@ -75,6 +75,7 @@ class WineProductRepository extends BaseRepository{
$product = app()->make(ProductRepository::class)->setProduct($oldGood);
$product['mer_id'] = $withGoodsMerId;
$product['copy_product_id'] = $oldGood['product_id'];
$product['supplier_mer_id'] = $oldGood['mer_id'];
// 处理商品添加
return Db::transaction(function () use ($item, $product, $withGoodsMerId, $oldGood) {
// 增加商品

View File

@ -107,13 +107,12 @@ class StoreServiceRepository extends BaseRepository
]
];
}
else if($merchantType == 1 || $merchantType == 3 || $merchantType == 4){
else if(in_array($merchantType,[1,3,4])){
$adminRule = [
Elm::switches('is_verify', '核销权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
// Elm::switches('product_exchange', '商品兑换码', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('purchase_permission', '进货权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('customer', '订单管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
];
$filed = [
"value" => 1,
@ -122,6 +121,20 @@ class StoreServiceRepository extends BaseRepository
]
];
}
else if($merchantType == 5){
$adminRule = [
Elm::switches('is_goods', '商品管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('is_verify', '核销权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('purchase_permission', '进货权限', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
Elm::switches('customer', '订单管理', 1)->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开')->col(8),
];
$filed = [
"value" => 1,
"rule" => [
"is_goods","is_verify",'product_exchange','purchase_permission'
]
];
}
else if($merchantType == 2){
$adminRule = [];
$filed = [

View File

@ -146,8 +146,40 @@ class Auth extends BaseController
*/
public function userInfo()
{
$user = $this->request->userInfo()->hidden(['label_id', 'group_id', 'pwd', 'addres', 'card_id', 'last_time', 'last_ip', 'create_time', 'mark', 'status', 'spread_uid', 'spread_time', 'real_name', 'birthday', 'brokerage_price']);
$user->append(['service', 'topService','shopMerService','supermarketService','smokeMerService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral']);
$user = $this->request->userInfo()
->hidden([
'label_id',
'group_id',
'pwd',
'addres',
'card_id',
'last_time',
'last_ip',
'create_time',
'mark',
'status',
'spread_uid',
'spread_time',
'real_name',
'birthday',
'brokerage_price'
]);
$user->append([
'service',
'topService',
'shopMerService',
'supermarketService',
'smokeMerService',
'provinceService',
'total_collect_product',
'total_collect_store',
'total_coupon',
'total_visit_product',
'total_unread',
'total_recharge',
'lock_integral',
'total_integral'
]);
$data = $user->toArray();
$data['total_consume'] = $user['pay_price'];
$data['extension_status'] = systemConfig('extension_status');

View File

@ -50,10 +50,8 @@ class StoreProductValidate extends Validate
$arr[] = $sku;
if(isset($data['extension_type']) && $data['extension_type'] && systemConfig('extension_status')){
if(!isset($v['extension_one']) || !isset($v['extension_two'])) return '佣金金额必须填写';
if(($v['extension_one'] < 0) || ($v['extension_two'] < 0))
return '佣金金额不可存在负数';
if($v['price'] < bcadd($v['extension_one'],$v['extension_two'],2))
return '自定义佣金总金额不能大于商品售价';
if(($v['extension_one'] < 0) || ($v['extension_two'] < 0)) return '佣金金额不可存在负数';
// if($v['price'] < bcadd($v['extension_one'],$v['extension_two'],2)) return '自定义佣金总金额不能大于商品售价';
}
if ($data['product_type'] == 20 && !$v['ot_price']) {
return '积分商品兑换积分必须大于0.'.$data['product_type'] ;