feat: 修改了支付方式相关的枚举和列表搜索功能,并更新了商品订单和门店流水相关的逻辑。

This commit is contained in:
mkm 2024-06-03 16:43:43 +08:00
parent 3a82a0f435
commit fa84702c3b
5 changed files with 44 additions and 66 deletions

View File

@ -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 获取门店流水详情 * @notes 获取门店流水详情

View File

@ -4,9 +4,13 @@ namespace app\admin\lists\store_finance_flow;
use app\admin\lists\BaseAdminDataLists; 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\model\store_finance_flow\StoreFinanceFlow;
use app\common\lists\ListsSearchInterface; 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 public function setSearch(): array
{ {
return [ 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 public function lists(): array
{ {
return StoreFinanceFlow::where($this->searchWhere) return FinancialRecord::where($this->searchWhere)
->field(['id', 'uid', 'staff_id', 'order_id', 'link_id', 'type', 'pay_type', 'remark', 'trade_time'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->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(); ->toArray();
} }

View File

@ -4,6 +4,7 @@ namespace app\admin\lists\store_order;
use app\admin\lists\BaseAdminDataLists; use app\admin\lists\BaseAdminDataLists;
use app\common\enum\PayEnum;
use app\common\model\store_order\StoreOrder; use app\common\model\store_order\StoreOrder;
use app\common\lists\ListsSearchInterface; 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']) ->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()->each(function($item){
$item['pay_type_name']=PayEnum::getPaySceneDesc($item['pay_type']);
return $item;
})
->toArray(); ->toArray();
} }

View File

@ -212,6 +212,7 @@ class StoreProductLogic extends BaseLogic
'bar_code' => $find['bar_code'], 'bar_code' => $find['bar_code'],
'cate_id' => $find['cate_id'], 'cate_id' => $find['cate_id'],
'price' => $find['price'], 'price' => $find['price'],
'unit' => $find['unit'],
'store_id' => $store_id, 'store_id' => $store_id,
'sales' => 0, 'sales' => 0,
'stock' => $stock, 'stock' => $stock,

View File

@ -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 获取支付类型 * @notes 获取支付类型
* @param bool $value * @param bool $value
@ -116,11 +108,22 @@ class PayEnum
public static function getPaySceneDesc($value = true) public static function getPaySceneDesc($value = true)
{ {
$data = [ $data = [
self::SCENE_H5 => 'H5', self::WECHAT_PAY_H5 => '微信H5',
self::SCENE_OA => '微信公众号', self::WECHAT_PAY_JSAPI => '微信JSAPI',
self::SCENE_MNP => '微信小程序', self::WECHAT_PAY_MINI => '微信小程序',
self::SCENE_APP => 'APP', self::WECHAT_PAY_APP => '微信APP',
self::SCENE_PC => 'PC', 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) { if ($value === true) {
return $data; return $data;