feat: 修正了购物车和订单列表中的代码错误,并优化了零售订单列表的验证码生成逻辑。
This commit is contained in:
parent
c834e81c28
commit
3f75281438
@ -65,23 +65,23 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
->toArray();
|
->toArray();
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$user_ship = User::where('id', $userId)->value('user_ship');
|
$user_ship = User::where('id', $userId)->value('user_ship');
|
||||||
$field='product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id';
|
$field = 'product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id';
|
||||||
if (in_array($user_ship, [4, 6, 7])) {
|
if (in_array($user_ship, [4, 6, 7])) {
|
||||||
$field='product_id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id';
|
$field = 'product_id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id';
|
||||||
}
|
}
|
||||||
$this->user_ship=$user_ship;
|
$this->user_ship = $user_ship;
|
||||||
$this->off_activity=$off_activity;
|
$this->off_activity = $off_activity;
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
|
||||||
->field($field)
|
->field($field)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->find();
|
->find();
|
||||||
if ($find) {
|
if ($find) {
|
||||||
if($off_activity==1){
|
if ($off_activity == 1) {
|
||||||
$this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2);
|
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
|
||||||
}
|
}
|
||||||
if ($off_activity == 0 && $user_ship == 5 && $find['top_cate_id'] == 15189) {
|
if ($off_activity == 0 && $user_ship == 5 && $find['top_cate_id'] == 15189) {
|
||||||
$find['price']=$find['cost'];
|
$find['price'] = $find['cost'];
|
||||||
}
|
}
|
||||||
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
||||||
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
||||||
@ -114,24 +114,28 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
|
|
||||||
public function extend()
|
public function extend()
|
||||||
{
|
{
|
||||||
$data= [
|
$data = [
|
||||||
'off_activity' => $this->off_activity,
|
'off_activity' => $this->off_activity,
|
||||||
'total_price' => $this->total_price,
|
'total_price' => $this->total_price,
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'pay_price' => $this->total_price
|
'pay_price' => $this->total_price
|
||||||
];
|
];
|
||||||
if($this->user_ship==0){
|
if ($this->user_ship == 0) {
|
||||||
$data['msg']='您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
|
if ($data['pay_price'] < 500) {
|
||||||
|
$data['msg'] = '还差' . bcsub(500, $this->activity_price, 2) . '即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
|
} else {
|
||||||
|
$data['msg'] = '您已选购满500元,支付成功后即可获得' . bcmul($this->activity_price, 0.1, 2) . '元品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
}
|
}
|
||||||
if($this->off_activity==1){//1
|
|
||||||
$data['pay_price']=$this->activity_price;
|
|
||||||
if($this->activity_price<500){
|
|
||||||
if($this->user_ship==0){
|
|
||||||
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
|
||||||
}
|
}
|
||||||
}else{
|
if ($this->off_activity == 1) { //1
|
||||||
if($this->user_ship==0){
|
$data['pay_price'] = $this->activity_price;
|
||||||
$data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
|
if ($data['pay_price'] < 500) {
|
||||||
|
if ($this->user_ship == 0) {
|
||||||
|
$data['msg'] = '还差' . bcsub(500, $this->activity_price, 2) . '即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($this->user_ship == 0) {
|
||||||
|
$data['msg'] = '您已选购满500元,支付成功后即可获得' . bcmul($this->activity_price, 0.1, 2) . '元品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ use app\common\model\store_order\StoreOrder;
|
|||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
|
use Picqer\Barcode\BarcodeGeneratorPNG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 零售订单列表
|
* 零售订单列表
|
||||||
@ -80,6 +81,11 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
if($item['verify_img']){
|
if($item['verify_img']){
|
||||||
$item['verify_img'] = 'https://'.$this->request->host(true).$item['verify_img'];
|
$item['verify_img'] = 'https://'.$this->request->host(true).$item['verify_img'];
|
||||||
}
|
}
|
||||||
|
if($item['is_writeoff']==0){
|
||||||
|
$generator = new BarcodeGeneratorPNG();
|
||||||
|
$tmpFilename = $generator->getBarcode($item['verify_code'], $generator::TYPE_CODE_128);
|
||||||
|
$item['verify_base64'] = base64_encode($tmpFilename);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
@ -506,6 +506,11 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($find['verify_img']) {
|
if ($find['verify_img']) {
|
||||||
$find['verify_img'] = $url . $find['verify_img'];
|
$find['verify_img'] = $url . $find['verify_img'];
|
||||||
}
|
}
|
||||||
|
if($find['is_writeoff']==0){
|
||||||
|
$generator = new BarcodeGeneratorPNG();
|
||||||
|
$tmpFilename = $generator->getBarcode($find['verify_code'], $generator::TYPE_CODE_128);
|
||||||
|
$find['verify_base64'] = base64_encode($tmpFilename);
|
||||||
|
}
|
||||||
//处理返回最近的店铺
|
//处理返回最近的店铺
|
||||||
if ($param['lat'] && $param['long']) {
|
if ($param['lat'] && $param['long']) {
|
||||||
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user