Commit 5b313ca7b0f0552c99b69ff25ad27140a8e6d0e9

Authored by liuxuqinfhp1220
2 parents 536c8f0d 53683113

Merge branch 'master' of http://123.56.79.57/xt/xcx-book

# By vking
# Via vking
* 'master' of http://123.56.79.57/xt/xcx-book:
  search
  search
  search
  search
  search
  search
  search
  search
  search
... ... @@ -6,6 +6,10 @@ Component({
*/
properties: {
items: Array,
hasTip:{
type:Boolean,
value:true,
},
},
/**
... ...
<!--components/actionSheet/index.wxml-->
<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange">
<view class="tip"><slot></slot></view>
<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="action-sheet">
<view class="tip" wx:if="{{hasTip}}"><slot></slot></view>
<block wx:for="{{items}}" wx:key="items.key">
<action-sheet-item bindtap="bindItemTap" data-value="{{item}}" data-index="{{index}}">{{item}}</action-sheet-item>
</block>
... ...
... ... @@ -4,6 +4,7 @@ action-sheet-item,action-sheet-cancel{
margin:0;
height: 100rpx;
line-height: 100rpx;
font-size: 32rpx;
}
.tip{
color: #999999;
... ...
// components/common/feedback.js
const mans=[
'oB-xJ5KJCIasaEdgMRckqoL1cwg8',
'oB-xJ5BjnTvdgQGLHsjioNHH0eE8',
//'oB-xJ5BjnTvdgQGLHsjioNHH0eE8',
'oB-xJ5MEi2mTMrBTiYImD9cpGH6o',
'oB-xJ5OE1pM_17vNyWSMGqLH1vOg', //驴肉火烧多少钱一斤 MI 8
'oB-xJ5DIWrC6MECaXfql2GvTmQTU', //红旗 Redmi Note 7 Pro
... ...
// components/reserve/search/item.js
import App from '../../../utils/api';
Component({
/**
* 组件的属性列表
*/
properties: {
item:{
type:Object,
value:{}
},
keyword:{
type:String,
value:"",
},
hasHistory:{
type:Boolean,
value:false,
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
detailGo(){
this.SetHistorySearch();
this.triggerEvent('click',{act:'detail',data:this.data.item})
},
reserveGo(){
this.SetHistorySearch();
this.triggerEvent('click',{act:'reserve',data:this.data.item})
},
SetHistorySearch() {
let item=this.data.item
console.log('SetHistorySearch',item)
let params={
keyword:this.data.keyword,
type:item.type==-1?1:2,
sid:item.id,
name:item.title,
openid:'',
longitude:item.longitude,
latitude:item.latitude,
}
App.Customer.SetHistorySearch(params)
App.Customer.GetHistorySearch({},'clear')
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--components/reserve/search/item.wxml-->
<wxs src="../../../utils/util.wxs" module="util" />
<view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}">
<view class="icon icon{{item.type}}"></view>
<view class="text">{{item.title}}</view>
</view>
<view class="item item{{item.type}} flex-ll" bindtap="detailGo" wx:else="">
<view class="icon"></view>
<view class="flex-lr item-info">
<view class="info">
<view class="title {{item.activity.length>0?'activity':''}}">
<block wx:if="{{item.titles}}">
<text>{{item.titles[1]}}</text>
<text class="light">{{item.titles[2]}}</text>
<text>{{item.titles[3]}}</text>
</block>
<text wx:else="">{{item.title}}</text>
</view>
<view class="addr flex-ll" wx:if="{{item.type==-1}}">
<view class="txt" wx:if="{{item.category}}">{{item.category}}</view>
<view class="txt">{{util.distance(item.distance)}}</view>
</view>
<view class="addr" wx:else="">{{item.addr}}</view>
</view>
<view class="reserve-but" wx:if="{{item.is_online_reserve==1}}" catchtap="reserveGo">包间预订</view>
</view>
</view>
... ...
/* components/reserve/search/item.wxss */
@import "../../../app.wxss";
.item{
width: 100%;
box-sizing: border-box;
margin-bottom: 40rpx;
}
.item-1{
margin-bottom: 20rpx;
}
.item-1 .item-info{
width: calc(100% - 60rpx);
max-width: calc(100% - 60rpx);
box-sizing: border-box;
}
.item .title{
font-size: 28rpx;
height: 40rpx;
line-height: 40rpx;
white-space:nowrap;
overflow: hidden;
text-overflow:ellipsis;
}
.item .addr{
font-size: 24rpx;
height: 34rpx;
line-height: 34rpx;
margin-top: 4rpx;
white-space:nowrap;
overflow: hidden;
text-overflow:ellipsis;
}
.item .addr .txt{
border-right: 2rpx solid #979797;
margin-right: 10rpx;
padding-right: 10rpx;
height: 24rpx;
line-height: 24rpx;
}
.item .addr .txt:last-child{
border-right-width: 0;
}
.item .icon{
margin-right: 20rpx;
width: 22rpx;
height:26rpx;
background-image: url("http://qn.colorcun.com/reserve/images/addr.png");
background-size: 100% 100%;
}
.item-1 .info{
width: calc(100% - 140rpx);
max-width: calc(100% - 140rpx);
}
.item-1{
background:rgba(255,255,255,1);
box-shadow:0 0 8rpx 0 rgba(196,196,196,0.5);
border-radius:10rpx;
padding: 20rpx;
}
.item-1 .icon {
background-image: url("http://qn.colorcun.com/reserve/images/sea-se.png");
width: 36rpx;
height: 36rpx;
min-width: 36rpx;
}
.reserve-but{
width:120rpx;
height:40rpx;
background:linear-gradient(360deg,rgba(131,131,131,1) 0%,rgba(76,76,76,1) 100%);
border-radius:25rpx;
font-size:24rpx;
font-weight:500;
color:rgba(240,206,161,1);
line-height:40rpx;
text-shadow:0rpx 2rpx 6rpx rgba(80,80,80,1);
text-align: center;
min-width: 120rpx;
margin-left: 20rpx;
}
.history{
line-height: 50rpx;
font-size: 28rpx;
height:50rpx;
background:rgba(245,245,245,1);
border-radius:4px;
font-weight:500;
float: left;
padding: 0 10rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.history .icon{
background-size: 100% 100%;
margin-right: 10rpx;
width: 20rpx;
height: 24rpx;
min-width: 20rpx;
background-image: url("http://qn.colorcun.com/reserve/images/addr.png");
}
.history .icon-1{
width: 24rpx;
height: 18rpx;
min-width: 24rpx;
background-image: url("http://qn.colorcun.com/reserve/images/his-se.png");
}
.activity{
position: relative;
}
.activity:after{
content: "";
position:absolute;
height: 32rpx;
width: 32rpx;
margin-left: 10rpx;
min-width: 32rpx;
background-image: url("http://qn.colorcun.com/reserve/images/huizi.png");
background-size: 100% 100%;
top:4rpx;
}
.title .light{
color: #C0A369;
}
\ No newline at end of file
... ...
... ... @@ -204,7 +204,7 @@
</view>
</view>
<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预订</as>
<as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone" hasTip="{{false}}"></as>
<getpos bindpos="onpos" id="getpos"></getpos>
<discount id="discount" seller="{{seller}}" bindhide="discountHide" bindshow="discountShow"></discount>
<share id="share" seller_id="{{seller.id}}" seller="{{seller}}" wx:if="{{seller.id}}"></share>
... ...
... ... @@ -26,7 +26,7 @@
</cover-view>
<cover-view class="searchAddr flex-ll">
<cover-image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></cover-image>
<cover-view class="title">{{hasSuggestion?suggestion.title:'搜索店铺、地点或商圈'}}</cover-view>
<cover-view class="title">{{hasSuggestion?suggestion.title:'输入餐厅名或地名,快速订包间'}}</cover-view>
</cover-view>
</cover-view>
</formids>
... ...
... ... @@ -117,7 +117,7 @@ page{
.searchAddr {
margin-left: 15rpx;
width: 380rpx;
width: 400rpx;
height: 60rpx;
background-color: #fefefe;
border-radius: 30rpx;
... ...
... ... @@ -93,19 +93,30 @@ Page({
let mapParam=this.options
this.offset=1 //page
this.size=20 //page size
//计算视窗中心
let map=JSON.parse(mapParam.map);
let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
this.param={
lat:lat,
lng:lng,
lat_extend:mapParam.lat,
lng_extend:mapParam.lng,
offset:this.offset,
size:this.size,
distance:50,
};
if(mapParam.keyword){
this.param={
lat_extend:mapParam.lat,
lng_extend:mapParam.lng,
keyword:mapParam.keyword,
offset:this.offset,
size:this.size,
distance:5000,
};
}else{
//计算视窗中心
let map=JSON.parse(mapParam.map);
let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
this.param={
lat:lat,
lng:lng,
lat_extend:mapParam.lat,
lng_extend:mapParam.lng,
offset:this.offset,
size:this.size,
distance:50,
};
}
if(this.data.multiIndex[0]>0){
this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1);
}
... ...
... ... @@ -8,8 +8,6 @@ var qqmapsdk = new QQMapWX({
});
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
const search_history_cache_key='SEARCH_HISTORY_CACHE_KEY';
Page({
/**
... ... @@ -18,13 +16,15 @@ Page({
data: {
history:[],
suggestion:[],
hasSellerMore:false,
keyword:'',
sellerSplit:-1,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getHistory();
this.getPos()
},
... ... @@ -39,7 +39,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getHistory();
},
/**
... ... @@ -56,26 +56,23 @@ Page({
},
getHistory(){
let ca=util.cache(search_history_cache_key);
if(ca){
App.Customer.GetHistorySearch().then(res=>{
let mks=[]
res.data.forEach(h=>{
mks.push({ // 获取返回结果,放到mks数组中
title: h.name,
id: h.sid,
addr: '',
city: '',
district: 0,
latitude: h.latitude,
longitude: h.longitude,
type:h.type==1?-1:h.type,
})
})
this.setData({
history:ca
history:mks
})
}
},
setHistory(item){
let newca=[item];
let ca=this.data.history;
let maxL=20;
for(let i=0;i<ca.length;i++){
if(ca[i].id!=item.id){
newca.push(ca[i]);
}
if(newca.length>maxL) break;
}
util.cache(search_history_cache_key,newca);
this.setData({
history:newca,
})
},
//在Page({})中使用下列代码
... ... @@ -85,7 +82,6 @@ Page({
for (var i = 0; i < this.data.suggestion.length; i++) {
if (i == id) {
console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])
this.setHistory(this.data.suggestion[i])
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(this.data.suggestion[i])
... ... @@ -97,24 +93,9 @@ Page({
}
}
},
backHistoryFill: function (e) {
var i = util.attr(e,'index');
let item=this.data.history[i];
console.log(item)
this.setHistory(item)
this.setData({
backfill: item.title
});
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(item)
wx.navigateBack();
},
inputVal:'',
//触发关键词输入提示事件
getsuggest: function (e) {
var _this = this;
//调用关键词提示接口
this.inputVal=e.detail.value;
if(e.detail.value.length<1){
... ... @@ -132,21 +113,27 @@ Page({
key:map_key,
}).then(res=>{
res.data=res.data.data
var sug = [];
var sug = [],hasSellerMore=false,sellerSplit=-1
for (var i = 0; i < res.data.length; i++) {
sug.push({ // 获取返回结果,放到sug数组中
title: res.data[i].title,
id: res.data[i].id,
addr: res.data[i].address,
city: res.data[i].city,
district: res.data[i].district,
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
type:res.data[i].type,
});
if(i==2 && res.data[i].type==-1){
hasSellerMore=true
continue;
}
if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){
sellerSplit=i-1
}
let item=res.data[i]
item.latitude=item.location.lat
item.longitude=item.location.lng
item.addr=item.address
item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)'))
sug.push(item);
}
_this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
suggestion: sug
this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
suggestion: sug,
hasSellerMore:hasSellerMore,
keyword:this.inputVal,
sellerSplit:sellerSplit,
});
})
},
... ... @@ -161,7 +148,6 @@ Page({
orderby:'_distance',
key:map_key,
}).then(res=>{
res.data=res.data.data
var mks = []
for (var i = 0; i < res.data.length; i++) {
mks.push({ // 获取返回结果,放到mks数组中
... ... @@ -173,6 +159,7 @@ Page({
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
type:res.data[i].type,
category:res.data[i].category,
})
}
this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
... ... @@ -227,5 +214,51 @@ Page({
}
},
})
}
},
gotoList(){
wx.navigateTo({
url:util.http_build_query({
lat:this.location.latitude,
lng:this.location.longitude,
keyword:this.inputVal,
multiIndex:0,
},'./indexList')
})
},
searchItemClick(e){
//console.log('searchItemClick',e)
let item=e.detail.data
if(e.detail.act=='detail'){
if(item.type==-1){
wx.navigateTo({
url:util.http_build_query({
id:item.id,
},'./detail')
})
}else{
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(item)
this.setData({
backfill: item.title
});
wx.navigateBack();
}
}else{
wx.navigateTo({
url:util.http_build_query({
id:item.id,
activeTab:'reserve',
},'./detail')
})
}
},
historyEmpty(){
App.Customer.DelHistorySearch().then(()=>{
App.Customer.GetHistorySearch({},'clear')
this.setData({
history:[]
})
})
},
})
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@
"navigationBarTitleText":"周到安排",
"usingComponents": {
"formids":"/components/formids/formids",
"nav":"/components/nav/nav"
"nav":"/components/nav/nav",
"search-item":"/components/reserve/search/item"
}
}
\ No newline at end of file
... ...
... ... @@ -4,40 +4,33 @@
<view class="searchAddrView">
<view class="searchAddr flex-ll">
<image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></image>
<input style="width: 100%;" placeholder="搜索店铺、地点或商圈"
<input style="width: 100%;" placeholder="输入餐厅名或地名,快速订包间"
type="text" confirm-type="done"
focus
bindinput="getsuggest" value="{{backfill}}"/>
<view class="search-but" bindtap="nearby_search">搜索</view>
</view>
</view>
<view class="res-view">
<!--绑定回填事件-->
<view class="res-item" wx:for="{{suggestion}}" wx:key="index"
bindtap="backfill" id="{{index}}">
<!--根据需求渲染相应数据-->
<!--渲染地址title-->
<view class="label">{{item.title}}</view>
<!--渲染详细地址-->
<view class="address">{{item.addr}}</view>
</view>
<block wx:for="{{suggestion}}" wx:key="index"
bindtap="backfill" id="{{index}}">
<search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item>
<view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view>
<view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view>
</block>
<view class="see-more bottom" wx:if="{{suggestion.length>0}}"></view>
</view>
</view>
<view class="history" wx:if="{{history.length>0 && suggestion.length<1}}">
<view class="pages">
<view class="history-title">历史记录</view>
<view class="hr-one"></view>
<view class="flex-lr">
<view class="history-title">最近搜索</view>
<view class="history-empty" bindtap="historyEmpty"></view>
</view>
<view class="history-list">
<view class="flex-ll item" wx:for="{{history}}" wx:key="history.key"
bindtap="backHistoryFill" data-index="{{index}}">
<view class="icon-view">
<image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/addr.png"></image>
</view>
<view class="info">
<view class="title">{{item.title}}</view>
<view class="addr">{{item.addr}}</view>
</view>
</view>
<block wx:for="{{history}}" wx:key="history.key">
<search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item>
</block>
</view>
</view>
</view>
... ...
... ... @@ -7,9 +7,11 @@
.searchAddrView{
position: fixed;
top:100rpx;
width: 90%;
width: 110%;
height: 110rpx;
background-color: #fefefe;
z-index: 10;
margin-left: -5%;
}
.searchAddr {
position: fixed;
... ... @@ -23,6 +25,7 @@
line-height: 60rpx;
font-size: 28rpx;
z-index: 99;
left: 5%;
}
.searchAddr .icon{
min-width: 26rpx;
... ... @@ -33,18 +36,7 @@
.res-view{
margin-top: 110rpx;
}
.res-item{
width: 100%;
border-bottom: 2rpx solid #cccccc;
padding: 20rpx 0;
}
.res-item .label{
font-size: 30rpx;
}
.res-item .address{
font-size: 24rpx;
color:#4C4E4F;
}
.search-but{
min-width: 140rpx;
color:#000000;
... ... @@ -62,32 +54,53 @@
color:#999999;
height: 40rpx;
line-height: 40rpx;
font-weight:600;
margin-bottom: 20rpx;
}
.see-more{
width: 100%;
height: 34rpx;
position: relative;
margin-bottom: 40rpx;
margin-top: 40rpx;
}
.hr-one{
.see-more:before{
content: "";
width: 100%;
height: 2rpx;
background-color: #F5F5F5;
width: 110%;
margin: 18rpx -5% 0;
position: absolute;
left: 0;
top:17rpx;
}
.history .item{
height: 120rpx;
line-height: 120rpx;
.see-more:after{
content: "查看更多";
width:136rpx;
height:34rpx;
font-size:24rpx;
font-weight:500;
color:rgba(153,153,153,1);
line-height:34rpx;
background-color: #fefefe;
position: absolute;
display: block;
left:calc(50% - 68rpx);
top:0;
text-align: center;
}
.history .icon{
width: 22rpx;
height: 26rpx;
min-width: 22rpx;
margin-right: 20rpx;
.see-more.bottom:after{
width:200rpx;
content: "我是有底线的";
left:calc(50% - 100rpx);
}
.history .title{
font-size: 28rpx;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 4rpx;
.see-split{
width: 100%;
height: 20rpx;
}
.history .addr{
font-size: 24rpx;
color:#999999;
height: 34rpx;
line-height: 34rpx;
.history-empty{
width: 28rpx;
height: 28rpx;
background-image: url("http://qn.colorcun.com/reserve/images/empty.png");
background-size: 100% 100%;
}
\ No newline at end of file
... ...
... ... @@ -352,7 +352,7 @@
"id": 39,
"name": "pages/reserve/detail 在线订座 ",
"pathName": "pages/reserve/detail",
"query": "id=689&fromid=&activeTab=reserve",
"query": "id=80&fromid=&activeTab=",
"scene": null
},
{
... ...
... ... @@ -323,5 +323,19 @@ export default {
'App.Seller.VerificationIsAdmin':{
cachetime: 1800,
},
//搜索相关
'App.Customer.SetHistorySearch':{
openid:'openid'
},
//搜索相关
'App.Customer.DelHistorySearch':{
openid:'openid'
},
//搜索相关
'App.Customer.GetHistorySearch':{
openid:'openid',
cachetime: -1,
},
}
\ No newline at end of file
... ...
... ... @@ -71,4 +71,16 @@ module.exports = {
}
return name
},
distance:function(mi){
if(mi>=0){
mi=mi*1
var gl='m'
if(mi>=1000){
mi=mi/1000
gl='km'
}
return mi.toFixed(2)+gl
}
return '';
},
};
\ No newline at end of file
... ...