首次提交

This commit is contained in:
duan
2024-06-06 11:50:53 +08:00
parent cab4751927
commit 544c3b65b2
344 changed files with 72919 additions and 1 deletions

1806
pages/index/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,636 @@
<template>
<view class="content">
<view class="search-box">
<!-- mSearch组件 如果使用原样式删除组件元素-->
<!-- <mSearch class="mSearch-input-box" :mode="2" button="inside" :placeholder="defaultKeyword"
@search="doSearch(false)" @input="inputChange" @confirm="doSearch(false)" v-model="keyword"></mSearch> -->
<!-- 原样式 如果使用原样式恢复下方注销代码 -->
<!-- <view class="input-box">
<input type="text" :adjust-position="true" :placeholder="defaultKeyword" @input="inputChange" v-model="keyword" @confirm="doSearch(false)"
placeholder-class="placeholder-class" confirm-type="search">
</view>
<view class="search-btn" @tap="doSearch(false)">搜索</view> -->
<view class="margin-lr">
<u-search style="width: 100%;" placeholder="请输入商家或者商品名称" :focus="true" v-model="keyword"
:show-action="true" :animation="true" shape="square" action-text="取消" @custom="goBack()"
@search="doSearch(false)">
</u-search>
</view>
<!-- <u-dropdown v-show="isShowKeywordList">
<u-dropdown-item v-model="value1" :title="title" :options="options1" @change="confirm">
</u-dropdown-item>
<u-dropdown-item v-model="value2" :title="title1" :options="options2" @change="confirm2">
</u-dropdown-item>
</u-dropdown> -->
<view v-show="isShowKeywordList" style="width: 100%;z-index: 999;">
<view class="flex justify-between align-center bg-white padding-tb padding-lr-sm">
<view class="flex-sub text-center" :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
<view class="flex-sub text-center" :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
<view class="flex-sub text-center" :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
<view class="flex-sub text-center flex" @click="isShow = !isShow" >
<view class="flex align-center" style="margin: 0 auto;">
<view :class="isShow?'select':''" >筛选</view>
<u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
<u-icon v-if="isShow" name="arrow-up" color="#FCD202" size="28"></u-icon>
</view>
</view>
</view>
<view v-if="isShow" style="position: absolute;top: 150rpx;width: 100%;z-index: 1000;background: rgba(0,0,0,.5);height: 100vh;" @click="isShow =false">
<view class="padding-lr bg-white">
<view class="flex justify-between align-center padding-tb-sm u-border-bottom" v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)" >
<view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
<u-icon v-if="item.select" name="checkmark" color="#FCD202" size="28"></u-icon>
</view>
</view>
</view>
</view>
<!-- 原样式 end -->
<!-- 活动筛选 -->
<view class="hd flex justify-center" v-if="hdlist.length>0 && isShowKeywordList">
<view class="hd-box">
<scroll-view scroll-x="true" class="scroll-view_H">
<view class="hd-box-item" :style="currenthd==index?'background-color:#fcd202;font-weight:bold':''" @click="searchhd(index,item.activityId)" v-for="(item,index) in hdlist" :key="index">{{item.activityTitle}}</view>
</scroll-view>
</view>
</view>
</view>
<view class="search-keyword">
<view class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
<view class="padding-lr">
<view class="" v-for="(item,index) in keywordList" :key='index'>
<view class=" flex justify-between bg-white padding" style="margin-bottom: 20rpx;"
@click="goNav('/pages/index/shop/index?shopId='+item.shopId)">
<image :src="item.shopCover" class="radius" style="width: 160rpx;height: 160rpx;"></image>
<view class=" margin-left-sm" style="width: 450rpx;">
<view class=" flex flex-direction justify-between">
<view class="text-lg text-bold text-black">{{item.shopName}}</view>
<view class="flex align-center margin-top-xs" style="width: 100%;">
<u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
<text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
<text class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
<text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
<text class="text-gray margin-left-xs">{{item.distance}}</text>
</view>
<view class="text-gray margin-top-xs flex justify-between">
<view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}</view>
<view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view>
</view>
<view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
营业时间{{item.businessHours}}-{{item.lockHours}}</view>
<view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
<view class="flex flex-wrap align-center" style="width: 100%;height: 100%;overflow: hidden;">
<view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">{{item.exemptMinMoney}}免配送费</view>
<view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
v-if="item.shopLable">
{{ite}}
</view>
<view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">{{it.minMoney}}{{it.money}}</view>
</view>
</view>
</view>
<view class="flex margin-top-xs">
<view v-for="(ite,ind) in item.goodsList" :key='ind'
@click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
<image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;"
class="radius" mode=""></image>
<view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
<view class="text-bold margin-top-xs" style="color: #FD6416;"> <text
class="text-sm">¥</text> {{ite.goodsMoney}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- <view v-if="keywordList.length == 0">
暂无数据
</view> -->
<empty v-if="keywordList.length == 0"></empty>
</view>
<view class="keyword-box" v-show="!isShowKeywordList" scroll-y>
<view class="keyword-block" v-if="hotKeywordList.length>0">
<view class="keyword-list-header">
<view>热门搜索</view>
<view>
<image @tap="hotToggle" :src="'/static/images/index/attention'+forbid+'.png'"></image>
</view>
</view>
<view class="keyword" v-if="forbid==''">
<view v-for="(keyword,index) in hotKeywordList" @tap="doSearch(keyword)" :key="index">
{{keyword}}
</view>
</view>
<view class="hide-hot-tis" v-else>
<view>当前搜热已隐藏</view>
</view>
</view>
<view class="keyword-block" v-if="oldKeywordList.length>0">
<view class="keyword-list-header">
<view>历史记录</view>
<view>
<image @tap="oldDelete" src="/static/images/index/delete.png"></image>
</view>
</view>
<view class="keyword">
<view v-for="(keyword,index) in oldKeywordList" @tap="doSearch(keyword.message)" :key="index">
{{keyword.message}}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components: {
empty
},
data() {
return {
currenthd:-1,
hdlist:[],
activityId:'',
isShow: false,
defaultKeyword: "",
keyword: "",
oldKeywordList: [], //历史记录
hotKeywordList: [], //热搜
keywordList: [], //搜索列表
forbid: '',
isShowKeywordList: false,
limit: 10,
page: 1,
userId: '',
isVip: false,
lng: '',
lat: '',
value1: 1,
value2: 0,
options1: [{
label: '综合排序',
value: 1,
},
{
label: '距离优先',
value: 3,
},
{
label: '销量优先',
value: 4,
}
],
options2: [{
value: '',
label: "全部"
}],
options4: [{
id: '',
select: true,
shopTypeName: "全部"
}],
current: 1,
shopTypeId: '',
title: '综合排序',
title1: '筛选',
totalCount: 0
}
},
onLoad() {
let that = this
this.getSearchList()
this.gethdlist();
this.userId = uni.getStorageSync('userId') ? uni.getStorageSync('userId') : ''
this.lng = uni.getStorageSync('lng')
this.lat = uni.getStorageSync('lat')
this.getShopType()
this.isVip = uni.getStorageSync('isVIP')
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function(res) {
// that.lat = res.latitude;
// that.lng = res.longitude;
}
});
},
methods: {
//筛选活动
searchhd(index,activityId){
if(index==this.currenthd){
this.currenthd = -1
this.activityId = '';
this.doSearch(false);
}else{
this.currenthd = index;
this.activityId=activityId;
this.doSearch(false);
}
},
//获取所有活动
gethdlist(){
this.$Request.get("/app/activityManage/getActivityList").then(res => {
if (res.code == 0) {
res.data.records.map((item,index)=>{
if(item.activityId==14){
res.data.records.splice(index, 1)
}
})
this.hdlist = res.data.records
}
});
},
getSelect(e) {
this.options4.forEach(res=>{
if(res.id == e.id) {
res.select = true
this.page = 1
this.shopTypeId = e.id
// this.getShopList();
this.doSearch(this.keyword);
this.isShow = false
} else {
res.select = false
}
})
},
confirm(e) {
console.log(e)
this.page = 1
this.current = e;
this.doSearch(this.keyword);
},
confirm2(e) {
console.log(e)
this.page = 1
this.shopTypeId = e
if (e == 0) {
this.title1 = '筛选'
} else {
this.title1 = this.options2[e].label
}
this.doSearch(this.keyword);
},
// 获取搜索历史
getSearchList() {
let data = {
page: this.page,
limit: this.limit,
}
this.$Request.get("/app/searchhistory/selectSearchHistory", data).then(res => {
console.log(res)
if (res.code == 0) {
this.oldKeywordList = res.data.list
}
});
this.$Request.getT('/app/common/type/309').then(res => { //订单状态通知
if (res.code == 0) {
this.hotKeywordList = res.data.value.split(',')
}
})
},
//清除历史搜索
oldDelete() {
uni.showModal({
content: '确定清除历史搜索记录?',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
this.$Request.get("/app/searchhistory/deleteSearchHistory").then(res => {
if (res.code == 0) {
this.getSearchList()
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
//执行搜索
doSearch(keyword) {
this.keyword = keyword === false ? this.keyword : keyword;
this.isShowKeywordList = true;
if (!this.keyword) {
uni.showToast({
title: '请输入内容',
icon: 'none',
duration: 1000
})
return
}
let data = {
impotr: this.keyword,
screen: this.current,
shopTypeId: this.shopTypeId,
limit: this.limit,
page: this.page,
lng: this.lng,
lat: this.lat,
userId: this.userId,
activityId:this.activityId
}
this.$Request.get("/app/goods/selectShop", data).then(res => {
if (res.code == 0) {
this.totalCount = res.data.totalCount
res.data.list.forEach(ret => {
if (ret.distance > 1000) {
ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
} else {
if (ret.distance == 0) {
ret.distance = "0m";
} else {
ret.distance = Number(ret.distance).toFixed(1) + "m";
}
}
ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
ret.errandTime = Math.round(ret.errandTime)
ret.shopScore = ret.shopScore.toFixed(1)
})
if (this.page == 1) this.keywordList = [];
this.keywordList = [...this.keywordList, ...res.data.list]
}
});
},
// 商户类型
getShopType() {
this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
if (res.code == 0) {
res.data.forEach(res => {
res.select = false
})
this.options4 = [...this.options4, ...res.data]
}
})
},
// 点击取消返回首页
goBack() {
uni.navigateBack()
},
//热门搜索开关
hotToggle() {
this.forbid = this.forbid ? '' : '_forbid';
},
// 跳转商品详情
goDet(goodsId, shopId) {
uni.navigateTo({
url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=1'
})
},
goNav(url) {
console.log(url)
if (this.userId) {
uni.navigateTo({
url
})
} else {
uni.navigateTo({
url: '/pages/public/login'
})
}
},
// 跳转订单
goOrder(e) {
if (this.userId) {
uni.navigateTo({
url: '/pages/index/game/order?id=' + e.id
});
} else {
uni.navigateTo({
url: '/pages/public/login'
});
}
},
},
onReachBottom: function() {
// this.page = this.page + 1;
// this.doSearch(false);
if(this.keywordList.length<this.totalCount) {
this.page = this.page + 1;
this.doSearch(false);
} else {
uni.showToast({
title: '已经到底了',
icon: 'none'
})
}
},
onPullDownRefresh: function() {
this.page = 1;
this.doSearch(false);
},
}
</script>
<style lang="scss">
page {
/* background-color: #FFFFFF; */
}
.hd{
width: 100%;
height: auto;
// margin-top: 20rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
background-color: rgb(248,248,248);
.hd-box{
width: 686rpx;
height: 100%;
.scroll-view_H{
width: 100%;
white-space: nowrap;
}
.hd-box-item{
display: inline-block;
padding: 10rpx 20rpx 10rpx 20rpx;
background-color: #ffffff;
font-size: 24rpx;
border-radius: 8rpx;
margin-right: 10rpx;
}
}
}
.select{
color: #FCD202;
}
.search-box {
width: 100%;
/* background-color: rgb(242, 242, 242); */
padding: 15upx 0 0;
/* display: flex; */
/* justify-content: space-between; */
position: sticky;
top: 0;
background-color: #FFF;
z-index: 99;
}
.search-box .mSearch-input-box {
width: 100%;
}
.search-box .input-box {
width: 85%;
flex-shrink: 1;
display: flex;
justify-content: center;
align-items: center;
}
.search-box .search-btn {
width: 15%;
margin: 0 0 0 2%;
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
font-size: 28upx;
/* color: #fff; */
background: linear-gradient(to right, #ff9801, #ff570a);
border-radius: 60upx;
}
.search-box .input-box>input {
width: 100%;
height: 60upx;
font-size: 32upx;
border: 0;
border-radius: 60upx;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 0 3%;
margin: 0;
background-color: #ffffff;
}
.placeholder-class {
color: #9e9e9e;
}
.search-keyword {
width: 100%;
/* background-color: #111224; */
}
.keyword-list-box {
height: calc(100vh - 110upx);
/* padding-top: 10upx; */
/* border-radius: 20upx 20upx 0 0; */
/* background-color: #fff; */
}
.keyword-entry-tap {
background-color: #eee;
}
.keyword-entry {
width: 94%;
height: 80upx;
margin: 0 3%;
font-size: 30upx;
color: #333;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: solid 1upx #e7e7e7;
}
.keyword-entry image {
width: 60upx;
height: 60upx;
}
.keyword-entry .keyword-text,
.keyword-entry .keyword-img {
height: 80upx;
display: flex;
align-items: center;
}
.keyword-entry .keyword-text {
width: 90%;
}
.keyword-entry .keyword-img {
width: 10%;
justify-content: center;
}
.keyword-box {
height: calc(100vh - 110upx);
/* border-radius: 20upx 20upx 0 0; */
/* background-color: #111224; */
}
.keyword-box .keyword-block {
padding: 10upx 0;
}
.keyword-box .keyword-block .keyword-list-header {
width: 94%;
padding: 10upx 3%;
font-size: 27upx;
font-weight: 700;
/* color: #FFFFFF; */
display: flex;
justify-content: space-between;
}
.keyword-box .keyword-block .keyword-list-header image {
width: 40upx;
height: 40upx;
}
.keyword-box .keyword-block .keyword {
width: 94%;
padding: 3px 3%;
display: flex;
flex-flow: wrap;
justify-content: flex-start;
}
.keyword-box .keyword-block .hide-hot-tis {
display: flex;
justify-content: center;
font-size: 28upx;
/* color: #FFFFFF; */
}
.keyword-box .keyword-block .keyword>view {
display: flex;
justify-content: center;
align-items: center;
border-radius: 10upx;
padding: 0 20upx;
margin: 10upx 20upx 10upx 0;
height: 60upx;
font-size: 28upx;
background-color: #eee;
/* color: #FFFFFF; */
}
.lable {
border: 1rpx solid #FFE6D9;
height: 40rpx;
padding: 0 14rpx;
background: #FFE6D9;
border-radius: 4rpx;
font-weight: 500;
color: #FD6416;
font-size: 20rpx;
margin-right: 10rpx;
margin-bottom: 10rpx;
}
</style>

View File

@@ -0,0 +1,549 @@
<template>
<view class="container">
<view class="flex align-center" style="background:#fff;">
<view class="content padding-left bg-white" style="color: #333;font-size: 28upx;font-weight: bold;"
v-if="city">
<text @click="goCity()">{{city}}<text class="cuIcon-right"></text></text>
</view>
<view class="padding-tb-sm padding-lr-xs margin-right-xs flex-sub">
<view class="search-bar-form">
<view class="search-bar-box">
<icon class="icon-search-in-box" type="search" size="16"></icon>
<input confirm-type="search" class="search-bar-input" placeholder="输入地址查询"
placeholder-class="phcolor" :value="inputVal" :focus="inputShowed" @input="inputTyping" />
<view class="icon-clear" v-if="inputVal" @tap="clearInput">
<!-- #ifdef APP-PLUS || MP -->
<icon type="clear" :size="15"></icon>
<!-- #endif -->
</view>
</view>
</view>
</view>
</view>
<view class="tui-list search-result " v-if="inputShowed">
<view class="padding margin-lr radius flex justify-between align-center"
v-for="(item,index) in searchResult" :key="index" @click="update(item)">
<view>
<view class="text-lg text-bold text-black">{{item.addressDetail}}</view>
<view class="text-df text-gray margin-top-xs">{{item.province}}{{item.city}}{{item.district}}</view>
</view>
</view>
</view>
<view v-else>
<view class="tui-list city-list " v-if="list&&list.length>0">
<view class="flex justify-between">
<view class="title text-lg text-bold padding-sm padding-top-sm">我的地址</view>
<view style="display: flex;align-items: center;font-size: 26rpx;" class="padding-sm padding-top-sm" @tap="goAddressList">
<view>地址管理</view>
<image src="../../static/images/index/right2.png" style="width: 12rpx;height: 20rpx;margin-left: 6rpx;"></image>
</view>
</view>
<view class="padding margin-lr radius flex justify-between align-center" v-for="(item,index) in list"
:key="index" v-if="index == 0" @click="update(item)" style="border: 2rpx solid #FCD202;">
<view>
<view class="text-lg text-bold text-black">{{item.addressDetail}}</view>
<view class="text-df text-gray margin-top-xs">{{item.province}}{{item.city}}{{item.district}}
</view>
</view>
<u-icon name="checkbox-mark" color="#FCD202" size="42"></u-icon>
</view>
<view class="padding margin-lr radius flex justify-between align-center" v-for="(item,index) in list"
:key="index" v-if="index > 0" @click="update(item)">
<view>
<view class="text-lg text-bold text-black">{{item.addressDetail}}</view>
<view class="text-df text-gray margin-top-xs">{{item.province}}{{item.city}}{{item.district}}
</view>
</view>
</view>
</view>
</view>
<!-- 添加收货地址 -->
<view class="btn">
<view class="address_push" @click="addAddress">添加收货地址</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
region: [],
inputVal: '', // 搜索框输入的内容
inputShowed: false, // 输入框是否显示
list: [],
searchResult: [], // 搜索城市的结果
localCampus: '',
campusDetails: '',
txt: '选择城市',
province: '', //省
city: '', //市
district: '', //区
page: 1,
limit: 10,
totalCount: 0,
longitude: '',
latitude: ''
}
},
onLoad: function(options) {
console.log(options)
if (uni.getStorageSync('city')) {
this.city = uni.getStorageSync('city')
this.longitude = uni.getStorageSync('lng')
this.latitude = uni.getStorageSync('lat')
} else {
this.getlocation()
}
},
onShow() {
if (uni.getStorageSync('userId')) {
this.initCampusList()
}
},
methods: {
goAddressList() {
uni.navigateTo({
url: '/my/address/index'
});
},
update(e) {
let data = {
addressId: e.addressId,
addressDefault: 1,
}
this.$Request.postJson("/app/address/updateAddress", data).then(res => {
if (res.code == 0) {
uni.removeStorageSync('city')
uni.removeStorageSync('lng')
uni.removeStorageSync('lat')
setTimeout(function() {
uni.navigateBack()
}, 10)
}
});
},
goCity() {
let that = this
uni.chooseLocation({
success: function(res) {
console.log(res, '选择');
that.longitude = res.longitude
that.latitude = res.latitude
that.city = res.name
uni.setStorageSync('lng', that.longitude)
uni.setStorageSync('lat', that.latitude)
uni.setStorageSync('city', res.name)
setTimeout(function() {
uni.navigateBack()
}, 10)
}
});
},
getlocation() {
let that = this
// that.list=[]
uni.getLocation({
type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
that.longitude = res.longitude
that.latitude = res.latitude
let data = {
lat: res.latitude,
lng: res.longitude
}
that.$Request.get("/app/address/selectCity", data).then(res => {
if (res.code == 0) {
that.city = res.data.city
}
});
// that.initCampusList();
}
});
},
//获取社区列表
initCampusList() {
let that = this;
let data = {
page: that.page,
limit: that.limit,
}
that.$Request.getT('/app/address/selectAddressList', data).then(res => {
console.log(res)
if (res.code === 0) {
if (that.page == 1) {
that.list = res.data.list
} else {
that.list = [...that.list, ...res.data.list]
}
}
})
},
showInput() {
this.inputShowed = true
},
clearInput() {
this.inputVal = "";
this.inputShowed = false;
this.searchResult = [];
uni.hideKeyboard() //强行隐藏键盘
},
inputTyping(e) {
this.inputVal = e.detail.value;
if (e.detail.value.length === 0) {
this.searchResult = [];
this.inputShowed = false
} else {
this.inputShowed = true
}
this.searchCity()
},
// 搜索城市
searchCity() {
let data = {
impotr: this.inputVal,
page: 1,
limit: 1000
}
this.$Request.get("/app/address/searchAddress", data).then(res => {
if (res.code == 0) {
this.searchResult = res.data.list
}
});
},
// 添加地址
addAddress() {
let userId = this.$queue.getData('userId');
if (!userId) {
uni.navigateTo({
url: '/pages/public/login'
})
return
}
uni.navigateTo({
url: '/my/address/add'
})
},
},
onReachBottom: function() {
this.page = this.page + 1;
this.initCampusList();
},
onPullDownRefresh: function() {
this.page = 1;
this.initCampusList();
},
}
</script>
<style lang="scss">
page {
height: 100%;
background: #FFFFFF;
}
.page {
height: 100%;
overflow: hidden;
}
.search-bar {
display: flex;
align-items: center;
position: relative;
padding: 27rpx 30rpx 35rpx;
background-color: #fff;
}
.search-bar-form {
flex: 1;
position: relative;
border-radius: 32rpx;
background: #f2f5f7;
}
.search-bar-box {
display: flex;
align-items: center;
position: relative;
padding-left: 20rpx;
padding-right: 20rpx;
height: 64rpx;
z-index: 1;
}
.search-bar-input {
line-height: normal;
width: 100%;
padding-left: 20rpx;
font-size: 30rpx;
color: #333;
}
.phcolor {
font-size: 30rpx;
}
.icon-clear {
height: 38rpx;
}
.icon-clear .tui-icon-class {
display: block
}
.search-bar-label {
height: 64rpx;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 2;
border-radius: 32rpx;
color: #ccc;
background: #f2f5f7;
}
.icon-search {
position: relative;
height: 26rpx;
margin-right: 20rpx;
font-size: inherit;
}
.search-bar-text {
font-size: 30rpx;
line-height: 32rpx;
}
.cancel-btn {
padding-left: 30rpx;
}
.search-result::before {
display: none;
}
.search-result::after {
display: none;
}
.tui-list-cell {
// padding: 30upx;
// display: flex;
// flex-direction: row;
// justify-content: space-between;
// align-items: center;
// width: 100%;
}
.tui-list-cell-hover {
// background-color: #eee !important;
}
.tui-list-cell-navigate {
// width: 100%;
// position: relative;
// padding: 30rpx 0 30rpx 30rpx;
font-size: 30rpx;
color: #333;
font-weight: 800;
}
.tui-list-cell-navigate::after {
content: '';
position: absolute;
border-bottom: 1rpx solid #eaeef1;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
bottom: 0;
right: 0;
left: 30rpx;
}
.current-city {
padding: 0 30rpx 30rpx;
background: #fff;
}
.tui-icon-class {
margin-right: 10rpx;
}
.current-city .title {
font-size: 28rpx;
line-height: 24rpx;
color: #333333;
}
.box {
background: #F5F5F5;
border-radius: 10upx;
width: 686upx;
// height: 134upx;
}
.city-name {
display: flex;
align-items: center;
// margin-top: 17rpx;
font-size: 30rpx;
font-weight: bold;
line-height: 30rpx;
color: #333;
}
.hot-city .title {
height: 48rpx !important;
padding-left: 30rpx;
font-size: 24rpx !important;
line-height: 48rpx !important;
color: #999;
background: #f2f5f7 !important;
}
.city-names {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
padding: 12rpx 90rpx 26rpx 30rpx;
background: #fff;
}
.city-name-item {
display: flex;
justify-content: center;
align-items: center;
width: 140rpx;
height: 56rpx;
margin-top: 16rpx;
/* border: solid 1rpx #ccc; */
border-radius: 28rpx;
font-size: 28rpx;
color: #333;
position: relative;
}
.city-name-item::before {
content: "";
position: absolute;
width: 200%;
height: 200%;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scale(0.5, 0.5);
transform: scale(0.5, 0.5);
-webkit-box-sizing: border-box;
box-sizing: border-box;
left: 0;
top: 0;
border-radius: 56rpx;
border: 1px solid #ccc;
}
.tap-city {
color: #fff;
background: #5677fc;
/* border: solid 1rpx #5677fc; */
}
.tui-list {
background-color: #fff;
position: relative;
width: 100%;
display: flex;
flex-direction: column;
padding-bottom: env(safe-area-inset-bottom);
}
.tui-list-cell-divider {
height: 48rpx;
padding-left: 30rpx;
font-size: 24rpx;
color: #999;
background: #f2f5f7;
padding: 0 30rpx;
display: flex;
align-items: center;
}
.tui-indexed-list-bar {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
z-index: 9999;
position: absolute;
top: 132rpx;
right: 0;
padding-right: 10rpx;
width: 44rpx;
}
.tui-indexed-list-text {
font-size: 22rpx;
white-space: nowrap;
}
.tui-indexed-list-bar.active {
background-color: rgb(200, 200, 200);
}
.tui-indexed-list-alert {
position: absolute;
z-index: 20;
width: 160rpx;
height: 160rpx;
left: 50%;
top: 50%;
margin-left: -80rpx;
margin-top: -80rpx;
border-radius: 80rpx;
text-align: center;
line-height: 160rpx;
font-size: 70rpx;
color: #fff;
background-color: rgba(0, 0, 0, 0.5);
}
/* 添加收货地址 */
.btn {
position: fixed;
bottom: 0rpx;
width: 100%;
height: 100rpx;
line-height: 100rpx;
background-color: white;
padding-top: 10rpx;
}
.address_push {
width: 90%;
height: 80rpx;
margin: 0 auto;
background: #FCD202;
border-radius: 20rpx;
color: white;
text-align: center;
line-height: 80rpx;
font-size: 35rpx;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

518
pages/index/shop/im.vue Normal file
View File

@@ -0,0 +1,518 @@
<template>
<view>
<view style="width: 100%;padding-bottom: 140rpx;">
<view style="display: flex;flex-direction: column;" v-for="(item,index) in ListItem" :key='index'>
<view style="margin-top: 15rpx;width: 100%;text-align: center;font-size: 26rpx;color: #999999;">
{{item.createTime}}
</view>
<view v-if="!item.shopId && !item.riderId" style="width: 83%;margin-left: 15%;">
<view class="chat-listitem" style="float: right;">
<view v-if="item.content && item.messageType === 1" @longpress="copy(item.content)"
class="chat-listitem-text" style="margin-right: 20rpx;">{{item.content}}</view>
<image @tap="viewImg(item.content)" v-if="item.content && item.messageType === 2"
:src="item.content" style="height: 200rpx;width: 200rpx;margin-right: 20rpx;"></image>
<view>
<image v-if="item.avatar" :src="item.avatar" class="chat-listitem-image"></image>
<image v-else src="../../../static/logo.png" class="chat-listitem-image"></image>
</view>
</view>
</view>
<view v-if="item.riderId" style="width: 83%;margin-right: 15%;">
<view class="chat-listitem" style="float: left;margin-left: 10rpx;">
<view v-if="item.riderId">
<image :src="item.riderAvatar" class="chat-listitem-image"></image>
</view>
<view v-if="item.content && item.messageType === 1" class="chat-listitem-text"
style="margin-left: 20rpx;">{{item.content}}</view>
<image @tap="viewImg(item.content)" v-if="item.content && item.messageType === 2"
:src="item.content" style="height: 200rpx;width: 200rpx;margin-left: 20rpx;"></image>
</view>
</view>
<view v-if="item.shopId" style="width: 83%;margin-right: 15%;">
<view class="chat-listitem" style="float: left;margin-left: 10rpx;">
<view v-if="item.shopId">
<image :src="item.shopCover" class="chat-listitem-image"></image>
</view>
<view v-if="item.content && item.messageType === 1" class="chat-listitem-text"
style="margin-left: 20rpx;">{{item.content}}</view>
<image @tap="viewImg(item.content)" v-if="item.content && item.messageType === 2"
:src="item.content" style="height: 200rpx;width: 200rpx;margin-left: 20rpx;"></image>
</view>
</view>
</view>
</view>
<!-- 底部聊天输入框 -->
<view class="input-box ">
<view class="justify-between padding-lr align-center"
style="display: flex;width: 100%;background-color: #EEEEEE;">
<image src="../../../static/images/msg/add.png" @click="chooseImage(['album'])"
style="width: 50rpx;height: 50rpx;margin-right: 12rpx;border-radius: 52upx;"></image>
<input confirm-type="send" @confirm='setChatSave(1)' type="text" v-model="content"
style="width: 72%;height: 70rpx;background: #fff;margin: 0 10rpx;border-radius: 5rpx;padding-left: 10rpx;" />
<view class="save" @tap='setChatSave(1)'>发送</view>
</view>
</view>
</view>
</template>
<script>
import configdata from '../../../common/config.js';
export default {
data() {
return {
connected: false,
connecting: false,
msg: false,
type4: [],
listRight: {
chat: {
userHead: ""
},
content: "",
sendType: 1,
type: 1
},
content: '',
chatId: '',
type: 1,
ListItem: [],
ShopState: false,
ShopordersId: '',
Shopimage: '',
Shopmoney: '',
ShopTitle: '',
orderState: false,
ordersId: '',
userId: '',
orderimage: '',
orderNum: '',
teamId: '',
hand: 1,
index: 0,
page: 0,
size: 1000,
countDown: '',
ordersId: '',
byUserId: '',
RiderUnreadCount: 0,
};
},
computed: {
showMsg() {
if (this.connected) {
if (this.msg) {
return '收到消息:' + this.msg
} else {
return '等待接收消息'
}
} else {
return '尚未连接'
}
}
},
onUnload() {
// uni.closeSocket()
uni.hideLoading()
},
onLoad(d) {
this.userId = this.$queue.getData('userId');
this.byUserId = d.byUserId
this.ordersId = d.ordersId;
this.connect();
// if (d.teamName) {
// uni.setNavigationBarTitle({
// title: d.teamName
// });
// }
},
onShow() {
if (this.connected || this.connecting) {
} else {
this.connect();
}
},
onHide() {
// uni.closeSocket()
},
onUnload() {
this.close()
},
methods: {
copy(content) {
uni.showModal({
title: '温馨提示',
content: '确认要复制此文字吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: res => {
if (res.confirm) {
uni.setClipboardData({
data: content,
success: r => {
this.$queue.showToast('复制成功');
}
});
}
}
});
},
getDateDiff(data) {
// 传进来的data必须是日期格式不能是时间戳
//var str = data;
//将字符串转换成时间格式
var timePublish = new Date(data);
var timeNow = new Date();
var minute = 1000 * 60;
var hour = minute * 60;
var day = hour * 24;
var month = day * 30;
var result = "2";
var diffValue = timeNow - timePublish;
var diffMonth = diffValue / month;
var diffWeek = diffValue / (7 * day);
var diffDay = diffValue / day;
var diffHour = diffValue / hour;
var diffMinute = diffValue / minute;
if (diffMonth > 3) {
result = timePublish.getFullYear() + "-";
result += timePublish.getMonth() + "-";
result += timePublish.getDate();
} else if (diffMonth > 1) { //月
result = data.substring(0, 10);
} else if (diffWeek > 1) { //周
result = data.substring(0, 10);
} else if (diffDay > 1) { //天
result = data.substring(0, 10);
} else if (diffHour > 1) { //小时
result = parseInt(diffHour) + "小时前";
} else if (diffMinute > 1) { //分钟
result = parseInt(diffMinute) + "分钟前";
} else {
result = "刚刚";
}
return result;
},
connect() {
let that = this;
let userId = that.$queue.getData('userId');
if (that.connected || that.connecting) {
uni.showModal({
content: '正在连接或者已经连接,请勿重复连接',
showCancel: false
})
return false
}
that.connecting = true
uni.showLoading({
title: '连接中...'
})
console.log(userId, '*******************')
console.log(this.config("WSHOST1") +'/'+ this.ordersId, '*******************2')
uni.connectSocket({
// url: 'ws://192.168.1.17:8881/gameTeamChat/' + userId + '_' + this.teamId,
// url: 'wss://game.shengqianxiong.com.cn/wss/gameTeamChat/' + userId + '_' + this.teamId,
// url: 'ws://192.168.1.17:8180/sqx_fast/chatSocket/' + userId,
url: this.config("WSHOST1") + this.ordersId,
data() {
return {
msg: 'Hello'
}
},
header: {
'content-type': 'application/json'
},
method: 'GET',
success(res) {
uni.hideLoading();
that.getTimeOrListItem1();
// 这里是接口调用成功的回调,不是连接成功的回调,请注意
},
fail(err) {
// 这里是接口调用失败的回调,不是连接失败的回调,请注意
console.log("--------------" + JSON.stringify(err))
}
});
uni.onSocketOpen((res) => {
that.connecting = false
that.connected = true
uni.hideLoading()
// uni.showToast({
// icon: 'none',
// title: '连接成功'
// })
console.log('onOpen', res);
});
uni.onSocketError((err) => {
that.connecting = false
that.connected = false
uni.hideLoading()
uni.showModal({
content: '网络较差,请稍后再试',
showCancel: false
})
console.log('onError', err);
});
uni.onSocketMessage(function(res) {
console.log('收到服务器内容1111' + JSON.stringify(res));
setTimeout(() => {
that.getTimeOrListItem1();
}, 50);
});
uni.onSocketClose((res) => {
that.connected = false
that.startRecive = false
that.msg = false
console.log('onClose', res)
});
},
close() {
uni.closeSocket()
},
getTimeOrListItem1() {
this.$Request.getMsg('/app/ordersChat/selectGameChatDetails?type=1&page=1&limit=1000&ordersId=' + this.ordersId)
.then(
res => {
this.ListItem = [];
if (res.data) {
var time = '';
res.data.list.forEach(d => {
if (!d.avatar) {
// d.chat.userHead = '../../static/logo.png';
let avatar = this.$queue.getData('avatar');
d.avatar = avatar
}
this.ListItem.push(d);
});
this.ListItem = this.ListItem.reverse();
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 99999,
duration: 0
});
}, 50);
}
uni.hideLoading();
});
},
getChatSave() {
let userId = this.$queue.getData('userId');
let phone = this.$queue.getData('phone');
let userName = this.$queue.getData('userName');
if (!phone) {
phone = this.$queue.getData('userName');
}
let avatar = this.$queue.getData('avatar');
let data = {
userId: userId,
userHead: avatar,
userName: userName,
storeId: '0',
storeHead: '同城外卖',
storeName: ''
}
this.$Request.postJson('/chat/save', data).then(res => {
if (res.status === 0) {
this.chatId = res.data.chatId;
uni.showLoading({
title: '加载中...'
});
this.getTimeOrListItem1();
}
});
},
setChatSave(type) {
//type:1文字 2图片
if (type === 1 && this.content == '') {
this.$queue.showToast('请输入聊天内容');
return;
}
// if (this.chatId == '' || this.chatId == undefined) {
// this.$queue.showToast('网络较差,请稍后再试');
// return;
// }
let userId = this.$queue.getData('userId');
let avatar = this.$queue.getData('avatar');
let phone = this.$queue.getData('phone');
let userName = this.$queue.getData('userName');
if (!phone) {
phone = this.$queue.getData('userName');
}
console.log(this.byUserId)
let data = {
content: this.content,
messageType: type,
userId: userId,
ordersId: this.ordersId,
}
data = JSON.stringify(data);
let that = this;
uni.sendSocketMessage({
data: data,
success(res) {
let avatar = that.$queue.getData('avatar');
if (!avatar) {
avatar = '../../static/logo.png';
}
let data = {
chat: {
userHead: avatar
},
content: that.content,
type: type,
userId: userId
}
console.log(data, 'data99999999999999999')
setTimeout(() => {
that.getTimeOrListItem1();
}, 50);
console.log(that.content);
},
fail(err) {
console.log(err);
}
})
this.content = '';
},
//发送图片
chooseImage(sourceType) {
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
this.$queue.showLoading("上传中...");
uni.uploadFile({ // 上传接口
url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
console.log(uploadFileRes)
this.content = JSON.parse(uploadFileRes.data).data;
this.setChatSave(2);
uni.hideLoading();
}
});
}
}
})
},
config: function(name) {
var info = null;
if (name) {
var name2 = name.split("."); //字符分割
if (name2.length > 1) {
info = configdata[name2[0]][name2[1]] || null;
} else {
info = configdata[name] || null;
}
if (info == null) {
let web_config = cache.get("web_config");
if (web_config) {
if (name2.length > 1) {
info = web_config[name2[0]][name2[1]] || null;
} else {
info = web_config[name] || null;
}
}
}
}
return info;
},
//查看大图
viewImg(item) {
let imgsArray = [];
imgsArray[0] = item;
uni.previewImage({
current: 0,
urls: imgsArray
});
},
},
};
</script>
<style>
page {
/* background: #1c1b20; */
}
.input-box {
position: fixed;
bottom: 0;
left: 0;
height: 120rpx;
width: 100%;
display: flex;
box-sizing: content-box;
z-index: 999;
/* background-color: #ececec; */
/* padding: 0 5rpx; */
}
.chat-listitem {
display: flex;
margin-top: 20rpx;
padding: 10rpx;
}
.chat-listitem-text {
color: #000000;
background: #FFFFFF;
margin-top: 10rpx;
width: fit-content;
padding: 15rpx;
font-size: 30rpx;
height: max-content;
word-wrap: break-word;
word-break: break-all;
border-radius: 10rpx;
}
.chat-listitem-image-type4 {
color: #000000;
background: #FFFFFF;
width: fit-content;
font-size: 30rpx;
height: max-content;
word-wrap: break-word;
word-break: break-all;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
}
.chat-listitem-image {
margin-top: 5rpx;
width: 75rpx;
height: 75rpx;
border-radius: 5rpx;
}
.save {
width: 130rpx;
text-align: center;
border-radius: 70rpx;
height: 70rpx;
color: #FFF;
background: #1789FD;
margin: 5rpx 10rpx 0;
line-height: 70rpx;
}
</style>

