...
|
...
|
@@ -7,7 +7,7 @@ |
|
|
{{addressText}}
|
|
|
<!-- <image src="/static/image/Frame_11@2x.png" mode="" style="width: 24rpx;height: 24rpx;"></image> -->
|
|
|
<view class="arrowWhite">
|
|
|
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
...
|
...
|
@@ -37,16 +37,14 @@ |
|
|
</view>
|
|
|
</view>
|
|
|
<view class="swiperBox">
|
|
|
<swiper class="swiper" :indicator-dots="indicatorDots"
|
|
|
:duration="duration"
|
|
|
:circular="true" autoplay="true">
|
|
|
<swiper class="swiper" :indicator-dots="indicatorDots" :duration="duration" :circular="true" autoplay="true">
|
|
|
<swiper-item v-for="(item,index) in swiperList" :key="index" @click="goGood(item.id_status)">
|
|
|
<image :src="item.image" mode="" class="swiper"></image>
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
</view>
|
|
|
<view class="classifyBox">
|
|
|
<view class="classifyPic" v-for="(item,index) in ClassifyList" :key="index" @click="goClass(index,item.id)" v-if="index<3">
|
|
|
<view class="classifyPic" v-for="(item,index) in ClassifyList1" :key="index" @click="goClass(index,item.id)" v-if="index<3">
|
|
|
<image :src="item.image" mode=""></image>
|
|
|
<text class="classifyText">{{item.name}}</text>
|
|
|
</view>
|
...
|
...
|
@@ -55,7 +53,7 @@ |
|
|
<text class="classifyText">分类</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="margin: 0 30rpx 0 34rpx;">
|
|
|
<view style="margin: 0 30rpx 0 34rpx;" v-if="listTypecont.length>0">
|
|
|
<view class="pintuanBox">
|
|
|
<view class="pintuanTop">
|
|
|
<view class="topLeft" style="display: flex;align-items: center;">
|
...
|
...
|
@@ -106,7 +104,7 @@ |
|
|
</view>
|
|
|
<view class="picker" style="position: relative;">
|
|
|
<picker @change="bindPickerChange" :value="index" :range="array" class="picker">
|
|
|
<view class="uni-input pickerIner" >{{array[index]}}</view>
|
|
|
<view class="uni-input pickerIner">{{array[index]}}</view>
|
|
|
<view class="image" style="position: absolute;top: 0;left: 150rpx;">
|
|
|
<image src="/static/image/fenlei_icon_3@2x.png" mode="" style="width: 28rpx;height: 28rpx;"></image>
|
|
|
</view>
|
...
|
...
|
@@ -174,12 +172,12 @@ |
|
|
</view>
|
|
|
<view class="addressMask">
|
|
|
<image src="/static/image/dingwei_icon_1@2x.png" mode=""></image>
|
|
|
<view class="maskAddress" style="max-width: 104rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
<view class="maskAddress" style="max-width: 204rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
{{item.address}}
|
|
|
</view>
|
|
|
<view class="maskAddress">
|
|
|
<!-- <view class="maskAddress">
|
|
|
{{item.distance}}km
|
|
|
</view>
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
...
|
...
|
@@ -219,12 +217,12 @@ |
|
|
</view>
|
|
|
<view class="addressMask">
|
|
|
<image src="/static/image/dingwei_icon_1@2x.png" mode=""></image>
|
|
|
<view class="maskAddress" style="max-width: 104rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
<view class="maskAddress" style="max-width: 204rpx;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
|
|
{{item.address}}
|
|
|
</view>
|
|
|
<view class="maskAddress">
|
|
|
<!-- <view class="maskAddress">
|
|
|
{{item.distance.toFixed(2)}}km
|
|
|
</view>
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
...
|
...
|
@@ -263,16 +261,19 @@ |
|
|
<text class="botTextFa">发布</text>
|
|
|
</view>
|
|
|
</li>
|
|
|
<li @click="goMessage">
|
|
|
<li @click="goMessage" style="position: relative;">
|
|
|
<image src="../../static/image/xiaoxi_icon_5@2x.png" style="width: 48rpx;height: 44rpx;" mode=""></image>
|
|
|
<text class="botText">消息</text>
|
|
|
<view class="num" >
|
|
|
{{messageNum>99?'99+':messageNum}}
|
|
|
</view>
|
|
|
</li>
|
|
|
<li @click="goMe">
|
|
|
<image src="../../static/image/wode_icon_5@2x.png" style="width: 48rpx;height: 44rpx;" mode=""></image>
|
|
|
<text class="botText">我的</text>
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
...
|
...
|
@@ -282,45 +283,46 @@ |
|
|
import request from '../../utils/request.js'
|
|
|
export default {
|
|
|
onLoad: function(options) {
|
|
|
uni.setStorageSync('pid',options.userId)
|
|
|
if(options.address){
|
|
|
this.addressText=options.address
|
|
|
uni.setStorageSync('aaa',11)
|
|
|
uni.setStorageSync('City',options.address)
|
|
|
uni.setStorageSync('lat',options.lat)
|
|
|
uni.setStorageSync('lot',options.lot)
|
|
|
}else{
|
|
|
|
|
|
uni.setStorageSync('pid', options.userId)
|
|
|
if (options.address) {
|
|
|
this.addressText = options.address
|
|
|
uni.setStorageSync('aaa', 11)
|
|
|
uni.setStorageSync('City', options.address)
|
|
|
uni.setStorageSync('lat', options.lat)
|
|
|
uni.setStorageSync('lot', options.lot)
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
|
|
|
if(uni.getStorageSync('token')){
|
|
|
this.token=true
|
|
|
|
|
|
if (uni.getStorageSync('token')) {
|
|
|
this.token = true
|
|
|
}
|
|
|
setTimeout(()=>{
|
|
|
this.swiper();
|
|
|
this.classifyData(); //分类
|
|
|
this.jfavtivity(); //拼团
|
|
|
this.board() //广告
|
|
|
this.jvliSelect(); //距离选择
|
|
|
this.classifylistss(); //分类选择
|
|
|
this.goodsXy(); //发现需要
|
|
|
this.goodsXz(); //闲置物品
|
|
|
},500)
|
|
|
|
|
|
},
|
|
|
onShow: function(){
|
|
|
onShow: function() {
|
|
|
let that = this
|
|
|
if(uni.getStorageSync("City") == ""){
|
|
|
if (uni.getStorageSync("City") == "") {
|
|
|
this.getLocations();
|
|
|
}else{
|
|
|
} else {
|
|
|
that.addressText = uni.getStorageSync("City")
|
|
|
}
|
|
|
|
|
|
setTimeout(() => {
|
|
|
this.swiper();
|
|
|
this.classifyData(); //分类
|
|
|
this.jfavtivity(); //拼团
|
|
|
this.board() //广告
|
|
|
this.jvliSelect(); //距离选择
|
|
|
this.classifylistss(); //分类选择
|
|
|
this.goodsXy(); //发现需要
|
|
|
this.goodsXz(); //闲置物品
|
|
|
this.messageNums()//留言个数
|
|
|
}, 500)
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
token:false,
|
|
|
pageNums:1,
|
|
|
pageNum:1,
|
|
|
token: false,
|
|
|
pageNums: 1,
|
|
|
pageNum: 1,
|
|
|
addressText: '',
|
|
|
IndexImg: 'https://s3.ax1x.com/2021/01/11/s8PyTK.png',
|
|
|
longitude: '',
|
...
|
...
|
@@ -328,56 +330,67 @@ |
|
|
address: '', //定位
|
|
|
noAddress: false,
|
|
|
swiperList: [], //轮播图
|
|
|
autoplay:true,
|
|
|
duration:1500,
|
|
|
indicatorDots:true,
|
|
|
autoplay: true,
|
|
|
duration: 1500,
|
|
|
indicatorDots: true,
|
|
|
boardImg: '', //广告
|
|
|
IndexImg: 'https://s3.ax1x.com/2021/01/11/s8PyTK.png',
|
|
|
address: '', //定位
|
|
|
inputValue: '',
|
|
|
inputValue: '',
|
|
|
//拼团
|
|
|
listTypecont: [],
|
|
|
scrollTop: 0,
|
|
|
tabList: ['闲置物品', '发现需要'],
|
|
|
tabIndex: 0,
|
|
|
//距离
|
|
|
arrayList:[],
|
|
|
arrayList: [],
|
|
|
array: [],
|
|
|
index: 0,
|
|
|
//分类
|
|
|
ClassifyList1: [],
|
|
|
ClassifyList: [],
|
|
|
classArray: [],
|
|
|
index1: 0,
|
|
|
//商品
|
|
|
goodsList: [],
|
|
|
goodsList1: [],
|
|
|
show: false
|
|
|
show: false,
|
|
|
messageNum:0 //消息个数
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
if (this.tabIndex == 0) {
|
|
|
this.pageNum = this.pageNum + 1
|
|
|
this.goodsXz()
|
|
|
} else {
|
|
|
this.pageNum = this.pageNum + 1
|
|
|
this.goodsXy()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
login(){
|
|
|
login() {
|
|
|
uni.navigateTo({
|
|
|
url:"/pages/index/login"
|
|
|
url: "/pages/index/login"
|
|
|
})
|
|
|
},
|
|
|
//签到
|
|
|
signIn() {
|
|
|
if(this.token){
|
|
|
if (this.token) {
|
|
|
request.get('/api/number/signIn', {}).then(res => {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}).catch(err => {
|
|
|
|
|
|
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
this.login()
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
getLocations() {
|
...
|
...
|
@@ -396,10 +409,10 @@ |
|
|
},
|
|
|
success: res => {
|
|
|
wx.setStorageSync('City', res.data.result.address_component.city)
|
|
|
if(that.addressText==''){
|
|
|
if(uni.getStorageSync("City") == ""){
|
|
|
that.addressText = res.data.result.address_component.city
|
|
|
}else{
|
|
|
if (that.addressText == '') {
|
|
|
if (uni.getStorageSync("City") == "") {
|
|
|
that.addressText = res.data.result.address_component.city
|
|
|
} else {
|
|
|
that.addressText = uni.getStorageSync("City")
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -413,10 +426,10 @@ |
|
|
},
|
|
|
//藏宝图
|
|
|
cangbao() {
|
|
|
if(this.token){
|
|
|
if (this.token) {
|
|
|
var t = this;
|
|
|
let lat = uni.getStorageSync('lat')
|
|
|
if (!lat ) {
|
|
|
if (!lat) {
|
|
|
uni.authorize({
|
|
|
scope: 'scope.userLocation',
|
|
|
success(res) {
|
...
|
...
|
@@ -447,16 +460,16 @@ |
|
|
url: '/pages/index/map'
|
|
|
})
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
this.login()
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
goSelectAddress() {
|
|
|
if(this.token){
|
|
|
if (this.token) {
|
|
|
var t = this;
|
|
|
let lat = uni.getStorageSync('lat')
|
|
|
if (!lat ) {
|
|
|
if (!lat) {
|
|
|
uni.authorize({
|
|
|
scope: 'scope.userLocation',
|
|
|
success(res) {
|
...
|
...
|
@@ -487,10 +500,10 @@ |
|
|
url: '/pages/index/select-location'
|
|
|
})
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
this.login()
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
//轮播图
|
...
|
...
|
@@ -504,7 +517,7 @@ |
|
|
},
|
|
|
goGood(status) {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/index/integral-good?status='+status
|
|
|
url: '/pages/index/integral-good?status=' + status
|
|
|
})
|
|
|
},
|
|
|
//积分活动
|
...
|
...
|
@@ -545,6 +558,7 @@ |
|
|
list.forEach((item, index) => {
|
|
|
this.classArray.push(item.name)
|
|
|
})
|
|
|
this.classArray.unshift('全部')
|
|
|
}).catch(ex => {
|
|
|
|
|
|
});
|
...
|
...
|
@@ -555,9 +569,9 @@ |
|
|
.then(res => {
|
|
|
let list = res.data.info
|
|
|
list.forEach((item, index) => {
|
|
|
this.array.push(item.long+"km")
|
|
|
this.array.push(item.long + "km")
|
|
|
this.arrayList.push(item)
|
|
|
|
|
|
|
|
|
})
|
|
|
}).catch(ex => {
|
|
|
|
...
|
...
|
@@ -571,7 +585,15 @@ |
|
|
},
|
|
|
classifyData() {
|
|
|
request.get('/api/index/inFen', {}).then(res => {
|
|
|
// this.ClassifyList1=res.data.info
|
|
|
this.ClassifyList = res.data.info
|
|
|
this.ClassifyList.unshift({
|
|
|
id: '',
|
|
|
name: '全部'
|
|
|
})
|
|
|
let list = this.ClassifyList
|
|
|
list.shift()
|
|
|
this.ClassifyList1 = list
|
|
|
}).catch(err => {
|
|
|
|
|
|
})
|
...
|
...
|
@@ -579,13 +601,13 @@ |
|
|
//闲置商品
|
|
|
goGoodDetailXz(ids) {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/index/good-details?goos_id=" + ids+'&index=1'
|
|
|
url: "/pages/index/good-details?goos_id=" + ids + '&index=1'
|
|
|
})
|
|
|
},
|
|
|
//发现需要
|
|
|
goGoodDetailFx(ids) {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/index/good-details?id=" + ids+'&index=2'
|
|
|
url: "/pages/index/good-details?id=" + ids + '&index=2'
|
|
|
})
|
|
|
},
|
|
|
//全部分类
|
...
|
...
|
@@ -595,36 +617,38 @@ |
|
|
})
|
|
|
},
|
|
|
// 闲置物品
|
|
|
goodsXz() {
|
|
|
let that=this;
|
|
|
goodsXz() {
|
|
|
let that = this;
|
|
|
request.get("/api/index/xianZhi", {
|
|
|
lat2: uni.getStorageSync('lat'),
|
|
|
lng2: uni.getStorageSync('lot'),
|
|
|
id:this.index?that.arrayList[that.index].id:"",
|
|
|
sort_id:that.index1?that.ClassifyList[that.index1].id:'',
|
|
|
id: this.index ? that.arrayList[that.index].id : "",
|
|
|
sort_id: that.index1 ? that.ClassifyList[that.index1].id : '',
|
|
|
page: that.pageNum,
|
|
|
rows: 10
|
|
|
})
|
|
|
.then(res => {
|
|
|
this.goodsList = res.data.data
|
|
|
let list = that.pageNum == 1 ? res.data.data : that.goodsList.concat(res.data.data)
|
|
|
this.goodsList = list
|
|
|
}).catch(ex => {
|
|
|
|
|
|
});
|
|
|
},
|
|
|
//发现需要
|
|
|
goodsXy() {
|
|
|
let that=this
|
|
|
request.get("/api/index/faXian",{
|
|
|
let that = this
|
|
|
request.get("/api/index/faXian", {
|
|
|
lat2: uni.getStorageSync('lat'),
|
|
|
lng2: uni.getStorageSync('lot'),
|
|
|
page: that.pageNums,
|
|
|
rows: 10,
|
|
|
id:this.index?that.arrayList[that.index].id:"",
|
|
|
sort_id:that.index1?that.ClassifyList[that.index1].id:'',
|
|
|
id: this.index ? that.arrayList[that.index].id : "",
|
|
|
sort_id: that.index1 ? that.ClassifyList[that.index1].id : '',
|
|
|
// id:that.arrayList[that.index].id?that.arrayList[that.index].id:'',
|
|
|
// sort_id:that.classifylist[that.index1].id?that.classifylist[that.index1].id:'',
|
|
|
})
|
|
|
.then(res => {
|
|
|
let list = that.pageNum == 1 ? res.data.data : that.goodsList1.concat(res.data.data)
|
|
|
that.goodsList1 = res.data.data
|
|
|
}).catch(ex => {
|
|
|
|
...
|
...
|
@@ -651,30 +675,31 @@ |
|
|
|
|
|
//tab
|
|
|
changeTab(Inv) {
|
|
|
let that=this
|
|
|
let that = this
|
|
|
that.tabIndex = Inv;
|
|
|
if(that.tabIndex==0){
|
|
|
if (that.tabIndex == 0) {
|
|
|
this.pageNum = 1
|
|
|
that.goodsXz()
|
|
|
}else{
|
|
|
} else {
|
|
|
this.pageNum = 1
|
|
|
that.goodsXy()
|
|
|
}
|
|
|
},
|
|
|
bindPickerChange: function(e) {
|
|
|
this.index = e.target.value
|
|
|
if(this.tabIndex==0){
|
|
|
if (this.tabIndex == 0) {
|
|
|
this.goodsXz()
|
|
|
}else{
|
|
|
} else {
|
|
|
this.goodsXy()
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
bindPickerChange1: function(e) {
|
|
|
let _that=this
|
|
|
let _that = this
|
|
|
_that.index1 = e.target.value
|
|
|
if(_that.tabIndex==0){
|
|
|
if (_that.tabIndex == 0) {
|
|
|
_that.goodsXz()
|
|
|
}else{
|
|
|
console.log('发现')
|
|
|
} else {
|
|
|
_that.goodsXy()
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -692,24 +717,24 @@ |
|
|
},
|
|
|
//发布
|
|
|
goFa() {
|
|
|
if(this.token){
|
|
|
if (this.token) {
|
|
|
this.show = true
|
|
|
}else{
|
|
|
} else {
|
|
|
this.login()
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
//消息
|
|
|
goMessage() {
|
|
|
uni.reLaunch({
|
|
|
url: '/pages/message/message'
|
|
|
|
|
|
|
|
|
});
|
|
|
},
|
|
|
//我的
|
|
|
goMe() {
|
|
|
uni.reLaunch({
|
|
|
url:'/myPackage/pages/me/me'
|
|
|
url: '/myPackage/pages/me/me'
|
|
|
});
|
|
|
},
|
|
|
onClose() {
|
...
|
...
|
@@ -725,6 +750,14 @@ |
|
|
// fail() {}
|
|
|
// })
|
|
|
// }
|
|
|
//留言个数
|
|
|
messageNums(){
|
|
|
request.get('/api/mation/unreadNumber',{}).then(res=>{
|
|
|
this.messageNum=res.data.number
|
|
|
}).catch(err=>{
|
|
|
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
...
|
...
|
@@ -756,6 +789,7 @@ |
|
|
bottom: 0;
|
|
|
width: 100%;
|
|
|
display: flex;
|
|
|
z-index: 99;
|
|
|
}
|
|
|
|
|
|
ul li {
|
...
|
...
|
@@ -783,4 +817,20 @@ |
|
|
width: 88rpx;
|
|
|
height: 88rpx;
|
|
|
}
|
|
|
|
|
|
.num {
|
|
|
position: absolute;
|
|
|
background: red;
|
|
|
height: 30rpx;
|
|
|
font-size: 22rpx;
|
|
|
line-height: 30rpx;
|
|
|
text-align: center;
|
|
|
border-radius: 16rpx;
|
|
|
color: #fff;
|
|
|
top: 6rpx;
|
|
|
right: 30rpx;
|
|
|
min-width: 18rpx;
|
|
|
max-width: 60rpx;
|
|
|
padding: 0 6rpx;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|