init
This commit is contained in:
192
wx214944c362629fc7/pages/index/index.js
Normal file
192
wx214944c362629fc7/pages/index/index.js
Normal file
@@ -0,0 +1,192 @@
|
||||
var t = require("../../@babel/runtime/helpers/defineProperty"), a = getApp();
|
||||
|
||||
Page({
|
||||
data: t({
|
||||
searchColor: "rgba(0,0,0,0.4)",
|
||||
searchSize: "15",
|
||||
searchName: "搜索商品",
|
||||
pageTriggered: !1,
|
||||
scrollHeight: null,
|
||||
showView: !1,
|
||||
arrange: "arrange",
|
||||
sortType: "all",
|
||||
sortPrice: !1,
|
||||
sortColour: !1,
|
||||
option: {},
|
||||
list: {},
|
||||
noList: !0,
|
||||
no_more: !1,
|
||||
page: 1,
|
||||
searchValue: "",
|
||||
cateList: [],
|
||||
cate_id: 0,
|
||||
colourList: [],
|
||||
colour_id: 0,
|
||||
hideNotice: !1,
|
||||
storeInfo: {},
|
||||
tabTxt: "成色",
|
||||
tab: !0
|
||||
}, "colour_id", 0),
|
||||
onLoad: function(t) {
|
||||
a.setTitle();
|
||||
var e = this;
|
||||
e.setListHeight(), e.getCategoryList(), e.getColourList(), e.getStoreInfo(), e.setData({
|
||||
option: t
|
||||
}, function() {
|
||||
e.getGoodsList(!0);
|
||||
});
|
||||
},
|
||||
onPullDownRefresh: function() {
|
||||
var t = this;
|
||||
wx.showLoading({
|
||||
title: "刷新中..."
|
||||
}), setTimeout(function() {
|
||||
t.onRefresh();
|
||||
}, 1e3), wx.showNavigationBarLoading(), this.setData({
|
||||
pageTriggered: !0,
|
||||
page: 1
|
||||
});
|
||||
},
|
||||
onRefresh: function() {
|
||||
var t = this;
|
||||
t.getGoodsList(!0), setTimeout(function() {
|
||||
wx.hideLoading(), wx.hideNavigationBarLoading(), t.setData({
|
||||
pageTriggered: !1
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
filterTab: function(t) {
|
||||
console.log(111), this.setData({
|
||||
tab: !this.data.tab,
|
||||
page: 1
|
||||
});
|
||||
},
|
||||
filter: function(t) {
|
||||
var a = t.currentTarget.dataset.id, e = t.currentTarget.dataset.txt, o = this.data.tabTxt;
|
||||
o = e, this.setData({
|
||||
tab: !0,
|
||||
tabTxt: o,
|
||||
colour_id: a,
|
||||
jiage_txt: e
|
||||
}), this.getGoodsList(!0);
|
||||
},
|
||||
getCategoryList: function() {
|
||||
var t = this;
|
||||
a._get("category/lists", {}, function(a) {
|
||||
var e = a.data;
|
||||
e.list.unshift({
|
||||
category_id: 0,
|
||||
name: "全部"
|
||||
}), t.setData({
|
||||
cateList: e.list
|
||||
});
|
||||
});
|
||||
},
|
||||
getStoreInfo: function() {
|
||||
var t = this;
|
||||
a._get("index/getStoreInfo", {}, function(a) {
|
||||
var e = a.data;
|
||||
console.log(e), t.setData({
|
||||
storeInfo: e.store
|
||||
});
|
||||
});
|
||||
},
|
||||
switchNotice: function() {
|
||||
this.setData({
|
||||
hideNotice: !0
|
||||
});
|
||||
},
|
||||
getColourList: function() {
|
||||
var t = this;
|
||||
a._get("goods/getColourList", {}, function(a) {
|
||||
var e = a.data;
|
||||
t.setData({
|
||||
colourList: e.list
|
||||
});
|
||||
});
|
||||
},
|
||||
getSearchContent: function(t) {
|
||||
this.data.searchValue = t.detail.value;
|
||||
},
|
||||
search: function() {
|
||||
this.getGoodsList(!0);
|
||||
},
|
||||
searchCate: function(t) {
|
||||
console.log("栏目ID"), console.log(t.currentTarget.dataset.category_id), this.setData({
|
||||
cate_id: t.currentTarget.dataset.category_id,
|
||||
page: 1
|
||||
}), this.getGoodsList(!0);
|
||||
},
|
||||
getGoodsList: function(t, e) {
|
||||
wx.showLoading({
|
||||
title: "刷新中..."
|
||||
}), console.log(this.data.searchValue);
|
||||
var o = this;
|
||||
a._get("goods/lists", {
|
||||
page: e || 1,
|
||||
sortType: o.data.sortType,
|
||||
sortPrice: o.data.sortPrice ? 1 : 0,
|
||||
sortColour: o.data.sortColour ? 1 : 0,
|
||||
category_id: o.data.cate_id || 0,
|
||||
colour_id: o.data.colour_id || 0,
|
||||
search: o.data.searchValue || ""
|
||||
}, function(a) {
|
||||
wx.hideLoading(), console.log(a);
|
||||
var e = a.data.list, i = o.data.list;
|
||||
!0 === t || void 0 === i.data ? o.setData({
|
||||
list: e,
|
||||
noList: !1
|
||||
}) : o.setData({
|
||||
"list.data": i.data.concat(e.data)
|
||||
});
|
||||
});
|
||||
},
|
||||
setListHeight: function() {
|
||||
var t = this;
|
||||
wx.getSystemInfo({
|
||||
success: function(a) {
|
||||
t.setData({
|
||||
scrollHeight: a.windowHeight - 160
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
switchSortType: function(t) {
|
||||
var a = this, e = t.currentTarget.dataset.type, o = "price" !== e || !a.data.sortPrice, i = "colour" !== e || !a.data.sortColour;
|
||||
a.setData({
|
||||
list: {},
|
||||
page: 1,
|
||||
sortType: e,
|
||||
sortPrice: o,
|
||||
sortColour: i,
|
||||
tab: !0
|
||||
}, function() {
|
||||
a.getGoodsList(!0);
|
||||
});
|
||||
},
|
||||
toSynthesize: function(t) {
|
||||
wx.navigateTo({
|
||||
url: "../category/screen?objectId="
|
||||
});
|
||||
},
|
||||
onChangeShowState: function() {
|
||||
this.setData({
|
||||
showView: !this.data.showView,
|
||||
arrange: this.data.arrange ? "" : "arrange"
|
||||
});
|
||||
},
|
||||
bindDownLoad: function() {
|
||||
if (console.log("this.data.page", this.data.page), console.log("this.data.list.last_page", this.data.list.last_page),
|
||||
this.data.page >= this.data.list.last_page) return this.setData({
|
||||
no_more: !0
|
||||
}), !1;
|
||||
this.getGoodsList(!1, ++this.data.page);
|
||||
},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: "小程序首页",
|
||||
desc: "",
|
||||
path: "/pages/index/index"
|
||||
};
|
||||
}
|
||||
});
|
||||
3
wx214944c362629fc7/pages/index/index.json
Normal file
3
wx214944c362629fc7/pages/index/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
89
wx214944c362629fc7/pages/index/index.wxml
Normal file
89
wx214944c362629fc7/pages/index/index.wxml
Normal file
@@ -0,0 +1,89 @@
|
||||
<view class="container">
|
||||
<view class="list-header">
|
||||
<view class="notice-wrap" hidden="{{hideNotice}}" wx:if="{{storeInfo.notice.length>0}}">
|
||||
<view class="tongzhitext">
|
||||
<text class="tongzhi-text">{{storeInfo.notice}}</text>
|
||||
</view> <view bindtap="switchNotice" class="closeView">x</view>
|
||||
</view>
|
||||
<view class="index-search-box dis-flex" style="position:static">
|
||||
<view class="dis-flex search-input-box flex-box">
|
||||
<view class="search-input">
|
||||
<view class="dis-flex search-box">
|
||||
<view class="left">
|
||||
<icon color="rgba(180,180,180,1)" size="15" type="search"></icon>
|
||||
</view>
|
||||
<view class="right">
|
||||
<input bindinput="getSearchContent" class="input" placeholder="请输入您搜索的商品" placeholderStyle="color:#aba9a9" type="text"></input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="serch-button">
|
||||
<button bindtap="search" type="warn"> 搜索 </button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index_sale search-cate-box ">
|
||||
<scroll-view class="search-cate" scrollX="true">
|
||||
<view hoverClass="none" style="display: inline-block;" wx:for="{{cateList}}" wx:key="this">
|
||||
<view bindtap="searchCate" class="page-column {{cate_id==item.category_id?'search-cate-activity':''}}" data-category_id="{{item.category_id}}">
|
||||
<view class="content ">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view></view>
|
||||
<view class="store_nav_cont dis-flex b-f b-b">
|
||||
<view bindtap="switchSortType" class="flex-box t-c p-r" data-index="0 " data-type="all" id="list-{{sortType==='all'?true:0}}">
|
||||
<text>发布时间</text>
|
||||
</view>
|
||||
<view bindtap="switchSortType" class="flex-box t-c p-r" data-index="2" data-type="price" id="list-{{sortType==='price'?true:0}}">
|
||||
<text class="price"> 价格</text>
|
||||
<text class="iconfont icon-jiantou-copy tf-180 top_jiantou {{sortPrice?'':'active'}}"></text>
|
||||
<text class="iconfont icon-jiantou-copy bot_jiantou {{sortPrice?'active':''}}"></text>
|
||||
</view>
|
||||
<view bindtap="filterTab" class="flex-box t-c p-r" data-index="1" id="list-{{tab===false?true:0}}">
|
||||
<text>{{tabTxt}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabLayer" hidden="{{tab}}">
|
||||
<text bindtap="filter" class="{{colour_id==0?'active':''}}" data-id="0" data-index="1" data-txt="成色">全部</text>
|
||||
<text bindtap="filter" class="{{colour_id==85?'active':''}}" data-id="85" data-index="1" data-txt="85新">85新</text>
|
||||
<text bindtap="filter" class="{{colour_id==90?'active':''}}" data-id="90" data-index="1" data-txt="9成新">9成新</text>
|
||||
<text bindtap="filter" class="{{colour_id==95?'active':''}}" data-id="95" data-index="1" data-txt="95新">95新</text>
|
||||
<text bindtap="filter" class="{{colour_id==99?'active':''}}" data-id="99" data-index="1" data-txt="99新">99新</text>
|
||||
</view>
|
||||
<scroll-view bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="bindDownLoad" class="weui-panel weui-panel_access" refresherEnabled="true" refresherTriggered="{{pageTriggered}}" scrollY="true" style="height: {{scrollHeight}}px; width: 750rpx; " throttle="{{false}}" wx:if="{{list.data.length>0}}">
|
||||
<view class="new">
|
||||
<view class="category-list {{arrange}}">
|
||||
<navigator class="list b-f" hoverClass="none" url="../goods/index?goods_id={{item.goods_id}}" wx:for="{{list.data}}" wx:key="list">
|
||||
<view class="left">
|
||||
<view class="img">
|
||||
<image class="goodsImg" mode="scaleToFill" src="{{item.image[0].file_path}}"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="cont">
|
||||
<text class="f-28 title twolist-hidden m-top10">
|
||||
<text class="colour-box f-20" wx:if="{{item.colour>0}}">{{colourList[item.colour]}}</text>
|
||||
<text>{{item.goods_name}}</text>
|
||||
</text>
|
||||
<view class="f-26" style="color: #555;"> {{item.goods_title.length>0?item.goods_title:' '}} </view>
|
||||
<view class="price f-30 col-m"> ¥{{item.goods_min_price}} <text class="del f-22" wx:if="{{item.goods_sku.line_price>0}}">{{item.goods_sku.line_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<view class="no-more f-30" hidden="{{!no_more}}">亲, 没有更多了</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="yoshop-notcont" style="margin-top:260px;" wx:if="{{!noList&&!list.data.length}}">
|
||||
<view class="img">
|
||||
<image mode="aspectFit" src="../../images/no_content.png"></image>
|
||||
</view>
|
||||
<text class="cont">亲, 没有相关内容</text>
|
||||
</view>
|
||||
</view>
|
||||
358
wx214944c362629fc7/pages/index/index.wxss
Normal file
358
wx214944c362629fc7/pages/index/index.wxss
Normal file
@@ -0,0 +1,358 @@
|
||||
.store_nav_cont {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-true {
|
||||
color: #ff495e;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-0 {
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-0 .icon-fenlei {
|
||||
color: #777;
|
||||
font-size: 28rpx;
|
||||
padding-left: 8rpx;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-true .icon-fenlei {
|
||||
color: #ff495e;
|
||||
font-size: 28rpx;
|
||||
padding-left: 8rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
height: 75rpx!important;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-0 .top_jiantou,.store_nav_cont #list-true .top_jiantou {
|
||||
color: #777;
|
||||
font-size: 18rpx;
|
||||
margin-top: -16rpx;
|
||||
position: absolute;
|
||||
right: 52rpx;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-0 .bot_jiantou,.store_nav_cont #list-true .bot_jiantou {
|
||||
color: #777;
|
||||
font-size: 18rpx;
|
||||
margin-top: -2rpx;
|
||||
position: absolute;
|
||||
right: 52rpx;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.store_nav_cont #list-true .bot_jiantou.active,.store_nav_cont #list-true .top_jiantou.active {
|
||||
color: #ff495e;
|
||||
}
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cate-btn {
|
||||
background: #ff495e;
|
||||
bottom: 18rpx;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
padding: 4px 18rpx;
|
||||
right: 18rpx;
|
||||
}
|
||||
|
||||
.index-cont-search icon {
|
||||
left: 0;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.index-search-box {
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
left: 0rpx;
|
||||
padding: 18rpx 13rpx;
|
||||
position: fixed;
|
||||
right: 0rpx;
|
||||
top: 1rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.index-search {
|
||||
background: #fff;
|
||||
border-bottom: 0;
|
||||
border-radius: 50rpx;
|
||||
box-sizing: border-box;
|
||||
color: #999;
|
||||
font-size: 32rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
margin: 0 10rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.list-right {
|
||||
width: 60rpx;
|
||||
}
|
||||
|
||||
.list-right text {
|
||||
font-size: 40rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.list-header {
|
||||
left: 0;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 1rpx;
|
||||
}
|
||||
|
||||
.no-more {
|
||||
color: #737373;
|
||||
margin: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.category-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.category-list .list {
|
||||
box-sizing: border-box;
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.category-list .list:nth-child(2n) {
|
||||
border-bottom: 4px solid #f7f7f7;
|
||||
border-left: 2px solid #f7f7f7;
|
||||
}
|
||||
|
||||
.category-list .list:nth-child(2n-1) {
|
||||
border-bottom: 4px solid #f7f7f7;
|
||||
border-right: 2px solid #f7f7f7;
|
||||
}
|
||||
|
||||
.category-list.arrange .list {
|
||||
border-bottom: 1rpx solid #f7f7f7;
|
||||
overflow: hidden;
|
||||
padding: 15rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.category-list.arrange .list .left {
|
||||
float: left;
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.category-list.arrange .list .right {
|
||||
float: left;
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
.category-list.arrange .list .left .img image {
|
||||
height: 220rpx;
|
||||
width: 220rpx;
|
||||
}
|
||||
|
||||
.search-input-box {
|
||||
background: #f7f7f7;
|
||||
height: 64rpx;
|
||||
margin-right: 10rpx;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
border-radius: 5px 0 0 5px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
padding-left: 10rpx;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.search-input input {
|
||||
font-size: 30rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.serch-button {
|
||||
box-sizing: border-box;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.serch-button button {
|
||||
border-radius: 0 5px 5px 0;
|
||||
font-size: 28rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.search-cate-box {
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.search-cate {
|
||||
position: relative;
|
||||
top: 30%;
|
||||
}
|
||||
|
||||
.page-column {
|
||||
background-color: #f7f7f7;
|
||||
border-radius: 6rpx;
|
||||
margin: 0 20rpx;
|
||||
padding: 10rpx 0rpx!important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.search-cate-activity {
|
||||
background-color: #e64340;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.colour-box {
|
||||
background: #e64340;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
line-height: 26rpx;
|
||||
margin-right: 10rpx;
|
||||
padding: 4rpx 8rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@-webkit-keyframes remindMessage {
|
||||
0% {
|
||||
-webkit-transform: translateX(90%);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: translateX(-180%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes remindMessage {
|
||||
0% {
|
||||
-webkit-transform: translateX(90%);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: translateX(-180%);
|
||||
}
|
||||
}
|
||||
|
||||
.tongzhitext {
|
||||
margin-left: 10rpx;
|
||||
margin-right: 80rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tongzhi-text {
|
||||
animation: remindMessage 14s linear infinite;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.notice-wrap,.tongzhi-text {
|
||||
color: #d09868;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.notice-wrap {
|
||||
background: #ffebda;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
|
||||
.closeView {
|
||||
font-size: 35rpx;
|
||||
height: 45rpx;
|
||||
line-height: 45rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
text-align: center;
|
||||
top: 5rpx;
|
||||
width: 45rpx;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tabTit {
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 15px;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
width: 750rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tabTit .active {
|
||||
background: #fff;
|
||||
color: #e64340;
|
||||
}
|
||||
|
||||
.tabTit .active image {
|
||||
background: none;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.tabTit image {
|
||||
height: 26rpx;
|
||||
margin-left: 5px;
|
||||
vertical-align: middle;
|
||||
width: 26rpx;
|
||||
}
|
||||
|
||||
.tabLayer {
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
box-shadow: 0 5px 5px rgba(0,0,0,.15);
|
||||
overflow: hidden;
|
||||
padding-bottom: 40rpx;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
top: 340rpx;
|
||||
width: 750rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tabLayer text {
|
||||
border: 1px solid #eee;
|
||||
float: left;
|
||||
font-size: 15px;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
margin: 20rpx 0 0 26rpx;
|
||||
width: 210rpx;
|
||||
}
|
||||
|
||||
.tabLayer .active {
|
||||
border-color: #e64340;
|
||||
color: #e64340;
|
||||
}
|
||||
|
||||
.flex1 {
|
||||
display: block;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.box {
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
Reference in New Issue
Block a user