Browse Source

首页UI整改

master
杜叶春 2 years ago
parent
commit
6414860e32
  1. 35
      app.js
  2. 18
      app.json
  3. 4
      app.wxss
  4. BIN
      images/home_title_bg.png
  5. BIN
      images/icons/Back_home.png
  6. BIN
      images/icons/cart.png
  7. BIN
      images/icons/cartopen.png
  8. BIN
      images/icons/category.png
  9. BIN
      images/icons/categoryopen.png
  10. BIN
      images/icons/home.png
  11. BIN
      images/icons/homeopen.png
  12. BIN
      images/icons/me.png
  13. BIN
      images/icons/meopen.png
  14. BIN
      images/icons/seach.png
  15. BIN
      images/icons/seachopen.png
  16. BIN
      images/pass.png
  17. BIN
      images/user.png
  18. 10
      pages/address/address.js
  19. 2
      pages/address/address.wxml
  20. 10
      pages/address/index.js
  21. 14
      pages/address/upaddress.js
  22. 150
      pages/article/article.js
  23. 187
      pages/bangding/bangding.js
  24. 48
      pages/cart/cart.js
  25. 1
      pages/cart/cart.json
  26. 34
      pages/category/category.js
  27. 4
      pages/category/category.json
  28. 2
      pages/category/category.wxml
  29. 1
      pages/category/category.wxss
  30. 8
      pages/coupon/index.js
  31. 7
      pages/coupon/index.json
  32. 42
      pages/distribution/detail.js
  33. 6
      pages/distribution/detail.json
  34. 28
      pages/group_buy/cantuan.js
  35. 6
      pages/group_buy/cantuan.json
  36. 4
      pages/group_buy/cantuan.wxml
  37. 57
      pages/group_buy/detail.js
  38. 6
      pages/group_buy/detail.json
  39. 6
      pages/group_buy/group.json
  40. 194
      pages/index/index.js
  41. 4
      pages/index/index.json
  42. 202
      pages/index/index.wxml
  43. 374
      pages/index/index.wxss
  44. 190
      pages/login/login.js
  45. 2
      pages/login/login.json
  46. 49
      pages/login/login.wxml
  47. 280
      pages/login/login.wxss
  48. 6
      pages/new/new.js
  49. 4
      pages/order/detail.js
  50. 10
      pages/order/pay.js
  51. 378
      pages/product/detail.js
  52. 6
      pages/product/detail.json
  53. 6
      pages/product/detail.wxml
  54. 3
      pages/search/search.json
  55. 87
      pages/user/user.js
  56. 6
      pages/user/user.json
  57. 6
      pages/user/user.wxml
  58. 2
      pages/user/user.wxss
  59. 3
      project.private.config.json
  60. 90
      utils/server.js
  61. 23
      utils/util.js

35
app.js

