Skip to content

Commit

Permalink
增加搜索等
Browse files Browse the repository at this point in the history
  • Loading branch information
lrjxgl committed Apr 2, 2019
1 parent 1476655 commit 245dde8
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 42 deletions.
3 changes: 2 additions & 1 deletion pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
{"path":"pages/b2c_order/raty"},
{"path":"pages/b2c_order/show"},
{"path":"pages/b2c_order/pay"},
{"path":"pages/b2c_user/index"}
{"path":"pages/b2c_user/index"},
{"path":"pages/b2c_search/index"}
],
"globalStyle": {
"navigationBarTextStyle": "black",
Expand Down
38 changes: 33 additions & 5 deletions pages/b2c/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<div>
<div v-if="!pageLoad"><page-loading></page-loading></div>
<div v-else>
<div class="pd-5">
<div class="flex">
<input v-model="keyword" type="search" class="header-search pdl-5">
<div @click="search" class="header-search-btn iconfont icon-search"></div>
</div>
</div>
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-for="(item,key) in pageData.flashList" :key="key">
<view class="swiper-item">
Expand All @@ -8,6 +16,13 @@
</swiper-item>

</swiper>
<view class="m-navPic mgt-5 mgb-5">
<navigator v-for="(item,key) in pageData.navList" :key="key" :url="item.link1" class="m-navPic-item">
<image class="m-navPic-img" mode="widthFix" :src="item.imgurl"></image>
<view class="m-navPic-title">{{item.title}}</view>
</navigator>

</view>
<div class="row-box-hd pdl-10" >
<div class="flex-1 f16">推荐</div>
<div class="row-box-more">更多</div>
Expand Down Expand Up @@ -57,9 +72,11 @@
</div>
</div>

</div>
</div>
<b2c-footer tab="home"></b2c-footer>
</div>

</template>

<script>
Expand All @@ -70,7 +87,9 @@
},
data(){
return{
pageData:{}
pageData:{},
pageLoad:false,
keyword:""
}
},
onLoad:function(ops){
Expand All @@ -80,17 +99,23 @@
this.getPage();
},
methods:{
search:function(){
uni.navigateTo({
url:"../b2c_search/index?keyword="+encodeURI(this.keyword)
})
},
goProduct:function(id){
uni.navigateTo({
url:"../b2c_product/show?id="+id
})
},
getPage:function(){
var that=this;
uni.request({
url:this.app.apiHost+"/module.php?m=b2c&ajax=1&authcode="+this.app.getAuthCode(),
that.app.get({
url:this.app.apiHost+"/module.php?m=b2c&ajax=1",
success:function(res){
that.pageData=res.data.data;
that.pageData=res.data;
that.pageLoad=true;
}
})
},
Expand All @@ -99,8 +124,11 @@
</script>

<style>
swiper{
height: 440upx;
}
.mtt10{
margin-top: -20upx;
margin-top: -22upx;
}
</style>
2 changes: 1 addition & 1 deletion pages/b2c_cart/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
if(res.error==1000){
uni.showToast({
title:"请先登录"
})
})
return false;
}
that.pageLoad=true;
Expand Down
16 changes: 11 additions & 5 deletions pages/b2c_category/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<div class="main-body bg-white mh100" >
<div class="list-side">
<div class="list-side" :style="{'top':sideTop+'px'}">

<div @click="setCat(item.catid)" v-for="(item,index) in pageData.catList" :key="index" class="list-side-item" v-bind:class="{'list-side-item-active':catid==item.catid}">{{item.title}}</div>

Expand Down Expand Up @@ -44,12 +44,17 @@
pageData: {},
catid:0,
height:440,
sideTop:44
}
},
onLoad: function(ops) {
var win=uni.getSystemInfoSync();
this.height=win.windowHeight-50;
// #ifndef H5
this.sideTop=0;
// #endif
this.getPage();
},
methods: {
setCat:function(catid){
Expand Down Expand Up @@ -87,14 +92,15 @@
top: 110upx;
bottom: 130upx;
width: 170upx;
border-right: 2upx solid #eee;
border-right: 1px solid #eee;
text-align: center;
background-color: #fff;
}
.list-side-item {
color: #707070;
padding: 22upx 11upx;
font-size: 32upx;
font-size: 14px;
display: block;
cursor: pointer;
}
Expand All @@ -118,7 +124,7 @@
text-align: center;
padding: 22upx 0;
color: #666;
font-size: 30upx;
font-size: 14px;
position: relative;
}
Expand Down Expand Up @@ -161,7 +167,7 @@
margin-bottom: 22upx;
padding: 0 22upx;
box-sizing: border-box;
font-size: 30upx;
font-size: 14px;
color: #666;
text-align: center;
}
Expand Down
2 changes: 1 addition & 1 deletion pages/b2c_order/confirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>

