Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ece5b572cf
@ -30,7 +30,7 @@ class StoreCartDao extends BaseDao
|
||||
const SOURCE_STORE_CLOUD = 101; //店铺内云商品
|
||||
const SOURCE_CLOUD = 102; //云仓内店铺商品
|
||||
const CITY_CLOUD = 103; //市级云仓商品
|
||||
const SOURCE_PROCURE = 200; //供应链采购商品B2B
|
||||
const SOURCE_PROCURE = 13; //供应链采购商品B2B
|
||||
const SOURCE_COMMUNITY_RESALE = 201; //转售商品
|
||||
const SOURCE_COMMUNITY_ENTRUST = 202; //委托商品
|
||||
|
||||
@ -69,9 +69,9 @@ class StoreCartDao extends BaseDao
|
||||
* @param int $uid
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAll(int $uid,$product_type)
|
||||
public function getAll(int $uid,$product_type,$source=0)
|
||||
{
|
||||
$query = ($this->getModel())::where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type])
|
||||
$query = ($this->getModel())::where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'source'=>$source])
|
||||
->with([
|
||||
'product' => function ($query) {
|
||||
$query->field('product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used,product_type,once_max_count,once_min_count,pay_limit,mer_svip_status,svip_price_type');
|
||||
@ -147,10 +147,10 @@ class StoreCartDao extends BaseDao
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
*/
|
||||
public function getCartCount(int $uid,$product_type)
|
||||
public function getCartCount(int $uid,$product_type,$source=0)
|
||||
{
|
||||
$data = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0])->field('count(*) as count')->select();
|
||||
$data[0]['count'] = $data[0]['count'] ? $data[0]['count'] : 0;
|
||||
$count = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0,'source'=>$source])->count();
|
||||
$data[0]['count'] = $count;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
764
app/common/dao/store/order/StoreOrderOtherDao.php
Normal file
764
app/common/dao/store/order/StoreOrderOtherDao.php
Normal file
@ -0,0 +1,764 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\dao\store\order;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\store\order\StoreOtherGroupOrder;
|
||||
use app\common\model\store\order\StoreOrderOther;
|
||||
use app\common\model\store\order\StoreOrderProductOther;
|
||||
use app\common\model\store\order\StoreOrderStatusOther;
|
||||
use app\common\repositories\store\order\StoreOrderStatusRepository;
|
||||
use app\common\repositories\store\product\ProductAssistSetRepository;
|
||||
use app\common\repositories\store\product\ProductGroupBuyingRepository;
|
||||
|
||||
use think\db\BaseQuery;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* Class StoreOrderDao
|
||||
* @package app\common\dao\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/8
|
||||
*/
|
||||
class StoreOrderOtherDao extends BaseDao
|
||||
{
|
||||
//订单状态(0:待发货;1:待收货;2:待评价;3:已完成; 9: 拼团中 10: 待付尾款 11:尾款超时未付 -1:已退款)
|
||||
const ORDER_STATUS_BE_SHIPPED = 0;
|
||||
const ORDER_STATUS_BE_RECEIVE = 1;
|
||||
const ORDER_STATUS_REPLY = 2;
|
||||
const ORDER_STATUS_SUCCESS = 3;
|
||||
const ORDER_STATUS_SPELL = 9;
|
||||
const ORDER_STATUS_TAIL = 10;
|
||||
const ORDER_STATUS_TAIL_FAIL = 11;
|
||||
const ORDER_STATUS_REFUND = -1;
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020/6/8
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreOrderOther::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param int $sysDel
|
||||
* @return BaseQuery
|
||||
* @author xaboyCRMEB
|
||||
* @day 2020/6/16
|
||||
*/
|
||||
public function search(array $where, $sysDel = 0)
|
||||
{
|
||||
$query = StoreOrderOther::hasWhere('merchant', function ($query) use ($where) {
|
||||
if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
}
|
||||
$query->where('is_del', 0);
|
||||
});
|
||||
|
||||
$query->when(($sysDel !== null), function ($query) use ($sysDel) {
|
||||
$query->where('is_system_del', $sysDel);
|
||||
})
|
||||
->when(isset($where['order_type']) && $where['order_type'] >= 0 && $where['order_type'] !== '', function ($query) use ($where) {
|
||||
if ($where['order_type'] == 2) {
|
||||
$query->where('is_virtual', 1);
|
||||
} else if ($where['order_type'] == 0) { //实体发货订单
|
||||
$query->where('order_type', 0)->where('is_virtual', 0);
|
||||
} else if ($where['order_type'] == 3) { //发货订单
|
||||
$query->where('order_type', 0);
|
||||
} else {
|
||||
$query->where('order_type', $where['order_type']);
|
||||
}
|
||||
})
|
||||
->when(isset($where['activity_type']) && $where['activity_type'] != '', function ($query) use ($where) {
|
||||
$query->where('activity_type', $where['activity_type']);
|
||||
})
|
||||
->when(isset($where['product_type']) && $where['product_type'] != '', function ($query) use ($where) {
|
||||
$query->where('activity_type', $where['product_type']);
|
||||
})
|
||||
->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
|
||||
// 12表示信用购 先货后款
|
||||
switch ($where['status']) {
|
||||
case 0:
|
||||
$query->whereIn('StoreOrderOther.status', [0, 9, 12]);
|
||||
break;
|
||||
case -2:
|
||||
$query->where('StoreOrderOther.paid', 1)->whereNotIn('StoreOrderOther.status', [10, 11]);
|
||||
break;
|
||||
case 10:
|
||||
$query->where('StoreOrderOther.paid', 1)->whereIn('StoreOrderOther.status', [10, 11]);
|
||||
break;
|
||||
case 2:
|
||||
$query->where('StoreOrderOther.paid', 1)->where('StoreOrderOther.status', $where['status'])->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY);
|
||||
break;
|
||||
case 20:
|
||||
$query->where('StoreOrderOther.paid', 1)->whereIn('StoreOrderOther.status', [2, 3]);
|
||||
break;
|
||||
default:
|
||||
$query->where('StoreOrderOther.status', $where['status']);
|
||||
break;
|
||||
}
|
||||
})
|
||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.uid', $where['uid']);
|
||||
})
|
||||
->when(isset($where['is_user']) && $where['is_user'] !== 0, function ($query) use ($where) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('order_type', 0)->whereOr(function ($query) {
|
||||
$query->where('order_type', 1)->where('main_id', 0);
|
||||
});
|
||||
});
|
||||
})
|
||||
//待核销订单
|
||||
->when(isset($where['is_verify']) && $where['is_verify'], function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.order_type', 1)->where('StoreOrderOther.status', 0);
|
||||
})
|
||||
->when(isset($where['pay_type']) && $where['pay_type'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.pay_type', $where['pay_type']);
|
||||
})
|
||||
->when(isset($where['order_ids']) && $where['order_ids'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('order_id', $where['order_ids']);
|
||||
})
|
||||
->when(isset($where['order_id']) && $where['order_id'] !== '', function ($query) use ($where) {
|
||||
if (is_array($where['order_id'])) {
|
||||
$query->whereIn('order_id', $where['order_id']);
|
||||
} else {
|
||||
$query->where('order_id', $where['order_id']);
|
||||
}
|
||||
})
|
||||
->when(isset($where['take_order']) && $where['take_order'] != '', function ($query) use ($where) {
|
||||
$query->where('order_type', 1)->whereNotNull('verify_time');
|
||||
})
|
||||
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.mer_id', $where['mer_id']);
|
||||
})
|
||||
->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['date'], 'StoreOrderOther.create_time');
|
||||
})
|
||||
->when(isset($where['pay_time']) && $where['pay_time'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['pay_time'], 'StoreOrderOther.pay_time');
|
||||
})
|
||||
->when(isset($where['verify_date']) && $where['verify_date'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['verify_date'], 'verify_time');
|
||||
})
|
||||
->when(isset($where['order_sn']) && $where['order_sn'] !== '', function ($query) use ($where) {
|
||||
$query->where('order_sn', 'like', '%' . $where['order_sn'] . '%');
|
||||
})
|
||||
->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.paid', $where['paid']);
|
||||
})
|
||||
->when(isset($where['is_del']) && $where['is_del'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.is_del', $where['is_del']);
|
||||
})
|
||||
->when(isset($where['service_id']) && $where['service_id'] !== '', function ($query) use ($where) {
|
||||
$query->where('service_id', $where['service_id']);
|
||||
})
|
||||
->when(isset($where['username']) && $where['username'] !== '', function ($query) use ($where) {
|
||||
$query->join('User U', 'StoreOrderOther.uid = U.uid')
|
||||
->where(function ($query) use ($where) {
|
||||
$query->where('nickname', 'like', "%{$where['username']}%")
|
||||
->whereOr('phone', 'like', "%{$where['username']}%")
|
||||
->whereOr('user_phone', 'like', "%{$where['username']}%");
|
||||
});
|
||||
})
|
||||
->when(isset($where['store_name']) && $where['store_name'] !== '', function ($query) use ($where) {
|
||||
$orderId = StoreOrderProductOther::alias('op')
|
||||
->join('storeProduct sp', 'op.product_id = sp.product_id')
|
||||
->whereLike('store_name', "%{$where['store_name']}%")
|
||||
->when((isset($where['sp.mer_id']) && $where['mer_id'] !== ''), function ($query) use ($where) {
|
||||
$query->where('mer_id', $where['mer_id']);
|
||||
})->column('order_id');
|
||||
$query->whereIn('order_id', $orderId ?: '');
|
||||
})
|
||||
->when(isset($where['search']) && $where['search'] !== '', function ($query) use ($where) {
|
||||
$orderId = StoreOrderProductOther::alias('op')
|
||||
->join('storeProduct sp', 'op.product_id = sp.product_id')
|
||||
->whereLike('store_name', "%{$where['search']}%")
|
||||
->when((isset($where['sp.mer_id']) && $where['mer_id'] !== ''), function ($query) use ($where) {
|
||||
$query->where('mer_id', $where['mer_id']);
|
||||
})->column('order_id');
|
||||
$query->where(function ($query) use ($orderId, $where) {
|
||||
$query->whereIn('order_id', $orderId ? $orderId : '')
|
||||
->whereOr('order_sn', 'like', "%{$where['search']}%")
|
||||
->whereOr('user_phone', 'like', "%{$where['search']}%");
|
||||
});
|
||||
})
|
||||
->when(isset($where['order_search']) && $where['order_search'] !== '', function ($query) use ($where) {
|
||||
$query->where('order_sn', 'like', '%' . $where['order_search'] . '%')->whereOr('user_phone', $where['order_search']);
|
||||
})
|
||||
->when(isset($where['group_order_sn']) && $where['group_order_sn'] !== '', function ($query) use ($where) {
|
||||
$query->join('StoreGroupOrder GO', 'StoreOrderOther.group_order_id = GStoreOrderOther.group_order_id')->where('group_order_sn', $where['group_order_sn']);
|
||||
})
|
||||
->when(isset($where['keywords']) && $where['keywords'] !== '', function ($query) use ($where) {
|
||||
$query->where(function ($query) use ($where) {
|
||||
$query->whereLike('StoreOrderOther.real_name|StoreOrderOther.user_phone|order_sn', "%" . $where['keywords'] . "%");
|
||||
});
|
||||
})
|
||||
->when(isset($where['reconciliation_type']) && $where['reconciliation_type'] !== '', function ($query) use ($where) {
|
||||
$query->when($where['reconciliation_type'], function ($query) use ($where) {
|
||||
$query->where('reconciliation_id', '<>', 0);
|
||||
}, function ($query) use ($where) {
|
||||
$query->where('reconciliation_id', 0);
|
||||
});
|
||||
})->order('StoreOrderOther.create_time DESC');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $uid
|
||||
* @return array|Model|null
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/11
|
||||
*/
|
||||
public function userOrder($id, $uid)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('order_id', $id)->where('uid', $uid)->where('is_del', 0)->where('paid', 1)->where('is_system_del', 0)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param $ids
|
||||
* @return BaseQuery
|
||||
* @author xaboy
|
||||
* @day 2020/6/26
|
||||
*/
|
||||
public function usersOrderQuery(array $where, $ids, $uid)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where(function ($query) use ($uid, $ids) {
|
||||
$query->whereIn('uid', $ids)->whereOr(function ($query) use ($uid) {
|
||||
if ($uid) {
|
||||
$query->where('uid', $uid)->where('is_selfbuy', 1);
|
||||
}
|
||||
});
|
||||
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['date'], 'pay_time');
|
||||
})->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
|
||||
$query->whereLike('order_id|order_sn', "%{$where['keyword']}%");
|
||||
})->where('paid', 1)->order('pay_time DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @param int|null $except
|
||||
* @return bool
|
||||
* @author xaboy
|
||||
* @day 2020/6/11
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
public function getMerId($id)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('order_id', $id)->value('mer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @return bool
|
||||
* @author Qinii
|
||||
* @day 2020-06-12
|
||||
*/
|
||||
public function merFieldExists(array $where)
|
||||
{
|
||||
return ($this->getModel()::getDB())->where($where)->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param $reconciliation_id
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 2020-06-15
|
||||
*/
|
||||
public function reconciliationUpdate($reconciliation_id)
|
||||
{
|
||||
return ($this->getModel()::getDB())->whereIn('reconciliation_id', $reconciliation_id)->update(['reconciliation_id' => 0]);
|
||||
}
|
||||
|
||||
public function dayOrderNum($day, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($day, function ($query, $day) {
|
||||
getModelTime($query, $day, 'pay_time');
|
||||
})->count();
|
||||
}
|
||||
|
||||
public function dayOrderPrice($day, $merId = null)
|
||||
{
|
||||
return getModelTime(StoreOrderOther::getDB()->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
}), $day, 'pay_time')->sum('pay_price');
|
||||
}
|
||||
|
||||
public function dateOrderPrice($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->sum('pay_price');
|
||||
}
|
||||
|
||||
public function dateOrderNum($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->count();
|
||||
}
|
||||
|
||||
public function dayOrderUserNum($day, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($day, function ($query, $day) {
|
||||
getModelTime($query, $day, 'pay_time');
|
||||
})->group('uid')->count();
|
||||
}
|
||||
|
||||
public function orderUserNum($date, $paid = null, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when($paid, function ($query, $paid) {
|
||||
$query->where('paid', $paid);
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) use ($paid) {
|
||||
if (!$paid) {
|
||||
getModelTime($query, $date);
|
||||
// $query->where(function ($query) use ($date) {
|
||||
// $query->where(function ($query) use ($date) {
|
||||
// $query->where('paid', 1);
|
||||
// getModelTime($query, $date, 'pay_time');
|
||||
// })->whereOr(function ($query) use ($date) {
|
||||
// $query->where('paid', 0);
|
||||
// getModelTime($query, $date);
|
||||
// });
|
||||
// });
|
||||
} else
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->group('uid')->count();
|
||||
}
|
||||
|
||||
public function orderUserGroup($date, $paid = null, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when($paid, function ($query, $paid) {
|
||||
$query->where('paid', $paid);
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->group('uid')->field(Db::raw('uid,sum(pay_price) as pay_price,count(order_id) as total'))->select();
|
||||
}
|
||||
|
||||
public function oldUserNum(array $ids, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->whereIn('uid', $ids)->where('paid', 1)->group('uid')->count();
|
||||
}
|
||||
|
||||
public function oldUserIds(array $ids, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->whereIn('uid', $ids)->where('paid', 1)->group('uid')->column('uid');
|
||||
}
|
||||
|
||||
public function orderPrice($date, $paid = null, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when($paid, function ($query, $paid) {
|
||||
$query->where('paid', $paid);
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->when($date, function ($query, $date) use ($paid) {
|
||||
if (!$paid) {
|
||||
$query->where(function ($query) use ($date) {
|
||||
$query->where(function ($query) use ($date) {
|
||||
$query->where('paid', 1);
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->whereOr(function ($query) use ($date) {
|
||||
$query->where('paid', 0);
|
||||
getModelTime($query, $date);
|
||||
});
|
||||
});
|
||||
} else
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->sum('pay_price');
|
||||
}
|
||||
|
||||
public function orderGroupNum($date, $merId = null)
|
||||
{
|
||||
$field = Db::raw('sum(pay_price) as pay_price,count(*) as total,count(distinct uid) as user,pay_time,from_unixtime(unix_timestamp(pay_time),\'%m-%d\') as `day`');
|
||||
if ($date == 'year') {
|
||||
$field = Db::raw('sum(pay_price) as pay_price,count(*) as total,count(distinct uid) as user,pay_time,from_unixtime(unix_timestamp(pay_time),\'%m\') as `day`');
|
||||
}
|
||||
$query = StoreOrderOther::getDB()->field($field)
|
||||
->where('paid', 1)->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
});
|
||||
return $query->order('pay_time ASC')->group('day')->select();
|
||||
}
|
||||
|
||||
public function orderGroupNumPage($where, $page, $limit, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->when(isset($where['dateRange']), function ($query) use ($where) {
|
||||
getModelTime($query, date('Y/m/d 00:00:00', $where['dateRange']['start']) . '-' . date('Y/m/d 00:00:00', $where['dateRange']['stop']), 'pay_time');
|
||||
})->field(
|
||||
Db::raw('status,sum(pay_price) as pay_price,count(*) as total,count(distinct uid) as user,pay_time,from_unixtime(unix_timestamp(pay_time),\'%m-%d\') as `day`')
|
||||
)
|
||||
->where('paid', 1)->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->order('pay_time DESC')->page($page, $limit)->group('day')->select()->each(function ($item) use ($merId) {
|
||||
$pay_time = explode(' ', $item['pay_time']);
|
||||
$item->settlement_price = Db::name('store_order')
|
||||
->whereIn('status', [2, 3])
|
||||
->where('mer_id', $merId)
|
||||
->whereDay('pay_time', $pay_time[0])
|
||||
->sum('pay_price');
|
||||
});
|
||||
}
|
||||
|
||||
public function dayOrderPriceGroup($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->field(Db::raw('sum(pay_price) as price, from_unixtime(unix_timestamp(pay_time),\'%H:%i\') as time'))
|
||||
->where('paid', 1)->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->group('time')->select();
|
||||
}
|
||||
|
||||
public function dayOrderNumGroup($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->field(Db::raw('count(*) as total, from_unixtime(unix_timestamp(pay_time),\'%H:%i\') as time'))
|
||||
->where('paid', 1)->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->group('time')->select();
|
||||
}
|
||||
|
||||
public function dayOrderUserGroup($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->field(Db::raw('count(DISTINCT uid) as total, from_unixtime(unix_timestamp(pay_time),\'%H:%i\') as time'))
|
||||
->where('paid', 1)->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->group('time')->select();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间到指定时间的支付金额 管理员
|
||||
* @param string $start 开始时间
|
||||
* @param string $stop 结束时间
|
||||
* @return mixed
|
||||
*/
|
||||
public function chartTimePrice($start, $stop, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)
|
||||
->where('pay_time', '>=', $start)
|
||||
->where('pay_time', '<', $stop)
|
||||
->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})
|
||||
->field('sum(pay_price) as num,FROM_UNIXTIME(unix_timestamp(pay_time), \'%Y-%m-%d\') as time')
|
||||
->group('time')
|
||||
->order('pay_time ASC')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $date
|
||||
* @param null $merId
|
||||
* @return mixed
|
||||
*/
|
||||
public function chartTimeNum($date, $merId = null)
|
||||
{
|
||||
return StoreOrderOther::getDB()->where('paid', 1)->when($date, function ($query) use ($date) {
|
||||
getModelTime($query, $date, 'pay_time');
|
||||
})->when($merId, function ($query, $merId) {
|
||||
$query->where('mer_id', $merId);
|
||||
})->field('count(order_id) as num,FROM_UNIXTIME(unix_timestamp(pay_time), \'%Y-%m-%d\') as time')
|
||||
->group('time')
|
||||
->order('pay_time ASC')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $end
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/9/16
|
||||
*/
|
||||
public function getFinishTimeoutIds($end)
|
||||
{
|
||||
return StoreOrderStatusOther::getDB()->alias('A')->leftJoin('StoreOrderOther B', 'A.order_id = B.order_id')
|
||||
->where('A.change_type', 'take')
|
||||
->where('A.change_time', '<', $end)->where('B.paid', 1)->where('B.status', 2)->where('B.pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY)
|
||||
->column('A.order_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 参与人数
|
||||
* @param array $data
|
||||
* @param int|null $uid
|
||||
* @return BaseQuery
|
||||
* @author Qinii
|
||||
* @day 2020-11-11
|
||||
*/
|
||||
public function getTattendCount(array $data, ?int $uid)
|
||||
{
|
||||
$query = StoreOrderOther::hasWhere('orderProduct', function ($query) use ($data, $uid) {
|
||||
$query->when(isset($data['activity_id']), function ($query) use ($data) {
|
||||
$query->where('activity_id', $data['activity_id']);
|
||||
})
|
||||
->when(isset($data['product_sku']), function ($query) use ($data) {
|
||||
$query->where('product_sku', $data['product_sku']);
|
||||
})
|
||||
->when(isset($data['product_id']), function ($query) use ($data) {
|
||||
$query->where('product_id', $data['product_id']);
|
||||
})
|
||||
->when(isset($data['exsits_id']), function ($query) use ($data) {
|
||||
switch ($data['product_type']) {
|
||||
case 3:
|
||||
$make = app()->make(ProductAssistSetRepository::class);
|
||||
$id = 'product_assist_id';
|
||||
break;
|
||||
case 4:
|
||||
$make = app()->make(ProductGroupBuyingRepository::class);
|
||||
$id = 'product_group_id';
|
||||
break;
|
||||
}
|
||||
$where = [$id => $data['exsits_id']];
|
||||
$activity_id = $make->getSearch($where)->column($make->getPk());
|
||||
if ($activity_id) {
|
||||
$id = array_unique($activity_id);
|
||||
$query->where('activity_id', 'in', $id);
|
||||
} else {
|
||||
$query->where('activity_id', '<', 0);
|
||||
}
|
||||
})
|
||||
->where('product_type', $data['product_type']);
|
||||
if ($uid) $query->where('uid', $uid);
|
||||
});
|
||||
$query->where('activity_type', $data['product_type']);
|
||||
switch ($data['product_type']) {
|
||||
case 0:
|
||||
$query->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1);
|
||||
})->whereOr(function ($query) {
|
||||
$query->where('paid', 0)->where('is_del', 0);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 1: //秒杀
|
||||
$query->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1);
|
||||
})->whereOr(function ($query) {
|
||||
$query->where('paid', 0)->where('is_del', 0);
|
||||
});
|
||||
})->when(isset($data['day']), function ($query) use ($data) {
|
||||
$query->whereDay('StoreOrderOther.create_time', $data['day']);
|
||||
});
|
||||
break;
|
||||
case 2: //预售
|
||||
|
||||
/**
|
||||
* 第一阶段参与人数:所有人
|
||||
* 第二阶段参与人数:支付了第一阶段
|
||||
*/
|
||||
//第二阶段
|
||||
if ($data['type'] == 1) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1)->whereOr(function ($query) {
|
||||
$query->where('paid', 0)->where('is_del', 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
if ($data['type'] == 2) $query->where('paid', 1)->where('status', 'in', [0, 1, 2, 3, -1]);
|
||||
break;
|
||||
case 3: //助力
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1)->whereOr(function ($query) {
|
||||
$query->where('paid', 0)->where('is_del', 0);
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 4: //
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1)->whereOr(function ($query) {
|
||||
$query->where('paid', 0)->where('is_del', 0);
|
||||
})
|
||||
->where('status', '>', -1);
|
||||
});
|
||||
break;
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未使用
|
||||
* TODO 成功支付人数
|
||||
* @param int $productType
|
||||
* @param int $activityId
|
||||
* @param int|null $uid
|
||||
* @param int|null $status
|
||||
* @author Qinii
|
||||
* @day 2020-10-30
|
||||
*/
|
||||
public function getTattendSuccessCount($data, ?int $uid)
|
||||
{
|
||||
$query = StoreOrderOther::hasWhere('orderProduct', function ($query) use ($data, $uid) {
|
||||
$query->when(isset($data['activity_id']), function ($query) use ($data) {
|
||||
$query->where('activity_id', $data['activity_id']);
|
||||
})
|
||||
->when(isset($data['product_sku']), function ($query) use ($data) {
|
||||
$query->where('product_sku', $data['product_sku']);
|
||||
})
|
||||
->when(isset($data['product_id']), function ($query) use ($data) {
|
||||
$query->where('product_id', $data['product_id']);
|
||||
})
|
||||
->when(isset($data['exsits_id']), function ($query) use ($data) {
|
||||
switch ($data['product_type']) {
|
||||
case 3:
|
||||
$make = app()->make(ProductAssistSetRepository::class);
|
||||
$id = 'product_assist_id';
|
||||
break;
|
||||
case 4:
|
||||
$make = app()->make(ProductGroupBuyingRepository::class);
|
||||
$id = 'product_group_id';
|
||||
break;
|
||||
}
|
||||
$where = [$id => $data['exsits_id']];
|
||||
$activity_id = $make->getSearch($where)->column($make->getPk());
|
||||
if ($activity_id) {
|
||||
$id = array_unique($activity_id);
|
||||
$query->where('activity_id', 'in', $id);
|
||||
} else {
|
||||
$query->where('activity_id', '<', 0);
|
||||
}
|
||||
})
|
||||
->where('product_type', $data['product_type']);
|
||||
if ($uid) $query->where('uid', $uid);
|
||||
});
|
||||
$query->where('activity_type', $data['product_type'])->where('paid', 1);
|
||||
|
||||
switch ($data['product_type']) {
|
||||
case 1: //秒杀
|
||||
$query->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('paid', 1);
|
||||
});
|
||||
})->when(isset($data['day']), function ($query) use ($data) {
|
||||
$query->whereDay('StoreOrderOther.create_time', $data['day']);
|
||||
});
|
||||
break;
|
||||
case 2: //预售
|
||||
if ($data['type'] == 1) { //第一阶段
|
||||
$query->where('status', 'in', [0, 1, 2, 3, 10]);
|
||||
} else { //第二阶段
|
||||
$query->where('status', 'in', [0, 1, 2, 3]);
|
||||
}
|
||||
break;
|
||||
case 3: //助力
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 获取退款单数量
|
||||
* @param $where
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 1/4/21
|
||||
*/
|
||||
public function getSeckillRefundCount($where, $type = 1)
|
||||
{
|
||||
$query = StoreOrderProductOther::getDB()->alias('P')->join('StoreRefundOrder R', 'P.order_id = R.order_id');
|
||||
$query->join('StoreOrder O', 'StoreOrderOther.order_id = P.order_id');
|
||||
$query
|
||||
->when(isset($where['activity_id']), function ($query) use ($where) {
|
||||
$query->where('P.activity_id', $where['activity_id']);
|
||||
})
|
||||
->when(isset($where['product_sku']), function ($query) use ($where) {
|
||||
$query->where('P.product_sku', $where['product_sku']);
|
||||
})
|
||||
->when(isset($where['day']), function ($query) use ($where) {
|
||||
$query->whereDay('P.create_time', $where['day']);
|
||||
})
|
||||
->when($type == 1, function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.verify_time', null)->where('StoreOrderOther.delivery_type', null);
|
||||
}, function ($query) {
|
||||
$query->where('R.refund_type', 2);
|
||||
})
|
||||
->where('P.product_type', 1)->where('R.status', 3);
|
||||
return $query->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO 用户的某个商品购买数量
|
||||
* @param int $uid
|
||||
* @param int $productId
|
||||
* @return int
|
||||
* @author Qinii
|
||||
* @day 2022/9/26
|
||||
*/
|
||||
public function getMaxCountNumber(int $uid, int $productId)
|
||||
{
|
||||
return StoreOrderOther::hasWhere('orderProduct', function ($query) use ($productId) {
|
||||
$query->where('product_id', $productId);
|
||||
})
|
||||
->where(function ($query) {
|
||||
$query->where('is_del', 0)->whereOr(function ($query) {
|
||||
$query->where('is_del', 1)->where('paid', 1);
|
||||
});
|
||||
})->where('StoreOrderOther.uid', $uid)->count();
|
||||
}
|
||||
}
|
72
app/common/dao/store/order/StoreOrderStatusOtherDao.php
Normal file
72
app/common/dao/store/order/StoreOrderStatusOtherDao.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\dao\store\order;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\store\order\StoreOrderStatus;
|
||||
use app\common\model\store\order\StoreOrderStatusOther;
|
||||
|
||||
/**
|
||||
* Class StoreOrderStatusDao
|
||||
* @package app\common\dao\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
class StoreOrderStatusOtherDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreOrderStatusOther::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
public function search($where)
|
||||
{
|
||||
$query = ($this->getModel()::getDB())
|
||||
->when(isset($where['id']) && $where['id'] !== '', function($query) use($where){
|
||||
$query->where('order_id', $where['id']);
|
||||
})
|
||||
->when(isset($where['type']) && $where['type'] !== '', function($query) use($where){
|
||||
$query->where('type', $where['type']);
|
||||
})
|
||||
->when(isset($where['user_type']) && $where['user_type'] !== '', function($query) use($where){
|
||||
$query->where('user_type', $where['user_type']);
|
||||
})
|
||||
->when(isset($where['date']) && $where['date'] !== '', function($query) use($where){
|
||||
getModelTime($query, $where['date'],'change_time');
|
||||
});
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getTimeoutDeliveryOrder($end)
|
||||
{
|
||||
return StoreOrderStatusOther::getDB()->alias('A')->leftJoin('StoreOrder B', 'A.order_id = B.order_id')
|
||||
->whereIn('A.change_type', ['delivery_0', 'delivery_1', 'delivery_2'])
|
||||
->where('A.change_time', '<', $end)->where('B.paid', 1)->where('B.status', 1)
|
||||
->column('A.order_id');
|
||||
}
|
||||
}
|
@ -26,6 +26,9 @@ class StoreGroupOrder extends BaseModel
|
||||
const PAY_TYPE_ROUTINE = 2; //小程序支付
|
||||
const PAY_TYPE_H5 = 3; //H5支付
|
||||
const PAY_TYPE_CREDIT_BUY = 8; //信用购 先货后款
|
||||
const ON_LINE_PRODUCT = 9; //线上铺货
|
||||
const ENTITY_PRODUCT = 10; //实体铺货
|
||||
const ON_CREDIT_PRODUCT = 11; //赊账进货
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
|
122
app/common/model/store/order/StoreGroupOrderOther.php
Normal file
122
app/common/model/store/order/StoreGroupOrderOther.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\store\coupon\StoreCouponRepository;
|
||||
|
||||
class StoreGroupOrderOther extends BaseModel
|
||||
{
|
||||
|
||||
const PAY_TYPE_BALANCE = 0; //余额支付
|
||||
const PAY_TYPE_WECHAT = 1; //微信支付
|
||||
const PAY_TYPE_ROUTINE = 2; //小程序支付
|
||||
const PAY_TYPE_H5 = 3; //H5支付
|
||||
const PAY_TYPE_CREDIT_BUY = 8; //信用购 先货后款
|
||||
const ON_LINE_PRODUCT = 9; //线上铺货
|
||||
const ENTITY_PRODUCT = 10; //实体铺货
|
||||
const ON_CREDIT_PRODUCT = 11; //赊账进货
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'group_order_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_group_order_other';
|
||||
}
|
||||
|
||||
public function orderList()
|
||||
{
|
||||
return $this->hasMany(StoreOrderOther::class, 'group_order_id', 'group_order_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
|
||||
public function getGiveCouponAttr()
|
||||
{
|
||||
if (count($this->give_coupon_ids))
|
||||
return app()->make(StoreCouponRepository::class)->getGiveCoupon($this->give_coupon_ids);
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getCancelTimeAttr()
|
||||
{
|
||||
$timer = ((int)systemConfig('auto_close_order_timer')) ?: 15;
|
||||
return date('m-d H:i', strtotime("+ $timer minutes", strtotime($this->create_time)));
|
||||
}
|
||||
|
||||
public function getCancelUnixAttr()
|
||||
{
|
||||
$timer = ((int)systemConfig('auto_close_order_timer')) ?: 15;
|
||||
return strtotime("+ $timer minutes", strtotime($this->create_time));
|
||||
}
|
||||
|
||||
public function getGiveCouponIdsAttr($value)
|
||||
{
|
||||
return $value ? explode(',', $value) : [];
|
||||
}
|
||||
|
||||
public function setGiveCouponIdsAttr($value)
|
||||
{
|
||||
return $value ? implode(',', $value) : '';
|
||||
}
|
||||
|
||||
public function getCombinePayParams($attach = 'order')
|
||||
{
|
||||
$params = [
|
||||
'order_sn' => $this->group_order_sn,
|
||||
'sub_orders' => [],
|
||||
'attach' => $attach,
|
||||
'body' => '订单支付',
|
||||
];
|
||||
foreach ($this->orderList as $order) {
|
||||
if ($order->pay_price > 0) {
|
||||
$subOrder = [
|
||||
'pay_price' => $order->pay_price,
|
||||
'order_sn' => $order->order_sn,
|
||||
'sub_mchid' => $order->merchant->sub_mchid,
|
||||
];
|
||||
$params['sub_orders'][] = $subOrder;
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function getPayParams($return_url = '', $attach = 'order')
|
||||
{
|
||||
$params = [
|
||||
'order_sn' => $this->group_order_sn,
|
||||
'pay_price' => $this->pay_price,
|
||||
'attach' => $attach,
|
||||
'body' => '订单支付'
|
||||
];
|
||||
if ($return_url) {
|
||||
$params['return_url'] = $return_url;
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function interest()
|
||||
{
|
||||
return $this->hasOne(StoreOrderInterest::class, 'group_order_id', 'group_order_id');
|
||||
}
|
||||
|
||||
}
|
39
app/common/model/store/order/StoreOrderInterestOther.php
Normal file
39
app/common/model/store/order/StoreOrderInterestOther.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class StoreOrderInterestOther extends BaseModel
|
||||
{
|
||||
|
||||
const STATUS_SETTLED = 1; //已结算
|
||||
const STATUS_UNSETTLED = 0; //未结算
|
||||
const STATUS_DELETED = -1; //已删除
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_order_interest_other';
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算利息
|
||||
* @return string
|
||||
*/
|
||||
public function calculateInterest()
|
||||
{
|
||||
if ($this->start_time == '0000-00-00 00:00:00') {
|
||||
return 0;
|
||||
}
|
||||
$days = ceil((time() - strtotime($this->start_time)) / 86400);
|
||||
$days = max($days ,0);
|
||||
$money = bcmul($this->total_price, ($this->rate / 100), 3);
|
||||
return bcmul($days, $money, 2);
|
||||
}
|
||||
|
||||
}
|
196
app/common/model/store/order/StoreOrderOther.php
Normal file
196
app/common/model/store/order/StoreOrderOther.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\community\Community;
|
||||
use app\common\model\store\product\ProductGroupUser;
|
||||
use app\common\model\store\service\StoreService;
|
||||
use app\common\model\store\shipping\Express;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\store\MerchantTakeRepository;
|
||||
|
||||
class StoreOrderOther extends BaseModel
|
||||
{
|
||||
|
||||
const STATUS_WAIT_CONFIRM = 12; //待确认
|
||||
const STATUS_WAIT_PAY = 0; //待支付
|
||||
const STATUS_WAIT_COMMENT = 2; //待评价
|
||||
const STATUS_FINISH = 3; //已完成
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'order_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_order_other';
|
||||
}
|
||||
|
||||
public function orderProduct()
|
||||
{
|
||||
return $this->hasMany(StoreOrderProductOther::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function refundProduct()
|
||||
{
|
||||
return $this->orderProduct()->where('refund_num', '>', 0);
|
||||
}
|
||||
|
||||
public function refundOrder()
|
||||
{
|
||||
return $this->hasMany(StoreRefundOrder::class,'order_id','order_id');
|
||||
}
|
||||
|
||||
public function orderStatus()
|
||||
{
|
||||
return $this->hasMany(StoreOrderStatusOther::class,'order_id','order_id')->order('change_time DESC');
|
||||
}
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'uid');
|
||||
}
|
||||
public function receipt()
|
||||
{
|
||||
return $this->hasOne(StoreOrderReceipt::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function spread()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'spread_uid');
|
||||
}
|
||||
|
||||
public function TopSpread()
|
||||
{
|
||||
return $this->hasOne(User::class, 'uid', 'top_uid');
|
||||
}
|
||||
|
||||
public function groupOrder()
|
||||
{
|
||||
return $this->hasOne(StoreGroupOrderOther::class, 'group_order_id', 'group_order_id');
|
||||
}
|
||||
|
||||
public function verifyService()
|
||||
{
|
||||
return $this->hasOne(StoreService::class, 'service_id', 'verify_service_id');
|
||||
}
|
||||
|
||||
public function getTakeAttr()
|
||||
{
|
||||
return app()->make(MerchantTakeRepository::class)->get($this->mer_id);
|
||||
}
|
||||
|
||||
public function searchDataAttr($query, $value)
|
||||
{
|
||||
return getModelTime($query, $value);
|
||||
}
|
||||
|
||||
public function presellOrder()
|
||||
{
|
||||
return $this->hasOne(PresellOrder::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function finalOrder()
|
||||
{
|
||||
return $this->hasOne(PresellOrder::class,'order_id','order_id');
|
||||
}
|
||||
|
||||
public function groupUser()
|
||||
{
|
||||
return $this->hasOne(ProductGroupUser::class,'order_id','order_id');
|
||||
}
|
||||
|
||||
public function profitsharing()
|
||||
{
|
||||
return $this->hasMany(StoreOrderProfitsharing::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function firstProfitsharing()
|
||||
{
|
||||
return $this->hasOne(StoreOrderProfitsharing::class, 'order_id', 'order_id')->where('type', 'order');
|
||||
}
|
||||
|
||||
public function presellProfitsharing()
|
||||
{
|
||||
return $this->hasOne(StoreOrderProfitsharing::class, 'order_id', 'order_id')->where('type', 'presell');
|
||||
}
|
||||
|
||||
// 核销订单的自订单列表
|
||||
public function takeOrderList()
|
||||
{
|
||||
return $this->hasMany(self::class,'main_id','order_id')->order('verify_time DESC');
|
||||
}
|
||||
|
||||
public function searchMerIdAttr($query, $value)
|
||||
{
|
||||
return $query->where('mer_id', $value);
|
||||
}
|
||||
|
||||
public function getRefundStatusAttr()
|
||||
{
|
||||
$day = (int)systemConfig('sys_refund_timer') ?: 15;
|
||||
return ($this->verify_time ? strtotime($this->verify_time) > strtotime('-' . $day . ' day') : true);
|
||||
}
|
||||
|
||||
public function getOrderExtendAttr($val)
|
||||
{
|
||||
return $val ? json_decode($val, true) : null;
|
||||
}
|
||||
|
||||
public function getRefundExtensionOneAttr()
|
||||
{
|
||||
if ( $this->refundOrder ){
|
||||
return $this->refundOrder()->where('status',3)->sum('extension_one');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getRefundExtensionTwoAttr()
|
||||
{
|
||||
if ( $this->refundOrder ){
|
||||
return $this->refundOrder()->where('status',3)->sum('extension_two');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function community()
|
||||
{
|
||||
return $this->hasOne(Community::class, 'order_id', 'order_id')->bind(['community_id']);
|
||||
}
|
||||
|
||||
public function getRefundPriceAttr()
|
||||
{
|
||||
return StoreRefundOrder::where('order_id',$this->order_id)->where('status',3)->sum('refund_price');
|
||||
}
|
||||
|
||||
public function interest()
|
||||
{
|
||||
return $this->hasOne(StoreOrderInterest::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function allowCreditPay()
|
||||
{
|
||||
return $this->pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && $this->status == self::STATUS_WAIT_PAY;
|
||||
}
|
||||
|
||||
}
|
80
app/common/model/store/order/StoreOrderProductOther.php
Normal file
80
app/common/model/store/order/StoreOrderProductOther.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\store\product\Product;
|
||||
use app\common\model\store\product\Spu;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class StoreOrderProductOther extends BaseModel
|
||||
{
|
||||
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return 'order_product_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_order_product_other';
|
||||
}
|
||||
|
||||
public function getCartInfoAttr($value)
|
||||
{
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
public function orderInfo()
|
||||
{
|
||||
return $this->hasOne(StoreOrderOther::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class,'uid','uid');
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(Product::class,'product_id','product_id');
|
||||
}
|
||||
|
||||
public function spu()
|
||||
{
|
||||
return $this->hasOne(Spu::class,'product_id','product_id');
|
||||
}
|
||||
|
||||
public function searchUidAttr($query ,$value)
|
||||
{
|
||||
$query->where('uid',$value);
|
||||
}
|
||||
public function searchActivitIidAttr($query,$value)
|
||||
{
|
||||
$query->where('activity_id',$value);
|
||||
}
|
||||
public function searchProductTypeAttr($query,$value)
|
||||
{
|
||||
$query->where('product_type',$value);
|
||||
}
|
||||
public function searchOrderIdAttr($query,$value)
|
||||
{
|
||||
$query->where('order_id',$value);
|
||||
}
|
||||
public function searchProductIdAttr($query,$value)
|
||||
{
|
||||
$query->where('product_id',$value);
|
||||
}
|
||||
}
|
47
app/common/model/store/order/StoreOrderStatusOther.php
Normal file
47
app/common/model/store/order/StoreOrderStatusOther.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model\store\order;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
/**
|
||||
* Class StoreOrderStatusOther
|
||||
* @package app\common\model\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
class StoreOrderStatusOther extends BaseModel
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
public static function tablePk(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @author xaboy
|
||||
* @day 2020/6/12
|
||||
*/
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'store_order_status_other';
|
||||
}
|
||||
}
|
@ -45,9 +45,9 @@ class StoreCartRepository extends BaseRepository
|
||||
* @return array
|
||||
* @author Qinii
|
||||
*/
|
||||
public function getList($user,$product_type)
|
||||
public function getList($user,$product_type,$source=0)
|
||||
{
|
||||
$res = $this->dao->getAll($user->uid,$product_type)->append(['checkCartProduct', 'UserPayCount', 'ActiveSku', 'attrValue', 'attr','spu']);
|
||||
$res = $this->dao->getAll($user->uid,$product_type,$source)->append(['checkCartProduct', 'UserPayCount', 'ActiveSku', 'attrValue', 'attr','spu']);
|
||||
$make = app()->make(ProductRepository::class);
|
||||
$res->map(function ($item) use ($make) {
|
||||
$item['attr'] = $make->detailAttr($item['attr']);
|
||||
@ -116,9 +116,9 @@ class StoreCartRepository extends BaseRepository
|
||||
* @param $uid
|
||||
* @author Qinii
|
||||
*/
|
||||
public function getCartByProductSku($sku, $uid, $product_type = 0)
|
||||
public function getCartByProductSku($sku, $uid, $product_type = 0,$source=0)
|
||||
{
|
||||
$where = ['is_del' => 0, 'is_fail' => 0, 'is_new' => 0, 'is_pay' => 0, 'uid' => $uid, 'product_type' => $product_type, 'product_attr_unique' => $sku];
|
||||
$where = ['is_del' => 0, 'is_fail' => 0, 'is_new' => 0, 'is_pay' => 0, 'uid' => $uid, 'product_type' => $product_type, 'product_attr_unique' => $sku,'source'=>$source];
|
||||
return ($this->dao->getWhere($where));
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$svip_discount = 0;
|
||||
$realPrice = $this->cartByPrice($cart);
|
||||
if ($source == StoreCartDao::SOURCE_PROCURE) {
|
||||
if (in_array($source,[9,10,11,12,13])) {
|
||||
if($realPrice==0){
|
||||
throw new ValidateException('价格必须大于0');
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
// } else {
|
||||
// return $cart['productAttr']['price'];
|
||||
// }
|
||||
if ($cart['source'] == StoreCartDao::SOURCE_PROCURE) {
|
||||
if (in_array($cart['source'],[9,10,11,12,13])) {
|
||||
return $cart['productAttr']['procure_price'];
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
@ -2680,7 +2680,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
"ot_price" => $datum['value']['price'],
|
||||
"svip_price" => null,
|
||||
"procure_price" => $procure_price,
|
||||
"stock" => 1,
|
||||
"stock" =>$datum['value']['stock']??1,
|
||||
"bar_code" => (int)$datum['value']['bar_code'],
|
||||
"weight" => 0,
|
||||
"volume" => 0,
|
||||
@ -2736,7 +2736,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
if (!empty($datum['value']['procure_price'])) {
|
||||
$procure_price = $datum['value']['procure_price'];
|
||||
}
|
||||
$attrValue['stock'] = 1;
|
||||
$stock=$datum['value']['stock']??1;
|
||||
$attrValue['stock'] = $stock;
|
||||
$unique = app(ProductRepository::class)->setUnique($find['product_id'], $datum['value']['bar_code'], $product_type);
|
||||
$attrValue['unique'] = $unique;
|
||||
$attrValue['detail'] = json_encode($attr_values);
|
||||
@ -2748,7 +2749,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
$attrValue['price'] = $datum['value']['price'];
|
||||
$attrValue['procure_price'] = $procure_price;
|
||||
$attrValue["image"] = "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png";
|
||||
Db::name('store_product')->where('product_id',$find['product_id'])->update(['spec_type'=>1]);
|
||||
Db::name('store_product')->where('product_id',$find['product_id'])->update(['spec_type'=>1,'stock'=>Db::raw('stock+'.$stock)]);
|
||||
Db::name('store_product_attr_value')->insert($attrValue);
|
||||
}
|
||||
/**
|
||||
|
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
use app\common\dao\store\order\StoreOrderStatusOtherDao;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use app\common\repositories\store\service\StoreServiceRepository;
|
||||
use app\common\repositories\store\service\StoreServiceUserRepository;
|
||||
|
||||
/**
|
||||
* Class StoreOrderStatusRepository
|
||||
* @package app\common\repositories\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/11
|
||||
* @mixin StoreOrderStatusDao
|
||||
*/
|
||||
class StoreOrderStatusOtherRepository extends BaseRepository
|
||||
{
|
||||
//订单日志
|
||||
public const TYPE_ORDER = 'order';
|
||||
//退款单日志
|
||||
public const TYPE_REFUND = 'refund';
|
||||
//商品日志
|
||||
// public const TYPE_PRODUCT = 'product';
|
||||
|
||||
//操作者类型
|
||||
public const U_TYPE_SYSTEM = 0;
|
||||
public const U_TYPE_USER = 1;
|
||||
public const U_TYPE_ADMIN = 2;
|
||||
public const U_TYPE_MERCHANT = 3;
|
||||
public const U_TYPE_SERVICE = 4;
|
||||
|
||||
//订单变动类型
|
||||
//取消
|
||||
const ORDER_STATUS_CANCEL = 'cancel';
|
||||
//改价
|
||||
const ORDER_STATUS_CHANGE = 'change';
|
||||
//创建
|
||||
const ORDER_STATUS_CREATE = 'create';
|
||||
//删除
|
||||
const ORDER_STATUS_DELETE = 'delete';
|
||||
//收货
|
||||
const ORDER_STATUS_TAKE = 'take';
|
||||
//拆单
|
||||
const ORDER_STATUS_SPLIT = 'split';
|
||||
//完成
|
||||
const ORDER_STATUS_OVER = 'over';
|
||||
const ORDER_STATUS_AUTO_OVER = 'auto_over';
|
||||
//预售订单
|
||||
const ORDER_STATUS_PRESELL= 'presell';
|
||||
const ORDER_STATUS_PRESELL_CLOSE = 'presell_close';
|
||||
//全部退款
|
||||
const ORDER_STATUS_REFUND_ALL = 'refund_all';
|
||||
//支付成功
|
||||
const ORDER_STATUS_PAY_SUCCCESS = 'pay_success';
|
||||
//拼图成功
|
||||
const ORDER_STATUS_GROUP_SUCCESS = 'group_success';
|
||||
//申请退款
|
||||
const CHANGE_REFUND_CREATGE = 'refund_create';
|
||||
//已发货
|
||||
const CHANGE_BACK_GOODS = 'back_goods';
|
||||
//退款申请已通过
|
||||
const CHANGE_REFUND_AGREE = 'refund_agree';
|
||||
//退款成功
|
||||
const CHANGE_REFUND_PRICE = 'refund_price';
|
||||
//订单退款已拒绝
|
||||
const CHANGE_REFUND_REFUSE = 'refund_refuse';
|
||||
//用户取消退款
|
||||
const CHANGE_REFUND_CANCEL = 'refund_cancel';
|
||||
|
||||
/*
|
||||
2 => '待取货',
|
||||
3 => '配送中',
|
||||
4 => '已完成',
|
||||
-1 => '已取消',
|
||||
9 => '物品返回中',
|
||||
10 => '物品返回完成',
|
||||
100 => '骑士到店',
|
||||
*/
|
||||
const ORDER_DELIVERY_COURIER = 'delivery_0';
|
||||
const ORDER_DELIVERY_SELF = 'delivery_1';
|
||||
const ORDER_DELIVERY_NOTHING = 'delivery_2';
|
||||
const ORDER_DELIVERY_CITY = 'delivery_5';
|
||||
const ORDER_DELIVERY_CITY_CANCEL = 'delivery_5_-1';
|
||||
const ORDER_DELIVERY_CITY_ARRIVE = 'delivery_5_100';
|
||||
const ORDER_DELIVERY_CITY_WAITING = 'delivery_5_2';
|
||||
const ORDER_DELIVERY_CITY_ING = 'delivery_5_3';
|
||||
const ORDER_DELIVERY_CITY_OVER = 'delivery_5_4';
|
||||
const ORDER_DELIVERY_CITY_REFUND = 'delivery_5_10';
|
||||
const ORDER_DELIVERY_CITY_REFUNDING = 'delivery_5_9';
|
||||
|
||||
|
||||
/**
|
||||
* StoreOrderStatusRepository constructor.
|
||||
* @param StoreOrderStatusDao $dao
|
||||
*/
|
||||
public function __construct(StoreOrderStatusOtherDao $dao)
|
||||
{
|
||||
$this->dao = $dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $order_id
|
||||
* @param $change_type
|
||||
* @param $change_message
|
||||
* @return \app\common\dao\BaseDao|\think\Model
|
||||
* @author xaboy
|
||||
* @day 2020/6/11
|
||||
*/
|
||||
public function status($order_id, $change_type, $change_message)
|
||||
{
|
||||
return $this->dao->create(compact('order_id', 'change_message', 'change_type'));
|
||||
}
|
||||
|
||||
public function search($where,$page, $limit)
|
||||
{
|
||||
$query = $this->dao->search($where)->order('change_time DESC');
|
||||
$count = $query->count();
|
||||
$list = $query->page($page, $limit)->select();
|
||||
return compact('count','list');
|
||||
}
|
||||
|
||||
public function createAdminLog(array $data)
|
||||
{
|
||||
$request = request();
|
||||
$data['user_type'] = $request->userType();
|
||||
$data['uid'] = $data['user_type'] == 1 ? $request->uid() : $request->adminId();
|
||||
$data['nickname'] = $data['user_type'] == 1 ? $request->userInfo()->real_name : $request->adminInfo()->real_name;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createServiceLog($service_id, array $data)
|
||||
{
|
||||
$service = app()->make(StoreServiceRepository::class)->getWhere(['service_id' => $service_id]);
|
||||
$data['user_type'] = self::U_TYPE_SERVICE;
|
||||
$data['uid'] = $service_id;
|
||||
$data['nickname'] = $service->nickname;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createUserLog(array $data)
|
||||
{
|
||||
$data['user_type'] = self::U_TYPE_USER;
|
||||
$data['uid'] = request()->uid();
|
||||
$data['nickname'] = request()->userInfo()->nickname;
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function createSysLog(array $data)
|
||||
{
|
||||
$data['user_type'] = self::U_TYPE_SYSTEM;
|
||||
$data['uid'] = 0;
|
||||
$data['nickname'] = '系统';
|
||||
return $this->dao->create($data);
|
||||
}
|
||||
|
||||
public function batchCreateLog($data)
|
||||
{
|
||||
if(!empty($data)) {
|
||||
return $this->dao->insertAll($data);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,757 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\repositories\store\order;
|
||||
|
||||
use app\common\dao\store\order\StoreCartDao;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\model\store\order\StoreOrder;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\repositories\community\CommunityRepository;
|
||||
use app\common\repositories\store\coupon\StoreCouponRepository;
|
||||
use app\common\repositories\store\coupon\StoreCouponUserRepository;
|
||||
use app\common\repositories\store\product\ProductAssistSkuRepository;
|
||||
use app\common\repositories\store\product\ProductAttrValueRepository;
|
||||
use app\common\repositories\store\product\ProductGroupSkuRepository;
|
||||
use app\common\repositories\store\product\ProductPresellSkuRepository;
|
||||
use app\common\repositories\store\product\ProductRepository;
|
||||
use app\common\repositories\store\product\StoreDiscountRepository;
|
||||
use app\common\repositories\store\StoreCategoryRepository;
|
||||
use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use app\common\repositories\user\MemberinterestsRepository;
|
||||
use app\common\repositories\user\UserAddressRepository;
|
||||
use app\common\repositories\user\UserBillRepository;
|
||||
use app\common\repositories\user\UserMerchantRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use app\validate\api\OrderVirtualFieldValidate;
|
||||
use app\validate\api\UserAddressValidate;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use crmeb\services\SwooleTaskService;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Queue;
|
||||
|
||||
class StoreOtherOrderCreateRepository extends StoreOtherOrderRepository
|
||||
{
|
||||
|
||||
public function v2CartIdByOrderInfo($user, array $cartId, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, $createOrder = false)
|
||||
{
|
||||
$uid = $user->uid;
|
||||
$userIntegral = $user->integral;
|
||||
$key = md5(json_encode(compact('cartId', 'takes', 'useCoupon', 'useIntegral', 'addressId'))) . $uid;
|
||||
app()->make(StoreCouponUserRepository::class)->failCoupon();
|
||||
$address = null;
|
||||
//验证地址
|
||||
if ($addressId) {
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
}
|
||||
$storeCartRepository = app()->make(StoreCartRepository::class);
|
||||
$res = $storeCartRepository->checkCartList($storeCartRepository->cartIbByData($cartId, $uid, $address), 0, $user);
|
||||
$merchantCartList = $res['list'];
|
||||
$fail = $res['fail'];
|
||||
|
||||
//检查购物车失效数据
|
||||
if (count($fail)) {
|
||||
if ($fail[0]['is_fail'])
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
if (in_array($fail[0]['product_type'], [1, 2, 3]) && !$fail[0]['userPayCount']) {
|
||||
throw new ValidateException('[超出限购数]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
throw new ValidateException('[已失效]' . mb_substr($fail[0]['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
|
||||
$svip_status = $user->is_svip > 0 && systemConfig('svip_switch_status') == '1';
|
||||
$svip_integral_rate = $svip_status ? app()->make(MemberinterestsRepository::class)->getSvipInterestVal(MemberinterestsRepository::HAS_TYPE_PAY) : 0;
|
||||
//订单活动类型
|
||||
$order_type = 0;
|
||||
$source = 2;
|
||||
//虚拟订单
|
||||
$order_model = 0;
|
||||
//虚拟订单自定义数据
|
||||
$order_extend = [];
|
||||
//检查商品类型, 活动商品只能单独购买
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
|
||||
foreach ($merchantCart['list'] as $cart) {
|
||||
if ($cart['product_type'] == 0) {
|
||||
if ($cart['product']['once_min_count'] > 0 && $cart['product']['once_min_count'] > $cart['cart_num'])
|
||||
throw new ValidateException('[低于起购数:' . $cart['product']['once_min_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
if ($cart['product']['pay_limit'] == 1 && $cart['product']['once_max_count'] < $cart['cart_num'])
|
||||
throw new ValidateException('[超出单次限购数:' . $cart['product']['once_max_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
if ($cart['product']['pay_limit'] == 2) {
|
||||
//如果长期限购
|
||||
//已购买数量
|
||||
$count = app()->make(StoreOtherOrderRepository::class)->getMaxCountNumber($cart['uid'], $cart['product_id']);
|
||||
if (($cart['cart_num'] + $count) > $cart['product']['once_max_count'])
|
||||
throw new ValidateException('[超出限购总数:' . $cart['product']['once_max_count'] . ']' . mb_substr($cart['product']['store_name'], 0, 10) . '...');
|
||||
}
|
||||
}
|
||||
if ($cart['product_type'] > 0) {
|
||||
$order_type = $cart['product_type'];
|
||||
$source = $cart['source'];
|
||||
}
|
||||
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
||||
throw new ValidateException('活动商品必须单独购买');
|
||||
}
|
||||
if ($cart['product']['type'] && (count($merchantCart['list']) != 1 || count($merchantCartList) != 1)) {
|
||||
throw new ValidateException('虚拟商品必须单独购买');
|
||||
}
|
||||
$order_model = $cart['product']['type'];
|
||||
if ($cart['product']['extend']) {
|
||||
$order_extend = json_decode($cart['product']['extend'], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$community = [];
|
||||
unset($merchantCart, $cart);
|
||||
$order_price = 0;
|
||||
$total_true_price = 0;
|
||||
$order_total_price = 0;
|
||||
$order_coupon_price = 0;
|
||||
$noDeliver = false;
|
||||
$presellType = 0;
|
||||
$fn = [];
|
||||
$enabledPlatformCoupon = !$order_type;
|
||||
$order_total_postage = 0;
|
||||
$platformCoupon = [];
|
||||
|
||||
$orderDeliveryStatus = true;
|
||||
$order_svip_discount = 0;
|
||||
// 循环计算每个店铺的订单数据 委托商品是否设置收货方式 ?
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
$postageRule = [];
|
||||
$total_price = 0;
|
||||
$total_num = 0;
|
||||
$valid_total_price = 0;
|
||||
$postage_price = 0;
|
||||
$product_price = [];
|
||||
$final_price = 0;
|
||||
$down_price = 0;
|
||||
$total_svip_discount = 0;
|
||||
|
||||
//是否自提
|
||||
$isTake = in_array($merchantCart['mer_id'], $takes ?? []);
|
||||
|
||||
$merTake = in_array('1', $merchantCart['delivery_way'], true);
|
||||
$merDelivery = (!$merchantCart['delivery_way'] || !count($merchantCart['delivery_way']) || in_array('2', $merchantCart['delivery_way'], true));
|
||||
$deliveryStatus = true;
|
||||
$product_cart = [];
|
||||
|
||||
|
||||
if ($deliveryStatus && !$isTake && ($merDelivery || $merTake)) {
|
||||
$isTake = $merDelivery ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
$enabledCoupon = !($order_type && $order_type != 2);
|
||||
|
||||
$merchantCart['coupon'] = [];
|
||||
|
||||
$svip_coupon_merge = merchantConfig($merchantCart['mer_id'], 'svip_coupon_merge');
|
||||
$use_svip = 0;
|
||||
//获取运费规则和统计商品数据
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
|
||||
if ($cart['cart_num'] <= 0) {
|
||||
throw new ValidateException('购买商品数必须大于0');
|
||||
}
|
||||
$svip_discount = 0;
|
||||
$realPrice = $this->cartByPrice($cart);
|
||||
$price = bcmul($cart['cart_num'], $realPrice, 2);
|
||||
$cart['total_price'] = $price;
|
||||
$cart['postage_price'] = 0;
|
||||
$cart['svip_discount'] = 0;
|
||||
$total_price = bcadd($total_price, $price, 2);
|
||||
$total_num += $cart['cart_num'];
|
||||
$_price = bcmul($cart['cart_num'], $this->cartByCouponPrice($cart), 2);
|
||||
$cart['svip_coupon_merge'] = 1;
|
||||
if ($cart['productAttr']['show_svip_price'] && !$cart['product_type']) {
|
||||
$svip_discount = max(bcmul($cart['cart_num'], bcsub($cart['productAttr']['org_price'] ?? 0, $cart['productAttr']['price'], 2), 2), 0);
|
||||
if ($svip_coupon_merge != '1') {
|
||||
$_price = 0;
|
||||
$cart['svip_coupon_merge'] = 0;
|
||||
}
|
||||
$use_svip = 1;
|
||||
}
|
||||
$valid_total_price = bcadd($valid_total_price, $_price, 2);
|
||||
$cart['allow_price'] = $_price;
|
||||
$temp1 = $cart['product']['temp'];
|
||||
$cart['temp_number'] = 0;
|
||||
$total_svip_discount = bcadd($total_svip_discount, $svip_discount, 2);
|
||||
$cart['svip_discount'] = $svip_discount;
|
||||
|
||||
if (!isset($product_cart[$cart['product_id']]))
|
||||
$product_cart[$cart['product_id']] = [$cart['cart_id']];
|
||||
else
|
||||
$product_cart[$cart['product_id']][] = $cart['cart_id'];
|
||||
|
||||
if ($_price > 0) {
|
||||
$product_price[$cart['product_id']] = bcadd($product_price[$cart['product_id']] ?? 0, $_price, 2);
|
||||
}
|
||||
|
||||
if (!$temp1) continue;
|
||||
|
||||
$number = $this->productByTempNumber($cart);
|
||||
if ($number <= 0) continue;
|
||||
$cart['temp_number'] = $number;
|
||||
|
||||
if ($order_model || !$temp1 || ($cart['product_type'] == 10 && $cart['productDiscount']['free_shipping'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$free = $temp1['free'][0] ?? null;
|
||||
$region = $temp1['region'][0] ?? null;
|
||||
|
||||
if (!$cart['product']['delivery_free'] && !$isTake && (!$address || !$cart['product']['temp'] || ($temp1['undelivery'] == 2 && !$free && (!$region || !$region['city_id'])))) {
|
||||
$cart['undelivered'] = true;
|
||||
$noDeliver = true;
|
||||
continue;
|
||||
}
|
||||
$cart['undelivered'] = (!$isTake) && $temp1['undelivery'] == 1 && isset($temp1['undelives']);
|
||||
$fn[] = function () use ($cart) {
|
||||
unset($cart['product']['temp']);
|
||||
};
|
||||
|
||||
if ($cart['undelivered']) {
|
||||
$noDeliver = true;
|
||||
continue;
|
||||
}
|
||||
if ($cart['product']['delivery_free']) {
|
||||
continue;
|
||||
}
|
||||
$tempId = $cart['product']['temp_id'];
|
||||
if (!isset($postageRule[$tempId])) {
|
||||
$postageRule[$tempId] = [
|
||||
'free' => null,
|
||||
'region' => null,
|
||||
'cart' => [],
|
||||
'price' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$freeRule = $postageRule[$tempId]['free'];
|
||||
$regionRule = $postageRule[$tempId]['region'];
|
||||
$postageRule[$tempId]['cart'][] = $cart['cart_id'];
|
||||
$postageRule[$tempId]['price'] = bcadd($postageRule[$tempId]['price'], $cart['price'], 2);
|
||||
|
||||
if ($temp1['appoint'] && $free) {
|
||||
if (!isset($freeRule)) {
|
||||
$freeRule = $free;
|
||||
$freeRule['cart_price'] = 0;
|
||||
$freeRule['cart_number'] = 0;
|
||||
}
|
||||
$freeRule['cart_number'] = bcadd($freeRule['cart_number'], $number, 2);
|
||||
$freeRule['cart_price'] = bcadd($freeRule['cart_price'], $price, 2);
|
||||
}
|
||||
|
||||
if ($region) {
|
||||
if (!isset($regionRule)) {
|
||||
$regionRule = $region;
|
||||
$regionRule['cart_price'] = 0;
|
||||
$regionRule['cart_number'] = 0;
|
||||
}
|
||||
$regionRule['cart_number'] = bcadd($regionRule['cart_number'], $number, 2);
|
||||
$regionRule['cart_price'] = bcadd($regionRule['cart_price'], $price, 2);
|
||||
}
|
||||
$postageRule[$tempId]['free'] = $freeRule;
|
||||
$postageRule[$tempId]['region'] = $regionRule;
|
||||
}
|
||||
unset($cart);
|
||||
|
||||
$coupon_price = 0;
|
||||
$use_store_coupon = 0;
|
||||
|
||||
$merCouponIds = (array)($useCoupon[$merchantCart['mer_id']] ?? []);
|
||||
$merCouponIds = array_reverse($merCouponIds);
|
||||
$sortIds = $merCouponIds;
|
||||
unset($defaultSort);
|
||||
$defaultSort = [];
|
||||
if (count($merCouponIds)) {
|
||||
foreach ($merchantCart['coupon'] as &$item) {
|
||||
$defaultSort[] = &$item;
|
||||
if (!in_array($item['coupon_user_id'], $sortIds, true)) {
|
||||
$sortIds[] = $item['coupon_user_id'];
|
||||
}
|
||||
}
|
||||
unset($item);
|
||||
usort($merchantCart['coupon'], function ($a, $b) use ($sortIds) {
|
||||
return array_search($a['coupon_user_id'], $sortIds) > array_search($b['coupon_user_id'], $sortIds) ? 1 : -1;
|
||||
});
|
||||
}
|
||||
|
||||
$pay_price = max(bcsub($valid_total_price, $coupon_price, 2), 0);
|
||||
$_pay_price = $pay_price;
|
||||
|
||||
|
||||
$useCouponIds = [];
|
||||
|
||||
//计算单个商品实际支付金额
|
||||
foreach ($merchantCart['list'] as $_k => &$cart) {
|
||||
$cartTotalPrice = bcmul($this->cartByPrice($cart), $cart['cart_num'], 2);
|
||||
$_cartTotalPrice = $cartTotalPrice;
|
||||
|
||||
//单个商品实际支付金额
|
||||
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
||||
$cart['true_price'] = $cartTotalPrice;
|
||||
}
|
||||
unset($cart, $_k);
|
||||
$total_true_price = bcadd($_pay_price, $total_true_price, 2);
|
||||
if (count($merchantCartList) > 1 || count($merchantCart['list']) > 1) {
|
||||
$orderDeliveryStatus = $orderDeliveryStatus && $deliveryStatus;
|
||||
}
|
||||
$merchantCart['order'] = [
|
||||
'true_price' => $_pay_price,
|
||||
'platform_coupon_price' => 0,
|
||||
'valid_total_price' => $valid_total_price,
|
||||
'total_price' => $total_price,
|
||||
'final_price' => $final_price,
|
||||
'down_price' => $down_price,
|
||||
'coupon_price' => $coupon_price,
|
||||
'platformCoupon' => $platformCoupon,
|
||||
'svip_coupon_merge' => $svip_coupon_merge,
|
||||
'postage_price' => $postage_price,
|
||||
'isTake' => $isTake,
|
||||
'total_num' => $total_num,
|
||||
'enabledCoupon' => $enabledCoupon,
|
||||
'useCouponIds' => $useCouponIds,
|
||||
'allow_take' => $merTake,
|
||||
'allow_delivery' => $merDelivery,
|
||||
'delivery_status' => $deliveryStatus,
|
||||
'svip_discount' => $total_svip_discount,
|
||||
'use_svip' => $use_svip,
|
||||
];
|
||||
$order_total_postage = bcadd($order_total_postage, $postage_price, 2);
|
||||
$order_svip_discount = bcadd($total_svip_discount, $order_svip_discount, 2);
|
||||
if (count($defaultSort)) {
|
||||
$merchantCart['coupon'] = &$defaultSort;
|
||||
}
|
||||
}
|
||||
unset($merchantCart);
|
||||
|
||||
$usePlatformCouponId = 0;
|
||||
$total_platform_coupon_price = 0;
|
||||
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
if (!$merchantCart['order']['use_svip'])
|
||||
continue;
|
||||
$totalMergePrice = 0;
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
if (!$cart['svip_coupon_merge']) {
|
||||
$totalMergePrice = bcadd($totalMergePrice, $cart['true_price'], 2);
|
||||
$cart['allow_price'] = $cart['true_price'];
|
||||
}
|
||||
}
|
||||
unset($cart);
|
||||
if ($totalMergePrice > 0) {
|
||||
$total_true_price = bcadd($total_true_price, $totalMergePrice, 2);
|
||||
$merchantCart['order']['valid_total_price'] = bcadd($merchantCart['order']['valid_total_price'], $totalMergePrice, 2);
|
||||
$merchantCart['order']['true_price'] = $merchantCart['order']['valid_total_price'];
|
||||
}
|
||||
}
|
||||
unset($merchantCart);
|
||||
|
||||
$usePlatformCouponId = 0;
|
||||
$total_platform_coupon_price = 0;
|
||||
|
||||
//积分配置
|
||||
$sysIntegralConfig = systemConfig(['integral_money', 'integral_status', 'integral_order_rate']);
|
||||
$merIntegralFlag = false;
|
||||
$order_total_integral = 0;
|
||||
$order_total_integral_price = 0;
|
||||
$order_total_give_integral = 0;
|
||||
$allow_no_address = true;
|
||||
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
$merchantCart['take'] = [
|
||||
'mer_integral_rate' => 0,
|
||||
'mer_integral_status' => 0,
|
||||
];
|
||||
$allow_no_address = $allow_no_address && $merchantCart['order']['isTake'];
|
||||
foreach ($merchantCart['config'] as $config) {
|
||||
$merchantCart['take'][$config['config_key']] = $config['value'];
|
||||
}
|
||||
$merIntegralConfig = $merchantCart['take'];
|
||||
unset($merchantCart['config']);
|
||||
$merIntegralConfig['mer_integral_rate'] = min(1, $merIntegralConfig['mer_integral_rate'] > 0 ? bcdiv($merIntegralConfig['mer_integral_rate'], 100, 4) : $merIntegralConfig['mer_integral_rate']);
|
||||
$total_integral = 0;
|
||||
$total_integral_price = 0;
|
||||
$merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']);
|
||||
|
||||
$order_total_integral = bcadd($order_total_integral, $total_integral, 0);
|
||||
$order_total_integral_price = bcadd($order_total_integral_price, $total_integral_price, 2);
|
||||
|
||||
$_pay_price = $merchantCart['order']['true_price'];
|
||||
$valid_total_price = $merchantCart['order']['valid_total_price'];
|
||||
$total_price = $merchantCart['order']['total_price'];
|
||||
$final_price = $merchantCart['order']['final_price'];
|
||||
$down_price = $merchantCart['order']['down_price'];
|
||||
$postage_price = $merchantCart['order']['postage_price'];
|
||||
|
||||
//计算订单商品金额
|
||||
$org_price = bcadd(bcsub($total_price, $valid_total_price, 2), max($_pay_price, 0), 2);
|
||||
if ($presellType == 2) {
|
||||
$org_price = max(bcsub($org_price, $final_price, 2), $down_price);
|
||||
}
|
||||
|
||||
//获取可优惠金额
|
||||
$coupon_price = 0;
|
||||
$order_coupon_price = 0;
|
||||
|
||||
//计算订单金额
|
||||
if ($order_type != 2 || $presellType != 2) {
|
||||
$pay_price = bcadd($postage_price, $org_price, 2);
|
||||
} else {
|
||||
$pay_price = $org_price;
|
||||
}
|
||||
|
||||
$total_give_integral = 0;
|
||||
|
||||
foreach ($fn as $callback) {
|
||||
$callback();
|
||||
}
|
||||
|
||||
$merchantCart['order']['order_type'] = $order_type;
|
||||
$merchantCart['order']['total_give_integral'] = $total_give_integral;
|
||||
$merchantCart['order']['total_integral_price'] = $total_integral_price;
|
||||
$merchantCart['order']['total_integral'] = $total_integral;
|
||||
$merchantCart['order']['org_price'] = $org_price;
|
||||
$merchantCart['order']['pay_price'] = $pay_price;
|
||||
$merchantCart['order']['coupon_price'] = $coupon_price;
|
||||
|
||||
$order_price = bcadd($order_price, $pay_price, 2);
|
||||
$order_total_price = bcadd($order_total_price, $total_price, 2);
|
||||
}
|
||||
unset($merchantCart);
|
||||
|
||||
if ($order_model) {
|
||||
$allow_no_address = false;
|
||||
}
|
||||
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
$cart['total_price'] = bcadd($cart['total_price'], $cart['svip_discount'], 2);
|
||||
}
|
||||
unset($cart);
|
||||
$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);
|
||||
}
|
||||
unset($merchantCart);
|
||||
$status = ($address || $order_model || $allow_no_address) ? ($noDeliver ? 'noDeliver' : 'finish') : 'noAddress';
|
||||
$order = $merchantCartList;
|
||||
$total_price = $order_total_price;
|
||||
$openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0;
|
||||
$total_coupon = bcadd($order_svip_discount, bcadd(bcadd($total_platform_coupon_price, $order_coupon_price, 2), $order_total_integral_price, 2), 2);
|
||||
return compact(
|
||||
'order_type',
|
||||
'source',
|
||||
'order_model',
|
||||
'order_extend',
|
||||
'order_total_postage',
|
||||
'order_price',
|
||||
'total_price',
|
||||
'community',
|
||||
'enabledPlatformCoupon',
|
||||
'platformCoupon',
|
||||
'usePlatformCouponId',
|
||||
'order_total_integral',
|
||||
'order_total_integral_price',
|
||||
'order_total_give_integral',
|
||||
'order_svip_discount',
|
||||
'total_platform_coupon_price',
|
||||
'total_coupon',
|
||||
'order_coupon_price',
|
||||
'order',
|
||||
'status',
|
||||
'address',
|
||||
'openIntegral',
|
||||
'useIntegral',
|
||||
'key'
|
||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
||||
}
|
||||
|
||||
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, int $product_type = 0)
|
||||
{
|
||||
$uid = $user->uid;
|
||||
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
|
||||
$order_model = $orderInfo['order_model'];
|
||||
$order_extend = $orderInfo['order_extend'];
|
||||
if (!$orderInfo['order_delivery_status']) {
|
||||
throw new ValidateException('部分商品配送方式不一致,请单独下单');
|
||||
}
|
||||
if ($orderInfo['order_price'] > 1000000) {
|
||||
throw new ValidateException('支付金额超出最大限制');
|
||||
}
|
||||
if ($orderInfo['status'] == 'noDeliver') throw new ValidateException('商品不支持该区域');
|
||||
if ($orderInfo['status'] == 'noAddress') throw new ValidateException('请选择地址');
|
||||
if (!$order_model && $orderInfo['allow_address']) {
|
||||
if (!$orderInfo['address']) throw new ValidateException('请选择正确的收货地址');
|
||||
if (!$orderInfo['address']['province_id']) throw new ValidateException('请完善收货地址信息');
|
||||
$extend = [];
|
||||
} else if (count($order_extend)) {
|
||||
$extend = app()->make(OrderVirtualFieldValidate::class)->load($order_extend, $extend);
|
||||
} else {
|
||||
$extend = [];
|
||||
}
|
||||
$orderType = $orderInfo['order_type'];
|
||||
if ($orderType == 0 && $pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||
throw new ValidateException('该商品不支持先货后款');
|
||||
}
|
||||
if (!in_array($orderType, [0, 98, 99]) && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) {
|
||||
throw new ValidateException('活动商品请单独购买');
|
||||
}
|
||||
|
||||
$merchantCartList = $orderInfo['order'];
|
||||
$cartSpread = 0;
|
||||
$hasTake = false;
|
||||
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
if ($merchantCart['order']['isTake']) {
|
||||
$hasTake = true;
|
||||
}
|
||||
//检查发票状态
|
||||
if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt'])
|
||||
throw new ValidateException('该店铺不支持开发票');
|
||||
|
||||
foreach ($merchantCart['list'] as $cart) {
|
||||
if (!$cartSpread && $cart['spread_id']) {
|
||||
$cartSpread = $cart['spread_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($hasTake) {
|
||||
app()->make(UserAddressValidate::class)->scene('take')->check($post);
|
||||
}
|
||||
|
||||
if ($cartSpread) {
|
||||
app()->make(UserRepository::class)->bindSpread($user, $cartSpread);
|
||||
}
|
||||
|
||||
$isSelfBuy = $user->is_promoter && systemConfig('extension_self') ? 1 : 0;
|
||||
if ($isSelfBuy) {
|
||||
$spreadUser = $user;
|
||||
$topUser = $user->valid_spread;
|
||||
} else {
|
||||
$spreadUser = $user->valid_spread;
|
||||
$topUser = $user->valid_top;
|
||||
}
|
||||
$spreadUid = $spreadUser->uid ?? 0;
|
||||
$topUid = $topUser->uid ?? 0;
|
||||
|
||||
$giveCouponIds = [];
|
||||
$address = $orderInfo['address'];
|
||||
$allUseCoupon = $orderInfo['usePlatformCouponId'] ? [$orderInfo['usePlatformCouponId']] : [];
|
||||
$totalNum = 0;
|
||||
$totalPostage = 0;
|
||||
$totalCost = 0;
|
||||
$cartIds = [];
|
||||
$orderList = [];
|
||||
foreach ($merchantCartList as $k => $merchantCart) {
|
||||
foreach ($merchantCart['list'] as &$cart) {
|
||||
$cartIds[] = $cart['cart_id'];
|
||||
}
|
||||
$cost = 0;
|
||||
$rate = 0;
|
||||
if ($merchantCart['commission_rate'] > 0) {
|
||||
$rate = $merchantCart['commission_rate'];
|
||||
} else if (isset($merchantCart['merchantCategory']['commission_rate']) && $merchantCart['merchantCategory']['commission_rate'] > 0) {
|
||||
$rate = bcmul($merchantCart['merchantCategory']['commission_rate'], 100, 4);
|
||||
}
|
||||
$user_address = isset($address) ? ($address['province'] . $address['city'] . $address['district'] . $address['street'] . $address['village'] . $address['brigade'] . $address['detail']) : '';
|
||||
$user_address_code = isset($address) ? ($address['province_code'] . ',' . $address['city_code'] . ',' . $address['district_code'] . ',' . $address['street_code'] . ',' . $address['village_code'] . ',' . $address['brigade_id']) : '';
|
||||
//整理订单数据
|
||||
$_order = [
|
||||
'cartInfo' => $merchantCart,
|
||||
'activity_type' => $orderInfo['order_type'],
|
||||
'source' => $orderInfo['source'] ?? 2,
|
||||
'commission_rate' => (float)$rate,
|
||||
'order_type' => $merchantCart['order']['isTake'] ? 1 : 0,
|
||||
'is_virtual' => $order_model ? 1 : 0,
|
||||
'extension_one' =>0,
|
||||
'extension_two' => 0,
|
||||
'order_sn' => $this->getNewOrderId(StoreOtherOrderRepository::TYPE_SN_ORDER) . ($k + 1),
|
||||
'uid' => $uid,
|
||||
'spread_uid' => $spreadUid,
|
||||
'top_uid' => $topUid,
|
||||
'is_selfbuy' => $isSelfBuy,
|
||||
'real_name' => $merchantCart['order']['isTake'] ? $post['real_name'] : ($address['real_name'] ?? ''),
|
||||
'user_phone' => $merchantCart['order']['isTake'] ? $post['phone'] : ($address['phone'] ?? ''),
|
||||
'user_address' => $user_address,
|
||||
'user_address_code' => $user_address_code,
|
||||
'cart_id' => implode(',', array_column($merchantCart['list'], 'cart_id')),
|
||||
'total_num' => $merchantCart['order']['total_num'],
|
||||
'total_price' => $merchantCart['order']['total_price'],
|
||||
'total_postage' => $merchantCart['order']['postage_price'],
|
||||
'pay_postage' => $merchantCart['order']['postage_price'],
|
||||
'svip_discount' => $merchantCart['order']['svip_discount'],
|
||||
'pay_price' => $merchantCart['order']['pay_price'],
|
||||
'integral' => $merchantCart['order']['total_integral'],
|
||||
'integral_price' => $merchantCart['order']['total_integral_price'],
|
||||
'give_integral' => $merchantCart['order']['total_give_integral'],
|
||||
'mer_id' => $merchantCart['mer_id'],
|
||||
'cost' => $cost,
|
||||
'order_extend' => count($extend) ? json_encode($extend, JSON_UNESCAPED_UNICODE) : '',
|
||||
'coupon_id' => implode(',', $merchantCart['order']['useCouponIds']),
|
||||
'mark' => $mark[$merchantCart['mer_id']] ?? '',
|
||||
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
|
||||
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
|
||||
'pay_type' => $pay_type,
|
||||
'paid'=>1,
|
||||
'pay_time'=>date('Y-m-d H:i:s',time()),
|
||||
];
|
||||
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
|
||||
$orderList[] = $_order;
|
||||
$totalPostage = bcadd($totalPostage, $_order['total_postage'], 2);
|
||||
$totalCost = bcadd($totalCost, $cost, 2);
|
||||
$totalNum += $merchantCart['order']['total_num'];
|
||||
}
|
||||
$groupOrder = [
|
||||
'uid' => $uid,
|
||||
'group_order_sn' => count($orderList) === 1 ? $orderList[0]['order_sn'] : ($this->getNewOrderId(StoreOtherOrderRepository::TYPE_SN_ORDER) . '0'),
|
||||
'total_postage' => $totalPostage,
|
||||
'total_price' => $orderInfo['total_price'],
|
||||
'total_num' => $totalNum,
|
||||
'real_name' => $address['real_name'] ?? '',
|
||||
'user_phone' => $address['phone'] ?? '',
|
||||
'user_address' => $user_address,
|
||||
'pay_price' => $orderInfo['order_price'],
|
||||
'coupon_price' => bcadd($orderInfo['total_platform_coupon_price'], $orderInfo['order_coupon_price'], 2),
|
||||
'pay_postage' => $totalPostage,
|
||||
'cost' => $totalCost,
|
||||
'coupon_id' => $orderInfo['usePlatformCouponId'] > 0 ? $orderInfo['usePlatformCouponId'] : '',
|
||||
'pay_type' => $pay_type,
|
||||
'give_coupon_ids' => $giveCouponIds,
|
||||
'integral' => $orderInfo['order_total_integral'],
|
||||
'integral_price' => $orderInfo['order_total_integral_price'],
|
||||
'give_integral' => $orderInfo['order_total_give_integral'],
|
||||
];
|
||||
$group = Db::transaction(function () use ($user, $uid, $cartIds, $groupOrder, $orderList) {
|
||||
$storeCartRepository = app()->make(StoreCartRepository::class);
|
||||
/** @var ProductAttrValueRepository $attrValueRepository */
|
||||
$attrValueRepository = app()->make(ProductAttrValueRepository::class);
|
||||
/** @var ProductRepository $productRepository */
|
||||
$productRepository = app()->make(ProductRepository::class);
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$userMerchantRepository = app()->make(UserMerchantRepository::class);
|
||||
|
||||
//减库存
|
||||
foreach ($orderList as $order) {
|
||||
foreach ($order['cartInfo']['list'] as $cart) {
|
||||
if (!isset($uniqueList[$cart['productAttr']['product_id'] . $cart['productAttr']['unique']])) {
|
||||
$uniqueList[$cart['productAttr']['product_id'] . $cart['productAttr']['unique']] = true;
|
||||
} else {
|
||||
throw new ValidateException('购物车商品信息重复');
|
||||
}
|
||||
try {
|
||||
$attrValueRepository->descStock($cart['productAttr']['product_id'], $cart['productAttr']['unique'], $cart['cart_num']);
|
||||
$productRepository->descStock($cart['product']['product_id'], $cart['cart_num']);
|
||||
/** @var PurchaseRecordRepository $purchaseRecordRepo */
|
||||
$purchaseRecordRepo = app()->make(PurchaseRecordRepository::class);
|
||||
$purchaseRecordRepo->incSalesVolume($cart['product']['product_id'], $cart['productAttr']['unique'], $cart['cart_num']);
|
||||
if ($cart['integral'] && $cart['integral']['use'] > 0) {
|
||||
$productRepository->incIntegral($cart['product']['product_id'], $cart['integral']['use'], $cart['integral']['price']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new ValidateException('库存不足');
|
||||
}
|
||||
}
|
||||
}
|
||||
//修改购物车状态
|
||||
$storeCartRepository->updates($cartIds, [
|
||||
'is_pay' => 1
|
||||
]);
|
||||
|
||||
//创建订单
|
||||
// $groupOrder = $storeGroupOrderRepository->create($groupOrder);
|
||||
$group_order_id = Db::name('store_group_order_other')->insertGetId($groupOrder);
|
||||
|
||||
foreach ($orderList as $k => $order) {
|
||||
$orderList[$k]['group_order_id'] = $group_order_id;
|
||||
}
|
||||
|
||||
$orderProduct = [];
|
||||
$orderStatus = [];
|
||||
foreach ($orderList as $order) {
|
||||
$cartInfo = $order['cartInfo'];
|
||||
unset($order['cartInfo']);
|
||||
//创建子订单
|
||||
// $_order = $this->dao->create($order);
|
||||
$order_id = Db::name('store_order_other')->insertGetId($order);
|
||||
|
||||
$orderStatus[] = [
|
||||
'order_id' => $order_id,
|
||||
'order_sn' => $order['order_sn'],
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '订单生成',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_CREATE,
|
||||
'uid' => $user->uid,
|
||||
'nickname' => $user->nickname,
|
||||
'user_type' => $storeOrderStatusRepository::U_TYPE_USER,
|
||||
];
|
||||
|
||||
foreach ($cartInfo['list'] as $cart) {
|
||||
$productPrice = $cart['true_price'];
|
||||
// $extension_one = $cart['extension_one'];
|
||||
// $extension_two = $cart['extension_two'];
|
||||
|
||||
|
||||
$order_cart = [
|
||||
'product' => $cart['product'],
|
||||
'productAttr' => $cart['productAttr'],
|
||||
'product_type' => $cart['product_type']
|
||||
];
|
||||
|
||||
$orderProduct[] = [
|
||||
'order_id' => $order_id,
|
||||
'cart_id' => $cart['cart_id'],
|
||||
'uid' => $uid,
|
||||
'product_id' => $cart['product_id'],
|
||||
'activity_id' => $cart['source'],
|
||||
'total_price' => $cart['total_price'],
|
||||
'product_price' => $productPrice,
|
||||
'extension_one' => 0,
|
||||
'extension_two' => 0,
|
||||
'postage_price' => $cart['postage_price'],
|
||||
'svip_discount' => $cart['svip_discount'],
|
||||
'cost' => $cart['cost']??0,
|
||||
'coupon_price' => $cart['coupon_price'],
|
||||
'platform_coupon_price' => $cart['platform_coupon_price'],
|
||||
'product_sku' => $cart['productAttr']['unique'],
|
||||
'product_num' => $cart['cart_num'],
|
||||
'refund_num' => $cart['cart_num'],
|
||||
'integral_price' => $cart['integral']['price'] ?? 0,
|
||||
'integral' => $cart['integral'] ? bcdiv($cart['integral']['use'], $cart['cart_num'], 0) : 0,
|
||||
'integral_total' => $cart['integral'] ? $cart['integral']['use'] : 0,
|
||||
'product_type' => $cart['product_type'],
|
||||
'source' => $cart['source'],
|
||||
'source_id' => $cart['source_id'],
|
||||
'cart_info' => json_encode($order_cart)
|
||||
];
|
||||
}
|
||||
|
||||
$userMerchantRepository->getInfo($uid, $order['mer_id']);
|
||||
app()->make(MerchantRepository::class)->incSales($order['mer_id'], $order['total_num']);
|
||||
}
|
||||
Db::name('store_order_status_other')->insertAll($orderStatus);
|
||||
Db::name('store_order_product_other')->insertAll($orderProduct);
|
||||
return $groupOrder;
|
||||
});
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
foreach ($merchantCart['list'] as $cart) {
|
||||
if (($cart['productAttr']['stock'] - $cart['cart_num']) < (int)merchantConfig($merchantCart['mer_id'], 'mer_store_stock')) {
|
||||
SwooleTaskService::merchant('notice', [
|
||||
'type' => 'min_stock',
|
||||
'data' => [
|
||||
'title' => '库存不足',
|
||||
'message' => $cart['product']['store_name'] . '(' . $cart['productAttr']['sku'] . ')库存不足',
|
||||
'id' => $cart['product']['product_id']
|
||||
]
|
||||
], $merchantCart['mer_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => $group->group_order_id]);
|
||||
return $group;
|
||||
}
|
||||
}
|
2024
app/common/repositories/store/order/StoreOtherOrderRepository.php
Normal file
2024
app/common/repositories/store/order/StoreOtherOrderRepository.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -321,7 +321,7 @@ class ProductRepository extends BaseRepository
|
||||
}
|
||||
app()->make(SpuRepository::class)->changeStatus($id, $productType);
|
||||
Db::commit();
|
||||
return $res;
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return false;
|
||||
@ -541,7 +541,7 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
$result = [];
|
||||
foreach ($data as $value) {
|
||||
if ($value['category']) {
|
||||
if (is_int($value)||$value['category']) {
|
||||
$result[] = [
|
||||
'product_id' => $productId,
|
||||
'mer_cate_id' => $value,
|
||||
@ -1933,20 +1933,19 @@ class ProductRepository extends BaseRepository
|
||||
if ($data['cart_num'] !== 1) throw new ValidateException('礼包商品只能购买一个');
|
||||
if ($userInfo->is_promoter) throw new ValidateException('您已经是分销员了');
|
||||
}
|
||||
|
||||
//立即购买 限购
|
||||
if ($data['is_new']) {
|
||||
$cart_num = $data['cart_num'];
|
||||
} else {
|
||||
//加入购物车
|
||||
//购物车现有
|
||||
$_num = $this->productOnceCountCart($where['product_id'], $data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||
$_num = $this->productOnceCountCart($where['product_id'], $data['product_attr_unique'], $userInfo->uid, $data['product_type'],$data['source']);
|
||||
$cart_num = $_num + $data['cart_num'];
|
||||
}
|
||||
if ($sku['stock'] < $cart_num) throw new ValidateException('库存不足');
|
||||
//添加购物车
|
||||
if (!$data['is_new']) {
|
||||
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid, $data['product_type'],$data['source']);
|
||||
}
|
||||
return compact('product', 'sku', 'cart');
|
||||
}
|
||||
@ -1959,7 +1958,7 @@ class ProductRepository extends BaseRepository
|
||||
* @author Qinii
|
||||
* @day 5/26/21
|
||||
*/
|
||||
public function productOnceCountCart($productId, $product_attr_unique, $uid, $product_type = 0)
|
||||
public function productOnceCountCart($productId, $product_attr_unique, $uid, $product_type = 0,$source=0)
|
||||
{
|
||||
$make = app()->make(StoreCartRepository::class);
|
||||
$where = [
|
||||
@ -1971,6 +1970,7 @@ class ProductRepository extends BaseRepository
|
||||
'product_id' => $productId,
|
||||
'uid' => $uid,
|
||||
'product_attr_unique' => $product_attr_unique,
|
||||
'source'=>$source
|
||||
];
|
||||
$cart_num = $make->getSearch($where)->sum('cart_num');
|
||||
return $cart_num;
|
||||
|
@ -22,6 +22,7 @@ use FormBuilder\Form;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Route;
|
||||
|
||||
/**
|
||||
@ -115,7 +116,7 @@ class MerchantCategoryRepository extends BaseRepository
|
||||
* @Date: 2020/9/15
|
||||
* @return array
|
||||
*/
|
||||
public function getSelect($v2=0)
|
||||
public function getSelect($v2=0,$type=0)
|
||||
{
|
||||
$query = $this->search([])->field('merchant_category_id,category_name,background');
|
||||
$list = $query->select()->toArray();
|
||||
@ -126,6 +127,19 @@ class MerchantCategoryRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
if($type==1){
|
||||
$lists=[];
|
||||
foreach($list as $k=>$v) {
|
||||
if($type==1){
|
||||
$find=Db::name('merchant')->where('category_id',$v['merchant_category_id'])
|
||||
->where('status',1)->where('is_del',0)->cache(300)->find();
|
||||
if($find){
|
||||
$lists[]=$v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$list=$lists;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +422,6 @@ class Auth extends BaseController
|
||||
|
||||
public function doMargin()
|
||||
{
|
||||
return app('json')->fail('线上缴纳调整中,请在线下缴纳');
|
||||
$user = $this->request->userInfo();
|
||||
$merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find();
|
||||
if (!$merchant) {
|
||||
|
@ -526,4 +526,21 @@ class Common extends BaseController
|
||||
->field('merchant_category_id as category_id,category_name,background,cover,description')->select();
|
||||
return app('json')->success($find??[]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组合数据
|
||||
*/
|
||||
public function system_group_value($name){
|
||||
$group_id= Db::name('system_group')->where('group_key',$name)->value('group_id');
|
||||
$data=[];
|
||||
if($group_id){
|
||||
$select=Db::name('system_group_data')->where('group_id',$group_id)
|
||||
->limit(100)->select();
|
||||
foreach($select as $k=>$v){
|
||||
$data[$k]=json_decode($v['value'],true);
|
||||
}
|
||||
}
|
||||
return app('json')->success($data);
|
||||
|
||||
}
|
||||
}
|
||||
|
393
app/controller/api/server/StoreOrderOther.php
Normal file
393
app/controller/api/server/StoreOrderOther.php
Normal file
@ -0,0 +1,393 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\controller\api\server;
|
||||
|
||||
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\repositories\delivery\DeliveryStationRepository;
|
||||
use app\common\repositories\store\order\StoreOtherOrderCreateRepository;
|
||||
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
||||
use app\common\repositories\store\service\StoreServiceRepository;
|
||||
use app\controller\merchant\Common;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\App;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class StoreOrderOther extends BaseController
|
||||
{
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
}
|
||||
public function orderStatistics($merId, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$product_type=$this->request->param('product_type',0);
|
||||
$order = $repository->OrderTitleNumber($merId, null,$product_type);
|
||||
$order['refund'] = app()->make(StoreRefundOrderRepository::class)->getWhereCount(['is_system_del' => 0, 'mer_id' => $merId]);
|
||||
/** @var Common $common */
|
||||
$common = app()->make(Common::class);
|
||||
$data = [];
|
||||
$data['today'] = $common->mainGroup('today', $merId);
|
||||
$data['yesterday'] = $common->mainGroup('yesterday', $merId);
|
||||
$data['month'] = $common->mainGroup('month', $merId);
|
||||
return app('json')->success(compact('order', 'data'));
|
||||
}
|
||||
|
||||
public function orderDetail($merId, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
list($start, $stop) = $this->request->params([
|
||||
['start', strtotime(date('Y-m'))],
|
||||
['stop', time()],
|
||||
], true);
|
||||
if ($start == $stop) return app('json')->fail('参数有误');
|
||||
if ($start > $stop) {
|
||||
$middle = $stop;
|
||||
$stop = $start;
|
||||
$start = $middle;
|
||||
}
|
||||
$where = $this->request->has('start') ? ['dateRange' => compact('start', 'stop')] : [];
|
||||
$list = $repository->orderGroupNumPage($where, $page, $limit, $merId);
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
public function orderList($merId, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where['status'] = $this->request->param('status');
|
||||
$where['pay_time'] = $this->request->param('pay_time');
|
||||
$where['product_type'] = $this->request->param('product_type',0);
|
||||
if ($where['product_type']==0){
|
||||
unset($where['product_type']);
|
||||
}
|
||||
$where['is_verify'] = $this->request->param('is_verify');
|
||||
$where['search'] = $this->request->param('store_name');
|
||||
$where['order_search'] = $this->request->param('search_info');
|
||||
$where['mer_id'] = $merId;
|
||||
$where['is_del'] = 0;
|
||||
return app('json')->success($repository->merchantGetList($where, $page, $limit));
|
||||
}
|
||||
|
||||
public function order($merId, $id, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$detail = $repository->getDetail($id);
|
||||
if (!$detail)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($detail['mer_id'] != $merId)
|
||||
return app('json')->fail('没有权限');
|
||||
return app('json')->success($detail->toArray());
|
||||
}
|
||||
|
||||
|
||||
protected function checkOrderAuth($merId, $id)
|
||||
{
|
||||
if (!app()->make(StoreOtherOrderCreateRepository::class)->existsWhere(['mer_id' => $merId, 'order_id' => $id]))
|
||||
throw new ValidateException('没有权限');
|
||||
}
|
||||
|
||||
public function mark($merId, $id, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$this->checkOrderAuth($merId, $id);
|
||||
$data = $this->request->params(['remark']);
|
||||
$repository->update($id, $data);
|
||||
return app('json')->success('备注成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 发货操作
|
||||
* @param $merId
|
||||
* @param $id
|
||||
* @param StoreOtherOrderCreateRepository $repository
|
||||
* @return Json
|
||||
* @author Qinii
|
||||
* @day 6/1/22
|
||||
*/
|
||||
public function delivery($merId, $id, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$this->checkOrderAuth($merId, $id);
|
||||
$type = $this->request->param('delivery_type');
|
||||
$split = $this->request->params(['is_split',['split',[]]]);
|
||||
if (!$repository->merDeliveryExists($id, $merId))
|
||||
return app('json')->fail('订单信息或状态错误');
|
||||
switch ($type)
|
||||
{
|
||||
case 3: //虚拟发货
|
||||
$data = $this->request->params([
|
||||
'delivery_type',
|
||||
'remark',
|
||||
]);
|
||||
$data['delivery_name'] = '';
|
||||
$data['delivery_id'] = '';
|
||||
$method = 'delivery';
|
||||
break;
|
||||
case 4: //电子面单
|
||||
if (!systemConfig('crmeb_serve_dump'))
|
||||
return app('json')->fail('电子面单功能未开启');
|
||||
$data = $this->request->params([
|
||||
'delivery_type',
|
||||
'delivery_name',
|
||||
'from_name',
|
||||
'from_tel',
|
||||
'from_addr',
|
||||
'temp_id',
|
||||
'remark',
|
||||
]);
|
||||
if (!$data['from_name'] ||
|
||||
!$data['delivery_name'] ||
|
||||
!$data['from_tel'] ||
|
||||
!$data['from_addr'] ||
|
||||
!$data['temp_id']
|
||||
)
|
||||
return app('json')->fail('填写配送信息');
|
||||
$method = 'dump';
|
||||
break;
|
||||
case 5: //同城配送
|
||||
if (systemConfig('delivery_status') != 1)
|
||||
return app('json')->fail('未开启同城配送');
|
||||
$data = $this->request->params([
|
||||
'delivery_type',
|
||||
'station_id',
|
||||
'mark',
|
||||
['cargo_weight',0],
|
||||
'remark',
|
||||
]);
|
||||
if ($data['cargo_weight'] < 0) return app('json')->fail('包裹重量能为负数');
|
||||
if (!$data['station_id']) return app('json')->fail('请选择门店');
|
||||
$method = 'cityDelivery';
|
||||
break;
|
||||
default: //快递
|
||||
$data = $this->request->params([
|
||||
'delivery_type',
|
||||
'delivery_type',
|
||||
'delivery_name',
|
||||
'delivery_id',
|
||||
'remark',
|
||||
]);
|
||||
if (!$data['delivery_type'] || !$data['delivery_name'] || !$data['delivery_id'])
|
||||
return app('json')->fail('填写配送信息');
|
||||
|
||||
$method = 'delivery';
|
||||
break;
|
||||
}
|
||||
$repository->runDelivery($id,$merId, $data, $split, $method, $this->request->serviceInfo()->service_id);
|
||||
return app('json')->success('发货成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 扫描发货
|
||||
* @param $orderId
|
||||
* @param $orderSn
|
||||
*/
|
||||
public function deliveryGoods($orderId, $orderSn, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
app()->make(StoreOtherOrderCreateRepository::class)->takeGoods($orderId, $orderSn);
|
||||
return app('json')->success('扫描发货成功');
|
||||
}
|
||||
|
||||
public function payPrice($merId, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
list($start, $stop, $month) = $this->request->params([
|
||||
['start', strtotime(date('Y-m'))],
|
||||
['stop', time()],
|
||||
'month'
|
||||
], true);
|
||||
|
||||
if ($month) {
|
||||
$start = date('Y/m/d', strtotime(getStartModelTime('month')));
|
||||
$stop = date('Y/m/d H:i:s', strtotime('+ 1day'));
|
||||
$front = date('Y/m/d', strtotime('first Day of this month', strtotime('-1 day', strtotime('first Day of this month'))));
|
||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
||||
} else {
|
||||
if ($start == $stop) return app('json')->fail('参数有误');
|
||||
if ($start > $stop) {
|
||||
$middle = $stop;
|
||||
$stop = $start;
|
||||
$start = $middle;
|
||||
}
|
||||
$space = bcsub($stop, $start, 0);//间隔时间段
|
||||
$front = bcsub($start, $space, 0);//第一个时间段
|
||||
|
||||
$front = date('Y/m/d H:i:s', $front);
|
||||
$start = date('Y/m/d H:i:s', $start);
|
||||
$stop = date('Y/m/d H:i:s', $stop);
|
||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
||||
}
|
||||
$frontPrice = $repository->dateOrderPrice($front . '-' . $end, $merId);
|
||||
$afterPrice = $repository->dateOrderPrice($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
||||
$chartInfo = $repository->chartTimePrice($start, date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
||||
$data['chart'] = $chartInfo;//营业额图表数据
|
||||
$data['time'] = $afterPrice;//时间区间营业额
|
||||
$increase = (float)bcsub((string)$afterPrice, (string)$frontPrice, 2); //同比上个时间区间增长营业额
|
||||
$growthRate = abs($increase);
|
||||
if ($growthRate == 0) $data['growth_rate'] = 0;
|
||||
else if ($frontPrice == 0) $data['growth_rate'] = bcmul($growthRate, 100, 0);
|
||||
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontPrice, 2), '100', 0);//时间区间增长率
|
||||
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
|
||||
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreOtherOrderCreateRepository $repository
|
||||
* @return Json
|
||||
* @author xaboy
|
||||
* @day 2020/8/27
|
||||
*/
|
||||
public function payNumber($merId, StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
list($start, $stop, $month) = $this->request->params([
|
||||
['start', strtotime(date('Y-m'))],
|
||||
['stop', time()],
|
||||
'month'
|
||||
], true);
|
||||
|
||||
if ($month) {
|
||||
$start = date('Y/m/d', strtotime(getStartModelTime('month')));
|
||||
$stop = date('Y/m/d H:i:s', strtotime('+ 1day'));
|
||||
$front = date('Y/m/d', strtotime('first Day of this month', strtotime('-1 day', strtotime('first Day of this month'))));
|
||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
||||
} else {
|
||||
if ($start == $stop) return app('json')->fail('参数有误');
|
||||
if ($start > $stop) {
|
||||
$middle = $stop;
|
||||
$stop = $start;
|
||||
$start = $middle;
|
||||
}
|
||||
$space = bcsub($stop, $start, 0);//间隔时间段
|
||||
$front = bcsub($start, $space, 0);//第一个时间段
|
||||
|
||||
$front = date('Y/m/d H:i:s', $front);
|
||||
$start = date('Y/m/d H:i:s', $start);
|
||||
$stop = date('Y/m/d H:i:s', $stop);
|
||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
||||
}
|
||||
$frontNumber = $repository->dateOrderNum($front . '-' . $end, $merId);
|
||||
$afterNumber = $repository->dateOrderNum($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
||||
$chartInfo = $repository->chartTimeNum($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
||||
$data['chart'] = $chartInfo;//订单数图表数据
|
||||
$data['time'] = $afterNumber;//时间区间订单数
|
||||
$increase = $afterNumber - $frontNumber; //同比上个时间区间增长订单数
|
||||
$growthRate = abs($increase);
|
||||
if ($growthRate == 0) $data['growth_rate'] = 0;
|
||||
else if ($frontNumber == 0) $data['growth_rate'] = bcmul($growthRate, 100, 0);
|
||||
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontNumber, 2), '100', 0);//时间区间增长率
|
||||
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
|
||||
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function getFormData($merId)
|
||||
{
|
||||
$config = [
|
||||
'mer_from_com',
|
||||
'mer_from_name',
|
||||
'mer_from_tel',
|
||||
'mer_from_addr',
|
||||
'mer_config_siid',
|
||||
'mer_config_temp_id'
|
||||
];
|
||||
$data = merchantConfig($merId,$config);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function getDeliveryConfig()
|
||||
{
|
||||
$data = systemConfig(['crmeb_serve_dump','delivery_status']);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function getDeliveryOptions($merId, DeliveryStationRepository $repository)
|
||||
{
|
||||
if (!systemConfig('delivery_status')) {
|
||||
return app('json')->success([]);
|
||||
}
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'mer_id' => $merId,
|
||||
'type' => systemConfig('delivery_type'),
|
||||
];
|
||||
$data = $repository->getOptions($where)->toArray();
|
||||
$type = systemConfig('delivery_type') == 1 ? 'UU' : '达达';
|
||||
if (empty($data)) return app('json')->fail('请前往商户后台添加'.$type.'发货点');
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
public function verify($merId,$id,StoreOtherOrderCreateRepository $orderRepository)
|
||||
{
|
||||
$order = $orderRepository->getWhere(['order_id' => $id,'mer_id' => $merId]);
|
||||
if (!$order) return app('json')->fail('数据不存在');
|
||||
$data = $this->request->params(['verify_code','data']);
|
||||
$orderRepository->verifyOrder($order->verify_code, $merId, $data, $this->request->serviceInfo()->service_id);
|
||||
return app('json')->success('订单核销成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单结算
|
||||
* @return mixed
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
public function settle(StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$id = $this->request->param('id/d');
|
||||
$payType = $this->request->param('pay_type');
|
||||
if ($payType == 'creditBuy') {
|
||||
return app('json')->fail('支付方式不支持');
|
||||
}
|
||||
try {
|
||||
$data = $repository->settle($id, $payType, $this->request->userInfo());
|
||||
return app('json')->success('success', $data);
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认接单
|
||||
* @return mixed
|
||||
*/
|
||||
public function confirm(StoreOtherOrderCreateRepository $repository)
|
||||
{
|
||||
$id = $this->request->param('id/d');
|
||||
$type = $this->request->param('type/d');
|
||||
try {
|
||||
$repository->confirm($id, $type);
|
||||
return app('json')->success('success');
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购订单列表
|
||||
* @param $merId
|
||||
* @param StoreOtherOrderCreateRepository $orderRepository
|
||||
* @return \think\Collection
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function purchaseOrder($merId, StoreOtherOrderCreateRepository $orderRepository)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$keyword = $this->request->param('keyword');
|
||||
$list = $orderRepository->purchaseOrder(['mer_id' => $merId], $keyword, $page, $limit);
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
}
|
@ -389,9 +389,9 @@ class MerchantIntention extends BaseController
|
||||
* @Date: 2020/9/15
|
||||
* @return mixed
|
||||
*/
|
||||
public function cateLst()
|
||||
public function cateLst($type=0)
|
||||
{
|
||||
$lst = app()->make(MerchantCategoryRepository::class)->getSelect();
|
||||
$lst = app()->make(MerchantCategoryRepository::class)->getSelect(0,$type);
|
||||
return app('json')->success($lst);
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ class StoreCart extends BaseController
|
||||
* @Date: 2020/5/28
|
||||
* @return mixed
|
||||
*/
|
||||
public function lst($product_type=0)
|
||||
public function lst($product_type=0,$source=0)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
return app('json')->success($this->repository->getList($this->request->userInfo(),$product_type));
|
||||
return app('json')->success($this->repository->getList($this->request->userInfo(),$product_type,$source));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,14 +91,9 @@ class StoreCart extends BaseController
|
||||
case 0: //普通商品
|
||||
case 98: //供应链商品
|
||||
case 99: //委托商品
|
||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
||||
if($source==StoreCartDao::CITY_CLOUD||$source==StoreCartDao::SOURCE_PROCURE){
|
||||
$data['source'] = $source;
|
||||
}else{
|
||||
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
||||
if ($data['source'] > 0) $data['source_id'] = intval($sourceId);
|
||||
}
|
||||
$data['source'] = $source;
|
||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||
break;
|
||||
case 1: //秒杀商品
|
||||
$result = app()->make(ProductRepository::class)->cartSeckillCheck($data,$this->request->userInfo());
|
||||
@ -123,7 +118,6 @@ class StoreCart extends BaseController
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
unset($data['group_buying_id']);
|
||||
if ($cart = $result['cart']) {
|
||||
//更新购物车
|
||||
@ -196,9 +190,9 @@ class StoreCart extends BaseController
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
*/
|
||||
public function cartCount($product_type=0)
|
||||
public function cartCount($product_type=0,$source=0)
|
||||
{
|
||||
return app('json')->success($this->repository->getCartCount($this->request->uid(),$product_type));
|
||||
return app('json')->success($this->repository->getCartCount($this->request->uid(),$product_type,$source));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,12 +17,14 @@ namespace app\controller\api\store\order;
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\repositories\delivery\DeliveryOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
||||
use app\common\repositories\store\order\StoreOtherOrderCreateRepository;
|
||||
use app\common\repositories\store\order\StoreOrderReceiptRepository;
|
||||
use app\validate\api\UserReceiptValidate;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\common\repositories\store\order\StoreCartRepository;
|
||||
use app\common\repositories\store\order\StoreGroupOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOtherOrderRepository;
|
||||
use app\common\repositories\user\UserAddressRepository;
|
||||
use think\exception\ValidateException;
|
||||
use crmeb\services\ExpressService;
|
||||
@ -113,7 +115,7 @@ class StoreOrder extends BaseController
|
||||
$courierData = json_decode($response->getBody(), true);
|
||||
if (empty($courierData['code']) || $courierData['code'] != 1) {
|
||||
throw new ValidateException('该收货区域未设置快递员');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) {
|
||||
@ -146,7 +148,7 @@ class StoreOrder extends BaseController
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where['status'] = $this->request->param('status');
|
||||
$where['product_type'] = $this->request->param('product_type',0);
|
||||
$where['product_type'] = $this->request->param('product_type', 0);
|
||||
$where['search'] = $this->request->param('store_name');
|
||||
$where['uid'] = $this->request->uid();
|
||||
$where['is_user'] = 1;
|
||||
@ -283,7 +285,7 @@ class StoreOrder extends BaseController
|
||||
return app('json')->fail('订单不存在');
|
||||
if (!$order->delivery_type || !$order->delivery_id)
|
||||
return app('json')->fail('订单未发货');
|
||||
$express = $this->repository->express($id,null);
|
||||
$express = $this->repository->express($id, null);
|
||||
$order->append(['orderProduct']);
|
||||
return app('json')->success(compact('express', 'order'));
|
||||
}
|
||||
@ -318,7 +320,7 @@ class StoreOrder extends BaseController
|
||||
|
||||
public function createReceipt($id)
|
||||
{
|
||||
$data = $this->request->params(['receipt_type' , 'receipt_title' , 'duty_paragraph', 'receipt_title_type', 'bank_name', 'bank_code', 'address','tel', 'email']);
|
||||
$data = $this->request->params(['receipt_type', 'receipt_title', 'duty_paragraph', 'receipt_title_type', 'bank_name', 'bank_code', 'address', 'tel', 'email']);
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'uid' => $this->request->uid(), 'is_del' => 0]);
|
||||
if (!$order) return app('json')->fail('订单不属于您或不存在');
|
||||
app()->make(StoreOrderReceiptRepository::class)->add($data, $order);
|
||||
@ -330,5 +332,4 @@ class StoreOrder extends BaseController
|
||||
$res = $orderRepository->show($id, $this->request->uid());
|
||||
return app('json')->success($res);
|
||||
}
|
||||
|
||||
}
|
||||
|
305
app/controller/api/store/order/StoreOrderOther.php
Normal file
305
app/controller/api/store/order/StoreOrderOther.php
Normal file
@ -0,0 +1,305 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\controller\api\store\order;
|
||||
|
||||
|
||||
use app\common\model\store\order\StoreGroupOrder;
|
||||
use app\common\repositories\delivery\DeliveryOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
||||
use app\common\repositories\store\order\StoreOtherOrderCreateRepository;
|
||||
use app\common\repositories\store\order\StoreOrderReceiptRepository;
|
||||
use app\validate\api\UserReceiptValidate;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\common\repositories\store\order\StoreCartRepository;
|
||||
use app\common\repositories\store\order\StoreGroupOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOtherOrderRepository;
|
||||
use app\common\repositories\user\UserAddressRepository;
|
||||
use think\exception\ValidateException;
|
||||
use crmeb\services\ExpressService;
|
||||
use crmeb\services\LockService;
|
||||
use think\facade\Db;
|
||||
use think\App;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* Class StoreOrder
|
||||
* @package app\controller\api\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
class StoreOrderOther extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var StoreOrderRepository
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* StoreOrder constructor.
|
||||
* @param App $app
|
||||
* @param StoreOrderRepository $repository
|
||||
*/
|
||||
public function __construct(App $app, StoreOtherOrderRepository $repository)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function v2CheckOrder(StoreCartRepository $cartRepository, StoreOrderCreateRepository $orderCreateRepository)
|
||||
{
|
||||
$cartId = (array)$this->request->param('cart_id', []);
|
||||
$addressId = (int)$this->request->param('address_id');
|
||||
$couponIds = (array)$this->request->param('use_coupon', []);
|
||||
$takes = (array)$this->request->param('takes', []);
|
||||
$useIntegral = (bool)$this->request->param('use_integral', false);
|
||||
$user = $this->request->userInfo();
|
||||
$uid = $user->uid;
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
$orderInfo = $orderCreateRepository->v2CartIdByOrderInfo($user, $cartId, $takes, $couponIds, $useIntegral, $addressId);
|
||||
|
||||
return app('json')->success($orderInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 其他创建订单
|
||||
*/
|
||||
public function otherOrder(StoreOtherOrderCreateRepository $otherOrderCreateRepository)
|
||||
{
|
||||
$cartId = (array)$this->request->param('cart_id', []);
|
||||
$addressId = (int)$this->request->param('address_id');
|
||||
$couponIds = (array)$this->request->param('use_coupon', []);
|
||||
$takes = (array)$this->request->param('takes', []);
|
||||
$useIntegral = (bool)$this->request->param('use_integral', false);
|
||||
$receipt_data = (array)$this->request->param('receipt_data', []);
|
||||
$extend = (array)$this->request->param('extend', []);
|
||||
$mark = (array)$this->request->param('mark', []);
|
||||
$payType = $this->request->param('pay_type');
|
||||
$post = (array)$this->request->param('post');
|
||||
$data= $otherOrderCreateRepository->v2CreateOrder(
|
||||
$payType,
|
||||
$this->request->userInfo(),
|
||||
$cartId,
|
||||
$extend,
|
||||
$mark,
|
||||
$receipt_data,
|
||||
$takes,
|
||||
$couponIds,
|
||||
$useIntegral,
|
||||
$addressId,
|
||||
$post
|
||||
);
|
||||
if($data){
|
||||
return app('json')->success('创建成功', $data);
|
||||
}else{
|
||||
return app('json')->error('创建失败', $data);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function lst_other(StoreOtherOrderRepository $otherOrderRepository)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where['status'] = $this->request->param('status');
|
||||
$where['product_type'] = $this->request->param('product_type', 0);
|
||||
$where['search'] = $this->request->param('store_name');
|
||||
$where['uid'] = $this->request->uid();
|
||||
$where['is_user'] = 1;
|
||||
return app('json')->success($otherOrderRepository->getList($where, $page, $limit));
|
||||
}
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
$order = $this->repository->getDetail((int)$id, $this->request->uid());
|
||||
if (!$order)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($order->order_type == 1) {
|
||||
$order->append(['take', 'refund_status']);
|
||||
}
|
||||
return app('json')->success($order->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function number()
|
||||
{
|
||||
$productType = $this->request->param('product_type', 0);
|
||||
return app('json')->success($this->repository->userOrderNumber($this->request->uid(), $productType));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreGroupOrderRepository $groupOrderRepository
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function groupOrderList(StoreGroupOrderRepository $groupOrderRepository)
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$productType = $this->request->param('product_type', 0);
|
||||
$list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0, 'product_type' => $productType], $page, $limit);
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param StoreGroupOrderRepository $groupOrderRepository
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function groupOrderDetail($id, StoreGroupOrderRepository $groupOrderRepository)
|
||||
{
|
||||
$groupOrderRepository->getAll = true;
|
||||
$groupOrder = $groupOrderRepository->detail($this->request->uid(), (int)$id);
|
||||
if (!$groupOrder)
|
||||
return app('json')->fail('订单不存在');
|
||||
else
|
||||
return app('json')->success($groupOrder);
|
||||
}
|
||||
|
||||
public function groupOrderStatus($id, StoreGroupOrderRepository $groupOrderRepository)
|
||||
{
|
||||
$groupOrder = $groupOrderRepository->status($this->request->uid(), intval($id));
|
||||
if (!$groupOrder)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($groupOrder->paid) $groupOrder->append(['give_coupon']);
|
||||
$activity_type = 0;
|
||||
$activity_id = 0;
|
||||
foreach ($groupOrder->orderList as $order) {
|
||||
$activity_type = max($order->activity_type, $activity_type);
|
||||
if ($order->activity_type == 4 && $groupOrder->paid) {
|
||||
$order->append(['orderProduct']);
|
||||
$activity_id = $order->orderProduct[0]['activity_id'];
|
||||
}
|
||||
}
|
||||
$groupOrder->activity_type = $activity_type;
|
||||
$groupOrder->activity_id = $activity_id;
|
||||
return app('json')->success($groupOrder->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param StoreGroupOrderRepository $groupOrderRepository
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function cancelGroupOrder($id, StoreGroupOrderRepository $groupOrderRepository)
|
||||
{
|
||||
$groupOrderRepository->cancel((int)$id, $this->request->uid());
|
||||
return app('json')->success('取消成功');
|
||||
}
|
||||
|
||||
public function groupOrderPay($id, StoreGroupOrderRepository $groupOrderRepository)
|
||||
{
|
||||
//TODO 佣金结算,佣金退回,物流查询
|
||||
$type = $this->request->param('type');
|
||||
if (!in_array($type, StoreOtherOrderRepository::PAY_TYPE))
|
||||
return app('json')->fail('请选择正确的支付方式');
|
||||
$groupOrder = $groupOrderRepository->detail($this->request->uid(), (int)$id, false);
|
||||
if (!$groupOrder)
|
||||
return app('json')->fail('订单不存在或已支付');
|
||||
$this->repository->changePayType($groupOrder, array_search($type, StoreOtherOrderRepository::PAY_TYPE));
|
||||
if ($groupOrder['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && !$groupOrder->orderList[0]->allowCreditPay()) {
|
||||
return app('json')->fail('请等待商家确认订单');
|
||||
}
|
||||
if ($groupOrder['pay_price'] == 0) {
|
||||
$this->repository->paySuccess($groupOrder);
|
||||
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->repository->pay($type, $this->request->userInfo(), $groupOrder, $this->request->param('return_url'), $this->request->isApp());
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->status('error', $e->getMessage(), ['order_id' => $groupOrder->group_order_id]);
|
||||
}
|
||||
}
|
||||
|
||||
public function take($id)
|
||||
{
|
||||
$this->repository->takeOrder($id, $this->request->userInfo());
|
||||
return app('json')->success('确认收货成功');
|
||||
}
|
||||
|
||||
public function express($id)
|
||||
{
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'is_del' => 0]);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单不存在');
|
||||
if (!$order->delivery_type || !$order->delivery_id)
|
||||
return app('json')->fail('订单未发货');
|
||||
$express = $this->repository->express($id, null);
|
||||
$order->append(['orderProduct']);
|
||||
return app('json')->success(compact('express', 'order'));
|
||||
}
|
||||
|
||||
public function verifyCode($id)
|
||||
{
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'uid' => $this->request->uid(), 'is_del' => 0, 'order_type' => 1]);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单状态有误');
|
||||
return app('json')->success(['qrcode' => $this->repository->wxQrcode($id, $order->verify_code)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
*/
|
||||
public function logisticsCode($id)
|
||||
{
|
||||
$storeInfo = Db::name('store_service')->where('uid', $this->request->uid())->find();
|
||||
if (!$storeInfo)
|
||||
return app('json')->fail('商户信息有误');
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'mer_id' => $storeInfo['mer_id'], 'is_del' => 0]);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单状态有误');
|
||||
return app('json')->success(['qrcode' => $this->repository->logisticsQrcode($id, $order->order_sn)]);
|
||||
}
|
||||
|
||||
public function del($id)
|
||||
{
|
||||
$this->repository->userDel($id, $this->request->uid());
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
public function createReceipt($id)
|
||||
{
|
||||
$data = $this->request->params(['receipt_type', 'receipt_title', 'duty_paragraph', 'receipt_title_type', 'bank_name', 'bank_code', 'address', 'tel', 'email']);
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'uid' => $this->request->uid(), 'is_del' => 0]);
|
||||
if (!$order) return app('json')->fail('订单不属于您或不存在');
|
||||
app()->make(StoreOrderReceiptRepository::class)->add($data, $order);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
public function getOrderDelivery($id, DeliveryOrderRepository $orderRepository)
|
||||
{
|
||||
$res = $orderRepository->show($id, $this->request->uid());
|
||||
return app('json')->success($res);
|
||||
}
|
||||
}
|
@ -222,6 +222,7 @@ class StoreImport extends BaseController
|
||||
'K1'=>'成本价',
|
||||
'L1'=>'商品条码',
|
||||
'M1'=>'商品品牌',
|
||||
'N1'=>'库存',
|
||||
];
|
||||
$a=SpreadsheetExcelService::instance()->checkImport($path,$check,true);
|
||||
|
||||
@ -230,7 +231,9 @@ class StoreImport extends BaseController
|
||||
'data' => [
|
||||
'path' => $path,
|
||||
'sql' => ['store_name' => 'A', 'cate_id_one' => 'B', 'cate_id_two' => 'C', 'cate_id_one_mer' => 'D', 'cate_id_one_two' => 'E',
|
||||
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'procure_price' => 'I','price'=>'J','cost'=>'K','bar_code'=>'L','brand_id'=>'M'],
|
||||
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'procure_price' => 'I','price'=>'J','cost'=>'K','bar_code'=>'L','brand_id'=>'M'
|
||||
,'stock'=>'N',
|
||||
],
|
||||
'where' => ['store_name' => 'A'],
|
||||
]
|
||||
];
|
||||
@ -251,6 +254,7 @@ class StoreImport extends BaseController
|
||||
'J1'=>'成本价',
|
||||
'K1'=>'商品条码',
|
||||
'L1'=>'商品品牌',
|
||||
'M1'=>'库存',
|
||||
];
|
||||
SpreadsheetExcelService::instance()->checkImport($path,$check,true);
|
||||
$data = [
|
||||
@ -258,7 +262,7 @@ class StoreImport extends BaseController
|
||||
'data' => [
|
||||
'path' => $path,
|
||||
'sql' => ['store_name' => 'A', 'cate_id_one' => 'B', 'cate_id_two' => 'C', 'cate_id_one_mer' => 'D', 'cate_id_one_two' => 'E',
|
||||
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'price' => 'I','cost'=>'J','bar_code'=>'K','brand_id'=>'L'],
|
||||
'attr_one' => 'F', 'attr_two' => 'G', 'unit_name' => 'H', 'price' => 'I','cost'=>'J','bar_code'=>'K','brand_id'=>'L','stock'=>'M'],
|
||||
'where' => ['store_name' => 'A'],
|
||||
]
|
||||
];
|
||||
|
@ -18,7 +18,7 @@ class paySuccessMargin
|
||||
Db::startTrans();
|
||||
try {
|
||||
$order_sn = $event['order_sn'];
|
||||
$marginInfo = Db::name('margin_order')->where('order_sn', $order_sn)->find();
|
||||
$marginInfo = Db::name('margin_order')->where('order_sn', $order_sn)->where('paid',0)->find();
|
||||
if ($marginInfo) {
|
||||
Db::name('margin_order')->where('order_id', $marginInfo['order_id'])->update([
|
||||
'paid' => 1,
|
||||
@ -30,10 +30,7 @@ class paySuccessMargin
|
||||
//已支付的押金
|
||||
$paidMarginAmount = bcadd($merchantInfo['paid_margin'], $marginInfo['total_price'], 2);
|
||||
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->update([
|
||||
'paid_margin' => $paidMarginAmount,'ot_margin'=>$paidMarginAmount
|
||||
]);
|
||||
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'])->where('uid', $marginInfo['uid'])->update([
|
||||
'margin' => 0
|
||||
'paid_margin' => $paidMarginAmount,'ot_margin'=>$paidMarginAmount,'margin' => 0
|
||||
]);
|
||||
|
||||
if ($paidMarginAmount ==$merchant_type['margin']) {
|
||||
@ -44,10 +41,13 @@ class paySuccessMargin
|
||||
}
|
||||
// 提交事务
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Log::error('微信支付押金失败' . $e->getMessage());
|
||||
// 回滚事务
|
||||
Db::rollback();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ class SendSmsJob implements JobInterface
|
||||
try {
|
||||
/** @var JgPush $client */
|
||||
$client = app()->make(JgPush::class);
|
||||
Log::info('JgPush送发送数据:' . json_encode($data));
|
||||
$client->send($data['tempId'], $data);
|
||||
} catch (\Exception $e) {
|
||||
Log::info('JgPush推送消息发送失败' . json_encode($data) . ' - ' . $e->getMessage());
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
.title[data-v-3500ed7a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-3500ed7a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}[data-v-3cd1b9b0] .el-cascader{display:block}.dialog-scustom[data-v-3cd1b9b0]{width:1200px;height:600px}.ela-btn[data-v-3cd1b9b0]{color:#2d8cf0}.Box .ivu-radio-wrapper[data-v-3cd1b9b0]{margin-right:25px}.Box .numPut[data-v-3cd1b9b0]{width:80%!important}.lunBox[data-v-3cd1b9b0]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border:1px solid #0bb20c}.pictrueBox[data-v-3cd1b9b0]{display:inline-block}.pictrue[data-v-3cd1b9b0]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-3cd1b9b0]{width:100%;height:100%}.pictrueTab[data-v-3cd1b9b0]{width:40px!important;height:40px!important}.upLoad[data-v-3cd1b9b0]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.ft[data-v-3cd1b9b0]{color:red}.buttonGroup[data-v-3cd1b9b0]{position:relative;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.buttonGroup .small-btn[data-v-3cd1b9b0]{position:relative;float:left;height:24px;padding:0 7px;font-size:14px;border-radius:3px}.buttonGroup .small-btn[data-v-3cd1b9b0]:first-child{margin-left:0;border-bottom-right-radius:0;border-top-right-radius:0}.virtual_boder[data-v-3cd1b9b0]{border:1px solid #1890ff}.virtual_boder2[data-v-3cd1b9b0]{border:1px solid #e7e7e7}.virtual_san[data-v-3cd1b9b0]{position:absolute;bottom:0;right:0;width:0;height:0;border-bottom:26px solid #1890ff;border-left:26px solid transparent}.virtual_dui[data-v-3cd1b9b0]{position:absolute;bottom:-2px;right:2px;color:#fff;font-family:system-ui}.virtual[data-v-3cd1b9b0]{width:120px;height:60px;background:#fff;border-radius:3px;float:left;text-align:center;padding-top:8px;position:relative;cursor:pointer;line-height:23px}.virtual .virtual_top[data-v-3cd1b9b0]{font-size:14px;font-weight:600;color:rgba(0,0,0,.85)}.virtual .virtual_bottom[data-v-3cd1b9b0]{font-size:12px;font-weight:400;color:#999}.virtual[data-v-3cd1b9b0]:nth-child(2n){margin:0 12px}[data-v-7d87bc0d] .el-cascader{display:block}.ela-btn[data-v-7d87bc0d]{color:#2d8cf0}.priceBox[data-v-7d87bc0d]{width:80px}.pictrue[data-v-7d87bc0d]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-7d87bc0d]{width:100%;height:100%}[data-v-7d87bc0d] .el-input-number__decrease,[data-v-7d87bc0d] .el-input-number__increase{display:none}[data-v-7d87bc0d] .el-input-number.is-controls-right .el-input__inner,[data-v-7d87bc0d] .el-input__inner{padding:0 5px}.pictrueTab[data-v-7d87bc0d]{width:40px!important;height:40px!important}.upLoad[data-v-7d87bc0d]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.bg[data-v-489f9ada]{z-index:100;position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5)}.goods_detail .goods_detail_wrapper[data-v-489f9ada]{z-index:-10}[data-v-489f9ada] table.el-input__inner{padding:0}.demo-table-expand[data-v-489f9ada]{font-size:0}.demo-table-expand1[data-v-489f9ada] label{width:77px!important;color:#99a9bf}.demo-table-expand .el-form-item[data-v-489f9ada]{margin-right:0;margin-bottom:0;width:33.33%}.selWidth[data-v-489f9ada]{width:350px!important}.seachTiele[data-v-489f9ada]{line-height:35px}
|
||||
.title[data-v-3500ed7a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-3500ed7a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}[data-v-3cd1b9b0] .el-cascader{display:block}.dialog-scustom[data-v-3cd1b9b0]{width:1200px;height:600px}.ela-btn[data-v-3cd1b9b0]{color:#2d8cf0}.Box .ivu-radio-wrapper[data-v-3cd1b9b0]{margin-right:25px}.Box .numPut[data-v-3cd1b9b0]{width:80%!important}.lunBox[data-v-3cd1b9b0]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border:1px solid #0bb20c}.pictrueBox[data-v-3cd1b9b0]{display:inline-block}.pictrue[data-v-3cd1b9b0]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-3cd1b9b0]{width:100%;height:100%}.pictrueTab[data-v-3cd1b9b0]{width:40px!important;height:40px!important}.upLoad[data-v-3cd1b9b0]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.ft[data-v-3cd1b9b0]{color:red}.buttonGroup[data-v-3cd1b9b0]{position:relative;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.buttonGroup .small-btn[data-v-3cd1b9b0]{position:relative;float:left;height:24px;padding:0 7px;font-size:14px;border-radius:3px}.buttonGroup .small-btn[data-v-3cd1b9b0]:first-child{margin-left:0;border-bottom-right-radius:0;border-top-right-radius:0}.virtual_boder[data-v-3cd1b9b0]{border:1px solid #1890ff}.virtual_boder2[data-v-3cd1b9b0]{border:1px solid #e7e7e7}.virtual_san[data-v-3cd1b9b0]{position:absolute;bottom:0;right:0;width:0;height:0;border-bottom:26px solid #1890ff;border-left:26px solid transparent}.virtual_dui[data-v-3cd1b9b0]{position:absolute;bottom:-2px;right:2px;color:#fff;font-family:system-ui}.virtual[data-v-3cd1b9b0]{width:120px;height:60px;background:#fff;border-radius:3px;float:left;text-align:center;padding-top:8px;position:relative;cursor:pointer;line-height:23px}.virtual .virtual_top[data-v-3cd1b9b0]{font-size:14px;font-weight:600;color:rgba(0,0,0,.85)}.virtual .virtual_bottom[data-v-3cd1b9b0]{font-size:12px;font-weight:400;color:#999}.virtual[data-v-3cd1b9b0]:nth-child(2n){margin:0 12px}[data-v-7d87bc0d] .el-cascader{display:block}.ela-btn[data-v-7d87bc0d]{color:#2d8cf0}.priceBox[data-v-7d87bc0d]{width:80px}.pictrue[data-v-7d87bc0d]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-7d87bc0d]{width:100%;height:100%}[data-v-7d87bc0d] .el-input-number__decrease,[data-v-7d87bc0d] .el-input-number__increase{display:none}[data-v-7d87bc0d] .el-input-number.is-controls-right .el-input__inner,[data-v-7d87bc0d] .el-input__inner{padding:0 5px}.pictrueTab[data-v-7d87bc0d]{width:40px!important;height:40px!important}.upLoad[data-v-7d87bc0d]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.bg[data-v-82d6320e]{z-index:100;position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5)}.goods_detail .goods_detail_wrapper[data-v-82d6320e]{z-index:-10}[data-v-82d6320e] table.el-input__inner{padding:0}.demo-table-expand[data-v-82d6320e]{font-size:0}.demo-table-expand1[data-v-82d6320e] label{width:77px!important;color:#99a9bf}.demo-table-expand .el-form-item[data-v-82d6320e]{margin-right:0;margin-bottom:0;width:33.33%}.selWidth[data-v-82d6320e]{width:350px!important}.seachTiele[data-v-82d6320e]{line-height:35px}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-6f9bbde8.530b410a.js
Normal file
1
public/mer/js/chunk-6f9bbde8.530b410a.js
Normal file
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-eab0bfaa.df48c41f.js
Normal file
1
public/mer/js/chunk-eab0bfaa.df48c41f.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
[data-v-51cf4d0a] .el-dialog__title{font-weight:700}.selWidth[data-v-51cf4d0a]{width:300px}.el-dropdown-link[data-v-51cf4d0a]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-51cf4d0a]{font-size:12px}.tabBox_tit[data-v-51cf4d0a]{width:60%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.pictrue[data-v-51cf4d0a]{width:60px;height:60px;border:1px dotted rgba(0,0,0,.1);margin-right:10px;position:relative;cursor:pointer}.pictrue img[data-v-51cf4d0a]{width:100%;height:100%}.btndel[data-v-51cf4d0a]{position:absolute;z-index:1;width:20px!important;height:20px!important;left:46px;top:-4px}.box-container[data-v-51cf4d0a]{overflow:hidden;padding:0 10px}.box-container .title[data-v-51cf4d0a]{margin:15px 0 10px;color:#333;font-weight:700;border-bottom:1px solid #dfe6ec}.box-container .list[data-v-51cf4d0a]{float:left;line-height:40px}.box-container .list .info[data-v-51cf4d0a]{display:block}.box-container .list .info .el-textarea[data-v-51cf4d0a]{margin-top:10px}.box-container .list.image[data-v-51cf4d0a]{margin:20px 0;position:relative}.box-container .list.image img[data-v-51cf4d0a]{position:absolute;top:-20px}.box-container .sp[data-v-51cf4d0a]{width:50%}.box-container .sp3[data-v-51cf4d0a]{width:33.3333%}.box-container .sp100[data-v-51cf4d0a]{width:100%}.box-container .list .name[data-v-51cf4d0a]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:inline-block;color:#606266;text-align:right}.acea-row[data-v-51cf4d0a]{margin-bottom:25px}.pictures[data-v-51cf4d0a]{width:100%;max-width:100%}
|
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