Merge branch 'main' of https://gitea.lihaink.cn/mkm/multi-store
This commit is contained in:
commit
cc0a84b1b8
@ -30,53 +30,6 @@ class StoreFinanceFlowController extends BaseAdminController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加门店流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:56
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new StoreFinanceFlowValidate())->post()->goCheck('add');
|
||||
$result = StoreFinanceFlowLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(StoreFinanceFlowLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑门店流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:56
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new StoreFinanceFlowValidate())->post()->goCheck('edit');
|
||||
$result = StoreFinanceFlowLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(StoreFinanceFlowLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除门店流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 16:56
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new StoreFinanceFlowValidate())->post()->goCheck('delete');
|
||||
StoreFinanceFlowLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店流水详情
|
||||
|
@ -4,9 +4,13 @@ namespace app\admin\lists\store_finance_flow;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
use app\common\model\financial_record\FinancialRecord;
|
||||
use app\common\model\system_store\SystemStoreStaff;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 门店流水列表
|
||||
@ -26,7 +30,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id', 'uid', 'create_time'],
|
||||
'=' => ['store_id', 'user_id', 'create_time'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -42,11 +46,24 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreFinanceFlow::where($this->searchWhere)
|
||||
->field(['id', 'uid', 'staff_id', 'order_id', 'link_id', 'type', 'pay_type', 'remark', 'trade_time'])
|
||||
return FinancialRecord::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->select()->each(function ($item) {
|
||||
if($item['user_id']<=0){
|
||||
$item['nickname']='游客';
|
||||
}else{
|
||||
$item['nickname']=User::where('id',$item['user_id'])->value('nickname');
|
||||
}
|
||||
if($item['financial_pm']==0){
|
||||
$item['number']='-'.$item['number'];
|
||||
}else{
|
||||
$item['number']='+'.$item['number'];
|
||||
}
|
||||
$item['staff_name']=SystemStoreStaff::where('id',$item['staff_id'])->value('staff_name');
|
||||
$item['pay_type_name']=PayEnum::getPaySceneDesc($item['pay_type']);
|
||||
$item['financial_type_name']=OrderEnum::getFinancialType($item['financial_type']);
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace app\admin\lists\store_order;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
@ -46,7 +47,10 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->select()->each(function($item){
|
||||
$item['pay_type_name']=PayEnum::getPaySceneDesc($item['pay_type']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,7 @@ class StoreProductLogic extends BaseLogic
|
||||
'bar_code' => $find['bar_code'],
|
||||
'cate_id' => $find['cate_id'],
|
||||
'price' => $find['price'],
|
||||
'unit' => $find['unit'],
|
||||
'store_id' => $store_id,
|
||||
'sales' => 0,
|
||||
'stock' => $stock,
|
||||
|
@ -30,8 +30,8 @@ class SystemStoreLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password=create_password($params['password'], $passwordSalt);
|
||||
$store=SystemStore::create([
|
||||
$password = create_password($params['password'], $passwordSalt);
|
||||
$store = SystemStore::create([
|
||||
'name' => $params['name'],
|
||||
'introduction' => $params['introduction'],
|
||||
'phone' => $params['phone'],
|
||||
@ -47,15 +47,15 @@ class SystemStoreLogic extends BaseLogic
|
||||
'area' => $params['area_code'],
|
||||
'street' => $params['street_code'],
|
||||
]);
|
||||
$taff=[
|
||||
'store_id'=>$store['id'],
|
||||
'account'=>$params['phone'],
|
||||
'pwd'=>$password,
|
||||
'avatar'=>$params['image'],
|
||||
'staff_name'=>$params['name'],
|
||||
'phone'=>$params['phone'],
|
||||
'is_admin'=>1,
|
||||
'status'=>1,
|
||||
$taff = [
|
||||
'store_id' => $store['id'],
|
||||
'account' => $params['phone'],
|
||||
'pwd' => $password,
|
||||
'avatar' => $params['image'],
|
||||
'staff_name' => $params['name'],
|
||||
'phone' => $params['phone'],
|
||||
'is_admin' => 1,
|
||||
'status' => 1,
|
||||
|
||||
];
|
||||
SystemStoreStaff::create($taff);
|
||||
@ -80,16 +80,31 @@ class SystemStoreLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
SystemStore::where('id', $params['id'])->update([
|
||||
$store = SystemStore::where('id',$params['id'])->update([
|
||||
'name' => $params['name'],
|
||||
'introduction' => $params['introduction'],
|
||||
'phone' => $params['phone'],
|
||||
'detailed_address' => $params['detailed_address'],
|
||||
'image' => $params['image'],
|
||||
'latitude' => $params['latitude'],
|
||||
'is_show' => $params['is_show'],
|
||||
'longitude' => $params['longitude'],
|
||||
'is_show' => $params['is_show']
|
||||
'latitude' => $params['latitude'],
|
||||
'day_start' => $params['day_start'],
|
||||
'day_end' => $params['day_end'],
|
||||
'province' => $params['province_code'],
|
||||
'city' => $params['city_code'],
|
||||
'area' => $params['area_code'],
|
||||
'street' => $params['street_code'],
|
||||
]);
|
||||
if($params['password']!=''){
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password = create_password($params['password'], $passwordSalt);
|
||||
$taff = [
|
||||
'pwd' => $password,
|
||||
'avatar' => $params['image'],
|
||||
'staff_name' => $params['name'],
|
||||
];
|
||||
SystemStoreStaff::where('store_id', $params['id'])->where('is_admin', 1)->where('account', $params['phone'])->update($taff);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
@ -125,4 +140,4 @@ class SystemStoreLogic extends BaseLogic
|
||||
{
|
||||
return SystemStore::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\retail\Cashierinfo;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
|
||||
/**
|
||||
* 零售订单列表
|
||||
@ -45,12 +47,12 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
$userId=$this->request->userId;
|
||||
if(!$userId) return [];
|
||||
return Cashierclass::where($this->searchWhere)->where('uid',$userId)
|
||||
return StoreOrder::where($this->searchWhere)->where('uid',$userId)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->each(function($item){
|
||||
$item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(3)->select();
|
||||
$item['goods_list']=StoreOrderCartInfo::where('oid',$item['id'])->with('goodsName')->field('product_id,cart_num')->limit(3)->select();
|
||||
$item['goods_count']=count(explode(',',$item['cart_id']));
|
||||
})
|
||||
->toArray();
|
||||
@ -64,7 +66,7 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Cashierclass::where($this->searchWhere)->count();
|
||||
return StoreOrder::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -112,26 +112,14 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
|
||||
}
|
||||
$where[]=['store_id','=',$store_id];
|
||||
$data =StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time'])
|
||||
return StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className'])
|
||||
->with(['className','unitName'])
|
||||
->order($order)
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($data as $k=> &$v){
|
||||
$info= StoreProduct::alias('p')
|
||||
->leftJoin('store_product_unit t','t.id = p.unit')
|
||||
->where('p.id',$v['product_id'])
|
||||
->field('p.unit,t.name,t.is_bulk')->find()??[];
|
||||
if($info){
|
||||
$v['unit_name'] = $info['name']??'';
|
||||
$v['is_bulk'] = $info['is_bulk']??'';
|
||||
}else{
|
||||
unset($data[$k]);
|
||||
}
|
||||
}
|
||||
return array_values($data);
|
||||
|
||||
// return StoreProduct::where($this->searchWhere)->where($where)
|
||||
// ->field(['id', 'cate_id','store_name','unit', 'ot_price', 'bar_code','image','sales','store_info'])
|
||||
// ->limit($this->limitOffset, $this->limitLength)
|
||||
@ -191,23 +179,12 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
$where[]=['store_id','=',$store_id];
|
||||
|
||||
$data =StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'product_id'])
|
||||
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className','unitName'])
|
||||
->order($order)
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($data as $k=> &$v){
|
||||
$info= StoreProduct::alias('p')
|
||||
->leftJoin('store_product_unit t','t.id = p.unit')
|
||||
->where('p.id',$v['product_id'])
|
||||
->field('p.unit,t.name,t.is_bulk')->find()??[];
|
||||
if($info){
|
||||
$v['unit_name'] = $info['name']??'';
|
||||
$v['is_bulk'] = $info['is_bulk']??'';
|
||||
}else{
|
||||
unset($data[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return count($data);
|
||||
}
|
||||
|
@ -56,14 +56,6 @@ class PayEnum
|
||||
|
||||
|
||||
|
||||
//支付场景
|
||||
const SCENE_H5 = 1; //H5
|
||||
const SCENE_OA = 2; //微信公众号
|
||||
const SCENE_MNP = 3; //微信小程序
|
||||
const SCENE_APP = 4; //APP
|
||||
const SCENE_PC = 5; //PC商城
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取支付类型
|
||||
* @param bool $value
|
||||
@ -116,11 +108,22 @@ class PayEnum
|
||||
public static function getPaySceneDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::SCENE_H5 => 'H5',
|
||||
self::SCENE_OA => '微信公众号',
|
||||
self::SCENE_MNP => '微信小程序',
|
||||
self::SCENE_APP => 'APP',
|
||||
self::SCENE_PC => 'PC',
|
||||
self::WECHAT_PAY_H5 => '微信H5',
|
||||
self::WECHAT_PAY_JSAPI => '微信JSAPI',
|
||||
self::WECHAT_PAY_MINI => '微信小程序',
|
||||
self::WECHAT_PAY_APP => '微信APP',
|
||||
self::ALIPAY_H5 => '支付宝H5',
|
||||
self::ALIPAY_MINI => '支付宝小程序',
|
||||
self::ALIPAY_APP => '支付宝APP',
|
||||
self::GOODS_FIRST_PAYMENT_LATER => '货到付款',
|
||||
self::CORPORATE_TRANSFER => '企业转账',
|
||||
self::CASH_PAY => '现金支付',
|
||||
self::WECHAT_PAY_QRCODE => '微信二维码',
|
||||
self::WECHAT_PAY_BARCODE => '微信条码',
|
||||
self::ALIPAY_QRCODE => '支付宝二维码',
|
||||
self::ALIPAY_BARCODE => '支付宝条码',
|
||||
self::BALANCE_PAY => '余额支付',
|
||||
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
|
@ -23,6 +23,11 @@ class StoreBranchProduct extends BaseModel
|
||||
|
||||
|
||||
|
||||
public function unitName()
|
||||
{
|
||||
return $this->hasOne(StoreProductUnit::class,'id','unit')->bind(['unit_name'=>'name','is_bulk']);
|
||||
}
|
||||
|
||||
|
||||
public function className()
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace app\common\model\store_order_cart_info;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class StoreOrderCartInfo extends BaseModel
|
||||
@ -14,6 +14,6 @@ class StoreOrderCartInfo extends BaseModel
|
||||
|
||||
public function goodsName()
|
||||
{
|
||||
return $this->hasOne(StoreProduct::class,'id','product_id')->bind(['store_name','image','unit','price']);
|
||||
return $this->hasOne(StoreBranchProduct::class,'id','product_id')->bind(['store_name','image','unit','price']);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user