<div class="flexlist-item" v-for="(item,index) in pageData.cartList" :key="index">
<input type="hidden" class="none" name="cartid[]" :value="item.id" />
<input type="hidden" class="none" :name="'cartid['+index+']'" :value="item.id" />
<img :src="item.imgurl+'.100x100.jpg'" class="flexlist-img" />
<div class="flex-1">
<div class="flexlist-title">{{item.title}}</div>
Expand Down
16 changes: 10 additions & 6 deletions pages/b2c_product/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div class="side">
<div class="side" :style="{'top':sideTop+'px'}">
<div @click="setCat(0)" v-bind:class="catActive" class="side-menu">推荐</div>
<div @click="setCat(item.catid)" v-bind:class="item.isactive?'cl-money':''" class="side-menu" v-for="(item,index) in pageData.catList" :key="index">{{item.title}}</div>
</div>
Expand All @@ -27,7 +27,7 @@
<input type="text" name="amount" :value="item.cart_amount" class="numbox-num" />
<div @click="plusCart(item.id,item.cart_amount)" class="numbox-plus">+</div>
</div>
<div @click="addCart(item.id)" class="btn-buy" v-else></div>
<div @click="addCart(item.id)" class="btn-buy iconfont icon-cart" v-else></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -60,7 +60,7 @@
<input type="text" name="amount" :value="ksproduct.cart_amount" class="numbox-num" />
<div @click="ksPlusCart(ksproduct.id,ksproduct.cart_amount)" class="numbox-plus">+</div>
</div>
<div @click="ksAddCart(ksproduct.id)" class="btn-buy" v-else></div>
<div @click="ksAddCart(ksproduct.id)" class="btn-buy iconfont icon-cart" v-else></div>
</div>
</div>
</div>
Expand All @@ -81,6 +81,7 @@
return {
pageData: {},
pageLoad:false,
sideTop:44,
show:"flex",
catActive:"cl-money",
ksShow:false,
Expand All @@ -96,6 +97,9 @@
uni.setNavigationBarTitle({
title:"点餐"
})
// #ifndef H5
this.sideTop=0;
// #endif
this.getPage();
},
methods: {
Expand Down Expand Up @@ -464,7 +468,7 @@
position: fixed;
top: 96upx;
left: 0upx;
width: 180upx;
width: 200upx;
bottom: 110upx;
background-color: #fff;
}
Expand All @@ -473,9 +477,9 @@
padding: 22upx 11upx;
border-bottom: 2upx solid #eee;
color: #646464;
font-size: 36upx;
font-size: 16px;
}
.main{
margin-left: 190upx;
margin-left: 205upx;
}
</style>
10 changes: 5 additions & 5 deletions pages/b2c_product/show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
价格 <div class="flex-1 cl-money f22 mgl-5" id="price">¥{{price}}</div>
<div class="numbox">
<div @click="dMinus" class="numbox-minus">-</div>
<input class="numbox-num" id="cart-amount" v-model="cart_amount" readonly="" :value="cart_amount" />
<input class="numbox-num" id="cart-amount" v-model="cart_amount" readonly="" />
<div @click="dPlus" class="numbox-plus">+</div>
</div>

Expand Down Expand Up @@ -215,7 +215,7 @@
left: 0upx;
right: 0upx;
bottom: 0upx;
font-size: 29upx;
font-size: 14px;
line-height: 1.2;
border-top: 1upx solid #eee;
background-color: #fff;
Expand All @@ -226,7 +226,7 @@
padding-top: 10upx;
clear: both;
display: block;
font-size: 29upx;
font-size: 14px;
line-height: 1.2;
}
Expand All @@ -240,15 +240,15 @@
display: inline-block;
line-height: 50upx;
font-size: 29upx;
font-size: 14px;
}
.flcart-f2 {
flex: 1;
line-height: 100upx;
background-color: #f90;
color: #fff;
font-size: 29upx;
font-size: 14px;
}
.flcart .f3 {
Expand Down
91 changes: 91 additions & 0 deletions pages/b2c_search/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<div>
<div id="app">


<div v-if="pageLoad">
<div class="mtlist">
<div class="mtlist-item" v-for="(item,index) in pageData.list" :key="index">
<div class="mtlist-item-bd">
<div class="mtlist-imgbox" @click="goProduct(item.shopid,item.id)">
<image mode="widthFix" class="mtlist-img" :src="item.imgurl+'.small.jpg'"></image>
</div>
<div class="mtlist-item-pd">
<div class="mtlist-item-money">
<div class="flex flex-1 flex-ai-center">
<div class="cl-money f12">¥</div>
<div class="cl-money f22">{{item.price}}</div>
</div>
<div class="mtlist-item-money_num">月销{{item.buy_num}}件</div>
</div>
<div class="mtlist-title">{{item.title}}</div>

</div>
</div>
</div>
</div>

</div>
</div>
</div>
</template>

<script>
import skyRaty from "../../components/skyraty.vue";
export default ({
components: {
skyRaty
},
data: function() {
return {
pageLoad: false,
pageData: {},
keyword: "",
page: "product"
}
},
onLoad: function(ops) {
this.keyword = ops.keyword;
this.getPage();
},
methods: {
goProduct: function(shopid, id) {
uni.navigateTo({
url: "../b2c_product/show?id=" + id
})
},
search: function() {
this.getPage();
},
setPage: function(page) {
this.page = page;
this.pageLoad = false;
this.pageData = {};
this.getPage();
},
getPage: function() {
this.getProduct();
},
getProduct: function() {
var that = this;
this.app.get({
url: that.app.apiHost + "/module.php?m=b2c_search&a=product&ajax=1",
data: {
keyword: this.keyword
},
dataType: "json",
success: function(res) {
that.pageLoad = true;
that.pageData = res.data;
}
})
}
}
});
</script>

<style>
</style>
Loading

0 comments on commit 245dde8

Please sign in to comment.