Sfoglia il codice sorgente

搜索接口调用

master
ljc 5 anni fa
parent
commit
b6a320fbe6
7 ha cambiato i file con 102 aggiunte e 61 eliminazioni
  1. +1
    -1
      laomenkuang_project/app.js
  2. +12
    -1
      laomenkuang_project/pages/TicketDetails/TicketDetails.js
  3. +8
    -6
      laomenkuang_project/pages/TicketDetails/TicketDetails.wxml
  4. +4
    -4
      laomenkuang_project/pages/TicketDetails/TicketDetails.wxss
  5. +69
    -47
      laomenkuang_project/pages/shop/shop.js
  6. +2
    -2
      laomenkuang_project/pages/shop/shop.wxml
  7. +6
    -0
      laomenkuang_project/pages/shop/shop.wxss

+ 1
- 1
laomenkuang_project/app.js Vedi File

@@ -40,7 +40,7 @@ App({
}else{
this.globalData.openid = openid;
}
// this.getUserType();
this.getUserType();
// 获取用户信息
// wx.getSetting({
// success: res => {

+ 12
- 1
laomenkuang_project/pages/TicketDetails/TicketDetails.js Vedi File

@@ -8,6 +8,7 @@ Page({
*/
data: {
ticketUser: [],//优惠券信息
ticketStateArr:[],//优惠券使用状态
},

/**
@@ -19,8 +20,18 @@ Page({
this.setData({
ticketUser: dataArr
})
this.ticketState(this.data.ticketUser.coupon_sell_id);
},
ticketState:function(id){//优惠券使用状态
app.wxRequest(app.globalData.httpUrl + 'couponbuy/uniquehistory/'+id, {}, e => {
console.log(e)
if (e.code == 200) {
this.setData({
ticketStateArr:e.data
})
}
}, this)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

+ 8
- 6
laomenkuang_project/pages/TicketDetails/TicketDetails.wxml Vedi File

@@ -40,14 +40,16 @@
</view>
</view>

<!-- <scroll-view class="scrollY" scroll-y="true"> -->
<view class="history">
<scroll-view class="scrollY" scroll-y="true">
<view class="history" wx:for="{{ticketStateArr}}">
<view class="historyLeft">
<image class="historyTicketBg" src="../images/historyTicketBg.png"></image>
<view class="ticketCode">券码:{{ticketUser.coupon_sell_id}}</view>
<view class="ticketCode">券码:{{item.coupon_sell_id}}</view>
</view>
<view class="tickName">{{ticketUser.coupon_type}}</view>
<view class="tickType">未使用</view>
<view class="tickName">{{item.coupon_type}}</view>
<view class="tickType" wx:if="{{item.coupon_state==1}}">未使用</view>
<view class="tickType" wx:if="{{item.coupon_state==2}}">已使用</view>
<view class="tickType" wx:if="{{item.coupon_state==3}}">锁定</view>
</view>
<!-- </scroll-view> -->
</scroll-view>
</view>

+ 4
- 4
laomenkuang_project/pages/TicketDetails/TicketDetails.wxss Vedi File

@@ -88,10 +88,10 @@
margin-left: 69rpx;
}

/* .scrollY{
height: 300rpx;
.scrollY{
height: 200rpx;
margin-top: 107rpx;
} */
}

.historyIcon{
width: 30rpx;
@@ -101,7 +101,7 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 107rpx;
margin-top: 20rpx;
padding: 0 50rpx;
}
.historyLeft{

+ 69
- 47
laomenkuang_project/pages/shop/shop.js Vedi File

@@ -13,31 +13,20 @@ Page({
provinceIndex:0,
cityIndex:0,
inputVal:"",
initialize:false,//检测是不是通过条件搜索
scrollHig:0,
getDataArr:[
// {
// "bigImg": "../images/shop.png",
// "name":"北京东城区金宝店",
// "address":"北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)",
// "phone":"010-8388-6698",
// },
// {
// "bigImg": "../images/shop.png",
// "name": "北京东城区金宝店",
// "address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)",
// "phone": "010-8388-6698",
// },
// {
// "bigImg": "../images/shop.png",
// "name": "北京东城区金宝店",
// "address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)",
// "phone": "010-8388-6698",
// }
]
pageNum:1,//页码
count:2,//每页条数
showDataArr:[],//展示的数据列表
dataArr: [],//搜索的数据列表
getDataArr:[],//每次下拉获取的数据
},
bindchange:function(e){
console.log("确定")
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
this.data.pageNum = 1;
this.data.dataArr = [];
this.setData({
inputVal:""
})
@@ -45,7 +34,13 @@ Page({
},
bindcolumnchange: function (e) {
console.log(e)
this.data.initialize = true;
if (this.data.provinceCityArr[0][0] == "") {
this.data.provinceCityArr[0][0] = "全部"
}

if (this.data.provinceCityArr[1][0] == "") {
this.data.provinceCityArr[1][0] = "全部";
}
var clo = e.detail.column;//指移动的哪一列
var value = e.detail.value;//指列中的哪一个
var activeArr = [this.data.provinceArr, this.data.cityArr[value]]
@@ -55,27 +50,29 @@ Page({
provinceCityArr: activeArr,
index:0,
provinceIndex: value,
cityIndex:0,
})
}else{
this.setData({
index: value,
cityIndex:value
})
// console.log(this.data.provinceCityArr)
}
console.log(activeArr)
console.log(clo, value)
// console.log(activeArr)
// console.log(clo, value)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getShopList();
this.searchShop();
this.searchShop(true);
},

getShopList:function(){//获取所有门店省市
app.wxRequest(app.globalData.httpUrl + 'shop/shop_province', {}, e => {
console.log(e)
// console.log(e)
var shopProvince = ["全部"];//省份
var shopCity = [];//城市
var shopCityAll = ["全部"];//全部城市
@@ -97,21 +94,29 @@ Page({
cityArr: shopCity,
provinceCityArr: provinceCity,
})
console.log(this.data.provinceArr)
console.log(this.data.cityArr)
console.log(this.data.provinceCityArr)
// console.log(this.data.provinceArr)
// console.log(this.data.cityArr)
// console.log(this.data.provinceCityArr)
}
}, this)
},

searchShop:function(){//搜索
var province = "";
var city = "";
if (this.data.initialize){
if (this.data.provinceCityArr[0][this.data.provinceIndex] == "全部"){
searchShop: function (search){//搜索
if (search) {
var province = "";
var city = "";
var activeArr = [this.data.provinceArr, this.data.cityArr[0]];
this.setData({
provinceIndex: 0,
cityIndex: 0,
index: 0,
provinceCityArr: activeArr,
})
}else{
if (this.data.provinceCityArr[0][this.data.provinceIndex] == "全部") {
this.data.provinceCityArr[0][this.data.provinceIndex] = "";
}
if (this.data.provinceCityArr[1][this.data.cityIndex] == "全部"){
}
if (this.data.provinceCityArr[1][this.data.cityIndex] == "全部") {
this.data.provinceCityArr[1][this.data.cityIndex] = "";
}
province = this.data.provinceCityArr[0][this.data.provinceIndex];
@@ -121,19 +126,20 @@ Page({
"shop_province": province,
"shop_city": city,
"key": this.data.inputVal,
"cur_page":1,
"show_num":10,
"cur_page": this.data.pageNum,
"show_num":this.data.count,
}
app.wxRequest(app.globalData.httpUrl + 'shop/search', params, e => {
console.log(e)
if (e.code == 200) {
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
for (var i = 0; i < e.data.length;i++){
this.data.dataArr.push(e.data[i]);
}
this.setData({
getDataArr:e.data
showDataArr: this.data.dataArr,
getDataArr: e.data,
})
console.log(this.data.showDataArr)
}
}, this)
},
@@ -177,6 +183,16 @@ Page({
*/
onReachBottom: function () {
console.log("到底了")
if (this.data.getDataArr!=""){
this.data.pageNum++;
this.searchShop();
}else{
wx.showToast({
title: '没有更多数据了',
icon:"none",
duration:1000
})
}
},

/**
@@ -198,9 +214,15 @@ Page({
})
},
searchFn:function(){//点击搜索按钮
this.setData({
index:0
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
this.searchShop();
console.log(this.data.provinceIndex)
console.log(this.data.cityIndex)
console.log(this.data.index)
this.data.pageNum = 1;
this.data.dataArr = [];
this.searchShop(true);
},
})

+ 2
- 2
laomenkuang_project/pages/shop/shop.wxml Vedi File

@@ -19,9 +19,9 @@
<view class="content">
<!-- <scroll-view scroll-y="true" style="height:{{scrollHig}}px" bindtouchend=""> -->
<view>
<view class="getData" wx:for="{{getDataArr}}">
<view class="getData" wx:for="{{showDataArr}}">
<view class="imgView">
<image class="shop" src="{{item.shop_img}}"></image>
<image mode="widthFix" class="shop" src="{{item.shop_img}}"></image>
<image bindtap="callPhone" data-index="{{index}}" class="ringUp" src="../images/ringUp.png" ></image>
</view>
<view class="shopName">{{item.shop_name}}</view>

+ 6
- 0
laomenkuang_project/pages/shop/shop.wxss Vedi File

@@ -1,6 +1,10 @@
/* pages/shop/shop.wxss */
page{
height: 100%;
}

.all{
height: 100%;
width: 686rpx;
padding: 0 32rpx;
}
@@ -70,6 +74,7 @@
}

.content{
height: 100%;
padding-top: 128rpx;
}
.imgView{
@@ -77,6 +82,7 @@
height: 300rpx;
position: relative;
overflow: hidden;
border-radius:30rpx;
}
.shop{
width: 738rpx;

Loading…
Annulla
Salva