commit
94fa89c575
@ -62,9 +62,11 @@ class StoreActivityOrderDao extends BaseDao
|
||||
public function repeal(int $groupOrderId)
|
||||
{
|
||||
$model = StoreActivityOrder::where('group_order_id', $groupOrderId)->find();
|
||||
$model->status = StoreActivityOrder::STATUS_INVALID;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('活动订单保存失败');
|
||||
if ($model) {
|
||||
$model->status = StoreActivityOrder::STATUS_INVALID;
|
||||
if (!$model->save()) {
|
||||
throw new \Exception('活动订单保存失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,11 +84,44 @@ class StoreActivityUserDao extends BaseDao
|
||||
return $data->value ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 用下面的 default()
|
||||
* @param int $userId
|
||||
* @param int $activityId
|
||||
* @return StoreActivityUser|array|mixed|\think\Model|null
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getOne(int $userId, int $activityId = 1)
|
||||
{
|
||||
return StoreActivityUser::where('user_id', $userId)->where('activity_id', $activityId)->where('status', 1)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户参加的活动类型,默认为消费返利
|
||||
* @param int $userId
|
||||
* @param int $activityId
|
||||
* @return StoreActivityUser|array|mixed|\think\Model|null
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function default(int $userId, int $activityId = 1)
|
||||
{
|
||||
$default = StoreActivityUser::where('user_id', $userId)->where('activity_id', $activityId)->where('status', 1)->find();
|
||||
if (empty($default)) {
|
||||
$couponId = StoreConsumption::where('type', StoreConsumption::TYPE_OWNER_CONSUMPTION)->value('coupon_id');
|
||||
$default = new StoreActivityUser();
|
||||
$default->user_id = $userId;
|
||||
$default->activity_id = $activityId;
|
||||
$default->value = $couponId;
|
||||
$default->status = 1;
|
||||
$default->save();
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户参与活动的状态
|
||||
* @param int $userId 用户id
|
||||
@ -130,11 +163,14 @@ class StoreActivityUserDao extends BaseDao
|
||||
$userInfo = User::where('spread_uid', $userId)->field('uid,nickname,avatar')->select()->toArray();
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$scope = $storeConsumptionUserDao->getScope($consumption, $myOrder['pay_price']);
|
||||
// 订单有效金额为实付金额+红包金额
|
||||
$orderValidAmount = bcadd($myOrder['pay_price'], $myOrder['red_pack'], 2);
|
||||
$orderValidAmount = min($orderValidAmount, $storeConsumptionUserDao->maxAmount);
|
||||
$orderQuery = StoreActivityOrder::where('spread_id', $userId)
|
||||
->whereIn('user_id', array_column($userInfo, 'uid'))
|
||||
->where('activity_id', $activityId)
|
||||
->where('is_first_order', StoreActivityOrder::IS_FIRST_ORDER)
|
||||
->where('pay_price', '>=', $scope['start']);
|
||||
->where('pay_price', '>=', $orderValidAmount);
|
||||
if (!empty($groupOrderIds)) {
|
||||
unset($groupOrderIds[0]);
|
||||
$orderQuery->whereIn('group_order_id', $groupOrderIds);
|
||||
@ -144,7 +180,7 @@ class StoreActivityUserDao extends BaseDao
|
||||
$orders = $orderQuery->select()->toArray();
|
||||
$orders = reset_index($orders, 'user_id');
|
||||
foreach ($userInfo as &$user) {
|
||||
$user['target_amount'] = $scope['start'];
|
||||
$user['target_amount'] = $orderValidAmount;
|
||||
$user['is_finish'] = isset($orders[$user['uid']]) ? 1 : 0;
|
||||
}
|
||||
return ['target' => $scope['num'], 'allow_receive' => count($orders) >= $scope['num'], 'user_info' => $userInfo];
|
||||
|
@ -2,12 +2,14 @@
|
||||
|
||||
namespace app\common\dao\store\consumption;
|
||||
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
use app\common\model\user\UserBill;
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use crmeb\utils\Curl;
|
||||
use think\facade\Log;
|
||||
@ -18,50 +20,56 @@ class CommissionDao
|
||||
/**
|
||||
* 活动首单商户佣金 (支付成功后调用)
|
||||
* @param $order
|
||||
* @param $finance
|
||||
* @param $financeSn
|
||||
* @param $financeDao
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function firstOrderCommission($order, $finance, $financeSn)
|
||||
public function firstOrderCommission($order, $financeDao)
|
||||
{
|
||||
$commission = bcmul($order['pay_price'], 0.01, 2);
|
||||
if ($commission > 0 && $order['order_type'] == 1) {
|
||||
// 订单为自提,且佣金大于0
|
||||
$financeDao->user = $order->user;
|
||||
$financeDao->order = $order;
|
||||
$financeDao->platformOut($commission, 'commission_to_store', $order['mer_id']);
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order['mer_id'], 'order', $order['order_id'], $commission);
|
||||
}
|
||||
$consumption = StoreConsumption::where('status', 1)->where('type', StoreConsumption::TYPE_FIRST_ORDER_COMMISSION)->find();
|
||||
if (empty($consumption)) {
|
||||
return $finance;
|
||||
return $financeDao;
|
||||
}
|
||||
$storeConsumptionDao = new StoreConsumptionUserDao();
|
||||
$isFirstOrder = $storeConsumptionDao->isFirstOrder($order['uid'], $consumption['start_time'], $consumption['end_time']);
|
||||
if (!$isFirstOrder) {
|
||||
return $finance;
|
||||
}
|
||||
$commission = bcmul($order['pay_price'], $consumption['config']['commission_rate'], 2);
|
||||
if ($commission > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $order->user->nickname,
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => 'first_order_commission',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $commission,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn
|
||||
];
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order['mer_id'], 'order', $order['order_id'], $commission);
|
||||
}
|
||||
$redPack = bcmul($order['pay_price'], $consumption['config']['red_pack_rate'], 2);
|
||||
if ($redPack > 0) {
|
||||
$userId = Merchant::where('mer_id', $order['mer_id'])->value('uid');
|
||||
$storeConsumptionDao->send($consumption, $consumption['config']['red_pack_rate'], $userId, $order['order_id'], $order['pay_price'], StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
return $financeDao;
|
||||
}
|
||||
// 给镇合伙人、村合伙人、小组服务团队、店铺分佣,仅直推
|
||||
$promotionCode = User::where('uid', $order['uid'])->value('promotion_code');
|
||||
if (!empty($promotionCode)) {
|
||||
$this->sendCommission($order, $promotionCode);
|
||||
$merchantId = substr($promotionCode, strpos($promotionCode, 'mer_') + 4);
|
||||
if (strpos($promotionCode, 'mer_') !== false && $merchantId) {
|
||||
$userId = Merchant::where('mer_id', $merchantId)->value('uid');
|
||||
$user = User::where('uid', $userId)->find();
|
||||
$commission = bcmul($order['pay_price'], 0.03, 2);
|
||||
$financeDao->user = $user;
|
||||
$financeDao->order = $order;
|
||||
$financeDao->platformOut($commission, 'commission_to_promoter', $merchantId);
|
||||
app()->make(MerchantRepository::class)->addLockMoney($merchantId, 'order', $order['order_id'], $commission);
|
||||
$redPack = bcmul($order['pay_price'], $consumption['config']['red_pack_rate'], 2);
|
||||
if ($redPack > 0) {
|
||||
try {
|
||||
(new StoreConsumptionUserDao())->send($consumption, $consumption['config']['red_pack_rate'], $user['uid'], $order['order_id'], $order['pay_price'], StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->sendCommission($order, $promotionCode);
|
||||
}
|
||||
}
|
||||
return $finance;
|
||||
return $financeDao;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,65 +80,45 @@ class CommissionDao
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function firstOrderBatchCommission($data)
|
||||
public function firstOrderCommissionCallback($data)
|
||||
{
|
||||
$consumption = StoreConsumption::where('status', 1)->where('type', StoreConsumption::TYPE_FIRST_ORDER_COMMISSION)->find();
|
||||
if (empty($consumption)) {
|
||||
return [];
|
||||
}
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$financeSn = $financialRecordRepository->getSn();
|
||||
$users = $data['user'];
|
||||
$users = $this->getUsers($data['user']);
|
||||
$order = StoreOrder::where('order_id', $data['order_id'])->find();
|
||||
if (empty($order)) {
|
||||
return [];
|
||||
}
|
||||
$finance = [];
|
||||
$result = [];
|
||||
foreach ($users as $k => $user) {
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($users as $user) {
|
||||
$commission = bcdiv($user['user_profit'], 100, 2);
|
||||
if ($commission > 0) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $order->user->nickname,
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => $user['type'] == 3 ? 'order_commission' : 'first_order_commission',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $commission,
|
||||
'mer_id' => $order['mer_id'],
|
||||
'financial_record_sn' => $financeSn . ($k + 1)
|
||||
];
|
||||
$financeDao->user = $user;
|
||||
$financeDao->order = $order;
|
||||
$financialType = $user['type'] == 4 ? 'commission_to_courier' : 'commission_to_promoter';
|
||||
$financeDao->platformOut($commission, $financialType);
|
||||
$result[] = $user;
|
||||
}
|
||||
//用户是镇合伙人,不发放红包
|
||||
if ($user['type'] == 3) {
|
||||
continue;
|
||||
}
|
||||
$redPack = bcmul($order['pay_price'], $consumption['config']['red_pack_rate'], 2);
|
||||
$user = User::where('phone', $user['account'])->find();
|
||||
if ($redPack > 0 && !empty($user)) {
|
||||
if ($redPack > 0) {
|
||||
try {
|
||||
(new StoreConsumptionUserDao())->send($consumption, $consumption['config']['red_pack_rate'], $user['uid'], $order['order_id'], $order['pay_price'], StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
$user->red_pack_balance = bcadd($user->red_pack_balance, $redPack, 2);
|
||||
if (!$user->save()) {
|
||||
throw new \Exception('红包余额更新出错');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($finance) > 0) {
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
}
|
||||
$financeDao->save();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给镇合伙人或推广人发放佣金(支付完成后调用,推广人仅首单奖励)
|
||||
* 请求发送给供应商平台后异步回调
|
||||
* 暂时取消镇合伙人佣金
|
||||
* @param $order
|
||||
* @param $promotionCode
|
||||
* @param int $type 类型:1=>小组,2=>村合伙人,3=>镇合伙人,4=>配送员
|
||||
@ -155,9 +143,114 @@ class CommissionDao
|
||||
$url = env('task.new_worker_host_url') . '/api/shop_call/' . $api;
|
||||
$result = $curl->post($url, ['timestamp' => $timestamp, 'data' => $encrypt]);
|
||||
$result = json_decode($result, true);
|
||||
if ($result['code'] != 1) {
|
||||
Log::error('发送佣金失败:' . var_export($result, true));
|
||||
Log::info('供销佣金:' . var_export($result, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款,店铺退佣金
|
||||
* @param $refundOrder
|
||||
* @return void
|
||||
*/
|
||||
public function refundByOrder($refundOrder)
|
||||
{
|
||||
// 是否已经退过佣金
|
||||
$refunded = FinancialRecord::where('order_id', $refundOrder->order['order_id'])
|
||||
->whereIn('financial_type', ['commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund'])
|
||||
->count();
|
||||
if ($refunded > 0) {
|
||||
return;
|
||||
}
|
||||
// 退佣金和红包、保证金
|
||||
$financeRecord = FinancialRecord::where('order_id', $refundOrder->order['order_id'])
|
||||
->whereIn('financial_type', ['commission_to_store', 'commission_to_courier', 'commission_to_promoter'])
|
||||
->field('user_id uid,user_info nickname,number,mer_id,financial_type')->select()->toArray();
|
||||
if (empty($financeRecord)) {
|
||||
return;
|
||||
}
|
||||
$userIds = [];
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($financeRecord as $item) {
|
||||
$userIds[] = $item['uid'];
|
||||
$financeDao->user = $item;
|
||||
$financeDao->order = $refundOrder->order;
|
||||
$financeDao->platformIn($item['number'], $item['financial_type'] . '_refund', $item['mer_id']);
|
||||
if ($item['mer_id'] > 0) {
|
||||
app()->make(MerchantRepository::class)->subLockMoney($item['mer_id'], 'order', $refundOrder->order['order_id'], $item['number']);
|
||||
}
|
||||
}
|
||||
$financeDao->save();
|
||||
|
||||
// 服务团队退红包
|
||||
$redPacks = UserBill::whereIn('uid', $userIds)->where('extra->order_id',$refundOrder->order['order_id'])->select()->toArray();
|
||||
foreach ($redPacks as $redPack) {
|
||||
(new StoreConsumptionUserDao())->refundByCommission($redPack['uid'], $refundOrder->order['order_id'], $redPack['number']);
|
||||
}
|
||||
|
||||
$promotionCode = User::where('uid', $refundOrder['uid'])->value('promotion_code');
|
||||
if ($promotionCode && strpos($promotionCode, 'mer_') === false){
|
||||
$curl = new Curl();
|
||||
$aes = new \AES();
|
||||
$timestamp = time();
|
||||
$json = ['timestamp' => $timestamp, 'data' => ['order_sn' => $refundOrder->order['order_sn']]];
|
||||
$iv = $aes->buildIv($timestamp);
|
||||
$encrypt = $aes->encrypt($json, $iv);
|
||||
$url = env('task.new_worker_host_url') . '/api/shop_call/handleRefund';
|
||||
$result = $curl->post($url, ['timestamp' => $timestamp, 'data' => $encrypt]);
|
||||
$result = json_decode($result, true);
|
||||
Log::error('发起佣金退款:' . var_export($result, true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @deprecated 暂时弃用,后续可能会用
|
||||
* 供销平台退佣金回调
|
||||
* @param $data
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function refundByCallback($data)
|
||||
{
|
||||
$result = [];
|
||||
$users = $this->getUsers($data['user']);
|
||||
$order = StoreOrder::where('order_id', $data['order_id'])->find();
|
||||
if (empty($order) || empty($users)) {
|
||||
return [];
|
||||
}
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($users as $user) {
|
||||
$commission = bcdiv($user['user_profit'], 100, 2);
|
||||
if ($commission > 0) {
|
||||
$financeDao->user = $user;
|
||||
$financeDao->order = $order;
|
||||
$financialType = ($user['type'] == 3 ? 'order_commission' : 'first_order_commission') . '_refund';
|
||||
$financeDao->platformIn($commission, $financialType);
|
||||
$result[] = $user;
|
||||
}
|
||||
$redPack = bcmul($order['pay_price'], 0.07, 2);
|
||||
if ($redPack > 0) {
|
||||
try {
|
||||
(new StoreConsumptionUserDao())->refundByCommission($user['uid'], $order->order_id, $redPack);
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
$financeDao->save();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getUsers($info)
|
||||
{
|
||||
$info = reset_index($info, 'account');
|
||||
$users = User::whereIn('account', array_keys($info))->field('uid,account,nickname')->select()->toArray();
|
||||
foreach ($users as &$user) {
|
||||
if (isset($info[$user['account']])) {
|
||||
$user = array_merge($info[$user['account']], $user);
|
||||
}
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,12 +5,15 @@ namespace app\common\dao\store\consumption;
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\dao\store\StoreActivityOrderDao;
|
||||
use app\common\dao\store\StoreActivityUserDao;
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\StoreActivityOrder;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\user\UserBillRepository;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
|
||||
class StoreConsumptionUserDao extends BaseDao
|
||||
@ -39,6 +42,12 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
|
||||
/** @var float $consumptionTotalAmount 红包总金额 */
|
||||
public $consumptionTotalAmount;
|
||||
/** @var int $orderType 订单类型:1 groupOrder,2 order */
|
||||
public $orderType = 2;
|
||||
/** @var float $consumptionUsed 已使用的红包金额 */
|
||||
public $consumptionUsed;
|
||||
/** @var float $profitRate 商品毛利率 */
|
||||
public $profitRate;
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
@ -77,7 +86,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
*/
|
||||
public function promoter(int $userId, $groupOrder, int $spreadUserId)
|
||||
{
|
||||
$activityUser = (new StoreActivityUserDao())->getOne($userId);
|
||||
$activityUser = (new StoreActivityUserDao())->default($userId);
|
||||
$consumption = (new StoreConsumptionDao())->getOne($activityUser['value'] ?? 0);
|
||||
//用户没有参加 消费金活动 或 已超过任务完成时间
|
||||
$endTime = $this->getEndTime($activityUser['create_time'] ?? '2024-01-01 00:00:00');
|
||||
@ -96,6 +105,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
$storeActivityOrderDao = new StoreActivityOrderDao();
|
||||
$storeActivityOrder = $storeActivityOrderDao->save($groupOrder, $spreadUserId, $isFirstOrder);
|
||||
if ($consumption['type'] == StoreConsumption::TYPE_OWNER_CONSUMPTION && $storeActivityOrder['status'] == StoreActivityOrder::STATUS_VALID && $storeActivityOrder['red_pack'] == 0) {
|
||||
$this->orderType = 1;
|
||||
$this->send($consumption, $scope['rate'], $userId, $groupOrder['group_order_id'], $orderValidAmount, StoreConsumptionUser::STATUS_UNUSED);
|
||||
$this->send($consumption, $scope['rate_two'], $userId, $groupOrder['group_order_id'], $orderValidAmount, StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
$storeActivityOrderDao->repeal($groupOrder['group_order_id']);
|
||||
@ -120,7 +130,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
public function guest(int $userId, $groupOrder, int $spreadUserId)
|
||||
{
|
||||
// 查询推荐人的消费金类型
|
||||
$spreadActivityUser = (new StoreActivityUserDao())->getOne($spreadUserId);
|
||||
$spreadActivityUser = (new StoreActivityUserDao())->default($spreadUserId);
|
||||
$endTime = $this->getEndTime($spreadActivityUser['create_time'] ?? '2024-01-01 00:00:00');
|
||||
$spreadConsumption = (new StoreConsumptionDao())->getOne($spreadActivityUser['value'] ?? 0);
|
||||
// 查询推荐人满足条件的有效订单
|
||||
@ -150,6 +160,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
$spreadOrderIds = "{$spreadGroupOrder['group_order_id']}," . $spreadOrderIds;
|
||||
// 使用了红包,订单有效金额需要乘以80%
|
||||
$orderValidAmount = $spreadGroupOrder['red_pack'] > 0 ? bcmul($orderValidAmount, 0.8, 2) : $orderValidAmount;
|
||||
$this->orderType = 1;
|
||||
$this->send($spreadConsumption, $spreadScope['rate'], $spreadUserId, $spreadOrderIds, $orderValidAmount);
|
||||
$storeActivityOrderDao->batchRepeal(explode(',', $spreadOrderIds));
|
||||
}
|
||||
@ -249,12 +260,19 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
// 写入红包日志
|
||||
/** @var $userBillRepository UserBillRepository */
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$extra = ['order_amount' => $amount, 'coupon_user_id' => $model['coupon_user_id']];
|
||||
if ($this->orderType == 2) {
|
||||
$extra['order_id'] = $groupOrderIds;
|
||||
} else {
|
||||
$extra['group_order_id'] = $groupOrderIds;
|
||||
}
|
||||
$userBillRepository->incBill($userId, 'red_pack', "red_pack_{$type}", [
|
||||
'link_id' => $model['coupon_user_id'],
|
||||
'status' => 1,
|
||||
'title' => '获得' . $title,
|
||||
'number' => $couponPrice,
|
||||
'mark' => '获得' . $title . $couponPrice . ",订单金额:{$amount}",
|
||||
'extra' => json_encode($extra, JSON_UNESCAPED_UNICODE),
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
@ -273,8 +291,16 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
if ($isNewUser == 0) {
|
||||
return 0;
|
||||
}
|
||||
$count = StoreGroupOrder::where('uid', $userId)->where('paid', 1)->whereBetweenTime('pay_time', $startTime, $endTime)->count();
|
||||
return intval($count <= 1);
|
||||
$exceptGroupOrderIds = StoreOrder::where('uid', $userId)
|
||||
->where('source', 105)
|
||||
->group('group_order_id')
|
||||
->column('group_order_id');
|
||||
$count = StoreGroupOrder::where('uid', $userId)
|
||||
->whereNotIn('group_order_id', $exceptGroupOrderIds)
|
||||
->where('paid', 1)
|
||||
->whereBetweenTime('pay_time', $startTime, $endTime)
|
||||
->count();
|
||||
return intval($count <= 0);
|
||||
}
|
||||
|
||||
public function getEndTime($datetime)
|
||||
@ -282,6 +308,26 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
return strtotime('+1 year', strtotime($datetime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加红包余额
|
||||
* @param $id
|
||||
* @param $amount
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function increase($id, $amount)
|
||||
{
|
||||
$storeConsumptionUser = StoreConsumptionUser::where('coupon_user_id', $id)->find();
|
||||
if (empty($storeConsumptionUser)) {
|
||||
throw new \Exception('红包记录不存在');
|
||||
}
|
||||
$storeConsumptionUser->balance = bcadd($storeConsumptionUser->balance, $amount, 2);
|
||||
if (!$storeConsumptionUser->save()) {
|
||||
throw new \Exception('红包余额更新出错');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扣减红包余额
|
||||
* @param $id
|
||||
@ -297,13 +343,17 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
throw new \Exception('红包余额不足');
|
||||
}
|
||||
$balance = bcsub($storeConsumptionUser->balance, $amount, 2);
|
||||
$storeConsumptionUser->balance = max($balance, 0);
|
||||
$storeConsumptionUser->balance = $balance;
|
||||
if ($balance <= 0 && $storeConsumptionUser->type == StoreConsumptionUser::TYPE_ONE) {
|
||||
$storeConsumptionUser->status = StoreConsumptionUser::STATUS_USED;
|
||||
}
|
||||
if (!$storeConsumptionUser->save()) {
|
||||
throw new \Exception('红包余额更新出错');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 已废弃,用下面的 typeTwoByProduct 和 typeOneByProduct
|
||||
* 根据订单商品计算实际金额和红包金额
|
||||
* @return array
|
||||
*/
|
||||
@ -321,8 +371,8 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
$rate = bcdiv($productPrice, $orderTotalPrice, 5);
|
||||
$realPrice = $this->isLast ? bcsub($orderPayPrice, $realPriceTotal, 2) : ceil(bcmul($orderPayPrice, $rate, 5));
|
||||
$consumptionAmount = $productPrice - $realPrice;
|
||||
$realPriceTotal += $realPrice;
|
||||
}
|
||||
$realPriceTotal += $realPrice;
|
||||
$realPrice = bcdiv($realPrice, 100, 2);
|
||||
$consumptionAmount = bcdiv($consumptionAmount, 100, 2);
|
||||
$realPriceTotal = bcdiv($realPriceTotal, 100, 2);
|
||||
@ -331,6 +381,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 已废弃,用下面的 typeTwoByProduct 和 typeOneByProduct
|
||||
* 根据订单计算实际金额和红包金额
|
||||
* @return array
|
||||
*/
|
||||
@ -341,7 +392,7 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
$groupOrderTotalPrice = $this->groupOrderTotalPrice * 100;
|
||||
$consumptionBalance = $this->consumptionTotalAmount * 100;
|
||||
$rate = bcdiv($orderTotalPrice, $groupOrderTotalPrice, 5);
|
||||
if ($consumptionBalance >= $orderTotalPrice) {
|
||||
if ($consumptionBalance >= $groupOrderTotalPrice) {
|
||||
$useAmount = $orderTotalPrice;
|
||||
} else {
|
||||
$useAmount = $this->isLast ? $consumptionBalance : ceil(bcmul($consumptionBalance, $rate, 5));
|
||||
@ -358,4 +409,155 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
return [$payPrice, $groupOrderTotalPrice, $useAmount, $consumptionBalance];
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过订单id退用户红包
|
||||
* @param $refundOrder
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function refundByOrder($refundOrder)
|
||||
{
|
||||
$order = StoreOrder::where('order_id', $refundOrder['order_id'])->find();
|
||||
$model = StoreConsumptionUser::where('uid', $refundOrder['uid'])->where('coupon_user_id', $order['consumption_id'])->find();
|
||||
if (empty($model) || $order['source'] == 105) {
|
||||
return;
|
||||
}
|
||||
$model->balance = bcadd($model->balance, $refundOrder['refund_consumption'], 2);
|
||||
$model->status = StoreConsumptionUser::STATUS_UNUSED;
|
||||
if (!$model->save()) {
|
||||
throw new ValidateException('红包退还失败');
|
||||
}
|
||||
// 写入红包日志
|
||||
/** @var $userBillRepository UserBillRepository */
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$title = $model['type'] == StoreConsumptionUser::TYPE_TWO ? '现金抵扣红包' : '无门槛实物通用红包';
|
||||
$userBillRepository->incBill($refundOrder['uid'], 'red_pack', "red_pack_{$model['type']}", [
|
||||
'link_id' => $refundOrder['order_id'],
|
||||
'status' => 1,
|
||||
'title' => '订单退款,获得' . $title,
|
||||
'number' => $refundOrder['refund_consumption'],
|
||||
'mark' => '订单退款,获得' . $title . $refundOrder['refund_consumption'] . ",退款订单ID:{$refundOrder['order_id']}",
|
||||
'balance' => 0
|
||||
]);
|
||||
$financeDao = new FinancialDao();
|
||||
$financeDao->user = $order->user;
|
||||
$financeDao->order = $order;
|
||||
$financeDao->platformIn($refundOrder['refund_consumption'], 'platform_consumption_refund');
|
||||
$financeDao->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款,服务团队退红包
|
||||
* @param $userId
|
||||
* @param $orderId
|
||||
* @param $amount
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function refundByCommission($userId, $orderId, $amount)
|
||||
{
|
||||
$model = StoreConsumptionUser::where('uid', $userId)->where('type', StoreConsumptionUser::TYPE_TWO)->find();
|
||||
if (empty($model)) {
|
||||
return;
|
||||
}
|
||||
$model->balance = bcsub($model->balance, $amount, 2);
|
||||
if (!$model->save()) {
|
||||
throw new ValidateException('红包退还失败');
|
||||
}
|
||||
// 写入红包日志
|
||||
/** @var $userBillRepository UserBillRepository */
|
||||
$userBillRepository = app()->make(UserBillRepository::class);
|
||||
$userBillRepository->decBill($userId, 'consumption_refund', 'deduction', [
|
||||
'link_id' => $orderId,
|
||||
'status' => 1,
|
||||
'title' => '订单退款,退现金抵扣红包',
|
||||
'number' => $amount,
|
||||
'mark' => '订单退款,退现金抵扣红包' . floatval($amount) . '元',
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包类型为 现金抵扣红包
|
||||
* 根据商品毛利率计算红包金额
|
||||
* @return array
|
||||
*/
|
||||
public function typeTwoByProduct()
|
||||
{
|
||||
// 把所有金额转换成分,避免红包金额产生误差
|
||||
$totalPrice = $this->orderProductPrice * 100;
|
||||
$consumptionUsed = $this->consumptionUsed * 100;
|
||||
$consumptionTotal = $this->consumptionTotalAmount * 100;
|
||||
$consumptionBalance = $consumptionTotal - $consumptionUsed;
|
||||
if ($consumptionBalance <= 0) {
|
||||
return [$this->orderProductPrice, '0.00', $this->consumptionUsed];
|
||||
}
|
||||
$rate = $this->getRate($this->profitRate);
|
||||
$useAmount = bcmul($totalPrice, $rate, 2);
|
||||
if ($useAmount >= $consumptionBalance) {
|
||||
$useAmount = $consumptionBalance;
|
||||
}
|
||||
$payPrice = $totalPrice - $useAmount;
|
||||
$consumptionUsed += $useAmount;
|
||||
$payPrice = bcdiv($payPrice, 100, 2);
|
||||
$useAmount = bcdiv($useAmount, 100, 2);
|
||||
$consumptionUsed = bcdiv($consumptionUsed, 100, 2);
|
||||
/** $payPrice:实际支付的金额,$useAmount:当前商品使用的红包金额,$consumptionUsed:使用的红包金额总计 */
|
||||
return [$payPrice, $useAmount, $consumptionUsed];
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包类型为 无门槛红包
|
||||
* 根据商品毛利率计算红包金额
|
||||
* @return array
|
||||
*/
|
||||
public function typeOneByProduct()
|
||||
{
|
||||
// 把所有金额转换成分,避免红包金额产生误差
|
||||
$totalPrice = $this->orderProductPrice * 100;
|
||||
$consumptionUsed = $this->consumptionUsed * 100;
|
||||
$consumptionTotal = $this->consumptionTotalAmount * 100;
|
||||
$groupOrderTotalPrice = $this->groupOrderTotalPrice * 100;
|
||||
$rate = bcdiv($totalPrice, $groupOrderTotalPrice, 5);
|
||||
if ($consumptionTotal >= $groupOrderTotalPrice) {
|
||||
$useAmount = $totalPrice;
|
||||
} else {
|
||||
$useAmount = $this->isLast ? $consumptionTotal - $consumptionUsed : round(bcmul($consumptionTotal, $rate, 1));
|
||||
}
|
||||
$payPrice = $totalPrice - $useAmount;
|
||||
$consumptionUsed += $useAmount;
|
||||
$payPrice = bcdiv($payPrice, 100, 2);
|
||||
$useAmount = bcdiv($useAmount, 100, 2);
|
||||
$consumptionUsed = bcdiv($consumptionUsed, 100, 2);
|
||||
/** $payPrice:实际支付的金额,$useAmount:当前商品使用的红包金额,$consumptionUsed:使用的红包金额总计 */
|
||||
return [$payPrice, $useAmount, $consumptionUsed];
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品毛利率计算红包抵扣比例
|
||||
* @param float $profitRate 毛利率
|
||||
* @return float|int
|
||||
*/
|
||||
public function getRate($profitRate)
|
||||
{
|
||||
$rateArray = [
|
||||
'0.25' => 0.4,
|
||||
'0.2' => 0.3,
|
||||
'0.15' => 0.2,
|
||||
'0.1' => 0.1,
|
||||
];
|
||||
$rate = 0;
|
||||
foreach ($rateArray as $k => $item) {
|
||||
if ($profitRate >= $k) {
|
||||
$rate = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $rate;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,18 +15,25 @@ namespace app\common\dao\store\order;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\order\StoreGroupOrderOther;
|
||||
use app\common\model\store\order\StoreOrderOther;
|
||||
use app\common\model\store\order\StoreOrderProductOther;
|
||||
use app\common\model\store\order\StoreOrderStatusOther;
|
||||
use app\common\model\store\order\StoreRefundOrder;
|
||||
use app\common\model\store\order\StoreRefundOrderOther;
|
||||
use app\common\model\store\order\StoreRefundProductOther;
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\repositories\store\order\StoreOrderStatusRepository;
|
||||
use app\common\repositories\store\product\ProductAssistSetRepository;
|
||||
use app\common\repositories\store\product\ProductGroupBuyingRepository;
|
||||
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use think\db\BaseQuery;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\Model;
|
||||
|
||||
@ -276,8 +283,8 @@ class StoreOrderOtherDao extends BaseDao
|
||||
public function fieldExists($field, $value, ?int $except = null): bool
|
||||
{
|
||||
return ($this->getModel()::getDB())->when($except, function ($query) use ($field, $except) {
|
||||
$query->where($field, '<>', $except);
|
||||
})->where($field, $value)->count() > 0;
|
||||
$query->where($field, '<>', $except);
|
||||
})->where($field, $value)->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -764,4 +771,96 @@ class StoreOrderOtherDao extends BaseDao
|
||||
});
|
||||
})->where('StoreOrderOther.uid', $uid)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 供应链订单退款
|
||||
* @param $refundOrder
|
||||
* @return void
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function refund($refundOrder)
|
||||
{
|
||||
$refundProducts = [];
|
||||
foreach ($refundOrder->refundProduct->toArray() as $item) {
|
||||
$refundProducts[$item['product']['product_source_id']] = ['num' => $item['refund_num']];
|
||||
}
|
||||
$order = StoreOrderOther::where('order_sn', $refundOrder->order['order_sn'])->find();
|
||||
$refundOrderArray = $refundOrder->toArray();
|
||||
unset($refundOrderArray['refund_order_id'], $refundOrderArray['refundProduct'], $refundOrderArray['order']);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$products = [];
|
||||
$refundTotal = 0.00;
|
||||
$orderProducts = StoreOrderProductOther::where('order_id', $order['order_id'])->select();
|
||||
foreach ($orderProducts as $orderProduct) {
|
||||
$refundProduct = $refundProducts[$orderProduct['product_id']] ?? [];
|
||||
if (empty($refundProduct)) {
|
||||
continue;
|
||||
}
|
||||
$price = bcdiv($orderProduct['total_price'], $orderProduct['product_num'], 2);
|
||||
$refundPrice = bcmul($price, $refundProduct['num'], 2);
|
||||
$refundTotal = bcadd($refundTotal, $refundPrice, 2);
|
||||
$products[] = [
|
||||
'order_product_id' => $orderProduct['order_product_id'],
|
||||
'refund_price' => $refundPrice,
|
||||
'refund_consumption' => 0,
|
||||
'platform_refund_price' => 0,
|
||||
'refund_postage' => 0,
|
||||
'refund_integral' => 0,
|
||||
'refund_num' => $refundProduct['num'],
|
||||
];
|
||||
$orderProduct->refund_num -= $refundProduct['num'];
|
||||
$orderProduct->is_refund = 1;
|
||||
$orderProduct->save();
|
||||
}
|
||||
$model = new StoreRefundOrderOther();
|
||||
$model->setAttrs($refundOrderArray);
|
||||
$model->order_id = $order['order_id'];
|
||||
$model->uid = $order['uid'];
|
||||
$model->mer_id = $order['mer_id'];
|
||||
$model->refund_price = $refundTotal;
|
||||
$model->save();
|
||||
|
||||
foreach ($products as &$product) {
|
||||
$product['refund_order_id'] = $model->refund_order_id;
|
||||
}
|
||||
if (count($products) > 0) {
|
||||
StoreRefundProductOther::getDB()->insertAll($products);
|
||||
}
|
||||
|
||||
$financeDao = new FinancialDao();
|
||||
$financeDao->user = $order->user;
|
||||
$financeDao->order = $order;
|
||||
$financeDao->order->order_id = $model->refund_order_id;
|
||||
$financeDao->platformIn($refundTotal, 'supply_chain_refund', $model->mer_id);
|
||||
|
||||
$marginRecord = FinancialRecord::where('order_id', $refundOrder['order_id'])
|
||||
->where('mer_id', $model->mer_id)
|
||||
->where('financial_type', 'auto_margin')
|
||||
->value('number');
|
||||
$marginRefunded = FinancialRecord::where('order_id', $refundOrder['order_id'])
|
||||
->where('mer_id', $model->mer_id)
|
||||
->where('financial_type', 'auto_margin_refund')
|
||||
->sum('number');
|
||||
if ($marginRecord > $marginRefunded) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
$merchantRepo->forceMargin = false;
|
||||
$merchantRepo->merId = $model->mer_id;
|
||||
[$margin, $financeDao] = $merchantRepo->refundDeposit($refundTotal, $financeDao);
|
||||
$merchantRepo->addLockMoney($model->mer_id, 'order', $refundOrder['order_id'], $margin);
|
||||
}
|
||||
|
||||
$financeDao->save();
|
||||
|
||||
app()->make(MerchantRepository::class)->subLockMoney($model->mer_id, 'order', $refundOrder['order_id'], $refundTotal);
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
throw new ValidateException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class StoreRefundProductDao extends BaseDao
|
||||
$lst = $this->getModel()::getDB()->alias('A')->leftJoin('StoreRefundOrder B', 'A.refund_order_id = B.refund_order_id')
|
||||
->where('B.status', '>', -1)
|
||||
->whereIn('A.order_product_id', $ids)->group('A.order_product_id')
|
||||
->field('A.order_product_id, SUM(A.refund_price) as refund_price, SUM(A.platform_refund_price) as platform_refund_price, SUM(A.refund_postage) as refund_postage, SUM(A.refund_integral) as refund_integral')
|
||||
->field('A.order_product_id, SUM(A.refund_price) as refund_price, SUM(A.platform_refund_price) as platform_refund_price, SUM(A.refund_postage) as refund_postage, SUM(A.refund_integral) as refund_integral, SUM(A.refund_consumption) as refund_consumption')
|
||||
->select()->toArray();
|
||||
$data = [];
|
||||
foreach ($lst as $item) {
|
||||
|
@ -151,9 +151,6 @@ class ProductDao extends BaseDao
|
||||
});
|
||||
}
|
||||
})
|
||||
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('Product.store_name', "%{$where['keyword']}%");
|
||||
})
|
||||
->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%");
|
||||
})
|
||||
|
@ -70,7 +70,7 @@ class SpuDao extends BaseDao
|
||||
->when(isset($where['mer_array_id']),function($query)use($where){
|
||||
$query->whereIn('P.mer_id',$where['mer_array_id']);
|
||||
})
|
||||
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
|
||||
->when(isset($where['mer_ids']) && count($where['mer_ids'])>0,function($query)use($where){
|
||||
$query->whereIn('P.mer_id',$where['mer_ids']);
|
||||
})
|
||||
->when(isset($where['keyword']) && $where['keyword'] !== '',function($query)use($where){
|
||||
|
@ -16,10 +16,18 @@ namespace app\common\dao\system\financial;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\financial\Financial;
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
|
||||
class FinancialDao extends BaseDao
|
||||
{
|
||||
|
||||
public $order;
|
||||
public $user;
|
||||
public $index = 0;
|
||||
public $financeSn;
|
||||
public $list = [];
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return Financial::class;
|
||||
@ -79,4 +87,75 @@ class FinancialDao extends BaseDao
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台出账财务流水
|
||||
* @param $number
|
||||
* @param $financialType
|
||||
* @param $merId
|
||||
*/
|
||||
public function platformOut($number, $financialType, $merId = 0)
|
||||
{
|
||||
$this->setData($number, $financialType, 0, 2, $merId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台入账财务流水
|
||||
* @param $number
|
||||
* @param $financialType
|
||||
* @param $merId
|
||||
*/
|
||||
public function platformIn($number, $financialType, $merId = 0)
|
||||
{
|
||||
$this->setData($number, $financialType, 1, 2, $merId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共入账财务流水
|
||||
* @param $number
|
||||
* @param $financialType
|
||||
* @param $merId
|
||||
*/
|
||||
public function publicOut($number, $financialType, $merId = '')
|
||||
{
|
||||
$this->setData($number, $financialType, 0, 1, $merId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共入账财务流水
|
||||
* @param $number
|
||||
* @param $financialType
|
||||
* @param $merId
|
||||
*/
|
||||
public function publicIn($number, $financialType, $merId = '')
|
||||
{
|
||||
$this->setData($number, $financialType, 1, 1, $merId);
|
||||
}
|
||||
|
||||
public function setData($number, $financialType, $pm, $type = 2, $merId = '')
|
||||
{
|
||||
if (empty($this->financeSn)) {
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$this->financeSn = $financialRecordRepository->getSn();
|
||||
}
|
||||
$this->list[] = [
|
||||
'order_id' => $this->order['order_id'],
|
||||
'order_sn' => $this->order['order_sn'],
|
||||
'user_info' => $this->user['nickname'],
|
||||
'user_id' => $this->user['uid'],
|
||||
'financial_type' => $financialType,
|
||||
'financial_pm' => $pm,
|
||||
'type' => $type,
|
||||
'number' => $number,
|
||||
'mer_id' => $merId !== '' ? $merId : $this->order->mer_id,
|
||||
'financial_record_sn' => $this->financeSn . ($this->index++)
|
||||
];
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
if (count($this->list) > 0) {
|
||||
(new FinancialRecord())->insertAll($this->list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class FinancialRecordDao extends BaseDao
|
||||
})
|
||||
->when(isset($where['is_mer']) && $where['is_mer'] !== '', function ($query) use ($where) {
|
||||
if($where['is_mer']){
|
||||
$query->where('mer_id',$where['is_mer'])->where('type','in',[0,1]);
|
||||
$query->where('mer_id',$where['is_mer'])->where('type','in',[0,1, 2]);
|
||||
}else{
|
||||
$query->where('type','in',[1,2]);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class UserBillDao extends BaseDao
|
||||
$lockMoney = 0;
|
||||
if (count($lst)) {
|
||||
$lockMoney = -1 * UserBill::getDB()->whereIn('link_id', array_column($lst, 'link_id'))
|
||||
->where('category', 'mer_refund_money')->sum('number');
|
||||
->where('category', 'mer_refund_money')->where('mer_id', $merId)->sum('number');
|
||||
}
|
||||
foreach ($lst as $bill) {
|
||||
$lockMoney = bcadd($lockMoney, $bill['number'], 2);
|
||||
|
@ -15,6 +15,7 @@ class StoreConsumption extends BaseModel
|
||||
const TYPE_OWNER_CONSUMPTION = 13; //个人消费金
|
||||
const TYPE_PULL_CONSUMPTION = 14; //拉新消费金
|
||||
const TYPE_FIRST_ORDER_COMMISSION = 15; //首单佣金
|
||||
const TYPE_RECHARGE = 16; //充值赠送
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
|
41
app/common/model/store/order/StoreRefundOrderOther.php
Normal file
41
app/common/model/store/order/StoreRefundOrderOther.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class StoreRefundOrderOther extends BaseModel
|
||||
{
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'refund_order_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_refund_order_other';
|
||||
}
|
||||
|
||||
public function refundProduct()
|
||||
{
|
||||
return $this->hasMany(StoreRefundProductOther::class, 'refund_order_id', 'refund_order_id');
|
||||
}
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
return $this->hasOne(StoreOrderOther::class, 'order_id', 'order_id');
|
||||
}
|
||||
}
|
30
app/common/model/store/order/StoreRefundProductOther.php
Normal file
30
app/common/model/store/order/StoreRefundProductOther.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreRefundProductOther extends BaseModel
|
||||
{
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'refund_product_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_refund_product_other';
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(StoreOrderProductOther::class,'order_product_id','order_product_id');
|
||||
}
|
||||
|
||||
public function refundOrder()
|
||||
{
|
||||
return $this->hasOne(StoreRefundOrderOther::class,'refund_order_id','refund_order_id');
|
||||
}
|
||||
|
||||
}
|
@ -58,6 +58,7 @@ class StoreCartRepository extends BaseRepository
|
||||
public function checkCartList($res, $hasCoupon = 0, $user = null)
|
||||
{
|
||||
$arr = $fail = [];
|
||||
/** @var ProductRepository $product_make */
|
||||
$product_make = app()->make(ProductRepository::class);
|
||||
$svip_status = ($user && $user->is_svip > 0 && systemConfig('svip_switch_status')) ? true : false;
|
||||
foreach ($res as $item) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\store\order\StoreGroupOrderDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
@ -226,6 +227,10 @@ class StoreGroupOrderRepository extends BaseRepository
|
||||
}
|
||||
$groupOrder->save();
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
if ($groupOrder->consumption_id > 0 && $groupOrder->consumption_money > 0) {
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->increase($groupOrder['consumption_id'], $groupOrder['consumption_money']);
|
||||
}
|
||||
});
|
||||
Queue::push(CancelGroupOrderJob::class, $id);
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
}
|
||||
/** @var StoreCartRepository $storeCartRepository */
|
||||
$storeCartRepository = app()->make(StoreCartRepository::class);
|
||||
$res = $storeCartRepository->checkCartList($storeCartRepository->cartIbByData($cartId, $uid, $address), 0, $user);
|
||||
$merchantCartList = $res['list'];
|
||||
@ -446,6 +447,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
|
||||
//计算单个商品实际支付金额
|
||||
$orderProcurePrice = 0;
|
||||
foreach ($merchantCart['list'] as $_k => &$cart) {
|
||||
$cartTotalPrice = bcmul($this->cartByPrice($cart), $cart['cart_num'], 2);
|
||||
$_cartTotalPrice = $cartTotalPrice;
|
||||
@ -453,9 +455,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
//单个商品实际支付金额
|
||||
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
||||
$cart['true_price'] = $cartTotalPrice;
|
||||
$procure = $this->cartByPrice($cart, 1);
|
||||
$procure_price = bcmul($cart['cart_num'], $procure, 2);
|
||||
$cart['profit_rate'] = bcdiv(($cartTotalPrice - $procure_price), $cartTotalPrice, 2);
|
||||
$orderProcurePrice = bcadd($orderProcurePrice, $procure_price, 2);
|
||||
}
|
||||
$procure = $this->cartByPrice($cart, 1);
|
||||
$procure_price = bcmul($cart['cart_num'], $procure, 2);
|
||||
unset($cart, $_k);
|
||||
$total_true_price = bcadd($_pay_price, $total_true_price, 2);
|
||||
if (count($merchantCartList) > 1 || count($merchantCart['list']) > 1) {
|
||||
@ -481,7 +485,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'delivery_status' => $deliveryStatus,
|
||||
'svip_discount' => $total_svip_discount,
|
||||
'use_svip' => $use_svip,
|
||||
'procure_price' => $procure_price
|
||||
'procure_price' => $orderProcurePrice
|
||||
];
|
||||
$order_total_postage = bcadd($order_total_postage, $postage_price, 2);
|
||||
$order_svip_discount = bcadd($total_svip_discount, $order_svip_discount, 2);
|
||||
@ -618,42 +622,49 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$allow_no_address = false;
|
||||
}
|
||||
|
||||
// 计算红包总金额
|
||||
$consumptionTotal = 0;
|
||||
if ($consumption_id > 0 && $this->store_consumption_user && $source == 103) {
|
||||
if ($this->store_consumption_user['type'] == 2 && $order_total_price >= 6) {
|
||||
if ($this->payType == 'balance') {
|
||||
throw new ValidateException('余额支付时,不能使用抵扣红包');
|
||||
}
|
||||
$consumptionTotal = bcdiv($order_total_price, 6, 2);
|
||||
}
|
||||
if ($this->store_consumption_user['type'] == 1) {
|
||||
$consumptionTotal = min($order_total_price, $this->balance);
|
||||
}
|
||||
$consumptionTotal = min($consumptionTotal, $this->balance);
|
||||
if (isset($this->store_consumption_user['type']) && $this->store_consumption_user['type'] == 2 && $order_total_price >= 6 && $this->payType == 'balance') {
|
||||
throw new ValidateException('余额支付时,不能使用抵扣红包');
|
||||
}
|
||||
$groupOrderPayPrice = $order_total_price;
|
||||
foreach ($merchantCartList as $k => &$merchantCart) {
|
||||
$isLast = count($merchantCartList) == $k + 1;
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
$cart['total_price'] = bcadd($cart['total_price'], $cart['svip_discount'], 2);
|
||||
}
|
||||
|
||||
$orderPayPrice = $merchantCart['order']['total_price'];
|
||||
if ($consumptionTotal) {
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->groupOrderTotalPrice = $groupOrderPayPrice;
|
||||
$storeConsumptionUserDao->orderTotalPrice = $orderPayPrice;
|
||||
$storeConsumptionUserDao->consumptionTotalAmount = $consumptionTotal;
|
||||
$storeConsumptionUserDao->isLast = $isLast;
|
||||
[$orderPayPrice, $groupOrderPayPrice, $useAmount, $consumptionTotal] = $storeConsumptionUserDao->calculateByOrder();
|
||||
$this->consumption_money = bcadd($this->consumption_money, $useAmount, 2);
|
||||
$this->balance = bcsub($this->balance, $useAmount, 2);
|
||||
$consumptionTotal = 0;
|
||||
$consumptionUsed = 0;
|
||||
$groupOrderPayPrice = 0;
|
||||
if ($consumption_id > 0 && $this->store_consumption_user && $source == 103) {
|
||||
$consumptionTotal = min($order_total_price, $this->balance);
|
||||
}
|
||||
foreach ($merchantCartList as $k => &$merchantCart) {
|
||||
$lastOrder = count($merchantCartList) == $k + 1;
|
||||
$orderPayPrice = 0;
|
||||
$orderConsumptionAmount = 0;
|
||||
foreach ($merchantCart['list'] as $key => &$cart) {
|
||||
$cart['total_price'] = bcadd($cart['total_price'], $cart['svip_discount'], 2);
|
||||
if ($consumptionTotal) {
|
||||
$lastProduct = count($merchantCart['list']) == $key + 1;
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->groupOrderTotalPrice = $order_total_price;
|
||||
$storeConsumptionUserDao->orderProductPrice = $cart['total_price'];
|
||||
$storeConsumptionUserDao->profitRate = $cart['profit_rate'];
|
||||
$storeConsumptionUserDao->consumptionTotalAmount = $consumptionTotal;
|
||||
$storeConsumptionUserDao->consumptionUsed = $consumptionUsed;
|
||||
$storeConsumptionUserDao->isLast = $lastOrder && $lastProduct;
|
||||
if ($this->store_consumption_user['type'] == 2) {
|
||||
[$payPrice, $useAmount, $consumptionUsed] = $storeConsumptionUserDao->typeTwoByProduct();
|
||||
} else {
|
||||
[$payPrice, $useAmount, $consumptionUsed] = $storeConsumptionUserDao->typeOneByProduct();
|
||||
}
|
||||
$this->consumption_money = bcadd($this->consumption_money, $useAmount, 2);
|
||||
$this->balance = bcsub($this->balance, $useAmount, 2);
|
||||
}
|
||||
$cart['pay_price'] = $payPrice ?? $cart['total_price'];
|
||||
$cart['consumption_price'] = $useAmount ?? 0;
|
||||
$orderPayPrice = bcadd($orderPayPrice, $cart['pay_price'], 2);
|
||||
$orderConsumptionAmount = bcadd($orderConsumptionAmount, $cart['consumption_price'], 2);
|
||||
$groupOrderPayPrice = bcadd($groupOrderPayPrice, $cart['pay_price'], 2);
|
||||
}
|
||||
|
||||
if ($source == 105) {
|
||||
$this->consumption_money = bcsub($orderPayPrice, 2, 2);
|
||||
$useAmount = $this->consumption_money;
|
||||
$orderConsumptionAmount = $this->consumption_money;
|
||||
$orderPayPrice = '2.00';
|
||||
$groupOrderPayPrice = $orderPayPrice;
|
||||
$order_total_price = $orderPayPrice;
|
||||
@ -662,7 +673,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
|
||||
unset($cart);
|
||||
$merchantCart['order']['consumption_money'] = $useAmount ?? '0.00';
|
||||
$merchantCart['order']['consumption_money'] = $orderConsumptionAmount;
|
||||
$merchantCart['order']['pay_price'] = $orderPayPrice;
|
||||
$merchantCart['order']['total_price'] = bcadd($merchantCart['order']['total_price'], $merchantCart['order']['svip_discount'], 2);
|
||||
$order_total_price = bcadd($order_total_price, $merchantCart['order']['svip_discount'], 2);
|
||||
@ -894,6 +905,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'give_integral' => $orderInfo['order_total_give_integral'],
|
||||
'consumption_id' => $orderInfo['consumption_id'],
|
||||
'consumption_money' => $orderInfo['consumption_money'],
|
||||
'source' => $orderInfo['source'],
|
||||
];
|
||||
event('order.create.before', compact('groupOrder', 'orderList'));
|
||||
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) {
|
||||
@ -1000,19 +1012,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'balance'=>0,'use_min_price'=>0,'order_id_set'=>'','create_time'=>date('Y-m-d H:i:s'),'start_time'=>date('Y-m-d H:i:s'),
|
||||
'end_time'=>date('Y-m-d H:i:s'),'use_time'=>date('Y-m-d H:i:s'),'type'=>1,'send_id'=>0,'status'=>1]);
|
||||
}else{
|
||||
$store_consumption_user = Db::name('store_consumption_user')->where('uid', $uid)->where('coupon_user_id', $groupOrder['consumption_id'])->where('status', 0)->find();
|
||||
if ($store_consumption_user) {
|
||||
if ($store_consumption_user['type'] == 1) {
|
||||
if ($store_consumption_user['balance'] > $groupOrder['consumption_money']) {
|
||||
$balance = bcsub($store_consumption_user['balance'], $groupOrder['consumption_money'], 2);
|
||||
$balanceArr = ['balance' => $balance];
|
||||
Db::name('store_consumption_user')->where('coupon_user_id', $store_consumption_user['coupon_user_id'])->update($balanceArr);
|
||||
} else {
|
||||
$balanceArr = ['balance' => 0, 'status' => 1];
|
||||
Db::name('store_consumption_user')->where('coupon_user_id', $store_consumption_user['coupon_user_id'])->update($balanceArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->reduce($groupOrder['consumption_id'], $groupOrder['consumption_money']);
|
||||
}
|
||||
|
||||
app()->make(UserBillRepository::class)->decBill($user['uid'], 'consumption', 'deduction', [
|
||||
@ -1173,6 +1174,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
'cart_info' => json_encode($order_cart),
|
||||
'product_source_id' => $product_source_id,
|
||||
'product_mer_id' => $product_mer_id,
|
||||
'pay_price' => $cart['pay_price'],
|
||||
'consumption_price' => $cart['consumption_price'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\store\order\StoreCartDao;
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
use app\common\dao\store\StoreActivityDao;
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\order\StoreOrderInterest;
|
||||
@ -164,6 +165,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
Db::commit();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('余额支付失败'.$e->getMessage().'。line:'.$e->getLine().'。file:'.$e->getFile());
|
||||
throw new ValidateException('余额支付失败'.$e->getMessage());
|
||||
}
|
||||
|
||||
@ -215,18 +217,15 @@ class StoreOrderRepository extends BaseRepository
|
||||
$orderStatus = [];
|
||||
$groupOrder->append(['orderList.orderProduct']);
|
||||
$flag = true;
|
||||
$finance = [];
|
||||
$profitsharing = [];
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$financeSn = $financialRecordRepository->getSn();
|
||||
$userMerchantRepository = app()->make(UserMerchantRepository::class);
|
||||
$storeOrderProfitsharingRepository = app()->make(StoreOrderProfitsharingRepository::class);
|
||||
$uid = $groupOrder->uid;
|
||||
$i = 1;
|
||||
// $isVipCoupon = app()->make(StoreGroupOrderRepository::class)->isVipCoupon($groupOrder);
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$svipDiscount = 0;
|
||||
$financeDao = new FinancialDao();
|
||||
foreach ($groupOrder->orderList as $_k => $order) {
|
||||
(new StoreActivityDao())->saveOrderProduct(2, $order);
|
||||
$order->paid = 1;
|
||||
@ -302,188 +301,40 @@ class StoreOrderRepository extends BaseRepository
|
||||
Queue::push(SendGoodsCodeJob::class, $order);
|
||||
}
|
||||
|
||||
// 商户流水账单数据
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => $presell ? 'order_presell' : 'order',
|
||||
'financial_pm' => 1,
|
||||
'type' => $presell ? 2 : 1,
|
||||
'number' => $order->pay_price,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
$financeDao->order = $order;
|
||||
$financeDao->user = $groupOrder->user;
|
||||
$financialType = $presell ? 'order_presell' : 'order';
|
||||
// 平台订单收入流水账单数据
|
||||
$financeDao->platformIn($order->total_price, $financialType);
|
||||
if ($order->consumption_money > 0) {
|
||||
$financeDao->platformOut($order->consumption_money, 'platform_consumption');
|
||||
}
|
||||
|
||||
if ($order->source == 103) {
|
||||
$_payPrice = $order->procure_price;
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'supply_chain',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
//市级供应链
|
||||
$product_mer_id = Db::name('store_order_product')->where('order_id', $order->order_id)->value('product_mer_id');
|
||||
// 平台支付市供应链流水账单数据
|
||||
$financeDao->platformOut($_payPrice, 'supply_chain', $product_mer_id);
|
||||
if ($product_mer_id) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $product_mer_id,
|
||||
'financial_record_sn' => $financeSn . (($i++)+1)
|
||||
];
|
||||
//市级供应链押金计算
|
||||
if ($_payPrice > 0) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
$merchantRepo->merId = $product_mer_id;
|
||||
$merchantRepo->forceMargin = false;
|
||||
[$_payCityPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
|
||||
[$_payCityPrice, $financeDao] = $merchantRepo->deductDeposit($_payPrice, $order, $financeDao);
|
||||
}
|
||||
if (isset($_payCityPrice)) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_true',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $_payCityPrice,
|
||||
'mer_id' => $product_mer_id,
|
||||
'financial_record_sn' => $financeSn . (($i++)+2)
|
||||
];
|
||||
if (!$is_combine) {
|
||||
app()->make(MerchantRepository::class)->addLockMoney($product_mer_id, 'order', $order->order_id, $_payCityPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//计算手续费
|
||||
$_order_rate = bcsub($order->pay_price, $_payPrice, 2);
|
||||
|
||||
//计算镇级供应链云仓实际获得金额
|
||||
// 服务团队佣金统一由新供销平台结算
|
||||
// if ($_order_rate > 0) {
|
||||
// $commission_rate = bcdiv(12, 100, 2);
|
||||
// $_payPrice = bcmul($_order_rate, $commission_rate, 2);
|
||||
// } else {
|
||||
// $_payPrice = 0;
|
||||
// }
|
||||
} else {
|
||||
$_payPrice = $order->pay_price;
|
||||
$_order_rate = 0;
|
||||
|
||||
//平台手续费
|
||||
if ($order['commission_rate'] > 0) {
|
||||
|
||||
$commission_rate = ($order['commission_rate'] / 100);
|
||||
|
||||
$_order_rate = bcmul($_payPrice, $commission_rate, 2);
|
||||
|
||||
$_payPrice = bcsub($_payPrice, $_order_rate, 2);
|
||||
// 结算各镇 小组佣金
|
||||
// event('order.paySuccessOrder', compact('order', '_order_rate'));
|
||||
}
|
||||
}
|
||||
|
||||
// bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
|
||||
// if ($presell) {
|
||||
// if (isset($order->orderProduct[0]['cart_info']['presell_extension_one']) && $order->orderProduct[0]['cart_info']['presell_extension_one'] > 0) {
|
||||
// $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_one'], 2);
|
||||
// }
|
||||
// if (isset($order->orderProduct[0]['cart_info']['presell_extension_two']) && $order->orderProduct[0]['cart_info']['presell_extension_two'] > 0) {
|
||||
// $_payPrice = bcadd($_payPrice, $order->orderProduct[0]['cart_info']['presell_extension_two'], 2);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
if (!$presell) {
|
||||
if ($order['commission_rate'] > 0 || $order->source == 103) {
|
||||
//支出手续费
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_charge',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_order_rate,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
//押金计算
|
||||
if ($_payPrice > 0) {
|
||||
/** @var MerchantRepository $merchantRepo */
|
||||
$merchantRepo = app()->make(MerchantRepository::class);
|
||||
$merchantRepo->merId = $order->mer_id;
|
||||
$merchantRepo->forceMargin = false;
|
||||
[$_payPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
|
||||
}
|
||||
if ($order->source == 103) {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'commission_to_cloud_warehouse',
|
||||
'financial_pm' => 0,
|
||||
'type' => 1,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
} else {
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'order_true',
|
||||
'financial_pm' => 0,
|
||||
'type' => 2,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// if ($order->platform_coupon_price > 0) {
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order->order_id,
|
||||
// 'order_sn' => $order->order_sn,
|
||||
// 'user_info' => $groupOrder->user->nickname,
|
||||
// 'user_id' => $uid,
|
||||
// 'financial_type' => $isVipCoupon ? 'order_svip_coupon' : 'order_platform_coupon',
|
||||
// 'financial_pm' => 0,
|
||||
// 'type' => 1,
|
||||
// 'number' => $order->platform_coupon_price,
|
||||
// 'mer_id' => $order->mer_id,
|
||||
// 'financial_record_sn' => $financeSn . ($i++)
|
||||
// ];
|
||||
// $_payPrice = bcadd($_payPrice, $order->platform_coupon_price, 2);
|
||||
// }
|
||||
if (!$is_combine) {
|
||||
app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $_payPrice);
|
||||
}
|
||||
}
|
||||
if ($is_combine) {
|
||||
$profitsharing[] = [
|
||||
'profitsharing_sn' => $storeOrderProfitsharingRepository->getOrderSn(),
|
||||
@ -506,14 +357,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
], $order->mer_id);
|
||||
//自动打印订单
|
||||
$this->autoPrinter($order->order_id, $order->mer_id);
|
||||
if ($order['pay_price'] > 0) {
|
||||
if ($order['pay_price'] > 0 && $order['source'] == 103) {
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润,商户和村、小组合伙人
|
||||
$finance = (new CommissionDao())->firstOrderCommission($order, $finance, $financeSn . ($i++));
|
||||
$addressCode = explode(',', $order['user_address_code']);
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润,镇合伙人
|
||||
if (!empty($addressCode[3])) {
|
||||
(new CommissionDao())->sendCommission($order, $addressCode[3], 3);
|
||||
}
|
||||
$financeDao = (new CommissionDao())->firstOrderCommission($order, $financeDao);
|
||||
}
|
||||
}
|
||||
//分销判断
|
||||
@ -530,7 +376,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
if (count($profitsharing)) {
|
||||
$storeOrderProfitsharingRepository->insertAll($profitsharing);
|
||||
}
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
$financeDao->save();
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
if (count($groupOrder['give_coupon_ids']) > 0)
|
||||
$groupOrder['give_coupon_ids'] = app()->make(StoreCouponRepository::class)->getGiveCoupon($groupOrder['give_coupon_ids'])->column('coupon_id');
|
||||
@ -2574,6 +2420,9 @@ class StoreOrderRepository extends BaseRepository
|
||||
public function childrenList($id, $merId)
|
||||
{
|
||||
$data = $this->dao->get($id);
|
||||
if (empty($data)) {
|
||||
return [];
|
||||
}
|
||||
$query = $this->dao->getSearch([])->with(['orderProduct'])->where('order_id', '<>', $id);
|
||||
if ($merId) $query->where('mer_id', $merId);
|
||||
if ($data['main_id']) {
|
||||
|
@ -14,11 +14,17 @@
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
|
||||
use app\common\dao\store\consumption\CommissionDao;
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\store\order\StoreOrderOtherDao;
|
||||
use app\common\dao\store\order\StoreRefundOrderDao;
|
||||
use app\common\dao\store\StoreActivityOrderDao;
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\store\order\StoreRefundOrder;
|
||||
use app\common\model\store\product\CloudProduct;
|
||||
use app\common\model\store\StoreActivityOrderProduct;
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\product\ProductRepository;
|
||||
@ -238,23 +244,14 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$productRefundPrices = app()->make(StoreRefundProductRepository::class)->userRefundPrice($products->column('order_product_id'));
|
||||
$totalPostage = 0;
|
||||
$totalRefundPrice = 0;
|
||||
$realPriceTotal = 0;
|
||||
$consumptionTotal = 0;
|
||||
foreach ($products as $k => $product) {
|
||||
$isLast = count($products->toArray()) == ($k + 1);
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->orderTotalPrice = $order['total_price'];
|
||||
$storeConsumptionUserDao->orderPayPrice = $order['pay_price'];
|
||||
$storeConsumptionUserDao->orderProductPrice = $product['product_price'];
|
||||
$storeConsumptionUserDao->realPriceTotal = $realPriceTotal;
|
||||
$storeConsumptionUserDao->isLast = $isLast;
|
||||
[$realPrice, $realPriceTotal, $consumptionPrice] = $storeConsumptionUserDao->calculate();
|
||||
$consumptionTotal = bcadd($consumptionTotal, $consumptionPrice, 2);
|
||||
$consumptionTotal = bcadd($consumptionTotal, $product['consumption_price'], 2);
|
||||
$productRefundPrice = $productRefundPrices[$product['order_product_id']] ?? [];
|
||||
$postagePrice = (!$order->status || $order->status == 9) ? bcsub($product['postage_price'], $productRefundPrice['refund_postage'] ?? 0, 2) : 0;
|
||||
$refundPrice = 0;
|
||||
if ($realPrice > 0) {
|
||||
$refundPrice = bcsub($realPrice, bcsub($productRefundPrice['refund_price'] ?? 0,$productRefundPrice['refund_postage']??0 ,2), 2);
|
||||
if ($product['pay_price'] > 0) {
|
||||
$refundPrice = bcsub($product['pay_price'], bcsub($productRefundPrice['refund_price'] ?? 0,$productRefundPrice['refund_postage']??0 ,2), 2);
|
||||
}
|
||||
$totalPostage = bcadd($totalPostage, $postagePrice, 2);
|
||||
$totalRefundPrice = bcadd($totalRefundPrice, $refundPrice, 2);
|
||||
@ -285,12 +282,8 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$productRefundPrices = app()->make(StoreRefundProductRepository::class)->userRefundPrice($products->column('order_product_id'));
|
||||
$product = $products[0];
|
||||
$productRefundPrice = $productRefundPrices[$product['order_product_id']] ?? [];
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->orderTotalPrice = $order['total_price'];
|
||||
$storeConsumptionUserDao->orderPayPrice = $order['pay_price'];
|
||||
$storeConsumptionUserDao->orderProductPrice = $product['product_price'];
|
||||
[$realPrice, $realPriceTotal, $consumptionPrice] = $storeConsumptionUserDao->calculate();
|
||||
$total_refund_price = bcsub($realPrice, bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
|
||||
$consumptionPrice = $product['consumption_price'];
|
||||
$total_refund_price = bcsub($product['pay_price'], bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
|
||||
$postage_price = (!$order->status || $order->status == 9) ? bcsub($product['postage_price'], $productRefundPrice['refund_postage'] ?? 0, 2) : 0;
|
||||
|
||||
return compact('total_refund_price', 'postage_price', 'consumptionPrice');
|
||||
@ -336,18 +329,10 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$total_extension_two = bcadd($total_extension_two, bcmul($product['refund_num'], $product['extension_two'], 2), 2);
|
||||
$postagePrice = (!$order->status || $order->status == 9) ? bcsub($product['postage_price'], $productRefundPrice['refund_postage'] ?? 0, 2) : 0;
|
||||
$totalRefundNum += $product['refund_num'];
|
||||
|
||||
$refundPrice = 0;
|
||||
//计算可退金额
|
||||
if ($order['total_price'] > 0) {
|
||||
$isLast = count($products->toArray()) == ($k + 1);
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->orderTotalPrice = $order['total_price'];
|
||||
$storeConsumptionUserDao->orderPayPrice = $order['pay_price'];
|
||||
$storeConsumptionUserDao->orderProductPrice = $product['product_price'];
|
||||
$storeConsumptionUserDao->realPriceTotal = $totalRefundPrice;
|
||||
$storeConsumptionUserDao->isLast = $isLast;
|
||||
[$refundPrice, $totalRefundPrice, $consumptionPrice] = $storeConsumptionUserDao->calculate();
|
||||
$consumptionTotal = bcadd($consumptionTotal, $consumptionPrice, 2);
|
||||
if ($product['pay_price'] > 0) {
|
||||
$refundPrice = bcsub($product['pay_price'], bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
|
||||
}
|
||||
|
||||
$platform_refund_price = 0;
|
||||
@ -360,6 +345,8 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$integral = bcsub($product['integral_total'], $productRefundPrice['refund_integral'] ?? 0, 0);
|
||||
}
|
||||
|
||||
$consumptionTotal = bcadd($consumptionTotal, $product['consumption_price'], 2);
|
||||
$totalRefundPrice = bcadd($totalRefundPrice, $refundPrice, 2);
|
||||
$totalPostage = bcadd($totalPostage, $postagePrice, 2);
|
||||
$totalPlatformRefundPrice = bcadd($totalPlatformRefundPrice, $platform_refund_price, 2);
|
||||
$totalIntegral = bcadd($totalIntegral, $integral, 2);
|
||||
@ -371,7 +358,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
'platform_refund_price' => $platform_refund_price,
|
||||
'refund_integral' => $integral,
|
||||
'refund_price' => $refundPrice,
|
||||
'refund_consumption' => $consumptionPrice,
|
||||
'refund_consumption' => $product['consumption_price'],
|
||||
'refund_postage' => $postagePrice,
|
||||
];
|
||||
}
|
||||
@ -470,12 +457,18 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$postagePrice = (!$order->status || $order->status == 9) ? bcsub($product['postage_price'], $productRefundPrice['refund_postage'] ?? 0, 2) : 0;
|
||||
|
||||
$refundPrice = 0;
|
||||
$consumptionRefund = 0;
|
||||
//计算可退金额
|
||||
if ($product['product_price'] > 0) {
|
||||
// 商品实付单价
|
||||
$payPrice = bcdiv($product['pay_price'], $product['product_num'], 2);
|
||||
$consumptionPrice = bcdiv($product['consumption_price'], $product['product_num'], 2);
|
||||
if ($product['refund_num'] == $num) {
|
||||
$refundPrice = bcsub($product['product_price'], bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
|
||||
$refundPrice = bcsub($product['pay_price'], bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
|
||||
$consumptionRefund = bcsub($product['consumption_price'], $productRefundPrice['refund_consumption'] ?? 0, 2);
|
||||
} else {
|
||||
$refundPrice = bcmul(bcdiv($product['product_price'], $product['product_num'], 2), $num, 2);
|
||||
$refundPrice = bcmul($payPrice, $num, 2);
|
||||
$consumptionRefund = bcmul($consumptionPrice, $num, 2);
|
||||
}
|
||||
}
|
||||
$totalRefundPrice = bcadd($refundPrice, $postagePrice, 2);
|
||||
@ -526,11 +519,12 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$data['refund_num'] = $num;
|
||||
$data['extension_one'] = $total_extension_one;
|
||||
$data['extension_two'] = $total_extension_two;
|
||||
$data['refund_consumption'] = $consumptionRefund;
|
||||
if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||
$data['refund_price'] = 0;
|
||||
}
|
||||
|
||||
return Db::transaction(function () use ($order, $data, $product, $productId, $num) {
|
||||
return Db::transaction(function () use ($order, $data, $product, $productId, $num, $consumptionRefund) {
|
||||
event('refund.create.before', compact('data'));
|
||||
$refund = $this->dao->create($data);
|
||||
app()->make(StoreRefundProductRepository::class)->create([
|
||||
@ -541,6 +535,7 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
'refund_price' => $data['refund_price'],
|
||||
'refund_integral' => $data['integral'],
|
||||
'refund_postage' => $data['refund_postage'],
|
||||
'refund_consumption' => $consumptionRefund,
|
||||
]);
|
||||
$product->refund_num -= $num;
|
||||
$product->is_refund = 1;
|
||||
@ -1176,15 +1171,25 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
//退还赠送积分
|
||||
$this->refundGiveIntegral($refundOrder);
|
||||
|
||||
app()->make(FinancialRecordRepository::class)->dec([
|
||||
'order_id' => $refundOrder->refund_order_id,
|
||||
'order_sn' => $refundOrder->refund_order_sn,
|
||||
'user_info' => $refundOrder->user->nickname,
|
||||
'user_id' => $refundOrder->uid,
|
||||
'financial_type' => 'refund_order',
|
||||
'type' => 1,
|
||||
'number' => $refundOrder->refund_price,
|
||||
], $refundOrder->mer_id);
|
||||
//退用户使用的红包
|
||||
if ($refundOrder['refund_consumption'] > 0) {
|
||||
(new StoreConsumptionUserDao())->refundByOrder($refundOrder);
|
||||
}
|
||||
|
||||
//活动订单撤销
|
||||
(new StoreActivityOrderDao())->repeal($refundOrder->order->group_order_id);
|
||||
|
||||
//退商户、服务团队的佣金
|
||||
(new CommissionDao())->refundByOrder($refundOrder);
|
||||
|
||||
//退供应链订单
|
||||
(new StoreOrderOtherDao())->refund($refundOrder);
|
||||
|
||||
$productIds = CloudProduct::where('activity_id', 2)->column('product_id');
|
||||
StoreActivityOrderProduct::where('user_id', $refundOrder->order['uid'])
|
||||
->whereIn('product_id', $productIds)
|
||||
->whereIn('activity_id', 2)
|
||||
->update(['status' => 0]);
|
||||
}
|
||||
|
||||
public function getRefundMerPrice(StoreRefundOrder $refundOrder, $refundPrice = null)
|
||||
@ -1312,31 +1317,29 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
$_refundRate = bcmul($commission_rate, bcsub($item['data']['refund_price'], $extension, 2), 2);
|
||||
$refundRate = bcadd($refundRate, $_refundRate, 2);
|
||||
}
|
||||
$margin = FinancialRecord::getInstance()->where('mer_id', $res->mer_id)->where('order_sn', $item['sn'])->where('financial_type', 'auto_margin')->value('number');
|
||||
$refundPrice = bcsub($refundPrice, $margin, 2);
|
||||
$refundPriceAll = bcadd($refundPriceAll, $refundPrice, 2);
|
||||
|
||||
try {
|
||||
$orderType = (isset($item['presell']) && $item['presell']) ? 'presell' : 'order';
|
||||
if ($item['type'] == 0) {
|
||||
$this->refundBill($item, $res->uid, $id);
|
||||
app()->make(MerchantRepository::class)->subLockMoney($res->mer_id, $orderType, $item['id'], $refundPrice);
|
||||
} else {
|
||||
if ($item['type'] == 10) $server = WechatService::create()->combinePay();
|
||||
if (in_array($item['type'], [2])) $server = MiniProgramService::create();
|
||||
if (in_array($item['type'], [4, 5])) $server = AlipayService::create();
|
||||
if (in_array($item['type'], [1, 3, 6])) $server = WechatService::create();
|
||||
$server->payOrderRefund($item['sn'], $item['data']);
|
||||
if ($item['type'] == 10) {
|
||||
$make = app()->make(StoreOrderProfitsharingRepository::class);
|
||||
if ($orderType === 'presell') {
|
||||
$make->refundPresallPrice($res, $item['data']['refund_price'], $refundPrice);
|
||||
} else {
|
||||
$make->refundPrice($res, $item['data']['refund_price'], $refundPrice);
|
||||
}
|
||||
} else {
|
||||
app()->make(MerchantRepository::class)->subLockMoney($res->mer_id, $orderType, $item['id'], $refundPrice);
|
||||
}
|
||||
// 目前是代销模式,下单的店铺不需要退钱,由供应链退款
|
||||
// if ($item['type'] == 10) {
|
||||
// $make = app()->make(StoreOrderProfitsharingRepository::class);
|
||||
// if ($orderType === 'presell') {
|
||||
// $make->refundPresallPrice($res, $item['data']['refund_price'], $refundPrice);
|
||||
// } else {
|
||||
// $make->refundPrice($res, $item['data']['refund_price'], $refundPrice);
|
||||
// }
|
||||
// } else {
|
||||
// app()->make(MerchantRepository::class)->subLockMoney($res->mer_id, $orderType, $item['id'], $refundPrice);
|
||||
// }
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new ValidateException($e->getMessage());
|
||||
@ -1344,27 +1347,16 @@ class StoreRefundOrderRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
app()->make(FinancialRecordRepository::class)->inc([
|
||||
'order_id' => $res->refund_order_id,
|
||||
'order_sn' => $res->refund_order_sn,
|
||||
'user_info' => $res->user->nickname,
|
||||
'user_id' => $res->uid,
|
||||
'financial_type' => 'refund_true',
|
||||
'number' => $refundPriceAll,
|
||||
'type' => 1,
|
||||
], $res->mer_id);
|
||||
$financeDao = new FinancialDao();
|
||||
$financeDao->order = $res->order->toArray();
|
||||
$financeDao->order['order_id'] = $res->refund_order_id;
|
||||
$financeDao->order['order_sn'] = $res->refund_order_sn;
|
||||
$financeDao->user = $res->user;
|
||||
$financeDao->platformOut($refundPriceAll, 'order_refund');
|
||||
$financeDao->save();
|
||||
|
||||
app()->make(FinancialRecordRepository::class)->inc([
|
||||
'order_id' => $res->refund_order_id,
|
||||
'order_sn' => $res->refund_order_sn,
|
||||
'user_info' => $res->user->nickname,
|
||||
'user_id' => $res->uid,
|
||||
'type' => 1,
|
||||
'financial_type' => 'refund_charge',
|
||||
'number' => $refundRate,
|
||||
], $res->mer_id);
|
||||
|
||||
event('refund.after', compact('id', 'res'));
|
||||
// 业务流程调整,暂时注释
|
||||
// event('refund.after', compact('id', 'res'));
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
@ -223,6 +223,9 @@ class ProductPresellRepository extends BaseRepository
|
||||
]);
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select()->append(['coupon', 'tattend_one', 'tattend_two', 'seles']);
|
||||
foreach ($list as &$item) {
|
||||
$item['type'] = 0;
|
||||
}
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
|
@ -1761,7 +1761,7 @@ class ProductRepository extends BaseRepository
|
||||
]
|
||||
], $product['mer_id']);
|
||||
app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
||||
event('product.sell', ['product_id' => [$id,'status'=>$status]]);
|
||||
event('product.sell', ['product_id' => [$id], 'status'=>$status]);
|
||||
$this->switchShow($id, $status, 'is_used', 0);
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,7 @@ class SpuRepository extends BaseRepository
|
||||
'product.attrValue',
|
||||
]);
|
||||
$productMake = app()->make(ProductRepository::class);
|
||||
$count = $query->fetchSql(false)->count();
|
||||
|
||||
$count = $query->count();
|
||||
if ($limit == 0) {
|
||||
$list = $query->setOption('field', [])->field($this->productFiled)->select()
|
||||
->each(function ($item) use ($is_sku, $productMake, $userInfo,$where) {
|
||||
@ -179,7 +178,7 @@ class SpuRepository extends BaseRepository
|
||||
$item['merchant']['village_name']=$village_name.'集体经营合作店铺';
|
||||
}
|
||||
}
|
||||
if (isset($item['merchant']['lat'] , $item['merchant']['long']) && isset($where['lat'], $where['long'])) {
|
||||
if (isset($item['merchant']['lat'] , $item['merchant']['long']) && isset($where['lat'], $where['long'])&&$where['lat']!='') {
|
||||
$distance = getDistance($where['lat'], $where['long'], $item['merchant']['lat'], $item['merchant']['long']);
|
||||
if ($distance < 0.9) {
|
||||
$distance = max(bcmul($distance, 1000, 0), 1).'m';
|
||||
@ -205,7 +204,7 @@ class SpuRepository extends BaseRepository
|
||||
$item['merchant']['village_name']=$village_name.'集体经营合作店铺';
|
||||
}
|
||||
}
|
||||
if (isset($item['merchant']['lat'] , $item['merchant']['long']) && isset($where['lat'], $where['long'])) {
|
||||
if (isset($item['merchant']['lat'] , $item['merchant']['long']) && isset($where['lat'], $where['long'])&&$where['lat']!='') {
|
||||
$distance = getDistance($where['lat'], $where['long'], $item['merchant']['lat'], $item['merchant']['long']);
|
||||
if ($distance < 0.9) {
|
||||
$distance = max(bcmul($distance, 1000, 0), 1).'m';
|
||||
|
@ -16,9 +16,7 @@ namespace app\common\repositories\system\merchant;
|
||||
|
||||
use app\common\dao\system\merchant\FinancialRecordDao;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\user\UserBillRepository;
|
||||
use app\common\repositories\user\UserRechargeRepository;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -31,6 +29,14 @@ use think\facade\Db;
|
||||
*/
|
||||
class FinancialRecordRepository extends BaseRepository
|
||||
{
|
||||
|
||||
public $commonFinancialType = [
|
||||
'order', 'order_refund', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon',
|
||||
'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund'
|
||||
,'commission_to_entry_merchant','commission_to_entry_merchant_refund'
|
||||
,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund', 'commission_to_store', 'commission_to_courier', 'commission_to_promoter', 'commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund', 'auto_margin', 'auto_margin_refund', 'supply_chain', 'supply_chain_refund', 'platform_consumption', 'platform_consumption_refund'
|
||||
];
|
||||
|
||||
public function __construct(FinancialRecordDao $dao)
|
||||
{
|
||||
$this->dao = $dao;
|
||||
@ -50,6 +56,11 @@ class FinancialRecordRepository extends BaseRepository
|
||||
$query = $this->dao->search($where)->order('create_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
foreach ($list as &$item) {
|
||||
if (!empty($where['mer_id'])) {
|
||||
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return compact('count', 'list');
|
||||
}
|
||||
|
||||
@ -115,33 +126,45 @@ class FinancialRecordRepository extends BaseRepository
|
||||
//订单收入总金额
|
||||
$count = $this->dao->search($where)->where('financial_type', 'in', ['order', 'order_presell', 'presell'])->sum('number');
|
||||
//退款支出金额
|
||||
$refund_order = $this->dao->search($where)->where('financial_type', 'refund_order')->sum('number');
|
||||
$refund_order = $this->dao->search($where)->where('financial_type', 'order_refund')->sum('number');
|
||||
$platformProfit = bcsub($count, $refund_order, 2);
|
||||
//供应链金额
|
||||
$supply = $this->dao->search($where)->where('financial_type', 'supply_chain')->sum('number');
|
||||
$supplyRefund = $this->dao->search($where)->where('financial_type', 'supply_chain_refund')->sum('number');
|
||||
$platformProfit = bcsub($platformProfit, $supply, 2);
|
||||
$platformProfit = bcadd($platformProfit, $supplyRefund, 2);
|
||||
//佣金支出金额
|
||||
$brokerage_ = $this->dao->search($where)->where('financial_type', 'in', ['brokerage_one', 'brokerage_two'])->sum('number');
|
||||
$_brokerage = $this->dao->search($where)->where('financial_type', 'in', ['refund_brokerage_two', 'refund_brokerage_one'])->sum('number');
|
||||
$brokerage = bcsub($brokerage_, $_brokerage, 2);
|
||||
|
||||
//入口店铺佣金
|
||||
$entry_merchant=$this->dao->search($where)->where('financial_type', 'commission_to_entry_merchant')->sum('number');
|
||||
$entry_merchant_refund=$this->dao->search($where)->where('financial_type', 'commission_to_entry_merchant_refund')->sum('number');
|
||||
//云仓库佣金
|
||||
$cloud_warehouse=$this->dao->search($where)->where('financial_type', 'commission_to_cloud_warehouse')->sum('number');
|
||||
$cloud_warehouse_refund=$this->dao->search($where)->where('financial_type', 'commission_to_cloud_warehouse_refund')->sum('number');
|
||||
//服务团队佣金
|
||||
$service_team=$this->dao->search($where)->where('financial_type', 'commission_to_service_team')->sum('number');
|
||||
$service_team_refund=$this->dao->search($where)->where('financial_type', 'commission_to_service_team_refund')->sum('number');
|
||||
//村团队佣金
|
||||
$village=$this->dao->search($where)->where('financial_type', 'commission_to_village')->sum('number');
|
||||
$village_refund=$this->dao->search($where)->where('financial_type', 'commission_to_village_refund')->sum('number');
|
||||
//镇佣金
|
||||
$town=$this->dao->search($where)->where('financial_type', 'commission_to_town')->sum('number');
|
||||
$town_refund=$this->dao->search($where)->where('financial_type', 'commission_to_town_refund')->sum('number');
|
||||
//平台手续费
|
||||
$charge_ = $this->dao->search($where)->where('financial_type', 'in', ['order_charge', 'presell_charge'])->sum('number');
|
||||
$_charge = $this->dao->search($where)->where('financial_type', 'refund_charge')->sum('number');
|
||||
$charge = bcsub($charge_, $_charge, 2);
|
||||
$platformProfit = bcsub($platformProfit, $brokerage, 2);
|
||||
// 保证金
|
||||
$margin = $this->dao->search($where)->where('financial_type', 'auto_margin')->sum('number');
|
||||
$marginRefund = $this->dao->search($where)->where('financial_type', 'auto_margin_refund')->sum('number');
|
||||
$platformProfit = bcadd($platformProfit, $margin, 2);
|
||||
$platformProfit = bcsub($platformProfit, $marginRefund, 2);
|
||||
//直推首单佣金
|
||||
$promoter = $this->dao->search($where)->where('financial_type', 'commission_to_promoter')->sum('number');
|
||||
$promoterRefund = $this->dao->search($where)->where('financial_type', 'commission_to_promoter_refund')->sum('number');
|
||||
$platformProfit = bcsub($platformProfit, $promoter, 2);
|
||||
$platformProfit = bcadd($platformProfit, $promoterRefund, 2);
|
||||
//配送员佣金
|
||||
$courier = $this->dao->search($where)->where('financial_type', 'commission_to_courier')->sum('number');
|
||||
$courierRefund = $this->dao->search($where)->where('financial_type', 'commission_to_courier_refund')->sum('number');
|
||||
$platformProfit = bcsub($platformProfit, $courier, 2);
|
||||
$platformProfit = bcadd($platformProfit, $courierRefund, 2);
|
||||
//提货店铺佣金
|
||||
$store = $this->dao->search($where)->where('financial_type', 'commission_to_store')->sum('number');
|
||||
$storeRefund = $this->dao->search($where)->where('financial_type', 'commission_to_store_refund')->sum('number');
|
||||
$platformProfit = bcsub($platformProfit, $store, 2);
|
||||
$platformProfit = bcadd($platformProfit, $storeRefund, 2);
|
||||
//优惠券费用 ,'order_platform_coupon','order_svip_coupon'
|
||||
$coupon = $this->dao->search($where)->where('financial_type', 'in', ['order_platform_coupon', 'order_svip_coupon'])->sum('number');
|
||||
// 消费金
|
||||
$consumption = $this->dao->search($where)->where('financial_type', 'platform_consumption')->sum('number');
|
||||
$consumptionRefund = $this->dao->search($where)->where('financial_type', 'platform_consumption_refund')->sum('number');
|
||||
$platformProfit = bcsub($platformProfit, $consumption, 2);
|
||||
$platformProfit = bcadd($platformProfit, $consumptionRefund, 2);
|
||||
//充值金额
|
||||
$bill_where = [
|
||||
'status' => 1,
|
||||
@ -173,18 +196,24 @@ class FinancialRecordRepository extends BaseRepository
|
||||
'field' => '元',
|
||||
'name' => '退款支出金额'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-goods',
|
||||
'count' => $supply,
|
||||
'field' => '元',
|
||||
'name' => '供应链成本'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => $supplyRefund,
|
||||
'field' => '元',
|
||||
'name' => '供应链退款'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
'count' => $brokerage,
|
||||
'field' => '元',
|
||||
'name' => '佣金支出金额'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
'count' => $charge,
|
||||
'field' => '元',
|
||||
'name' => '平台手续费'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-finance',
|
||||
'count' => $bill,
|
||||
@ -208,36 +237,42 @@ class FinancialRecordRepository extends BaseRepository
|
||||
'count' => $coupon,
|
||||
'field' => '元',
|
||||
'name' => '优惠券金额'
|
||||
],[
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => bcsub($entry_merchant,$entry_merchant_refund,2),
|
||||
'count' => bcsub($margin, $marginRefund, 2),
|
||||
'field' => '元',
|
||||
'name' => '入口商户佣金'
|
||||
],[
|
||||
'name' => '店铺保证金'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => bcsub($cloud_warehouse,$cloud_warehouse_refund,2),
|
||||
'count' => bcsub($promoter, $promoterRefund, 2),
|
||||
'field' => '元',
|
||||
'name' => '云仓库佣金'
|
||||
],[
|
||||
'name' => '直推首单佣金'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => bcsub($service_team,$service_team_refund,2),
|
||||
'count' => bcsub($courier, $courierRefund, 2),
|
||||
'field' => '元',
|
||||
'name' => '小组服务佣金'
|
||||
],[
|
||||
'name' => '配送员佣金'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => bcsub($village,$village_refund,2),
|
||||
'count' => bcsub($store, $storeRefund, 2),
|
||||
'field' => '元',
|
||||
'name' => '村佣金'
|
||||
],[
|
||||
'name' => '提货店铺佣金'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' => bcsub($town,$town_refund,2),
|
||||
'count' => bcsub($consumption, $consumptionRefund, 2),
|
||||
'field' => '元',
|
||||
'name' => '镇佣金'
|
||||
],[
|
||||
'name' => '平台红包(包含通用和抵扣)'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-order',
|
||||
'count' =>bcsub($charge, bcadd(bcadd(bcadd($entry_merchant, $cloud_warehouse, 2), $service_team, 2), $village, 2), 2),
|
||||
'count' => $platformProfit,
|
||||
'field' => '元',
|
||||
'name' => '平台剩余手续费'
|
||||
'name' => '平台结余'
|
||||
],
|
||||
];
|
||||
return compact('stat');
|
||||
@ -253,7 +288,7 @@ class FinancialRecordRepository extends BaseRepository
|
||||
public function getMerchantTitle($where)
|
||||
{
|
||||
//商户收入
|
||||
$count = $this->dao->search($where)->where('financial_type', 'in', ['order', 'mer_presell'])->sum('number');
|
||||
$count = $this->dao->search($where)->where('financial_type', 'in', ['order', 'mer_presell', 'supply_chain'])->sum('number');
|
||||
//押金
|
||||
$auto_margin = $this->dao->search($where)->where('financial_type', 'auto_margin')->sum('number');
|
||||
$auto_margin_refund = $this->dao->search($where)->where('financial_type', 'auto_margin_refund')->sum('number');
|
||||
@ -266,22 +301,18 @@ class FinancialRecordRepository extends BaseRepository
|
||||
//商户可提现金额
|
||||
$_line = bcsub($mer_money, $extract_minimum_line, 2);
|
||||
//退款支出金额
|
||||
$refund_order = $this->dao->search($where)->where('financial_type', 'refund_order')->sum('number');
|
||||
//佣金支出金额
|
||||
$_brokerage = $this->dao->search($where)->where('financial_type', 'in', ['brokerage_one', 'brokerage_two'])->sum('number');
|
||||
$refund_brokerage = $this->dao->search($where)->where('financial_type', 'in', ['refund_brokerage_one', 'refund_brokerage_two'])->sum('number');
|
||||
$brokerage = bcsub($_brokerage, $refund_brokerage, 2);
|
||||
//平台手续费
|
||||
$refund_true = $this->dao->search($where)->where('financial_type', 'in', ['order_charge', 'presell_charge'])->sum('number');
|
||||
$order_charge = $this->dao->search($where)->where('financial_type', 'refund_charge')->sum('number');
|
||||
$charge = bcsub($refund_true, $order_charge, 2);
|
||||
$refund_order = $this->dao->search($where)->where('financial_type', 'in', ['refund_order', 'supply_chain_refund'])->sum('number');
|
||||
//平台佣金
|
||||
$commission = $this->dao->search($where)->whereIn('financial_type', ['commission_to_store', 'commission_to_promoter'])->sum('number');
|
||||
$commissionRefund = $this->dao->search($where)->whereIn('financial_type', ['commission_to_store_refund', 'commission_to_promoter_refund'])->sum('number');
|
||||
$commission = bcsub($commission, $commissionRefund, 2);
|
||||
//商户可提现金额
|
||||
// $bill_order = app()->make(StoreOrderRepository::class)->search(['paid' => 1,'date' => $where['date'],'pay_type' => 0])->sum('pay_price');
|
||||
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']);
|
||||
$stat = [
|
||||
[
|
||||
'className' => 'el-icon-s-goods',
|
||||
'count' => $count,
|
||||
'count' => bcsub($count, 0, 2),
|
||||
'field' => '元',
|
||||
'name' => '商户收入'
|
||||
],
|
||||
@ -299,27 +330,15 @@ class FinancialRecordRepository extends BaseRepository
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
'count' => $refund_order,
|
||||
'count' => bcsub($refund_order, 0, 2),
|
||||
'field' => '元',
|
||||
'name' => '退款支出'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-finance',
|
||||
'count' => $brokerage,
|
||||
'field' => '元',
|
||||
'name' => '佣金支出'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
'count' => $charge,
|
||||
'count' => $commission,
|
||||
'field' => '元',
|
||||
'name' => '平台手续费'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
'count' => $coupon,
|
||||
'field' => '元',
|
||||
'name' => '平台优惠券补贴'
|
||||
'name' => '平台佣金'
|
||||
],
|
||||
[
|
||||
'className' => 'el-icon-s-cooperation',
|
||||
@ -434,11 +453,15 @@ class FinancialRecordRepository extends BaseRepository
|
||||
'number' => $expend['number'],
|
||||
'count' => $expend['count'] . '笔',
|
||||
'data' => [
|
||||
['应付商户金额', $expend['number_order'] . '元', $expend['count_order'] . '笔'],
|
||||
['订单退款金额', $expend['number_refund'] . '元', $expend['count_refund'] . '笔'],
|
||||
['应付商户金额', $expend['number_supply_chain'] . '元', $expend['count_supply_chain'] . '笔'],
|
||||
['佣金', $expend['number_brokerage'] . '元', $expend['count_brokerage'] . '笔'],
|
||||
['返还手续费', $expend['number_charge'] . '元', $expend['count_charge'] . '笔'],
|
||||
['优惠券补贴', $expend['number_coupon'] . '元', $expend['count_coupon'] . '笔'],
|
||||
['会员优惠券补贴', $expend['number_svipcoupon'] . '元', $expend['count_svipcoupon'] . '笔'],
|
||||
['平台红包补贴', $expend['number_consumption'] . '元', $expend['count_consumption'] . '笔'],
|
||||
['服务团队佣金', $expend['number_commission'] . '元', $expend['count_commission'] . '笔'],
|
||||
['保证金退款', $expend['number_margin'] . '元', $expend['count_margin'] . '笔'],
|
||||
]
|
||||
];
|
||||
$data['charge'] = [
|
||||
@ -470,11 +493,13 @@ class FinancialRecordRepository extends BaseRepository
|
||||
|
||||
$data['date'] = $date;
|
||||
$data['income'] = [
|
||||
'title' => '订单收入总金额',
|
||||
'title' => '收入总金额',
|
||||
'number' => $income['number'],
|
||||
'count' => $income['count'] . '笔',
|
||||
'data' => [
|
||||
['订单支付', $income['number_order'] . '元', $income['count_order'] . '笔'],
|
||||
['平台佣金', $income['number_commission'] . '元', $income['count_commission'] . '笔'],
|
||||
['保证金退还', $income['number_margin_refund'] . '元', $income['count_margin_refund'] . '笔'],
|
||||
['优惠券补贴', $income['number_coupon'] . '元', $income['count_coupon'] . '笔'],
|
||||
['会员优惠券补贴', $income['number_svipcoupon'] . '元', $income['count_svipcoupon'] . '笔'],
|
||||
]
|
||||
@ -484,16 +509,10 @@ class FinancialRecordRepository extends BaseRepository
|
||||
'number' => $expend['number'],
|
||||
'count' => $expend['count'] . '笔',
|
||||
'data' => [
|
||||
[
|
||||
'平台手续费',
|
||||
bcsub($expend['number_order_charge'], $expend['number_charge'], 2). '元',
|
||||
bcsub($expend['count_order_charge'], $expend['count_charge']). '笔',
|
||||
],
|
||||
[
|
||||
'店铺押金',
|
||||
$expend['number_auto_margin'] . '元',
|
||||
$expend['count_auto_margin'] . '笔'
|
||||
|
||||
],
|
||||
[
|
||||
'自动下单市供应链',
|
||||
@ -542,7 +561,12 @@ class FinancialRecordRepository extends BaseRepository
|
||||
*/
|
||||
public function countIncome($type, $where, $date, $merchant = [])
|
||||
{
|
||||
$financialType = ['order', 'order_presell', 'presell', 'mer_presell'];
|
||||
if ($where['is_mer'] > 0) {
|
||||
$financialType = ['supply_chain'];
|
||||
} else {
|
||||
$financialType = ['order', 'commission_to_store_refund', 'commission_to_promoter_refund',
|
||||
'commission_to_courier_refund', 'supply_chain_refund', 'auto_margin', 'platform_consumption_refund'];
|
||||
}
|
||||
if ($merchant){
|
||||
switch ($merchant['type_id']) {
|
||||
case 16:
|
||||
@ -587,9 +611,13 @@ class FinancialRecordRepository extends BaseRepository
|
||||
$financialType = ['refund_svip_coupon'];
|
||||
}
|
||||
[$data['count_svipcoupon'], $data['number_svipcoupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
[$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, ['commission_to_store', 'commission_to_promoter']);
|
||||
[$data['count_margin_refund'], $data['number_margin_refund']] = $this->dao->getDataByType($type, $where, $date, ['auto_margin_refund']);
|
||||
|
||||
$data['count'] = $data['count_order'];
|
||||
$data['count'] = $data['count_order'] + $data['count_commission'] + $data['count_margin_refund'];
|
||||
$data['number'] = bcadd($data['number_coupon'], $data['number_order'], 2);
|
||||
$data['number'] = bcadd($data['number'], $data['number_commission'], 2);
|
||||
$data['number'] = bcadd($data['number'], $data['number_margin_refund'], 2);
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -672,90 +700,53 @@ class FinancialRecordRepository extends BaseRepository
|
||||
}
|
||||
if ($where['is_mer']) { //商户的
|
||||
//退回收入
|
||||
$financialType = ['refund_order'];
|
||||
$financialType = ['supply_chain_refund'];
|
||||
[$data['count_refund'], $data['number_refund']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
//平台手续费
|
||||
$financialType = ['order_charge', 'presell_charge'];
|
||||
[$data['count_order_charge'], $data['number_order_charge']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
//转给市级供应链
|
||||
$financialType = ['supply_chain'];
|
||||
[$data['count_supply_chain'], $data['number_supply_chain']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
[$data['count_order_charge'], $data['number_order_charge']] = [0, 0];
|
||||
[$data['count_supply_chain'], $data['number_supply_chain']] = [0, 0];
|
||||
//商户押金
|
||||
$financialType = ['auto_margin'];
|
||||
[$data['count_auto_margin'], $data['number_auto_margin']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
//商户押金退回
|
||||
$financialType = ['auto_margin_refund'];
|
||||
[$data['count_auto_margin_refund'], $data['number_auto_margin_refund']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$number3 = bcsub($data['number_auto_margin'], $data['number_auto_margin_refund'], 2);
|
||||
$data['count_auto_margin'] = bcsub($data['count_auto_margin'], $data['count_auto_margin_refund']);
|
||||
$data['number_auto_margin'] = $number3;
|
||||
//退回佣金
|
||||
$financialType = ['refund_brokerage_two', 'refund_brokerage_one'];
|
||||
[$data['count_refund_brokerage'], $data['number_refund_brokerage']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
[$data['count_refund_brokerage'], $data['number_refund_brokerage']] = [0, 0];
|
||||
//退回给平台的优惠券金额
|
||||
$financialType = ['refund_platform_coupon'];
|
||||
[$data['count_coupon'], $data['number_coupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
[$data['count_coupon'], $data['number_coupon']] = [0, 0];
|
||||
//退回给平台的会员优惠券金额
|
||||
$financialType = ['refund_svip_coupon'];
|
||||
[$data['count_svipcoupon'], $data['number_svipcoupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
// if (!empty($financialType1)){
|
||||
// $financialType2= [explode('_refund',$financialType1[0])[0]];
|
||||
// halt($financialType1,$financialType2);
|
||||
// [$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, $financialType1);
|
||||
// [$data['count_commission2'], $data['number_commission2']] = $this->dao->getDataByType($type, $where, $date, $financialType2);
|
||||
// $data['count_brokerage']+=$data['count_commission2']-$data['count_commission'];
|
||||
// $data['number_brokerage']+=$data['number_commission2']-$data['number_commission'];
|
||||
// }
|
||||
//佣金 brokerage_one,brokerage_two - 退回佣金 refund_brokerage_two,refund_brokerage_one )
|
||||
$number = bcsub($data['number_brokerage'], $data['number_refund_brokerage'], 2);
|
||||
//平台手续费 =( order_charge + 预售手续费 presell_charge - 平台退给商户的手续费 refund_charge )
|
||||
$number_1 = bcsub($data['number_order_charge'], $data['number_charge'], 2);
|
||||
[$data['count_svipcoupon'], $data['number_svipcoupon']] = [0, 0];
|
||||
if($data['number_supply_chain']>0){
|
||||
$financialType = ['commission_to_cloud_warehouse'];
|
||||
[$data['count_commission_to_cloud_warehouse'], $data['number_commission_to_cloud_warehouse']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$number_1=bcadd($number_1, $data['number_supply_chain'], 2);
|
||||
$number_1=bcsub( $number_1, $data['number_commission_to_cloud_warehouse'], 2);
|
||||
[$data['count_commission_to_cloud_warehouse'], $data['number_commission_to_cloud_warehouse']] = [0, 0];
|
||||
}
|
||||
|
||||
//退回收入 refund_order + 退回佣金
|
||||
$number_2 = bcadd(bcadd($data['number_refund'], $data['number_coupon'], 2), $data['number_svipcoupon'], 2);
|
||||
$data['count'] =$data['count_supply_chain']+ $data['count_brokerage'] + $data['count_refund'] + $data['count_order_charge'] + $data['count_refund_brokerage'] + $data['count_svipcoupon'] + $data['count_auto_margin']-$data['count_charge'];
|
||||
$data['number'] = bcadd(bcadd($number3,bcadd($number_2, $number, 2),2), $number_1, 2);
|
||||
|
||||
$financialType = ['refund_order', 'supply_chain_refund', 'commission_to_promoter_refund', 'commission_to_store_refund', 'auto_margin'];
|
||||
[$data['count'], $data['number']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$data['number'] = bcsub($data['number'], 0, 2);
|
||||
} else { //平台的
|
||||
// 退回 订单实际获得金额
|
||||
|
||||
$financialType = ['order_true', 'presell_true','auto_margin'];
|
||||
[$data['count_order'], $data['number_order']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
$financialType = ['commission_to_entry_merchant'];
|
||||
[$data['count_merchant'], $data['number_merchant']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$data['count_order']=bcsub($data['count_order'],$data['count_merchant']);
|
||||
$data['number_order']=bcsub($data['number_order'],$data['number_merchant'], 2);
|
||||
|
||||
// 退款订单
|
||||
[$data['count_refund'], $data['number_refund']] = $this->dao->getDataByType($type, $where, $date, ['order_refund']);
|
||||
$total = $data['number_refund'];
|
||||
// 供应链订单
|
||||
[$data['count_supply_chain'], $data['number_supply_chain']] = $this->dao->getDataByType($type, $where, $date, ['supply_chain']);
|
||||
$total = bcadd($total, $data['number_supply_chain'], 2);
|
||||
// 退保证金记录
|
||||
[$data['count_margin'], $data['number_margin']] = $this->dao->getDataByType($type, $where, $date, ['auto_margin_refund']);
|
||||
$total = bcadd($total, $data['number_margin'], 2);
|
||||
//付给商户的优惠券抵扣金额
|
||||
$financialType = ['order_platform_coupon'];
|
||||
[$data['count_coupon'], $data['number_coupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
[$data['count_coupon'], $data['number_coupon']] = $this->dao->getDataByType($type, $where, $date, ['order_platform_coupon']);
|
||||
$total = bcadd($total, $data['number_coupon'], 2);
|
||||
//付给商户的svip优惠券抵扣金额
|
||||
$financialType = ['order_svip_coupon'];
|
||||
[$data['count_svipcoupon'], $data['number_svipcoupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
|
||||
[$data['count_svipcoupon'], $data['number_svipcoupon']] = $this->dao->getDataByType($type, $where, $date, ['order_svip_coupon']);
|
||||
$total = bcadd($total, $data['number_svipcoupon'], 2);
|
||||
//付给服务团队和其他的佣金
|
||||
[$data['count_refund'], $data['number_refund']] = $this->dao->getDataByType($type, $where, $date, $refund);
|
||||
[$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, $commission);
|
||||
$financialType = ['commission_to_store', 'commission_to_courier', 'commission_to_promoter'];
|
||||
[$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$total = bcadd($total, $data['number_commission'], 2);
|
||||
//平台红包
|
||||
$financialType = ['platform_consumption'];
|
||||
[$data['count_consumption'], $data['number_consumption']] = $this->dao->getDataByType($type, $where, $date, $financialType);
|
||||
$total = bcadd($total, $data['number_consumption'], 2);
|
||||
|
||||
$data['count_brokerage']+=$data['count_commission']-$data['count_refund'];
|
||||
$data['number_brokerage']+=$data['number_commission']-$data['number_refund'];
|
||||
|
||||
$number = bcadd($data['number_brokerage'], $data['number_order'], 2);
|
||||
$number_1 = bcadd(bcadd($number, $data['number_coupon'], 2), $data['number_svipcoupon'], 2);
|
||||
|
||||
$data['count'] = $data['count_brokerage'] + $data['count_order'] + $data['count_charge'];
|
||||
$data['number'] = bcadd($number_1, $data['number_charge'], 2);
|
||||
$data['count'] = $data['count_refund'] + $data['count_supply_chain'] + $data['count_margin'] + $data['count_coupon'] + $data['count_svipcoupon'] + $data['count_commission'] + $data['count_consumption'];
|
||||
$data['number'] = $total;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
namespace app\common\repositories\system\merchant;
|
||||
|
||||
|
||||
use app\common\dao\system\financial\FinancialDao;
|
||||
use app\common\dao\system\merchant\MerchantDao;
|
||||
use app\common\dao\system\serve\ServeOrderDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
@ -676,6 +677,7 @@ class MerchantRepository extends BaseRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 用下面的 deductDeposit
|
||||
* 自动扣除押金
|
||||
* @param $income
|
||||
* @param $order
|
||||
@ -748,4 +750,96 @@ class MerchantRepository extends BaseRepository
|
||||
return [bcsub($income,$margin,2), $finance, true];
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动扣除押金
|
||||
* @param $income
|
||||
* @param $order
|
||||
* @param FinancialDao $financeDao
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function deductDeposit($income, $order, FinancialDao $financeDao)
|
||||
{
|
||||
$merchant = Merchant::find($this->merId);
|
||||
// $margin_type = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
|
||||
//商户押金大于支付押金 或者forceMargin==false 直接返回 不计算押金
|
||||
if ($merchant['paid_margin']>= $merchant['margin']|| ($this->forceMargin === false && $merchant['auto_margin_rate'] == 0)) {
|
||||
return [$income, $financeDao];
|
||||
}
|
||||
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
||||
// //商户押金未完全缴纳且设置了自动扣除比例
|
||||
$margin= bcmul($income, bcdiv($rate, 100,2), 2);
|
||||
// $margin = min(bcsub($margin, $merchant['paid_margin'], 2), $margin);
|
||||
// $income = max(bcsub($income, $margin, 2), 0);
|
||||
// if ($margin <= 0) {
|
||||
// return [$income, $financeDao];
|
||||
// }
|
||||
$financeDao->platformIn($margin, 'auto_margin', $this->merId);
|
||||
if(bcadd($merchant['paid_margin'],$margin)>=$merchant['margin']){
|
||||
$is_margin=10;
|
||||
}else{
|
||||
$is_margin=1;
|
||||
}
|
||||
$orderInfo = [
|
||||
'type_id' => $merchant['type_id'],
|
||||
'is_margin' => $is_margin,
|
||||
'margin' => $margin,
|
||||
];
|
||||
$values = [
|
||||
'status' => 1,
|
||||
'is_del' => 0,
|
||||
'mer_id' => $merchant['mer_id'],
|
||||
'type' => ServeOrderRepository::TYPE_MARGIN,
|
||||
'meal_id'=> $merchant['type_id'],
|
||||
'pay_type' => ServeOrderRepository::PAY_TYPE_BALANCE,
|
||||
'order_info' => json_encode($orderInfo,JSON_UNESCAPED_UNICODE),
|
||||
'pay_price' => $margin,
|
||||
'store_order_id' => $order['order_id'],
|
||||
];
|
||||
$values['order_sn'] = app()->make(StoreOrderRepository::class)->getNewOrderId('cs');
|
||||
$values['pay_time'] = date('y_m-d H:i:s', time());
|
||||
if (!app()->make(ServeOrderDao::class)->create($values)) {
|
||||
throw new \Exception('serve_order 保存出错', 500);
|
||||
}
|
||||
$merchant->paid_margin = bcadd($margin, $merchant->paid_margin, 2);
|
||||
$merchant->ot_margin = $merchant->paid_margin;
|
||||
$merchant->is_margin = $is_margin;
|
||||
if ($merchant->save() === false) {
|
||||
throw new \Exception('merchant 保存出错', 500);
|
||||
}
|
||||
|
||||
return [bcsub($income,$margin,2), $financeDao];
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动扣除押金
|
||||
* @param $income
|
||||
* @param FinancialDao $financeDao
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function refundDeposit($income, FinancialDao $financeDao)
|
||||
{
|
||||
$merchant = Merchant::find($this->merId);
|
||||
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
|
||||
$margin = bcmul($income, bcdiv($rate, 100,2), 2);
|
||||
$merchant->paid_margin = bcsub($merchant->paid_margin, $margin, 2);
|
||||
if ($merchant->paid_margin <= 0) {
|
||||
return [bcsub($income,$margin,2), $financeDao];
|
||||
}
|
||||
if ($merchant->paid_margin < $merchant['margin'] && $merchant->is_margin == 10) {
|
||||
$merchant->is_margin = 1;
|
||||
}
|
||||
$merchant->ot_margin = $merchant->paid_margin;
|
||||
if ($merchant->save() === false) {
|
||||
throw new \Exception('merchant 保存出错', 500);
|
||||
}
|
||||
$financeDao->platformOut($margin, 'auto_margin_refund', $this->merId);
|
||||
return [$margin, $financeDao];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,10 @@
|
||||
|
||||
namespace app\common\repositories\user;
|
||||
|
||||
use app\common\dao\store\consumption\StoreConsumptionUserDao;
|
||||
use app\common\dao\user\UserRechargeDao;
|
||||
use app\common\model\store\consumption\StoreConsumption;
|
||||
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserRecharge;
|
||||
use app\common\repositories\BaseRepository;
|
||||
@ -126,8 +129,41 @@ class UserRechargeRepository extends BaseRepository
|
||||
$recharge->user->now_money = bcadd($recharge->user->now_money, $price, 2);
|
||||
$recharge->user->save();
|
||||
$recharge->save();
|
||||
|
||||
$consumption = StoreConsumption::where('status', 1)->where('type', StoreConsumption::TYPE_RECHARGE)->find();
|
||||
if (!empty($consumption)) {
|
||||
$amount = min($recharge->price, 100000);
|
||||
$rate = $this->getRate($amount);
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->send($consumption, $rate, $recharge->uid, $recharge->recharge_id, $amount, StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
|
||||
}
|
||||
});
|
||||
Queue::push(SendSmsJob::class,['tempId' => 'USER_BALANCE_CHANGE', 'id' =>$orderId]);
|
||||
event('user.recharge',compact('recharge'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按充值金额获取赠送比例
|
||||
* @param $amount
|
||||
* @return int
|
||||
*/
|
||||
public function getRate($amount)
|
||||
{
|
||||
$rateArray = [
|
||||
['start' => 1000, 'end' => 4999, 'rate' => 0.05],
|
||||
['start' => 5000, 'end' => 9999, 'rate' => 0.1],
|
||||
['start' => 10000, 'end' => 49999, 'rate' => 0.15],
|
||||
['start' => 50000, 'end' => 100000, 'rate' => 0.2],
|
||||
];
|
||||
$rate = 0;
|
||||
foreach ($rateArray as $item) {
|
||||
if ($amount >=$item['start'] && $amount <= $item['end']) {
|
||||
$rate = $item['rate'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $rate;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,14 +37,9 @@ class FinancialRecord extends BaseController
|
||||
$merId = $this->request->merId();
|
||||
if ($merId) {
|
||||
$where['mer_id'] = $merId;
|
||||
$where['financial_type'] = ['order', 'mer_accoubts', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon',
|
||||
'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund','commission_to_entry_merchant','commission_to_entry_merchant_refund'
|
||||
,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund'];
|
||||
$where['financial_type'] = array_merge($this->repository->commonFinancialType, ['mer_accoubts']);
|
||||
} else {
|
||||
$where['financial_type'] = ['order', 'sys_accoubts', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon',
|
||||
'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund'
|
||||
,'commission_to_entry_merchant','commission_to_entry_merchant_refund'
|
||||
,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund'];
|
||||
$where['financial_type'] = array_merge($this->repository->commonFinancialType, ['sys_accoubts']);
|
||||
}
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
}
|
||||
|
@ -27,7 +27,31 @@ class Open extends BaseController
|
||||
if (!empty($decrypted)) {
|
||||
$storeConsumptionUserDao = new CommissionDao();
|
||||
// "惠农供销,谱写数字新篇章"活动首单分润
|
||||
$result = $storeConsumptionUserDao->firstOrderBatchCommission($decrypted);
|
||||
$result = $storeConsumptionUserDao->firstOrderCommissionCallback($decrypted);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
return app('json')->fail('解密失败');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 供销平台退佣金回调
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function refundCommission()
|
||||
{
|
||||
$timestamp = $this->request->post('timestamp');
|
||||
$data = $this->request->post('data');
|
||||
$aes = new \AES();
|
||||
$iv = !empty($timestamp) ? $aes->buildIv($timestamp) : '';
|
||||
$decrypted = $aes->decrypt($data, $iv);
|
||||
Log::error('供销平台退佣金回调:' . var_export($decrypted, true));
|
||||
if (!empty($decrypted)) {
|
||||
$storeConsumptionUserDao = new CommissionDao();
|
||||
$result = $storeConsumptionUserDao->refundByCallback($decrypted);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
return app('json')->fail('解密失败');
|
||||
|
66
app/controller/api/server/Store.php
Normal file
66
app/controller/api/server/Store.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\api\server;
|
||||
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\controller\api\Common;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\App;
|
||||
use think\db\Query;
|
||||
|
||||
class Store extends BaseController
|
||||
{
|
||||
|
||||
protected $merId;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->merId = $this->request->route('merId');
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
*/
|
||||
public function qrcode()
|
||||
{
|
||||
$common = app()->make(Common::class);
|
||||
$siteUrl = systemConfig('site_url');
|
||||
$data = $common->Qrcode(['code' => $siteUrl . 'download/index.html?code=mer_' . $this->merId, 'id' => $this->merId]);
|
||||
return app('json')->success(['url' => $data]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 邀请记录
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$query = FinancialRecord::field('order_sn,number')
|
||||
->where('mer_id', $this->merId)
|
||||
->where('financial_type', 'commission_to_promoter')
|
||||
->with(['orderInfo' => function (Query $query) {
|
||||
$query->field('pay_price,real_name,uid,order_sn')->with(['user' => function (Query $query) {
|
||||
$query->field('nickname,uid');
|
||||
}]);
|
||||
}]);
|
||||
$count = $query->count();
|
||||
$result = $query->page($page, $limit)->select()->toArray();
|
||||
$list = [];
|
||||
foreach ($result as $item) {
|
||||
$list[] = [
|
||||
'nickname' => $item['orderInfo']['user']['nickname'],
|
||||
'uid' => $item['orderInfo']['uid'],
|
||||
'order_amount' => $item['orderInfo']['pay_price'],
|
||||
'commission' => $item['number'],
|
||||
];
|
||||
}
|
||||
return app('json')->success(['count' => $count, 'list' => $list]);
|
||||
}
|
||||
|
||||
}
|
@ -2,60 +2,98 @@
|
||||
|
||||
namespace app\controller\api\store\order;
|
||||
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use think\facade\Db;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\facade\Log;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
|
||||
/**
|
||||
* 订单处理
|
||||
*/
|
||||
class StoreProcessing extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* 自动向市级供应链创建订单
|
||||
* @param $order
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function AutomaticallyCreateOrders($order)
|
||||
{
|
||||
|
||||
|
||||
$merchant_two = Db::name('merchant')->where('mer_id', $order['mer_id'])->find();
|
||||
if (!in_array($order['source'], [103, 105])) {
|
||||
return;
|
||||
}
|
||||
$orderUser = Db::name('merchant')->where('mer_id', $order['mer_id'])->find();
|
||||
$store_group_order = Db::name('store_group_order')->where('group_order_id', $order['group_order_id'])->find();
|
||||
$store_group_order_other = Db::name('store_group_order_other')->where('group_order_sn', $order['order_sn'])->find();
|
||||
$store_group_order_other = Db::name('store_group_order_other')->where('group_order_sn', $store_group_order['group_order_sn'])->find();
|
||||
if (!$store_group_order_other) {
|
||||
unset($store_group_order['group_order_id']);
|
||||
$group_order_id = Db::name('store_group_order_other')->strict(false)->insertGetId($store_group_order);
|
||||
}else{
|
||||
$group_order_id=$store_group_order_other['group_order_id'];
|
||||
} else {
|
||||
$group_order_id = $store_group_order_other['group_order_id'];
|
||||
}
|
||||
$select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select();
|
||||
if ($order['source'] == 103 ||$order['source'] == 105 && $select) {
|
||||
// $financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
// $financeSn = $financialRecordRepository->getSn();
|
||||
$arr = $select->toArray();
|
||||
$orderProducts = Db::name('store_order_product')->where('order_id', $order['order_id'])->select()->toArray();
|
||||
$merchants = [];
|
||||
foreach ($orderProducts as $item) {
|
||||
$cartInfo = json_decode($item['cart_info'], true);
|
||||
$payPrice = bcmul($cartInfo['productAttr']['procure_price'], $item['product_num'], 2);
|
||||
if (isset($merchants[$item['product_mer_id']])) {
|
||||
$merchants[$item['product_mer_id']]['total_price'] = bcadd($merchants[$item['product_mer_id']]['total_price'], $payPrice, 2);
|
||||
$merchants[$item['product_mer_id']]['total_num'] = $merchants[$item['product_mer_id']]['total_num'] + $item['product_num'];
|
||||
} else {
|
||||
$merchants[$item['product_mer_id']]['total_price'] = $payPrice;
|
||||
$merchants[$item['product_mer_id']]['total_num'] = $item['product_num'];
|
||||
}
|
||||
$merchants[$item['product_mer_id']]['product'][] = $item;
|
||||
}
|
||||
$productOther = [];
|
||||
foreach ($merchants as $merId => $merchant) {
|
||||
$order['group_order_id'] = $group_order_id;
|
||||
$order['source'] = 104;
|
||||
|
||||
$order['mer_id'] = $select[0]['product_mer_id'];
|
||||
$order['uid'] = $merchant_two['uid'];
|
||||
$order['real_name'] = $merchant_two['mer_name'] . '-' . $merchant_two['real_name'];
|
||||
$order['user_phone'] = $merchant_two['mer_phone'];
|
||||
$order['user_address'] = $merchant_two['mer_address'];
|
||||
$order['mer_id'] = $merId;
|
||||
$order['uid'] = $orderUser['uid'];
|
||||
$order['real_name'] = $orderUser['mer_name'] . '-' . $orderUser['real_name'];
|
||||
$order['user_phone'] = $orderUser['mer_phone'];
|
||||
$order['user_address'] = $orderUser['mer_address'];
|
||||
$order['order_type'] = 0;
|
||||
|
||||
$order['pay_price'] = $merchant['total_price'];
|
||||
$order['total_price'] = $merchant['total_price'];
|
||||
$order['procure_price'] = $merchant['total_price'];
|
||||
$order['total_num'] = $merchant['total_num'];
|
||||
unset($order['order_id'], $order['orderProduct'], $order['user'], $order['supply_chain_rate'], $order['logistics_code'], $order['logistics_phone']);
|
||||
$order_id = Db::name('store_order_other')->strict(false)->insertGetId($order);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['order_id'] = $order_id;
|
||||
$arr[$key]['source'] = 104;
|
||||
unset($arr[$key]['order_product_id']);
|
||||
Db::name('store_product')->where('product_id',$value['product_id'])->dec('stock');
|
||||
}
|
||||
// $financialRecordRepository->insertAll($finance);
|
||||
Db::name('store_order_product_other')->strict(false)->insertAll($arr);
|
||||
return $order_id;
|
||||
$orderId = Db::name('store_order_other')->strict(false)->insertGetId($order);
|
||||
$productOther = array_merge($productOther, $this->setOrderOtherProduct($merchant, $orderUser, $orderId));
|
||||
}
|
||||
Db::name('store_order_product_other')->strict(false)->insertAll($productOther);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置订单商品
|
||||
* @param $merchant
|
||||
* @param $orderUser
|
||||
* @param $orderId
|
||||
* @return array
|
||||
*/
|
||||
public function setOrderOtherProduct($merchant, $orderUser, $orderId)
|
||||
{
|
||||
$productOther = [];
|
||||
foreach ($merchant['product'] as $product) {
|
||||
$cartInfo = json_decode($product['cart_info'], true);
|
||||
$product['order_id'] = $orderId;
|
||||
$product['source'] = 104;
|
||||
$product['product_price'] = bcmul($cartInfo['productAttr']['procure_price'], $product['product_num'], 2);
|
||||
$product['total_price'] = $product['product_price'];
|
||||
$product['pay_price'] = $product['product_price'];
|
||||
$product['product_id'] = $product['product_source_id'];
|
||||
$product['uid'] = $orderUser['uid'];
|
||||
$product['product_source_id'] = 0;
|
||||
$product['product_mer_id'] = 0;
|
||||
unset($product['order_product_id']);
|
||||
$productOther[] = $product;
|
||||
Db::name('store_product')->where('product_id', $product['product_source_id'])->dec('stock');
|
||||
}
|
||||
return $productOther;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,10 +66,15 @@ class StoreSpu extends BaseController
|
||||
'village_id',
|
||||
'location'
|
||||
]);
|
||||
[$lat, $lng] = (new CityAreaDao())->getLngAndLat($where['location'], $where['street_id']);
|
||||
$where['long']=$lng;
|
||||
$where['lat']=$lat;
|
||||
if ($where['type_id']||$where['type_code']) {
|
||||
if (isset($where['type_code']) && $where['type_code'] == 'PersonalStore') {
|
||||
$where['long'] = '';
|
||||
$where['lat'] = '';
|
||||
} else {
|
||||
[$lat, $lng] = (new CityAreaDao())->getLngAndLat($where['location'], $where['street_id']);
|
||||
$where['long'] = $lng;
|
||||
$where['lat'] = $lat;
|
||||
}
|
||||
if ($where['type_id'] || $where['type_code']) {
|
||||
$arr = ['status' => 1, 'mer_state' => 1, 'is_del' => 0];
|
||||
$query = Merchant::where($arr);
|
||||
// $merIds = (new MerchantDao())->getValidMerchantByDistance($lat, $lng);
|
||||
@ -85,17 +90,23 @@ class StoreSpu extends BaseController
|
||||
// $query->where('type_id', $mer_type_id);
|
||||
// }
|
||||
// }
|
||||
$where['mer_ids'] = $query->whereIn('type_id', explode(',', $where['type_id']))->column('mer_id');
|
||||
$mer_type_id = Db::name('merchant_type')->where('type_code', $where['type_code'])->value('mer_type_id');
|
||||
if ($mer_type_id && $where['type_code'] == 'PersonalStore') {
|
||||
$where['mer_ids'] = $query->where('type_id', $mer_type_id)->column('mer_id');
|
||||
}else{
|
||||
$where['mer_ids'] = $query->whereIn('type_id', explode(',', $where['type_id']))->column('mer_id');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unset($where['type_id'], $where['street_id'],$where['type_code'],$where['village_id']);
|
||||
unset($where['type_id'], $where['street_id'], $where['type_code'], $where['village_id']);
|
||||
|
||||
$where['is_gift_bag'] = 0;
|
||||
$where['product_type'] = $where['product_type'] != '' ? $where['product_type'] : 0;
|
||||
$where['order'] = $where['order'] ?: 'star';
|
||||
if ($where['is_trader'] != 1) unset($where['is_trader']);
|
||||
if($where['category_id']!=''){
|
||||
$where['mer_ids']= Db::name('merchant')->where(['category_id'=>$where['category_id'],'status'=>1,'is_del'=>0])->column('mer_id');
|
||||
if ($where['category_id'] != '') {
|
||||
$where['mer_ids'] = Db::name('merchant')->where(['category_id' => $where['category_id'], 'status' => 1, 'is_del' => 0])->column('mer_id');
|
||||
}
|
||||
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
|
||||
return app('json')->success($data);
|
||||
@ -155,7 +166,7 @@ class StoreSpu extends BaseController
|
||||
$where['mer_id'] = $id;
|
||||
$where['is_gift_bag'] = 0;
|
||||
$where['order'] = $where['order'] ? $where['order'] : 'sort';
|
||||
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo,true);
|
||||
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, true);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,10 @@ class paySuccess
|
||||
{
|
||||
try {
|
||||
$orderList = $event['groupOrder']['orderList'];
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->check($event['groupOrder']['uid'], $event['groupOrder']['group_order_id']);
|
||||
if ($event['groupOrder']['source'] == 103) {
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->check($event['groupOrder']['uid'], $event['groupOrder']['group_order_id']);
|
||||
}
|
||||
foreach ($orderList as $k => $order) {
|
||||
//
|
||||
$StoreProcessing->AutomaticallyCreateOrders($order);
|
||||
|
19
crmeb/utils/AsynClient.php
Normal file
19
crmeb/utils/AsynClient.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace crmeb\utils;
|
||||
use Swoole\Coroutine\Http\Client;
|
||||
use function Swoole\Coroutine\run;
|
||||
|
||||
class AsynClient
|
||||
{
|
||||
|
||||
function post($host='',$url='',$data)
|
||||
{
|
||||
run(function () use($host,$url,$data) {
|
||||
$cli = new Client($host);
|
||||
$cli->post($url,$data);
|
||||
echo $cli->body;
|
||||
$cli->close();
|
||||
});
|
||||
}
|
||||
}
|
2
public/index.html
Executable file → Normal file
2
public/index.html
Executable file → Normal file
@ -2,4 +2,4 @@
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
if(window.location.protocol == 'https:'){
|
||||
document.write('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">')
|
||||
}</script><link rel=stylesheet href=/static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.3822bc6e.js></script><script src=/static/js/index.344418d8.js></script></body></html>
|
||||
}</script><link rel=stylesheet href=/static/index.97465e7b.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.3822bc6e.js></script><script src=/static/js/index.3dad6f76.js></script></body></html>
|
2
public/mer.html
Executable file → Normal file
2
public/mer.html
Executable file → Normal file
File diff suppressed because one or more lines are too long
0
public/mer/css/app.54d412cb.css
Executable file → Normal file
0
public/mer/css/app.54d412cb.css
Executable file → Normal file
0
public/mer/css/chunk-00584afe.43ee60bd.css
Executable file → Normal file
0
public/mer/css/chunk-00584afe.43ee60bd.css
Executable file → Normal file
0
public/mer/css/chunk-01454a3c.1d14cc16.css
Executable file → Normal file
0
public/mer/css/chunk-01454a3c.1d14cc16.css
Executable file → Normal file
0
public/mer/css/chunk-02ea1cc8.3ba83a49.css
Executable file → Normal file
0
public/mer/css/chunk-02ea1cc8.3ba83a49.css
Executable file → Normal file
0
public/mer/css/chunk-031de214.2b116af7.css
Executable file → Normal file
0
public/mer/css/chunk-031de214.2b116af7.css
Executable file → Normal file
0
public/mer/css/chunk-03944393.8aadf067.css
Executable file → Normal file
0
public/mer/css/chunk-03944393.8aadf067.css
Executable file → Normal file
0
public/mer/css/chunk-03cdbf88.da186745.css
Executable file → Normal file
0
public/mer/css/chunk-03cdbf88.da186745.css
Executable file → Normal file
0
public/mer/css/chunk-048e53ee.80f336aa.css
Executable file → Normal file
0
public/mer/css/chunk-048e53ee.80f336aa.css
Executable file → Normal file
0
public/mer/css/chunk-0493956f.38d37ff5.css
Executable file → Normal file
0
public/mer/css/chunk-0493956f.38d37ff5.css
Executable file → Normal file
0
public/mer/css/chunk-09296115.be9e1835.css
Executable file → Normal file
0
public/mer/css/chunk-09296115.be9e1835.css
Executable file → Normal file
@ -1 +0,0 @@
|
||||
.head[data-v-343bb459]{padding:30px 35px 25px}.head .full[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-343bb459]{width:60px;height:60px}.head .full .iconfont[data-v-343bb459]{color:#1890ff}.head .full .iconfont.sale-after[data-v-343bb459]{color:#90add5}.head .full .text[data-v-343bb459]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-343bb459]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-343bb459]{padding-top:10px;white-space:nowrap}.head .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-343bb459]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-343bb459]{color:#f56022}.head .list .item .value2[data-v-343bb459]{color:#1bbe6b}.head .list .item .value3[data-v-343bb459]{color:#1890ff}.head .list .item .value4[data-v-343bb459]{color:#6a7b9d}.head .list .item .value5[data-v-343bb459]{color:#f5222d}.el-tabs--border-card[data-v-343bb459]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-343bb459]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-343bb459]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-343bb459]:nth-child(3n+1){padding-right:20px}.section .item[data-v-343bb459]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-343bb459]:nth-child(3n+3){padding-left:20px}.section .value[data-v-343bb459]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-343bb459]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-343bb459]{width:36px;height:36px;margin-right:10px}[data-v-343bb459] .el-drawer__body{overflow:auto}.gary[data-v-343bb459]{color:#aaa}.logistics[data-v-343bb459]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-343bb459]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-343bb459]{width:100%;height:100%}.logistics .logistics_cent span[data-v-343bb459]{display:block;font-size:12px}.tabBox_tit[data-v-343bb459]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-56bbdfa6]{max-width:100%}.area-desc[data-v-56bbdfa6]{margin:0;color:#999;font-size:12px}.selWidth[data-v-56bbdfa6]{width:300px}.spBlock[data-v-56bbdfa6]{cursor:pointer;display:block;padding:5px 0}.check[data-v-56bbdfa6]{color:#00a2d4}.el-dropdown-link[data-v-56bbdfa6]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-56bbdfa6]{font-size:12px}.tabBox_tit[data-v-56bbdfa6]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-56bbdfa6] .row-bg .cell{color:red!important}.headTab[data-v-56bbdfa6]{position:relative}.headTab .headBtn[data-v-56bbdfa6]{position:absolute;right:0;top:-6px}.dropdown[data-v-56bbdfa6]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
0
public/mer/css/chunk-0b1f3772.b24cfca2.css
Executable file → Normal file
0
public/mer/css/chunk-0b1f3772.b24cfca2.css
Executable file → Normal file
0
public/mer/css/chunk-0d2c1415.d76f77a2.css
Executable file → Normal file
0
public/mer/css/chunk-0d2c1415.d76f77a2.css
Executable file → Normal file
0
public/mer/css/chunk-0fa0e81e.3f2a189e.css
Executable file → Normal file
0
public/mer/css/chunk-0fa0e81e.3f2a189e.css
Executable file → Normal file
1
public/mer/css/chunk-0fc13aae.7c6c0f3d.css
Normal file
1
public/mer/css/chunk-0fc13aae.7c6c0f3d.css
Normal file
@ -0,0 +1 @@
|
||||
.head[data-v-4168297b]{padding:30px 35px 25px}.head .full[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-4168297b]{width:60px;height:60px}.head .full .iconfont[data-v-4168297b]{color:#1890ff}.head .full .iconfont.sale-after[data-v-4168297b]{color:#90add5}.head .full .text[data-v-4168297b]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-4168297b]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-4168297b]{padding-top:10px;white-space:nowrap}.head .list[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-4168297b]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-4168297b]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-4168297b]{color:#f56022}.head .list .item .value2[data-v-4168297b]{color:#1bbe6b}.head .list .item .value3[data-v-4168297b]{color:#1890ff}.head .list .item .value4[data-v-4168297b]{color:#6a7b9d}.head .list .item .value5[data-v-4168297b]{color:#f5222d}.el-tabs--border-card[data-v-4168297b]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-4168297b]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-4168297b]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-4168297b]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-4168297b]:nth-child(3n+1){padding-right:20px}.section .item[data-v-4168297b]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-4168297b]:nth-child(3n+3){padding-left:20px}.section .value[data-v-4168297b]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-4168297b]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-4168297b]{width:36px;height:36px;margin-right:10px}[data-v-4168297b] .el-drawer__body{overflow:auto}.gary[data-v-4168297b]{color:#aaa}.logistics[data-v-4168297b]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-4168297b]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-4168297b]{width:100%;height:100%}.logistics .logistics_cent span[data-v-4168297b]{display:block;font-size:12px}.tabBox_tit[data-v-4168297b]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-889b05f8]{max-width:100%}.area-desc[data-v-889b05f8]{margin:0;color:#999;font-size:12px}.selWidth[data-v-889b05f8]{width:300px}.spBlock[data-v-889b05f8]{cursor:pointer;display:block;padding:5px 0}.check[data-v-889b05f8]{color:#00a2d4}.el-dropdown-link[data-v-889b05f8]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-889b05f8]{font-size:12px}.tabBox_tit[data-v-889b05f8]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-889b05f8] .row-bg .cell{color:red!important}.headTab[data-v-889b05f8]{position:relative}.headTab .headBtn[data-v-889b05f8]{position:absolute;right:0;top:-6px}.dropdown[data-v-889b05f8]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
0
public/mer/css/chunk-0fdbbf98.c270c7db.css
Executable file → Normal file
0
public/mer/css/chunk-0fdbbf98.c270c7db.css
Executable file → Normal file
0
public/mer/css/chunk-1306dfb6.3286df8c.css
Executable file → Normal file
0
public/mer/css/chunk-1306dfb6.3286df8c.css
Executable file → Normal file
0
public/mer/css/chunk-1df22872.7c52b6c7.css
Executable file → Normal file
0
public/mer/css/chunk-1df22872.7c52b6c7.css
Executable file → Normal file
0
public/mer/css/chunk-32c5a54a.9dd53540.css
Executable file → Normal file
0
public/mer/css/chunk-32c5a54a.9dd53540.css
Executable file → Normal file
0
public/mer/css/chunk-344a4872.a4bc376f.css
Executable file → Normal file
0
public/mer/css/chunk-344a4872.a4bc376f.css
Executable file → Normal file
0
public/mer/css/chunk-35013ff2.662dcd12.css
Executable file → Normal file
0
public/mer/css/chunk-35013ff2.662dcd12.css
Executable file → Normal file
0
public/mer/css/chunk-39a0bfcb.88bd64b8.css
Executable file → Normal file
0
public/mer/css/chunk-39a0bfcb.88bd64b8.css
Executable file → Normal file
0
public/mer/css/chunk-3ec8e821.de0498e4.css
Executable file → Normal file
0
public/mer/css/chunk-3ec8e821.de0498e4.css
Executable file → Normal file
0
public/mer/css/chunk-3fdfdac4.09df0165.css
Executable file → Normal file
0
public/mer/css/chunk-3fdfdac4.09df0165.css
Executable file → Normal file
0
public/mer/css/chunk-40dcbfe7.099bec67.css
Executable file → Normal file
0
public/mer/css/chunk-40dcbfe7.099bec67.css
Executable file → Normal file
0
public/mer/css/chunk-412170ef.f0a7eba9.css
Executable file → Normal file
0
public/mer/css/chunk-412170ef.f0a7eba9.css
Executable file → Normal file
0
public/mer/css/chunk-412d33f7.e77254ea.css
Executable file → Normal file
0
public/mer/css/chunk-412d33f7.e77254ea.css
Executable file → Normal file
0
public/mer/css/chunk-43056c0c.275568af.css → public/mer/css/chunk-43056c0c.68b66d07.css
Executable file → Normal file
0
public/mer/css/chunk-43056c0c.275568af.css → public/mer/css/chunk-43056c0c.68b66d07.css
Executable file → Normal file
0
public/mer/css/chunk-4428d098.1fab3f84.css
Executable file → Normal file
0
public/mer/css/chunk-4428d098.1fab3f84.css
Executable file → Normal file
0
public/mer/css/chunk-4a9f6d94.aa785e77.css
Executable file → Normal file
0
public/mer/css/chunk-4a9f6d94.aa785e77.css
Executable file → Normal file
0
public/mer/css/chunk-4bf3fbdc.fc46ed08.css
Executable file → Normal file
0
public/mer/css/chunk-4bf3fbdc.fc46ed08.css
Executable file → Normal file
0
public/mer/css/chunk-4f7a44e8.5d58d05d.css
Executable file → Normal file
0
public/mer/css/chunk-4f7a44e8.5d58d05d.css
Executable file → Normal file
0
public/mer/css/chunk-52201564.7cd77cdd.css
Executable file → Normal file
0
public/mer/css/chunk-52201564.7cd77cdd.css
Executable file → Normal file
1
public/mer/css/chunk-5305fcd6.004212f0.css
Normal file
1
public/mer/css/chunk-5305fcd6.004212f0.css
Normal file
@ -0,0 +1 @@
|
||||
.head[data-v-4168297b]{padding:30px 35px 25px}.head .full[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-4168297b]{width:60px;height:60px}.head .full .iconfont[data-v-4168297b]{color:#1890ff}.head .full .iconfont.sale-after[data-v-4168297b]{color:#90add5}.head .full .text[data-v-4168297b]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-4168297b]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-4168297b]{padding-top:10px;white-space:nowrap}.head .list[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-4168297b]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-4168297b]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-4168297b]{color:#f56022}.head .list .item .value2[data-v-4168297b]{color:#1bbe6b}.head .list .item .value3[data-v-4168297b]{color:#1890ff}.head .list .item .value4[data-v-4168297b]{color:#6a7b9d}.head .list .item .value5[data-v-4168297b]{color:#f5222d}.el-tabs--border-card[data-v-4168297b]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-4168297b]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-4168297b]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-4168297b]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-4168297b]:nth-child(3n+1){padding-right:20px}.section .item[data-v-4168297b]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-4168297b]:nth-child(3n+3){padding-left:20px}.section .value[data-v-4168297b]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-4168297b]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-4168297b]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-4168297b]{width:36px;height:36px;margin-right:10px}[data-v-4168297b] .el-drawer__body{overflow:auto}.gary[data-v-4168297b]{color:#aaa}.logistics[data-v-4168297b]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-4168297b]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-4168297b]{width:100%;height:100%}.logistics .logistics_cent span[data-v-4168297b]{display:block;font-size:12px}.tabBox_tit[data-v-4168297b]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-56bbdfa6]{max-width:100%}.area-desc[data-v-56bbdfa6]{margin:0;color:#999;font-size:12px}.selWidth[data-v-56bbdfa6]{width:300px}.spBlock[data-v-56bbdfa6]{cursor:pointer;display:block;padding:5px 0}.check[data-v-56bbdfa6]{color:#00a2d4}.el-dropdown-link[data-v-56bbdfa6]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-56bbdfa6]{font-size:12px}.tabBox_tit[data-v-56bbdfa6]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-56bbdfa6] .row-bg .cell{color:red!important}.headTab[data-v-56bbdfa6]{position:relative}.headTab .headBtn[data-v-56bbdfa6]{position:absolute;right:0;top:-6px}.dropdown[data-v-56bbdfa6]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
0
public/mer/css/chunk-5310352e.96debd4e.css
Executable file → Normal file
0
public/mer/css/chunk-5310352e.96debd4e.css
Executable file → Normal file
0
public/mer/css/chunk-540035fc.9a4d3ac2.css
Executable file → Normal file
0
public/mer/css/chunk-540035fc.9a4d3ac2.css
Executable file → Normal file
0
public/mer/css/chunk-546dc2ee.8760fd66.css
Executable file → Normal file
0
public/mer/css/chunk-546dc2ee.8760fd66.css
Executable file → Normal file
0
public/mer/css/chunk-5bb47ee8.36eba9b7.css
Executable file → Normal file
0
public/mer/css/chunk-5bb47ee8.36eba9b7.css
Executable file → Normal file
0
public/mer/css/chunk-5ed4f497.27d2be4f.css
Executable file → Normal file
0
public/mer/css/chunk-5ed4f497.27d2be4f.css
Executable file → Normal file
0
public/mer/css/chunk-6231f720.08a2a362.css
Executable file → Normal file
0
public/mer/css/chunk-6231f720.08a2a362.css
Executable file → Normal file
0
public/mer/css/chunk-634734f0.47e987a6.css
Executable file → Normal file
0
public/mer/css/chunk-634734f0.47e987a6.css
Executable file → Normal file
0
public/mer/css/chunk-648f00b5.3265499c.css
Executable file → Normal file
0
public/mer/css/chunk-648f00b5.3265499c.css
Executable file → Normal file
0
public/mer/css/chunk-67e1db22.c358a0a3.css
Executable file → Normal file
0
public/mer/css/chunk-67e1db22.c358a0a3.css
Executable file → Normal file
0
public/mer/css/chunk-6a905886.374d59fa.css
Executable file → Normal file
0
public/mer/css/chunk-6a905886.374d59fa.css
Executable file → Normal file
0
public/mer/css/chunk-6c88f67a.bcbc6cbf.css
Executable file → Normal file
0
public/mer/css/chunk-6c88f67a.bcbc6cbf.css
Executable file → Normal file
0
public/mer/css/chunk-738c6ac1.dfe92740.css
Executable file → Normal file
0
public/mer/css/chunk-738c6ac1.dfe92740.css
Executable file → Normal file
0
public/mer/css/chunk-7391cd08.c891cf22.css
Executable file → Normal file
0
public/mer/css/chunk-7391cd08.c891cf22.css
Executable file → Normal file
0
public/mer/css/chunk-7788e6ba.355402fa.css
Executable file → Normal file
0
public/mer/css/chunk-7788e6ba.355402fa.css
Executable file → Normal file
0
public/mer/css/chunk-78c4a0d7.3794cac6.css
Executable file → Normal file
0
public/mer/css/chunk-78c4a0d7.3794cac6.css
Executable file → Normal file
0
public/mer/css/chunk-7ad233ee.b7223700.css
Executable file → Normal file
0
public/mer/css/chunk-7ad233ee.b7223700.css
Executable file → Normal file
0
public/mer/css/chunk-7c1a0002.59b03c28.css
Executable file → Normal file
0
public/mer/css/chunk-7c1a0002.59b03c28.css
Executable file → Normal file
0
public/mer/css/chunk-7c43671d.6e67331d.css
Executable file → Normal file
0
public/mer/css/chunk-7c43671d.6e67331d.css
Executable file → Normal file
0
public/mer/css/chunk-80a8cf62.500ed102.css
Executable file → Normal file
0
public/mer/css/chunk-80a8cf62.500ed102.css
Executable file → Normal file
0
public/mer/css/chunk-82bee4a8.4e2f1042.css
Executable file → Normal file
0
public/mer/css/chunk-82bee4a8.4e2f1042.css
Executable file → Normal file
0
public/mer/css/chunk-90657762.b3c160f5.css
Executable file → Normal file
0
public/mer/css/chunk-90657762.b3c160f5.css
Executable file → Normal file
0
public/mer/css/chunk-9afa8a36.2575f6c7.css
Executable file → Normal file
0
public/mer/css/chunk-9afa8a36.2575f6c7.css
Executable file → Normal file
0
public/mer/css/chunk-9d6d22b0.ff0afa57.css
Executable file → Normal file
0
public/mer/css/chunk-9d6d22b0.ff0afa57.css
Executable file → Normal file
0
public/mer/css/chunk-a0fbc2e4.efe7d411.css
Executable file → Normal file
0
public/mer/css/chunk-a0fbc2e4.efe7d411.css
Executable file → Normal file
0
public/mer/css/chunk-ab3d6574.3e259e7e.css
Executable file → Normal file
0
public/mer/css/chunk-ab3d6574.3e259e7e.css
Executable file → Normal file
0
public/mer/css/chunk-ae0b147e.5e45a053.css
Executable file → Normal file
0
public/mer/css/chunk-ae0b147e.5e45a053.css
Executable file → Normal file
0
public/mer/css/chunk-afbd5864.a52057fd.css
Executable file → Normal file
0
public/mer/css/chunk-afbd5864.a52057fd.css
Executable file → Normal file
0
public/mer/css/chunk-b28bec38.b5cebb93.css
Executable file → Normal file
0
public/mer/css/chunk-b28bec38.b5cebb93.css
Executable file → Normal file
0
public/mer/css/chunk-b62bf9da.fc476d73.css
Executable file → Normal file
0
public/mer/css/chunk-b62bf9da.fc476d73.css
Executable file → Normal file
@ -1 +0,0 @@
|
||||
.head[data-v-343bb459]{padding:30px 35px 25px}.head .full[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-343bb459]{width:60px;height:60px}.head .full .iconfont[data-v-343bb459]{color:#1890ff}.head .full .iconfont.sale-after[data-v-343bb459]{color:#90add5}.head .full .text[data-v-343bb459]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-343bb459]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-343bb459]{padding-top:10px;white-space:nowrap}.head .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-343bb459]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-343bb459]{color:#f56022}.head .list .item .value2[data-v-343bb459]{color:#1bbe6b}.head .list .item .value3[data-v-343bb459]{color:#1890ff}.head .list .item .value4[data-v-343bb459]{color:#6a7b9d}.head .list .item .value5[data-v-343bb459]{color:#f5222d}.el-tabs--border-card[data-v-343bb459]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-343bb459]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-343bb459]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-343bb459]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-343bb459]:nth-child(3n+1){padding-right:20px}.section .item[data-v-343bb459]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-343bb459]:nth-child(3n+3){padding-left:20px}.section .value[data-v-343bb459]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-343bb459]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-343bb459]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-343bb459]{width:36px;height:36px;margin-right:10px}[data-v-343bb459] .el-drawer__body{overflow:auto}.gary[data-v-343bb459]{color:#aaa}.logistics[data-v-343bb459]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-343bb459]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-343bb459]{width:100%;height:100%}.logistics .logistics_cent span[data-v-343bb459]{display:block;font-size:12px}.tabBox_tit[data-v-343bb459]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictures[data-v-889b05f8]{max-width:100%}.area-desc[data-v-889b05f8]{margin:0;color:#999;font-size:12px}.selWidth[data-v-889b05f8]{width:300px}.spBlock[data-v-889b05f8]{cursor:pointer;display:block;padding:5px 0}.check[data-v-889b05f8]{color:#00a2d4}.el-dropdown-link[data-v-889b05f8]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-889b05f8]{font-size:12px}.tabBox_tit[data-v-889b05f8]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-889b05f8] .row-bg .cell{color:red!important}.headTab[data-v-889b05f8]{position:relative}.headTab .headBtn[data-v-889b05f8]{position:absolute;right:0;top:-6px}.dropdown[data-v-889b05f8]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
0
public/mer/css/chunk-cd8d615e.bca28c90.css
Executable file → Normal file
0
public/mer/css/chunk-cd8d615e.bca28c90.css
Executable file → Normal file
0
public/mer/css/chunk-cf155762.2cf728f9.css
Executable file → Normal file
0
public/mer/css/chunk-cf155762.2cf728f9.css
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user