feat(StoreOrderLogic): 修改折扣率计算方式及退款方式

This commit is contained in:
mkm 2024-06-08 15:19:56 +08:00
parent d26d9c97d4
commit ee66715667
4 changed files with 21 additions and 12 deletions

View File

@ -81,7 +81,7 @@ class StoreOrderLogic extends BaseLogic
$pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2);
} else {
$discountRate = bcdiv(1, '100', 2);
$discountRate = bcdiv(100, '100', 2);
$pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2);
}
if (!empty(self::$total) && !empty($pay_price)) {
@ -235,13 +235,6 @@ class StoreOrderLogic extends BaseLogic
'total' => $total,
'currency' => 'CNY',
],
// '_action' => 'jsapi', // jsapi 退款,默认
// '_action' => 'app', // app 退款
// '_action' => 'combine', // 合单退款
// '_action' => 'h5', // h5 退款
// '_action' => 'miniapp', // 小程序退款
// '_action' => 'native', // native 退款
];
$res = $wechat->wechat->refund($order);

View File

@ -2,7 +2,8 @@
namespace app\store\controller\store_order;
use app\api\logic\order\OrderLogic;
use app\api\validate\OrderValidate;
use app\store\lists\store_order\StoreOrderLists;
use app\common\controller\Definitions;
use app\common\enum\PayEnum;
@ -11,6 +12,7 @@ use app\common\logic\PayNotifyLogic;
use app\common\logic\SystemStoreStaffLogic;
use app\store\controller\BaseAdminController;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\model\store_order\StoreOrder;
use app\store\validate\store_order\StoreOrderValidate;
use hg\apidoc\annotation as ApiDoc;
use Webman\RedisQueue\Redis;
@ -173,4 +175,18 @@ class StoreOrderController extends BaseAdminController
return $this->fail(StoreOrderLogic::getError());
}
}
public function writeoff_order()
{
$params = (new OrderValidate())->post()->goCheck('check');
$count = StoreOrder::where('verify_code',$params['verify_code'])->count();
if(empty($count)){
return $this->fail('无该核销码请检查');
}
$res = OrderLogic::writeOff($params);
if ($res) {
return $this->success('核销成功');
}
return $this->fail('核销失败'.OrderLogic::getError());
}
}

View File

@ -43,8 +43,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
*/
public function lists($where = []): array
{
$this->searchWhere[]=['staff_id'=>$this->adminId];
$this->searchWhere[]=['is_pay'=>0];
$this->searchWhere[]=['staff_id','=',$this->adminId];
$this->searchWhere[]=['is_pay','=',0];
$list = Cart::where($this->searchWhere)
->field('id,product_id,cart_num,store_id')
->limit($this->limitOffset, $this->limitLength)

View File

@ -27,7 +27,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
'=' => ['pay_type'],
'=' => ['pay_type','paid'],
'%like%' => ['order_id'],
'between_time' => 'create_time',
];