From 64dd28efe1d0fbb0a1fa76323973e1d60f5c2cf2 Mon Sep 17 00:00:00 2001 From: devil Date: Sat, 21 Nov 2020 19:58:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=94=AF=E4=BB=980?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E9=94=99=E8=AF=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/OrderService.php | 2 +- application/tags.php | 30 +++++ .../default/pages/user-order/user-order.js | 104 +++++++------- .../default/pages/user-order/user-order.js | 94 ++++++------- .../qq/default/pages/user-order/user-order.js | 124 ++++++++--------- .../default/pages/user-order/user-order.js | 127 +++++++++--------- sourcecode/weixin/default/app.js | 2 +- .../default/pages/user-order/user-order.js | 104 +++++++------- 8 files changed, 319 insertions(+), 268 deletions(-) diff --git a/application/service/OrderService.php b/application/service/OrderService.php index b26d3f34a..94e09fb69 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -171,7 +171,7 @@ class OrderService // 是否直接跳转 if($success_count > 0 && $success_count == count($order_data)) { - return DataReturn('支付成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0])]); + return DataReturn('支付成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0]), 'is_success'=>1]); } // 支付入口文件检查 diff --git a/application/tags.php b/application/tags.php index a80d92e8d..5df3a4fbe 100755 --- a/application/tags.php +++ b/application/tags.php @@ -37,11 +37,13 @@ return array ( 0 => 'app\\plugins\\ordergoodsform\\Hook', 1 => 'app\\plugins\\membershiplevelvip\\Hook', 2 => 'app\\plugins\\multilingual\\Hook', + 3 => 'app\\plugins\\coupon\\Hook', ), 'plugins_js' => array ( 0 => 'app\\plugins\\ordergoodsform\\Hook', 1 => 'app\\plugins\\multilingual\\Hook', + 2 => 'app\\plugins\\coupon\\Hook', ), 'plugins_view_goods_detail_base_inventory_top' => array ( @@ -67,6 +69,7 @@ return array ( array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', 1 => 'app\\plugins\\blog\\Hook', + 2 => 'app\\plugins\\coupon\\Hook', ), 'plugins_service_goods_handle_end' => array ( @@ -79,6 +82,7 @@ return array ( 'plugins_service_buy_group_goods_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', + 1 => 'app\\plugins\\coupon\\Hook', ), 'plugins_service_user_login_success_record' => array ( @@ -119,11 +123,13 @@ return array ( 'plugins_service_users_center_left_menu_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', + 1 => 'app\\plugins\\coupon\\Hook', ), 'plugins_service_header_navigation_top_right_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', 1 => 'app\\plugins\\multilingual\\Hook', + 2 => 'app\\plugins\\coupon\\Hook', ), 'plugins_common_page_bottom' => array ( @@ -145,5 +151,29 @@ return array ( array ( 0 => 'app\\plugins\\multilingual\\Hook', ), + 'plugins_view_goods_detail_panel_bottom' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), + 'plugins_view_buy_group_goods_inside_bottom' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), + 'plugins_view_buy_form_inside' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), + 'plugins_service_buy_order_insert_success' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), + 'plugins_service_order_status_change_history_success_handle' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), + 'plugins_service_user_register_end' => + array ( + 0 => 'app\\plugins\\coupon\\Hook', + ), ); ?> \ No newline at end of file diff --git a/sourcecode/alipay/default/pages/user-order/user-order.js b/sourcecode/alipay/default/pages/user-order/user-order.js index 874c2fac1..7dd2cfd70 100644 --- a/sourcecode/alipay/default/pages/user-order/user-order.js +++ b/sourcecode/alipay/default/pages/user-order/user-order.js @@ -233,9 +233,7 @@ Page({ // 支付方法 pay_handle(order_ids) { var self = this; - // 加载loding my.showLoading({ content: "请求中..." }); - my.request({ url: app.get_request_url("pay", "order"), method: "POST", @@ -248,57 +246,63 @@ Page({ success: res => { my.hideLoading(); if (res.data.code == 0) { - // 支付方式类型 - switch (res.data.data.is_payment_type) { - // 正常线上支付 - case 0 : - var data = res.data.data; - my.tradePay({ - tradeNO: data.data, - success: res => { - if (res.resultCode == 9000) { - // 数据设置 - self.order_item_pay_success_handle(order_ids); - - // 跳转支付页面 - my.navigateTo({ - url: - "/pages/paytips/paytips?code=9000" - }); - } else { - app.showToast('支付失败'); + // 是否直接支付成功 + if((res.data.data.is_success || 0) == 1) { + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + } else { + // 支付方式类型 + switch (res.data.data.is_payment_type) { + // 正常线上支付 + case 0 : + var data = res.data.data; + my.tradePay({ + tradeNO: data.data, + success: res => { + if (res.resultCode == 9000) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); + + // 跳转支付页面 + my.navigateTo({ + url: + "/pages/paytips/paytips?code=9000" + }); + } else { + app.showToast('支付失败'); + } + }, + fail: res => { + app.showToast('唤起支付模块失败'); } - }, - fail: res => { - app.showToast('唤起支付模块失败'); - } - }); - break; - - // 线下支付 - case 1 : - var order_ids_arr = order_ids.split(','); - var temp_data_list = self.data.data_list; - for(var i in temp_data_list) - { - if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + }); + break; + + // 线下支付 + case 1 : + var order_ids_arr = order_ids.split(','); + var temp_data_list = self.data.data_list; + for(var i in temp_data_list) { - temp_data_list[i]['is_under_line'] = 1; + if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + { + temp_data_list[i]['is_under_line'] = 1; + } } - } - self.setData({ data_list: temp_data_list }); - app.alert({ msg: res.data.msg, is_show_cancel: 0}); - break; - - // 钱包支付 - case 2 : - self.order_item_pay_success_handle(order_ids); - app.showToast('支付成功', 'success'); - break; - - // 默认 - default : - app.showToast('支付类型有误'); + self.setData({ data_list: temp_data_list }); + app.alert({ msg: res.data.msg, is_show_cancel: 0}); + break; + + // 钱包支付 + case 2 : + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + break; + + // 默认 + default : + app.showToast('支付类型有误'); + } } } else { app.showToast(res.data.msg); diff --git a/sourcecode/baidu/default/pages/user-order/user-order.js b/sourcecode/baidu/default/pages/user-order/user-order.js index 4b5899f97..6b9d93cab 100755 --- a/sourcecode/baidu/default/pages/user-order/user-order.js +++ b/sourcecode/baidu/default/pages/user-order/user-order.js @@ -229,9 +229,7 @@ Page({ // 支付方法 pay_handle(order_ids) { var self = this; - // 加载loding swan.showLoading({ title: "请求中..." }); - swan.request({ url: app.get_request_url("pay", "order"), method: "POST", @@ -243,50 +241,56 @@ Page({ success: res => { swan.hideLoading(); if (res.data.code == 0) { - // 支付方式类型 - switch (res.data.data.is_payment_type) { - // 正常线上支付 - case 0: - var data = res.data.data; - swan.requestPolymerPayment({ - orderInfo: data.data, - success: function (res) { - // 数据设置 - self.order_item_pay_success_handle(order_ids); - - // 跳转支付页面 - swan.navigateTo({ - url: "/pages/paytips/paytips?code=9000" - }); - }, - fail: function (res) { - app.showToast('支付失败'); - } - }); - break; - - // 线下支付 - case 1: - var order_ids_arr = order_ids.split(','); - var temp_data_list = self.data.data_list; - for (var i in temp_data_list) { - if (order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) { - temp_data_list[i]['is_under_line'] = 1; + // 是否直接支付成功 + if((res.data.data.is_success || 0) == 1) { + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + } else { + // 支付方式类型 + switch (res.data.data.is_payment_type) { + // 正常线上支付 + case 0: + var data = res.data.data; + swan.requestPolymerPayment({ + orderInfo: data.data, + success: function (res) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); + + // 跳转支付页面 + swan.navigateTo({ + url: "/pages/paytips/paytips?code=9000" + }); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + break; + + // 线下支付 + case 1: + var order_ids_arr = order_ids.split(','); + var temp_data_list = self.data.data_list; + for (var i in temp_data_list) { + if (order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) { + temp_data_list[i]['is_under_line'] = 1; + } } - } - self.setData({ data_list: temp_data_list }); - app.alert({ msg: res.data.msg, is_show_cancel: 0 }); - break; - - // 钱包支付 - case 2: - self.order_item_pay_success_handle(order_ids); - app.showToast('支付成功', 'success'); - break; - - // 默认 - default: - app.showToast('支付类型有误'); + self.setData({ data_list: temp_data_list }); + app.alert({ msg: res.data.msg, is_show_cancel: 0 }); + break; + + // 钱包支付 + case 2: + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + break; + + // 默认 + default: + app.showToast('支付类型有误'); + } } } else { app.showToast(res.data.msg); diff --git a/sourcecode/qq/default/pages/user-order/user-order.js b/sourcecode/qq/default/pages/user-order/user-order.js index d8e660e6e..bfcb06527 100755 --- a/sourcecode/qq/default/pages/user-order/user-order.js +++ b/sourcecode/qq/default/pages/user-order/user-order.js @@ -232,9 +232,7 @@ Page({ // 支付方法 pay_handle(order_ids) { var self = this; - // 加载loding qq.showLoading({title: "请求中..." }); - qq.request({ url: app.get_request_url("pay", "order"), method: "POST", @@ -246,67 +244,73 @@ Page({ success: res => { qq.hideLoading(); if (res.data.code == 0) { - // 支付方式类型 - switch (res.data.data.is_payment_type) { - // 正常线上支付 - case 0 : - var data = res.data.data; - // 是否微信支付 - if(data.payment.payment == 'Weixin') { - qq.requestWxPayment({ - url: data.data, - referer: app.data.request_url, - success: function(res) { - app.alert({msg: '支付成功后、请不要重复支付、如果订单状态未成功请联系客服处理', is_show_cancel: 0}); - self.get_data_list(); - }, - fail: function (res) { - app.showToast('支付失败'); - } - }); - } else { - qq.requestPayment({ - package: data.data, - success: function(res) { - // 数据设置 - self.order_item_pay_success_handle(order_ids); - - // 跳转支付页面 - qq.navigateTo({ - url: "/pages/paytips/paytips?code=9000" - }); - }, - fail: function (res) { - app.showToast('支付失败'); - } - }); - } - break; + // 是否直接支付成功 + if((res.data.data.is_success || 0) == 1) { + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + } else { + // 支付方式类型 + switch (res.data.data.is_payment_type) { + // 正常线上支付 + case 0 : + var data = res.data.data; + // 是否微信支付 + if(data.payment.payment == 'Weixin') { + qq.requestWxPayment({ + url: data.data, + referer: app.data.request_url, + success: function(res) { + app.alert({msg: '支付成功后、请不要重复支付、如果订单状态未成功请联系客服处理', is_show_cancel: 0}); + self.get_data_list(); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + } else { + qq.requestPayment({ + package: data.data, + success: function(res) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); + + // 跳转支付页面 + qq.navigateTo({ + url: "/pages/paytips/paytips?code=9000" + }); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + } + break; - // 线下支付 - case 1 : - var order_ids_arr = order_ids.split(','); - var temp_data_list = self.data.data_list; - for(var i in temp_data_list) - { - if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + // 线下支付 + case 1 : + var order_ids_arr = order_ids.split(','); + var temp_data_list = self.data.data_list; + for(var i in temp_data_list) { - temp_data_list[i]['is_under_line'] = 1; + if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + { + temp_data_list[i]['is_under_line'] = 1; + } } - } - self.setData({ data_list: temp_data_list }); - app.alert({ msg: res.data.msg, is_show_cancel: 0}); - break; - - // 钱包支付 - case 2 : - self.order_item_pay_success_handle(order_ids); - app.showToast('支付成功', 'success'); - break; - - // 默认 - default : - app.showToast('支付类型有误'); + self.setData({ data_list: temp_data_list }); + app.alert({ msg: res.data.msg, is_show_cancel: 0}); + break; + + // 钱包支付 + case 2 : + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + break; + + // 默认 + default : + app.showToast('支付类型有误'); + } } } else { app.showToast(res.data.msg); diff --git a/sourcecode/toutiao/default/pages/user-order/user-order.js b/sourcecode/toutiao/default/pages/user-order/user-order.js index f594a5a76..125978885 100755 --- a/sourcecode/toutiao/default/pages/user-order/user-order.js +++ b/sourcecode/toutiao/default/pages/user-order/user-order.js @@ -241,8 +241,7 @@ Page({ // 支付方法 pay_handle(order_ids) { - var self = this; // 加载loding - + var self = this; tt.showLoading({ title: "请求中..." }); @@ -256,72 +255,78 @@ Page({ dataType: "json", success: res => { tt.hideLoading(); - if (res.data.code == 0) { - // 支付方式类型 - switch (res.data.data.is_payment_type) { - // 正常线上支付 - case 0: - var data = res.data.data; - tt.pay({ - orderInfo: data.order_info, - service: data.service, - success(res) { - // if (res.code == 0) { - // // 数据设置 - // self.order_item_pay_success_handle(index); - - // // 跳转支付页面 - // tt.navigateTo({ - // url: "/pages/paytips/paytips?code=9000&total_price=" + - // self.data.data_list[index]['total_price'] - // }); - // } else { - // app.showToast('支付失败'); - // } - - // 由于头条支付无法监听支付状态,这里就不做接口轮询了,直接刷新页面 - self.setData({ - data_page: 1 - }); - self.get_data_list(1); - }, - fail(res) { - console.log(res, 'pay-fail'); - app.showToast('调起收银台失败-'+res.data.code); - } - }); - break; + // 是否直接支付成功 + if((res.data.data.is_success || 0) == 1) + { + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + } else { + // 支付方式类型 + switch (res.data.data.is_payment_type) { + // 正常线上支付 + case 0: + var data = res.data.data; + tt.pay({ + orderInfo: data.order_info, + service: data.service, + success(res) { + // if (res.code == 0) { + // // 数据设置 + // self.order_item_pay_success_handle(index); + + // // 跳转支付页面 + // tt.navigateTo({ + // url: "/pages/paytips/paytips?code=9000&total_price=" + + // self.data.data_list[index]['total_price'] + // }); + // } else { + // app.showToast('支付失败'); + // } + + // 由于头条支付无法监听支付状态,这里就不做接口轮询了,直接刷新页面 + self.setData({ + data_page: 1 + }); + self.get_data_list(1); + }, + fail(res) { + console.log(res, 'pay-fail'); + app.showToast('调起收银台失败-'+res.data.code); + } + }); + break; - // 线下支付 - case 1: - var order_ids_arr = order_ids.split(','); - var temp_data_list = self.data.data_list; + // 线下支付 + case 1: + var order_ids_arr = order_ids.split(','); + var temp_data_list = self.data.data_list; - for (var i in temp_data_list) { - if (order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) { - temp_data_list[i]['is_under_line'] = 1; + for (var i in temp_data_list) { + if (order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) { + temp_data_list[i]['is_under_line'] = 1; + } } - } - self.setData({ - data_list: temp_data_list - }); - app.alert({ - msg: res.data.msg, - is_show_cancel: 0 - }); - break; + self.setData({ + data_list: temp_data_list + }); + app.alert({ + msg: res.data.msg, + is_show_cancel: 0 + }); + break; - // 钱包支付 - case 2: - self.order_item_pay_success_handle(order_ids); - app.showToast('支付成功', 'success'); - break; + // 钱包支付 + case 2: + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + break; - // 默认 - default: - app.showToast('支付类型有误'); + // 默认 + default: + app.showToast('支付类型有误'); + } } } else { app.showToast(res.data.msg); diff --git a/sourcecode/weixin/default/app.js b/sourcecode/weixin/default/app.js index be46f0282..3cad11051 100755 --- a/sourcecode/weixin/default/app.js +++ b/sourcecode/weixin/default/app.js @@ -73,7 +73,7 @@ App({ // 请求地址 request_url: "{{request_url}}", - // request_url: 'http://shopxo.com/', + request_url: 'http://shopxo.com/', // request_url: 'https://dev.shopxo.net/', // 基础信息 diff --git a/sourcecode/weixin/default/pages/user-order/user-order.js b/sourcecode/weixin/default/pages/user-order/user-order.js index 0e5ecaba4..90f76c8e1 100755 --- a/sourcecode/weixin/default/pages/user-order/user-order.js +++ b/sourcecode/weixin/default/pages/user-order/user-order.js @@ -232,9 +232,7 @@ Page({ // 支付方法 pay_handle(order_ids) { var self = this; - // 加载loding wx.showLoading({title: "请求中..." }); - wx.request({ url: app.get_request_url("pay", "order"), method: "POST", @@ -246,56 +244,62 @@ Page({ success: res => { wx.hideLoading(); if (res.data.code == 0) { - // 支付方式类型 - switch (res.data.data.is_payment_type) { - // 正常线上支付 - case 0 : - var data = res.data.data; - wx.requestPayment({ - timeStamp: data.data.timeStamp, - nonceStr: data.data.nonceStr, - package: data.data.package, - signType: data.data.signType, - paySign: data.data.paySign, - success: function (res) { - // 数据设置 - self.order_item_pay_success_handle(order_ids); - - // 跳转支付页面 - wx.navigateTo({ - url: "/pages/paytips/paytips?code=9000" - }); - }, - fail: function (res) { - app.showToast('支付失败'); - } - }); - break; - - // 线下支付 - case 1 : - var order_ids_arr = order_ids.split(','); - var temp_data_list = self.data.data_list; - for(var i in temp_data_list) - { - if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + // 是否直接支付成功 + if((res.data.data.is_success || 0) == 1) { + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + } else { + // 支付方式类型 + switch (res.data.data.is_payment_type) { + // 正常线上支付 + case 0 : + var data = res.data.data; + wx.requestPayment({ + timeStamp: data.data.timeStamp, + nonceStr: data.data.nonceStr, + package: data.data.package, + signType: data.data.signType, + paySign: data.data.paySign, + success: function (res) { + // 数据设置 + self.order_item_pay_success_handle(order_ids); + + // 跳转支付页面 + wx.navigateTo({ + url: "/pages/paytips/paytips?code=9000" + }); + }, + fail: function (res) { + app.showToast('支付失败'); + } + }); + break; + + // 线下支付 + case 1 : + var order_ids_arr = order_ids.split(','); + var temp_data_list = self.data.data_list; + for(var i in temp_data_list) { - temp_data_list[i]['is_under_line'] = 1; + if(order_ids_arr.indexOf(temp_data_list[i]['id']) != -1) + { + temp_data_list[i]['is_under_line'] = 1; + } } - } - self.setData({ data_list: temp_data_list }); - app.alert({ msg: res.data.msg, is_show_cancel: 0}); - break; - - // 钱包支付 - case 2 : - self.order_item_pay_success_handle(order_ids); - app.showToast('支付成功', 'success'); - break; - - // 默认 - default : - app.showToast('支付类型有误'); + self.setData({ data_list: temp_data_list }); + app.alert({ msg: res.data.msg, is_show_cancel: 0}); + break; + + // 钱包支付 + case 2 : + self.order_item_pay_success_handle(order_ids); + app.showToast('支付成功', 'success'); + break; + + // 默认 + default : + app.showToast('支付类型有误'); + } } } else { app.showToast(res.data.msg); -- GitLab