1921
pages/index/shop/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
<template>
<view class="">
<!-- <view v-if="msgList.length" class="margin-topW">
<view class="flex padding-tb radius padding-lr-sm bg" @click="goMsg" v-for="(item,index) in msgList"
:key='index'>
<view>
<image style="width: 80rpx;height: 80rpx;border-radius: 80rpx;"
src="../../static/images/msg/msg.png"></image>
</view>
<view class="flex-sub margin-left-sm">
<view class="flex justify-between">
<view class="text-white">{{item.title?item.title: '系统消息'}}</view>
<view v-if="messageCount>0"
style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
{{messageCount}}</view>
</view>
<view>
<view class="text-grey">{{item.content}}</view>
</view>
</view>
</view>
</view> -->
<view v-if="chatList.length" class="content ">
<view class="radius padding-lr-sm bg" style="margin-top: 4rpx;" @click="goIM(item)"
v-for="(item,index) in chatList" :key='index'>
<view class="flex padding-tb " v-if="userId == item.userId">
<view>
<u-image shape="circle" width='80rpx' height="80rpx" :src="item.shopCover"></u-image>
</view>
<view class="flex-sub margin-left-sm">
<view class="flex justify-between">
<view class="text-white">{{item.shopName}}</view>
<view class="text-grey">{{item.createTime}}</view>
</view>
<view class="flex justify-between">
<view class="text-grey">{{ item.messageType == 1? item.content : '[图片]'}}</view>
<view v-if="item.unreadMessageCount"
style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
{{item.unreadMessageCount}}</view>
</view>
</view>
</view>
<view class="flex padding-tb" v-else>
<view>
<u-image shape="circle" width='80rpx' height="80rpx" :src="item.shopCover"></u-image>
</view>
<view class="flex-sub margin-left-sm">
<view class="flex justify-between">
<view class="text-white">{{item.shopName}}</view>
<view class="text-grey">{{item.createTime}}</view>
</view>
<view class="flex justify-between">
<view class="text-grey">{{ item.messageType == 1? item.content : '[图片]'}}</view>
<view v-if="item.unreadMessageCount"
style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
{{item.unreadMessageCount}}</view>
</view>
</view>
</view>
</view>
</view>
<empty v-if="!chatList.length && !msgList.length" content='暂无消息'></empty>
</view>
</template>
<script>
import empty from '../../components/empty.vue'
export default {
components: {
empty
},
data() {
return {
page: 1,
limit: 100,
chatList: [],
userId: '',
msgList: [],
time: '',
messageCount: 0
}
},
onLoad() {
this.getChatList()
},
onShow() {
let that = this
that.userId = uni.getStorageSync('userId')
if (that.userId) {
that.time = setInterval(function() {
that.getChatList()
// that.getMsgList()
that.$nextTick(function() {
that.messageCount = uni.getStorageSync('messageCount')
})
}, 10000)
} else {
that.chatList = []
that.msgList = []
}
},
onHide() {
clearInterval(this.time)
},
methods: {
getChatList() {
this.$Request.get("/shop/ordersChat/selectOrdersChatPageShop", {
page: this.page,
limit: this.limit,
shopId: uni.getStorageSync('shopId')
}).then(res => {
if (res.code == 0) {
this.chatList = res.data.list
}
});
},
// getMsgList() {
// this.$Request.get("/app/message/selectMessageByUserIdLimit1").then(res => {
// if (res.code == 0) {
// this.msgList = res.data.list
// }
// });
// },
goIM(e) {
let userId = this.$queue.getData('userId');
if (e.userId == userId) {
userId = e.byUserId
} else {
userId = e.userId
}
uni.navigateTo({
url: '/pages/msg/im?chatConversationId=' + e.chatConversationId + '&byUserId=' + userId
})
},
goMsg() {
uni.navigateTo({
url: '/pages/msg/message'
})
}
}
}
</script>
<style>
page {
background-color: #F7F7F7;
}
.bg {
background: #FFFFFF;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,566 @@
<template>
<view v-if="XCXIsSelect=='是'">
<view style="position: fixed;top: 0;width: 100%;z-index: 999;">
<view class="flex justify-between align-center bg-white padding-tb padding-lr-sm">
<view class="flex-sub text-center" :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
<view class="flex-sub text-center" :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
<view class="flex-sub text-center" :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
<view class="flex-sub text-center flex" @click="isShow = !isShow">
<view class="flex align-center" style="margin: 0 auto;">
<view :class="isShow?'select':''">筛选</view>
<u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
<u-icon v-if="isShow" name="arrow-up" color="#FCD202" size="28"></u-icon>
</view>
</view>
</view>
<view v-if="isShow"
style="position: absolute;top: 90rpx;width: 100%;z-index: 1000;background: rgba(0,0,0,.5);height: 100vh;"
@click="isShow =false">
<view class="padding-lr bg-white">
<view class="flex justify-between align-center padding-tb-sm u-border-bottom"
v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)">
<view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
<u-icon v-if="item.select" name="checkmark" color="#FCD202" size="28"></u-icon>
</view>
</view>
</view>
</view>
<!-- #ifdef H5 -->
<view class="hd flex justify-center" style="position: fixed;top: 90rpx;" v-if="hdlist.length>0">
<!-- #endif -->
<!-- #ifndef H5 -->
<view class="hd flex justify-center" style="position: fixed;top: 90rpx;" v-if="hdlist.length>0">
<!-- #endif -->
<view class="hd-box">
<scroll-view scroll-x="true" class="scroll-view_H">
<view class="hd-box-item" :style="currenthd==index?'background-color:#fcd202;font-weight:bold':''" @click="searchhd(index,item.activityId)" v-for="(item,index) in hdlist" :key="index">{{item.activityTitle}}</view>
</scroll-view>
</view>
</view>
<!-- #ifdef H5 -->
<view class="padding-lr-sm" style="margin-top: 80rpx;">
<!-- #endif -->
<!-- #ifndef H5 -->
<view class="padding-lr-sm" style="margin-top: 180rpx;">
<!-- #endif -->
<view class="" v-for="(item,index) in shopList" :key='index'>
<view class="margin-tb-sm flex justify-between bg-white padding"
@click="goNav('/pages/index/shop/index?shopId='+item.shopId)">
<image :src="item.shopCover" class="radius" style="width: 160rpx;height: 160rpx;"></image>
<view class=" margin-left-sm" style="width: 450rpx;">
<view class=" flex flex-direction justify-between">
<view class="text-lg text-bold text-black">{{item.shopName}}</view>
<view class="flex align-center margin-top-xs" style="width: 100%;">
<u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
<text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
<text
class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
<text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
<text class="text-gray margin-left-xs">{{item.distance}}</text>
</view>
<view class="text-gray margin-top-xs flex justify-between">
<view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}
</view>
<view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view>
</view>
<view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
营业时间{{item.businessHours}}-{{item.lockHours}}</view>
<view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
<view class="flex flex-wrap align-center" style="width: 100%;height: 100%;overflow: hidden;">
<view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">{{item.exemptMinMoney}}免配送费</view>
<view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
v-if="item.shopLable">
{{ite}}
</view>
<view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">{{it.minMoney}}{{it.money}}</view>
</view>
</view>
</view>
<view class="flex margin-top-xs">
<view v-for="(ite,ind) in item.goodsList" :key='ind'
@click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
<image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
mode=""></image>
<view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
<view class="text-bold margin-top-xs" style="color: #FD6416;">
<text class="text-sm">¥</text> {{ite.goodsMoney}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<empty v-if="!shopList.length"></empty>
</view>
<view v-else>
<view style="font-size: 28upx;" v-html="content"></view>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components: {
empty
},
data() {
return {
currenthd:-1,
hdlist:[],
activityId:'',
isShow: false,
hintShow: false,
shop: {},
page: 1,
limit: 10,
shopList: [],
current: 1,
shopTypeId: '',
userId: '',
lng: '',
lat: '',
value1: 0,
value2: 0,
value3: 0,
value4: 0,
options1: [{
label: '综合排序',
value: 1,
}],
options2: [{
value: '3',
label: "距离优先"
}],
options3: [{
value: '4',
label: "销量优先"
}],
options4: [{
id: '',
select: true,
shopTypeName: "全部"
}],
title: '综合排序',
title1: '距离优先',
title2: '销量优先',
title3: '筛选',
totalCount: 0,
XCXIsSelect: '否',
content:''
}
},
onLoad(e) {
console.log(e)
this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
if (this.XCXIsSelect == '否') {
this.getGuize()
uni.setNavigationBarTitle({
title: '隐私政策'
});
} else {
uni.setNavigationBarTitle({
title: '店铺列表'
});
}
let that = this
uni.showLoading({
title: '加载中'
})
that.shopTypeId = e.value ? e.value : ''
that.value2 = e.value ? e.value : 0
that.userId = uni.getStorageSync('userId')
that.getShopType()
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function(res) {
that.lat = res.latitude;
that.lng = res.longitude;
}
});
that.getShopList()
that.gethdlist();
},
methods: {
//筛选活动
searchhd(index,activityId){
if(index==this.currenthd){
this.currenthd = -1
this.activityId = '';
this.getShopList()
}else{
this.currenthd = index;
this.activityId=activityId;
this.getShopList()
}
},
//获取所有活动
gethdlist(){
this.$Request.get("/app/activityManage/getActivityList").then(res => {
if (res.code == 0) {
res.data.records.map((item,index)=>{
if(item.activityId==14){
res.data.records.splice(index, 1)
}
})
this.hdlist = res.data.records
}
});
},
// 跳转商品详情
goDet(goodsId, shopId) {
let userId = this.$queue.getData('userId');
if (!userId) {
uni.navigateTo({
url: '/pages/public/login'
})
return
}
uni.navigateTo({
url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
})
},
getGuize() {
this.$Request.getT('/app/common/type/237').then(res => {
if (res.code == 0) {
this.content = res.data.value;
// this.tit = res.data.min
}
});
},
goBack() {
uni.navigateBack({
})
},
getSelect(e) {
console.log(e)
this.options4.forEach(res => {
if (res.id == e.id) {
res.select = true
this.page = 1
this.shopTypeId = e.id
this.getShopList();
this.isShow = false
} else {
res.select = false
}
})
},
confirm(e) {
console.log(e)
this.page = 1
this.current = e;
this.getShopList();
},
confirm2(e) {
console.log(e)
this.page = 1
this.current = e;
this.getShopList();
},
confirm3(e) {
console.log(e)
this.page = 1
this.current = e;
this.getShopList();
},
confirm4(e) {
console.log(e)
this.page = 1
this.shopTypeId = e
this.getShopList();
},
// 商户列表
getShopList() {
// this.lng = uni.getStorageSync('lng')
// this.lat = uni.getStorageSync('lat')
let data = {
page: this.page,
limit: this.limit,
screen: this.current,
shopTypeId: this.shopTypeId,
lng: uni.getStorageSync('lng'),
lat: uni.getStorageSync('lat'),
activityId:this.activityId
}
this.$Request.getT('/app/goods/selectShop', data).then(res => {
uni.hideLoading()
if (res.code == 0) {
console.log(res.data.list)
this.totalCount = res.data.totalCount
res.data.list.forEach(ret => {
if (ret.distance > 1000) {
ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
} else {
if (ret.distance == 0) {
ret.distance = "0m";
} else {
ret.distance = Number(ret.distance).toFixed(1) + "m";
}
}
ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
'../../static/logo.png'
ret.errandTime = Math.round(ret.errandTime)
ret.shopScore = ret.shopScore.toFixed(1)
})
if (this.page == 1) {
this.shopList = res.data.list
} else {
this.shopList = [...this.shopList, ...res.data.list]
}
console.log(this.shopList)
}
})
},
// 商户类型
getShopType() {
this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
if (res.code == 0) {
res.data.forEach(res => {
res.select = false
})
this.options4 = [...this.options4, ...res.data]
}
})
},
goNav(url) {
console.log(url)
if (this.userId) {
uni.navigateTo({
url
})
} else {
uni.navigateTo({
url: '/pages/public/login'
})
}
},
goShopDet(url, e) {
this.shop = e
// console.log(e, '当前店铺')
// let myDate = new Date();
// let hours = myDate.getHours();
// let minute = myDate.getMinutes();
// let openTime = this.shop.businessHours.split(':')[0] //开始小时
// let closeTime = this.shop.lockHours.split(':')[0] //结束小时
// let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
// let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
// console.log(hours)
// console.log(minute)
// console.log(openTime)
// console.log(openTime1)
// console.log(closeTime)
// console.log(closeTime1)
// console.log(minute >= closeTime1)
// if (hours < openTime) {
// this.hintShow = true
// return
// } else if (hours == openTime && minute < openTime1) {
// this.hintShow = true
// return
// } else if (hours >= closeTime) {
// this.hintShow = true
// return
// } else if (hours == closeTime && minute >= closeTime1) {
// this.hintShow = true
// return
// }
console.log(url)
if (this.userId) {
uni.navigateTo({
url
})
} else {
uni.navigateTo({
url: '/pages/public/login'
})
}
},
},
onReachBottom: function() {
if (this.shopList.length < this.totalCount) {
this.page = this.page + 1;
this.getShopList()
} else {
uni.showToast({
title: '已经到底了',
icon: 'none'
})
}
},
}
</script>
<style lang="scss">
.hd{
width: 100%;
height: auto;
background-color: rgb(248, 248, 248);
padding: 20rpx 0 20rpx 0;
z-index: 1;
// margin-top: 20rpx;
.hd-box{
width: 686rpx;
height: 100%;
.scroll-view_H{
width: 100%;
white-space: nowrap;
}
.hd-box-item{
display: inline-block;
padding: 10rpx 20rpx 10rpx 20rpx;
background-color: #ffffff;
font-size: 24rpx;
border-radius: 8rpx;
margin-right: 10rpx;
}
}
}
.select {
color: #FCD202;
}
.tabs {
margin: 20rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.tabs_name {
flex: 1;
/* display: inline-block; */
text-align: center;
margin-bottom: 30rpx 0;
position: relative;
display: flex;
/* justify-content: space-between; */
align-items: center;
}
.tabs_name view {
margin: 0 auto;
display: flex;
align-items: center;
}
.tabs_2 {
/* width: 30%; */
}
.actives {
color: #007AFF;
}
.tabsicon {
position: absolute;
top: 0;
right: 22rpx;
width: 20rpx;
height: 40rpx;
z-index: 1;
}
.tabs_icon {
width: 12rpx;
height: 8rpx;
z-index: 1;
margin-left: 10rpx;
}
.icon1 {
/* position: absolute; */
/* top: 6rpx; */
}
.icon2 {
position: absolute;
bottom: 6rpx;
}
.hintPopul {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
background: rgba(0, 0, 0, .4);
z-index: 999;
}
.content_ {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
text-align: center;
width: 500rpx;
height: 400rpx;
border-radius: 20rpx;
background-color: #fff;
padding-top: 120rpx;
}
.content_ image {
position: absolute;
top: -50rpx;
left: 0;
right: 0;
margin: auto;
}
.hintText {
font-size: 30rpx;
}
.skuBtn {
width: 460rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background: #FCD202;
font-size: 28rpx;
border: 2rpx solid #FCD202;
color: #333333;
border-radius: 50rpx;
font-weight: 700;
margin: auto;
}
.lable {
border: 1rpx solid #FFE6D9;
height: 40rpx;
padding: 0 14rpx;
background: #FFE6D9;
border-radius: 4rpx;
font-weight: 500;
color: #FD6416;
font-size: 20rpx;
margin-right: 10rpx;
margin-bottom: 10rpx;
}
</style>

16
pages/index/webView.vue Normal file
View File

@@ -0,0 +1,16 @@
<template>
<web-view :src="url"></web-view>
</template>
<script>
export default {
data() {
return {
url: null //要打开的外部链接
}
},
onLoad: function (option) {
this.url = option.url
}
}
</script>