diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index b5b827e..e16d6a2 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -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; + } diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index a2f1c63..c14cb8a 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -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; } diff --git a/app/common/repositories/store/product/WineProductRepository.php b/app/common/repositories/store/product/WineProductRepository.php index c544d37..dffb780 100644 --- a/app/common/repositories/store/product/WineProductRepository.php +++ b/app/common/repositories/store/product/WineProductRepository.php @@ -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) { // 增加商品 diff --git a/app/common/repositories/store/service/StoreServiceRepository.php b/app/common/repositories/store/service/StoreServiceRepository.php index 70c6b64..bf22053 100644 --- a/app/common/repositories/store/service/StoreServiceRepository.php +++ b/app/common/repositories/store/service/StoreServiceRepository.php @@ -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 = [ diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 92e98df..31bf4f4 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -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'); diff --git a/app/validate/merchant/StoreProductValidate.php b/app/validate/merchant/StoreProductValidate.php index bd99f68..9e482a6 100644 --- a/app/validate/merchant/StoreProductValidate.php +++ b/app/validate/merchant/StoreProductValidate.php @@ -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'] ;