commit
0ea88df531
@ -8,6 +8,8 @@ use app\admin\controller\BaseAdminController;
|
|||||||
use app\admin\lists\user\UserLists;
|
use app\admin\lists\user\UserLists;
|
||||||
use app\admin\logic\user\UserLogic;
|
use app\admin\logic\user\UserLogic;
|
||||||
use app\admin\validate\user\UserValidate;
|
use app\admin\validate\user\UserValidate;
|
||||||
|
use app\api\lists\user_sign\UserSignLists;
|
||||||
|
use app\api\lists\user_sign_log\UserSignLogLists;
|
||||||
|
|
||||||
class UserController extends BaseAdminController
|
class UserController extends BaseAdminController
|
||||||
{
|
{
|
||||||
@ -82,6 +84,19 @@ class UserController extends BaseAdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼品券/冻结券
|
||||||
|
*/
|
||||||
|
public function userSing()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new UserSignLogLists());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//用户领取列表
|
//用户领取列表
|
||||||
public function userGiftList()
|
public function userGiftList()
|
||||||
{
|
{
|
||||||
|
@ -75,69 +75,30 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
if (!empty($this->request->adminInfo['store_id'])) {
|
if (!empty($this->request->adminInfo['store_id'])) {
|
||||||
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
//厨师判断 other_uid不为空 user_ship=1厨师
|
||||||
|
$cookCheck = 0;
|
||||||
|
if(!empty($item['other_uid']) && $item['other_uid'] >0){
|
||||||
|
$cookCheck = User::where('id', $item['other_uid'])->value('user_ship')??0;
|
||||||
|
}
|
||||||
if ($item['financial_pm'] == 0) {
|
if ($item['financial_pm'] == 0) {
|
||||||
$item['number'] = '-' . $item['number'];
|
$item['number'] = '-' . $item['number'];
|
||||||
$item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']);
|
$Identity = OrderEnum::getFinancialType($item['financial_type']);
|
||||||
|
if($cookCheck == 1 && $item['financial_type'] ==12){
|
||||||
|
$Identity ="厨师";
|
||||||
|
}
|
||||||
|
$item['financial_type_name'] = '订单支出:' .$Identity;
|
||||||
} else {
|
} else {
|
||||||
$item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得';
|
$Identity = OrderEnum::getFinancialType($item['financial_type']);
|
||||||
|
if($cookCheck == 1 && $item['financial_type'] ==12){
|
||||||
|
$Identity ="厨师";
|
||||||
|
}
|
||||||
|
$item['financial_type_name'] = $Identity . '获得';
|
||||||
$item['number'] = '+' . $item['number'];
|
$item['number'] = '+' . $item['number'];
|
||||||
}
|
}
|
||||||
$item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');
|
$item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');
|
||||||
$item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
|
$item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
|
||||||
$item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
|
$item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
// foreach ($data as $key => $item) {
|
|
||||||
// $list1 = StoreFinanceFlow::where('order_id', $item['order_id'])->where('financial_type', '>', 1)->field($field)->select()->each(function ($item) {
|
|
||||||
// if ($item['user_id'] <= 0) {
|
|
||||||
// $item['nickname'] = '游客';
|
|
||||||
// } else {
|
|
||||||
// $id = $item['user_id'];
|
|
||||||
// $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id";
|
|
||||||
// }
|
|
||||||
// if (!empty($this->request->adminInfo['store_id'])) {
|
|
||||||
// $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
|
||||||
// }
|
|
||||||
// if ($item['financial_pm'] == 0) {
|
|
||||||
// $item['number'] = '-' . $item['number'];
|
|
||||||
// $item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']);
|
|
||||||
// } else {
|
|
||||||
// $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得';
|
|
||||||
// $item['number'] = '+' . $item['number'];
|
|
||||||
// }
|
|
||||||
// $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');
|
|
||||||
// $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
|
|
||||||
// $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
|
|
||||||
// });
|
|
||||||
// $list2 = UserSign::where('order_id', $item['order_sn'])->whereIn('user_ship', [0, 2, 3])->select();
|
|
||||||
// foreach ($list2 as $k => $v) {
|
|
||||||
// $list2[$k]['id'] = 'JF' . $v['id'];
|
|
||||||
// $list2[$k]['order_sn'] = $item['order_sn'];
|
|
||||||
// $list2[$k]['store_name'] = $item['store_name'];
|
|
||||||
// if($v['user_ship']==0){
|
|
||||||
// $list2[$k]['financial_pm'] = 1;
|
|
||||||
// $list2[$k]['number'] = '+' . $v['number'];
|
|
||||||
// }else{
|
|
||||||
// if($v['financial_pm']==1){
|
|
||||||
// $list2[$k]['financial_pm'] = 1;
|
|
||||||
// $list2[$k]['number'] = '+' . $v['number'];
|
|
||||||
// }else{
|
|
||||||
// $list2[$k]['financial_pm'] = 0;
|
|
||||||
// $list2[$k]['number'] = '-' . $v['number'];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $list2[$k]['nickname'] = $v['uid'] > 0 ? User::where('id', $v['uid'])->value('nickname') . '|' . $v['uid'] : '游客';
|
|
||||||
// $list2[$k]['financial_type_name'] = $v['title'];
|
|
||||||
// $list2[$k]['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
|
|
||||||
// }
|
|
||||||
// $list3 = array_merge($list1->toArray(), $list2->toArray());
|
|
||||||
// // 提取 financial_pm 字段到单独的数组
|
|
||||||
// $financial_pm = array_column($list3, 'financial_pm');
|
|
||||||
|
|
||||||
// // 对 financial_pm 数组进行排序,这将影响原始数组
|
|
||||||
// array_multisort($financial_pm, SORT_ASC, $list3);
|
|
||||||
// $data[$key]['list']=$list3;
|
|
||||||
// }
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,15 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
return StoreOrderCartInfo::where($this->searchWhere)
|
return StoreOrderCartInfo::where($this->searchWhere)
|
||||||
->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength)
|
->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength)
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
$find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name')->find();
|
$find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name,store_info')->find();
|
||||||
if($find){
|
if($find){
|
||||||
$item['image']=$find['image'];//商品图片
|
$item['image']=$find['image'];//商品图片
|
||||||
$item['store_name']=$find['store_name'];//商品名称
|
$item['store_name']=$find['store_name'];//商品名称
|
||||||
|
$item['store_info']=$find['store_info'];//商品规格
|
||||||
}else{
|
}else{
|
||||||
$item['image']='';//商品图片
|
$item['image']='';//商品图片
|
||||||
$item['store_name']='';//商品名称
|
$item['store_name']='';//商品名称
|
||||||
|
$item['store_info']='';//商品规格-(数据库叫商品简介)
|
||||||
}
|
}
|
||||||
return $item; //返回处理后的数据。
|
return $item; //返回处理后的数据。
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,7 @@ namespace app\admin\lists\user_product_storage_log;
|
|||||||
|
|
||||||
|
|
||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
use app\common\model\user_product_storage_log\UserProductStorageLog;
|
use app\common\model\user_product_storage_log\UserProductStorageLog;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
@ -28,6 +29,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'=' => ['uid', 'oid', 'product_id','status','store_id'],
|
||||||
'between_time' => ['create_time'],
|
'between_time' => ['create_time'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -44,20 +46,44 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
|
$store_id = $this->request->get('store_id','');
|
||||||
|
$order_sn = $this->request->get('order_sn','');
|
||||||
|
$order = StoreOrder::where('store_id',$store_id)
|
||||||
|
->where('order_id','like','%'.$order_sn.'%')->column('id');
|
||||||
|
if($order){
|
||||||
|
$where[]=['oid','in',$order];
|
||||||
|
$this->searchWhere[]=$where;
|
||||||
|
}
|
||||||
|
|
||||||
return UserProductStorageLog::where($this->searchWhere)
|
return UserProductStorageLog::where($this->searchWhere)
|
||||||
->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums'])
|
->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums','times','update_time'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$user=User::where('id',$item['uid'])->field('nickname,real_name')->find();
|
$user=User::where('id',$item['uid'])->field('nickname,real_name,mobile')->find();
|
||||||
$item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
|
$item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
|
||||||
$item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
|
$item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
|
||||||
$item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
|
$item['mobile'] = $user['mobile']??'';
|
||||||
|
$goods = StoreProduct::where('id',$item['product_id'])->field('store_name,image,store_info,price')->withTrashed()->find();
|
||||||
|
$item['store_name']=$goods['store_name']??'';
|
||||||
|
$item['store_name_img']=$goods['image']??'';
|
||||||
|
$item['store_info']=$goods['store_info']??'';//规格
|
||||||
|
$item['price']=$goods['price']??'';
|
||||||
|
$order = StoreOrder::where('id',$item['oid'])->withTrashed()->field('order_id,verify_code,verify_img')->find();
|
||||||
|
$item['verify_code'] = $order['verify_code']??'';
|
||||||
|
$item['order_id'] = $order['order_id']??'';
|
||||||
|
$item['verify_img'] = '';
|
||||||
|
if($order['verify_img']){
|
||||||
|
$item['verify_img'] = 'https://'.$this->request->host(true).$order['verify_img'];
|
||||||
|
}
|
||||||
if($item['financial_pm']==1){
|
if($item['financial_pm']==1){
|
||||||
$item['financial_pm']='增加';
|
$item['financial_pm']='增加';
|
||||||
}else{
|
}else{
|
||||||
$item['financial_pm']='减少';
|
$item['financial_pm']='减少';
|
||||||
}
|
}
|
||||||
|
if($item['times']){
|
||||||
|
$item['times']=date('Y-m-d H:i:s',$item['times']);
|
||||||
|
}
|
||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -283,6 +283,15 @@ class UserLogic extends BaseLogic
|
|||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'],$params['page_size'])
|
||||||
->order('id','desc')
|
->order('id','desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
|
foreach ($data as &$value){
|
||||||
|
if($value['status'] == 0){
|
||||||
|
$value['title'] = "购买商品".$value['all']."元获得".$value['number']."元返还金";
|
||||||
|
}else{
|
||||||
|
//退回到余额、微信、采购款
|
||||||
|
$back = self::dealTitleCate($value['pay_type']);
|
||||||
|
$value['title'] = "返还金解冻".$value['number']."元退回到".$back;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -309,4 +318,29 @@ class UserLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function dealTitleCate($pay_type)
|
||||||
|
{
|
||||||
|
switch ($pay_type){
|
||||||
|
case 18:
|
||||||
|
$title = "采购款";
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
$title = "现金";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$title ="余额";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
case 9:
|
||||||
|
$title ="微信";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
$title ="支付宝";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$title ="默认";
|
||||||
|
}
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller\user_product_storage_log;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\user_product_storage_log\UserProductStorageLogLists;
|
||||||
|
use app\api\controller\BaseApiController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户商品储存控制器
|
||||||
|
* Class UserProductStorageLogController
|
||||||
|
* @package app\admin\controller\user_product_storage_log
|
||||||
|
*/
|
||||||
|
class UserProductStorageLogController extends BaseApiController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取用户商品日志列表
|
||||||
|
* @return
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/28 11:05
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new UserProductStorageLogLists());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,6 +25,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
protected $total_price = 0;
|
protected $total_price = 0;
|
||||||
protected $activity_price = 0;
|
protected $activity_price = 0;
|
||||||
protected $off_activity = 0;
|
protected $off_activity = 0;
|
||||||
|
protected $user_ship = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +64,11 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
|
$user_ship = User::where('id', $userId)->value('user_ship');
|
||||||
|
if (in_array($user_ship, [4, 5, 6, 7])) {
|
||||||
|
$off_activity=1;
|
||||||
|
}
|
||||||
|
$this->user_ship=$user_ship;
|
||||||
$this->off_activity=$off_activity;
|
$this->off_activity=$off_activity;
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
||||||
@ -108,19 +114,24 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
$data= [
|
$data= [
|
||||||
'off_activity' => $this->off_activity,
|
'off_activity' => $this->off_activity,
|
||||||
'total_price' => $this->total_price,
|
'total_price' => $this->total_price,
|
||||||
'msg' => '您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。',
|
'msg' => '',
|
||||||
'pay_price' => $this->total_price
|
'pay_price' => $this->total_price
|
||||||
];
|
];
|
||||||
if($this->off_activity==0){//1
|
if($this->user_ship==0){
|
||||||
$this->activity_price = $this->total_price;
|
$data['msg']='您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
|
}
|
||||||
|
if($this->off_activity==1){//1
|
||||||
$data['pay_price']=$this->activity_price;
|
$data['pay_price']=$this->activity_price;
|
||||||
if($this->activity_price<500){
|
if($this->activity_price<500){
|
||||||
|
if($this->user_ship==0){
|
||||||
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
$data['pay_price']= $this->activity_price;
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if($this->user_ship==0){
|
||||||
$data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
|
$data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['paid', 'status', 'is_writeoff'],
|
'=' => ['paid', 'status', 'is_writeoff','reservation'],
|
||||||
'between_time' => 'create_time',
|
'between_time' => 'create_time',
|
||||||
'%like%' => ['order_id'],
|
'%like%' => ['order_id'],
|
||||||
];
|
];
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace app\api\lists\product;
|
namespace app\api\lists\product;
|
||||||
|
|
||||||
|
|
||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\api\lists\BaseApiDataLists;
|
||||||
use app\common\lists\ListsExtendInterface;
|
use app\common\lists\ListsExtendInterface;
|
||||||
use app\common\lists\ListsSortInterface;
|
use app\common\lists\ListsSortInterface;
|
||||||
use app\common\model\dict\DictType;
|
use app\common\model\dict\DictType;
|
||||||
@ -12,6 +12,7 @@ use app\common\model\store_product\StoreProduct;
|
|||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\cate\Cate;
|
use app\common\model\cate\Cate;
|
||||||
use app\common\model\Config;
|
use app\common\model\Config;
|
||||||
|
use app\common\model\user\User;
|
||||||
//use app\common\model\goods\GoodsLabel;
|
//use app\common\model\goods\GoodsLabel;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
@ -20,9 +21,10 @@ use think\facade\Db;
|
|||||||
* Class goods
|
* Class goods
|
||||||
* @package app\api\goods
|
* @package app\api\goods
|
||||||
*/
|
*/
|
||||||
class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface
|
class ProductLists extends BaseApiDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface
|
||||||
{
|
{
|
||||||
|
protected $off_activity = 0;
|
||||||
|
protected $user_ship = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
@ -36,7 +38,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
'=' => ['store_id', 'cate_id', 'top_cate_id', 'two_cate_id'],
|
'=' => ['store_id', 'cate_id', 'top_cate_id', 'two_cate_id'],
|
||||||
'%pipe_like%' => ['store_name' => 'store_name|bar_code'],
|
'%pipe_like%' => ['store_name' => 'store_name|bar_code'],
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @notes 设置支持排序字段
|
* @notes 设置支持排序字段
|
||||||
@ -71,17 +72,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
// $class_all = $this->request->get('class_all');
|
|
||||||
// if ($class_all) {
|
|
||||||
// //查3级别的
|
|
||||||
// $arr = Cate::where('pid', $class_all)->column('id');
|
|
||||||
// if ($arr) {
|
|
||||||
// $arr2 = Cate::where('pid', 'in', $arr)->column('id');
|
|
||||||
// $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
|
|
||||||
// } else {
|
|
||||||
// $this->searchWhere[] = ['cate_id', '=', $class_all];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
$order = $this->request->get('order', '');
|
$order = $this->request->get('order', '');
|
||||||
$field = $this->request->get('field', '');
|
$field = $this->request->get('field', '');
|
||||||
if (empty($order) || empty($field)) {
|
if (empty($order) || empty($field)) {
|
||||||
@ -90,7 +80,20 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
$order = [$field => $order];
|
$order = [$field => $order];
|
||||||
}
|
}
|
||||||
$fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
|
$fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
|
||||||
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
|
$uid=0;
|
||||||
|
if($this->request->get('uid',0)>0){
|
||||||
|
$uid=$this->request->get('uid',0);
|
||||||
|
}elseif( $this->userId > 0){
|
||||||
|
$uid=$this->userId;
|
||||||
|
}
|
||||||
|
if ($uid>0) {
|
||||||
|
$user_ship = User::where('id', $uid)->value('user_ship');
|
||||||
|
if (in_array($user_ship, [4, 5, 6, 7])) {
|
||||||
|
$off_activity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->off_activity = $off_activity;
|
||||||
$this->searchWhere[] = ['status', '=', 1];
|
$this->searchWhere[] = ['status', '=', 1];
|
||||||
// $this->searchWhere[] = ['stock', '>', 0];
|
// $this->searchWhere[] = ['stock', '>', 0];
|
||||||
return StoreBranchProduct::where($this->searchWhere)
|
return StoreBranchProduct::where($this->searchWhere)
|
||||||
@ -99,7 +102,11 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order($order)
|
->order($order)
|
||||||
// ->page($this->limitOffset +1,$this->limitLength)
|
// ->page($this->limitOffset +1,$this->limitLength)
|
||||||
->select()->toArray();
|
->select()->each(function ($item) {
|
||||||
|
$item['tag']=' 赠10%品牌礼品券 ';
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,20 +123,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
}
|
}
|
||||||
public function extend()
|
public function extend()
|
||||||
{
|
{
|
||||||
// $off_activity = Config::where('name', 'off_activity')->value('value');
|
$price = 'price';
|
||||||
// if($off_activity==1){
|
$op_price = 'price';
|
||||||
// $data=[
|
if ($this->off_activity == 1) {
|
||||||
// 'off_activity' => $off_activity,
|
$price = 'cost';
|
||||||
// 'price' => 'cost',
|
$op_price = 'price';
|
||||||
// 'op_price' => 'price',
|
}
|
||||||
// ];
|
|
||||||
// }else{
|
|
||||||
$data = [
|
$data = [
|
||||||
'off_activity' => 0,
|
'off_activity' => $this->off_activity,
|
||||||
'price' => 'price',
|
'price' => $price,
|
||||||
'op_price' => 'price',
|
'op_price' => $op_price,
|
||||||
];
|
];
|
||||||
// }
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,17 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
if($latitude && $longitude){
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value){
|
||||||
$value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude);
|
$value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
foreach ($data as &$values){
|
||||||
|
$values['distance'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($data, function ($a, $b) {
|
usort($data, function ($a, $b) {
|
||||||
|
@ -47,6 +47,7 @@ class UserSignLogLists extends BaseApiDataLists implements ListsSearchInterface
|
|||||||
{
|
{
|
||||||
$type=$this->request->get('type',1);
|
$type=$this->request->get('type',1);
|
||||||
$mark=$this->request->get('mark','');
|
$mark=$this->request->get('mark','');
|
||||||
|
$uid=$this->request->get('uid','');
|
||||||
if($type==1){
|
if($type==1){
|
||||||
$this->searchWhere[]=['type','in',[1,7,3]];
|
$this->searchWhere[]=['type','in',[1,7,3]];
|
||||||
$this->searchWhere[]=['status','=',1];
|
$this->searchWhere[]=['status','=',1];
|
||||||
@ -56,7 +57,11 @@ class UserSignLogLists extends BaseApiDataLists implements ListsSearchInterface
|
|||||||
}elseif($mark==2){
|
}elseif($mark==2){
|
||||||
$this->searchWhere[]=['financial_pm','=',0];
|
$this->searchWhere[]=['financial_pm','=',0];
|
||||||
}
|
}
|
||||||
|
if($uid){
|
||||||
|
$this->searchWhere[]=['uid','=',$uid];
|
||||||
|
}else{
|
||||||
$this->searchWhere[]=['uid','=',$this->userId];
|
$this->searchWhere[]=['uid','=',$this->userId];
|
||||||
|
}
|
||||||
$list=UserSignLog::where($this->searchWhere)->order('id desc')
|
$list=UserSignLog::where($this->searchWhere)->order('id desc')
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->select()->each(function ($item){
|
->select()->each(function ($item){
|
||||||
|
@ -21,6 +21,7 @@ use app\common\model\store_order\StoreOrder;
|
|||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
|
use app\common\model\store_product_log\StoreProductLog;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\system_store\SystemStoreStaff;
|
use app\common\model\system_store\SystemStoreStaff;
|
||||||
@ -83,21 +84,21 @@ class OrderLogic extends BaseLogic
|
|||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id';
|
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id';
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find();
|
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
||||||
if (!$find) {
|
if (!$find) {
|
||||||
// unset($cart_select[$k]);
|
// unset($cart_select[$k]);
|
||||||
// continue;
|
// continue;
|
||||||
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id';
|
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id';
|
||||||
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->withTrashed()->find();
|
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
||||||
$cart_select[$k]['status'] = 1; //缺货标识
|
$cart_select[$k]['status'] = 1; //缺货标识
|
||||||
}
|
}
|
||||||
unset($cart_select[$k]['id']);
|
unset($cart_select[$k]['id']);
|
||||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||||
// if ($off_activity == 1) {
|
if ($off_activity == 1 || in_array($user['user_ship'], [4, 5, 6, 7])) {
|
||||||
// $price = $find['cost'];
|
$price = $find['cost'];
|
||||||
// } else {
|
} else {
|
||||||
$price = $find['price'];
|
$price = $find['price'];
|
||||||
// }
|
}
|
||||||
$cart_select[$k]['price'] = $price;
|
$cart_select[$k]['price'] = $price;
|
||||||
$cart_select[$k]['cost'] = $find['cost'];
|
$cart_select[$k]['cost'] = $find['cost'];
|
||||||
$cart_select[$k]['vip'] = 0;
|
$cart_select[$k]['vip'] = 0;
|
||||||
@ -529,6 +530,13 @@ class OrderLogic extends BaseLogic
|
|||||||
'store_id' => $params['store_id'],
|
'store_id' => $params['store_id'],
|
||||||
'staff_id' => $params['staff_id'] ?? 0,
|
'staff_id' => $params['staff_id'] ?? 0,
|
||||||
], ['id' => $order['id']]);
|
], ['id' => $order['id']]);
|
||||||
|
//修改商品统计记录标识
|
||||||
|
(new StoreProductLog())->update(
|
||||||
|
[
|
||||||
|
'store_id' => $params['store_id']
|
||||||
|
],
|
||||||
|
['oid' => $order['id']]
|
||||||
|
);
|
||||||
(new StoreOrderCartInfo())->update([
|
(new StoreOrderCartInfo())->update([
|
||||||
'verify_code' => $params['verify_code'] . '-1',
|
'verify_code' => $params['verify_code'] . '-1',
|
||||||
'writeoff_time' => time(),
|
'writeoff_time' => time(),
|
||||||
@ -552,7 +560,7 @@ class OrderLogic extends BaseLogic
|
|||||||
$financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']);
|
$financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 11])->value('number') ?? 0;
|
$deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 0, 'financial_type' => 11])->value('number') ?? 0;
|
||||||
$money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
|
$money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
|
||||||
$financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
|
$financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
|
||||||
//积分结算
|
//积分结算
|
||||||
|
@ -42,10 +42,10 @@ class UserShipLists extends BaseAdminDataLists
|
|||||||
if(!$this->request->__get('id')){
|
if(!$this->request->__get('id')){
|
||||||
$arr[]=['id'=>0,'title'=>'一般用户','limit'=>0];
|
$arr[]=['id'=>0,'title'=>'一般用户','limit'=>0];
|
||||||
}
|
}
|
||||||
$type_id=$this->request->get('type_id',0);
|
// $type_id=$this->request->get('type_id',0);
|
||||||
if($type_id!=4){
|
// if($type_id!=4){
|
||||||
$this->searchWhere[]=['id','<>',4];
|
// $this->searchWhere[]=['id','<>',4];
|
||||||
}
|
// }
|
||||||
$lists = UserShip::where($this->searchWhere)
|
$lists = UserShip::where($this->searchWhere)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->field($field)
|
->field($field)
|
||||||
|
@ -30,9 +30,9 @@ class CommissionLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function setBrigade($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
|
public static function setBrigade($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
|
||||||
{
|
{
|
||||||
$user_1 = self::user($order, 0.05, $transaction_id, $brigade_uid, 14); //队长
|
$user_1 = self::user($order, 0.05, $transaction_id, $brigade_uid, 15); //队长
|
||||||
$user_2 = self::user($order, 0.03, $transaction_id, 0, 12); ////会员、厨师
|
$user_2 = self::user($order, 0.03, $transaction_id, 0, 12); ////会员、厨师
|
||||||
$user_3 = self::user($order, 0.01, $transaction_id, $village_uid, 15); //村长
|
$user_3 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
|
||||||
|
|
||||||
$platform = self::platform($order, 0.02, $transaction_id); //平台
|
$platform = self::platform($order, 0.02, $transaction_id); //平台
|
||||||
$store = self::store($order, 0.05, $transaction_id, 0); //门店
|
$store = self::store($order, 0.05, $transaction_id, 0); //门店
|
||||||
@ -61,8 +61,8 @@ class CommissionLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function setStore($order, $transaction_id = 0)
|
public static function setStore($order, $transaction_id = 0)
|
||||||
{
|
{
|
||||||
$platform = self::platform($order, 0.05, $transaction_id); //平台
|
$platform = self::platform($order, 0.02, $transaction_id); //平台
|
||||||
$store = self::store($order, 0.02, $transaction_id, 0); //门店
|
$store = self::store($order, 0.05, $transaction_id, 0); //门店
|
||||||
$attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
|
$attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
|
||||||
$moeny = bcadd(bcadd($platform, $store, 2), $attrition, 2);
|
$moeny = bcadd(bcadd($platform, $store, 2), $attrition, 2);
|
||||||
self::suppliter($order, $moeny, $transaction_id);
|
self::suppliter($order, $moeny, $transaction_id);
|
||||||
@ -130,24 +130,20 @@ class CommissionLogic extends BaseLogic
|
|||||||
if ($deposit > 0) {
|
if ($deposit > 0) {
|
||||||
if ($deposit > $store_profit) {
|
if ($deposit > $store_profit) {
|
||||||
if ($store_profit > 0) {
|
if ($store_profit > 0) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update();
|
|
||||||
$financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
$financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
$financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$money = bcsub($store_profit, $deposit, 2);
|
$money = bcsub($store_profit, $deposit, 2);
|
||||||
if ($deposit > 0) {
|
if ($deposit > 0) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update();
|
|
||||||
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
}
|
}
|
||||||
if ($money) {
|
if ($money) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
|
|
||||||
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($store_profit > 0) {
|
if ($store_profit > 0) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
|
|
||||||
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,12 +165,28 @@ class CommissionLogic extends BaseLogic
|
|||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
//记录用户余额收入
|
//记录用户余额收入
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
|
if(in_array($enum,[14,15])&&$userRate==0.05){
|
||||||
|
$purchase_funds=User::where('id', $uid)->value('purchase_funds');
|
||||||
|
if($purchase_funds>0){
|
||||||
|
$fees_two = bcmul($purchase_funds, $userRate, 2);
|
||||||
|
if($fees_two<$fees){
|
||||||
|
$fees=$fees_two;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($enum==12&&$userRate==0.07){
|
||||||
|
$purchase_funds=User::where('id', $uid)->value('purchase_funds');
|
||||||
|
if($purchase_funds>0){
|
||||||
|
$fees_two = bcmul($purchase_funds, $userRate, 2);
|
||||||
|
if($fees_two<$fees){
|
||||||
|
$fees=$fees_two;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$GiveUser = User::where('id', $order['uid'])->find();
|
$GiveUser = User::where('id', $order['uid'])->find();
|
||||||
if($GiveUser['user_ship'] != 5){//新限制 不为种养殖
|
|
||||||
$capitalFlowDao = new CapitalFlowLogic($GiveUser);
|
$capitalFlowDao = new CapitalFlowLogic($GiveUser);
|
||||||
$capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
|
$capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$financeLogic->user['uid'] = $order['uid'];
|
$financeLogic->user['uid'] = $order['uid'];
|
||||||
$financeLogic->other_arr['vip_uid'] = $uid;
|
$financeLogic->other_arr['vip_uid'] = $uid;
|
||||||
$financeLogic->order = $order;
|
$financeLogic->order = $order;
|
||||||
@ -199,9 +211,9 @@ class CommissionLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
$fees = bcmul($pay_price, $userRate, 2);
|
$fees = bcmul($pay_price, $userRate, 2);
|
||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('attrition', $fees)->update();
|
|
||||||
$financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
$financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
|
$financeLogic->save();
|
||||||
}
|
}
|
||||||
return $fees;
|
return $fees;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
|
|
||||||
}
|
}
|
||||||
//积分写入
|
//积分写入
|
||||||
if(in_array($order['pay_type'],[3,7,9,13,17])&&$order['uid']>0){
|
if(isset($user) && $user['user_ship']==0){
|
||||||
UserSignLogic::OrderWrite($order);
|
UserSignLogic::OrderWrite($order);
|
||||||
}
|
}
|
||||||
if ($off_activity == 1) {
|
if ($off_activity == 1) {
|
||||||
@ -603,9 +603,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
//如果是会员需要返回会员金额
|
//如果是会员需要返回会员金额
|
||||||
if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
// if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
||||||
$order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
// $order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
||||||
}
|
// }
|
||||||
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
||||||
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
||||||
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
||||||
@ -627,6 +627,18 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||||
|
if ($address) {
|
||||||
|
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||||
|
if ($arr1) {
|
||||||
|
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||||
|
}
|
||||||
|
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||||
|
if ($arr2) {
|
||||||
|
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//查询用户对应的村长和队长
|
//查询用户对应的村长和队长
|
||||||
@ -644,10 +656,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
switch ($user_ship) {
|
switch ($user_ship) {
|
||||||
case 1: // 厨师
|
case 1: // 厨师
|
||||||
case 4: // 商户
|
//case 4: // 商户
|
||||||
case 5: // 种养殖
|
//case 5: // 种养殖
|
||||||
case 6: // 酒店
|
// case 6: // 酒店
|
||||||
case 7: // 食堂
|
// case 7: // 食堂
|
||||||
case 8: // 一条龙
|
case 8: // 一条龙
|
||||||
CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
|
CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
|
||||||
break;
|
break;
|
||||||
|
@ -45,7 +45,7 @@ class UserSignLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$count = UserRecharge::where(['uid'=>$order->uid,'paid'=>YesNoEnum::YES])->count();
|
$count = UserRecharge::where(['uid'=>$order->uid,'paid'=>YesNoEnum::YES])->count();
|
||||||
if ($count ==1 && in_array($user_ship, [1, 2, 3, 5, 6, 7, 8])) {
|
if ($count ==1 && $user_ship>0) {
|
||||||
//首充
|
//首充
|
||||||
$write = self::write($order, $total_vip, 0, 1, 9);
|
$write = self::write($order, $total_vip, 0, 1, 9);
|
||||||
self::write_log($write, $total_vip, 0, 7);
|
self::write_log($write, $total_vip, 0, 7);
|
||||||
|
@ -71,7 +71,7 @@ class UserProductStorageLogic extends BaseLogic
|
|||||||
if($price){
|
if($price){
|
||||||
$price=bcmul($price,$v['nums'],2);
|
$price=bcmul($price,$v['nums'],2);
|
||||||
$rate=bcdiv($price,100,2);
|
$rate=bcdiv($price,100,2);
|
||||||
$order_id= StoreOrder::where('id',$cart_info['oid'])->value('order_id');
|
$order_id= StoreOrder::where('id',$find['oid'])->value('order_id');
|
||||||
UserSignLogic::storage($order_id,$rate);
|
UserSignLogic::storage($order_id,$rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\store\controller\user_product_storage_log;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\user_product_storage_log\UserProductStorageLogLists;
|
||||||
|
use app\store\controller\BaseAdminController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户商品储存控制器
|
||||||
|
* Class UserProductStorageLogController
|
||||||
|
* @package app\admin\controller\user_product_storage
|
||||||
|
*/
|
||||||
|
class UserProductStorageLogController extends BaseAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取用户商品储存列表
|
||||||
|
* @return
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/28 11:05
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new UserProductStorageLogLists());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,6 +23,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
protected $total_price = 0;
|
protected $total_price = 0;
|
||||||
protected $activity_price = 0;
|
protected $activity_price = 0;
|
||||||
protected $off_activity = 0;
|
protected $off_activity = 0;
|
||||||
|
protected $pay_price = 0;
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
* @return \string[][]
|
* @return \string[][]
|
||||||
@ -42,7 +43,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
*/
|
*/
|
||||||
public function lists($where = []): array
|
public function lists($where = []): array
|
||||||
{
|
{
|
||||||
$userId = $this->request->get('uid');
|
|
||||||
$where = [
|
$where = [
|
||||||
'staff_id' => $this->adminId,
|
'staff_id' => $this->adminId,
|
||||||
'is_pay' => 0
|
'is_pay' => 0
|
||||||
@ -55,15 +55,24 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
// $off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$off_activity = 0;
|
$off_activity = 0;
|
||||||
$this->off_activity = $off_activity;
|
$this->off_activity = $off_activity;
|
||||||
|
$uid = 0;
|
||||||
|
if ($this->request->get('uid')) {
|
||||||
|
$uid = $this->request->get('uid');
|
||||||
|
}
|
||||||
|
if ($uid > 0) {
|
||||||
|
$user_ship = User::where('id', $uid)->value('user_ship');
|
||||||
|
if (in_array($user_ship, [4, 5, 6, 7])) {
|
||||||
|
$off_activity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
||||||
->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
|
->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
if ($find) {
|
if ($find) {
|
||||||
if ($off_activity == 1) {
|
if ($off_activity == 1) {
|
||||||
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
|
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
|
||||||
@ -71,8 +80,10 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
} else {
|
} else {
|
||||||
$item['price'] = $find['price'];
|
$item['price'] = $find['price'];
|
||||||
}
|
}
|
||||||
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
$item['pay_price'] = bcmul($item['cart_num'], $item['price'], 2);
|
||||||
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
$item['total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
||||||
|
$this->total_price = bcadd($this->total_price, $item['total_price'], 2);
|
||||||
|
$this->pay_price = bcadd($this->pay_price, $item['pay_price'], 2);
|
||||||
$item['image'] = $find['image'];
|
$item['image'] = $find['image'];
|
||||||
$item['cost'] = $find['cost'];
|
$item['cost'] = $find['cost'];
|
||||||
$item['store_name'] = $find['store_name'];
|
$item['store_name'] = $find['store_name'];
|
||||||
@ -105,7 +116,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
'off_activity' => $this->off_activity,
|
'off_activity' => $this->off_activity,
|
||||||
'total_price' => $this->total_price,
|
'total_price' => $this->total_price,
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'pay_price' => $this->total_price
|
'pay_price' => $this->pay_price
|
||||||
];
|
];
|
||||||
if ($this->off_activity == 1) {
|
if ($this->off_activity == 1) {
|
||||||
$data['pay_price'] = $this->activity_price;
|
$data['pay_price'] = $this->activity_price;
|
||||||
|
@ -28,7 +28,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['pay_type', 'paid'],
|
'=' => ['pay_type', 'paid','reservation'],
|
||||||
'%like%' => ['order_id'],
|
'%like%' => ['order_id'],
|
||||||
'between_time' => 'create_time',
|
'between_time' => 'create_time',
|
||||||
];
|
];
|
||||||
@ -71,7 +71,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return StoreOrder::where($this->searchWhere)->with(['user'])
|
return StoreOrder::where($this->searchWhere)->with(['user'])
|
||||||
->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num'])
|
->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type',
|
||||||
|
'status', 'paid', 'total_num','reservation','reservation_time'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item){
|
->select()->each(function ($item){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user