|
|
@@ -347,27 +347,27 @@ class StoreOrder extends BaseModel
|
|
|
}
|
|
|
}
|
|
|
//使用优惠劵
|
|
|
- $res1 = true;
|
|
|
- if ($couponId) {
|
|
|
- $couponInfo = StoreCouponUser::validAddressWhere()->where('id', $couponId)->where('uid', $uid)->find();
|
|
|
- if (!$couponInfo) return self::setErrorInfo('选择的优惠劵无效!', true);
|
|
|
- $coupons = StoreCouponUser::getUsableCouponList($uid, ['valid' => $cartInfo], $payPrice);
|
|
|
- $flag = false;
|
|
|
- foreach ($coupons as $coupon) {
|
|
|
- if ($coupon['id'] == $couponId) {
|
|
|
- $flag = true;
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!$flag)
|
|
|
- return self::setErrorInfo('不满足优惠劵的使用条件!', true);
|
|
|
- $payPrice = (float)bcsub($payPrice, $couponInfo['coupon_price'], 2);
|
|
|
- $res1 = StoreCouponUser::useCoupon($couponId);
|
|
|
- $couponPrice = $couponInfo['coupon_price'];
|
|
|
- } else {
|
|
|
- $couponId = 0;
|
|
|
- $couponPrice = 0;
|
|
|
- }
|
|
|
+// $res1 = true;
|
|
|
+// if ($couponId) {
|
|
|
+// $couponInfo = StoreCouponUser::validAddressWhere()->where('id', $couponId)->where('uid', $uid)->find();
|
|
|
+// if (!$couponInfo) return self::setErrorInfo('选择的优惠劵无效!', true);
|
|
|
+// $coupons = StoreCouponUser::getUsableCouponList($uid, ['valid' => $cartInfo], $payPrice);
|
|
|
+// $flag = false;
|
|
|
+// foreach ($coupons as $coupon) {
|
|
|
+// if ($coupon['id'] == $couponId) {
|
|
|
+// $flag = true;
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!$flag)
|
|
|
+// return self::setErrorInfo('不满足优惠劵的使用条件!', true);
|
|
|
+// $payPrice = (float)bcsub($payPrice, $couponInfo['coupon_price'], 2);
|
|
|
+// $res1 = StoreCouponUser::useCoupon($couponId);
|
|
|
+// $couponPrice = $couponInfo['coupon_price'];
|
|
|
+// } else {
|
|
|
+// $couponId = 0;
|
|
|
+// $couponPrice = 0;
|
|
|
+// }
|
|
|
if (!$res1) return self::setErrorInfo('使用优惠劵失败!', true);
|
|
|
|
|
|
//$shipping_type = 1 快递发货 $shipping_type = 2 门店自提
|