@ -20,23 +20,22 @@ App({
var logs = wx.getStorageSync('logs') || [] var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now()) logs.unshift(Date.now())
wx.setStorageSync('logs', logs); wx.setStorageSync('logs', logs);
}, },
//控制授权登入 //控制授权登入
userlogin: function (page) { // isLogin: function (page) {
if (this.globalData.userInfo.openid == '' || !this.globalData.userInfo.openid) { // if (this.globalData.userInfo.openid == '' || !this.globalData.userInfo.openid) {
if (page) { // if (page) {
return true // return true
} else { // } else {
wx.navigateTo({ // wx.navigateTo({
// url: 'pages/login/login' // // url: 'pages/login/login'
}) // })
} // }
} else { // } else {
console.log(this.globalData.userInfo) // console.log(this.globalData.userInfo)
} // }
}, // },
onShow: function (options) { onShow: function (options) {
var referee_openid = options.query.userid ? options.query.userid : ''; var referee_openid = options.query.userid ? options.query.userid : '';
@ -75,7 +74,6 @@ App({
if (userinfo.nickName) { if (userinfo.nickName) {
that.globalData.userInfo = userinfo; that.globalData.userInfo = userinfo;
} }
} }
}); });
}, },
@ -89,7 +87,7 @@ App({
gender: stype.gender, gender: stype.gender,
referee_openid: this.globalData.userInfo.referee_openid || '' referee_openid: this.globalData.userInfo.referee_openid || ''
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
if (data.status == 0) { if (data.status == 0) {
wx.showToast({ wx.showToast({
@ -122,7 +120,7 @@ App({
callback() callback()
} }
else { else {
that.showToast(res.err); that.showToast(res.message);
} }
}); });
}, },
@ -137,7 +135,8 @@ App({
}, },
globalData: { globalData: {
userInfo: {}, userInfo: {},
userlogin: wx.getStorageSync('userlogin'), isLogin: false,
accessId: wx.getStorageSync('accessId'),
}, },
redirect: function (url, param) { redirect: function (url, param) {
wx.navigateTo({ wx.navigateTo({

18
app.json

@ -1,7 +1,7 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/search/search", "pages/category/category",
"pages/user/user", "pages/user/user",
"pages/new/new", "pages/new/new",
"pages/set/set", "pages/set/set",
@ -67,16 +67,10 @@
"text": "首页" "text": "首页"
}, },
{ {
"pagePath": "pages/new/new", "pagePath": "pages/category/category",
"iconPath": "images/icons/new.png", "iconPath": "images/icons/category.png",
"selectedIconPath": "images/icons/newopen.png", "selectedIconPath": "images/icons/categoryopen.png",
"text": "新品" "text": "全部分类"
},
{
"pagePath": "pages/search/search",
"iconPath": "images/icons/seach.png",
"selectedIconPath": "images/icons/seachopen.png",
"text": "搜索"
}, },
{ {
"pagePath": "pages/cart/cart", "pagePath": "pages/cart/cart",
@ -88,7 +82,7 @@
"pagePath": "pages/user/user", "pagePath": "pages/user/user",
"iconPath": "images/icons/me.png", "iconPath": "images/icons/me.png",
"selectedIconPath": "images/icons/meopen.png", "selectedIconPath": "images/icons/meopen.png",
"text": "个人中心" "text": "我的"
} }
] ]
}, },

4
app.wxss

@ -1,10 +1,10 @@
/**app.wxss**/ /**app.wxss**/
page { page {
background: #fff; font-family: '微软雅黑'; background: #fff;
height:100%; height:100%;
width:100%; width:100%;
font-family: "Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif;
} }
.container { .container {
height: 100%; height: 100%;

BIN
images/home_title_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
images/icons/Back_home.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/icons/cart.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/icons/cartopen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
images/icons/category.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/icons/categoryopen.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
images/icons/home.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
images/icons/homeopen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
images/icons/me.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/icons/meopen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/icons/seach.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

BIN
images/icons/seachopen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/pass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

10
pages/address/address.js

@ -66,7 +66,7 @@ Page({
WXAPI.addressManagement({ WXAPI.addressManagement({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var sheng = data.sheng; var sheng = data.sheng;
var shi = data.shi; var shi = data.shi;
@ -137,7 +137,7 @@ Page({
WXAPI.getCityArr({ WXAPI.getCityArr({
count: count, count: count,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
shi: data.shi shi: data.shi
@ -157,7 +157,7 @@ Page({
count: count, count: count,
column: column, column: column,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
xian: data.xian xian: data.xian
@ -178,7 +178,7 @@ Page({
shi: rew[1], shi: rew[1],
xuan: rew[2] xuan: rew[2]
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var province = data.province; var province = data.province;
var city = data.city; var city = data.city;
@ -233,7 +233,7 @@ Page({
county: e.detail.value.county, county: e.detail.value.county,
address: e.detail.value.address address: e.detail.value.address
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
wx.showToast({ wx.showToast({
title: data.info, title: data.info,

2
pages/address/address.wxml

@ -20,7 +20,7 @@
<input class='xzdq' disabled="false" name="city" value="{{city}}" /> <input class='xzdq' disabled="false" name="city" value="{{city}}" />
<input class='xzdq' disabled="false" name="county" value="{{county}}" /> <input class='xzdq' disabled="false" name="county" value="{{county}}" />
<view class="section_right" bindtap="translate"> <view class="section_right" bindtap="translate">
<image src="../../images/x_right.png"></image> <image src="/images/x_right.png"></image>
</view> </view>
<view class="animation-element-wrapper {{ show?'openBG':'closeBG' }}" style="visibility:{{show ? 'visible':'hidden'}}" bindtap="hiddenFloatView" data-id="444"> <view class="animation-element-wrapper {{ show?'openBG':'closeBG' }}" style="visibility:{{show ? 'visible':'hidden'}}" bindtap="hiddenFloatView" data-id="444">

10
pages/address/index.js

@ -34,7 +34,7 @@ Page({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
id_arr: carts id_arr: carts
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
wx.showToast({ wx.showToast({
title: '地址已清空', title: '地址已清空',
@ -92,7 +92,7 @@ Page({
WXAPI.addressIndex({ WXAPI.addressIndex({
openid: app.globalData.userInfo.openid openid: app.globalData.userInfo.openid
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var address = data.adds; var address = data.adds;
if (address == '') { if (address == '') {
@ -219,7 +219,7 @@ Page({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
addr_id: addrId addr_id: addrId
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var cartId = that.data.cartId; var cartId = that.data.cartId;
if (cartId != '0' || cartId == 'group') { if (cartId != '0' || cartId == 'group') {
@ -258,7 +258,7 @@ Page({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
id_arr: addrId id_arr: addrId
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
that.DataonLoad(); that.DataonLoad();
} else { } else {
wx.showToast({ wx.showToast({
@ -278,7 +278,7 @@ Page({
WXAPI.addressIndex({ WXAPI.addressIndex({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var address = data.adds; var address = data.adds;
that.numbers = data.adds; that.numbers = data.adds;

14
pages/address/upaddress.js

@ -56,7 +56,7 @@ Page({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
id_arr: that.data.id_arr, id_arr: that.data.id_arr,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var address = data.adds; var address = data.adds;
var province = data.province; var province = data.province;
@ -79,7 +79,7 @@ Page({
WXAPI.addressManagement({ WXAPI.addressManagement({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var sheng = data.sheng; var sheng = data.sheng;
var shi = data.shi; var shi = data.shi;
@ -143,7 +143,7 @@ Page({
WXAPI.getCityArr({ WXAPI.getCityArr({
count: count, count: count,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
shi: data.shi shi: data.shi
@ -163,7 +163,7 @@ Page({
count: count, count: count,
column: column, column: column,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
xian: data.xian xian: data.xian
@ -184,7 +184,7 @@ Page({
shi: rew[1], shi: rew[1],
xuan: rew[2] xuan: rew[2]
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
var province = data.province; var province = data.province;
var city = data.city; var city = data.city;
@ -237,7 +237,7 @@ Page({
county: e.detail.value.county, county: e.detail.value.county,
address: e.detail.value.address address: e.detail.value.address
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
@ -260,7 +260,7 @@ Page({
// from_id: formId, // from_id: formId,
// userid: app.globalData.userInfo.openid // userid: app.globalData.userInfo.openid
// }).then(res => { // }).then(res => {
// if (res.status == 1) { // if (res.code == 200) {
// var data = res; // var data = res;
// } // }

150
pages/article/article.js

@ -41,50 +41,36 @@ Page({
// 获取文章详情 // 获取文章详情
y_detail: function (id) { y_detail: function (id) {
var that = this; var that = this;
wx.request({ WXAPI.envelopeIndex({
url: app.d.ceshiUrl + '&action=envelope&m=index', id: id,
method: 'post', }).then(res => {
data: { if (res.code == 200) {
id: id, var data = res;
}, var article = data.article;
header: { //请求头 var content = article['0'].content;
'Content-Type': 'application/x-www-form-urlencoded' //绑定页面数据,使用插件titstu
}, WxParse.wxParse('content', 'html', content, that, 3);
success: function (res) { that.setData({
var status = res.data.status; article: article['0'],
if (status == 1) { title:article['0'].Article_title,
var article = res.data.article; });
var content = article['0'].content;
//绑定页面数据,使用插件titstu if (article['0'].Article_title !='关于我们'){
WxParse.wxParse('content', 'html', content, that, 3);
that.setData({ that.setData({
article: article['0'], titstu:true,
title:article['0'].Article_title,
});
if (article['0'].Article_title !='关于我们'){
that.setData({
titstu:true,
});
}
//设置动态标题
wx.setNavigationBarTitle({
title: article['0'].Article_title
});
} else {
//返回错误提示
wx.showToast({
title: res.data.err,
duration: 2000,
}); });
} }
}, //设置动态标题
error: function (e) { wx.setNavigationBarTitle({
title: article['0'].Article_title
});
} else {
//返回错误提示
wx.showToast({ wx.showToast({
title: '网络异常!', title: res.err,
duration: 2000, duration: 2000,
}); });
}, }
}); });
}, },
// 转发分享 // 转发分享
@ -102,33 +88,21 @@ Page({
path: '/pages/index/index?id?p_openid=' + app.globalData.userInfo.openid, path: '/pages/index/index?id?p_openid=' + app.globalData.userInfo.openid,
success: function (res) { success: function (res) {
// 转发成功 // 转发成功
wx.request({ WXAPI.envelopeShare({
url: app.d.ceshiUrl + '&action=envelope&m=share', id: id,
method: 'post', openid: app.globalData.userInfo.openid
data: { }).then(res => {
id: id, if (res.code == 200) {
openid: app.globalData.userInfo.openid var data = res;
}, wx.navigateTo({
header: { url: '../share/index?id=' + id + '&n=1',
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
wx.showToast({
title: res.data.err,
duration: 2000
}); });
if (res.data.info == 1) { } else {
wx.navigateTo({
url: '../share/index?id=' + id + '&n=1',
});
}
},
fail: function (e) {
wx.showToast({ wx.showToast({
title: '网络异常!err:getsessionkeys', title: res.err,
duration: 2000 duration: 2000
}); });
}, }
}); });
}, },
fail: function (res) { fail: function (res) {
@ -138,25 +112,17 @@ Page({
}, },
storage: function () { storage: function () {
var that = this; var that = this;
wx.request({ WXAPI.appUser({
url: app.d.ceshiUrl + '&action=app&m=user', nickName: app.globalData.userInfo.nickName,
method: 'post', headimgurl: app.globalData.userInfo.avatarUrl,
data: { sex: app.globalData.userInfo.gender,
nickName: app.globalData.userInfo.nickName, openid: app.globalData.userInfo.openid,
headimgurl: app.globalData.userInfo.avatarUrl, p_openid: app.globalData.userInfo.p_openid,
sex: app.globalData.userInfo.gender, }).then(res => {
openid: app.globalData.userInfo.openid, if (res.code == 200) {
p_openid: app.globalData.userInfo.p_openid, var data = res;
},
header: { }
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
},
fail: function (e) {
},
}); });
}, },
//分享朋友圈 查看保存图片 //分享朋友圈 查看保存图片
@ -167,25 +133,21 @@ Page({
icon: 'loading', icon: 'loading',
duration: 1500, duration: 1500,
}); });
WXAPI.getcodeProductShare({
app.request.wxRequest({ scene: 'id=' + that.data.id + '&p_openid=' + app.globalData.userInfo.openid,
url: '&action=getcode&m=product_share', path: 'pages/article/article',
data: { id: app.globalData.userInfo.user_id,
scene: 'id=' + that.data.id + '&p_openid=' + app.globalData.userInfo.openid, pid: that.data.id,
path: 'pages/article/article', type: 1
id: app.globalData.userInfo.user_id, }).then(res => {
pid: that.data.id, if (res.code == 200) {
type: 1 var data = res;
},
method: 'post',
success: function (res) {
console.log(res)
that.setData({ that.setData({
maskHidden: true, maskHidden: true,
imagePath: res.url, imagePath: res.url,
}); });
} }
}) });
var animation = wx.createAnimation({ var animation = wx.createAnimation({
duration: 200, duration: 200,

187
pages/bangding/bangding.js

@ -124,58 +124,41 @@ Page({
date: date date: date
}); });
var that = this; var that = this;
wx.request({ WXAPI.userPerfectIndex({
url: app.d.ceshiUrl + '&action=user&m=perfect_index', user_id: app.globalData.userInfo.user_id
method: 'post', }).then(res => {
data: { if (res.code == 200) {
user_id: app.globalData.userInfo.user_id var data = res;
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
console.log(res)
var status = res.data.status;
if (status == 1) {
var data = res.data.data;
var items = that.data.items; var items = that.data.items;
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].name == data.sex) { if (items[i].name == data.sex) {
items[i].checked = true; items[i].checked = true;
} else {
items[i].checked = false;
}
}
if (data.province) {
var region = [data.province, data.city, data.county];
} else {
var region = that.data.region;
}
if (data.birthday) {
var date = data.birthday
} else { } else {
var date = that.data.date; items[i].checked = false;
} }
that.setData({
name: data.name,
mobile: data.mobile,
binding: res.data.binding,
items: items,
region: region,
date: date,
wx_id: data.wechat_id,
sex: data.sex,
remind: ''
});
} }
}, if (data.province) {
error: function (e) { var region = [data.province, data.city, data.county];
wx.showToast({ } else {
title: '网络异常!', var region = that.data.region;
duration: 2000 }
if (data.birthday) {
var date = data.birthday
} else {
var date = that.data.date;
}
that.setData({
name: data.name,
mobile: data.mobile,
binding: data.binding,
items: items,
region: region,
date: date,
wx_id: data.wechat_id,
sex: data.sex,
remind: ''
}); });
} }
}); });
@ -205,35 +188,21 @@ Page({
showCancel: false, showCancel: false,
content: '同意授权', content: '同意授权',
success: function (res) { success: function (res) {
wx.request({ WXAPI.userSecretKey({
url: app.d.ceshiUrl + '&action=user&m=secret_key', encryptedData: encryptedData, // 加密数据
method: 'post', iv: iv, // 加密算法
data: { sessionId: app.globalData.userInfo.session_key
encryptedData: encryptedData, // 加密数据 }).then(res => {
iv: iv, // 加密算法 if (res.code == 200) {
sessionId: app.globalData.userInfo.session_key var data = res;
}, that.setData({
header: { islogin: true,
'Content-Type': 'application/x-www-form-urlencoded' mobile: data.info
}, })
success: function (res) { } else {
var status = res.data.status; app.getUserInfo(that, res_d);
if (status == 1) {
that.setData({
islogin: true,
mobile: res.data.info
})
} else {
app.getUserInfo(that, res_d);
}
},
error: function (e) {
wx.showToast({
title: '网络异常!',
duration: 2000
});
} }
}) });
} }
}) })
} }
@ -265,50 +234,34 @@ Page({
}) })
wx.hideToast() wx.hideToast()
} else { } else {
WXAPI.userPerfect({
wx.request({ user_id: app.globalData.userInfo.user_id,
url: app.d.ceshiUrl + '&action=user&m=perfect', name: res.detail.value.name,
method: 'post', mobile: that.data.mobile,
data: { province: province,
user_id: app.globalData.userInfo.user_id, city: city,
name: res.detail.value.name, county: county,
mobile: that.data.mobile, wx_id: res.detail.value.wx_id,
province: province, sex: sex,
city: city, date: that.data.date,
county: county, }).then(res => {
wx_id: res.detail.value.wx_id, if (res.code == 200) {
sex: sex, var data = res;
date: that.data.date,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
var status = res.data.status;
if (status == 1) {
wx.showToast({
title: res.data.succ,
icon: 'success',
duration: 3000
})
} else {
wx.showToast({
title: res.data.err ? res.data.err : '非法操作!',
icon: 'none',
duration: 1500
});
}
wx.navigateBack({
delta: 1
});
},
error: function (e) {
wx.showToast({ wx.showToast({
title: '网络异常!', title: res.message,
duration: 2000 icon: 'success',
duration: 3000
})
} else {
wx.showToast({
title: res.message ? res.message : '非法操作!',
icon: 'none',
duration: 1500
}); });
} }
wx.navigateBack({
delta: 1
});
}); });
} }
}, },

48
pages/cart/cart.js

@ -46,8 +46,8 @@ Page({
num: num, num: num,
cart_id: cart_id cart_id: cart_id
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
// 只有大于一件的时候,才能normal状态,否则disable状态 // 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal'; var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据 // 购物车数据
@ -82,13 +82,13 @@ Page({
WXAPI.productDelAllCart({ WXAPI.productDelAllCart({
user_id: that.data.user_id, user_id: that.data.user_id,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
wx.showToast({ wx.showToast({
title: '操作成功!', title: '操作成功!',
duration: 2500 duration: 2500
}); });
that.loadProductData(); that.loadProductData();
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
} else { } else {
wx.showToast({ wx.showToast({
title: '操作失败!', title: '操作失败!',
@ -169,8 +169,8 @@ Page({
user_id: that.data.user_id, user_id: that.data.user_id,
carts: toastStr, carts: toastStr,
}).then(res => { }).then(res => {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
if (res.status == 1) { if (res.code == 200) {
wx.showToast({ wx.showToast({
title: '操作成功!', title: '操作成功!',
duration: 2000 duration: 2000
@ -200,8 +200,8 @@ Page({
num: num, num: num,
cart_id: cart_id cart_id: cart_id
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
// 只有大于一件的时候,才能normal状态,否则disable状态 // 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal'; var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据 // 购物车数据
@ -325,10 +325,10 @@ Page({
bgcolor: app.d.bgcolor, bgcolor: app.d.bgcolor,
user_id: app.globalData.userInfo.openid user_id: app.globalData.userInfo.openid
}); });
wx.setNavigationBarColor({ // wx.setNavigationBarColor({
frontColor: app.d.frontColor,// // frontColor: app.d.frontColor,//
backgroundColor: app.d.bgcolor //页面标题为路由参数 // backgroundColor: app.d.bgcolor //页面标题为路由参数
}); // });
this.loadProductData(); this.loadProductData();
this.sum(); this.sum();
}, },
@ -355,8 +355,8 @@ Page({
res.confirm && WXAPI.productDelcart({ res.confirm && WXAPI.productDelcart({
carts: carts, carts: carts,
}).then(res => { }).then(res => {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
if (res.status == 1) { if (res.code == 200) {
that.loadProductData(); that.loadProductData();
} }
else { else {
@ -380,18 +380,24 @@ Page({
// 数据加载 // 数据加载
loadProductData: function () { loadProductData: function () {
var that = this; var that = this;
WXAPI.cartIndex({
WXAPI.productShopping({ accessId: app.globalData.accessId,
user_id: app.globalData.userInfo.openid storeId: 239,
page: 1
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res.data;
that.setData({ that.setData({
carts: data.cart, carts: data.list,
selectedAllStatus: false, selectedAllStatus: false,
total: '¥0.00', total: '¥0.00',
remind: '' remind: ''
}); });
} else {
wx.showToast({
title: res.message,
duration: 2000
});
} }
}); });
}, },
@ -412,7 +418,7 @@ Page({
num: num, num: num,
cart_id: carid cart_id: carid
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
// 只有大于一件的时候,才能normal状态,否则disable状态 // 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal'; var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据 // 购物车数据

1
pages/cart/cart.json

@ -1,3 +1,4 @@
{ {
"usingComponents": {},
"navigationBarTitleText": "购物车" "navigationBarTitleText": "购物车"
} }

34
pages/search/search.js → pages/category/category.js

@ -1,3 +1,4 @@
// pages/category/category.js
var app = getApp(); var app = getApp();
var WxSearch = require('../../wxSearch/wxSearch.js') var WxSearch = require('../../wxSearch/wxSearch.js')
var WXAPI = require('../../utils/server.js'); var WXAPI = require('../../utils/server.js');
@ -21,19 +22,25 @@ Page({
search: function (e) { search: function (e) {
var that = this; var that = this;
WXAPI.searchIndex({ WXAPI.searchIndex({
keyword:'百货' accessId: app.globalData.accessId,
storeId: 239,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res.data;
that.setData({ that.setData({
cateItems: data.List, cateItems: data,
hotwords: data.hot, hotwords: data.hot,
curNav: data.List[0].cate_id curNav: data[0].cate_id
}); });
that.onReady(); that.onReady();
that.setData({ that.setData({
remind: '' remind: ''
}); });
} else {
wx.showToast({
title: res.message,
duration: 2000
});
} }
}); });
}, },
@ -45,16 +52,15 @@ Page({
that.setData({ that.setData({
color:app.d.bgcolor, color:app.d.bgcolor,
}) })
wx.setNavigationBarColor({ // wx.setNavigationBarColor({
frontColor: app.d.frontColor, // frontColor: app.d.frontColor,
backgroundColor: app.d.bgcolor, //页面标题为路由参数 // backgroundColor: app.d.bgcolor, //页面标题为路由参数
animation: { // animation: {
duration: 400, // duration: 400,
timingFunc: 'easeIn' // timingFunc: 'easeIn'
} // }
}), // }),
this.search(); this.search();
}, },
//事件处理函数 //事件处理函数
switchRightTab: function (e) { switchRightTab: function (e) {

4
pages/category/category.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "全部分类"
}

2
pages/search/search.wxml → pages/category/category.wxml

@ -1,3 +1,4 @@
<!--pages/category/category.wxml-->
<!--index.wxml--> <!--index.wxml-->
<view class="body" wx:if="{{remind}}"> <view class="body" wx:if="{{remind}}">
<view class='zong'> <view class='zong'>
@ -68,3 +69,4 @@
</view> </view>
</view> </view>
</block> </block>

1
pages/search/search.wxss → pages/category/category.wxss

@ -1,3 +1,4 @@
/* pages/category/category.wxss */
@import "/wxSearch/wxSearch.wxss"; @import "/wxSearch/wxSearch.wxss";
page{ page{
background: #fff; background: #fff;

8
pages/coupon/index.js

@ -130,9 +130,11 @@ Page({
}, },
// 点击领取 // 点击领取
receive: function (e) { receive: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
if (e.currentTarget.dataset.point == '领取') { if (e.currentTarget.dataset.point == '领取') {

7
pages/coupon/index.json

@ -1,6 +1,5 @@
{ {
"navigationBarTitleText": "优惠券", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "优惠券"
"pop": "../login/login"
}
} }

42
pages/distribution/detail.js

@ -196,7 +196,7 @@ Page({
skuBeanList: res.data.skuBeanList, skuBeanList: res.data.skuBeanList,
zhekou: res.data.zhekou != '' ? res.data.zhekou : false, zhekou: res.data.zhekou != '' ? res.data.zhekou : false,
}); });
util.getUesrBgplus(that, app, true) // util.getUesrBgplus(that, app, true)
that.setData({ that.setData({
remind: false remind: false
}); });
@ -212,8 +212,8 @@ Page({
url: '../../pages/draw/draw' url: '../../pages/draw/draw'
}); });
} else { } else {
util.getUesrBgplus(that, app, true) // util.getUesrBgplus(that, app, true)
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
wx.switchTab({ wx.switchTab({
url: '../index/index' url: '../index/index'
}) })
@ -355,11 +355,13 @@ Page({
}, },
//跳转cart //跳转cart
go_cart: function () { go_cart: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
util.getUesrBgplus(this, app, false) // util.getUesrBgplus(this, app, false)
wx.switchTab({ wx.switchTab({
url: '../cart/cart' url: '../cart/cart'
}) })
@ -571,7 +573,7 @@ Page({
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
util.getUesrBgplus(that, app, true) // util.getUesrBgplus(that, app, true)
that.setData({ that.setData({
showModalStatus: false showModalStatus: false
}); });
@ -664,9 +666,11 @@ Page({
}, },
// 添加到收藏 // 添加到收藏
addFavorites: function (e) { addFavorites: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
wx.request({ wx.request({
@ -773,9 +777,11 @@ Page({
}, },
add_fromid: function (e) { add_fromid: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
@ -835,9 +841,11 @@ Page({
}, },
// 弹窗 // 弹窗
set_share: function (e) { set_share: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var taht = this; var taht = this;
var show_share = taht.data.show_share; var show_share = taht.data.show_share;

6
pages/distribution/detail.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "商品详情", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "商品详情"
"pop": "../login/login"
}
} }

28
pages/group_buy/cantuan.js

@ -398,9 +398,11 @@ Page({
}) })
}, },
getUserformid: function (e) { getUserformid: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var formid = e.detail.formId; var formid = e.detail.formId;
this.sendFormid(formid) this.sendFormid(formid)
@ -457,8 +459,8 @@ Page({
let that = this let that = this
if (e.detail.errMsg == 'getUserInfo:ok') { if (e.detail.errMsg == 'getUserInfo:ok') {
//获取成功设置状态 //获取成功设置状态
app.globalData.userlogin = true; app.globalData.isLogin = true;
wx.setStorageSync('userlogin', true); wx.setStorageSync('isLogin', true);
//设置用户信息本地存储 //设置用户信息本地存储
try { try {
wx.setStorageSync('userInfo', e.detail.userInfo); wx.setStorageSync('userInfo', e.detail.userInfo);
@ -474,7 +476,7 @@ Page({
duration: 1500, duration: 1500,
}) })
that.setData({ that.setData({
userlogin: false isLogin: false
}) })
that.getOP(e.detail.userInfo) that.getOP(e.detail.userInfo)
} else { } else {
@ -485,7 +487,7 @@ Page({
}) })
//没有授权需要弹框 //没有授权需要弹框
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} }
}, },
@ -515,19 +517,19 @@ Page({
//没有授权需要弹框 //没有授权需要弹框
if (!res.authSetting['scope.userInfo']) { if (!res.authSetting['scope.userInfo']) {
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} else { } else {
//判断用户已经授权。不需要弹框 //判断用户已经授权。不需要弹框
if (app.globalData.userlogin) { if (app.globalData.isLogin) {
that.setData({ that.setData({
userlogin: false isLogin: false
}) })
app.globalData.userlogin = true; app.globalData.isLogin = true;
wx.setStorageSync('userlogin', true); wx.setStorageSync('isLogin', true);
} else { } else {
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} }
} }

6
pages/group_buy/cantuan.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "我的团", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "我的团"
"pop": "../login/login"
}
} }

4
pages/group_buy/cantuan.wxml

@ -172,8 +172,8 @@
<!-- 自定义弹框开始 --> <!-- 自定义弹框开始 -->
<view wx:if="{{userlogin}}" class="mask"></view> <view wx:if="{{isLogin}}" class="mask"></view>
<view wx:if="{{userlogin}}" class="model"> <view wx:if="{{isLogin}}" class="model">
<view class="modelTitle"> <view class="modelTitle">
获取微信授权信息 获取微信授权信息
</view> </view>

57
pages/group_buy/detail.js

@ -175,9 +175,11 @@ Page({
}, },
//分享朋友圈 查看保存图片 //分享朋友圈 查看保存图片
user_share: function () { user_share: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
wx.showToast({ wx.showToast({
@ -333,9 +335,11 @@ Page({
}, 1000) }, 1000)
}, },
joinGroup: function (e) { joinGroup: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var id = e.currentTarget.dataset.id; var id = e.currentTarget.dataset.id;
app.redirect('group_buy/cantuan', 'id=' + id + '&groupid=' + this.data.groupid + '&man_num=' + this.data.itemData.man_num + '&pro_id=' + this.gid + '&sum=' + this.data.sum); app.redirect('group_buy/cantuan', 'id=' + id + '&groupid=' + this.data.groupid + '&man_num=' + this.data.itemData.man_num + '&pro_id=' + this.gid + '&sum=' + this.data.sum);
@ -347,9 +351,11 @@ Page({
}, },
goToBuy: function () { goToBuy: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
var obj = ''; var obj = '';
@ -410,9 +416,11 @@ Page({
}) })
}, },
getUserformid: function (e) { getUserformid: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var formid = e.detail.formId; var formid = e.detail.formId;
@ -447,9 +455,11 @@ Page({
}, },
addShopCart: function () { addShopCart: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
//添加到购物车 //添加到购物车
var that = this; var that = this;
@ -499,10 +509,11 @@ Page({
// 弹窗 // 弹窗
setModalStatus: function (e) { setModalStatus: function (e) {
var isLogin = wx.getStorageSync('isLogin')
if (app.userlogin(1)) { if (!isLogin) {
this.pop.clickPup(this) wx.navigateTo({
return url: '/pages/login/login'
})
} }
var animation = wx.createAnimation({ var animation = wx.createAnimation({
@ -738,9 +749,11 @@ Page({
// 弹窗 // 弹窗
set_share: function (e) { set_share: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var taht = this; var taht = this;

6
pages/group_buy/detail.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "商品详情", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "商品详情"
"pop": "../login/login"
}
} }

6
pages/group_buy/group.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "爱拼才会赢", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "爱拼才会赢"
"pop": "../login/login"
}
} }

194
pages/index/index.js

@ -16,11 +16,10 @@ Page({
circular: true, // 是否采用衔接滑动 circular: true, // 是否采用衔接滑动
scrollLeft: 0, //tab标题的滚动条位置 scrollLeft: 0, //tab标题的滚动条位置
current: 0, //当前选中的Tab项 current: 0, //当前选中的Tab项
current1: 0,
page: 1, page: 1,
index: 1, index: 1,
cont: 1, cont: 1,
tabid: 0, tabid: 58,
loading: false, loading: false,
remind: '加载中', remind: '加载中',
showModal: false, showModal: false,
@ -38,11 +37,7 @@ Page({
var that = this; var that = this;
that.getMore(); that.getMore();
}, },
current1Change: function (e) {
this.setData({
current1: e.detail.current,
})
},
imgW: function (e) { imgW: function (e) {
var $width = e.detail.width, //获取图片真实宽度 var $width = e.detail.width, //获取图片真实宽度
$height = e.detail.height, $height = e.detail.height,
@ -59,35 +54,34 @@ Page({
images: image images: image
}) })
}, },
getMore: function (_e) { getMore: function () {
var that = this; var that = this;
var page = that.data.page; var page = that.data.page;
var index = that.data.tabid; var cid = that.data.tabid;
var current = that.data.current; var current = that.data.current;
that.setData({ that.setData({
page: page + 1 page: page + 1
}); });
WXAPI.indexGetMore({ WXAPI.indexGetMore({
page: page, page: page,
index: index, cid: cid,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res.data;
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
that.setData({ that.setData({
loading: false, loading: false,
}); });
if (data == '') {
if (data.prolist == '' || data.status == 0) {
return false; return false;
} else { } else {
var twoList = that.data.twoList; var titleList = that.data.titleList;
twoList[current].twodata.push(...prolist) titleList[current].list.push(...prolist)
var indexTwoData = twoList[0].twodata var indexList = titleList[0].list
that.setData({ that.setData({
twoList: twoList, titleList: titleList,
indexTwoData: indexTwoData indexList: indexList
}); });
} }
} }
@ -155,65 +149,83 @@ Page({
loadProductDetail: function () { loadProductDetail: function () {
var that = this; var that = this;
var userinfo = wx.getStorageSync('userInfo'); // var userinfo = wx.getStorageSync('userInfo');
if (userinfo.nickName) { // if (userinfo.nickName) {
app.globalData.userInfo = userinfo; // app.globalData.userInfo = userinfo;
} // }
var openid = app.globalData.userInfo.openid ? app.globalData.userInfo.openid : false; // var openid = app.globalData.userInfo.openid ? app.globalData.userInfo.openid : false;
var user_id = ''; // var user_id = '';
if (openid) { // if (openid) {
user_id = app.globalData.userInfo.user_id; // user_id = app.globalData.userInfo.user_id;
} // }
WXAPI.homeIndex({ WXAPI.homeIndex({
user_id: user_id accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
latitude: 28.227965,
longitude: 112.951227,
}).then(res => { }).then(res => {
// if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res.data;
var banner = data.banner; // 轮播图 var titleList = data.list2; //标题导航栏
var twoList = data.twoList; //产品显示 var indexList = []
var bgcolor = data.bgcolor; //产品显示 if (titleList) {
var plug = data.plug; indexList = titleList[0].list // 获取首页的数据对象
var title = data.title; }
app.d.bgcolor = bgcolor;
var arr = Object.keys(twoList[0].distributor);
var banner_num = Object.keys(banner); // 轮播图
var notice = data.notice;
var indexTwoData = twoList[0].twodata // 获取首页的数据对象
app.globalData.logoimg = data.logo app.globalData.logoimg = data.logo
app.globalData.title = data.title
that.setData({ that.setData({
distributor: arr, inforList: data.notice, //滚动公告条
inforList: notice, banner: data.banner, // 轮播图
banner: banner, titleList: titleList,
banner_num: banner_num, indexList: indexList,
twoList: twoList, r_mch: data.r_mch, //优选店铺
indexTwoData: indexTwoData, plug: data.nav_list, //首页类型模块
bgcolor: bgcolor, mch_name: data.title,
plug: plug,
mch_name: title,
logo: data.logo, logo: data.logo,
djname: data.djname, zjList: data.Marketing_list,
zjList: data.list memberPlugin: data.memberPlugin //是否显示会员权益条
});
wx.setNavigationBarColor({
frontColor: app.d.frontColor,
backgroundColor: app.d.bgcolor //页面标题为路由参数
});
wx.setNavigationBarTitle({
title: title,
success: function () { },
}); });
// wx.setNavigationBarColor({
// frontColor: app.d.frontColor,
// backgroundColor: app.d.bgcolor //页面标题为路由参数
// });
that.setData({ remind: '' }); that.setData({ remind: '' });
console.log(data.list.length) // console.log(data.Marketing_list.length)
if (data.list.length) { if (data.Marketing_list.length) {
that.listnsg(); that.listnsg();
} }
// } } else {
// else { wx.showToast({
// that.showToast(data.err); title: res.message,
// } duration: 2000
});
}
});
//新品上市
WXAPI.newArrivalIndex({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
that.setData({
newImgList: data.list
})
}
});
//好物优选
WXAPI.recommendIndex({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
that.setData({
recommendImgList: data.list
})
}
}); });
}, },
onHide: function () { onHide: function () {
@ -284,16 +296,16 @@ Page({
that.nextpic(data); that.nextpic(data);
cont_time = timestamp; cont_time = timestamp;
} }
that.checkCor(e); // that.checkCor();
}, },
nextpic: function (data) { nextpic: function (data) {
this.setData({ this.setData({
current: data.pos, current: data.pos,
tabid: data.tabid tabid: data.tabid,
}); });
}, },
//设置点击tab大于第七个是自动跳到后面 //设置点击tab大于第七个是自动跳到后面
checkCor: function (_e) { checkCor: function (e) {
if (this.data.current > 4) { if (this.data.current > 4) {
this.setData({ this.setData({
scrollLeft: 800 scrollLeft: 800
@ -310,13 +322,13 @@ Page({
contentChange: function (e) { contentChange: function (e) {
var that = this; var that = this;
var id = e.detail.current; var id = e.detail.current;
var tabid = that.data.twoList[id].id; var tabid = that.data.titleList[id].cid;
this.setData({ this.setData({
current: id, current: id,
tabid: tabid, tabid: tabid,
page: 1, page: 1,
}) })
this.checkCor(); // this.checkCor();
}, },
onShow: function () { onShow: function () {
console.log(app) console.log(app)
@ -326,12 +338,12 @@ Page({
that.onLoad(); that.onLoad();
app.d.indexchase = false; app.d.indexchase = false;
} }
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
}, },
onReady: function () { onReady: function () {
this.pop = this.selectComponent("#pop") this.pop = this.selectComponent("#pop")
}, },
onLoad: function (_e) { onLoad: function (e) {
var that = this; var that = this;
that.loadProductDetail(); that.loadProductDetail();
}, },
@ -356,8 +368,8 @@ Page({
let that = this let that = this
if (e.detail.errMsg == 'getUserInfo:ok') { if (e.detail.errMsg == 'getUserInfo:ok') {
//获取成功设置状态 //获取成功设置状态
app.globalData.userlogin = true; app.globalData.isLogin = true;
wx.setStorageSync('userlogin', true); wx.setStorageSync('isLogin', true);
//设置用户信息本地存储 //设置用户信息本地存储
try { try {
wx.setStorageSync('userInfo', e.detail.userInfo); wx.setStorageSync('userInfo', e.detail.userInfo);
@ -373,7 +385,7 @@ Page({
duration: 1500, duration: 1500,
}) })
that.setData({ that.setData({
userlogin: false isLogin: false
}) })
that.getOP(e.detail.userInfo) that.getOP(e.detail.userInfo)
} }
@ -401,19 +413,19 @@ Page({
// 没有授权需要弹框 // 没有授权需要弹框
if (!res.authSetting['scope.userInfo']) { if (!res.authSetting['scope.userInfo']) {
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} else { } else {
//判断用户已经授权。不需要弹框 //判断用户已经授权。不需要弹框
if (app.globalData.userlogin) { if (app.globalData.isLogin) {
that.setData({ that.setData({
userlogin: false isLogin: false
}) })
app.globalData.userlogin = true; app.globalData.isLogin = true;
wx.setStorageSync('userlogin', true); wx.setStorageSync('isLogin', true);
} else { } else {
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} }
} }
@ -446,7 +458,7 @@ Page({
avatarUrl: avatarUrl, avatarUrl: avatarUrl,
gender: gender gender: gender
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
wx.showToast({ wx.showToast({
title: '授权成功!', title: '授权成功!',
success: 2000 success: 2000
@ -458,10 +470,12 @@ Page({
getqx(event) { getqx(event) {
let name = event.currentTarget.dataset.name let name = event.currentTarget.dataset.name
if (name === "签到" || name === "钱包") { if (name === "会员中心" || name === "钱包") {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
} }

4
pages/index/index.json

@ -1,6 +1,4 @@
{ {
"usingComponents": { "usingComponents": {},
"pop": "../login/login"
},
"navigationBarTitleText": "互利商城" "navigationBarTitleText": "互利商城"
} }

202
pages/index/index.wxml

@ -1,3 +1,4 @@
<!--pages/index/index.wxml-->
<view class="page"> <view class="page">
<!-- 加载页面开始 --> <!-- 加载页面开始 -->
<view class="body" wx:if="{{remind}}"> <view class="body" wx:if="{{remind}}">
@ -26,7 +27,7 @@
</view> </view>
<!-- 加载页面结束 --> <!-- 加载页面结束 -->
<block wx:else> <block wx:else>
<form bindsubmit="search_cancel" wx:if="{{searchView}}" report-submit="true"> <!-- <form bindsubmit="search_cancel" wx:if="{{searchView}}" report-submit="true">
<view class="search-box"> <view class="search-box">
<view class="input-box"> <view class="input-box">
@ -43,25 +44,46 @@
</view> </view>
</view> </view>
</form> </form> -->
<view class='tab'> <!-- <view class='tab'>
<scroll-view scroll-x="true" class="tab-h" scroll-left="{{scrollLeft}}"> <scroll-view scroll-x="true" class="tab-h" scroll-left="{{scrollLeft}}">
<view class='tablist'> <view class='tablist'>
<view wx:for="{{twoList}}" wx:key="id" scroll-x class='item {{current==index?"select":""}}' data-pos='{{index}}' data-tabid='{{item.id}}' bindtap='tabItemClick'> <view wx:for="{{titleList}}" wx:key="cid" scroll-x class='item {{current==index?"select":""}}' data-pos='{{index}}' data-tabid='{{item.cid}}' bindtap='tabItemClick'>
<text class='tab-text'>{{item.name}}</text> <text class='tab-text'>{{item.pname}}</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class='searchWrap' bindtap='searchView'> <view class='searchWrap' bindtap='searchView'>
<image class="search-icon1" src="/images/icon-search.png"></image> <image class="search-icon1" src="/images/icon-search.png"></image>
</view> </view>
</view> </view> -->
<swiper class='out' current='{{current}}' autoplay="{{false}}" bindchange="contentChange"> <!-- 顶部导航栏 -->
<swiper-item wx:for="{{twoList}}" wx:for-item="item" wx:key="id"> <!-- <view class="container_top_item" style="height: 88rpx;">
<scroll-view scroll-y="true" bindscrolltolower="obm"> <view class="container_top_item_left" bindtap="toArea" style="white-space: nowrap;">
{{region.district?region.district:'岳麓区'}}
<image src="jianX_h" lazy-load="true"></image>
</view>
<view class="container_top_item_center" bindtap="toUrl('/pagesA/search/search')">
<image src="syss" lazy-load="true"></image>
{{language.home.search_placeholder}}
</view>
<view class="container_top_item_right" bindtap="_navigateTo('/pages/message/systemMesage')">
<image src="grxx" lazy-load="true"></image>
<view v-if="xxnum">{{ xxnum }}</view>
</view>
</view> -->
<!-- 顶部导航栏结束 -->
<view class="out">
<!-- <swiper class='out' current='{{current}}' autoplay="{{false}}" bindchange="contentChange"> -->
<!-- <swiper-item wx:for="{{titleList}}" wx:for-item="item" wx:key="id"> -->
<scroll-view scroll-y="true" bindscrolltolower="obm">
<!-- /首页轮播图/ --> <!-- /首页轮播图/ -->
<swiper class="swiper-box" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" wx:if="{{item.id == 0 && banner.length >0}}"> <!-- wx:if="{{item.cid == 0 && banner.length >0}}" -->
<swiper class="swiper-box" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{banner}}" wx:key="id"> <block wx:for="{{banner}}" wx:key="id">
<navigator url='{{item.url}}'> <navigator url='{{item.url}}'>
<swiper-item> <swiper-item>
@ -72,25 +94,12 @@
</swiper> </swiper>
<!-- /首页轮播图结束/ --> <!-- /首页轮播图结束/ -->
<view class="section units" wx:if="{{item.id == 0}}">
<view bindtap="getqx" hover-class="changestyle" class="unit" wx:for="{{plug}}" wx:for-item="list" wx:key="id" data-name="{{list.name}}" data-path="{{list.url}}">
<view>
<image class='img' src="{{list.image}}"></image>
</view>
<view style='width:100%;'>
<text style='color:#666;font-size:14px;'>{{list.name}}</text>
</view>
</view>
</view>
<!-- /首页菜单/ --> <!-- /首页菜单/ -->
<view class="section icons" wx:if="{{item.id > 0 && item.icons.length >0}}"> <!-- wx:if="{{item.id > 0 && item.icons.length >0}}" -->
<navigator url="../listdetail/listdetail?class={{icons.id}}&title={{icons.name}}" hover-class="changestyle" class="icon" wx:for="{{item.icons}}" wx:for-item="icons" wx:key="id" data-id="{{item.id}}"> <view class="section icons" >
<navigator url="../listdetail/listdetail?class={{icons.id}}&title={{icons.name}}" hover-class="changestyle" class="icon" wx:for="{{plug}}" wx:for-item="icons" wx:key="id" data-id="{{item.id}}">
<view> <view>
<image class='img' src="{{icons.img}}"></image> <image class='img' src="{{icons.appimg}}"></image>
</view> </view>
<view style='width:100%;'> <view style='width:100%;'>
<text class="menu-width">{{icons.name}}</text> <text class="menu-width">{{icons.name}}</text>
@ -100,7 +109,7 @@
<!-- /首页菜单结束/ --> <!-- /首页菜单结束/ -->
<!--滚动公告条开始 --> <!--滚动公告条开始 -->
<view class='in_news' wx:if="{{item.id==0 && inforList.length > 0}}"> <!-- <view class='in_news' wx:if="{{item.id==0 && inforList.length > 0}}">
<image src='/images/lb.png' class='in_img'></image> <image src='/images/lb.png' class='in_img'></image>
<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000"> <swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
<block wx:for="{{inforList}}"wx:key="key"> <block wx:for="{{inforList}}"wx:key="key">
@ -111,58 +120,121 @@
</navigator> </navigator>
</block> </block>
</swiper> </swiper>
</view> </view> -->
<!-- 滚动公告条结束 --> <!-- 滚动公告条结束 -->
<view class="cont" wx:if="{{item.id == 0}}">
<block wx:for="{{item.twodata}}" wx:for-item="twodata" wx:key="id"> <!-- 好物优选 -->
<navigator class="img-box" wx:if="{{twodata.url}}" url="{{twodata.url}}" hover-class="changestyle"> <view class="content_top" style="margin-bottom: 38rpx;">
<image class="mphoto" style="width:{{ images[index].width }}rpx; height:{{ images[index].height }}rpx;" data-index="{{ index }}" bindload='imgW' src="{{twodata.imgurl}}"></image> <view class="content_top-box">
<navigator url="../new/new?type=1" open-type="navigate">
<view class="content_top-box-top">
<view class="content_top-box-top-title">新品上市</view>
<view class="content_top-box-top-txt">上新好物优选购</view>
</view>
<view class="content_top-box-bottom" wx:if="{{newImgList}}">
<image src="{{newImgList[0].imgurl}}" class="content_top-box-bottom-img"></image>
<image wx:if="{{newImgList.length > 1}}" src="{{newImgList[1].imgurl}}" class="content_top-box-bottom-img"></image>
</view>
</navigator> </navigator>
<view class="twos_cont" wx:elif="{{index==0}}"> </view>
<block wx:for="{{indexTwoData}}" wx:for-item="twos" wx:key="id"> <view class="content_top-box">
<navigator class="pr" url="../product/detail?productId={{twos.id}}" hover-class="changestyle"> <navigator url="../new/new?type=2" open-type="navigate">
<image class="photo" src="{{twos.imgurl}}"></image> <view class="content_top-box-top">
<view class="title">{{twos.product_title}}</view> <view class="content_top-box-top-title">好物优选</view>
<view class="content_top-box-top-txt">品质好物优先选</view>
</view>
<view class="content_top-box-bottom" wx:if="{{recommendImgList}}">
<image src="{{recommendImgList[0].imgurl}}" class="content_top-box-bottom-img"></image>
<image wx:if="{{recommendImgList.length > 1}}" src="{{recommendImgList[1].imgurl}}" class="content_top-box-bottom-img"></image>
</view>
</navigator>
</view>
</view>
<!-- 好物优选结束 -->
<!-- 优选店铺 -->
<view class="mch" wx:if="{{r_mch}}">
<view class="home_title">
<view class="mch_name">优选店铺</view>
<image class="home_title_bg" src="/images/home_title_bg.png"></image>
<view class="more" bindtap="navTo('/pagesB/home/mchList')">
<text>更多</text>
<image src="/images/x_right.png" lazy-load="true"></image>
</view>
</view>
<view class="mch_content">
<!-- @tap="toUrl('/pagesB/home/mchList')" -->
<view class="mch_content_item" wx:for="{{r_mch}}" wx:for-item="item" wx:key="id">
<image src="{{item.logo}}" lazy-load="true" mode="aspectFill"></image>
<view>{{item.name}}</view>
<text>{{item.distance}}km</text>
</view>
</view>
</view>
<!-- 优选店铺结束 -->
<!-- 会员权益 -->
<!-- @click="vipclick" -->
<view style="width: 100%;height: 200rpx;" wx:if="{{memberPlugin}}">
<image src="https://mall.gylservice.com/pic/images/icon1/member/hyrk.png" style="width: 100%;height: 100%;"></image>
</view>
<!-- 会员权益结束 -->
<!-- 分类商品 -->
<!-- <view class="cont">
<block wx:for="{{item.list}}" wx:for-item="list" wx:key="id">
<navigator class="img-box" wx:if="{{list.url}}" url="{{list.url}}" hover-class="changestyle">
<image class="mphoto" style="width:{{ images[index].width }}rpx; height:{{images[index].height}}rpx;" data-index="{{index}}" bindload='imgW' src="{{list.imgurl}}"></image>
</navigator>
<view class="item_cont" wx:elif="{{index==0}}">
<block wx:for="{{indexList}}" wx:for-item="item" wx:key="id">
<navigator class="pr" url="../product/detail?productId={{item.id}}" hover-class="changestyle">
<image class="photo" src="{{item.imgurl}}"></image>
<view class="title">{{item.product_title}}</view>
<view style="display:flex;line-height:50rpx;"> <view style="display:flex;line-height:50rpx;">
<view class="gmxx" style="font-size:28rpx;"> <view class="gmxx" style="font-size:28rpx;">
<text style="padding:0px 4px 0 0;" wx:if="{{twos.xp == 1}}">新品</text> <text style="padding:0px 4px 0 0;" wx:if="{{item.xp == 1}}">新品</text>
<text style="padding:0px 4px 0 0;" wx:if="{{twos.rexiao == 1}}">热销</text> <text style="padding:0px 4px 0 0;" wx:if="{{item.rexiao == 1}}">热销</text>
<text style="padding:0px 4px 0 0;" wx:if="{{twos.tuijian == 1}}">推荐</text> <text style="padding:0px 4px 0 0;" wx:if="{{item.tuijian == 1}}">推荐</text>
</view> </view>
</view> </view>
<view style="display:flex;line-height:50rpx;color:#999"> <view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style=" color: red;">¥ {{twos.price}} <view class="gmxx" style=" color: red;">¥ {{item.price}}原价:¥{{item.price_yh}}</view>
<!--原价:¥{{twos.price_yh}}--> <view class="ku" style="width:70%">销量:{{item.volume}}</view>
</view>
<view class="ku" style="width:70%">销量:{{twos.volume}}</view>
</view> </view>
</navigator> </navigator>
</block> </block>
</view> </view>
</block> </block>
</view> </view> -->
<view class="cont" wx:else> <!-- wx:else -->
<block wx:for="{{item.twodata}}" wx:for-item="twodata" wx:key="id"> <view class="cont">
<navigator class="pr" url="../product/detail?productId={{twodata.id}}" hover-class="changestyle"> <!-- 分类导航 -->
<image class="photo" src="{{twodata.imgurl}}"></image> <scroll-view class="scroll-view_x" scroll-x="true" style="width:auto;overflow:hidden;">
<view class="title">{{twodata.name}}</view> <view class="seckill_content_view">
<view class='goods_title_item {{current==index?"active":""}}' wx:for="{{titleList}}" data-pos='{{index}}' wx:for-item="item" wx:key="cid" data-tabid='{{item.cid}}' bindtap='tabItemClick'>
<view>{{item.pname}}</view>
<text>{{item.english_name}}</text>
</view>
</view>
</scroll-view>
<block wx:for="{{item.list}}" wx:for-item="list" wx:key="id">
<navigator class="pr" url="../product/detail?productId={{list.id}}" hover-class="changestyle">
<image class="photo" src="{{list.imgurl}}"></image>
<view class="title">{{list.product_title}}</view>
<view style="display:flex;line-height:50rpx;"> <view style="display:flex;line-height:50rpx;">
<view class="gmxx" style="font-size:28rpx;width:80%"> <view class="gmxx" style="font-size:28rpx;width:80%">
<text style="padding:0px 2px;" wx:if="{{twodata.xp == 1}}">新品</text> <text style="padding:0px 2px;" wx:if="{{list.xp == 1}}">新品</text>
<text style="padding:0px 2px;" wx:if="{{twodata.rexiao == 1}}">热销</text> <text style="padding:0px 2px;" wx:if="{{list.rexiao == 1}}">热销</text>
<text style="padding:0px 2px;" wx:if="{{twodata.tuijian == 1}}">推荐</text> <text style="padding:0px 2px;" wx:if="{{list.tuijian == 1}}">推荐</text>
</view> </view>
</view> </view>
<view style="display:flex;line-height:50rpx;color:#999"> <view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style=" color: red;">¥ {{twodata.price_yh}}</view> <view class="gmxx" style=" color: red;">¥ {{list.price}}</view>
<view class="ku" style="width:60%">销量:{{twodata.volume}}</view> <view class="ku" style="width:60%">销量:{{list.volume}}</view>
</view> </view>
</navigator> </navigator>
</block> </block>
</view> </view>
<!-- 分类商品结束 -->
<view style="display: flex;" wx:if="{{loading}}"> <view style="display: flex;" wx:if="{{loading}}">
<view class="spinner" style='margin:20px auto;'> <view class="spinner" style='margin:20px auto;'>
@ -187,15 +259,17 @@
</view> </view>
</view> </view>
<view wx:if="{{item.twodata == ''}}" class='tishi'> <view wx:if="{{titleList[current].list == ''}}" class='tishi'>
<view> <view>
<image class='scimg' style="margin-top: 25%;" src='/images/search_no.png'></image> <image class='scimg' style="margin-top: 15%;margin-bottom: 5%;" src='/images/search_no.png'></image>
</view> </view>
<view style='font-size:13px;color:#666;'>没有更多数据了</view> <view style='font-size:13px;color:#666;padding-bottom:50rpx'>没有更多数据了</view>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item>
</swiper> <!-- </swiper-item>
</swiper> -->
</view>
<view wx:if="{{zjList_box}}" class='zjList_box'> <view wx:if="{{zjList_box}}" class='zjList_box'>
<view class='zjList'> <view class='zjList'>

374
pages/index/index.wxss

@ -38,9 +38,6 @@
.clearfix{ .clearfix{
clear: both; clear: both;
} }
.swiper-box{
width: 100%;
}
.vipBlock{ .vipBlock{
background-color: #fff; background-color: #fff;
height: 60rpx; height: 60rpx;
@ -113,16 +110,17 @@
} }
page { page {
flex-direction: column; flex-direction: column;
font-family: '微软雅黑';
height: 100%; height: 100%;
width: 100%; width: 100%;
display:flex; display:flex;
background:#eee; background-color:#f4f5f6;
overflow-y: auto;
} }
.page{ .page{
height:100%; height:100%;
width:100%; width:100%;
} }
.tab-h{ .tab-h{
height: 100rpx; height: 100rpx;
width: 100%; width: 100%;
@ -133,32 +131,23 @@ page {
background: #F7F7F7; background: #F7F7F7;
font-size: 16px; font-size: 16px;
white-space: nowrap; white-space: nowrap;
/* position: fixed;
top: 0;
left: 0;
z-index: 99; */
} }
.tab-text{ .tab-text{
padding:0 5px; padding:0 5px;
text-align: center; text-align: center;
} }
.out scroll-view{ scroll-view{
width: 100%;
height: 100%; height: 100%;
overflow-y: scroll; /* overflow-y: scroll; */
} }
.tablist { /* .tablist {
display: flex; display: flex;
background: #f5f5f5; background: #f5f5f5;
height: 100rpx; height: 100rpx;
transform:translate3d(0,0,0); transform:translate3d(0,0,0);
} }
swiper {
display:block;
width: 95%;
margin: 0 auto;
height:180px;
}
.tablist .item { .tablist .item {
flex: auto; flex: auto;
@ -168,34 +157,44 @@ swiper {
align-items: center; align-items: center;
font-size: 11pt; font-size: 11pt;
color: #353535; color: #353535;
} } */
.tablist .item.select { /* .tablist .item.select {
color: #FF6347; color: #FF6347;
} }
.select .tab-text{ .select .tab-text{
border-bottom: 2px solid #FF6347; border-bottom: 2px solid #FF6347;
} } */
.content{ .content{
height: 0px; height: 0px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.out{ .out{
flex: auto; flex: auto;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
swiper {
display:block;
width: 100%;
margin: 0 auto;
height:150px;
}
.swiper-box{
margin-left: 25rpx;
width: 700rpx;
border-radius: 18rpx;
overflow: hidden;
}
.swiper-slide { .swiper-slide {
overflow: auto; overflow: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
.slide-image { .slide-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -250,9 +249,9 @@ swiper {
padding-top: 15rpx; padding-top: 15rpx;
} }
.cont { .cont {
width: 95%; width: 100%;
margin: 0 auto; margin: 0 auto;
padding-top: 10rpx; /* padding-top: 10rpx; */
} }
.cont_0 { .cont_0 {
width: 100%; width: 100%;
@ -331,10 +330,10 @@ swiper {
padding: 1% 5% 0 5%; padding: 1% 5% 0 5%;
font-weight: 700; font-weight: 700;
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
display:-webkit-box; display:-webkit-box;
-webkit-line-clamp:1; -webkit-line-clamp:1;
-webkit-box-orient:vertical; -webkit-box-orient:vertical;
} }
.gmxx { .gmxx {
padding-left:20rpx; padding-left:20rpx;
@ -374,11 +373,13 @@ display:-webkit-box;
color: #666; color: #666;
} }
.icons { .section {
/* height: 370rpx; */ width: 100%;
padding: 20rpx 10rpx; margin: 0 auto;
padding-bottom: 0; background:#fff;
margin-bottom:15rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
.icons swiper-item { .icons swiper-item {
@ -391,15 +392,19 @@ display:-webkit-box;
} }
.icons{ .icons{
float:left; padding: 20rpx 10rpx;
display:flex; padding-bottom: 0;
/* flex-direction:column; */ margin-top: 10rpx;
align-items:center; display:flex;
flex-wrap:wrap; /* flex-direction:column; */
width:98%; align-items:center;
text-align:center; flex-wrap:wrap;
margin:10rpx 0; width:93%;
align-content:flex-start; text-align:center;
margin:10rpx 0;
align-content:flex-start;
margin-left: 2.5%;
background-color: #f4f5f6;
} }
.icons .icon image { .icons .icon image {
@ -413,18 +418,22 @@ align-content:flex-start;
font-size: 12px; font-size: 12px;
/* line-height: 2; */ /* line-height: 2; */
} }
.unit{ .icon {
height: 40%; height: 40%;
vertical-align: top; vertical-align: top;
margin-left: -15rpx; display:flex;
display:flex; align-items:center;
align-items:center; justify-content: center;
justify-content: center; flex-wrap: wrap;
flex-wrap: wrap; width: 20%;
width: 20%; text-align: center;
text-align: center; margin: 10rpx 0;
margin: 10rpx 0; }
.img{
height: 100%;
width: 100%;
} }
.units{ .units{
display:flex; display:flex;
align-items:center; align-items:center;
@ -435,16 +444,7 @@ align-content:flex-start;
justify-content:space-around; justify-content:space-around;
box-shadow: 3px 3px 3px #ccc; box-shadow: 3px 3px 3px #ccc;
} }
.unit image { .unit{
margin:0 auto;
width:55px;
height:55px;
}
.unit view {
width: 100%;
height:100%;
}
.icon {
height: 40%; height: 40%;
vertical-align: top; vertical-align: top;
margin-left: -15rpx; margin-left: -15rpx;
@ -456,23 +456,23 @@ align-content:flex-start;
text-align: center; text-align: center;
margin: 10rpx 0; margin: 10rpx 0;
} }
.img{ .unit image {
height: 95%; margin:0 auto;
width: 95%; width:55px;
height:55px;
}
.unit view {
width: 100%;
height:100%;
} }
.class_p{ .class_p{
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
} }
.section {
width: 95%;
margin: 0 auto;
background:#fff;
margin-bottom:15rpx;
margin-top: 10rpx;
}
@font-face {font-family: "iconfont"; @font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1521691402490'); /* IE9*/ src: url('iconfont.eot?t=1521691402490'); /* IE9*/
@ -616,7 +616,13 @@ button{
.loading-more-bar{ text-align: center; margin-bottom: 20rpx; opacity: 0; } .loading-more-bar{ text-align: center; margin-bottom: 20rpx; opacity: 0; }
.loading-more-bar.active{ opacity: 1; } .loading-more-bar.active{ opacity: 1; }
.scroll-view-x{background-color: #fff;white-space: nowrap;width: 95%;margin: 0 auto;} /* .scroll-view-x{
background-color: #fff;
white-space: nowrap;
width: 95%;
margin: 0 auto;
} */
.navigator_second{ .navigator_second{
/* width:150rpx; */ /* width:150rpx; */
text-align:center; text-align:center;
@ -644,14 +650,14 @@ button{
box-shadow: 3px 3px 3px #ccc; box-shadow: 3px 3px 3px #ccc;
} }
.title-bar { position: relative; border-bottom: 1rpx solid #eee; height: 100rpx;margin-bottom:10px; } /* .title-bar { position: relative; border-bottom: 1rpx solid #eee; height: 100rpx;margin-bottom:10px; }
.title-bar wx-image { width: 38rpx; height: 38rpx; } .title-bar wx-image { width: 38rpx; height: 38rpx; }
.title-bar .title { margin: 0 40rpx; } .title-bar .title { margin: 0 40rpx; }
.title-bar .title-line { display: inline-block; height: 2rpx; width: 30rpx; background: #bbb; } .title-bar .title-line { display: inline-block; height: 2rpx; width: 30rpx; background: #bbb; }
.title-bar .title wx-image { margin-right: 24rpx; } .title-bar .title wx-image { margin-right: 24rpx; }
.title-bar wx-navigator { position: absolute; right: 0; top: 0; bottom: 0; padding: 0 20rpx; } .title-bar wx-navigator { position: absolute; right: 0; top: 0; bottom: 0; padding: 0 20rpx; }
.title-bar wx-navigator wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; } .title-bar wx-navigator wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; } */
.flex-y-center { /* .flex-y-center {
display:-webkit-box; display:-webkit-box;
display:-webkit-flex; display:-webkit-flex;
display:flex; display:flex;
@ -660,9 +666,9 @@ button{
-ms-flex-align:center; -ms-flex-align:center;
-ms-grid-row-align:center; -ms-grid-row-align:center;
align-items:center; align-items:center;
} } */
.flex-x-center { /* .flex-x-center {
display:-webkit-box; display:-webkit-box;
display:-webkit-flex; display:-webkit-flex;
display:flex; display:flex;
@ -670,7 +676,7 @@ button{
-webkit-justify-content:center; -webkit-justify-content:center;
-ms-flex-pack:center; -ms-flex-pack:center;
justify-content:center; justify-content:center;
} } */
.vipText2_img{ .vipText2_img{
height: 100%; height: 100%;
@ -730,4 +736,188 @@ button{
white-space:nowrap; white-space:nowrap;
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
} }
/* 优选好物 */
.content_top {
display: flex;
justify-content: space-between;
margin: 25rpx 25rpx;
}
.content_top-box{
display: flex;
width: 340rpx;
height: 250rpx;
flex-direction: column;
background-color: #fff;
border-radius: 25rpx;
border-right: 2rpx solid #F4F5F6;
}
.content_top-box-top{
display: flex;
height: 88rpx;
line-height: 88rpx;
}
.content_top-box-top-title{
font-weight: 600;
color: #333333;
font-size: 30rpx;
margin-left: 24rpx;
}
.content_top-box-bottom-img{
width: 136rpx;
height: 136rpx;
border-radius: 25rpx;
margin-left: 24rpx;
border: 2rpx solid #e9e9e9;
}
.content_top-box-top-txt{
font-size: 24rpx;
color: #999999;
margin-left: 8rpx;
}
.content_top-box-bottom{
display: flex;
}
/* 优选店铺 */
.mch_content{
display: flex;
justify-content: space-between;
padding: 0 30rpx;
margin: 30rpx 0;
width: 100%;
overflow: hidden;
overflow-x: scroll;
box-sizing: border-box;
}
.mch_content_item{
display: flex;
flex-direction: column;
width:198rpx;
height:316rpx;
background:rgba(255,255,255,1);
border-radius:10rpx;
margin-right: 8rpx;
}
.mch_content_item image{
width:198rpx;
height:216rpx;
border-radius:10rpx 10rpx 0rpx 0rpx;
}
.mch_content_item view{
font-size: 26rpx;
line-height: 26rpx;
color: #000000;
margin: 20rpx 14rpx 18rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-family: serif;
}
.mch_content_item text{
color: #999999;
font-size: 26rpx;
line-height: 26rpx;
margin: 0 14rpx;
font-family: serif;
}
.mch {
background-color: #ffffff;
width: 690rpx;
margin: 0 auto;
border-radius: 16rpx;
}
.mch .home_title {
padding-top: 20rpx;
margin-left: 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
}
.home_title .mch_name {
font-family: serif;
font-size: 35rpx;
position: absolute;
color: #FA5555;
}
.home_title .home_title_bg {
width: 119rpx;
height: 19rpx;
margin-top: 27rpx;
margin-left: 23rpx;
}
.home_title .more {
color: #999999;
font-size: 28rpx;
font-family: serif;
}
.more image {
width: 22rpx;
height: 22rpx;
margin-left: 8rpx;
margin-right: 20rpx;
}
/* 分类导航 */
.scroll-view_x {
margin-top: 20rpx;
width: 100%;
height: 120rpx;
}
.seckill_content_view {
display: flex;
height: 120rpx;
}
.goods_title_item{
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
height: 60rpx;
padding: 0 30rpx;
position: relative;
}
.goods_title_item:not(:last-child){
border-right: 1px solid #A1CECE;
}
.goods_title_item.active view{
color: #333333;
font-weight: bold;
font-family: serif;
}
.goods_title_item.active text{
color:#FA5151;
font-family: serif;
}
.goods_title_item.active:after{
content: '';
position: absolute;
bottom: -16rpx;
left: 50%;
transform: translateX(-50%);
width:30rpx;
height:6rpx;
background:rgba(250, 81, 81, 1.0);
border-radius:3rpx;
}
.goods_title_item view{
text-align: center;
font-size: 34rpx;
color: #020202;
line-height: 34rpx;
white-space: nowrap;
font-family: serif;
}
.goods_title_item text{
color: #666666;
font-size: 22rpx;
line-height: 22rpx;
white-space: nowrap;
font-family: serif;
}

190
pages/login/login.js

@ -3,15 +3,30 @@ var WXAPI = require('../../utils/server.js');
Page({ Page({
data: { data: {
navTab: [{'type':'验证码登录','status':0},{'type':'密码登录','status':1}],
currentIndex: 1,
click: false, //是否显示弹窗内容 click: false, //是否显示弹窗内容
option: false, //显示弹窗或关闭弹窗的操作动画 option: false, //显示弹窗或关闭弹窗的操作动画
logoimg: '', logoimg: '',
loadtitle:'', loadtitle:'',
thvm:{} thvm:{},
}, account: '',
myCatchTouch: function () { password: '',
return;
}, },
//密码登录to验证码登录
switchTab: function(e) {
// this.landing = false
// this.codeLoginBtnStatus = false
// this.phone_codeStatus1 = false
// this.account = ''
// this.password = ''
// this.tabbar_isShow = 1
this.setData({
currentIndex: e.currentTarget.dataset.idx,
tabbar_isShow: e.currentTarget.dataset.item.status,
});
},
// 用户点击显示弹窗 // 用户点击显示弹窗
setCloses:function(){ setCloses:function(){
wx.showToast({ wx.showToast({
@ -46,7 +61,6 @@ Page({
}) })
}, 500) }, 500)
} else { } else {
_that.setData({ _that.setData({
option: true option: true
@ -54,41 +68,7 @@ Page({
} }
}, },
getUserInfo: function (t) {
wx.showLoading({
title: "正在登录",
mask: !0
})
},
material: function (res) {
wx.getUserInfo({
success: function (res) {
var userInfo = res.userInfo;
var nickName = userInfo.nickName;
var avatarUrl = userInfo.avatarUrl;
var gender = userInfo.gender; //性别 0:未知、1:男、2:女
wx.request({
url: app.d.ceshiUrl + '&action=user&m=material',
method: 'post',
data: {
openid: app.globalData.userInfo.openid,
nickName: nickName,
avatarUrl: avatarUrl,
gender: gender
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
wx.showToast({
title: res.data.info,
success: 2000
});
}
})
}
})
},
//获取用户信息新接口 //获取用户信息新接口
agreeGetUser: function (e) { agreeGetUser: function (e) {
let that = this; let that = this;
@ -99,8 +79,8 @@ Page({
console.log(e.detail.userInfo) console.log(e.detail.userInfo)
if (e.detail.errMsg == 'getUserInfo:ok') { if (e.detail.errMsg == 'getUserInfo:ok') {
//获取成功设置状态 //获取成功设置状态
app.globalData.userlogin = true; app.globalData.isLogin = true;
wx.setStorageSync('userlogin', true); wx.setStorageSync('isLogin', true);
//设置用户信息本地存储 //设置用户信息本地存储
try { try {
wx.setStorageSync('userInfo', e.detail.userInfo); wx.setStorageSync('userInfo', e.detail.userInfo);
@ -113,7 +93,7 @@ Page({
} }
that.setData({ that.setData({
userlogin: false isLogin: false
}) })
that.getOP(e.detail.userInfo) that.getOP(e.detail.userInfo)
@ -125,58 +105,94 @@ Page({
}) })
//没有授权需要弹框 //没有授权需要弹框
that.setData({ that.setData({
userlogin: true isLogin: true
}); });
} }
}, },
login: function () { accountInput: function(e) {
var that = this; this.setData({
//取出本地存储用户信息,解决需要每次进入小程序弹框获取用户信息 valueId: "nickname",
var userInfo = wx.getStorageSync('userInfo'); account: e.detail.value
wx.login({
success: res => {
app.globalData.code = res.code
wx.setStorageSync('code', res.code)
},
fail: function () {
wx.showToast({
title: '系统提示:网络错误!',
icon: 'warn',
duration: 1500,
})
}
}) })
},
wx.getSetting({ passwordInput: function(e) {
success: (res) => { this.setData({
//没有授权需要弹框 valueId: "nickname",
if (!res.authSetting['scope.userInfo']) { password: e.detail.value
that.setData({ })
userlogin: true },
}); login: function () {
} else { var that = this;
//判断用户已经授权。不需要弹框 WXAPI.login({
if (app.globalData.userlogin) { storeId: 239,
that.setData({ phone: that.data.account,
userlogin: false password: that.data.password,
}) }).then(res => {
app.globalData.userlogin = true; if (res.code == 200) {
wx.setStorageSync('userlogin', true); var data = res.data
} else { app.globalData.accessId = data.access_id;
that.setData({ wx.setStorageSync('accessId', data.access_id)
userlogin: true wx.setStorageSync('isLogin', true);
}); wx.setStorageSync('userInfo', data.data);
} wx.navigateBack()
} // wx.showToast({
}, // title: '登录成功!',
fail: function () { // success: 2000
// });
} else {
wx.showToast({ wx.showToast({
title: '系统提示:网络错误!', title: res.message,
icon: 'warn', icon: 'none',
duration: 1500, duration: 1500,
}) })
} }
}) });
// wx.login({
// success: res => {
// app.globalData.code = res.code
// wx.setStorageSync('code', res.code)
// },
// fail: function () {
// wx.showToast({
// title: '系统提示:网络错误!',
// icon: 'warn',
// duration: 1500,
// })
// }
// })
// wx.getSetting({
// success: (res) => {
// //没有授权需要弹框
// if (!res.authSetting['scope.userInfo']) {
// that.setData({
// isLogin: true
// });
// } else {
// //判断用户已经授权。不需要弹框
// if (app.globalData.isLogin) {
// that.setData({
// isLogin: false
// })
// app.globalData.isLogin = true;
// wx.setStorageSync('isLogin', true);
// } else {
// that.setData({
// isLogin: true
// });
// }
// }
// },
// fail: function () {
// wx.showToast({
// title: '系统提示:网络错误!',
// icon: 'warn',
// duration: 1500,
// })
// }
// })
}, },
getOP: function (res) { getOP: function (res) {
//提交用户信息 获取用户id //提交用户信息 获取用户id

2
pages/login/login.json

@ -1,4 +1,4 @@
{ {
"usingComponents": {}, "usingComponents": {},
"component": true "navigationBarTitleText": "登录"
} }

49
pages/login/login.wxml

@ -1,28 +1,37 @@
<!-- 底部弹窗动画的内容 --> <!--pages/index/index.wxml-->
<view class="page">
<view class='pupContent {{click? "showContent": "hideContent"}} {{option? "open": "closes"}}' hover-stop-propagation='true'> <view class="top-tab">
<image src="../../images/logonsgb.png" catchtap="setCloses"></image> <view class="top-tab-item{{currentIndex==idx?'Active':''}}" wx:key="key" wx:for="{{navTab}}" wx:for-index="idx" wx:for-item="item" data-idx='{{idx}}' data-item='{{item}}' bindtap="switchTab">{{item.type}}
<view class="pupContent-body"> <view class="top-tab-line{{currentIndex==idx?'Active':''}}"></view>
<view class="pupContent-head">
<image src="{{ logoimg }}"></image>
<view>欢迎来到{{ loadtitle }}</view>
</view> </view>
</view>
<view class="pupContent-title">
为提供更优质的服务,需要获取以下信息: <!--密码登录-->
</view> <view class='login'>
<!-- 用户名 -->
<view class="pupContent-con"> <view class="userCs">
<view>· 你的公开信息(昵称、头像等)</view> <image src="/images/user.png" class="user"></image>
<input placeholder="请输入账号/手机号" type="text" bindinput="accountInput" />
</view> </view>
<!-- 密码 -->
<view> <view class=passwordCs">
<button class="pupContent-btn" bindgetuserinfo="agreeGetUser" class="login-btn" openType="getUserInfo" style="background-color: #1AAD19; border-radius:10rpx;height:46px;display:flex;justify-content:center;align-items: center;" >确定</button> <image src="/images/pass.png" class="pass"></image>
<input placeholder="请输入密码" type="password" bindinput="passwordInput" />
</view> </view>
<!-- <button open-type="getPhoneNumber" hidden="{{false}}" lang="zh_CN" bindgetphonenumber="bindPhoneNumber">微信一键登录</button> -->
<view class="loginView" bindtap="login">登录</view>
</view> </view>
</view> <!--验证码登录-->
<!-- 固定的背景 -->
<view class='pupContentBG {{click?"showBG":"hideBG"}} {{option?"openBG":"closeBG"}}' catchtap='clickPup' catchtouchmove="myCatchTouch">
<!-- <view class="ather_login">
<view>—— 其他登录方式 ——</view>
<view>
<image :src="wx"></image>
</view>
</view> -->
</view> </view>

280
pages/login/login.wxss

@ -1,160 +1,122 @@
.pupContentBG { page{
width: 100vw !important; background-color: #F4F5F6;
height: 100vh !important; }
position: fixed !important; .top-tab{
top: 0 !important; /* position: fixed; */
padding-left: 20rpx;
padding-right: 20rpx;
width: 100%;
height: 100rpx;
background-color: #fff;
white-space: nowrap;
}
.top-tab-itemActive{
color: #333333;
width: 50%;
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
display: inline-block;
}
.top-tab-item {
color: #999999;
width: 50%;
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 30rpx;
display: inline-block;
}
.top-tab-lineActive{
width: 150rpx;
height: 6rpx;
margin-top: -10rpx;
margin-left: 30%;
background-color: #F95B43;
z-index: 655;
}
.top-tab-line{
width: 100%;
height: 2rpx;
margin-top: -8rpx;
background-color: #fff;
}
.login{
display: flex;
}
/* 图片+输入框+下划线的父容器view */
.userCs{
margin-top: 50rpx;
margin-left: 25rpx;
position: absolute;
display: flex;
width:700rpx ;
height: 110rpx ;
background-color: white;
border-radius: 20rpx;
}
/* 用户名图标 */
.userCs .user{
margin-top: 25rpx;
margin-left: 30rpx;
width: 55rpx;
height: 55rpx;
}
/* 用户名输入框 */
.userCs input{
width: 500rpx;
font-size: 30rpx ;
margin-top: 35rpx;
margin-left: 30rpx;
line-height: 55rpx;
}
/* 密码图标+输入框+小眼睛图标+下划线父容器view */
.passwordCs{
margin-top: 190rpx;
margin-left: 25rpx;
position: absolute;
display: flex;
width:700rpx ;
height: 110rpx ;
background-color: white;
border-radius: 20rpx;
}
/* 密码图标 */
.passwordCs .pass{
margin-top: 25rpx;
margin-left: 30rpx;
width: 55rpx;
height: 55rpx;
}
/* 眼睛 图标*/
.passwordCs .eye{
margin-top: 5rpx;
margin-left: 65rpx;
width: 55rpx;
height: 55rpx;
}
/* 密码输入框 */
.passwordCs input{
width: 500rpx;
font-size: 30rpx ;
margin-top: 35rpx;
margin-left: 30rpx;
line-height: 55rpx;
}
.loginView{
/* margin: 300rpx 90rpx 25rpx; */
margin-top: 380rpx;
margin-left: 25rpx;
width: 700rpx;
height: 85rpx;
background-color:#F95B43;
border-radius: 20rpx;
font-size: 32rpx;
color: white;
display: flex;
align-items: center;
justify-content: center;
} }
.pupContent {
width: 100% !important;
background: #FFFFFF !important;
position: fixed !important;
bottom: 0 !important;
z-index: 999 !important;
border-radius: 16rpx 16rpx 0rpx 0rpx !important;
}
.pupContent >image {
width: 28rpx !important;
height: 28rpx !important;
float: right !important;
margin-right: 30rpx !important;
margin-top: 30rpx !important;
}
.pupContent-body {
margin: 60rpx 40rpx !important;
}
/* 设置显示的背景 */
.pupContent-head {
display: flex !important;
align-items: center !important;
color: #020202 !important;
font-weight:bold !important;
font-size:34rpx !important;
padding-bottom: 60rpx !important;
}
.pupContent-head view{
padding-left: 20rpx !important;
}
.pupContent-head image{
width: 80rpx !important;
height: 80rpx !important;
}
.showBG {
display: block !important;
}
.pupContent-title {
color: #020202 !important;
font-size: 30rpx !important;
font-weight:500 !important;
padding-bottom: 40rpx !important;
}
.pupContent-title {
color: #020202 !important;
font-size:30rpx !important;
}
.pupContent-btn {
height: 90rpx !important;
background-color: #1AAD19 !important;
color: #FFFFFF !important;
font-size:30rpx !important;
font-weight:500 !important;
display: flex !important;
justify-content: center !important;
align-items: center !important;
border-radius:10rpx !important;
}
.pupContent-con {
color: #666666 !important;
font-size:26rpx !important;
padding-bottom: 68rpx !important;
}
.hideBG {
display: none;
}
/* 弹出或关闭动画来动态设置内容高度 */
@keyframes slideBGtUp {
from {
background: transparent;
}
to {
background: rgba(0, 0, 0, 0.1);
}
}
@keyframes slideBGDown {
from {
background: rgba(0, 0, 0, 0.1);
}
to {
background: transparent;
}
}
/* 显示或关闭内容时动画 */
.openBG {
animation: slideBGtUp 0.5s ease-in both;
/* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */
}
.closeBG {
animation: slideBGDown 0.5s ease-in both;
/* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */
}
/* 设置显示内容 */
.showContent {
display: block;
}
.hideContent {
display: none;
}
/* 弹出或关闭动画来动态设置内容高度 */
@keyframes slideContentUp {
from {
height: 0;
}
to {
height: 520rpx;
}
}
@keyframes slideContentDown {
from {
height: 520rpx;
}
to {
height: 0;
}
}
/* 显示或关闭内容时动画 */
.open {
animation: slideContentUp 0.5s ease-in both;
/* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */
}
.closes {
animation: slideContentDown 0.5s ease-in both;
/* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */
}

6
pages/new/new.js

@ -35,7 +35,7 @@ Page({
select: select, select: select,
sort: sort, sort: sort,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
shopList: data.pro, shopList: data.pro,
@ -183,7 +183,7 @@ Page({
sort: sort, sort: sort,
page: page page: page
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
that.setData({ that.setData({
shopList: data.pro, shopList: data.pro,
@ -212,7 +212,7 @@ Page({
select: select, select: select,
sort: sort, sort: sort,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
if (data.pro == '' || data.status == 0) { if (data.pro == '' || data.status == 0) {
that.setData({ that.setData({

4
pages/order/detail.js

@ -110,8 +110,8 @@ Page({
//离开界面时清除定时器 //离开界面时清除定时器
clearInterval(this.data.timeout); clearInterval(this.data.timeout);
util.getUesrBgplus(this, app, false) // util.getUesrBgplus(this, app, false)
util.getUesrBgplus(this, app, true) // util.getUesrBgplus(this, app, true)
}, },
// 选择支付方式 // 选择支付方式
switchChange: function (e) { switchChange: function (e) {

10
pages/order/pay.js

@ -105,8 +105,8 @@ Page({
}, },
onUnload() { //onUnload监听页面卸载 onUnload() { //onUnload监听页面卸载
var that = this; var that = this;
util.getUesrBgplus(that, app, true) //刷新显示购物车数量 // util.getUesrBgplus(that, app, true) //刷新显示购物车数量
util.getUesrBgplus(that, app, false) //刷新显示购物车数量 // util.getUesrBgplus(that, app, false) //刷新显示购物车数量
var cartid = that.data.cartId var cartid = that.data.cartId
var type = that.data.type var type = that.data.type
if (type == 1) { //直接结算离开页面清除购物车数量 if (type == 1) { //直接结算离开页面清除购物车数量
@ -150,7 +150,7 @@ Page({
that.setData({ that.setData({
dz_stu: false, dz_stu: false,
}); });
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
wx.navigateTo({ wx.navigateTo({
url: '../order/pay?cartId=' + that.data.cartId, url: '../order/pay?cartId=' + that.data.cartId,
}) })
@ -218,7 +218,7 @@ Page({
}); });
if (status == 0) { if (status == 0) {
setTimeout(function () { setTimeout(function () {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
@ -226,7 +226,7 @@ Page({
} else { } else {
setTimeout(function () { setTimeout(function () {
util.getUesrBgplus(that, app, false) // util.getUesrBgplus(that, app, false)
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })

378
pages/product/detail.js

@ -155,104 +155,83 @@ Page({
console.log(app.globalData.userInfo, 'openid') console.log(app.globalData.userInfo, 'openid')
// if (openid) { // if (openid) {
var bgcolor = app.d.bgcolor; var bgcolor = app.d.bgcolor;
wx.setNavigationBarColor({ // wx.setNavigationBarColor({
frontColor: app.d.frontColor, // frontColor: app.d.frontColor,
backgroundColor: bgcolor, // 页面标题为路由参数 // backgroundColor: bgcolor, // 页面标题为路由参数
animation: { // animation: {
duration: 400, // duration: 400,
timingFunc: 'easeIn' // timingFunc: 'easeIn'
} // }
}); // });
console.log(that.data.userid)
wx.request({ WXAPI.productIndex({
url: app.d.ceshiUrl + '&action=product&m=index', accessId: app.globalData.accessId,
method: 'post', storeId: 239,
data: { pro_id: that.data.productId,
pro_id: that.data.productId, vipSource: 0
openid: openid, }).then(res => {
type1: that.data.type1,//判断是抽奖还是其他活动 if (res.code == 200) {
choujiangid: that.data.choujiangid, var data = res.data;
role: that.options.role ? that.options.role : '', var pro = data.pro;
size: that.data.size, var content = pro.content;
userid: that.data.userid WxParse.wxParse('content', 'html', content, that, 5);
}, that.setData({
header: { bgcolor: bgcolor,
'Content-Type': 'application/x-www-form-urlencoded' itemData: pro,
}, kucun: pro.num,
success: function (res) { bannerItem: pro.img_arr,
var status = res.data.status; share: data.share,
var is_shou = res.data.type; title: pro.name,
if (status == 1) { is_zhekou: pro.is_zhekou,
var pro = res.data.pro; comments: data.comments,
var content = pro.content; is_shou: data.type,
WxParse.wxParse('content', 'html', content, that, 5); collection_id: data.collection_id,
that.setData({ choujiangid: that.data.choujiangid,
bgcolor: bgcolor, role: that.data.role ? that.data.role : '',
itemData: pro, qj_price: pro.price,
kucun: pro.num, qj_yprice: pro.vip_yprice,
bannerItem: pro.img_arr, attrList: data.attrList,
share: res.data.share, skuBeanList: data.skuBeanList,
title: pro.name, zhekou: data.zhekou != '' ? data.zhekou : false,
is_zhekou: pro.is_zhekou, });
comments: res.data.comments, // util.getUesrBgplus(that, app, true)
is_shou: res.data.type, that.setData({
collection_id: res.data.collection_id, remind: false
choujiangid: that.data.choujiangid, });
role: that.data.role ? that.data.role : '', //默认选中
qj_price: res.data.qj_price, that.one();
qj_yprice: res.data.qj_yprice, } else if (res.code == 3) {
attrList: res.data.attrList,
skuBeanList: res.data.skuBeanList,
zhekou: res.data.zhekou != '' ? res.data.zhekou : false,
});
util.getUesrBgplus(that, app, true)
that.setData({
remind: false
});
//默认选中
that.one();
} else if (status == 3) {
wx.showToast({
title: res.data.err,
duration: 2000,
});
wx.redirectTo({
url: '../../pages/draw/draw'
});
} else {
util.getUesrBgplus(that, app, true)
util.getUesrBgplus(that, app, false)
wx.switchTab({
url: '../index/index'
})
wx.showToast({
title: res.data.err,
duration: 2000,
});
}
//判断是否收藏
if (is_shou) {
that.setData({
wsc: 'bxs',
sc: 'xs',
})
} else {
that.setData({
wsc: 'xs',
sc: 'bxs',
})
}
},
error: function (e) {
wx.showToast({ wx.showToast({
title: '网络异常!', title: res.message,
duration: 2000, duration: 2000,
}); });
}, wx.redirectTo({
url: '../../pages/draw/draw'
});
} else {
// util.getUesrBgplus(that, app, true)
// util.getUesrBgplus(that, app, false)
wx.switchTab({
url: '../index/index'
})
wx.showToast({
title: res.message,
duration: 2000,
});
}
//判断是否收藏
if (data.type) {
that.setData({
wsc: 'bxs',
sc: 'xs',
})
} else {
that.setData({
wsc: 'xs',
sc: 'bxs',
})
}
}); });
}, },
// 弹窗 // 弹窗
setModalStatus: function (e) { setModalStatus: function (e) {
@ -366,11 +345,13 @@ Page({
}, },
//跳转cart //跳转cart
go_cart: function () { go_cart: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
util.getUesrBgplus(this, app, false) // util.getUesrBgplus(this, app, false)
wx.switchTab({ wx.switchTab({
url: '../cart/cart' url: '../cart/cart'
}) })
@ -568,52 +549,38 @@ Page({
var pro_type = e.target.dataset.type; var pro_type = e.target.dataset.type;
var ptype = e.currentTarget.dataset.type; var ptype = e.currentTarget.dataset.type;
// console.log(ptype, '--jnkmjkl') // console.log(ptype, '--jnkmjkl')
wx.request({ WXAPI.productAddCart({
url: app.d.ceshiUrl + '&action=product&m=add_cart', uid: app.globalData.userInfo.openid,
method: 'post', pid: that.data.productId,
data: { num: that.data.buynum,
uid: app.globalData.userInfo.openid, sizeid: sizeid,
pid: that.data.productId, pro_type: pro_type,
num: that.data.buynum, }).then(res => {
sizeid: sizeid, if (res.code == 200) {
pro_type: pro_type,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
//设置购物车刷新 //设置购物车刷新
app.d.purchase = 1; app.d.purchase = 1;
var data = res.data; var data = res.data;
if (data.status == 1) { var ptype = e.currentTarget.dataset.type;
var ptype = e.currentTarget.dataset.type; if (ptype == 'buynow') {
if (ptype == 'buynow') { wx.redirectTo({
wx.redirectTo({ url: '../order/pay?cartId=' + data.cart_id + '&pid=' + that.data.productId + '&num=' + that.data.buynum + '&type=1',
url: '../order/pay?cartId=' + data.cart_id + '&pid=' + that.data.productId + '&num=' + that.data.buynum + '&type=1', });
}); return;
return;
} else {
wx.showToast({
title: '加入购物车成功',
icon: 'success',
duration: 2000
});
util.getUesrBgplus(that, app, true)
that.setData({
showModalStatus: false
});
}
} else { } else {
wx.showToast({ wx.showToast({
icon: 'loading', title: '加入购物车成功',
title: res.err, icon: 'success',
duration: 2000 duration: 2000
}); });
// util.getUesrBgplus(that, app, true)
that.setData({
showModalStatus: false
});
} }
}, } else {
fail: function () {
wx.showToast({ wx.showToast({
title: '网络异常!', icon: 'loading',
title: res.message,
duration: 2000 duration: 2000
}); });
} }
@ -693,99 +660,70 @@ Page({
}, },
// 添加到收藏 // 添加到收藏
addFavorites: function (e) { addFavorites: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
wx.request({ WXAPI.addFavoritesIndex({
url: app.d.ceshiUrl + '&action=addFavorites&m=index', openid: app.globalData.userInfo.openid,
method: 'post', pid: that.data.productId,
data: { }).then(res => {
openid: app.globalData.userInfo.openid, if (res.code == 200) {
pid: that.data.productId,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
var data = res.data; var data = res.data;
if (data.status == 1) {
wx.showToast({
title: data.succ,
duration: 2000
});
that.setData({
wsc: 'bxs',
sc: 'xs',
collection_id: data.id
})
//变成已收藏,但是目前小程序可能不能改变图片,只能改样式
that.data.itemData.isCollect = false;
} else {
wx.showToast({
title: res.err,
duration: 2000
});
that.setData({
wsc: 'bxs',
sc: 'xs',
})
}
},
fail: function () {
// fail
wx.showToast({ wx.showToast({
title: '网络异常!', title: res.message,
duration: 2000 duration: 2000
}); });
that.setData({
wsc: 'bxs',
sc: 'xs',
collection_id: data.id
})
//变成已收藏,但是目前小程序可能不能改变图片,只能改样式
that.data.itemData.isCollect = false;
} else {
wx.showToast({
title: res.message,
duration: 2000
});
that.setData({
wsc: 'bxs',
sc: 'xs',
})
} }
}); });
}, },
// 取消收藏 // 取消收藏
delFavorites: function (e) { delFavorites: function (e) {
var that = this; var that = this;
wx.request({ WXAPI.removeFavorites({
url: app.d.ceshiUrl + '&action=addFavorites&m=removeFavorites', id: that.data.collection_id,
method: 'post', }).then(res => {
data: { if (res.code == 200) {
id: that.data.collection_id, var data = res;
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
var data = res.data;
if (data.status == 1) {
wx.showToast({
title: data.succ,
duration: 2000
});
//变成未收藏,但是目前小程序可能不能改变图片,只能改样式
that.setData({
wsc: 'xs',
sc: 'bxs',
})
} else {
wx.showToast({
title: res.err,
duration: 2000
});
that.setData({
wsc: 'xs',
sc: 'bxs',
})
}
},
fail: function () {
// fail
wx.showToast({ wx.showToast({
title: '网络异常!', title: res.message,
duration: 2000 duration: 2000
}); });
//变成未收藏,但是目前小程序可能不能改变图片,只能改样式
that.setData({
wsc: 'xs',
sc: 'bxs',
})
} else {
wx.showToast({
title: res.message,
duration: 2000
});
that.setData({
wsc: 'xs',
sc: 'bxs',
})
} }
}); });
}, },
//图片预览 //图片预览
previewImage: function (e) { previewImage: function (e) {
@ -802,9 +740,11 @@ Page({
}, },
add_fromid: function (e) { add_fromid: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var that = this; var that = this;
@ -864,9 +804,11 @@ Page({
}, },
// 弹窗 // 弹窗
set_share: function (e) { set_share: function (e) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
url: '/pages/login/login'
})
} }
var taht = this; var taht = this;
var show_share = taht.data.show_share; var show_share = taht.data.show_share;

6
pages/product/detail.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "商品详情", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "商品详情"
"pop": "../login/login"
}
} }

6
pages/product/detail.wxml

@ -332,10 +332,10 @@
<view class="fl_l w60"> <view class="fl_l w60">
<form bindsubmit="add_fromid" report-submit='true'> <form bindsubmit="add_fromid" report-submit='true'>
<button class="w50 fl_l white" style="background: #f7c747;font-size: 15px;line-height: 50px;color: #fff;padding:0;" form-type="submit" type="default" data-type="addcart" data-status="1">加入购物车</button> <button class="w50 fl_l white" style="background: #f7c747;font-size: 15px;line-height: 50px;color: #fff;padding:0;" form-type="submit" type="default" data-type="addcart" data-status="1">加入购物车</button>
<!-- wx:if="{{cart==0}}" -->
<button class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" form-type="submit" type="default" data-type="buynow" data-status="1">立刻购买</button>
<button wx:if="{{cart==0}}" class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" form-type="submit" type="default" data-type="buynow" data-status="1">立刻购买</button> <!-- <button wx:if="{{cart>0}}" class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" bindtap="Settlement" >购物车结算</button> -->
<button wx:if="{{cart>0}}" class="w50 fl_l white" style="background: #ec612a;padding:0;font-size: 15px;line-height: 50px;color: #fff;" bindtap="Settlement" >购物车结算</button>
</form> </form>

3
pages/search/search.json

@ -1,3 +0,0 @@
{
"navigationBarTitleText": "搜索"
}

87
pages/user/user.js

@ -37,7 +37,8 @@ Page({
], ],
cont: 1, cont: 1,
remind: '加载中', remind: '加载中',
tjr: false, tjr: false,
user:'',
}, },
//下拉刷新 //下拉刷新
onPullDownRefresh: function () { onPullDownRefresh: function () {
@ -61,14 +62,14 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.setNavigationBarColor({ // wx.setNavigationBarColor({
frontColor: app.d.frontColor, // frontColor: app.d.frontColor,
backgroundColor: app.d.bgcolor, //页面标题为路由参数7a896c app.d.bgcolor // backgroundColor: app.d.bgcolor, //页面标题为路由参数7a896c app.d.bgcolor
animation: { // animation: {
duration: 400, // duration: 400,
timingFunc: 'easeIn' // timingFunc: 'easeIn'
} // }
}); // });
var plug_ins = app.globalData.userInfo.plug_ins; // 插件 var plug_ins = app.globalData.userInfo.plug_ins; // 插件
this.setData({ this.setData({
bgcolor: app.d.bgcolor, // 背景颜色 bgcolor: app.d.bgcolor, // 背景颜色
@ -98,36 +99,37 @@ Page({
requestMyData: function () { requestMyData: function () {
var that = this; var that = this;
WXAPI.appIndex({
})
WXAPI.userIndex({ WXAPI.userIndex({
openid: app.globalData.userInfo.openid || '', accessId: app.globalData.accessId,
referee_openid: app.globalData.userInfo.referee_openid || '' storeId: 239,
storeType: 1,
mobile:'',
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res.data;
if (data.user.wx_name == 'undefined') { if (data.data) {
that.setData({ that.setData({
userlogin: true user: data.data.user,
}); // article: data.data.article,
that.login(); logo: data.data.logo,
} else { company: data.data.company,
that.setData({ th: data.data.th,
user: data.user, dfh_num: data.data.dfh_num,
article: data.article, dfk_num: data.data.dfk_num,
logo: data.logo, dpj_num: data.data.dpj_num,
company: data.company, dsh_num: data.data.dsh_num,
th: data.th, // plug_ins: data.data.plug_ins,
dfh_num: data.dfh_num, // tjr: data.data.tjr,
dfk_num: data.dfk_num, // support: data.data.support
dpj_num: data.dpj_num,
dsh_num: data.dsh_num,
plug_ins: data.plug_ins,
tjr: data.tjr,
support: data.support
}); });
} }
} else { } else {
wx.showToast({ wx.showToast({
title: '非法操作!', title: '访问失败!',
duration: 2000 duration: 2000
}); });
} }
@ -141,17 +143,20 @@ Page({
}) })
}, },
login: function () { login: function () {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
this.requestMyData(); wx.navigateTo({
return url: '/pages/login/login'
} })
}
}, },
jumpgo: function (event) { jumpgo: function (event) {
if (app.userlogin(1)) { var isLogin = wx.getStorageSync('isLogin')
this.pop.clickPup(this) if (!isLogin) {
return wx.navigateTo({
} url: '/pages/login/login'
})
}
let url = event.currentTarget.dataset.id let url = event.currentTarget.dataset.id
wx.navigateTo({ wx.navigateTo({
url: url url: url

6
pages/user/user.json

@ -1,6 +1,4 @@
{ {
"navigationBarTitleText": "个人中心", "usingComponents": {},
"usingComponents": { "navigationBarTitleText": "个人中心"
"pop": "../login/login"
}
} }

6
pages/user/user.wxml

@ -29,10 +29,10 @@
<view class='user_top' style="background-color:{{bgcolor}}"> <view class='user_top' style="background-color:{{bgcolor}}">
<view class='user_top_two'> <view class='user_top_two'>
<image style='display:block;' class='user_top_image' src="{{user.headimgurl ? user.headimgurl:'../../images/heads.png'}}" /> <image style='display:block;' class='user_top_image' src="{{user.headimgurl ? user.headimgurl:'/images/heads.png'}}" />
<block wx:if="{{ user.user_id }}"> <block wx:if="{{user.mobile}}">
<view class='user_mc' bindtap="copyText" data-text="{{user.user_id}}" style='display:block;'> <view class='user_mc' bindtap="copyText" data-text="{{user.user_id}}" style='display:block;'>
<view>{{user.wx_name}}</view> <view>{{user.user_name}}</view>
<text class='username_font'>用户ID:{{user.user_id}}</text> <text class='username_font'>用户ID:{{user.user_id}}</text>
<text class='username_font' wx:if="{{tjr}}" style="margin-left: 16px;">{{tjr}}</text> <text class='username_font' wx:if="{{tjr}}" style="margin-left: 16px;">{{tjr}}</text>

2
pages/user/user.wxss

@ -19,7 +19,7 @@ text{
/* margin-top:-35px; */ /* margin-top:-35px; */
font-size:32px; font-size:32px;
margin-left:35px; margin-left:35px;
color: #fff; color: #333333;
} }
.user_top{ .user_top{
height:420rpx; height:420rpx;

3
project.private.config.json

@ -2,7 +2,8 @@
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E4%BA%92%E5%88%A9%E5%95%86%E5%9F%8E", "projectname": "%E4%BA%92%E5%88%A9%E5%95%86%E5%9F%8E",
"setting": { "setting": {
"compileHotReLoad": true "compileHotReLoad": true,
"urlCheck": false
}, },
"libVersion": "2.20.2" "libVersion": "2.20.2"
} }

90
utils/server.js

@ -1,12 +1,12 @@
//小程序开发api接口 //小程序开发api接口
const API_BASE_URL = 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0' const API_BASE_URL = 'https://mall.gylservice.com/gw?module=app'
const requestServer = (url, method, data) => { const requestServer = (url, method, data) => {
let _url = API_BASE_URL + url let _url = API_BASE_URL + url
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var userInfo = wx.getStorageSync('userInfo'); var userInfo = wx.getStorageSync('userInfo');
var token = userInfo.token; var token = userInfo.token;
var openid = wx.getStorageSync('openid'); var accessId = wx.getStorageSync('accessId');
// console.log('token:' + token); // console.log('token:' + token);
wx.request({ wx.request({
url: _url, url: _url,
@ -14,8 +14,9 @@ const requestServer = (url, method, data) => {
data: data, data: data,
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
token: token, // accessId: accessId,
openid: openid, language: '',
"Accept": "*/*",
}, },
dataType: 'json', dataType: 'json',
success(res) { success(res) {
@ -57,42 +58,64 @@ module.exports = {
appIndex: (data) => { //获取用户会话密钥 appIndex: (data) => { //获取用户会话密钥
return requestServer('&action=app&m=index', 'post', data) return requestServer('&action=app&m=index', 'post', data)
}, },
homeIndex: (data) => { //首页 /* 首页 */
return requestServer('&action=Index&m=index', 'post', data) homeIndex: (data) => { //首页
return requestServer('&action=index&app=index', 'post', data)
}, },
appCart: (data) => { newArrivalIndex: (data) => { //新品上市
return requestServer('&action=index&app=new_arrival', 'post', data)
},
recommendIndex: (data) => { //好物优选
return requestServer('&action=index&app=recommend', 'post', data)
},
productIndex: (data) => { //商品详情
return requestServer('&action=product&app=index', 'post', data)
},
/* 分类 */
searchIndex: (data) => { //分类页
return requestServer('&action=search&app=index', 'post', data)
},
/* 购物车 */
appCart: (data) => { //
return requestServer('&action=app&m=cart', 'post', data) return requestServer('&action=app&m=cart', 'post', data)
}, },
cartIndex: (data) => { //购物车
return requestServer('&action=cart&app=index', 'post', data)
},
/* 我的 */
userIndex: (data) => { //个人中心
return requestServer('&action=user&app=index', 'post', data)
},
/* 登录 */
login: (data) => { //登录
return requestServer('&action=login&app=login', 'post', data)
},
productSaveFormid: (data) => { productSaveFormid: (data) => {
return requestServer('&action=product&m=save_formid', 'post', data) return requestServer('&action=product&m=save_formid', 'post', data)
}, },
userMaterial: (data) => { //用户信息 userMaterial: (data) => { //
return requestServer('&action=user&m=material', 'post', data) return requestServer('&action=user&m=material', 'post', data)
}, },
indexGetMore: (data) => { //更多 indexGetMore: (data) => { //更多
return requestServer('&action=Index&m=get_more', 'post', data) return requestServer('&action=index&app=get_more', 'post', data)
}, },
newProduct: (data) => { //新品 newProduct: (data) => { //新品
return requestServer('&action=product&m=new_product', 'post', data) return requestServer('&action=product&m=new_product', 'post', data)
}, },
searchIndex: (data) => { //搜索页
return requestServer('&action=search&m=index', 'post', data)
},
productToCollection: (data) => { productToCollection: (data) => {
return requestServer('&action=product&m=to_Collection', 'post', data) return requestServer('&action=product&m=to_Collection', 'post', data)
}, },
userIndex: (data) => { //个人中心
return requestServer('&action=user&m=index', 'post', data)
},
productUpcart: (data) => { productUpcart: (data) => {
return requestServer('&action=product&m=up_cart', 'post', data) return requestServer('&action=product&m=up_cart', 'post', data)
}, },
productDelAllCart: (data) => { //清空 productDelAllCart: (data) => { //清空
return requestServer('&action=product&m=delAll_cart', 'post', data) return requestServer('&action=product&m=delAll_cart', 'post', data)
}, },
productShopping: (data) => { // productShopping: (data) => {
return requestServer('&action=product&m=Shopping', 'post', data) // return requestServer('&action=product&m=Shopping', 'post', data)
}, // },
productDelcart: (data) => { //删除 productDelcart: (data) => { //删除
return requestServer('&action=product&m=delcart', 'post', data) return requestServer('&action=product&m=delcart', 'post', data)
}, },
@ -129,5 +152,36 @@ module.exports = {
addressUpAdds: (data) => { //修改地址 addressUpAdds: (data) => { //修改地址
return requestServer('&action=address&m=up_adds', 'post', data) return requestServer('&action=address&m=up_adds', 'post', data)
}, },
envelopeIndex: (data) => { //
return requestServer('&action=envelope&m=index', 'post', data)
},
envelopeShare: (data) => { //
return requestServer('&action=envelope&m=share', 'post', data)
},
appUser: (data) => { //
return requestServer('&action=app&m=user', 'post', data)
},
getcodeProductShare: (data) => { //
return requestServer('&action=getcode&m=product_share', 'post', data)
},
userPerfectIndex: (data) => { //
return requestServer('&action=user&m=perfect_index', 'post', data)
},
userSecretKey: (data) => { //
return requestServer('&action=user&m=secret_key', 'post', data)
},
userPerfect: (data) => { //
return requestServer('&action=user&m=perfect', 'post', data)
},
productAddCart: (data) => { //
return requestServer('&action=product&m=add_cart', 'post', data)
},
addFavoritesIndex: (data) => { //
return requestServer('&action=addFavorites&m=index', 'post', data)
},
removeFavorites: (data) => { //
return requestServer('&action=addFavorites&m=removeFavorites', 'post', data)
},
} }

23
utils/util.js

@ -14,28 +14,11 @@ function formatNumber(n) {
return n[1] ? n : '0' + n return n[1] ? n : '0' + n
} }
function getUesrBg(that) {
WXAPI.appCart({
openid: app.globalData.userInfo.openid,
}).then(res => {
if (res.status == 1) {
var data = res;
var num = data.cart.toString()
if (num > 0) {
wx.setTabBarBadge({
index: 3,
text: num,
})
}
}
});
}
function getUesrBgplus(that, app, is) { function getUesrBgplus(that, app, is) {
WXAPI.appCart({ WXAPI.appCart({
openid: app.globalData.userInfo.openid, openid: app.globalData.userInfo.openid,
}).then(res => { }).then(res => {
if (res.status == 1) { if (res.code == 200) {
var data = res; var data = res;
if (is) { if (is) {
that.setData({ that.setData({
@ -64,13 +47,11 @@ function getUesrBgplus(that, app, is) {
*/ */
function getUrl() { function getUrl() {
//如果不想安装后台服务,请使用注释这一行做简单数据体验 //如果不想安装后台服务,请使用注释这一行做简单数据体验
return 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0' return 'http://192.168.0.73:18001'
// return 'http://localhost/open/app/LKT/index.php?module=api&software_name=3&edition=1.0'
} }
module.exports = { module.exports = {
formatTime: formatTime, formatTime: formatTime,
getUesrBg: getUesrBg,
getUesrBgplus: getUesrBgplus, getUesrBgplus: getUesrBgplus,
getUrl: getUrl getUrl: getUrl
} }

Loading…
Cancel
Save