上传小程序的代码
This commit is contained in:
parent
6be68b4dbf
commit
f40c0d17ed
7
app.js
7
app.js
@ -1,5 +1,5 @@
|
|||||||
var util = require('utils/util.js');
|
//var util = require('utils/util.js');
|
||||||
var api = require('config/api.js');
|
//var api = require('config/api.js');
|
||||||
App({
|
App({
|
||||||
data: {
|
data: {
|
||||||
deviceInfo: {}
|
deviceInfo: {}
|
||||||
@ -17,7 +17,8 @@ App({
|
|||||||
util.request(api.AuthLoginByWeixin, {
|
util.request(api.AuthLoginByWeixin, {
|
||||||
code: res.code
|
code: res.code
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
|
console.log(11111111)
|
||||||
let userInfo = res.data.userInfo;
|
let userInfo = res.data.userInfo;
|
||||||
wx.setStorageSync('token', res.data.token);
|
wx.setStorageSync('token', res.data.token);
|
||||||
wx.setStorageSync('userInfo', userInfo);
|
wx.setStorageSync('userInfo', userInfo);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const ApiRoot = 'http://localhost:8361';
|
const ApiRoot = 'http://localhost:8361';
|
||||||
// const ApiRoot = 'http://192.168.0.113:8361';
|
// const ApiRoot = 'http://192.168.0.113:8361';
|
||||||
// const ApiRoot = 'https://www.qile.club:8688';
|
// const ApiRoot = 'https://www.qile.club:8688';
|
||||||
const ApiRootUrl = ApiRoot + '/api/'
|
const ApiRootUrl = ApiRoot + '/api/v1/'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ApiRoot: ApiRoot,
|
ApiRoot: ApiRoot,
|
||||||
|
|||||||
@ -71,7 +71,8 @@ Page({
|
|||||||
util.request(api.AuthLoginByWeixin, {
|
util.request(api.AuthLoginByWeixin, {
|
||||||
info: info
|
info: info
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
|
console.log(222222222)
|
||||||
wx.setStorageSync('userInfo', res.data.userInfo);
|
wx.setStorageSync('userInfo', res.data.userInfo);
|
||||||
wx.setStorageSync('token', res.data.token);
|
wx.setStorageSync('token', res.data.token);
|
||||||
app.globalData.userInfo = res.data.userInfo;
|
app.globalData.userInfo = res.data.userInfo;
|
||||||
|
|||||||
@ -61,7 +61,7 @@ Page({
|
|||||||
getCartList: function() {
|
getCartList: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.CartList).then(function(res) {
|
util.request(api.CartList).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let hasCartGoods = res.data.cartList;
|
let hasCartGoods = res.data.cartList;
|
||||||
if (hasCartGoods.length != 0) {
|
if (hasCartGoods.length != 0) {
|
||||||
hasCartGoods = 1;
|
hasCartGoods = 1;
|
||||||
@ -117,7 +117,7 @@ Page({
|
|||||||
productIds: productIds.join(','),
|
productIds: productIds.join(','),
|
||||||
isChecked: that.isCheckedAll() ? 0 : 1
|
isChecked: that.isCheckedAll() ? 0 : 1
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
cartGoods: res.data.cartList,
|
cartGoods: res.data.cartList,
|
||||||
cartTotal: res.data.cartTotal
|
cartTotal: res.data.cartTotal
|
||||||
@ -154,7 +154,7 @@ Page({
|
|||||||
number: number,
|
number: number,
|
||||||
id: id
|
id: id
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
cartGoods: res.data.cartList,
|
cartGoods: res.data.cartList,
|
||||||
cartTotal: res.data.cartTotal
|
cartTotal: res.data.cartTotal
|
||||||
@ -196,7 +196,7 @@ Page({
|
|||||||
},
|
},
|
||||||
getCartNum: function() {
|
getCartNum: function() {
|
||||||
util.request(api.CartGoodsCount).then(function(res) {
|
util.request(api.CartGoodsCount).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let cartGoodsCount = '';
|
let cartGoodsCount = '';
|
||||||
if (res.data.cartTotal.goodsCount == 0) {
|
if (res.data.cartTotal.goodsCount == 0) {
|
||||||
wx.removeTabBarBadge({
|
wx.removeTabBarBadge({
|
||||||
@ -249,7 +249,7 @@ Page({
|
|||||||
productIds: that.data.cartGoods[itemIndex].product_id,
|
productIds: that.data.cartGoods[itemIndex].product_id,
|
||||||
isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
|
isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
cartGoods: res.data.cartList,
|
cartGoods: res.data.cartList,
|
||||||
cartTotal: res.data.cartTotal
|
cartTotal: res.data.cartTotal
|
||||||
@ -344,7 +344,7 @@ Page({
|
|||||||
util.request(api.CartDelete, {
|
util.request(api.CartDelete, {
|
||||||
productIds: productIds
|
productIds: productIds
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let cartList = res.data.cartList;
|
let cartList = res.data.cartList;
|
||||||
that.setData({
|
that.setData({
|
||||||
cartGoods: cartList,
|
cartGoods: cartList,
|
||||||
|
|||||||
@ -23,7 +23,7 @@ Page({
|
|||||||
getChannelShowInfo: function (e) {
|
getChannelShowInfo: function (e) {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.ShowSettings).then(function (res) {
|
util.request(api.ShowSettings).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let index_banner_img = res.data.index_banner_img;
|
let index_banner_img = res.data.index_banner_img;
|
||||||
that.setData({
|
that.setData({
|
||||||
index_banner_img: index_banner_img
|
index_banner_img: index_banner_img
|
||||||
@ -68,7 +68,7 @@ Page({
|
|||||||
page: that.data.allPage,
|
page: that.data.allPage,
|
||||||
id: id
|
id: id
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let count = res.data.count;
|
let count = res.data.count;
|
||||||
that.setData({
|
that.setData({
|
||||||
allCount: count,
|
allCount: count,
|
||||||
|
|||||||
@ -97,7 +97,7 @@ Page({
|
|||||||
util.request(api.GoodsDetail, {
|
util.request(api.GoodsDetail, {
|
||||||
id: that.data.id
|
id: that.data.id
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let _specificationList = res.data.specificationList;
|
let _specificationList = res.data.specificationList;
|
||||||
// 如果仅仅存在一种货品,那么商品页面初始化时默认checked
|
// 如果仅仅存在一种货品,那么商品页面初始化时默认checked
|
||||||
if (_specificationList.valueList.length == 1) {
|
if (_specificationList.valueList.length == 1) {
|
||||||
@ -334,7 +334,7 @@ Page({
|
|||||||
getCartCount: function() {
|
getCartCount: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.CartGoodsCount).then(function(res) {
|
util.request(api.CartGoodsCount).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
cartGoodsCount: res.data.cartTotal.goodsCount
|
cartGoodsCount: res.data.cartTotal.goodsCount
|
||||||
});
|
});
|
||||||
@ -434,7 +434,7 @@ Page({
|
|||||||
}, "POST")
|
}, "POST")
|
||||||
.then(function(res) {
|
.then(function(res) {
|
||||||
let _res = res;
|
let _res = res;
|
||||||
if (_res.errno == 0) {
|
if (_res.code == 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '添加成功',
|
title: '添加成功',
|
||||||
});
|
});
|
||||||
@ -517,7 +517,7 @@ Page({
|
|||||||
.then(function(res) {
|
.then(function(res) {
|
||||||
let _res = res;
|
let _res = res;
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
if (_res.errno == 0) {
|
if (_res.code == 0) {
|
||||||
let id = that.data.id;
|
let id = that.data.id;
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/order-check/index?addtype=1'
|
url: '/pages/order-check/index?addtype=1'
|
||||||
|
|||||||
@ -73,7 +73,7 @@ Page({
|
|||||||
getIndexData: function () {
|
getIndexData: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.IndexUrl).then(function (res) {
|
util.request(api.IndexUrl).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
floorGoods: res.data.categoryList,
|
floorGoods: res.data.categoryList,
|
||||||
banner: res.data.banner,
|
banner: res.data.banner,
|
||||||
@ -117,7 +117,7 @@ Page({
|
|||||||
getChannelShowInfo: function (e) {
|
getChannelShowInfo: function (e) {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.ShowSettings).then(function (res) {
|
util.request(api.ShowSettings).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let show_channel = res.data.channel;
|
let show_channel = res.data.channel;
|
||||||
let show_banner = res.data.banner;
|
let show_banner = res.data.banner;
|
||||||
let show_notice = res.data.notice;
|
let show_notice = res.data.notice;
|
||||||
|
|||||||
@ -120,7 +120,7 @@ Page({
|
|||||||
orderFrom: orderFrom,
|
orderFrom: orderFrom,
|
||||||
type: 0
|
type: 0
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let addressId = 0;
|
let addressId = 0;
|
||||||
if (res.data.checkedAddress != 0) {
|
if (res.data.checkedAddress != 0) {
|
||||||
addressId = res.data.checkedAddress.id;
|
addressId = res.data.checkedAddress.id;
|
||||||
@ -167,7 +167,7 @@ Page({
|
|||||||
actualPrice: actualPrice,
|
actualPrice: actualPrice,
|
||||||
offlinePay: 0
|
offlinePay: 0
|
||||||
}, 'POST').then(res => {
|
}, 'POST').then(res => {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.removeStorageSync('orderId');
|
wx.removeStorageSync('orderId');
|
||||||
wx.setStorageSync('addressId', 0);
|
wx.setStorageSync('addressId', 0);
|
||||||
const orderId = res.data.orderInfo.id;
|
const orderId = res.data.orderInfo.id;
|
||||||
@ -202,7 +202,7 @@ Page({
|
|||||||
actualPrice: actualPrice,
|
actualPrice: actualPrice,
|
||||||
offlinePay: 1
|
offlinePay: 1
|
||||||
}, 'POST').then(res => {
|
}, 'POST').then(res => {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.removeStorageSync('orderId');
|
wx.removeStorageSync('orderId');
|
||||||
wx.setStorageSync('addressId', 0);
|
wx.setStorageSync('addressId', 0);
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Page({
|
|||||||
getSearchKeyword() {
|
getSearchKeyword() {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.SearchIndex).then(function (res) {
|
util.request(api.SearchIndex).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
historyKeyword: res.data.historyKeywordList,
|
historyKeyword: res.data.historyKeywordList,
|
||||||
defaultKeyword: res.data.defaultKeyword,
|
defaultKeyword: res.data.defaultKeyword,
|
||||||
@ -54,7 +54,7 @@ Page({
|
|||||||
getHelpKeyword: function () {
|
getHelpKeyword: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.SearchHelper, { keyword: that.data.keyword }).then(function (res) {
|
util.request(api.SearchHelper, { keyword: that.data.keyword }).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
helpKeyword: res.data
|
helpKeyword: res.data
|
||||||
});
|
});
|
||||||
@ -83,7 +83,7 @@ Page({
|
|||||||
getGoodsList: function () {
|
getGoodsList: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.GoodsList, { keyword: that.data.keyword,sort: that.data.currentSortType, order: that.data.currentSortOrder, sales: that.data.salesSortOrder}).then(function (res) {
|
util.request(api.GoodsList, { keyword: that.data.keyword,sort: that.data.currentSortType, order: that.data.currentSortOrder, sales: that.data.salesSortOrder}).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
searchStatus: true,
|
searchStatus: true,
|
||||||
// categoryFilter: false,
|
// categoryFilter: false,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Page({
|
|||||||
util.request(api.GetBase64, {
|
util.request(api.GetBase64, {
|
||||||
goodsId: id
|
goodsId: id
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.getQrcodeJpg(res.data);
|
that.getQrcodeJpg(res.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ Page({
|
|||||||
util.request(api.GoodsShare, {
|
util.request(api.GoodsShare, {
|
||||||
id: id
|
id: id
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
goods: res.data,
|
goods: res.data,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -80,7 +80,7 @@ Page({
|
|||||||
util.request(api.AddressDetail, {
|
util.request(api.AddressDetail, {
|
||||||
id: that.data.addressId
|
id: that.data.addressId
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
address: res.data
|
address: res.data
|
||||||
});
|
});
|
||||||
@ -97,7 +97,7 @@ Page({
|
|||||||
util.request(api.DeleteAddress, {
|
util.request(api.DeleteAddress, {
|
||||||
id: id
|
id: id
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.removeStorageSync('addressId');
|
wx.removeStorageSync('addressId');
|
||||||
util.showErrorToast('删除成功');
|
util.showErrorToast('删除成功');
|
||||||
wx.navigateBack();
|
wx.navigateBack();
|
||||||
@ -299,7 +299,7 @@ Page({
|
|||||||
util.request(api.RegionList, {
|
util.request(api.RegionList, {
|
||||||
parentId: regionId
|
parentId: regionId
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
regionList: res.data.map(item => {
|
regionList: res.data.map(item => {
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ Page({
|
|||||||
address: address.address,
|
address: address.address,
|
||||||
is_default: address.is_default,
|
is_default: address.is_default,
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Page({
|
|||||||
getAddresses() {
|
getAddresses() {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.GetAddresses).then(function(res) {
|
util.request(api.GetAddresses).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
addresses: res.data
|
addresses: res.data
|
||||||
})
|
})
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Page({
|
|||||||
getExpressList(orderId) {
|
getExpressList(orderId) {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.OrderExpressInfo, {orderId: orderId}).then(function (res) {
|
util.request(api.OrderExpressInfo, {orderId: orderId}).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let expressList = res.data;
|
let expressList = res.data;
|
||||||
let traces = JSON.parse(res.data.traces);
|
let traces = JSON.parse(res.data.traces);
|
||||||
expressList.traces = traces;
|
expressList.traces = traces;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ Page({
|
|||||||
getFootprintList() {
|
getFootprintList() {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.FootprintList, { page: that.data.allPage, size: that.data.size }).then(function (res) {
|
util.request(api.FootprintList, { page: that.data.allPage, size: that.data.size }).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let count = res.data.count;
|
let count = res.data.count;
|
||||||
let f1 = that.data.footprintList;
|
let f1 = that.data.footprintList;
|
||||||
let f2 = res.data.data;
|
let f2 = res.data.data;
|
||||||
@ -55,7 +55,7 @@ Page({
|
|||||||
let that = this;
|
let that = this;
|
||||||
let id = e.currentTarget.dataset.val;
|
let id = e.currentTarget.dataset.val;
|
||||||
util.request(api.FootprintDelete, { footprintId: id }, 'POST').then(function (res) {
|
util.request(api.FootprintDelete, { footprintId: id }, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '取消成功',
|
title: '取消成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Page({
|
|||||||
util.request(api.OrderGoods, {
|
util.request(api.OrderGoods, {
|
||||||
orderId: id
|
orderId: id
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
goodsList: res.data
|
goodsList: res.data
|
||||||
});
|
});
|
||||||
|
|||||||
@ -74,7 +74,8 @@ Page({
|
|||||||
util.request(api.AuthLoginByWeixin, {
|
util.request(api.AuthLoginByWeixin, {
|
||||||
code: code
|
code: code
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
|
console.log(33333333)
|
||||||
let userInfo = res.data.userInfo;
|
let userInfo = res.data.userInfo;
|
||||||
that.setData({
|
that.setData({
|
||||||
is_new: res.data.is_new,
|
is_new: res.data.is_new,
|
||||||
@ -97,8 +98,9 @@ Page({
|
|||||||
},
|
},
|
||||||
getSettingsDetail() {
|
getSettingsDetail() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
||||||
util.request(api.SettingsDetail).then(function (res) {
|
util.request(api.SettingsDetail).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let userInfo = res.data;
|
let userInfo = res.data;
|
||||||
// wx.setStorageSync('userInfo', userInfo);
|
// wx.setStorageSync('userInfo', userInfo);
|
||||||
that.setData({
|
that.setData({
|
||||||
@ -117,7 +119,7 @@ Page({
|
|||||||
getOrderInfo: function (e) {
|
getOrderInfo: function (e) {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.OrderCountInfo).then(function (res) {
|
util.request(api.OrderCountInfo).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let status = res.data;
|
let status = res.data;
|
||||||
that.setData({
|
that.setData({
|
||||||
status: status
|
status: status
|
||||||
|
|||||||
@ -129,7 +129,7 @@ Page({
|
|||||||
util.request(api.OrderExpressInfo, {
|
util.request(api.OrderExpressInfo, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let express = res.data;
|
let express = res.data;
|
||||||
express.traces = JSON.parse(res.data.traces);
|
express.traces = JSON.parse(res.data.traces);
|
||||||
that.setData({
|
that.setData({
|
||||||
@ -144,7 +144,7 @@ Page({
|
|||||||
util.request(api.OrderDetail, {
|
util.request(api.OrderDetail, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
orderInfo: res.data.orderInfo,
|
orderInfo: res.data.orderInfo,
|
||||||
orderGoods: res.data.orderGoods,
|
orderGoods: res.data.orderGoods,
|
||||||
@ -172,7 +172,7 @@ Page({
|
|||||||
util.request(api.OrderCancel, {
|
util.request(api.OrderCancel, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.getOrderDetail();
|
that.getOrderDetail();
|
||||||
} else {
|
} else {
|
||||||
util.showErrorToast(res.errmsg);
|
util.showErrorToast(res.errmsg);
|
||||||
@ -190,7 +190,7 @@ Page({
|
|||||||
util.request(api.OrderDelete, {
|
util.request(api.OrderDelete, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '删除订单成功'
|
title: '删除订单成功'
|
||||||
});
|
});
|
||||||
@ -216,7 +216,7 @@ Page({
|
|||||||
util.request(api.OrderConfirm, {
|
util.request(api.OrderConfirm, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '确认收货成功!'
|
title: '确认收货成功!'
|
||||||
});
|
});
|
||||||
@ -241,7 +241,7 @@ Page({
|
|||||||
util.request(api.OrderCancel, {
|
util.request(api.OrderCancel, {
|
||||||
orderId: that.data.orderId
|
orderId: that.data.orderId
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '取消订单成功'
|
title: '取消订单成功'
|
||||||
});
|
});
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Page({
|
|||||||
getOrderInfo: function(e) {
|
getOrderInfo: function(e) {
|
||||||
let that = this;
|
let that = this;
|
||||||
util.request(api.OrderCountInfo).then(function(res) {
|
util.request(api.OrderCountInfo).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let status = res.data;
|
let status = res.data;
|
||||||
that.setData({
|
that.setData({
|
||||||
status: status
|
status: status
|
||||||
@ -59,7 +59,7 @@ Page({
|
|||||||
size: that.data.size,
|
size: that.data.size,
|
||||||
page: that.data.allPage,
|
page: that.data.allPage,
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
let count = res.data.count;
|
let count = res.data.count;
|
||||||
that.setData({
|
that.setData({
|
||||||
allCount: count,
|
allCount: count,
|
||||||
@ -126,7 +126,7 @@ Page({
|
|||||||
util.request(api.OrderCancel, {
|
util.request(api.OrderCancel, {
|
||||||
orderId: orderId
|
orderId: orderId
|
||||||
}, 'POST').then(function(res) {
|
}, 'POST').then(function(res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '取消订单成功'
|
title: '取消订单成功'
|
||||||
});
|
});
|
||||||
|
|||||||
@ -59,8 +59,9 @@ Page({
|
|||||||
},
|
},
|
||||||
getSettingsDetail() {
|
getSettingsDetail() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
||||||
util.request(api.SettingsDetail).then(function (res) {
|
util.request(api.SettingsDetail).then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
that.setData({
|
that.setData({
|
||||||
name: res.data.name,
|
name: res.data.name,
|
||||||
mobile: res.data.mobile,
|
mobile: res.data.mobile,
|
||||||
@ -104,7 +105,7 @@ Page({
|
|||||||
nickName: nickName,
|
nickName: nickName,
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
util.showErrorToast('保存成功');
|
util.showErrorToast('保存成功');
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,40 +18,23 @@
|
|||||||
"ignore": [],
|
"ignore": [],
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
"outputPath": ""
|
"outputPath": ""
|
||||||
}
|
},
|
||||||
|
"enhance": false,
|
||||||
|
"packNpmRelationList": [],
|
||||||
|
"ignoreUploadUnusedFiles": true
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.9.4",
|
|
||||||
"appid": "wxf3d768d1818218f1",
|
|
||||||
"projectname": "%e6%b5%b7%e9%a3%8e%e5%b0%8f%e5%ba%97",
|
|
||||||
"isGameTourist": false,
|
|
||||||
"scripts": {
|
|
||||||
"beforeCompile": "",
|
|
||||||
"beforePreview": "",
|
|
||||||
"beforeUpload": ""
|
|
||||||
},
|
|
||||||
"simulatorType": "wechat",
|
"simulatorType": "wechat",
|
||||||
"simulatorPluginLibVersion": {},
|
"simulatorPluginLibVersion": {},
|
||||||
"condition": {
|
"condition": {},
|
||||||
"search": {
|
"editorSetting": {
|
||||||
"current": -1,
|
"tabIndent": "insertSpaces",
|
||||||
"list": []
|
"tabSize": 2
|
||||||
},
|
},
|
||||||
"conversation": {
|
"libVersion": "2.9.4",
|
||||||
"current": -1,
|
"packOptions": {
|
||||||
"list": []
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
},
|
},
|
||||||
"plugin": {
|
"appid": "wx23d29bab9e02327f"
|
||||||
"current": -1,
|
|
||||||
"list": []
|
|
||||||
},
|
|
||||||
"game": {
|
|
||||||
"currentL": -1,
|
|
||||||
"list": []
|
|
||||||
},
|
|
||||||
"miniprogram": {
|
|
||||||
"current": 2,
|
|
||||||
"list": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
7
project.private.config.json
Normal file
7
project.private.config.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
|
"projectname": "hioshop-miniprogram",
|
||||||
|
"setting": {
|
||||||
|
"compileHotReLoad": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,7 +8,7 @@ function payOrder(orderId) {
|
|||||||
util.request(api.PayPrepayId, {
|
util.request(api.PayPrepayId, {
|
||||||
orderId: orderId
|
orderId: orderId
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
const payParam = res.data;
|
const payParam = res.data;
|
||||||
// 如果没有支付想直接支付成功,下面注释。
|
// 如果没有支付想直接支付成功,下面注释。
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|||||||
@ -18,8 +18,11 @@ function loginByWeixin() {
|
|||||||
code: code,
|
code: code,
|
||||||
userInfo: userInfo
|
userInfo: userInfo
|
||||||
}, 'POST').then(res => {
|
}, 'POST').then(res => {
|
||||||
if (res.errno === 0) {
|
|
||||||
|
if (res.code === 0) {
|
||||||
//存储用户信息
|
//存储用户信息
|
||||||
|
console.log(44444444)
|
||||||
|
console.log(res.data)
|
||||||
wx.setStorageSync('userInfo', res.data.userInfo);
|
wx.setStorageSync('userInfo', res.data.userInfo);
|
||||||
wx.setStorageSync('token', res.data.token);
|
wx.setStorageSync('token', res.data.token);
|
||||||
resolve(res);
|
resolve(res);
|
||||||
@ -40,6 +43,7 @@ function loginByWeixin() {
|
|||||||
function checkLogin() {
|
function checkLogin() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
|
if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
|
||||||
|
console.log(1111111111)
|
||||||
util.checkSession().then(() => {
|
util.checkSession().then(() => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|||||||
@ -68,13 +68,14 @@ function testMobile(num) {
|
|||||||
*/
|
*/
|
||||||
function request(url, data = {}, method = "GET") {
|
function request(url, data = {}, method = "GET") {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
wx.request({
|
wx.request({
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
method: method,
|
method: method,
|
||||||
header: {
|
header: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Hioshop-Token': wx.getStorageSync('token')
|
'Authorization': wx.getStorageSync('token')
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
@ -92,7 +93,7 @@ function request(url, data = {}, method = "GET") {
|
|||||||
// code: code,
|
// code: code,
|
||||||
// userInfo: userInfo
|
// userInfo: userInfo
|
||||||
// }, 'POST').then(res => {
|
// }, 'POST').then(res => {
|
||||||
// if (res.errno === 0) {
|
// if (res.code === 0) {
|
||||||
// //存储用户信息
|
// //存储用户信息
|
||||||
// wx.setStorageSync('userInfo', res.data.userInfo);
|
// wx.setStorageSync('userInfo', res.data.userInfo);
|
||||||
// wx.setStorageSync('token', res.data.token);
|
// wx.setStorageSync('token', res.data.token);
|
||||||
@ -243,7 +244,8 @@ function loginNow() {
|
|||||||
request(api.AuthLoginByWeixin, {
|
request(api.AuthLoginByWeixin, {
|
||||||
code: res.code
|
code: res.code
|
||||||
}, 'POST').then(function (res) {
|
}, 'POST').then(function (res) {
|
||||||
if (res.errno === 0) {
|
if (res.code === 0) {
|
||||||
|
console.log(555555555)
|
||||||
let userInfo = res.data.userInfo;
|
let userInfo = res.data.userInfo;
|
||||||
wx.setStorageSync('token', res.data.token);
|
wx.setStorageSync('token', res.data.token);
|
||||||
wx.setStorageSync('userInfo', userInfo);
|
wx.setStorageSync('userInfo', userInfo);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user