Browse Source

产品列表显示修复

master
杜叶春 2 years ago
parent
commit
7f24889f22
  1. 5
      app.json
  2. 5
      app.wxss
  3. BIN
      images/delete.png
  4. BIN
      images/grxx.png
  5. BIN
      images/icon_xiahua.png
  6. BIN
      images/syss.png
  7. BIN
      images/xjt.png
  8. BIN
      images/zhiding.png
  9. 11
      pages/article/article.js
  10. 170
      pages/chooseArea/chooseArea.js
  11. 4
      pages/chooseArea/chooseArea.json
  12. 46
      pages/chooseArea/chooseArea.wxml
  13. 153
      pages/chooseArea/chooseArea.wxss
  14. 21
      pages/distribution/detail.js
  15. 7
      pages/group_buy/detail.js
  16. 104
      pages/index/index.js
  17. 3
      pages/index/index.json
  18. 304
      pages/index/index.wxml
  19. 243
      pages/index/index.wxss
  20. 10
      pages/listdetail/listdetail.js
  21. 3
      pages/listdetail/listdetail.json
  22. 66
      pages/login/login.js
  23. 11
      pages/login/login.wxml
  24. 47
      pages/login/login.wxss
  25. 68
      pages/login/register.js
  26. 3
      pages/login/register.json
  27. 5
      pages/login/register.wxml
  28. 19
      pages/login/register.wxss
  29. 66
      pages/mchList/mchList.js
  30. 6
      pages/mchList/mchList.json
  31. 2
      pages/mchList/mchList.wxml
  32. 1
      pages/mchList/mchList.wxss
  33. 122
      pages/new/new.js
  34. 2
      pages/new/new.json
  35. 171
      pages/new/new.wxml
  36. 129
      pages/new/new.wxss
  37. 21
      pages/product/detail.js
  38. 2
      pages/product/detail.wxml
  39. 6
      pages/set/set.js
  40. 14
      utils/server.js

5
app.json

@ -45,7 +45,10 @@
"pages/live/index",
"pages/distribution/list",
"pages/distribution/user",
"pages/distribution/detail"
"pages/distribution/detail",
"pages/mchList/mchList",
"pages/chooseArea/chooseArea",
"pages/login/register"
],
"window": {
"backgroundTextStyle": "light",

5
app.wxss

@ -10,11 +10,8 @@ page {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
font-family: '微软雅黑'
font-family: '微软雅黑';
}
.df{
display: -webkit-box;

BIN
images/delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/grxx.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
images/icon_xiahua.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

BIN
images/syss.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

BIN
images/xjt.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 605 B

BIN
images/zhiding.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

11
pages/article/article.js

@ -180,16 +180,7 @@ Page({
wx.getSetting({
success(res) {
console.log(res)
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
console.log('授权成功')
}
})
} else {
console.log('qqqqq')
}
}
})

170
pages/chooseArea/chooseArea.js

