From 01dd8a1480aff74c665dd8115e4ed5dffc3be2d9 Mon Sep 17 00:00:00 2001
From: devil
@@ -36,10 +36,10 @@ {{/if}}
- {{if $data['status'] GT 1}}{{else /}}2{{/if}} + {{if $data['status'] gt 1}}{{else /}}2{{/if}}
付款
@@ -48,10 +48,10 @@ {{/if}}- {{if $data['status'] GT 2}}{{else /}}3{{/if}} + {{if $data['status'] gt 2}}{{else /}}3{{/if}}
卖家发货
@@ -60,10 +60,10 @@ {{/if}}- {{if $data['status'] GT 3}}{{else /}}4{{/if}} + {{if $data['status'] gt 3}}{{else /}}4{{/if}}
确认收货
@@ -72,10 +72,10 @@ {{/if}}- {{if $data['user_is_comments'] GT 0}}{{else /}}5{{/if}} + {{if $data['user_is_comments'] gt 0}}{{else /}}5{{/if}}
评价
@@ -118,7 +118,18 @@ {{if !empty($data.payment_name)}}{{$order.is_under_line_text}}
+ {{/if}} diff --git a/application/service/BuyService.php b/application/service/BuyService.php index cb2268b7f..b9c36eb2c 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -15,6 +15,7 @@ use think\facade\Hook; use app\service\GoodsService; use app\service\UserService; use app\service\ResourcesService; +use app\service\PaymentService; use app\service\ConfigService; /** @@ -924,6 +925,20 @@ class BuyService } } + // 支付方式 + $payment_id = 0; + $is_under_line = 0; + if(!empty($params['payment_id'])) + { + $payment = PaymentService::PaymentList(['where'=>['id'=>intval($params['payment_id'])]]); + if(empty($payment[0])) + { + return DataReturn('支付方式有误', -1); + } + $payment_id = $payment[0]['id']; + $is_under_line = in_array($payment[0]['payment'], config('shopxo.under_line_list')) ? 1 : 0; + } + // 订单主信息 $order = [ 'order_no' => date('YmdHis').GetNumberCode(6), @@ -935,10 +950,11 @@ class BuyService 'price' => ($buy['data']['base']['total_price'] <= 0.00) ? 0.00 : $buy['data']['base']['total_price'], 'total_price' => ($buy['data']['base']['actual_price'] <= 0.00) ? 0.00 : $buy['data']['base']['actual_price'], 'extension_data' => empty($buy['data']['extension_data']) ? '' : json_encode($buy['data']['extension_data']), - 'payment_id' => isset($params['payment_id']) ? intval($params['payment_id']) : 0, + 'payment_id' => $payment_id, 'buy_number_count' => array_sum(array_column($buy['data']['goods'], 'stock')), 'client_type' => (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE, 'order_model' => $site_model, + 'is_under_line' => $is_under_line, 'add_time' => time(), ]; if($order['status'] == 1) diff --git a/application/service/OrderService.php b/application/service/OrderService.php index dd868a545..df7b0d0af 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -87,22 +87,25 @@ class OrderService return DataReturn('支付方式有误', -1); } - // 更新订单支付方式 + // 更新订单支付方式信息 if(!empty($params['payment_id']) && $params['payment_id'] != $order['payment_id']) { - Db::name('Order')->where(['id'=>$order['id']])->update(['payment_id'=>$payment_id, 'upd_time'=>time()]); + Db::name('Order')->where(['id'=>$order['id']])->update([ + 'payment_id' => $payment_id, + 'is_under_line' => in_array($payment[0]['payment'], config('shopxo.under_line_list')) ? 1 : 0, + 'upd_time' => time(), + ]); } - // 金额为0直接支付成功 + // 金额为0、走直接支付成功 if($order['total_price'] <= 0.00) { - // 非线上支付处理 $params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view']; - $pay_result = self::OrderPaymentUnderLine([ + $pay_result = self::OrderDirectSuccess([ 'order' => $order, 'payment' => $payment[0], 'user' => $params['user'], - 'subject' => $params, + 'params' => $params, ]); if($pay_result['code'] == 0) { @@ -190,7 +193,7 @@ class OrderService $ret = (new $pay_name($payment[0]['config']))->Pay($pay_data); if(isset($ret['code']) && $ret['code'] == 0) { - // 非线上支付处理 + // 线下支付处理 if(in_array($payment[0]['payment'], config('shopxo.under_line_list'))) { $params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view']; @@ -203,18 +206,32 @@ class OrderService if($pay_result['code'] != 0) { return $pay_result; + } else { + $ret['msg'] = $pay_result['msg']; } } // 支付信息返回 $ret['data'] = [ - // 是否为在线支付类型 - 'is_online_pay' => ($payment[0]['payment'] == 'WalletPay' || in_array($payment[0]['payment'], config('shopxo.under_line_list'))) ? 0 : 1, + // 支付类型(0正常线上支付、1线下支付、2钱包支付) + 'is_payment_type' => 0, // 支付模块处理数据 - 'data' => $ret['data'], + 'data' => $ret['data'], ]; + // 是否线下支付 + if(in_array($payment[0]['payment'], config('shopxo.under_line_list'))) + { + $ret['data']['is_payment_type'] = 1; + } else { + // 是否钱包支付 + if($payment[0]['payment'] == 'WalletPay') + { + $ret['data']['is_payment_type'] = 2; + } + } + return $ret; } return DataReturn(empty($ret['msg']) ? '支付接口异常' : $ret['msg'], -1); @@ -278,28 +295,29 @@ class OrderService return DataReturn('支付方式有误', -1); } - // 非线上支付处理 - return self::OrderPaymentUnderLine([ + // 线下支付处理 + return self::OrderPaymentUnderLineSuccess([ 'order' => $order, 'payment' => $payment[0], 'user' => $params['user'], - 'subject' => $params, + 'params' => $params, ]); } /** - * [OrderPaymentUnderLine 线下支付处理] - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2018-10-05T22:40:57+0800 + * 订单金额为小于等于0直接成功 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-04-07 + * @desc description * @param [array] $params [输入参数] */ - private static function OrderPaymentUnderLine($params = []) + private static function OrderDirectSuccess($params = []) { if(!empty($params['order']) && !empty($params['payment']) && !empty($params['user'])) { - if(in_array($params['payment']['payment'], config('shopxo.under_line_list')) || $params['order']['total_price'] <= 0.00) + if($params['order']['total_price'] <= 0.00) { // 支付处理 $pay_params = [ @@ -313,11 +331,64 @@ class OrderService ], ]; return self::OrderPayHandle($pay_params); - } else { - return DataReturn('仅线下支付方式处理', -1); } + return DataReturn('订单金额有误、请正常发起支付', -1); } - return DataReturn('无需处理', 0); + return DataReturn('支付传参有误', -1); + } + + /** + * 线下支付方式、直接支付成功 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-04-07 + * @desc description + * @param [array] $params [输入参数] + */ + private static function OrderPaymentUnderLineSuccess($params = []) + { + if(!empty($params['order']) && !empty($params['payment']) && !empty($params['user'])) + { + if(in_array($params['payment']['payment'], config('shopxo.under_line_list'))) + { + // 支付处理 + $pay_params = [ + 'order' => $params['order'], + 'payment' => $params['payment'], + 'pay' => [ + 'trade_no' => '', + 'subject' => isset($params['params']['subject']) ? $params['params']['subject'] : '订单支付', + 'buyer_user' => $params['user']['user_name_view'], + 'pay_price' => $params['order']['total_price'], + ], + ]; + return self::OrderPayHandle($pay_params); + } + return DataReturn('仅线下支付方式处理', -1); + } + return DataReturn('支付传参有误', -1); + } + + /** + * 线下支付处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-10-05T22:40:57+0800 + * @param [array] $params [输入参数] + */ + private static function OrderPaymentUnderLine($params = []) + { + if(!empty($params['order']) && !empty($params['payment']) && !empty($params['user'])) + { + if(in_array($params['payment']['payment'], config('shopxo.under_line_list'))) + { + return DataReturn('提交成功、待管理员确认', 0); + } + return DataReturn('仅线下支付方式处理', -1); + } + return DataReturn('支付传参有误', -1); } /** @@ -370,8 +441,8 @@ class OrderService $where = ['order_no'=>$ret['data']['out_trade_no'], 'is_delete_time'=>0, 'user_is_delete_time'=>0]; $order = Db::name('Order')->where($where)->find(); - // 非线上支付处理 - self::OrderPaymentUnderLine([ + // 线下支付方式处理 + return self::OrderPaymentUnderLine([ 'order' => $order, 'payment' => $payment[0], 'user' => $params['user'], @@ -506,15 +577,20 @@ class OrderService $detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元'; MessageService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']); - // 更新订单状态 - $upd_data = array( + // 订单更新数据 + $upd_data = [ 'status' => 2, 'pay_status' => 1, 'pay_price' => $pay_price, 'payment_id' => $params['payment']['id'], 'pay_time' => time(), 'upd_time' => time(), - ); + ]; + + // 是否线下支付 + $upd_data['is_under_line'] = in_array($params['payment']['payment'], config('shopxo.under_line_list')) ? 1 : 0; + + // 更新订单状态 if(Db::name('Order')->where(['id'=>$params['order']['id']])->update($upd_data)) { // 添加状态日志 @@ -807,7 +883,10 @@ class OrderService $v['express_name'] = ExpressService::ExpressName($v['express_id']); // 支付方式 - $v['payment_name'] = ($v['status'] <= 1) ? null : PaymentService::OrderPaymentName($v['id']); + $v['payment_name'] = PaymentService::OrderPaymentName($v['id'], $v['payment_id']); + + // 线下支付 icon 名称 + $v['is_under_line_text'] = ($v['is_under_line'] == 1) ? '线下支付' : null; // 创建时间 $v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']); @@ -918,7 +997,7 @@ class OrderService } } - return DataReturn('处理成功', 0, $data); + return DataReturn('success', 0, $data); } /** @@ -1659,7 +1738,7 @@ class OrderService ]; } - return DataReturn('处理成功', 0, $result); + return DataReturn('success', 0, $result); } /** diff --git a/application/service/PaymentService.php b/application/service/PaymentService.php index 7b946c4df..3b584de59 100755 --- a/application/service/PaymentService.php +++ b/application/service/PaymentService.php @@ -237,11 +237,21 @@ class PaymentService * @version 1.0.0 * @date 2018-09-19 * @desc description - * @param [int] $order_id [订单id] + * @param [int] $order_id [订单id] + * @param [int] $payment_id [支付方式id] */ - public static function OrderPaymentName($order_id = 0) + public static function OrderPaymentName($order_id = 0, $payment_id = 0) { - return empty($order_id) ? null : Db::name('PayLog')->where(['order_id'=>intval($order_id)])->value('payment_name'); + $name = null; + if(!empty($order_id)) + { + $name = Db::name('PayLog')->where(['order_id'=>intval($order_id)])->value('payment_name'); + if(empty($anme) && !empty($payment_id)) + { + $name = Db::name('Payment')->where(['id'=>intval($payment_id)])->value('name'); + } + } + return $name; } /** diff --git a/application/service/ToutiaoService.php b/application/service/ToutiaoService.php index bf10fbfc8..b76e71c04 100644 --- a/application/service/ToutiaoService.php +++ b/application/service/ToutiaoService.php @@ -44,7 +44,7 @@ class ToutiaoService // 线上支付信息处理 $order_info = []; $service = 0; - if($ret['data']['is_online_pay'] == 1) + if($ret['data']['is_payment_type'] == 0) { // 配置信息 $merchant_id = MyC('common_app_mini_toutiao_pay_merchant_id'); @@ -108,9 +108,9 @@ class ToutiaoService // 返回数据 $result = [ - 'order_info' => $order_info, - 'service' => $service, - 'is_online_pay' => $ret['data']['is_online_pay'], + 'order_info' => $order_info, + 'service' => $service, + 'is_payment_type' => $ret['data']['is_payment_type'], ]; return DataReturn('success', 0, $result); } diff --git a/application/tags.php b/application/tags.php index 723880330..417ea5f33 100755 --- a/application/tags.php +++ b/application/tags.php @@ -115,7 +115,6 @@ return array ( 0 => 'app\\plugins\\excellentbuyreturntocash\\Hook', 1 => 'app\\plugins\\coupon\\Hook', 2 => 'app\\plugins\\distribution\\Hook', - 3 => 'app\\plugins\\neworderemail\\Hook', ), 'plugins_view_goods_detail_panel_bottom' => array ( diff --git a/config/shopxo.php b/config/shopxo.php index b284354fd..2bd9a4109 100755 --- a/config/shopxo.php +++ b/config/shopxo.php @@ -15,7 +15,7 @@ return [ // 开发模式 - 'is_develop' => true, + 'is_develop' => false, // 默认编码 'default_charset' => 'utf-8', diff --git a/sourcecode/alipay/app.js b/sourcecode/alipay/app.js index 694225d6c..01e5d6f07 100644 --- a/sourcecode/alipay/app.js +++ b/sourcecode/alipay/app.js @@ -67,7 +67,7 @@ App({ // 请求地址 request_url: "{{request_url}}", - // request_url: 'http://shopxo.com/', + request_url: 'http://shopxo.com/', // request_url: 'http://dev.shopxo.net/', // 基础信息 @@ -658,6 +658,60 @@ App({ } }, + /** + * alert确认框 + * title [string] 标题(默认空) + * msg [string] 提示信息,必传 + * is_show_cancel [int] 是否显示取消按钮(默认显示 0否, 1|undefined是) + * cancel_text [string] 取消按钮文字(默认 取消) + * cancel_color [string] 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000) + * confirm_text [string] 确认按钮文字(默认 确认) + * confirm_color [string] 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000) + * object [boject] 回调操作对象,点击确认回调参数1,取消回调0 + * method [string] 回调操作对象的函数 + */ + alert(e) + { + var msg = e.msg || null; + if (msg != null) + { + var title = e.title || ''; + var is_show_cancel = (e.is_show_cancel == 0) ? false : true; + var cancel_text = e.cancel_text || '取消'; + var confirm_text = e.confirm_text || '确认'; + var cancel_color = e.cancel_color || ''; + var confirm_color = e.confirm_color || ''; + + if(is_show_cancel) + { + my.confirm({ + title: title, + content: msg, + confirmButtonText: confirm_text, + cancelButtonText: cancel_text, + success: (res) => { + if ((e.object || null) != null && typeof e.object === 'object' && (e.method || null) != null) { + e.object[e.method](res.confirm ? 1 : 0); + } + }, + }); + } else { + my.alert({ + title: title, + content: msg, + buttonText: confirm_text, + success: (res) => { + if ((e.object || null) != null && typeof e.object === 'object' && (e.method || null) != null) { + e.object[e.method](1); + } + } + }); + } + } else { + self.showToast('提示信息为空 alert'); + } + }, + // 拨打电话 call_tel(value) { if ((value || null) != null) { diff --git a/sourcecode/alipay/app.json b/sourcecode/alipay/app.json index 9c49c49b2..2adac9a16 100644 --- a/sourcecode/alipay/app.json +++ b/sourcecode/alipay/app.json @@ -65,7 +65,7 @@ "pages/plugins/wallet/user-cash-detail/user-cash-detail" ], "window": { - "defaultTitle": "{{application_title}}", + "defaultTitle": "shopxo", "titleBarColor": "#d2364c", "backgroundColor": "#f5f5f5" }, diff --git a/sourcecode/alipay/pages/user-order-detail/user-order-detail.js b/sourcecode/alipay/pages/user-order-detail/user-order-detail.js index 5e18a0082..c0198a1eb 100644 --- a/sourcecode/alipay/pages/user-order-detail/user-order-detail.js +++ b/sourcecode/alipay/pages/user-order-detail/user-order-detail.js @@ -56,7 +56,7 @@ Page({ {name: "优惠金额", value: data.data.preferential_price || ''}, {name: "增加金额", value: data.data.increase_price || '' }, {name: "支付金额", value: data.data.pay_price || ''}, - {name: "支付方式", value: data.data.payment_name || ''}, + {name: "支付方式", value: (data.data.payment_name || '') + ((data.data.is_under_line_text || null) == null ? '' : '(' + data.data.is_under_line_text +')')}, {name: "快递公司", value: data.data.express_name || ''}, {name: "快递单号", value: data.data.express_number || ''}, {name: "用户留言", value: data.data.user_note || ''}, diff --git a/sourcecode/alipay/pages/user-order/user-order.axml b/sourcecode/alipay/pages/user-order/user-order.axml index dd18867ec..89bc4f90e 100644 --- a/sourcecode/alipay/pages/user-order/user-order.axml +++ b/sourcecode/alipay/pages/user-order/user-order.axml @@ -12,7 +12,9 @@