feat/task1-c-wallet
devil_gong 2019-06-28 17:34:30 +08:00
parent 0bd89b4b5c
commit d216bb8de0
20 changed files with 93 additions and 49 deletions

View File

@ -61,6 +61,7 @@ App({
// 请求地址
request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'http://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",
@ -224,6 +225,7 @@ App({
// 邀请人参数
var params = my.getStorageSync({key: this.data.cache_launch_info_key});
var referrer = (params.data == null) ? 0 : (params.data.referrer || 0);
var $this = this;
// 加载loding
my.showLoading({ content: "授权中..." });
@ -233,19 +235,20 @@ App({
scopes: "auth_user",
success: res => {
if (res.authCode) {
my.httpRequest({
url: this.get_request_url("alipayuserauth", "user"),
my.request({
url: $this.get_request_url("alipayuserauth", "user"),
method: "POST",
data: {
authcode: res.authCode,
referrer: referrer
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {
my.setStorage({
key: this.data.cache_user_login_key,
key: $this.data.cache_user_login_key,
data: res.data.data
});
@ -262,7 +265,6 @@ App({
},
fail: () => {
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错",
@ -274,7 +276,6 @@ App({
},
fail: e => {
my.hideLoading();
my.showToast({
type: "fail",
content: "授权失败",
@ -291,7 +292,6 @@ App({
* auth_data 授权数据
*/
user_auth_login(object, method, auth_data) {
my.showLoading({ content: "授权中..." });
var openid = my.getStorageSync({key: this.data.cache_user_login_key});
if ((openid || null) == null)
{
@ -309,14 +309,14 @@ App({
* auth_data 授权数据
*/
get_user_login_info(object, method, openid, userinfo) {
// 远程解密数据
my.showLoading({ content: "授权中..." });
var $this = this;
my.request({
url: $this.get_request_url('alipayuserinfo', 'user'),
method: 'POST',
data: { userinfo: userinfo, openid: openid },
dataType: 'json',
header: { 'content-type': 'application/x-www-form-urlencoded' },
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();
if (res.data.code == 0) {
@ -345,7 +345,7 @@ App({
}
},
fail: () => {
wx.hideLoading();
my.hideLoading();
my.showToast({
type: "fail",
content: "服务器请求出错",

View File

@ -60,11 +60,12 @@ Page({
this.setData({form_submit_loading: true});
// 网络请求
my.httpRequest({
my.request({
url: app.get_request_url('add', 'answer'),
method: 'POST',
data: e.detail.value,
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();

View File

@ -30,13 +30,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("common", "answer"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();

View File

@ -72,11 +72,12 @@ Page({
var data = this.data.params;
data['address_id'] = this.data.address_id;
data['payment_id'] = this.data.payment_id;
my.httpRequest({
my.request({
url: app.get_request_url("index", "buy"),
method: "POST",
data: data,
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {
@ -161,11 +162,12 @@ Page({
my.showLoading({content: '提交中...'});
this.setData({ buy_submit_disabled_status: true });
my.httpRequest({
my.request({
url: app.get_request_url("add", "buy"),
method: "POST",
data: data,
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {

View File

@ -64,11 +64,12 @@ Page({
buy_submit_disabled_status: true,
});
my.httpRequest({
my.request({
url: app.get_request_url("index", "cart"),
method: "POST",
data: {},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
if (res.data.code == 0) {
@ -168,11 +169,12 @@ Page({
}
// 更新数据库
my.httpRequest({
my.request({
url: app.get_request_url("stock", "cart"),
method: "POST",
data: { "id": temp_data_list[index]['id'], "goods_id": temp_data_list[index]['goods_id'], "stock": buy_number},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
if (res.data.code == 0) {
@ -231,11 +233,12 @@ Page({
// 收藏事件
goods_favor_event(id, goods_id, type) {
my.httpRequest({
my.request({
url: app.get_request_url('favor', 'goods'),
method: 'POST',
data: { "id": goods_id, "is_mandatory_favor": 1 },
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
if (res.data.code == 0) {
this.cart_delete(id, type);
@ -257,11 +260,12 @@ Page({
// 购物车删除
cart_delete(id, type) {
my.httpRequest({
my.request({
url: app.get_request_url('delete', 'cart'),
method: 'POST',
data: { "id": id },
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
if (res.data.code == 0) {
var temp_data_list = this.data.data_list;

View File

@ -22,11 +22,12 @@ Page({
});
// 加载loding
my.httpRequest({
my.request({
url: app.get_request_url("category", "goods"),
method: "POST",
data: {},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
if (res.data.code == 0) {

View File

@ -69,11 +69,12 @@ Page({
data_list_loding_status: 1
});
my.httpRequest({
my.request({
url: app.get_request_url("detail", "goods"),
method: "POST",
data: {goods_id: this.data.params.goods_id},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
my.hideLoading();
@ -237,11 +238,12 @@ Page({
} else {
my.showLoading({content: '处理中...'});
my.httpRequest({
my.request({
url: app.get_request_url('favor', 'goods'),
method: 'POST',
data: {"id": this.data.goods.id},
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();
if(res.data.code == 0)
@ -288,11 +290,12 @@ Page({
return false;
} else {
my.showLoading({ content: '处理中...' });
my.httpRequest({
my.request({
url: app.get_request_url('save', 'cart'),
method: 'POST',
data: { "goods_id": this.data.goods.id, "stock": this.data.temp_buy_number, "spec": JSON.stringify(spec) },
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();
if (res.data.code == 0) {
@ -397,11 +400,12 @@ Page({
}
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url('spectype', 'goods'),
method: 'POST',
data: { "id": this.data.goods.id, "spec": JSON.stringify(spec) },
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
if (res.data.code == 0) {
var spec_count = spec.length;
@ -484,11 +488,12 @@ Page({
}
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url('specdetail', 'goods'),
method: 'POST',
data: { "id": this.data.goods.id, "spec": JSON.stringify(spec) },
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
if (res.data.code == 0) {
this.setData({

View File

@ -63,11 +63,12 @@ Page({
post_data['category_id'] = params['category_id'] || 0;
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "search"),
method: "POST",
data: post_data,
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();

View File

@ -26,11 +26,12 @@ Page({
});
// 加载loding
my.httpRequest({
my.request({
url: app.get_request_url("index", "index"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
self.setData({load_status: 1});

View File

@ -39,8 +39,13 @@ Page({
user_auth_code(object, method, auth_data) {
my.getOpenUserInfo({
success: (userinfo) => {
// my.alert({
// title: '亲',
// content: userinfo,
// buttonText: '我知道了',
// });
console.log(userinfo)
app.user_auth_login($this, 'user_auth_back_event', userinfo);
app.user_auth_login($this, 'user_auth_back_event', null);
}
});
},
@ -80,11 +85,12 @@ Page({
my.showLoading({content: '发送中...'});
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
my.httpRequest({
my.request({
url: app.get_request_url('regverifysend', 'user'),
method: 'POST',
data: {mobile: this.data.mobile},
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();
if(res.data.code == 0)
@ -149,11 +155,12 @@ Page({
this.setData({form_submit_loading: true});
// 网络请求
my.httpRequest({
my.request({
url: app.get_request_url('reg', 'user'),
method: 'POST',
data: e.detail.value,
dataType: 'json',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
my.hideLoading();

View File

@ -51,13 +51,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "message"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();

View File

@ -77,11 +77,12 @@ Page({
// 加载loding
my.showLoading({ content: "加载中..." });
my.httpRequest({
my.request({
url: app.get_request_url("detail", "useraddress"),
method: "POST",
data: self.data.params,
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {
@ -122,11 +123,12 @@ Page({
// 获取选择的省市区
get_province_list() {
var self = this;
my.httpRequest({
my.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
@ -152,13 +154,14 @@ Page({
get_city_list() {
var self = this;
if (self.data.province_id) {
my.httpRequest({
my.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {
pid: self.data.province_id
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
@ -186,13 +189,14 @@ Page({
var self = this;
if (self.data.city_id) {
// 加载loding
my.httpRequest({
my.request({
url: app.get_request_url("index", "region"),
method: "POST",
data: {
pid: self.data.city_id
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
@ -301,11 +305,12 @@ Page({
// 加载loding
my.showLoading({ content: "处理中..." });
my.httpRequest({
my.request({
url: app.get_request_url("save", "useraddress"),
method: "POST",
data: form_data,
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {

View File

@ -48,11 +48,12 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "useraddress"),
method: "POST",
data: {},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();
@ -136,11 +137,12 @@ Page({
my.showLoading({ content: "处理中..." });
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("delete", "useraddress"),
method: "POST",
data: {id: value},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0)
@ -216,11 +218,12 @@ Page({
my.showLoading({ content: "处理中..." });
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("setdefault", "useraddress"),
method: "POST",
data: {id: value},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0)

View File

@ -51,13 +51,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "answer"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();

View File

@ -50,13 +50,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "usergoodsfavor"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();
@ -146,11 +147,12 @@ Page({
// 加载loding
my.showLoading({ content: "处理中..." });
my.httpRequest({
my.request({
url: app.get_request_url("cancel", "usergoodsfavor"),
method: "POST",
data: {id: id},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {

View File

@ -50,13 +50,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "usergoodsbrowse"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();
@ -145,11 +146,12 @@ Page({
// 加载loding
my.showLoading({ content: "处理中..." });
my.httpRequest({
my.request({
url: app.get_request_url("delete", "usergoodsbrowse"),
method: "POST",
data: { id: id },
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {

View File

@ -51,13 +51,14 @@ Page({
});
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "userintegral"),
method: "POST",
data: {
page: this.data.data_page
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();

View File

@ -25,13 +25,14 @@ Page({
data_list_loding_status: 1
});
my.httpRequest({
my.request({
url: app.get_request_url("detail", "order"),
method: "POST",
data: {
id: this.data.params.id
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();

View File

@ -93,7 +93,7 @@ Page({
var order_status = ((this.data.nav_status_list[this.data.nav_status_index] || null) == null) ? -1 : this.data.nav_status_list[this.data.nav_status_index]['value'];
// 获取数据
my.httpRequest({
my.request({
url: app.get_request_url("index", "order"),
method: "POST",
data: {
@ -103,6 +103,7 @@ Page({
is_more: 1,
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
my.stopPullDownRefresh();
@ -226,7 +227,7 @@ Page({
// 加载loding
my.showLoading({ content: "请求中..." });
my.httpRequest({
my.request({
url: app.get_request_url("pay", "order"),
method: "POST",
data: {
@ -234,6 +235,7 @@ Page({
payment_id: this.data.payment_id,
},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {
@ -310,11 +312,12 @@ Page({
// 加载loding
my.showLoading({ content: "处理中..." });
my.httpRequest({
my.request({
url: app.get_request_url("cancel", "order"),
method: "POST",
data: {id: id},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {
@ -363,11 +366,12 @@ Page({
// 加载loding
my.showLoading({ content: "处理中..." });
my.httpRequest({
my.request({
url: app.get_request_url("collect", "order"),
method: "POST",
data: {id: id},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.hideLoading();
if (res.data.code == 0) {

View File

@ -84,11 +84,12 @@ Page({
// 获取数据
get_data() {
my.httpRequest({
my.request({
url: app.get_request_url("center", "user"),
method: "POST",
data: {},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
my.stopPullDownRefresh();
if (res.data.code == 0) {