| | |
| | | use app\common\service\order\OrderRefundService; |
| | | use app\common\model\supplier\Balance as supplierBalanceModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | | |
| | | use app\common\model\payment\PaymentLog as PaymentLogModel; |
| | | /** |
| | | * 普通订单模型 |
| | | */ |
| | |
| | | foreach ($productList as &$item) { |
| | | // 商品单价 |
| | | $item['product_price'] = $item['product_sku']['product_price']; |
| | | $item['settlement_price'] = $item['product_sku']['settlement_price']; |
| | | // 商品购买数量 |
| | | $item['total_num'] = $params['product_num']; |
| | | $item['spec_sku_id'] = $item['product_sku']['spec_sku_id']; |
| | | // 商品购买总金额 |
| | | $item['total_price'] = helper::bcmul($item['product_price'], $params['product_num']); |
| | | // 商品总结算价 |
| | | $item['total_settlement_price'] = helper::bcmul($item['settlement_price'], $params['product_num']); |
| | | } |
| | | $supplierData[] = [ |
| | | 'shop_supplier_id' => $product['shop_supplier_id'], |
| | |
| | | public static function getUserOrderDetail($order_id, $user_id) |
| | | { |
| | | $model = new static(); |
| | | $order = $model->where(['order_id' => $order_id, 'user_id' => $user_id])->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find(); |
| | | $where = ['order_id' => $order_id, 'user_id' => $user_id]; |
| | | if(strlen($order_id)>=14){ //按照微信支付的 预下单填入的out_trade_no |
| | | $where = ['trade_no' => $order_id, 'user_id' => $user_id]; |
| | | $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find(); |
| | | if(!$order){ |
| | | $where = ['ins_order_sn' => $order_id, 'user_id' => $user_id]; |
| | | $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find(); |
| | | } |
| | | }else{ |
| | | $order = $model->where($where)->with(['product' => ['image', 'refund'], 'address', 'express', 'extractStore','extractClerk', 'supplier', 'advance'])->find(); |
| | | } |
| | | if (empty($order)) { |
| | | throw new BaseException(['msg' => '订单不存在']); |
| | | } |
| | |
| | | } else { |
| | | $orderInfo->save(['online_money' => $online_money]); |
| | | } |
| | | } |
| | | }$payment = new PaymentLogModel(); |
| | | $paylog_data = [ |
| | | 'app_id' => $orderInfo['app_id'], |
| | | 'order_no' => $order_no, |
| | | 'order_id' => $orderInfo['order_id'], |
| | | 'online_money' => $online_money, |
| | | 'order_source' => $orderInfo['order_source'] |
| | | ]; |
| | | $payment->savePaymentLog($paylog_data); |
| | | $online_money > 0 && $payment = self::onOrderPayment($user, $order_no, $payType, $params['pay_source'], $online_money, $multiple, $shop_supplier_id); |
| | | |
| | | $result['order_id'] = $params['order_id']; |