提交 0c9ebcf3 编写于 作者: D devil_gong

小程序细节优化

上级 667901a9
...@@ -33,6 +33,18 @@ class ToutiaoService ...@@ -33,6 +33,18 @@ class ToutiaoService
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public static function Pay($params = []) public static function Pay($params = [])
{
// 获取支付信息
$ret = OrderService::Pay($params);
if($ret['code'] != 0)
{
return $ret;
}
// 线上支付信息处理
$order_info = [];
$service = 0;
if($ret['data']['is_online_pay'] == 1)
{ {
// 配置信息 // 配置信息
$merchant_id = MyC('common_app_mini_toutiao_pay_merchant_id'); $merchant_id = MyC('common_app_mini_toutiao_pay_merchant_id');
...@@ -43,13 +55,6 @@ class ToutiaoService ...@@ -43,13 +55,6 @@ class ToutiaoService
return DataReturn('小程序未配置', -1); return DataReturn('小程序未配置', -1);
} }
// 获取支付信息
$ret = OrderService::Pay($params);
if($ret['code'] != 0)
{
return $ret;
}
// 获取订单信息 // 获取订单信息
$where = ['id'=>intval($params['id']), 'user_id' => $params['user']['id']]; $where = ['id'=>intval($params['id']), 'user_id' => $params['user']['id']];
$order = Db::name('Order')->where($where)->find(); $order = Db::name('Order')->where($where)->find();
...@@ -99,6 +104,7 @@ class ToutiaoService ...@@ -99,6 +104,7 @@ class ToutiaoService
// 签名 // 签名
$order_info['sign'] = (new \base\Toutiao())->PaySignCreated($order_info, $pay_secret); $order_info['sign'] = (new \base\Toutiao())->PaySignCreated($order_info, $pay_secret);
}
// 返回数据 // 返回数据
$result = [ $result = [
......
...@@ -67,8 +67,8 @@ App({ ...@@ -67,8 +67,8 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', // request_url: 'http://tp5-dev.com/',
request_url: 'http://dev.shopxo.net/', // request_url: 'http://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
"pages/extraction-address/extraction-address" "pages/extraction-address/extraction-address"
], ],
"window": { "window": {
"defaultTitle": "test", "defaultTitle": "{{application_title}}",
"titleBarColor": "#d2364c" "titleBarColor": "#d2364c"
}, },
"tabBar": { "tabBar": {
......
...@@ -192,7 +192,11 @@ Page({ ...@@ -192,7 +192,11 @@ Page({
// 选择处理 // 选择处理
this.selected_calculate(); this.selected_calculate();
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -245,7 +249,11 @@ Page({ ...@@ -245,7 +249,11 @@ Page({
if (res.data.code == 0) { if (res.data.code == 0) {
this.cart_delete(id, type); this.cart_delete(id, type);
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -273,7 +281,11 @@ Page({ ...@@ -273,7 +281,11 @@ Page({
}); });
app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success'); app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast((type == 'delete') ? '删除失败' : '收藏失败'); app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
......
...@@ -62,8 +62,8 @@ App({ ...@@ -62,8 +62,8 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', // request_url: 'http://tp5-dev.com/',
request_url: 'https://dev.shopxo.net/', // request_url: 'https://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -182,7 +182,11 @@ Page({ ...@@ -182,7 +182,11 @@ Page({
// 选择处理 // 选择处理
this.selected_calculate(); this.selected_calculate();
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -202,7 +206,11 @@ Page({ ...@@ -202,7 +206,11 @@ Page({
if (res.data.code == 0) { if (res.data.code == 0) {
this.cart_delete(id, type); this.cart_delete(id, type);
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -254,7 +262,11 @@ Page({ ...@@ -254,7 +262,11 @@ Page({
app.showToast(type == 'delete' ? '删除成功' : '收藏成功', 'success'); app.showToast(type == 'delete' ? '删除成功' : '收藏成功', 'success');
} else { } else {
app.showToast(type == 'delete' ? '删除失败' : '收藏失败'); if (app.is_login_check(res.data)) {
app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
......
...@@ -67,8 +67,8 @@ App({ ...@@ -67,8 +67,8 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', // request_url: 'http://tp5-dev.com/',
request_url: 'https://dev.shopxo.net/', // request_url: 'https://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -183,7 +183,11 @@ Page({ ...@@ -183,7 +183,11 @@ Page({
// 选择处理 // 选择处理
this.selected_calculate(); this.selected_calculate();
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -203,7 +207,11 @@ Page({ ...@@ -203,7 +207,11 @@ Page({
if (res.data.code == 0) { if (res.data.code == 0) {
this.cart_delete(id, type); this.cart_delete(id, type);
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -255,7 +263,11 @@ Page({ ...@@ -255,7 +263,11 @@ Page({
app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success'); app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast((type == 'delete') ? '删除失败' : '收藏失败'); app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
......
...@@ -67,8 +67,8 @@ App({ ...@@ -67,8 +67,8 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', // request_url: 'http://tp5-dev.com/',
// request_url: 'https://test.shopxo.net/', // request_url: 'https://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -179,6 +179,7 @@ ...@@ -179,6 +179,7 @@
} }
.goods-base button { .goods-base button {
background: #fff; background: #fff;
padding: 0;
} }
.goods-base .goods-share { .goods-base .goods-share {
position: absolute; position: absolute;
......
...@@ -223,7 +223,7 @@ Page({ ...@@ -223,7 +223,7 @@ Page({
tt.showLoading({title: "请求中..." }); tt.showLoading({title: "请求中..." });
tt.request({ tt.request({
url: app.get_request_url("pay", "order"), url: app.get_request_url("pay", "toutiao"),
method: "POST", method: "POST",
data: { data: {
id: order_id, id: order_id,
...@@ -235,30 +235,37 @@ Page({ ...@@ -235,30 +235,37 @@ Page({
if (res.data.code == 0) { if (res.data.code == 0) {
// 是否在线支付,非在线支付则支付成功 // 是否在线支付,非在线支付则支付成功
if (res.data.data.is_online_pay == 0) { if (res.data.data.is_online_pay == 0) {
// 数据设置 var temp_data_list = this.data.data_list;
self.order_item_pay_success_handle(index); temp_data_list[index]['status'] = 2;
temp_data_list[index]['status_name'] = '待发货';
this.setData({ data_list: temp_data_list });
app.showToast("支付成功", "success"); app.showToast("支付成功", "success");
} else { } else {
tt.requestPayment({ tt.pay({
timeStamp: res.data.data.data.timeStamp, orderInfo: res.data.data.order_info,
nonceStr: res.data.data.data.nonceStr, service: res.data.data.service,
package: res.data.data.data.package, success(res) {
signType: res.data.data.data.signType, if (res.code == 0) {
paySign: res.data.data.data.paySign,
success: function(res) {
// 数据设置 // 数据设置
self.order_item_pay_success_handle(index); var temp_data_list = self.data.data_list;
temp_data_list[index]['status'] = 2;
temp_data_list[index]['status_name'] = '待发货';
self.setData({ data_list: temp_data_list });
// 跳转支付页面 // 跳转支付页面
tt.navigateTo({ wx.navigateTo({
url: "/pages/paytips/paytips?code=9000&total_price=" + url: "/pages/paytips/paytips?code=9000&total_price=" +
self.data.data_list[index]['total_price'] self.data.data_list[index]['total_price']
}); });
}, } else {
fail: function (res) {
app.showToast('支付失败'); app.showToast('支付失败');
} }
},
fail(res) {
console.log(res, 'pay-fail')
app.showToast('调起收银台失败-'+res.data.code);
}
}); });
} }
} else { } else {
......
...@@ -67,8 +67,8 @@ App({ ...@@ -67,8 +67,8 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', // request_url: 'http://tp5-dev.com/',
request_url: 'https://dev.shopxo.net/', // request_url: 'https://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -183,7 +183,11 @@ Page({ ...@@ -183,7 +183,11 @@ Page({
// 选择处理 // 选择处理
this.selected_calculate(); this.selected_calculate();
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -203,7 +207,11 @@ Page({ ...@@ -203,7 +207,11 @@ Page({
if (res.data.code == 0) { if (res.data.code == 0) {
this.cart_delete(id, type); this.cart_delete(id, type);
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg); app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
...@@ -255,7 +263,11 @@ Page({ ...@@ -255,7 +263,11 @@ Page({
app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success'); app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
} else { } else {
if (app.is_login_check(res.data)) {
app.showToast((type == 'delete') ? '删除失败' : '收藏失败'); app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
} else {
app.showToast('提交失败,请重试!');
}
} }
}, },
fail: () => { fail: () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册