Browse Source

优化登录、新增搜索、商品列表

master
ltlzx 3 years ago
parent
commit
97833fcf7e
  1. 97
      pages/category/productList.vue
  2. 6
      pages/index/search.vue
  3. 8
      pages/login/index.vue

97
pages/category/productList.vue

@ -4,7 +4,8 @@
<block slot="left">
<view class="nav_left">
<image src="../../static/img/left.png" mode="" @click="back"></image>
<image src="../../static/img/seach1.png" mode=""></image>
<image src="../../static/img/seach1.png" mode="" @click="goPage()"></image>
</view>
</block>
<block slot="right">
@ -16,13 +17,13 @@
</block>
</uni-nav-bar>
<view class="pets_nav">
<text>Synthesis</text>
<view class="pets_nav_item">
<text>Sales</text>
<text :class="query.order_type==0?'active_text':''" @click="selectNav(0)">Synthesis</text>
<view class="pets_nav_item" @click="selectNav(1)">
<text :class="query.order_type==3 ?'active_text' :query.order_type==4 ?'active_text':''">Sales</text>
<image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image>
</view>
<view class="pets_nav_item">
<text>Price</text>
<view class="pets_nav_item" @click="selectNav(2)">
<text :class="query.order_type==1 ?'active_text':query.order_type==2 ?'active_text':''">Price</text>
<view class="pets_nav_item_right">
<image src="../../static/img/top.png" mode="" class="pets_nav_arrow"></image>
<image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image>
@ -36,15 +37,15 @@
</view>
<view class="body">
<view class="product" v-show="pets_index==0">
<view class="product_item" v-for="(item,index) in 5" :key="index">
<view class="product_item_image"></view>
<view class="product_item" v-for="(item,index) in list" :key="index">
<image class="product_item_image" :src="item.image"></image>
<view class="product_item_right">
<view >Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men's</view>
<view >{{item.short_name}}</view>
<view class="item_right_lable">
<view class="right_lable_item">Hashtag buzzword</view>
<view class="right_lable_item" v-if="item.tags!=''">{{item.tags}}</view>
</view>
<view class="item_right_price">
<text>US$314.00</text>
<text>US${{item.shop_price}}</text>
<view class="right_price_operation">
<image src="/static/img/like.png" mode=""></image>
<image src="../../static/img/cart2.png" mode=""></image>
@ -55,15 +56,15 @@
</view>
<view class="product1" v-show="pets_index==1">
<custom-waterfalls-flow :value="list">
<custom-waterfalls-flow ref="waterfallsFlowRef" :value="list" imageKey="goods_img">
<template v-slot:default="item">
<view class="product1_item">
<view>{{item.title}}</view>
<view>{{item.short_name}}</view>
<view class="desc">
<text>{{item.desc}}</text>
<text>US${{item.shop_price}}</text>
<image src="../../static/img/cart2.png" mode=""></image>
</view>
<view class="lable" v-if="item.lable!=''">{{item.lable}}</view>
<view class="lable" v-if="item.tags!=''">{{item.tags}}</view>
</view>
</template>
</custom-waterfalls-flow>
@ -81,39 +82,46 @@
pets_index:1,
navWidth:"160rpx",
query:{
_action:'getgoods'
_action:'getgoods',
order_type:0
},
list: [
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"Hashtag buzzword" ,
},
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
},
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
},
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
},
]
list:[]
}
},
methods:{
back(){
uni.navigateBack()
},
goPage(){
uni.navigateTo({
url:'../index/search'
})
},
selectNav(type){
if(type==0){
this.query.order_type=0
}else if(type==1){
this.query.order_type=3
}else{
if(this.query.order_type!=1 &&this.query.order_type!=2){
this.query.order_type=1
}else if(this.query.order_type==1){
this.query.order_type=2
}else{
this.query.order_type=1
}
}
this.getList()
},
getList(){
defaultRequest(this.query).then(res=>{
console.info(res)
if(res.error==0){
this.list=res.data
this.$refs.waterfallsFlowRef.refresh();
}
})
}
},
onLoad(e) {
@ -122,6 +130,7 @@
}else{
this.query.keyword=e.keyword
}
this.getList()
}
}
@ -158,6 +167,7 @@
// border-top: 1px solid #F5F6FA;
border-bottom: 1px solid #F5F6FA;
position: fixed;
background-color: white;
top: 0;
margin-top: 155rpx;
/* #ifdef H5 */
@ -166,6 +176,9 @@
width: 100%;
box-sizing: border-box;
z-index: 99;
.active_text{
color: #000000;
}
.pets_nav_item{
display: flex;
align-items: center;

6
pages/index/search.vue

@ -41,6 +41,7 @@
</template>
<script>
import {defaultRequest} from '../../api/index.js'
export default {
data() {
return {
@ -49,7 +50,10 @@
},
methods:{
search(){
if(this.searchValue=='')return
uni.navigateTo({
url:'../category/productList?keyword='+this.searchValue+'&type=1'
})
}
}
}

8
pages/login/index.vue

@ -52,7 +52,7 @@
</template>
<script>
import {defaultRequest} from '../../api/index.js'
import {defaultRequest1} from '../../api/index.js'
export default {
data() {
return {
@ -91,7 +91,7 @@
//
configuration(){
let data={_action:'getpagedata',pagecode:'PAGE-LOGIN'}
defaultRequest(data).then(res=>{
defaultRequest1(data).then(res=>{
console.info(res)
})
},
@ -102,7 +102,7 @@
this.loginErr=true
return
}
defaultRequest(this.loginDate).then(res=>{
defaultRequest1(this.loginDate).then(res=>{
console.info(res)
if(res.error==0){
this.loginErr=false
@ -134,7 +134,7 @@
return
}
this.regDate.password2=this.regDate.password1
defaultRequest(this.regDate).then(res=>{
defaultRequest1(this.regDate).then(res=>{
console.info(res)
if(res.error==0){
this.regErr=false

Loading…
Cancel
Save