diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 6aa9803f8..e550d4851 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -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); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 89e3a7546..a9cdc2be2 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -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()); + } } diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index f64814803..e16f45c1e 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -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) diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index 1df54d420..3eebf5b0b 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -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', ];