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

18
app.json

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

4
app.wxss

@ -1,10 +1,10 @@
/**app.wxss**/
page {
background: #fff; font-family: '微软雅黑';
background: #fff;
height:100%;
width:100%;
font-family: "Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif;
}
.container {
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({
openid: app.globalData.userInfo.openid,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
var sheng = data.sheng;
var shi = data.shi;
@ -137,7 +137,7 @@ Page({
WXAPI.getCityArr({
count: count,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
that.setData({
shi: data.shi
@ -157,7 +157,7 @@ Page({
count: count,
column: column,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
that.setData({
xian: data.xian
@ -178,7 +178,7 @@ Page({
shi: rew[1],
xuan: rew[2]
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
var province = data.province;
var city = data.city;
@ -233,7 +233,7 @@ Page({
county: e.detail.value.county,
address: e.detail.value.address
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
wx.showToast({
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="county" value="{{county}}" />
<view class="section_right" bindtap="translate">
<image src="../../images/x_right.png"></image>
<image src="/images/x_right.png"></image>
</view>
<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,
id_arr: carts
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
wx.showToast({
title: '地址已清空',
@ -92,7 +92,7 @@ Page({
WXAPI.addressIndex({
openid: app.globalData.userInfo.openid
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
var address = data.adds;
if (address == '') {
@ -219,7 +219,7 @@ Page({
openid: app.globalData.userInfo.openid,
addr_id: addrId
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
var cartId = that.data.cartId;
if (cartId != '0' || cartId == 'group') {
@ -258,7 +258,7 @@ Page({
openid: app.globalData.userInfo.openid,
id_arr: addrId
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
that.DataonLoad();
} else {
wx.showToast({
@ -278,7 +278,7 @@ Page({
WXAPI.addressIndex({
openid: app.globalData.userInfo.openid,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
var address = data.adds;
that.numbers = data.adds;

14
pages/address/upaddress.js

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

150
pages/article/article.js

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

187
pages/bangding/bangding.js

@ -124,58 +124,41 @@ Page({
date: date
});
var that = this;
wx.request({
url: app.d.ceshiUrl + '&action=user&m=perfect_index',
method: 'post',
data: {
user_id: app.globalData.userInfo.user_id
},
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;
WXAPI.userPerfectIndex({
user_id: app.globalData.userInfo.user_id
}).then(res => {
if (res.code == 200) {
var data = res;
var items = that.data.items;
for (var i = 0; i < items.length; i++) {
if (items[i].name == data.sex) {
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
var items = that.data.items;
for (var i = 0; i < items.length; i++) {
if (items[i].name == data.sex) {
items[i].checked = true;
} 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: ''
});
}
},
error: function (e) {
wx.showToast({
title: '网络异常!',
duration: 2000
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 {
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,
content: '同意授权',
success: function (res) {
wx.request({
url: app.d.ceshiUrl + '&action=user&m=secret_key',
method: 'post',
data: {
encryptedData: encryptedData, // 加密数据
iv: iv, // 加密算法
sessionId: app.globalData.userInfo.session_key
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
var status = res.data.status;
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
});
WXAPI.userSecretKey({
encryptedData: encryptedData, // 加密数据
iv: iv, // 加密算法
sessionId: app.globalData.userInfo.session_key
}).then(res => {
if (res.code == 200) {
var data = res;
that.setData({
islogin: true,
mobile: data.info
})
} else {
app.getUserInfo(that, res_d);
}
})
});
}
})
}
@ -265,50 +234,34 @@ Page({
})
wx.hideToast()
} else {
wx.request({
url: app.d.ceshiUrl + '&action=user&m=perfect',
method: 'post',
data: {
user_id: app.globalData.userInfo.user_id,
name: res.detail.value.name,
mobile: that.data.mobile,
province: province,
city: city,
county: county,
wx_id: res.detail.value.wx_id,
sex: sex,
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) {
WXAPI.userPerfect({
user_id: app.globalData.userInfo.user_id,
name: res.detail.value.name,
mobile: that.data.mobile,
province: province,
city: city,
county: county,
wx_id: res.detail.value.wx_id,
sex: sex,
date: that.data.date,
}).then(res => {
if (res.code == 200) {
var data = res;
wx.showToast({
title: '网络异常!',
duration: 2000
title: res.message,
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,
cart_id: cart_id
}).then(res => {
if (res.status == 1) {
util.getUesrBgplus(that, app, false)
if (res.code == 200) {
// util.getUesrBgplus(that, app, false)
// 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据
@ -82,13 +82,13 @@ Page({
WXAPI.productDelAllCart({
user_id: that.data.user_id,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
wx.showToast({
title: '操作成功!',
duration: 2500
});
that.loadProductData();
util.getUesrBgplus(that, app, false)
// util.getUesrBgplus(that, app, false)
} else {
wx.showToast({
title: '操作失败!',
@ -169,8 +169,8 @@ Page({
user_id: that.data.user_id,
carts: toastStr,
}).then(res => {
util.getUesrBgplus(that, app, false)
if (res.status == 1) {
// util.getUesrBgplus(that, app, false)
if (res.code == 200) {
wx.showToast({
title: '操作成功!',
duration: 2000
@ -200,8 +200,8 @@ Page({
num: num,
cart_id: cart_id
}).then(res => {
if (res.status == 1) {
util.getUesrBgplus(that, app, false)
if (res.code == 200) {
// util.getUesrBgplus(that, app, false)
// 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据
@ -325,10 +325,10 @@ Page({
bgcolor: app.d.bgcolor,
user_id: app.globalData.userInfo.openid
});
wx.setNavigationBarColor({
frontColor: app.d.frontColor,//
backgroundColor: app.d.bgcolor //页面标题为路由参数
});
// wx.setNavigationBarColor({
// frontColor: app.d.frontColor,//
// backgroundColor: app.d.bgcolor //页面标题为路由参数
// });
this.loadProductData();
this.sum();
},
@ -355,8 +355,8 @@ Page({
res.confirm && WXAPI.productDelcart({
carts: carts,
}).then(res => {
util.getUesrBgplus(that, app, false)
if (res.status == 1) {
// util.getUesrBgplus(that, app, false)
if (res.code == 200) {
that.loadProductData();
}
else {
@ -380,18 +380,24 @@ Page({
// 数据加载
loadProductData: function () {
var that = this;
WXAPI.productShopping({
user_id: app.globalData.userInfo.openid
WXAPI.cartIndex({
accessId: app.globalData.accessId,
storeId: 239,
page: 1
}).then(res => {
if (res.status == 1) {
var data = res;
if (res.code == 200) {
var data = res.data;
that.setData({
carts: data.cart,
carts: data.list,
selectedAllStatus: false,
total: '¥0.00',
remind: ''
});
} else {
wx.showToast({
title: res.message,
duration: 2000
});
}
});
},
@ -412,7 +418,7 @@ Page({
num: num,
cart_id: carid
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
// 只有大于一件的时候,才能normal状态,否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 购物车数据

1
pages/cart/cart.json

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

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

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

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

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

8
pages/coupon/index.js

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

7
pages/coupon/index.json

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

42
pages/distribution/detail.js

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

6
pages/distribution/detail.json

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

28
pages/group_buy/cantuan.js

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

6
pages/group_buy/cantuan.json

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

4
pages/group_buy/cantuan.wxml

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

57
pages/group_buy/detail.js

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

6
pages/group_buy/detail.json

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

6
pages/group_buy/group.json

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

194
pages/index/index.js

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

4
pages/index/index.json

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

202
pages/index/index.wxml

@ -1,3 +1,4 @@
<!--pages/index/index.wxml-->
<view class="page">
<!-- 加载页面开始 -->
<view class="body" wx:if="{{remind}}">
@ -26,7 +27,7 @@
</view>
<!-- 加载页面结束 -->
<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="input-box">
@ -43,25 +44,46 @@
</view>
</view>
</form>
<view class='tab'>
</form> -->
<!-- <view class='tab'>
<scroll-view scroll-x="true" class="tab-h" scroll-left="{{scrollLeft}}">
<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'>
<text class='tab-text'>{{item.name}}</text>
<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.pname}}</text>
</view>
</view>
</scroll-view>
<view class='searchWrap' bindtap='searchView'>
<image class="search-icon1" src="/images/icon-search.png"></image>
</view>
</view>
<swiper class='out' current='{{current}}' autoplay="{{false}}" bindchange="contentChange">
<swiper-item wx:for="{{twoList}}" wx:for-item="item" wx:key="id">
<scroll-view scroll-y="true" bindscrolltolower="obm">
</view> -->
<!-- 顶部导航栏 -->
<!-- <view class="container_top_item" style="height: 88rpx;">
<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">
<navigator url='{{item.url}}'>
<swiper-item>
@ -72,25 +94,12 @@
</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}}">
<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}}">
<!-- wx:if="{{item.id > 0 && item.icons.length >0}}" -->
<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>
<image class='img' src="{{icons.img}}"></image>
<image class='img' src="{{icons.appimg}}"></image>
</view>
<view style='width:100%;'>
<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>
<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
<block wx:for="{{inforList}}"wx:key="key">
@ -111,58 +120,121 @@
</navigator>
</block>
</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">
<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" style="margin-bottom: 38rpx;">
<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>
<view class="twos_cont" wx:elif="{{index==0}}">
<block wx:for="{{indexTwoData}}" wx:for-item="twos" wx:key="id">
<navigator class="pr" url="../product/detail?productId={{twos.id}}" hover-class="changestyle">
<image class="photo" src="{{twos.imgurl}}"></image>
<view class="title">{{twos.product_title}}</view>
</view>
<view class="content_top-box">
<navigator url="../new/new?type=2" 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="{{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 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="{{twos.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.xp == 1}}">新品</text>
<text style="padding:0px 4px 0 0;" wx:if="{{item.rexiao == 1}}">热销</text>
<text style="padding:0px 4px 0 0;" wx:if="{{item.tuijian == 1}}">推荐</text>
</view>
</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style=" color: red;">¥ {{twos.price}}
<!--原价:¥{{twos.price_yh}}-->
</view>
<view class="ku" style="width:70%">销量:{{twos.volume}}</view>
<view class="gmxx" style=" color: red;">¥ {{item.price}}原价:¥{{item.price_yh}}</view>
<view class="ku" style="width:70%">销量:{{item.volume}}</view>
</view>
</navigator>
</block>
</view>
</block>
</view>
<view class="cont" wx:else>
<block wx:for="{{item.twodata}}" wx:for-item="twodata" wx:key="id">
<navigator class="pr" url="../product/detail?productId={{twodata.id}}" hover-class="changestyle">
<image class="photo" src="{{twodata.imgurl}}"></image>
<view class="title">{{twodata.name}}</view>
</view> -->
<!-- wx:else -->
<view class="cont">
<!-- 分类导航 -->
<scroll-view class="scroll-view_x" scroll-x="true" style="width:auto;overflow:hidden;">
<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 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="{{twodata.rexiao == 1}}">热销</text>
<text style="padding:0px 2px;" wx:if="{{twodata.tuijian == 1}}">推荐</text>
<text style="padding:0px 2px;" wx:if="{{list.xp == 1}}">新品</text>
<text style="padding:0px 2px;" wx:if="{{list.rexiao == 1}}">热销</text>
<text style="padding:0px 2px;" wx:if="{{list.tuijian == 1}}">推荐</text>
</view>
</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style=" color: red;">¥ {{twodata.price_yh}}</view>
<view class="ku" style="width:60%">销量:{{twodata.volume}}</view>
<view class="gmxx" style=" color: red;">¥ {{list.price}}</view>
<view class="ku" style="width:60%">销量:{{list.volume}}</view>
</view>
</navigator>
</block>
</view>
<!-- 分类商品结束 -->
<view style="display: flex;" wx:if="{{loading}}">
<view class="spinner" style='margin:20px auto;'>
@ -187,15 +259,17 @@
</view>
</view>
<view wx:if="{{item.twodata == ''}}" class='tishi'>
<view wx:if="{{titleList[current].list == ''}}" class='tishi'>
<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 style='font-size:13px;color:#666;'>没有更多数据了</view>
<view style='font-size:13px;color:#666;padding-bottom:50rpx'>没有更多数据了</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<!-- </swiper-item>
</swiper> -->
</view>
<view wx:if="{{zjList_box}}" class='zjList_box'>
<view class='zjList'>

374
pages/index/index.wxss

@ -38,9 +38,6 @@
.clearfix{
clear: both;
}
.swiper-box{
width: 100%;
}
.vipBlock{
background-color: #fff;
height: 60rpx;
@ -113,16 +110,17 @@
}
page {
flex-direction: column;
font-family: '微软雅黑';
height: 100%;
width: 100%;
display:flex;
background:#eee;
background-color:#f4f5f6;
overflow-y: auto;
}
.page{
height:100%;
width:100%;
}
.tab-h{
height: 100rpx;
width: 100%;
@ -133,32 +131,23 @@ page {
background: #F7F7F7;
font-size: 16px;
white-space: nowrap;
/* position: fixed;
top: 0;
left: 0;
z-index: 99; */
}
.tab-text{
padding:0 5px;
text-align: center;
}
.out scroll-view{
scroll-view{
width: 100%;
height: 100%;
overflow-y: scroll;
/* overflow-y: scroll; */
}
.tablist {
/* .tablist {
display: flex;
background: #f5f5f5;
height: 100rpx;
transform:translate3d(0,0,0);
}
swiper {
display:block;
width: 95%;
margin: 0 auto;
height:180px;
}
.tablist .item {
flex: auto;
@ -168,34 +157,44 @@ swiper {
align-items: center;
font-size: 11pt;
color: #353535;
}
} */
.tablist .item.select {
color: #FF6347;
/* .tablist .item.select {
color: #FF6347;
}
.select .tab-text{
border-bottom: 2px solid #FF6347;
}
border-bottom: 2px solid #FF6347;
} */
.content{
height: 0px;
display: flex;
justify-content: center;
align-items: center;
height: 0px;
display: flex;
justify-content: center;
align-items: center;
}
.out{
flex: auto;
width: 100%;
height: 100%;
flex: auto;
width: 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 {
overflow: auto;
-webkit-overflow-scrolling: touch;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.slide-image {
width: 100%;
height: 100%;
@ -250,9 +249,9 @@ swiper {
padding-top: 15rpx;
}
.cont {
width: 95%;
width: 100%;
margin: 0 auto;
padding-top: 10rpx;
/* padding-top: 10rpx; */
}
.cont_0 {
width: 100%;
@ -331,10 +330,10 @@ swiper {
padding: 1% 5% 0 5%;
font-weight: 700;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
}
.gmxx {
padding-left:20rpx;
@ -374,11 +373,13 @@ display:-webkit-box;
color: #666;
}
.icons {
/* height: 370rpx; */
padding: 20rpx 10rpx;
padding-bottom: 0;
.section {
width: 100%;
margin: 0 auto;
background:#fff;
margin-bottom:15rpx;
margin-top: 10rpx;
}
.icons swiper-item {
@ -391,15 +392,19 @@ display:-webkit-box;
}
.icons{
float:left;
display:flex;
/* flex-direction:column; */
align-items:center;
flex-wrap:wrap;
width:98%;
text-align:center;
margin:10rpx 0;
align-content:flex-start;
padding: 20rpx 10rpx;
padding-bottom: 0;
margin-top: 10rpx;
display:flex;
/* flex-direction:column; */
align-items:center;
flex-wrap:wrap;
width:93%;
text-align:center;
margin:10rpx 0;
align-content:flex-start;
margin-left: 2.5%;
background-color: #f4f5f6;
}
.icons .icon image {
@ -413,18 +418,22 @@ align-content:flex-start;
font-size: 12px;
/* line-height: 2; */
}
.unit{
height: 40%;
vertical-align: top;
margin-left: -15rpx;
display:flex;
align-items:center;
justify-content: center;
flex-wrap: wrap;
width: 20%;
text-align: center;
margin: 10rpx 0;
.icon {
height: 40%;
vertical-align: top;
display:flex;
align-items:center;
justify-content: center;
flex-wrap: wrap;
width: 20%;
text-align: center;
margin: 10rpx 0;
}
.img{
height: 100%;
width: 100%;
}
.units{
display:flex;
align-items:center;
@ -435,16 +444,7 @@ align-content:flex-start;
justify-content:space-around;
box-shadow: 3px 3px 3px #ccc;
}
.unit image {
margin:0 auto;
width:55px;
height:55px;
}
.unit view {
width: 100%;
height:100%;
}
.icon {
.unit{
height: 40%;
vertical-align: top;
margin-left: -15rpx;
@ -456,23 +456,23 @@ align-content:flex-start;
text-align: center;
margin: 10rpx 0;
}
.img{
height: 95%;
width: 95%;
.unit image {
margin:0 auto;
width:55px;
height:55px;
}
.unit view {
width: 100%;
height:100%;
}
.class_p{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.section {
width: 95%;
margin: 0 auto;
background:#fff;
margin-bottom:15rpx;
margin-top: 10rpx;
}
@font-face {font-family: "iconfont";
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.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{
/* width:150rpx; */
text-align:center;
@ -644,14 +650,14 @@ button{
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 .title { margin: 0 40rpx; }
.title-bar .title-line { display: inline-block; height: 2rpx; width: 30rpx; background: #bbb; }
.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 wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; }
.flex-y-center {
.title-bar wx-navigator wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; } */
/* .flex-y-center {
display:-webkit-box;
display:-webkit-flex;
display:flex;
@ -660,9 +666,9 @@ button{
-ms-flex-align:center;
-ms-grid-row-align:center;
align-items:center;
}
} */
.flex-x-center {
/* .flex-x-center {
display:-webkit-box;
display:-webkit-flex;
display:flex;
@ -670,7 +676,7 @@ button{
-webkit-justify-content:center;
-ms-flex-pack:center;
justify-content:center;
}
} */
.vipText2_img{
height: 100%;
@ -730,4 +736,188 @@ button{
white-space:nowrap;
overflow:hidden;
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({
data: {
navTab: [{'type':'验证码登录','status':0},{'type':'密码登录','status':1}],
currentIndex: 1,
click: false, //是否显示弹窗内容
option: false, //显示弹窗或关闭弹窗的操作动画
logoimg: '',
loadtitle:'',
thvm:{}
},
myCatchTouch: function () {
return;
thvm:{},
account: '',
password: '',
},
//密码登录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(){
wx.showToast({
@ -46,7 +61,6 @@ Page({
})
}, 500)
} else {
_that.setData({
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) {
let that = this;
@ -99,8 +79,8 @@ Page({
console.log(e.detail.userInfo)
if (e.detail.errMsg == 'getUserInfo:ok') {
//获取成功设置状态
app.globalData.userlogin = true;
wx.setStorageSync('userlogin', true);
app.globalData.isLogin = true;
wx.setStorageSync('isLogin', true);
//设置用户信息本地存储
try {
wx.setStorageSync('userInfo', e.detail.userInfo);
@ -113,7 +93,7 @@ Page({
}
that.setData({
userlogin: false
isLogin: false
})
that.getOP(e.detail.userInfo)
@ -125,58 +105,94 @@ Page({
})
//没有授权需要弹框
that.setData({
userlogin: true
isLogin: true
});
}
},
login: function () {
var that = this;
//取出本地存储用户信息,解决需要每次进入小程序弹框获取用户信息
var userInfo = wx.getStorageSync('userInfo');
wx.login({
success: res => {
app.globalData.code = res.code
wx.setStorageSync('code', res.code)
},
fail: function () {
wx.showToast({
title: '系统提示:网络错误!',
icon: 'warn',
duration: 1500,
})
}
accountInput: function(e) {
this.setData({
valueId: "nickname",
account: e.detail.value
})
wx.getSetting({
success: (res) => {
//没有授权需要弹框
if (!res.authSetting['scope.userInfo']) {
that.setData({
userlogin: true
});
} else {
//判断用户已经授权。不需要弹框
if (app.globalData.userlogin) {
that.setData({
userlogin: false
})
app.globalData.userlogin = true;
wx.setStorageSync('userlogin', true);
} else {
that.setData({
userlogin: true
});
}
}
},
fail: function () {
},
passwordInput: function(e) {
this.setData({
valueId: "nickname",
password: e.detail.value
})
},
login: function () {
var that = this;
WXAPI.login({
storeId: 239,
phone: that.data.account,
password: that.data.password,
}).then(res => {
if (res.code == 200) {
var data = res.data
app.globalData.accessId = data.access_id;
wx.setStorageSync('accessId', data.access_id)
wx.setStorageSync('isLogin', true);
wx.setStorageSync('userInfo', data.data);
wx.navigateBack()
// wx.showToast({
// title: '登录成功!',
// success: 2000
// });
} else {
wx.showToast({
title: '系统提示:网络错误!',
icon: 'warn',
title: res.message,
icon: 'none',
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) {
//提交用户信息 获取用户id

2
pages/login/login.json

@ -1,4 +1,4 @@
{
"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'>
<image src="../../images/logonsgb.png" catchtap="setCloses"></image>
<view class="pupContent-body">
<view class="pupContent-head">
<image src="{{ logoimg }}"></image>
<view>欢迎来到{{ loadtitle }}</view>
<view class="top-tab">
<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="top-tab-line{{currentIndex==idx?'Active':''}}"></view>
</view>
<view class="pupContent-title">
为提供更优质的服务,需要获取以下信息:
</view>
<view class="pupContent-con">
<view>· 你的公开信息(昵称、头像等)</view>
</view>
<!--密码登录-->
<view class='login'>
<!-- 用户名 -->
<view class="userCs">
<image src="/images/user.png" class="user"></image>
<input placeholder="请输入账号/手机号" type="text" bindinput="accountInput" />
</view>
<view>
<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>
<!-- 密码 -->
<view class=passwordCs">
<image src="/images/pass.png" class="pass"></image>
<input placeholder="请输入密码" type="password" bindinput="passwordInput" />
</view>
<!-- <button open-type="getPhoneNumber" hidden="{{false}}" lang="zh_CN" bindgetphonenumber="bindPhoneNumber">微信一键登录</button> -->
<view class="loginView" bindtap="login">登录</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>

280
pages/login/login.wxss

@ -1,160 +1,122 @@
.pupContentBG {
width: 100vw !important;
height: 100vh !important;
position: fixed !important;
top: 0 !important;
page{
background-color: #F4F5F6;
}
.top-tab{
/* 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,
sort: sort,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
that.setData({
shopList: data.pro,
@ -183,7 +183,7 @@ Page({
sort: sort,
page: page
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
that.setData({
shopList: data.pro,
@ -212,7 +212,7 @@ Page({
select: select,
sort: sort,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
if (data.pro == '' || data.status == 0) {
that.setData({

4
pages/order/detail.js

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

10
pages/order/pay.js

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

378
pages/product/detail.js

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

6
pages/product/detail.json

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

6
pages/product/detail.wxml

@ -332,10 +332,10 @@
<view class="fl_l w60">
<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>
<!-- 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>

3
pages/search/search.json

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

87
pages/user/user.js

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

6
pages/user/user.json

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

6
pages/user/user.wxml

@ -29,10 +29,10 @@
<view class='user_top' style="background-color:{{bgcolor}}">
<view class='user_top_two'>
<image style='display:block;' class='user_top_image' src="{{user.headimgurl ? user.headimgurl:'../../images/heads.png'}}" />
<block wx:if="{{ user.user_id }}">
<image style='display:block;' class='user_top_image' src="{{user.headimgurl ? user.headimgurl:'/images/heads.png'}}" />
<block wx:if="{{user.mobile}}">
<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' wx:if="{{tjr}}" style="margin-left: 16px;">{{tjr}}</text>

2
pages/user/user.wxss

@ -19,7 +19,7 @@ text{
/* margin-top:-35px; */
font-size:32px;
margin-left:35px;
color: #fff;
color: #333333;
}
.user_top{
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",
"projectname": "%E4%BA%92%E5%88%A9%E5%95%86%E5%9F%8E",
"setting": {
"compileHotReLoad": true
"compileHotReLoad": true,
"urlCheck": false
},
"libVersion": "2.20.2"
}

90
utils/server.js

@ -1,12 +1,12 @@
//小程序开发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) => {
let _url = API_BASE_URL + url
return new Promise((resolve, reject) => {
var userInfo = wx.getStorageSync('userInfo');
var token = userInfo.token;
var openid = wx.getStorageSync('openid');
var accessId = wx.getStorageSync('accessId');
// console.log('token:' + token);
wx.request({
url: _url,
@ -14,8 +14,9 @@ const requestServer = (url, method, data) => {
data: data,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: token,
openid: openid,
// accessId: accessId,
language: '',
"Accept": "*/*",
},
dataType: 'json',
success(res) {
@ -57,42 +58,64 @@ module.exports = {
appIndex: (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)
},
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) => {
return requestServer('&action=product&m=save_formid', 'post', data)
},
userMaterial: (data) => { //用户信息
userMaterial: (data) => { //
return requestServer('&action=user&m=material', 'post', data)
},
indexGetMore: (data) => { //更多
return requestServer('&action=Index&m=get_more', 'post', data)
return requestServer('&action=index&app=get_more', 'post', data)
},
newProduct: (data) => { //新品
return requestServer('&action=product&m=new_product', 'post', data)
},
searchIndex: (data) => { //搜索页
return requestServer('&action=search&m=index', 'post', data)
},
productToCollection: (data) => {
return requestServer('&action=product&m=to_Collection', 'post', data)
},
userIndex: (data) => { //个人中心
return requestServer('&action=user&m=index', 'post', data)
},
productUpcart: (data) => {
return requestServer('&action=product&m=up_cart', 'post', data)
},
productDelAllCart: (data) => { //清空
return requestServer('&action=product&m=delAll_cart', 'post', data)
},
productShopping: (data) => {
return requestServer('&action=product&m=Shopping', 'post', data)
},
// productShopping: (data) => {
// return requestServer('&action=product&m=Shopping', 'post', data)
// },
productDelcart: (data) => { //删除
return requestServer('&action=product&m=delcart', 'post', data)
},
@ -129,5 +152,36 @@ module.exports = {
addressUpAdds: (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
}
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) {
WXAPI.appCart({
openid: app.globalData.userInfo.openid,
}).then(res => {
if (res.status == 1) {
if (res.code == 200) {
var data = res;
if (is) {
that.setData({
@ -64,13 +47,11 @@ function getUesrBgplus(that, app, is) {
*/
function getUrl() {
//如果不想安装后台服务,请使用注释这一行做简单数据体验
return 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0'
// return 'http://localhost/open/app/LKT/index.php?module=api&software_name=3&edition=1.0'
return 'http://192.168.0.73:18001'
}
module.exports = {
formatTime: formatTime,
getUesrBg: getUesrBg,
getUesrBgplus: getUesrBgplus,
getUrl: getUrl
}

Loading…
Cancel
Save