Merge branch 'master' of https://gitea.lihaink.cn/mkm/erp
This commit is contained in:
commit
22076ee2f9
@ -91,5 +91,12 @@ class MerchantController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
public function bind_goods(){
|
||||
$params = (new MerchantValidate())->post()->goCheck('detail');
|
||||
$result = MerchantLogic::bindGoods($params);
|
||||
if (true === $result) {
|
||||
return $this->success('绑定成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
}
|
@ -31,25 +31,25 @@ class GoodsLogic extends BaseLogic
|
||||
try {
|
||||
Goods::create([
|
||||
'name' => $params['name'],
|
||||
'py' => $params['py'],
|
||||
'py' => $params['py'] ?? '',
|
||||
'number' => $params['number'],
|
||||
'spec' => $params['spec'],
|
||||
'class' => $params['class'],
|
||||
'brand' => $params['brand'],
|
||||
'brand' => $params['brand'] ?? '',
|
||||
'unit' => $params['unit'],
|
||||
'buy' => $params['buy'],
|
||||
'sell' => $params['sell'],
|
||||
'retail' => $params['retail'],
|
||||
'code' => $params['code'],
|
||||
'sell' => $params['sell'] ?? '',
|
||||
'retail' => $params['retail'] ?? '',
|
||||
'code' => $params['code'] ?? '',
|
||||
'warehouse' => $params['warehouse'],
|
||||
'location' => $params['location'],
|
||||
'location' => $params['location'] ?? '',
|
||||
'stocktip' => $params['stocktip'],
|
||||
'imgs' => $params['imgs'],
|
||||
'details' => $params['details'] ? implode(',', $params['details']) : '',
|
||||
'data' => $params['data'],
|
||||
'more' => $params['more'],
|
||||
'sort' => $params['sort'],
|
||||
'sys_labels' => $params['sys_labels'] ?? '',
|
||||
'data' => $params['data'] ?? '',
|
||||
'more' => $params['more'] ?? '',
|
||||
'sort' => $params['sort'] ?? '',
|
||||
'sys_labels' => $params['sys_labels'],
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@ -74,26 +74,26 @@ class GoodsLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
Goods::where('id', $params['id'])->update([
|
||||
'name' => $params['name'],
|
||||
'py' => $params['py'],
|
||||
'number' => $params['number'],
|
||||
'spec' => $params['spec'],
|
||||
'class' => $params['class'],
|
||||
'brand' => $params['brand'],
|
||||
'unit' => $params['unit'],
|
||||
'buy' => $params['buy'],
|
||||
'sell' => $params['sell'],
|
||||
'retail' => $params['retail'],
|
||||
'code' => $params['code'],
|
||||
'warehouse' => $params['warehouse'],
|
||||
'location' => $params['location'],
|
||||
'stocktip' => $params['stocktip'],
|
||||
'imgs' => $params['imgs'],
|
||||
'details' => $params['details'] ? implode(',', $params['details']) : '',
|
||||
'data' => $params['data'],
|
||||
'more' => $params['more'],
|
||||
'sort' => $params['sort'],
|
||||
'sys_labels' => $params['sys_labels'] ?? '',
|
||||
'name' => $params['name'],
|
||||
'py' => $params['py'] ?? '',
|
||||
'number' => $params['number'],
|
||||
'spec' => $params['spec'],
|
||||
'class' => $params['class'],
|
||||
'brand' => $params['brand'] ?? '',
|
||||
'unit' => $params['unit'],
|
||||
'buy' => $params['buy'],
|
||||
'sell' => $params['sell'] ?? '',
|
||||
'retail' => $params['retail'] ?? '',
|
||||
'code' => $params['code'] ?? '',
|
||||
'warehouse' => $params['warehouse'],
|
||||
'location' => $params['location'] ?? '',
|
||||
'stocktip' => $params['stocktip'],
|
||||
'imgs' => $params['imgs'],
|
||||
'details' => $params['details'] ? implode(',', $params['details']) : '',
|
||||
'data' => $params['data'] ?? '',
|
||||
'more' => $params['more'] ?? '',
|
||||
'sort' => $params['sort'] ?? '',
|
||||
'sys_labels' => $params['sys_labels'],
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
|
@ -117,6 +117,35 @@ class MerchantLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 商户绑定商品
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 16:35
|
||||
*/
|
||||
public static function bindGoods(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$data = [];
|
||||
foreach ($params['bind_data'] as $v){
|
||||
$data[] = [
|
||||
'mer_id' => $params['mer_id'],
|
||||
'goods_id' => $v['goods_id'],
|
||||
'nums' => $v['nums']
|
||||
];
|
||||
}
|
||||
Db::name('merchant_bind_goods')->insertAll($data);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ class OpurchaseclassLogic extends BaseLogic
|
||||
self::setError('报价未设置');
|
||||
return false;
|
||||
}
|
||||
$find->is_adopt=1;
|
||||
$find->is_adopt=2;
|
||||
}else{
|
||||
$find->is_storage=1;
|
||||
$find->notes=$notes;
|
||||
|
@ -21,10 +21,14 @@ class GoodsValidate extends BaseValidate
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'name' => 'require',
|
||||
'spec' => 'require',
|
||||
'class' => 'require',
|
||||
'brand' => 'require',
|
||||
'unit' => 'require',
|
||||
// 'warehouse' => 'require',
|
||||
'sys_labels' => 'require',
|
||||
'buy' => 'require',
|
||||
'warehouse' => 'require',
|
||||
'stocktip' => 'require',
|
||||
'imgs' => 'require',
|
||||
];
|
||||
|
||||
|
||||
@ -35,11 +39,14 @@ class GoodsValidate extends BaseValidate
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'name' => '商品名称',
|
||||
'py' => '首拼字母',
|
||||
'class' => '商品分类',
|
||||
'brand' => '商品品牌',
|
||||
'spec' => '规格型号',
|
||||
'unit' => '商品单位',
|
||||
'warehouse' => '默认仓库',
|
||||
'sys_labels' => '标签',
|
||||
'buy' => '购货价格',
|
||||
'warehouse' => '默认仓库',
|
||||
'stocktip' => '库存阈值',
|
||||
'imgs' => '商品图片',
|
||||
];
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace app\admin\validate\merchant;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use function Symfony\Component\Translation\t;
|
||||
|
||||
|
||||
/**
|
||||
@ -34,6 +35,7 @@ class MerchantValidate extends BaseValidate
|
||||
'mer_money' => 'require|float',
|
||||
'commission_switch' => 'in:0,1',
|
||||
'financial_type' => 'in:1,2,3',
|
||||
'bind_data' => 'require|checkBindData'
|
||||
];
|
||||
|
||||
|
||||
@ -57,6 +59,7 @@ class MerchantValidate extends BaseValidate
|
||||
'mer_money' => '商户余额',
|
||||
'commission_switch' => '商户手续费单独设置',
|
||||
'financial_type' => '默认使用类型',
|
||||
'bind_data' => '绑定商品数据'
|
||||
];
|
||||
|
||||
|
||||
@ -68,7 +71,7 @@ class MerchantValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('mer_id',true);
|
||||
return $this->remove('mer_id',true)->remove('bind_data',true);
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +82,9 @@ class MerchantValidate extends BaseValidate
|
||||
* @date 2024/04/23 16:35
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{}
|
||||
{
|
||||
return $this->remove('bind_data',true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -104,5 +109,12 @@ class MerchantValidate extends BaseValidate
|
||||
{
|
||||
return $this->only(['mer_id']);
|
||||
}
|
||||
|
||||
public function checkBindData($value){
|
||||
if(!is_array($value)){
|
||||
return '数据格式错误';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -42,12 +42,14 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI
|
||||
$supplier_id=$this->request->userInfo['supplier']['id'] ?? 0;
|
||||
$params = $this->request->get();
|
||||
if(isset($params['type']) && $params['type'] == 2){
|
||||
$where[] = ['price','<>',''];
|
||||
$where[] = ['price','<>',0];
|
||||
$where[] = ['is_adopt','<>',0];
|
||||
}else{
|
||||
$where[] = ['price','=',''];
|
||||
$where[] = ['is_adopt','=',0];
|
||||
}
|
||||
if(!$supplier_id) return [];
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->where('is_adopt',0)
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)
|
||||
->with('goods')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
|
@ -15,6 +15,7 @@ class OpurchaseGoodsOfferLogic extends BaseLogic{
|
||||
OpurchaseGoodsOffer::where('id',$v['id'])->update([
|
||||
'price' => $v['price'],
|
||||
'nums' => $v['nums'],
|
||||
'is_adopt' => 1,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ class OpurchaseGoodsOffer extends BaseModel
|
||||
|
||||
public function getIsAdoptTextAttr($value,$data): string
|
||||
{
|
||||
return $data['is_adopt'] == 0 ? '未成交' : '已成交';
|
||||
$arr = [0=>'待报价', 1=>'已报价', 2=>'已采纳', 3=>'未采纳'];
|
||||
return $arr[$data['is_adopt']];
|
||||
}
|
||||
|
||||
public function goods()
|
||||
|
Loading…
x
Reference in New Issue
Block a user