支付宝小程序优化

This commit is contained in:
devil_gong
2019-10-08 16:20:08 +08:00
parent dde0367716
commit 9ea422ec8a
34 changed files with 209 additions and 547 deletions

View File

@ -63,8 +63,8 @@ App({
// 请求地址
request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'http://test.shopxo.net/',
// request_url: 'http://tp5-dev.com/',
// request_url: 'http://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",
@ -225,7 +225,7 @@ App({
var openid = my.getStorageSync({key: this.data.cache_user_login_key});
if ((openid.data || null) == null)
{
var $this = this;
var self = this;
// 加载loding
my.showLoading({ content: "授权中..." });
@ -235,7 +235,7 @@ App({
success: res => {
if (res.authCode) {
my.request({
url: $this.get_request_url("alipayuserauth", "user"),
url: self.get_request_url("alipayuserauth", "user"),
method: "POST",
data: {authcode: res.authCode},
dataType: "json",
@ -247,7 +247,7 @@ App({
if((data.is_alipay_user_exist || 0) == 1)
{
my.setStorage({
key: $this.data.cache_user_info_key,
key: self.data.cache_user_info_key,
data: data,
success: (res) => {
if (typeof object === 'object' && (method || null) != null) {
@ -255,46 +255,30 @@ App({
}
},
fail: () => {
my.showToast({
type: "fail",
content: "用户信息缓存失败",
duration: 3000
});
self.showToast('用户信息缓存失败');
}
});
} else {
my.setStorageSync({
key: $this.data.cache_user_login_key,
key: self.data.cache_user_login_key,
data: res.data.data.openid
});
$this.login_to_auth();
self.login_to_auth();
}
} else {
my.showToast({
type: "fail",
content: res.data.msg,
duration: 3000
});
self.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错",
duration: 3000
});
self.showToast('服务器请求出错');
}
});
}
},
fail: e => {
my.hideLoading();
my.showToast({
type: "fail",
content: "授权失败",
duration: 3000
});
self.showToast('授权失败');
}
});
} else {
@ -350,11 +334,11 @@ App({
// 请求数据
my.showLoading({ content: "授权中..." });
var $this = this;
var self = this;
userinfo['openid'] = openid;
userinfo['referrer'] = (params.data == null) ? 0 : (params.data.referrer || 0);
my.request({
url: $this.get_request_url('alipayuserinfo', 'user'),
url: self.get_request_url('alipayuserinfo', 'user'),
method: 'POST',
data: userinfo,
dataType: 'json',
@ -363,7 +347,7 @@ App({
my.hideLoading();
if (res.data.code == 0) {
my.setStorage({
key: $this.data.cache_user_info_key,
key: self.data.cache_user_info_key,
data: res.data.data,
success: (res) => {
if (typeof object === 'object' && (method || null) != null) {
@ -371,28 +355,16 @@ App({
}
},
fail: () => {
my.showToast({
type: "fail",
content: "用户信息缓存失败",
duration: 3000
});
self.showToast('用户信息缓存失败');
}
});
} else {
my.showToast({
type: "fail",
content: res.data.msg,
duration: 3000
});
self.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错",
duration: 3000
});
self.showToast('服务器请求出错');
},
});
},
@ -404,7 +376,7 @@ App({
*/
use_location(object, method) {
my.showLoading({ content: "定位中..." });
var self = this;
my.getLocation({
success(res) {
my.hideLoading();
@ -432,15 +404,15 @@ App({
break;
case 12:
my.showToast({ content: "网络异常,请重试[" + e.error + "]" });
self.showToast("网络异常,请重试[" + e.error + "]");
break;
case 13:
my.showToast({ content: "定位失败,请重试[" + e.error + "]" });
self.showToast("定位失败,请重试[" + e.error + "]");
break;
default:
my.showToast({ content: "定位超时,请重试[" + e.error + "]" });
self.showToast("定位超时,请重试[" + e.error + "]");
}
}
});
@ -458,10 +430,7 @@ App({
if ((temp_value == undefined || temp_value.length == 0 || temp_value == -1) || (temp_is_can_zero == null && temp_value == 0)
) {
my.showToast({
type: "fail",
content: validation[i]["msg"]
});
this.showToast(validation[i]["msg"]);
return false;
}
}
@ -610,7 +579,7 @@ App({
case 3 :
var values = value.split('|');
if (values.length != 4) {
my.showToast({content: '事件值格式有误'});
this.showToast('事件值格式有误');
return false;
}

View File

@ -27,7 +27,7 @@
"pages/user-orderaftersale-detail/user-orderaftersale-detail"
],
"window": {
"defaultTitle": "test",
"defaultTitle": "{{application_title}}",
"titleBarColor": "#d2364c"
},
"tabBar": {

View File

@ -71,10 +71,7 @@ Page({
if(res.data.code == 0)
{
my.showToast({
type: 'success',
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
setTimeout(function()
{
my.redirectTo({
@ -83,21 +80,13 @@ Page({
}, 2000);
} else {
this.setData({form_submit_loading: false});
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
this.setData({form_submit_loading: false});
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -76,11 +76,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -89,10 +85,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -116,10 +116,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -128,11 +125,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错',
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -179,21 +172,14 @@ Page({
my.redirectTo({url: '/pages/user-order/user-order'});
}
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
this.setData({ buy_submit_disabled_status: false });
}
},
fail: () => {
my.hideLoading();
this.setData({buy_submit_disabled_status: false});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -90,10 +90,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -103,11 +100,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: '服务器请求出错',
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -147,18 +140,18 @@ Page({
if (buy_number < buy_min_number) {
buy_number = buy_min_number;
if (buy_min_number > 1) {
my.showToast({ content: '起购' + buy_min_number + inventory_unit });
app.showToast('起购' + buy_min_number + inventory_unit );
return false;
}
}
if (buy_max_number > 0 && buy_number > buy_max_number) {
buy_number = buy_max_number;
my.showToast({ content: '限购' + buy_max_number + inventory_unit });
app.showToast('限购' + buy_max_number + inventory_unit );
return false;
}
if (buy_number > inventory) {
buy_number = inventory;
my.showToast({ content: '库存数量' + inventory + inventory_unit });
app.showToast('库存数量' + inventory + inventory_unit );
return false;
}
@ -183,17 +176,11 @@ Page({
// 选择处理
this.selected_calculate();
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -242,17 +229,11 @@ Page({
if (res.data.code == 0) {
this.cart_delete(id, type);
} else {
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
},
@ -274,23 +255,13 @@ Page({
swipe_index: null,
data_list_loding_status: temp_data_list.length == 0 ? 0 : this.data.data_list_loding_status,
});
my.showToast({
type: 'success',
content: (type == 'delete') ? '删除成功' : '收藏成功'
});
app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success');
} else {
my.showToast({
type: 'fail',
content: (type == 'delete') ? '删除失败' : '收藏失败'
});
app.showToast((type == 'delete') ? '删除失败' : '收藏失败');
}
},
fail: () => {
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
},
@ -360,10 +331,7 @@ Page({
}
if (selected_count <= 0) {
my.showToast({
type: "fail",
content: '请选择商品'
});
app.showToast('请选择商品');
return false
}

View File

@ -49,11 +49,7 @@ Page({
data_list_loding_status: 0,
data_bottom_line_status: true,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -62,11 +58,7 @@ Page({
data_list_loding_status: 2,
data_bottom_line_status: true,
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -165,11 +165,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: '服务器请求出错',
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -271,24 +267,14 @@ Page({
goods_favor_text: (status == 1) ? '已收藏' : '收藏',
goods_favor_icon: '/images/goods-detail-favor-icon-'+status+'.png'
});
my.showToast({
type: 'success',
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
}
@ -317,24 +303,14 @@ Page({
my.hideLoading();
if (res.data.code == 0) {
this.popup_close_event();
my.showToast({
type: 'success',
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
}
@ -458,17 +434,11 @@ Page({
this.setData({goods_specifications_choose: temp_data});
}
} else {
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
},
@ -519,17 +489,11 @@ Page({
goods_spec_base_inventory: res.data.data.inventory,
});
} else {
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
},
@ -565,18 +529,18 @@ Page({
buy_number = buy_min_number;
if(buy_min_number > 1)
{
my.showToast({content: '起购'+buy_min_number+inventory_unit});
app.showToast('起购'+buy_min_number+inventory_unit);
}
}
if(buy_max_number > 0 && buy_number > buy_max_number)
{
buy_number = buy_max_number;
my.showToast({content: '限购'+buy_max_number+inventory_unit});
app.showToast('限购'+buy_max_number+inventory_unit);
}
if(buy_number > inventory)
{
buy_number = inventory;
my.showToast({content: '库存数量'+inventory+inventory_unit});
app.showToast('库存数量'+inventory+inventory_unit);
}
this.setData({temp_buy_number: buy_number});
},
@ -612,10 +576,7 @@ Page({
}
if(active_count < sku_count)
{
my.showToast({
type: 'fail',
content: '请选择属性'
});
app.showToast('请选择属性');
return false;
}
}
@ -641,10 +602,7 @@ Page({
break;
default :
my.showToast({
type: "fail",
content: "操作事件类型有误"
});
app.showToast('操作事件类型有误');
}
}
}

View File

@ -113,11 +113,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -127,10 +123,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -197,6 +197,7 @@
border: 0;
color: #fff;
padding: 0 30rpx;
height: 65rpx;
line-height: 65rpx;
font-size: 30rpx;
border-radius: 6rpx;

View File

@ -69,11 +69,7 @@ Page({
data_list_loding_status: 0,
data_bottom_line_status: true,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -83,11 +79,7 @@ Page({
data_bottom_line_status: true,
load_status: 1,
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -96,7 +88,7 @@ Page({
search_input_event(e) {
var keywords = e.detail.value || null;
if (keywords == null) {
my.showToast({content: '请输入搜索关键字'});
app.showToast('请输入搜索关键字');
return false;
}

View File

@ -80,7 +80,7 @@ Page({
if(app.fields_check(this.data, validation))
{
// 网络请求
var $this = this;
var self = this;
my.showLoading({content: '发送中...'});
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
@ -100,30 +100,22 @@ Page({
{
if(temp_time <= 1)
{
clearInterval($this.data.temp_clear_time);
$this.setData({verify_submit_text: '获取验证码', verify_disabled: false});
clearInterval(self.data.temp_clear_time);
self.setData({verify_submit_text: '获取验证码', verify_disabled: false});
} else {
temp_time--;
$this.setData({verify_submit_text: '剩余 '+temp_time+' 秒'});
self.setData({verify_submit_text: '剩余 '+temp_time+' 秒'});
}
}, 1000);
} else {
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
this.setData({verify_submit_text: '获取验证码', verify_loading: false, verify_disabled: false});
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
}
@ -169,10 +161,7 @@ Page({
if(res.data.code == 0 && (res.data.data || null) != null)
{
clearInterval(this.data.temp_clear_time);
my.showToast({
type: 'success',
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
my.setStorage({
key: app.data.cache_user_info_key,
@ -191,21 +180,13 @@ Page({
}, 1000);
} else {
this.setData({form_submit_loading: false});
my.showToast({
type: 'fail',
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
this.setData({form_submit_loading: false});
my.showToast({
type: 'fail',
content: '服务器请求出错'
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -98,11 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -112,10 +108,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -104,18 +104,12 @@ Page({
self.init_value();
}, 500);
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -136,17 +130,11 @@ Page({
province_list: data
});
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -169,17 +157,11 @@ Page({
city_list: data
});
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -204,17 +186,11 @@ Page({
county_list: data
});
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -314,26 +290,17 @@ Page({
success: res => {
my.hideLoading();
if (res.data.code == 0) {
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
setTimeout(function() {
my.navigateBack();
}, 1000);
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -86,10 +86,7 @@ Page({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
}
},
fail: () => {
@ -99,10 +96,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -118,10 +112,7 @@ Page({
var value = e.currentTarget.dataset.value || null;
if(value == null)
{
my.showToast({
type: "fail",
content: '地址ID有误'
});
app.showToast('地址ID有误');
return false;
}
@ -154,11 +145,7 @@ Page({
data_list_loding_status: temp_data.length == 0 ? 0 : 3,
data_bottom_line_status: temp_data.length == 0 ? false : true,
});
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
// 当前删除是否存在缓存中,存在则删除
var cache_address = my.getStorageSync({
@ -172,19 +159,12 @@ Page({
}
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -197,20 +177,14 @@ Page({
var value = e.currentTarget.dataset.value || null;
if(value == null)
{
my.showToast({
type: "fail",
content: '地址ID有误'
});
app.showToast('地址ID有误');
return false;
}
var self = this;
if(value == self.data.is_default)
{
my.showToast({
type: "success",
content: '设置成功'
});
app.showToast('设置成功', 'success');
return false;
}
@ -229,25 +203,14 @@ Page({
if (res.data.code == 0)
{
self.setData({is_default: value});
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -98,11 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -112,10 +108,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -96,11 +96,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -110,10 +106,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -166,24 +159,14 @@ Page({
data_bottom_line_status: false,
});
}
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -95,11 +95,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -109,10 +105,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -164,24 +157,14 @@ Page({
data_bottom_line_status: false,
});
}
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}

View File

@ -98,11 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -112,10 +108,7 @@ Page({
this.setData({
data_list_loding_status: 2
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -70,10 +70,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -84,11 +81,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: '服务器请求出错',
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},

View File

@ -164,11 +164,7 @@ Page({
data_list_loding_status: 0,
load_status: 1,
});
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
@ -179,10 +175,7 @@ Page({
data_list_loding_status: 2,
load_status: 1,
});
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -245,11 +238,7 @@ Page({
temp_data_list[index]['status'] = 2;
temp_data_list[index]['status_name'] = '待发货';
this.setData({ data_list: temp_data_list });
my.showToast({
type: "success",
content: '支付成功'
});
app.showToast('支付成功', 'success');
} else {
my.tradePay({
tradeNO: res.data.data.data,
@ -272,26 +261,17 @@ Page({
});
},
fail: res => {
my.showToast({
type: "fail",
content: "唤起支付模块失败"
});
app.showToast('唤起支付模块失败');
}
});
}
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -325,24 +305,14 @@ Page({
temp_data_list[index]['status'] = 5;
temp_data_list[index]['status_name'] = '已取消';
this.setData({data_list: temp_data_list});
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -379,24 +349,14 @@ Page({
temp_data_list[index]['status'] = 4;
temp_data_list[index]['status_name'] = '已完成';
this.setData({data_list: temp_data_list});
my.showToast({
type: "success",
content: res.data.msg
});
app.showToast(res.data.msg, 'success');
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
}
@ -406,10 +366,7 @@ Page({
// 催催
rush_event(e) {
my.showToast({
type: "success",
content: "催促成功"
});
app.showToast('催促成功', 'success');
},
// 导航事件
@ -427,10 +384,7 @@ Page({
var did = e.target.dataset.did || 0;
if(oid == 0 || did == 0)
{
my.showToast({
type: "fail",
content: "参数有误"
});
app.showToast('参数有误');
return false;
}

View File

@ -147,4 +147,14 @@
width: 200rpx;
height: 200rpx;
display: block;
}
/*
* 退货弹层
*/
.delivery-popup {
padding-top: 20rpx;
}
.delivery-popup .close {
margin-right: 20rpx;
}

View File

@ -140,7 +140,7 @@
<!-- 退货弹层 -->
<popup show="{{popup_delivery_status}}" position="bottom" onClose="popup_delivery_close_event">
<view class="share-popup bg-white">
<view class="delivery-popup bg-white">
<view class="close fr oh">
<view class="fr" catchTap="popup_delivery_close_event">
<icon type="clear" size="20" />

View File

@ -237,7 +237,7 @@ Page({
// 上传图片预览
upload_show_event(e) {
my.previewImage({
current: this.data.form_images_list[e.target.dataset.index],
current: e.target.dataset.index,
urls: this.data.form_images_list,
});
},
@ -448,7 +448,7 @@ Page({
// 凭证图片预览
images_view_event(e) {
my.previewImage({
current: this.data.new_aftersale_data.images[e.target.dataset.index],
current: e.target.dataset.index,
urls: this.data.new_aftersale_data.images,
});
},

View File

@ -111,18 +111,12 @@ Page({
navigation: data.navigation || [],
});
} else {
my.showToast({
type: "fail",
content: res.data.msg
});
app.showToast(res.data.msg);
}
},
fail: () => {
my.stopPullDownRefresh();
my.showToast({
type: "fail",
content: "服务器请求出错"
});
app.showToast('服务器请求出错');
}
});
},
@ -130,20 +124,14 @@ Page({
// 清除缓存
clear_storage(e) {
my.clearStorage()
my.showToast({
type: "success",
content: "清除缓存成功"
});
app.showToast('清除缓存成功', 'success');
},
// 客服电话
call_event() {
if(this.data.customer_service_tel == null)
{
my.showToast({
type: "fail",
content: "客服电话有误"
});
app.showToast('客服电话有误');
} else {
my.makePhoneCall({ number: this.data.customer_service_tel });
}

View File

@ -59,7 +59,7 @@ Page({
var validation = [{ fields: 'mobile', msg: '请填写手机号码' }];
if (app.fields_check(this.data, validation)) {
// 网络请求
var $this = this;
var self = this;
swan.showLoading({ title: '发送中...' });
this.setData({ verify_submit_text: '发送中', verify_loading: true, verify_disabled: true });
@ -76,11 +76,11 @@ Page({
var temp_time = this.data.verify_time_total;
this.data.temp_clear_time = setInterval(function () {
if (temp_time <= 1) {
clearInterval($this.data.temp_clear_time);
$this.setData({ verify_submit_text: '获取验证码', verify_disabled: false });
clearInterval(self.data.temp_clear_time);
self.setData({ verify_submit_text: '获取验证码', verify_disabled: false });
} else {
temp_time--;
$this.setData({ verify_submit_text: '剩余 ' + temp_time + ' 秒' });
self.setData({ verify_submit_text: '剩余 ' + temp_time + ' 秒' });
}
}, 1000);
} else {

View File

@ -198,7 +198,7 @@ Page({
// 支付方法
pay_handle(order_id, index) {
var $this = this;
var self = this;
// 加载loding
swan.showLoading({ title: "请求中..." });
@ -226,14 +226,14 @@ Page({
orderInfo: res.data.data.data,
success: function (res) {
// 数据设置
var temp_data_list = $this.data.data_list;
var temp_data_list = self.data.data_list;
temp_data_list[index]['status'] = 2;
temp_data_list[index]['status_name'] = '待发货';
$this.setData({ data_list: temp_data_list });
self.setData({ data_list: temp_data_list });
// 跳转支付页面
swan.navigateTo({
url: "/pages/paytips/paytips?code=9000&total_price=" + $this.data.data_list[index]['total_price']
url: "/pages/paytips/paytips?code=9000&total_price=" + self.data.data_list[index]['total_price']
});
},
fail: function (res) {

View File

@ -147,4 +147,14 @@
width: 200rpx;
height: 200rpx;
display: block;
}
/*
* 退货弹层
*/
.delivery-popup {
padding-top: 20rpx;
}
.delivery-popup .close {
margin-right: 20rpx;
}

View File

@ -140,7 +140,7 @@
<!-- 退货弹层 -->
<component-popup status="{{popup_delivery_status}}" position="bottom" bindonclose="popup_delivery_close_event">
<view class="share-popup bg-white">
<view class="delivery-popup bg-white">
<view class="close fr oh">
<view class="fr" catchtap="popup_delivery_close_event">
<icon type="clear" size="20" />

View File

@ -169,19 +169,19 @@ App({
*/
user_auth_login(object, method, auth_data) {
wx.showLoading({ title: "授权中..." });
var $this = this;
var self = this;
wx.checkSession({
success: function () {
var openid = wx.getStorageSync($this.data.cache_user_login_key) || null;
var openid = wx.getStorageSync(self.data.cache_user_login_key) || null;
if (openid == null)
{
$this.user_login(object, method, auth_data);
self.user_login(object, method, auth_data);
} else {
$this.get_user_login_info(object, method, openid, auth_data);
self.get_user_login_info(object, method, openid, auth_data);
}
},
fail: function () {
$this.user_login(object, method, auth_data);
self.user_login(object, method, auth_data);
}
});
},
@ -193,12 +193,12 @@ App({
* auth_data 授权数据
*/
user_login(object, method, auth_data) {
var $this = this;
var self = this;
wx.login({
success: (res) => {
if (res.code) {
wx.request({
url: $this.get_request_url('wechatuserauth', 'user'),
url: self.get_request_url('wechatuserauth', 'user'),
method: 'POST',
data: { authcode: res.code },
dataType: 'json',
@ -206,25 +206,25 @@ App({
success: (res) => {
if (res.data.code == 0) {
wx.setStorage({
key: $this.data.cache_user_login_key,
key: self.data.cache_user_login_key,
data: res.data.data
});
$this.get_user_login_info(object, method, res.data.data, auth_data);
self.get_user_login_info(object, method, res.data.data, auth_data);
} else {
wx.hideLoading();
$this.showToast(res.data.msg);
self.showToast(res.data.msg);
}
},
fail: () => {
wx.hideLoading();
$this.showToast('服务器请求出错');
self.showToast('服务器请求出错');
},
});
}
},
fail: (e) => {
wx.hideLoading();
$this.showToast('授权失败');
self.showToast('授权失败');
}
});
},
@ -242,9 +242,9 @@ App({
var referrer = (params == null) ? 0 : (params.referrer || 0);
// 远程解密数据
var $this = this;
var self = this;
wx.request({
url: $this.get_request_url('wechatuserinfo', 'user'),
url: self.get_request_url('wechatuserinfo', 'user'),
method: 'POST',
data: {
"encrypted_data": auth_data.encryptedData,
@ -258,7 +258,7 @@ App({
wx.hideLoading();
if (res.data.code == 0) {
wx.setStorage({
key: $this.data.cache_user_info_key,
key: self.data.cache_user_info_key,
data: res.data.data,
success: (res) => {
if (typeof object === 'object' && (method || null) != null) {
@ -266,16 +266,16 @@ App({
}
},
fail: () => {
$this.showToast('用户信息缓存失败');
self.showToast('用户信息缓存失败');
}
});
} else {
$this.showToast(res.data.msg);
self.showToast(res.data.msg);
}
},
fail: () => {
wx.hideLoading();
$this.showToast('服务器请求出错');
self.showToast('服务器请求出错');
},
});
},

View File

@ -41,13 +41,13 @@ Page({
*/
user_auth_code(object, method, auth_data) {
// 请求授权接口
var $this = this;
var self = this;
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userInfo']) {
$this.setData({ user: null});
self.setData({ user: null});
} else {
app.user_auth_login($this, 'user_auth_back_event', auth_data);
app.user_auth_login(self, 'user_auth_back_event', auth_data);
}
},
fail: (e) => {
@ -86,7 +86,7 @@ Page({
if(app.fields_check(this.data, validation))
{
// 网络请求
var $this = this;
var self = this;
wx.showLoading({title: '发送中...'});
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
@ -106,11 +106,11 @@ Page({
{
if(temp_time <= 1)
{
clearInterval($this.data.temp_clear_time);
$this.setData({verify_submit_text: '获取验证码', verify_disabled: false});
clearInterval(self.data.temp_clear_time);
self.setData({verify_submit_text: '获取验证码', verify_disabled: false});
} else {
temp_time--;
$this.setData({verify_submit_text: '剩余 '+temp_time+' 秒'});
self.setData({verify_submit_text: '剩余 '+temp_time+' 秒'});
}
}, 1000);
} else {

View File

@ -210,7 +210,7 @@ Page({
// 支付方法
pay_handle(order_id, index) {
var $this = this;
var self = this;
// 加载loding
wx.showLoading({title: "请求中..." });
@ -242,15 +242,15 @@ Page({
paySign: res.data.data.data.paySign,
success: function(res) {
// 数据设置
var temp_data_list = $this.data.data_list;
var temp_data_list = self.data.data_list;
temp_data_list[index]['status'] = 2;
temp_data_list[index]['status_name'] = '待发货';
$this.setData({ data_list: temp_data_list });
self.setData({ data_list: temp_data_list });
// 跳转支付页面
wx.navigateTo({
url: "/pages/paytips/paytips?code=9000&total_price=" +
$this.data.data_list[index]['total_price']
self.data.data_list[index]['total_price']
});
},
fail: function (res) {

View File

@ -140,7 +140,7 @@
<!-- 退货弹层 -->
<component-popup prop-show="{{popup_delivery_status}}" prop-position="bottom" bindonclose="popup_delivery_close_event">
<view class="share-popup bg-white">
<view class="delivery-popup bg-white">
<view class="close fr oh">
<view class="fr" catchtap="popup_delivery_close_event">
<icon type="clear" size="20" />

View File

@ -147,4 +147,14 @@
width: 200rpx;
height: 200rpx;
display: block;
}
/*
* 退货弹层
*/
.delivery-popup {
padding-top: 20rpx;
}
.delivery-popup .close {
margin-right: 20rpx;
}