@ -0,0 +1,170 @@
// pages/chooseArea/chooseArea.js
var app = getApp();
var WXAPI = require('../../utils/server.js');
Page({
/**
* 页面的初始数据
*/
data: {
searchKey: '',
city_list: {},
area_list: [],
choose_area: [],
seeAreaFlag: false,
filterKey: '',
level: 0,
region: '',
GroupID: '',
titleKey: 'A',
scrollKey: 'A',
},
getLocation(groupID) {
var that = this;
WXAPI.getLocation({
accessId: app.globalData.accessId,
GroupID: groupID
}).then(res => {
if (res.code == 200) {
var data = res.data
that.setData({
city_list: data.list,
area_list: data.xian,
})
}
});
},
seeAreaClick(){
var that = this;
that.setData({
seeAreaFlag: !that.data.seeAreaFlag
})
},
searchInput: function(e) {
this.setData({
searchKey: e.detail.value
})
},
cleardata() {
console.log('1111')
this.setData({
searchKey: ''
})
},
search() {
var that = this;
var result_list = []
var city_list = that.data.city_list
for (var i = 0; i < city_list.length; i++) {
city_list[i].filter(item=>{
if(item.G_CName.includes(that.data.searchKey)) {
result_list.push(item)
}
})
}
that.setData({
filterKey: that.data.searchKey,
city_list: result_list
})
},
changeTitle(e){
var that = this;
that.setData({
titleKey: e.currentTarget.dataset.key,
scrollKey: e.currentTarget.dataset.key,
})
},
clickArea(e){
var that = this;
var data = e.currentTarget.dataset
// var choose_area = []
// that.setData({
// choose_area: choose_area.splice(0,1,data.item),
// GroupID: data.item.GroupID
// })
// that.data.choose_area = choose_area.splice(0,1,data.item)
var region = {
city: data.item.G_CName,
city_GroupID: data.item.GroupID,
// district: that.data.choose_area[1].G_CName,
// district_GroupID: that.data.choose_area[1].GroupID,
}
wx.setStorageSync('region',region)
// that.getLocation(that.data.choose_area[1].GroupID)
wx.navigateBack()
},
contentScroll(e){
var offset = e.detail.scrollTop;
var lineHeight;
var that = this;
var cityarr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z']
var city_list = that.data.city_list
// for (var i in cityarr) {
// lineHeight = city_list[cityarr[i]].length*40;
// }
var index = parseInt(offset / 660);
that.setData({
titleKey: cityarr[index]
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var that = this;
var region = wx.getStorageSync('region')
that.setData({
region: region,
})
that.getLocation(region.city_GroupID)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

4
pages/chooseArea/chooseArea.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "选择地区"
}

46
pages/chooseArea/chooseArea.wxml

@ -0,0 +1,46 @@
<!--pages/chooseArea/chooseArea.wxml-->
<view class="container">
<view class="topBox">
<view class="searchBox">
<view class="searchBox_left">
<image class='searchImg' src="/images/icon-search.png"></image>
<input type="text" value="{{searchKey}}" placeholder="请输入城市名称" bindinput="searchInput"/>
<view wx:if="{{searchKey}}" bindtap="cleardata">
<image class="cancel" src="/images/delete.png" mode=""></image>
</view>
</view>
<view class="searchBox_btn" bindtap="search">搜索</view>
</view>
<view class="area">
<view class="area_left">
<text>当前位置:</text>
<view class="area_left_item" wx:if="{{choose_area.length>0}}">
<text wx:for="{{choose_area}}" wx:key="index">{{item.G_CName}}</text>
</view>
<view wx:else>{{region.city}}</view>
</view>
<view class="area_right" bindtap="seeAreaClick">
<text>切换区县</text>
<image src="/images/xjt.png"></image>
</view>
</view>
<view class="areaItemBox" wx:if="{{seeAreaFlag}}">
<view class="areaItem" wx:for="{{area_list}}" wx:key="index" data-item="{{item}}" bindtap="clickArea">{{item.G_CName}}</view>
</view>
</view>
<scroll-view class="content" scroll-y="true" bindscroll="contentScroll" scroll-into-view="{{scrollKey}}" scroll-with-animation="true">
<view class="list-table" wx:for="{{city_list}}" id="{{index}}" wx:key="index">
<view class="listTitle" wx:if="{{!filterKey}}">{{index}}</view>
<view wx:for="{{city_list[index]}}" wx:key="index">
<view class="list" wx:if="{{!item.G_CName.includes(filterKey)}}" wx:key="index" data-item="{{item}}" bindtap="clickArea">{{item.G_CName}}</view>
</view>
</view>
<view class="listRight" wx:if="{{!filterKey}}">
<view wx:for="{{city_list}}" wx:key="key" class="{{index == titleKey?'active': ''}}" data-key="{{index}}" bindtap="changeTitle">{{index}}</view>
</view>
</scroll-view>
</view>

153
pages/chooseArea/chooseArea.wxss

@ -0,0 +1,153 @@
/* pages/chooseArea/chooseArea.wxss */
.container{
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
.searchBox{
display: flex;
width: 100%;
padding: 6rpx 0 17rpx 30rpx;
box-sizing: border-box;
background-color: #fff;
}
.searchBox_btn{
display: flex;
align-items: center;
justify-content: center;
height: 68rpx;
padding: 0 30rpx 0 20rpx;
font-size: 28rpx;
}
.searchBox .searchBox_left {
position: relative;
flex: 1;
display: flex;
align-items: center;
height: 68rpx;
border-radius: 40rpx;
padding-left: 69rpx;
box-sizing: border-box;
background-color: #F4F5F6;
}
.searchBox_left image{
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 20rpx;
width: 30rpx;
height: 30rpx;
}
.searchBox_left .cancel{
width: 35rpx;
height: 35rpx;
left: 570rpx;
z-index: 10;
}
.searchBox_left input{
width: 100%;
font-size: 28rpx;
color: #020202;
}
.area{
display: flex;
align-items: center;
height: 84rpx;
padding: 0 30rpx;
font-size: 28rpx;
}
.area_left{
display: flex;
align-items: center;
}
.area_left_item{
max-width: 370rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.area_right{
display: flex;
align-items: center;
margin-left: auto;
}
.area_right text{
font-size: 26rpx;
color: #666666;
}
.area_right image{
width: 20rpx;
height: 12rpx;
margin-left: 10rpx;
}
.areaItemBox{
display: flex;
flex-wrap: wrap;
padding: 12rpx 0 0 30rpx;
max-height: 450rpx;
overflow-y: auto;
}
.areaItemBox .areaItem{
display: flex;
align-items: center;
justify-content: center;
min-width: 210rpx;
padding: 0 20rpx;
height: 80rpx;
background: #FFFFFF;
border: 1px solid #E6E6E6;
border-radius: 4rpx;
box-sizing: border-box;
margin-right: 30rpx;
margin-bottom: 30rpx;
font-size: 28rpx;
color: #0F0F1C;
}
.areaItemBox .areaItem.active{
background-color: #F4F4F4;
}
.content{
position: relative;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.content .listRight{
position: fixed;
right: 0;
top: 260rpx;
}
.listRight view{
font-size: 24rpx;
padding: 8rpx 18rpx;
color: #999999;
}
.listRight view.active{
color: #020202;
}
.content .listTitle{
display: flex;
align-items: center;
height: 54rpx;
background: #F8F8F8;
padding: 0 30rpx;
font-size: 30rpx;
color: #999999;
}
.content .list{
display: flex;
align-items: center;
height: 80rpx;
padding: 0 30rpx;
margin-right: 70rpx;
font-size: 30rpx;
border-bottom: 1px solid #E6E6E6;
}
.content .list.active{
background-color: #F4F4F4;
}

21
pages/distribution/detail.js

@ -885,26 +885,7 @@ Page({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
console.log('授权成功')
},
fail: function (res) {
wx.openSetting({
success: (res) => {
res.authSetting = {
"scope.userInfo": true,
"scope.userLocation": true,
"scope.writePhotosAlbum": true
}
}
})
}
})
} else {
}

7
pages/group_buy/detail.js

@ -795,12 +795,7 @@ Page({
success(res) {
console.log(res)
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
console.log('授权成功')
}
})
} else {
console.log('qqqqq')
}

104
pages/index/index.js

@ -6,6 +6,7 @@ var WXAPI = require('../../utils/server.js');
var util = require('../../utils/util.js')
Page({
data: {
barHeight: wx.getSystemInfoSync().statusBarHeight,
pop: null,
inforList: [], //公告
banner: [],
@ -30,14 +31,20 @@ Page({
zjList: {},
zjList_box: false,
cart: 0, //购物车数量
// mainHeight: 0,
region: '',
latitude: 28.227965,
longitude: 112.951227,
},
//下拉事件
onPullDownRefresh: function () {
var that = this;
that.getMore();
},
navToArea: function () {
wx.navigateTo({
url: "../chooseArea/chooseArea?"
})
},
imgW: function (e) {
var $width = e.detail.width, //获取图片真实宽度
$height = e.detail.height,
@ -67,23 +74,22 @@ Page({
cid: cid,
}).then(res => {
if (res.code == 200) {
var data = res.data;
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
that.setData({
loading: false,
});
var data = res.data;
if (data == '') {
return false;
that.setData({
loading: false,
});
return;
} else {
var titleList = that.data.titleList;
titleList[current].list.push(...prolist)
var indexList = titleList[0].list
that.setData({
loading: false,
titleList: titleList,
indexList: indexList
});
}
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
}
});
},
@ -150,34 +156,21 @@ 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;
// }
WXAPI.homeIndex({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
latitude: 28.227965,
longitude: 112.951227,
latitude: that.data.latitude,
longitude: that.data.longitude,
}).then(res => {
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
that.setData({
inforList: data.notice, //滚动公告条
banner: data.banner, // 轮播图
titleList: titleList,
indexList: indexList,
r_mch: data.r_mch, //优选店铺
plug: data.nav_list, //首页类型模块
mch_name: data.title,
@ -202,7 +195,7 @@ Page({
}
});
//新品上市
WXAPI.newArrivalIndex({
WXAPI.newArrival({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
@ -215,7 +208,7 @@ Page({
}
});
//好物优选
WXAPI.recommendIndex({
WXAPI.recommend({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
@ -228,6 +221,24 @@ Page({
}
});
},
navigatorAct: function(e) {
var data = e.currentTarget.dataset
wx.navigateTo({
url:"/pages/new/new?title="+data.title,
})
},
//找相似
discoverSimilarProducts: function (e) {
var goodsId = e.currentTarget.dataset;
wx.navigateTo({
// url:"/pages/detail/detail?id="+goodsId.id
})
},
navToMchList: function (e) {
wx.navigateTo({
url:"../mchList/mchList"
})
},
onHide: function () {
clearTimeout();
},
@ -338,6 +349,9 @@ Page({
that.onLoad();
app.d.indexchase = false;
}
that.setData({
region: wx.getStorageSync('region')
})
// util.getUesrBgplus(that, app, false)
},
onReady: function () {
@ -363,33 +377,6 @@ Page({
})
},
//获取用户信息新接口
agreeGetUser: function (e) {
let that = this
if (e.detail.errMsg == 'getUserInfo:ok') {
//获取成功设置状态
app.globalData.isLogin = true;
wx.setStorageSync('isLogin', true);
//设置用户信息本地存储
try {
wx.setStorageSync('userInfo', e.detail.userInfo);
} catch (e) {
wx.showToast({
title: '系统提示:网络错误!',
icon: 'warn',
duration: 1500,
})
}
wx.showLoading({
title: '加载中...',
duration: 1500,
})
that.setData({
isLogin: false
})
that.getOP(e.detail.userInfo)
}
},
login: function () {
var that = this;
//取出本地存储用户信息,解决需要每次进入小程序弹框获取用户信息
@ -478,11 +465,16 @@ Page({
})
}
}
wx.navigateTo({
url: event.currentTarget.dataset.path,
})
},
zhiding() {
wx.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
onShareAppMessage: function (res) {
var that = this;
var id = that.data.productId;

3
pages/index/index.json

@ -1,4 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "互利商城"
"navigationBarTitleText": "互利商城",
"navigationStyle": "custom"
}

304
pages/index/index.wxml

@ -58,58 +58,58 @@
</view>
</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" style="padding-top:{{barHeight + 40}}rpx; padding-bottom:10rpx;">
<view class="container_top_item_left" bindtap="navToArea">
{{region.city?region.city:'常州市'}}
<image src="/images/icon_xiahua.png" 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_center" bindtap="toUrl('/pagesA/search/search')">
<image src="/images/syss.png" lazy-load="true"></image>
搜索你想要的商品
</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="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 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">
<!-- /首页轮播图/ -->
<!-- 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>
<image src="{{item.image}}" id="{{item.id}}" class="slide-image" width="100%" height="200" />
</swiper-item>
</navigator>
</block>
</swiper>
<!-- /首页轮播图结束/ -->
<scroll-view scroll-y="true" bindscrolltolower="obm">
<!-- /首页菜单/ -->
<!-- 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.appimg}}"></image>
</view>
<view style='width:100%;'>
<text class="menu-width">{{icons.name}}</text>
</view>
<!-- /首页轮播图/ -->
<!-- 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>
<image src="{{item.image}}" id="{{item.id}}" class="slide-image" width="100%" height="200" />
</swiper-item>
</navigator>
</view>
<!-- /首页菜单结束/ -->
</block>
</swiper>
<!-- /首页轮播图结束/ -->
<!--滚动公告条开始 -->
<!-- <view class='in_news' wx:if="{{item.id==0 && inforList.length > 0}}">
<!-- /首页菜单/ -->
<!-- wx:if="{{item.id > 0 && item.icons.length >0}}" -->
<view class="section icons">
<navigator class="icon" url="../listdetail/listdetail?id={{icons.id}}&title={{icons.name}}" hover-class="changestyle" wx:for="{{plug}}" wx:for-item="icons" wx:key="id" data-id="{{icons.id}}">
<view>
<image class='img' src="{{icons.appimg}}"></image>
</view>
<view style='width:100%;'>
<text class="menu-width">{{icons.name}}</text>
</view>
</navigator>
</view>
<!-- /首页菜单结束/ -->
<!--滚动公告条开始 -->
<!-- <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">
@ -121,72 +121,69 @@
</block>
</swiper>
</view> -->
<!-- 滚动公告条结束 -->
<!-- 滚动公告条结束 -->
<!-- 好物优选 -->
<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>
<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 class="content_top" style="margin-bottom: 38rpx;">
<view class="content_top-box" data-title="新品上市" bindtap="navigatorAct">
<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>
</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 class="content_top-box" data-title="好物优选" bindtap="navigatorAct">
<!-- <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="navToMchList">
<text>更多</text>
<image src="/images/x_right.png" lazy-load="true"></image>
</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 class="mch_content">
<view class="mch_content_item" wx:for="{{r_mch}}" wx:for-item="item" wx:key="id" bindtap="navToMchList">
<image src="{{item.logo}}" lazy-load="true" mode="aspectFill"></image>
<view>{{item.name}}</view>
<text>{{item.distance}}km</text>
</view>
</view>
<!-- 优选店铺结束 -->
<!-- 会员权益 -->
<!-- @click="vipclick" -->
<view style="width: 100%;height: 200rpx;" wx:if="{{memberPlugin}}">
</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">
</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">
<navigator class="productView" 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;">
@ -197,7 +194,7 @@
</view>
</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style=" color: red;">¥ {{item.price}}原价:¥{{item.price_yh}}</view>
<view class="gmxx" style="color: red;">¥ {{item.price}}原价:¥{{item.price_yh}}</view>
<view class="ku" style="width:70%">销量:{{item.volume}}</view>
</view>
</navigator>
@ -205,68 +202,70 @@
</view>
</block>
</view> -->
<!-- wx:else -->
<view class="cont">
<!-- wx:else -->
<view class="cont">
<!-- 分类导航 -->
<scroll-view class="scroll-view_x" scroll-x="true" style="width:auto;overflow:hidden;">
<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 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="{{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;">¥ {{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;'>
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
<block wx:for="{{titleList[current].list}}" wx:for-item="list" wx:key="id">
<navigator class="productView" url="../product/detail?productId={{list.id}}" hover-class="changestyle">
<image class="photo" src="{{list.imgurl}}"></image>
<view class="title">{{list.product_title}}</view>
<view class="gstatus">{{list.s_type_list[0].name}}</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx">¥ {{list.price}}</view>
<view class="ku">已售{{list.volume}}件</view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
<view style="display:flex;">
<view class="goods_shopBox">
<image class="goods_shop" src="{{list.logo}}"></image>
<text>{{list.mch_name}}</text>
</view>
<view class="discover" data-id="{{list.id}}" bindtap="discoverSimilarProducts">找相似</view>
</view>
</navigator>
</block>
</view>
<!-- 分类商品结束 -->
<view style="display: flex;" wx:if="{{loading}}">
<view class="spinner" style='margin:20px auto;'>
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
</view>
<view wx:if="{{titleList[current].list == ''}}" class='tishi'>
<view>
<!-- wx:if="{{titleList[current].list == ''}}" -->
<view class='tishi'>
<!-- <view>
<image class='scimg' style="margin-top: 15%;margin-bottom: 5%;" src='/images/search_no.png'></image>
</view>
<view style='font-size:13px;color:#666;padding-bottom:50rpx'>没有更多数据了</view>
</view>
</scroll-view>
</view> -->
<view style='font-size:27rpx;color:#999;padding-top:20rpx;padding-bottom:50rpx;font-family: serif;'>~ 我是有底线的 ~</view>
</view>
</scroll-view>
<!-- </swiper-item>
</swiper> -->
</view>
@ -275,13 +274,14 @@
<view class='zjList'>
<view class="swiper_item">
<image src='{{headimgurl}}' class='zjList_img'></image>
恭喜{{user_name}}获得{{pname}}</view>
恭喜{{user_name}}获得{{pname}}
</view>
</view>
</view>
</block>
</view>
<image class="zhiding" src="/images/zhiding.png" bindtap="zhiding"></image>
<!--模态弹窗-->
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
<view class="modalDlg" wx:if="{{showModal && sign_status == 1}}">

243
pages/index/index.wxss

@ -1,3 +1,16 @@
page {
flex-direction: column;
height: 100%;
width: 100%;
display:flex;
background-color:#f4f5f6;
overflow-y: auto;
/* font-family: serif; */
}
.page{
height:100%;
width:100%;
}
.in_news{
width:95%;
height:80rpx;
@ -35,51 +48,12 @@
display:block;
}
.clearfix{
clear: both;
}
.vipBlock{
background-color: #fff;
height: 60rpx;
line-height: 60rpx;
width: 95%;
margin: 0 auto;
margin-bottom: 16rpx;
box-shadow: 3px 3px 3px #ccc;
}
.vipText1{
float: left;
color: #000;
font-size: 28rpx;
padding-left: 10rpx;
}
.vipText2{
float: right;
height:80%;
position:relative;
top:10%;
text-align:center;
font-size:24rpx;
background-color:pink;
border-radius:10rpx;
line-height:48rpx;
margin-right:10rpx;
display:flex;
justify-content:center;
padding:0 10px;
}
.dot{
width: 25rpx;
height: 8rpx;
margin-right: 20rpx;
background-color: white;
}
.activeD{
width: 25rpx;
height: 8rpx;
background-color: coral;
}
.dots{
width: 156rpx;
height: 36rpx;
@ -100,7 +74,6 @@
height: 100%;
display: flex;
align-items: center;
}
.search-icon1{
width: 40rpx;
@ -108,19 +81,84 @@
display: inline-block;
margin: 0 auto;
}
page {
flex-direction: column;
height: 100%;
width: 100%;
display:flex;
background-color:#f4f5f6;
overflow-y: auto;
.container_top_item {
position: fixed;
display: flex;
align-items: center;
height: 190rpx;
padding: 0rpx 30rpx;
box-sizing: border-box;
z-index: 999;
background: transparent;
width: 100vw;
background-color: #fff;
/* background-color: #f4f5f6; */
}
.page{
height:100%;
width:100%;
.container_top_item_left {
display: flex;
align-items: center;
color: #000000;
font-size: 32rpx;
white-space: nowrap;
}
.container_top_item_left image {
width: 30rpx;
height: 30rpx;
margin-left: 6rpx;
}
.container_top_item_center {
/* search */
display: flex;
align-items: center;
width: 350rpx;
height: 66rpx;
padding: 0 20rpx;
border-radius: 33rpx;
margin-left: 20rpx;
box-sizing: border-box;
font-size: 24rpx;
color: #999999;
/* background-color: #fff; */
background-color: #f4f5f6;
}
.container_top_item_center image {
width: 32rpx;
height: 32rpx;
margin-right: 13rpx;
}
.container_top_item_right {
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin-left: 20rpx;
width: 66rpx;
height: 66rpx;
/* // background: rgba(255, 255, 255, 1); */
border-radius: 33rpx;
}
.container_top_item_right image {
width: 48rpx;
height: 48rpx;
}
.container_top_item_right view {
position: absolute;
right: -7rpx;
top: 6rpx;
padding: 4rpx 6rpx;
background: #fa5151;
border-radius: 12rpx;
font-size: 22rpx;
line-height: 16rpx;
color: #FFFFFF;
}
.tab-h{
height: 100rpx;
width: 100%;
@ -174,15 +212,17 @@ scroll-view{
}
.out{
padding-top: 190rpx;
flex: auto;
width: 100%;
height: 100%;
}
swiper {
margin-top: 20rpx;
display:block;
width: 100%;
margin: 0 auto;
/* margin: 0 auto; */
height:150px;
}
.swiper-box{
@ -253,29 +293,15 @@ swiper {
margin: 0 auto;
/* padding-top: 10rpx; */
}
.cont_0 {
width: 100%;
}
.cont_0 .pr {
margin-bottom:10px;
background:#fff;
display:inline-block;
width:46%;
margin-left:20rpx;
}
.cont_0_box{
padding:5px 0;
text-align:center;
color:#333;
background:#fff;
}
.cont .pr {
.cont .productView {
margin-bottom:10px;
background:#fff;
display:inline-block;
width:46%;
margin-left:20rpx;
font-size:13px;
border-radius: 10rpx;
overflow: hidden;
}
.cont_image {
width: 100%;
@ -285,34 +311,43 @@ swiper {
.cont .title {
font-size: 28rpx;
color: #333;
line-height: 20px;
line-height: 28px;
margin: 0;
height: 40px;
max-height: 60rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
padding: 1% 5% 0 5%;
padding: 0 20rpx 0 20rpx;
}
.cont .gstatus{
color: #999;
font-size: 21rpx;
margin: 5rpx 20rpx 10rpx 20rpx;
/* border-radius: 40rpx; */
padding: 3rpx 5rpx;
height: 25rpx;
width: 45rpx;
line-height: 25rpx;
text-align: center;
border: 1rpx solid #999;
}
.cont .tit {
/*height: 80rpx;*/
font-size: 12px;
color: #333;
line-height: 20px;
margin: 0;
max-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding: 1% 5% 0 5%;
/*color: #ccc*/
.discover{
display: flex;
align-items: center;
justify-content: center;
width:90rpx;
height:36rpx;
background:#FA9D3B;
border-radius:10rpx 0rpx 0rpx 0rpx;
margin-left: auto;
margin-top: auto;
font-size: 22rpx;
color: #ffffff;
}
.photo{
height:345rpx;
width:100%;
@ -362,17 +397,30 @@ swiper {
font-family: '\5FAE\8F6F\96C5\9ED1', arial, "\5b8b\4f53";
}
.gmxx{
font-size: 14px;
color: #d9002f;
font-size: 15px;
color: #fa5151;
/*padding-top: 10px; */
}
.ku{
text-align: right;
width: 50%; font-size: 26rpx;
width: 50%;
font-size: 23rpx;
margin-right:10rpx;
color: #666;
color: #999;
}
.goods_shopBox{
display: flex;
align-items: center;
margin: 15rpx 20rpx 15rpx;
font-size: 20rpx;
color: #1d1313;
}
.goods_shopBox .goods_shop{
width: 30rpx;
height: 30rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.section {
width: 100%;
margin: 0 auto;
@ -799,8 +847,8 @@ margin-left: 24rpx;
margin-right: 8rpx;
}
.mch_content_item image{
width:198rpx;
height:216rpx;
width:150rpx;
height:150rpx;
border-radius:10rpx 10rpx 0rpx 0rpx;
}
.mch_content_item view{
@ -921,3 +969,10 @@ margin-left: 24rpx;
white-space: nowrap;
font-family: serif;
}
.zhiding{
position: fixed;
right: 30rpx;
bottom: 8%;
width: 104rpx;
height: 104rpx;
}

10
pages/listdetail/listdetail.js

@ -51,14 +51,14 @@ Page({
}
},
onLoad: function (options) {
var objectId = options.class;
var objectId = options.id;
var title = options.title;
//页面初始化 options为页面跳转所带来的参数
if (objectId || title) {
wx.setNavigationBarColor({
frontColor: app.d.frontColor,//
backgroundColor: app.d.bgcolor //页面标题为路由参数
})
// wx.setNavigationBarColor({
// frontColor: app.d.frontColor,//
// backgroundColor: app.d.bgcolor //页面标题为路由参数
// })
//更改头部标题
wx.setNavigationBarTitle({
title: options.title,

3
pages/listdetail/listdetail.json

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

66
pages/login/login.js

@ -121,7 +121,12 @@ Page({
password: e.detail.value
})
},
login: function () {
forgetAct() {
wx.navigateTo({
url: '/pages/login/register?name=找回密码',
})
},
loginAct: function () {
var that = this;
WXAPI.login({
storeId: 239,
@ -135,10 +140,10 @@ Page({
wx.setStorageSync('isLogin', true);
wx.setStorageSync('userInfo', data.data);
wx.navigateBack()
// wx.showToast({
// title: '登录成功!',
// success: 2000
// });
wx.showToast({
title: '登录成功!',
success: 2000
});
} else {
wx.showToast({
title: res.message,
@ -147,52 +152,11 @@ Page({
})
}
});
// 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,
// })
// }
// })
},
registerAct() {
wx.navigateTo({
url: '/pages/login/register?name=注册',
})
},
getOP: function (res) {
//提交用户信息 获取用户id

11
pages/login/login.wxml

@ -1,11 +1,11 @@
<!--pages/index/index.wxml-->
<view class="page">
<view class="top-tab">
<!-- <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>
</view> -->
<!--密码登录-->
<view class='login'>
@ -20,18 +20,17 @@
<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 class="forgetView" bindtap="forgetAct">忘记密码?</view>
<view class="loginView" bindtap="loginAct">登录</view>
<view class="registerView" bindtap="registerAct">注册</view>
</view>
<!--验证码登录-->
<!-- <view class="ather_login">
<view>—— 其他登录方式 ——</view>
<view>
<image :src="wx"></image>
</view>
</view> -->
</view>

47
pages/login/login.wxss

@ -45,14 +45,15 @@ page{
}
.login{
display: flex;
flex-direction:column;
}
/* 图片+输入框+下划线的父容器view */
.userCs{
margin-top: 50rpx;
margin-left: 25rpx;
margin-left: 30rpx;
position: absolute;
display: flex;
width:700rpx ;
width:690rpx ;
height: 110rpx ;
background-color: white;
border-radius: 20rpx;
@ -75,10 +76,10 @@ page{
/* 密码图标+输入框+小眼睛图标+下划线父容器view */
.passwordCs{
margin-top: 190rpx;
margin-left: 25rpx;
margin-left: 30rpx;
position: absolute;
display: flex;
width:700rpx ;
width:690rpx ;
height: 110rpx ;
background-color: white;
border-radius: 20rpx;
@ -105,13 +106,25 @@ page{
margin-left: 30rpx;
line-height: 55rpx;
}
/* 忘记密码 */
.forgetView{
position: absolute;
margin-top: 325rpx;
right: 30rpx;
width: 150rpx;
height: 40rpx;
color: gray;
font-size: 25rpx;
display: flex;
align-items: center;
justify-content: center;
}
.loginView{
/* margin: 300rpx 90rpx 25rpx; */
margin-top: 380rpx;
margin-left: 25rpx;
width: 700rpx;
height: 85rpx;
margin-top: 410rpx;
margin-left: 30rpx;
width: 690rpx;
height: 80rpx;
background-color:#F95B43;
border-radius: 20rpx;
font-size: 32rpx;
@ -120,3 +133,19 @@ page{
align-items: center;
justify-content: center;
}
.registerView{
margin-top: 30rpx;
margin-left: 30rpx;
width: 690rpx;
height: 80rpx;
/* background-color:white; */
border-radius: 20rpx;
border-color: #F95B43;
border-style:solid;
border-width:2rpx;
font-size: 32rpx;
color: #F95B43;
display: flex;
align-items: center;
justify-content: center;
}

68
pages/login/register.js

@ -0,0 +1,68 @@
// pages/login/register.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: options.name,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
pages/login/register.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

5
pages/login/register.wxml

@ -0,0 +1,5 @@
<!--pages/login/register.wxml-->
<view class="container">
<image class="codeImage" src="/images/red_packet_share.png" mode="aspectFill"></image>
<view class="title">请添加上方二维码联系客服注册账号</view>
</view>

19
pages/login/register.wxss

@ -0,0 +1,19 @@
/* pages/login/register.wxss */
page{
background-color: #F4F5F6;
}
.container{
font-size: 30rpx;
width: 100%;
align-items: center;
}
.codeImage{
margin-top: 60rpx;
width: 320rpx;
height: 320rpx;
}
.title{
margin-top: 30rpx;
height: 60rpx;
line-height: 60rpx;
}

66
pages/mchList/mchList.js

@ -0,0 +1,66 @@
// pages/mchList/mchList.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

6
pages/mchList/mchList.json

@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "优选店铺",
"navigationBarBackgroundColor": "#FA5151",
"navigationBarTextStyle": "white"
}

2
pages/mchList/mchList.wxml

@ -0,0 +1,2 @@
<!--pages/mchList/mchList.wxml-->
<text>pages/mchList/mchList.wxml</text>

1
pages/mchList/mchList.wxss

@ -0,0 +1 @@
/* pages/mchList/mchList.wxss */

122
pages/new/new.js

@ -11,8 +11,9 @@ Page({
cont: 1,
remind: '加载中',//进来加载
brandId: 0,
heng:'xs',//控制显示方式
heng:'xs',//控制显示方式
shu:'bxs',
logoUrl: "https://cz-hl-shop.oss-cn-shanghai.aliyuncs.com/239/1/20230227/",
xianshi:'icon-yduipaibanleixingliebiao',
imageurl1: "../../images/mo.png",//默认排序图
daindex1: 0,
@ -24,28 +25,11 @@ Page({
sort: 0,// 1 asc 升序 0 desc 降序
},
onPullDownRefresh: function () {
wx.showNavigationBarLoading() //在标题栏中显示加载
var that = this;
var objectId = that.data.objectId;
var select = that.data.select;
var sort = that.data.sort;
WXAPI.newProduct({
page: 1,
cid: 1,
select: select,
sort: sort,
}).then(res => {
if (res.code == 200) {
var data = res;
that.setData({
shopList: data.pro,
page:2,
period: false
})
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
}
});
that.getMore();
},
/* tab */
choosesort1: function (e) {
@ -176,17 +160,15 @@ Page({
var select = that.data.select;
var sort = that.data.sort;
var page = that.data.page;
//ajax请求数据
WXAPI.newProduct({
cid: 1,
select: select,
sort: sort,
page: page
WXAPI.newArrival({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res;
var data = res.data;
that.setData({
shopList: data.pro,
shopList: data.list,
page: page+1
})
}
@ -206,28 +188,69 @@ Page({
that.setData({
page: page+1
});
WXAPI.newProduct({
page: page,
cid: 1,
select: select,
sort: sort,
if (that.data.title == '新品上市') {
that.getNewArrival()
} else {
that.getRecommend()
}
},
//新品上市
getNewArrival() {
var that = this;
wx.showNavigationBarLoading() //在标题栏中显示加载
WXAPI.newArrival({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res;
if (data.pro == '' || data.status == 0) {
var data = res.data;
//成功返回设置数据
if (data == '') {
that.setData({
period: true,
loading:false
loading: false,
});
return;
} else {
that.setData({
remind: '',
loading:false,
shopList: data.list
// shopList: that.data.shopList.concat(data.list)
});
return false;
}
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
}
});
},
//好物优选
getRecommend() {
var that = this;
wx.showNavigationBarLoading() //在标题栏中显示加载
WXAPI.recommend({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data;
//成功返回设置数据
that.setData({
remind: '',
loading:false,
shopList: that.data.shopList.concat(data.pro)
});
if (data == '') {
that.setData({
loading: false,
});
return;
} else {
that.setData({
remind: '',
loading:false,
shopList: data.list
// shopList: that.data.shopList.concat(data.list)
});
}
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
}
});
},
@ -244,13 +267,16 @@ Page({
},
onLoad: function (options) {
wx.setNavigationBarTitle({
title: options.title,
})
this.setData({
bgcolor: app.d.bgcolor,
title: options.title,
});
wx.setNavigationBarColor({
frontColor: app.d.frontColor,//
backgroundColor: app.d.bgcolor //页面标题为路由参数
})
// wx.setNavigationBarColor({
// frontColor: app.d.frontColor,//
// backgroundColor: app.d.bgcolor //页面标题为路由参数
// })
//页面初始化 options为页面跳转所带来的参数
this.getMore();
},

2
pages/new/new.json

@ -1,3 +1,3 @@
{
"navigationBarTitleText": "新品推荐"
"usingComponents": {}
}

171
pages/new/new.wxml

@ -1,31 +1,31 @@
<!-- 加载页面开始 -->
<view class="body" wx:if="{{remind}}">
<view class='zong'>
<view class="spinner" >
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
<view class='zong'>
<view class="spinner">
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
</view>
</view>
<!-- 加载页面结束 -->
<block wx:else>
<view class='sort-wrap fd'>
<block wx:else>
<!-- <view class='sort-wrap fd'>
<view class="sort-btn {{select == 0 ? 'select' : ''}}" bindtap="default">
最新
</view>
@ -40,46 +40,30 @@
<view class='sort-btn'>
<view class='iconfont {{xianshi}}' bindtap="tabchage"> </view>
</view>
</view>
</view> -->
<view class="list">
<view class="cont" style='padding-top:10px;'>
<view class="{{shu}}">
<navigator class="pr {{shu}}" url="../product/detail?productId={{item.id}}&size={{item.size}}" hover-class="changestyle" wx:for="{{shopList}}" wx:key="*this" data-id="{{item.id}}">
<!-- <view class='photo-c'>
<image class="photo" src="{{item.imgurl}}"></image>
<image class="photo-right" wx:if="{{item.s_type==1}}" src="../../images/new.png"></image>
</view> 不启用样式 右上角 -->
<view class='photo-c'>
<image class="photo" src="{{item.imgurl}}"></image>
</view>
<view class='shu'>
<view class="title">
<text style="font-size:28rpx;width:30%;color:#B82136">新品 </text>
{{item.name}}</view>
<view style="display:flex;line-height:50rpx;;">
<view class="gmxx" style=" color: red;">¥ {{item.price_yh}}</view>
<view class="gmx">¥ {{item.price}}</view>
</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx" style="font-size:28rpx;width:30%">
<!-- <text wx:if="{{item.s_type==2}}">热销</text>
<text >推荐</text> -->
</view>
<view class="ku" style="width:100%">销量:{{item.volume}}</view>
</view>
</view>
</navigator>
<view class="list">
<view class="cont" style='padding-top:10px;'>
<view class="xs">
<navigator class="product xs" url="../product/detail?productId={{item.id}}&size={{item.size}}" hover-class="changestyle" wx:for="{{shopList}}" wx:key="index" data-id="{{item.id}}">
<image class="photo" src="{{item.imgurl}}"></image>
<view class="title">新品 {{item.product_title}}</view>
<view class="gstatus">{{item.s_type_list[0].name}}</view>
<view style="display:flex;line-height:50rpx;color:#999">
<view class="gmxx">¥ {{item.price}}</view>
<view class="ku">已售{{item.volume}}件</view>
</view>
<view style="display:flex;">
<view class="goods_shopBox">
<image class="goods_shop" src="{{logoUrl}}{{item.logo}}"></image>
<text>{{item.mch_name}}</text>
</view>
<view class="discover" data-id="{{item.id}}" bindtap="discoverSimilarProducts">找相似</view>
</view>
<view class="{{heng}}">
</navigator>
</view>
<!-- <view class="{{heng}}">
<navigator class="pr pr_xt" style='display:flex;margin-bottom:0px;width:100%;margin-left:0px;' url="../product/detail?productId={{item.id}}&size={{item.size}}" hover-class="changestyle" wx:for="{{shopList}}" wx:key="*this" data-id="{{item.id}}">
<!-- <view class='photo-c'>
<image class="photo" style='height:220rpx;width:230rpx;margin-left:3px;' src="{{item.imgurl}}"></image>
<image class="photo-right" wx:if="{{item.s_type==1}}" src="../../images/new.png"></image>
</view> 设置右上角图标样式 目前不启用 -->
<view class='photo-c'>
<image class="photo" style='height:220rpx;width:230rpx;margin-left:20rpx;padding-top:20rpx' src="{{item.imgurl}}"></image>
</view>
@ -94,46 +78,43 @@
<view class="gmx" style='text-align:right;'>¥ {{item.price}}</view>
</view>
<view style="display:flex;line-height:50rpx;color:#999">
<!--<view class="gmxx" style="font-size:28rpx;width:30%">
<text>新品</text>
</view> -->
<view class="ku">销量:{{item.volume}}</view>
</view>
</view>
</navigator>
</view>
</view>
<view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}">1</view>
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"></view>
<view class="clear mt10" wx:if="{{period}}" style='border:0;color#666' >-我是有底线的-</view>
</view> -->
</view>
<view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}">1</view>
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"></view>
<view class="clear mt10" wx:if="{{period}}" style='border:0;color:#666'>-我是有底线的-</view>
<block wx:else>
<!-- 显示加载 -->
<view style="display: flex;" wx:if="{{loading}}">
<view class="spinner" style='margin:20px auto;' >
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
<!-- 显示加载 -->
<view style="display: flex;" wx:if="{{loading}}">
<view class="spinner" style='margin:20px auto;'>
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<!-- <view class="clear mt10" wx:else bindtap="getMore">点击查看更多{{loading}}-</view> -->
<view class='goTop' hidden='{{!floorstatus}}' bindtap="goTop">
<image src='../../images/fanhui.png' style='width:20px;height:20px;margin:10px;'></image>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
</view>
<!-- <view class="clear mt10" wx:else bindtap="getMore">点击查看更多{{loading}}-</view> -->
<view class='goTop' hidden='{{!floorstatus}}' bindtap="goTop">
<image src='/images/fanhui.png' style='width:20px;height:20px;margin:10px;'></image>
</view>
</block>
</view>
</view>
</block>

129
pages/new/new.wxss

@ -100,7 +100,7 @@ page {
.list{
background: #eee;
width: 100%;
margin-top: 90rpx;
/* margin-top: 90rpx; */
}
.ban{
width: 46%;
@ -125,8 +125,6 @@ page {
color: gray;
}
.commodity_screen {
width: 100%;
height: 100%;
@ -160,58 +158,73 @@ page {
font-size: 30rpx;
margin-top: 30rpx;
}
.cont .pr {
margin-bottom:10px;
background:#fff;
display:inline-block;
width:46%;
margin-left:20rpx;
.cont {
width: 100%;
margin: 0 auto;
}
.cont .product {
margin-bottom:10px;
background:#fff;
display:inline-block;
width:46%;
margin-left:22rpx;
font-size:13px;
border-radius: 10rpx;
overflow: hidden;
}
.cont_image {
width: 100%;
height: 285rpx;
}
.shu{
padding-left:10px;
padding-right:10px;
}
.cont .title {
font-size: 28rpx;
color: #333;
line-height: 20px;
line-height: 28px;
margin: 0;
height: 40px;
overflow: hidden;
text-overflow: ellipsis;
max-height: 60rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
/* padding:0 0 0 10rpx; */
}
.cont .tit {
/*height: 80rpx;*/
font-size: 12px;
color: #333;
line-height: 20px;
margin: 0;
max-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding: 1% 5% 0 5%;
/*color: #ccc*/
padding: 0 20rpx 0 20rpx;
}
.cont .gstatus{
color: #999;
font-size: 21rpx;
margin: 5rpx 20rpx 10rpx 20rpx;
/* border-radius: 40rpx; */
padding: 3rpx 5rpx;
height: 25rpx;
width: 45rpx;
line-height: 25rpx;
text-align: center;
border: 1rpx solid #999;
}
.discover{
display: flex;
align-items: center;
justify-content: center;
width:90rpx;
height:36rpx;
background:#FA9D3B;
border-radius:10rpx 0rpx 0rpx 0rpx;
margin-left: auto;
margin-top: auto;
font-size: 22rpx;
color: #ffffff;
}
.photo{
height:345rpx;
width:345rpx;
width:100%;
}
.cont .photo {
background:#fff;
display:inline-block;
background:#fff;
display:inline-block;
}
.co .title {
font-size: 32rpx;
@ -222,22 +235,23 @@ display:inline-block;
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; */
padding-left:20rpx;
width:74%;
}
.gmx {
text-align:right;
width:77%;
font-size:26rpx;
text-decoration:line-through;
color:#999;
text-align: right;
width: 67%;
font-size: 25rpx;
text-decoration:line-through;
color: #999;
margin-right:7px;
}
.gmx .xiaoliang {
font-size: 26rpx;
@ -253,14 +267,29 @@ display:-webkit-box;
font-family: '\5FAE\8F6F\96C5\9ED1', arial, "\5b8b\4f53";
}
.gmxx{
font-size: 14px;
color: #d9002f;
font-size: 15px;
color: #fa5151;
/*padding-top: 10px; */
}
.ku{
text-align: right;
width: 100%; font-size: 26rpx;
color: #666;
width: 50%;
font-size: 23rpx;
margin-right:10rpx;
color: #999;
}
.goods_shopBox{
display: flex;
align-items: center;
margin: 15rpx 20rpx 15rpx;
font-size: 20rpx;
color: #1d1313;
}
.goods_shopBox .goods_shop{
width: 30rpx;
height: 30rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.icons {

21
pages/product/detail.js

@ -848,26 +848,7 @@ Page({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
console.log('授权成功')
},
fail: function (res) {
wx.openSetting({
success: (res) => {
res.authSetting = {
"scope.userInfo": true,
"scope.userLocation": true,
"scope.writePhotosAlbum": true
}
}
})
}
})
} else {
}

2
pages/product/detail.wxml

@ -83,7 +83,7 @@
<view style='clear:both;'></view>
</view>
<view class='kd_xl'>
<text class="c6 font_14" style='color:#ccc;margin-right:90px;'>快递:{{itemData.freight}}</text>
<text class="c6 font_14" style='color:#ccc;margin-right:90px;'>运费:{{itemData.freight}}</text>
<text class="c6 font_14" style='color:#ccc'>销量:{{itemData.volume}}</text>
</view>
</view>

6
pages/set/set.js

@ -32,11 +32,7 @@ Page({
} else {
wx.openSetting({
success: (res) => {
wx.authorize({
scope: 'scope.record',
success() {
}
})
}
})
}

14
utils/server.js

@ -62,10 +62,10 @@ module.exports = {
homeIndex: (data) => { //首页
return requestServer('&action=index&app=index', 'post', data)
},
newArrivalIndex: (data) => { //新品上市
newArrival: (data) => { //新品上市
return requestServer('&action=index&app=new_arrival', 'post', data)
},
recommendIndex: (data) => { //好物优选
recommend: (data) => { //好物优选
return requestServer('&action=index&app=recommend', 'post', data)
},
productIndex: (data) => { //商品详情
@ -99,10 +99,9 @@ module.exports = {
indexGetMore: (data) => { //更多
return requestServer('&action=index&app=get_more', 'post', data)
},
newProduct: (data) => { //新品
return requestServer('&action=product&m=new_product', 'post', data)
},
// newProduct: (data) => { //新品
// return requestServer('&action=product&m=new_product', 'post', data)
// },
productToCollection: (data) => {
return requestServer('&action=product&m=to_Collection', 'post', data)
},
@ -128,6 +127,9 @@ module.exports = {
getCountyInfo: (data) => { //根据省市获取县
return requestServer('&action=user&m=getCountyInfo', 'post', data)
},
getLocation: (data) => { //获取地址信息
return requestServer('&action=index&app=get_location', 'post', data)
},
preservation: (data) => {
return requestServer('&action=user&m=Preservation', 'post', data)
},

Loading…
Cancel
Save