初始化代码
This commit is contained in:
94
uniapp/uni-app/home/pages/about.vue
Normal file
94
uniapp/uni-app/home/pages/about.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<view class="home-article" v-if="isLoad">
|
||||
<fixed>
|
||||
<view>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
height="100rpx"></tab>
|
||||
</view>
|
||||
</fixed>
|
||||
<view class="mg-md pd-md fill-base box-shadow radius-24" v-if="tabList.length > 0">
|
||||
<parser :html="tabList[activeIndex].text" @linkpress="linkpress" show-with-animation lazy-load>加载中...
|
||||
</parser>
|
||||
</view>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
import parser from "@/components/jyf-Parser/index"
|
||||
export default {
|
||||
components: {
|
||||
parser
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
tabList: [],
|
||||
activeIndex: 0,
|
||||
id: 0
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
methods: {
|
||||
async initIndex() {
|
||||
let data = await this.$api.home.aboutUsList();
|
||||
let {
|
||||
id = 0
|
||||
} = this
|
||||
let ind = data.findIndex(item => {
|
||||
item.id == id
|
||||
})
|
||||
this.activeIndex = ind == -1 ? 0 : ind
|
||||
this.tabList = data
|
||||
this.isLoad = true
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.id = this.tabList[index].id
|
||||
},
|
||||
linkpress(res) {
|
||||
console.log("linkpress", res);
|
||||
// #ifdef APP-PLUS
|
||||
this.$util.goUrl({
|
||||
url: res.href,
|
||||
openType: 'web'
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-article {
|
||||
.article-title {
|
||||
font-size: 44rpx;
|
||||
line-height: 65rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
119
uniapp/uni-app/home/pages/article.vue
Normal file
119
uniapp/uni-app/home/pages/article.vue
Normal file
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<view class="home-article" v-if="detail.id">
|
||||
<view class="space-md"></view>
|
||||
<view class="pd-lg">
|
||||
<view class="article-title c-title">{{detail.title}}</view>
|
||||
<view class="f-paragraph c-title mt-md">
|
||||
发布时间:{{detail[options.type ==1 ? 'create_time':'create_time_text']}}</view>
|
||||
</view>
|
||||
<view class="mt-md pd-lg">
|
||||
<parser :html="detail[options.type ==1 ? 'text':'content']" @linkpress="linkpress" show-with-animation
|
||||
lazy-load>加载中...</parser>
|
||||
</view>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
import parser from "@/components/jyf-Parser/index"
|
||||
export default {
|
||||
components: {
|
||||
parser
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
detail: {},
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
let {
|
||||
type = 1
|
||||
} = options
|
||||
options.type = type * 1
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
uni.setNavigationBarTitle({
|
||||
title: type == 1 ? '新闻动态' : '文章详情'
|
||||
})
|
||||
this.initIndex()
|
||||
},
|
||||
onShareAppMessage(e) {
|
||||
let {
|
||||
id: pid
|
||||
} = this.userInfo
|
||||
let {
|
||||
id,
|
||||
title,
|
||||
} = this.detail
|
||||
let {
|
||||
type
|
||||
} = this.options
|
||||
let path = `/home/pages/article?id=${id}&pid=${pid}&type=${type}`
|
||||
this.$util.log(path)
|
||||
return {
|
||||
title,
|
||||
imageUrl: '',
|
||||
path,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getDetail()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
linkpress(res) {
|
||||
console.log("linkpress", res);
|
||||
// #ifdef APP-PLUS
|
||||
this.$util.goUrl({
|
||||
url: res.href,
|
||||
openType: 'web'
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
async getDetail() {
|
||||
let {
|
||||
id,
|
||||
type = 1
|
||||
} = this.options
|
||||
let methodKey = type == 3 ? 'mine' : 'home'
|
||||
let methodModel = type === 1 ? 'articleInfo' : type == 3 ? 'operateInfoInfo' : 'welfareColumnInfo'
|
||||
this.detail = await this.$api[methodKey][methodModel](type === 1 ? {
|
||||
article_id: id
|
||||
} : {
|
||||
id
|
||||
});
|
||||
this.$util.hideAll()
|
||||
if (type !== 3) return
|
||||
let {
|
||||
number
|
||||
} = this.$util.getPage(-1).tabList[1]
|
||||
this.$util.getPage(-1).tabList[1].number = number - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff
|
||||
}
|
||||
|
||||
.home-article {
|
||||
.article-title {
|
||||
font-size: 44rpx;
|
||||
line-height: 65rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
525
uniapp/uni-app/home/pages/farm/detail.vue
Normal file
525
uniapp/uni-app/home/pages/farm/detail.vue
Normal file
@@ -0,0 +1,525 @@
|
||||
<template>
|
||||
<view class="land-order-detail" v-if="detail.id">
|
||||
<fixed>
|
||||
<uni-nav-bar :fixed="false"
|
||||
:shadow="false" :statusBar="true" color="#fff" backgroundColor="none"
|
||||
:leftIcon="options.pid?'iconshouye':'icon-left'" title="农场详情">
|
||||
</uni-nav-bar>
|
||||
<image mode="aspectFill" lazy-load class="common-bg abs"
|
||||
:style="{height: `${configInfo.navBarHeight + 104}px`}" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>
|
||||
<view class="common-top-img"></view>
|
||||
<view class="common-top-info rel fill-base">
|
||||
<view class="top-box abs">
|
||||
<view @tap.stop="$util.goUrl({url:`/home/pages/farm/info?id=${options.id}`})"
|
||||
class="farm-item fill-base flex-center ml-md mr-md pd-lg box-shadow radius-24">
|
||||
<image mode="aspectFill" lazy-load class="cover box-shadow radius-24" :src="detail.cover">
|
||||
</image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="flex-y-center f-title c-title mt-sm mb-sm">
|
||||
<view class="max-title ellipsis">{{detail.title}}</view>
|
||||
<view class="status-btn flex-center c-caption ml-sm radius-10"
|
||||
:class="[{'fill-space':detail.is_open == 0},{'fill-body':detail.is_open == 1}]"
|
||||
:style="{color:detail.is_open == 1?primaryColor:''}">
|
||||
{{detail.is_open == 1?'营业中':'闭店中'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between">
|
||||
<view class="star-fill-info rel">
|
||||
<view class="flex-warp star rel">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill abs" :style="{width: detail.star_percent}">
|
||||
<view class="flex-warp">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill icon-font-color"
|
||||
:style="{backgroundImage: '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)'}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view @tap.stop="toMap" class="flex-y-center f-caption c-caption mt-sm"><i
|
||||
class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="addr-text ellipsis">{{detail.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-sm fill-base"></view>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
|
||||
<block v-if="tabList[activeIndex].id == 1">
|
||||
<view class="flex-warp">
|
||||
<view @tap.stop="goDetail(index)" class="goods-item fill-base mt-md ml-md box-shadow radius-16"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.cover"></image>
|
||||
<view class="pd-md">
|
||||
<view class="f-paragraph c-title ellipsis">{{item.goods_name}}</view>
|
||||
<view class="flex-y-baseline">
|
||||
<view class="f-title c-warning">¥{{item.show_price}}</view>
|
||||
<view class="f-caption c-caption text-delete ml-sm">¥{{item.show_init_price}}</view>
|
||||
</view>
|
||||
<view class="f-caption c-caption">已售 {{item.all_sale_count}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="tabList[activeIndex].id == 2">
|
||||
<view @tap.stop="goDetail(index)" class="land-item fill-base mt-md ml-md mr-md box-shadow radius-16"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.cover"></image>
|
||||
<view class="pd-lg">
|
||||
<view class="f-title c-title">{{item.title}}</view>
|
||||
<view class="f-caption c-caption ellipsis-2">
|
||||
<text decode="emsp" style="word-break:break-all;">{{item.desc}}</text>
|
||||
</view>
|
||||
<view class="flex-between mt-md">
|
||||
<view class="flex-y-baseline">
|
||||
<view class="f-lg-title c-warning">¥{{item.min_price}}</view>
|
||||
<view class="f-caption c-caption ml-sm">起</view>
|
||||
</view>
|
||||
<view class="common-btn flex-center f-paragraph c-base radius-4"
|
||||
:style="{background:primaryColor}">
|
||||
立即租赁</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="tabList[activeIndex].id == 3">
|
||||
<view @tap.stop="goDetail(index)" class="claim-item fill-base mt-md ml-md mr-md box-shadow radius-24"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-center pd-lg">
|
||||
<image mode="aspectFill" lazy-load class="cover fill-body radius-24" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg max-380">
|
||||
<view class="f-title c-title ellipsis-2">{{item.title}}</view>
|
||||
<view class="f-paragraph c-title">{{`${item.start_time} ~ ${item.end_time}`}}</view>
|
||||
<view class="flex-between mt-sm mb-md">
|
||||
<view class="line-item rel">
|
||||
<view class="cur abs" :style="{width: item.precent}"></view>
|
||||
</view>
|
||||
<view class="c-caption" style="font-size: 20rpx;">已认养{{item.precent}}</view>
|
||||
</view>
|
||||
<view class="count-list flex-warp">
|
||||
<view class="count-item">
|
||||
<view class="flex-y-center f-caption c-caption">
|
||||
<view class="dot radius"></view>品种
|
||||
</view>
|
||||
<view class="f-paragraph c-title ellipsis">{{item.breed}}</view>
|
||||
</view>
|
||||
<view class="count-item">
|
||||
<view class="flex-y-center f-caption c-caption">
|
||||
<view class="dot radius"></view>周期
|
||||
</view>
|
||||
<view class="f-paragraph c-title ellipsis">{{item.cycle}}天</view>
|
||||
</view>
|
||||
<view class="count-item">
|
||||
<view class="flex-y-center f-caption c-caption">
|
||||
<view class="dot radius"></view>产量
|
||||
</view>
|
||||
<view class="f-paragraph c-title">{{item.output}}kg</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg pt-lg pb-lg b-1px-t">
|
||||
<view class="flex-y-baseline">
|
||||
<view class="f-lg-title c-warning">¥{{item.price}}</view>
|
||||
<view class="f-caption c-caption ml-sm">/{{item.unit}}</view>
|
||||
</view>
|
||||
<view class="common-btn flex-center f-paragraph c-base radius-4" :style="{background:primaryColor}">
|
||||
立即认养</view>
|
||||
</view>
|
||||
<view class="flex-y-center pl-lg pr-lg pb-lg">
|
||||
<view class="flex-warp">
|
||||
<block v-for="(item,index) in item.count.user_list" :key="index">
|
||||
<view class="avatar-group" v-if="index<6">
|
||||
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius"
|
||||
:src="item.avatarUrl"></image>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="flex-y-center f-caption c-title pr-lg" :class="[{'ml-lg':item.count.user_count>0}]"
|
||||
style="height: 48rpx;">
|
||||
已有{{item.count.user_count}}人参与</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="tabList[activeIndex].id == 4">
|
||||
<view class="flex-warp ml-md mr-md">
|
||||
<view @tap.stop="goDetail(index)" class="monitor-item rel fill-base box-shadow radius-16"
|
||||
:class="[{'mr-md':index%2==0}]" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="live-item flex-center abs">
|
||||
<image mode="aspectFill" lazy-load class="live-img" src="/static/image/home/live.png"></image>
|
||||
<view class="f-icontext c-base">LIVE</view>
|
||||
</view>
|
||||
<view class="view-item flex-center abs c-base">
|
||||
<i class="iconfont icon-chakan mr-sm"></i>
|
||||
<view class="f-icontext">{{item.iv || 0}}</view>
|
||||
</view>
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.cover"></image>
|
||||
<view class="content">
|
||||
<view class="f-paragraph c-title ellipsis">{{item.title}}</view>
|
||||
<view class="flex-y-center f-caption c-caption"><i class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="max-300 ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
<view class="space-footer"></view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
detail: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: '商品'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '土地',
|
||||
}, {
|
||||
id: 3,
|
||||
title: '认养',
|
||||
}, {
|
||||
id: 4,
|
||||
title: '监控',
|
||||
}],
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
onShareAppMessage(e) {
|
||||
let {
|
||||
id: pid
|
||||
} = this.userInfo
|
||||
let {
|
||||
id,
|
||||
title,
|
||||
cover: imageUrl
|
||||
} = this.detail
|
||||
let path = `/home/pages/farm/detail?id=${id}&pid=${pid}`
|
||||
this.$util.log(path)
|
||||
return {
|
||||
title,
|
||||
imageUrl,
|
||||
path,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let data = await this.$api.home.farmerInfo({
|
||||
id
|
||||
})
|
||||
data.is_open = 1
|
||||
data.star_percent = (data.star * 1 / 5 * 100).toFixed(2) + '%'
|
||||
this.detail = data
|
||||
this.getList()
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
let param = this.$util.deepCopy(this.param)
|
||||
let {
|
||||
id: farmer_id
|
||||
} = this.options
|
||||
let {
|
||||
id
|
||||
} = tabList[activeIndex]
|
||||
if (id === 4) {
|
||||
param.sort = 1
|
||||
}
|
||||
param = Object.assign({}, param, {
|
||||
farmer_id,
|
||||
});
|
||||
let method = {
|
||||
1: {
|
||||
key: 'shop',
|
||||
model: 'goodsList'
|
||||
},
|
||||
2: {
|
||||
key: 'land',
|
||||
model: 'landList'
|
||||
},
|
||||
3: {
|
||||
key: 'claim',
|
||||
model: 'claimList'
|
||||
},
|
||||
4: {
|
||||
key: 'home',
|
||||
model: 'monitorList'
|
||||
}
|
||||
}
|
||||
let {
|
||||
key,
|
||||
model
|
||||
} = method[id]
|
||||
let newList = await this.$api[key][model](param)
|
||||
if (id == 3) {
|
||||
newList.data.map(item => {
|
||||
let {
|
||||
stock,
|
||||
sale_num
|
||||
} = item
|
||||
item.precent = (sale_num / (stock + sale_num) * 100).toFixed(2) + '%'
|
||||
})
|
||||
}
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
async toMap() {
|
||||
let {
|
||||
lat,
|
||||
lng,
|
||||
address
|
||||
} = this.detail
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
await uni.getLocation({
|
||||
type: 'gcj02',
|
||||
})
|
||||
await uni.openLocation({
|
||||
latitude: lat * 1,
|
||||
longitude: lng * 1,
|
||||
name: address,
|
||||
scale: 28
|
||||
})
|
||||
},
|
||||
goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let {
|
||||
id: type
|
||||
} = this.tabList[this.activeIndex]
|
||||
let arr = {
|
||||
1: '/shop/pages/detail',
|
||||
2: '/land/pages/detail',
|
||||
3: '/claim/pages/detail',
|
||||
4: '/home/pages/monitor/detail',
|
||||
}
|
||||
let url = `${arr[type]}?id=${id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.land-order-detail {
|
||||
|
||||
.farm-item {
|
||||
.cover {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.icon-dingwei,
|
||||
.icon-right {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
|
||||
.status-btn {
|
||||
width: 80rpx;
|
||||
height: 36rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.max-title {
|
||||
max-width: 370rpx;
|
||||
}
|
||||
|
||||
.addr-text {
|
||||
max-width: 420rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-item {
|
||||
width: 345rpx;
|
||||
|
||||
.cover {
|
||||
width: 345rpx;
|
||||
height: 345rpx;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.land-item {
|
||||
.cover {
|
||||
width: 100%;
|
||||
height: 345rpx;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.claim-item {
|
||||
.cover {
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.line-item {
|
||||
width: 230rpx;
|
||||
height: 15rpx;
|
||||
background: rgba(112, 152, 64, 0.2);
|
||||
border-radius: 8rpx;
|
||||
|
||||
.cur {
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 15rpx;
|
||||
background: linear-gradient(0deg, #709840 0%, #91C84E 100%);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.count-list {
|
||||
.count-item {
|
||||
width: 33.33%;
|
||||
|
||||
.dot {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
background: #B3D465;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.monitor-item {
|
||||
width: 345rpx;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.live-item {
|
||||
top: 10rpx;
|
||||
left: 10rpx;
|
||||
width: 109rpx;
|
||||
height: 38rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 18rpx;
|
||||
|
||||
.live-img {
|
||||
top: 0;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
|
||||
.f-icontext {
|
||||
margin-left: 10rpx;
|
||||
width: 61rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.view-item {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 137rpx;
|
||||
height: 51rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 0 15rpx 0 0;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 345rpx;
|
||||
height: 190rpx;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
|
||||
.iconfont {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
188
uniapp/uni-app/home/pages/farm/info.vue
Normal file
188
uniapp/uni-app/home/pages/farm/info.vue
Normal file
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<view class="home-farm-info" v-if="detail.id">
|
||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="商户信息">
|
||||
</uni-nav-bar>
|
||||
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
||||
<image mode="aspectFill" lazy-load class="common-bg abs" :style="{height: `${configInfo.navBarHeight + 104}px`}"
|
||||
src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>
|
||||
<view class="common-top-img"></view>
|
||||
<view class="common-top-info rel">
|
||||
<view class="top-box abs">
|
||||
<view class="farm-item fill-base flex-center ml-md mr-md pd-lg box-shadow radius-24">
|
||||
<image mode="aspectFill" lazy-load class="cover box-shadow-mini radius-24" :src="detail.cover">
|
||||
</image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title ellipsis" style="max-width: 460rpx;">{{detail.title}}</view>
|
||||
<view class="f-caption c-caption mt-sm">浏览量 {{detail.iv || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-md"></view>
|
||||
<view class="fill-base pt-sm pl-lg pr-lg pb-lg">
|
||||
<view class="common-nav-title flex-center c-title">
|
||||
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||
<view class="f-title text-bold flex-1">店铺描述</view>
|
||||
</view>
|
||||
<view class="f-paragraph c-desc">
|
||||
<text decode="emsp" style="word-break:break-all;">{{detail.desc}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-list fill-base pl-lg pb-lg">
|
||||
<image mode="aspectFill" @tap.stop="$util.previewImage({current:item,urls:detail.imgs})"
|
||||
class="info-img fill-body radius-16"
|
||||
:class="[{'mr-md':index!=detail.imgs.length},{'mr-lg': index == detail.imgs.length}]" :src="item"
|
||||
v-for="(item,index) in detail.imgs" :key="index"></image>
|
||||
</view>
|
||||
|
||||
<view class="space-md"></view>
|
||||
<view class="fill-base pt-sm pl-lg pr-lg pb-lg">
|
||||
<view class="common-nav-title flex-center c-title">
|
||||
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||
<view class="f-title text-bold flex-1">基础信息</view>
|
||||
</view>
|
||||
<view class="f-paragraph c-desc mt-sm">
|
||||
<view @tap.stop="$util.goUrl({url:detail.mobile,openType:'call'})" class="flex-between">
|
||||
<view>联系电话</view>
|
||||
<view>{{detail.mobile}}</view>
|
||||
</view>
|
||||
<view @tap.stop="toMap" class="flex-warp mt-md">
|
||||
<view>店铺地址</view>
|
||||
<view class="flex-1 ml-lg pl-lg">{{detail.address}}</view>
|
||||
</view>
|
||||
<!-- <view class="flex-between mt-md">
|
||||
<view>开店时间</view>
|
||||
<view>{{detail.create_time}}</view>
|
||||
</view> -->
|
||||
<view class="flex-between mt-md">
|
||||
<view>是否营业</view>
|
||||
<view>{{openType[detail.is_open]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-footer"></view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
options: {},
|
||||
detail: {},
|
||||
openType: {
|
||||
0: '闭店中',
|
||||
1: '营业中'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
methods: {
|
||||
async initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let data = await this.$api.home.farmerInfo({
|
||||
id
|
||||
})
|
||||
data.is_open = 1
|
||||
data.star_percent = (data.star * 1 / 5 * 100).toFixed(2) + '%'
|
||||
data.iv = data.iv*1+1
|
||||
this.detail = data
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
async toMap() {
|
||||
let {
|
||||
lat,
|
||||
lng,
|
||||
address
|
||||
} = this.detail
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
await uni.getLocation({
|
||||
type: 'gcj02',
|
||||
})
|
||||
await uni.openLocation({
|
||||
latitude: lat * 1,
|
||||
longitude: lng * 1,
|
||||
name: address,
|
||||
scale: 28
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-farm-info {
|
||||
.farm-item {
|
||||
.cover {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.icon-dingwei,
|
||||
.icon-right {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
|
||||
.status-btn {
|
||||
width: 80rpx;
|
||||
height: 36rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.max-title {
|
||||
max-width: 370rpx;
|
||||
}
|
||||
|
||||
.addr-text {
|
||||
max-width: 420rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.info-list {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
|
||||
.info-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
225
uniapp/uni-app/home/pages/farm/list.vue
Normal file
225
uniapp/uni-app/home/pages/farm/list.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<view class="home-farm-list">
|
||||
<fixed>
|
||||
<view @tap.stop="toChooseLocation"
|
||||
class="fill-base flex-center pt-lg pb-lg pl-md pr-md f-paragraph c-title">
|
||||
<view class="flex-1 flex-warp">
|
||||
<i class="iconfont icon-dingwei mr-sm" style="margin-top: 3rpx;" :style="{color:primaryColor}"></i>
|
||||
<view class="max-580 ellipsis">{{location.address || '定位中...'}}</view>
|
||||
</view>
|
||||
<i class="iconfont icon-right" style="font-size: 28rpx;"></i>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="farm-item fill-base flex-center mt-md ml-md mr-md pd-lg box-shadow radius-24"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-24" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="flex-y-center f-title c-title mt-sm mb-sm">
|
||||
<view class="max-title ellipsis">{{item.title}}</view>
|
||||
<view class="status-btn flex-center c-caption ml-sm radius-10"
|
||||
:class="[{'fill-space':item.is_open==0},{'fill-body':item.is_open==1}]"
|
||||
:style="{color:item.is_open==1?primaryColor:''}">
|
||||
{{item.is_open==1?'营业中':'闭店中'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill-info rel">
|
||||
<view class="flex-warp star rel">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill abs" :style="{width: item.star_percent}">
|
||||
<view class="flex-warp">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill icon-font-color"
|
||||
:style="{backgroundImage: '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)'}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-caption c-caption mt-sm"><i class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="addr-text ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
|
||||
<abnor @confirm="$util.checkAuth({ type: 'userLocation' })" :tip="[{ text: '定位失败,请开启地理位置授权后重试~', color: 0 }]"
|
||||
:button="[{ text: '开启定位' , type: 'confirm' }]" btnSize="" v-if="!loading && !location.lng"> </abnor>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
location: state => state.user.location,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getShopCarList']),
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
let {
|
||||
location
|
||||
} = this
|
||||
if (!location.lat) {
|
||||
location = await this.$util.getBmapLocation()
|
||||
this.updateUserItem({
|
||||
key: 'location',
|
||||
val: location
|
||||
})
|
||||
}
|
||||
if (!this.location.lat) {
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
return
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
location
|
||||
} = this
|
||||
let {
|
||||
lat,
|
||||
lng
|
||||
} = location
|
||||
param = Object.assign({}, param, {
|
||||
lat,
|
||||
lng,
|
||||
});
|
||||
let newList = await this.$api.home.farmerList(param);
|
||||
newList.data.map(item => {
|
||||
item.is_open = 1
|
||||
item.star_percent = (item.star * 1 / 5 * 100).toFixed(2) + '%'
|
||||
})
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
// 选择地区
|
||||
async toChooseLocation(e) {
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
let [, {
|
||||
address = '',
|
||||
longitude: lng = 0,
|
||||
latitude: lat = 0
|
||||
} = {}] = await uni.chooseLocation();
|
||||
if (!address) return
|
||||
let location = {
|
||||
lng,
|
||||
lat,
|
||||
address
|
||||
}
|
||||
this.updateUserItem({
|
||||
key: 'location',
|
||||
val: location
|
||||
})
|
||||
this.param.page = 1
|
||||
this.getList()
|
||||
this.$util.back()
|
||||
},
|
||||
// 详情
|
||||
async goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/home/pages/farm/detail?id=${id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-farm-list {
|
||||
.farm-item {
|
||||
.cover {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.icon-dingwei {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
|
||||
.status-btn {
|
||||
width: 80rpx;
|
||||
height: 36rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.max-title {
|
||||
max-width: 370rpx;
|
||||
}
|
||||
|
||||
.addr-text {
|
||||
max-width: 420rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
51
uniapp/uni-app/home/pages/monitor/detail.vue
Normal file
51
uniapp/uni-app/home/pages/monitor/detail.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<view class="home-monitor-detail" v-if="url">
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
import siteInfo from '../../../siteinfo.js';
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
url: ''
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let {
|
||||
siteroot,
|
||||
uniacid
|
||||
} = siteInfo
|
||||
let href = siteroot.split('/index.php')[0]
|
||||
this.url = `${href}/demo/index.html?${id}&${uniacid}`
|
||||
// this.url = `${href}/monitor/index.html?${id}&${uniacid}`
|
||||
this.$util.hideAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
253
uniapp/uni-app/home/pages/monitor/list.vue
Normal file
253
uniapp/uni-app/home/pages/monitor/list.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<view class="home-monitor-list" v-if="isLoad">
|
||||
<fixed>
|
||||
<view class="fill-base flex-between pt-md pb-md b-1px-b">
|
||||
<view class="pl-md pr-md" style="width: 650rpx;">
|
||||
<search type="input" @input="toSearch" textAlign="left" placeholder="搜索农场名称" :padding="0"
|
||||
:radius="35">
|
||||
</search>
|
||||
</view>
|
||||
<view @tap.stop="toShowRank" class="flex-center c-caption b-1px-l" style="width: 100rpx;">
|
||||
<i class="iconfont icon-down-bold" :class="[{'rotate-180':show_rank_item}]"></i>
|
||||
</view>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<uni-popup @change="popupChange" ref="rank_item" type="top" :custom="true">
|
||||
<view style="height: 100rpx;"></view>
|
||||
<view class="pd-lg fill-base">
|
||||
<view @tap.stop="handerTabChange(index,'rankInd')" class="f-paragraph c-title"
|
||||
:class="[{'mt-md':index!=0}]" :style="{color:index==rankInd?primaryColor:''}"
|
||||
v-for="(item,index) in rankList" :key="index">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<view class="flex-warp ml-md mr-md">
|
||||
<view @tap.stop="goDetail(index)" class="monitor-item fill-base box-shadow radius-16"
|
||||
:class="[{'mr-md':index%2==0}]" v-for="(item,index) in list.data" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.cover"></image>
|
||||
<view class="content">
|
||||
<view class="f-paragraph c-title ellipsis">{{item.title}}</view>
|
||||
<view class="flex-y-center f-caption c-caption"><i class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="max-300 ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-caption c-caption"><i class="iconfont icon-eyeopen mr-sm"></i>
|
||||
<view class="max-300 ellipsis">{{item.iv || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
rankInd: 0,
|
||||
rankList: [{
|
||||
id: 1,
|
||||
title: '综合排序'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '距离最近'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '观看最多'
|
||||
}],
|
||||
activeIndex: 0,
|
||||
tabList: [],
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false,
|
||||
show_rank_item: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
location: state => state.user.location,
|
||||
}),
|
||||
async onLoad() {
|
||||
if (this.isLoad) return
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
async onShow() {
|
||||
if (!this.isLoad || (this.location.lat && this.rankInd != 1)) return
|
||||
let [err, result] = await uni.getSetting()
|
||||
if (err || !result.authSetting[`scope.userLocation`]) return
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
await this.getLocation()
|
||||
let cate = await this.$api.claim.claimCateList({
|
||||
type: 1
|
||||
})
|
||||
cate.unshift({
|
||||
id: 0,
|
||||
title: '全部'
|
||||
})
|
||||
this.tabList = cate
|
||||
this.isLoad = true
|
||||
this.param.page = 1
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
async getLocation() {
|
||||
let {
|
||||
location
|
||||
} = this
|
||||
if (!location.lat) {
|
||||
location = await this.$util.getBmapLocation()
|
||||
this.updateUserItem({
|
||||
key: 'location',
|
||||
val: location
|
||||
})
|
||||
}
|
||||
},
|
||||
handerTabChange(index, type) {
|
||||
this[type] = index
|
||||
if (type == 'rankInd') {
|
||||
this.$refs.rank_item.close()
|
||||
}
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toShowRank() {
|
||||
let {
|
||||
show_rank_item,
|
||||
} = this
|
||||
if (this.lockTap) return
|
||||
this.lockTap = true
|
||||
setTimeout(() => {
|
||||
let methodModel = show_rank_item ? 'close' : 'open'
|
||||
this.$refs.rank_item[methodModel]()
|
||||
}, 500)
|
||||
},
|
||||
popupChange(e) {
|
||||
let {
|
||||
show
|
||||
} = e
|
||||
this.show_rank_item = show
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
}, 200)
|
||||
},
|
||||
toSearch(val) {
|
||||
this.loading = true
|
||||
this.param.page = 1
|
||||
this.param.title = val
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
rankList,
|
||||
rankInd
|
||||
} = this
|
||||
let {
|
||||
id: sort
|
||||
} = rankList[rankInd]
|
||||
if (sort == 2 && !this.location.lat) {
|
||||
await this.getLocation()
|
||||
return
|
||||
}
|
||||
let {
|
||||
lng = 0,
|
||||
lat = 0
|
||||
} = this.location
|
||||
param = Object.assign({}, param, {
|
||||
sort,
|
||||
});
|
||||
if (sort === 2) {
|
||||
param.lat = lat
|
||||
param.lng = lng
|
||||
}
|
||||
let newList = await this.$api.home.farmerList(param)
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
async goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/home/pages/monitor/search?id=${id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-monitor-list {
|
||||
.monitor-item {
|
||||
width: 345rpx;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.cover {
|
||||
width: 345rpx;
|
||||
height: 190rpx;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
|
||||
.iconfont {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
207
uniapp/uni-app/home/pages/monitor/search.vue
Normal file
207
uniapp/uni-app/home/pages/monitor/search.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view class="home-monitor-list" v-if="isLoad">
|
||||
|
||||
<fixed>
|
||||
<view class="fill-base pt-big pb-big pl-md pr-md">
|
||||
<search @input="toSearch" type="input" :padding="0" :radius="70" placeholder="搜索监控名称"></search>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<view class="flex-warp ml-md mr-md">
|
||||
<view @tap.stop="goDetail(index)" class="monitor-item rel fill-base box-shadow radius-16"
|
||||
:class="[{'mr-md':index%2==0}]" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="live-item flex-center abs">
|
||||
<image mode="aspectFill" lazy-load class="live-img" src="/static/image/home/live.png"></image>
|
||||
<view class="f-icontext c-base">LIVE</view>
|
||||
</view>
|
||||
<view class="view-item flex-center abs c-base">
|
||||
<i class="iconfont icon-chakan mr-sm"></i>
|
||||
<view class="f-icontext">{{item.iv || 0}}</view>
|
||||
</view>
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.cover"></image>
|
||||
<view class="content">
|
||||
<view class="f-paragraph c-title ellipsis">{{item.title}}</view>
|
||||
<view class="flex-y-center f-caption c-caption"><i class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="max-300 ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
rankInd: 0,
|
||||
rankList: [{
|
||||
id: 1,
|
||||
title: '综合排序'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '距离最近'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '观看最多'
|
||||
}],
|
||||
activeIndex: 0,
|
||||
tabList: [],
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false,
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
location: state => state.user.location,
|
||||
}),
|
||||
async onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
await this.initIndex()
|
||||
this.isLoad = true
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo']),
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
toSearch(val) {
|
||||
this.loading = true
|
||||
this.param.page = 1
|
||||
this.param.title = val
|
||||
this.getList()
|
||||
},
|
||||
handerTabChange(index, type) {
|
||||
this[type] = index
|
||||
if (type == 'rankInd') {
|
||||
this.$refs.rank_item.close()
|
||||
}
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
} = this
|
||||
let {
|
||||
id = 0,
|
||||
} = this.options
|
||||
param.farmer_id = id
|
||||
let newList = await this.$api.home.monitorList(param)
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
async goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/home/pages/monitor/detail?id=${id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-monitor-list {
|
||||
.monitor-item {
|
||||
width: 345rpx;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.live-item {
|
||||
top: 10rpx;
|
||||
left: 10rpx;
|
||||
width: 109rpx;
|
||||
height: 38rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 18rpx;
|
||||
|
||||
.live-img {
|
||||
top: 0;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
|
||||
.f-icontext {
|
||||
margin-left: 10rpx;
|
||||
width: 61rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.view-item {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 137rpx;
|
||||
height: 51rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 0 15rpx 0 0;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 345rpx;
|
||||
height: 190rpx;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
|
||||
.iconfont {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
503
uniapp/uni-app/home/pages/search.vue
Normal file
503
uniapp/uni-app/home/pages/search.vue
Normal file
@@ -0,0 +1,503 @@
|
||||
<template>
|
||||
<view class="shop-choose-store" v-if="isLoad">
|
||||
<fixed>
|
||||
<view class="rel search-info">
|
||||
<view class="user-store-info abs">
|
||||
<image mode="aspectFill" lazy-load class="store-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-store.png">
|
||||
</image>
|
||||
</view>
|
||||
<uni-nav-bar :fixed="false" :shadow="false" :statusBar="true" :onlyLeft="true" color="#fff"
|
||||
:backgroundColor="`none`">
|
||||
<view @tap.stop="toChooseLocation" class="flex-y-center" slot="left">
|
||||
<i class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="text-bold max-400 ellipsis">
|
||||
{{location.address ?location.address : isLoad ? '定位失败' : '定位中...'}}
|
||||
</view>
|
||||
<i class="iconfont icon-down-bold ml-sm"></i>
|
||||
</view>
|
||||
</uni-nav-bar>
|
||||
<view class="flex-between fill-base">
|
||||
<view style="width: 550rpx;">
|
||||
<search @input="toSearch" @confirm="toSearch" type="input" :radius="30"
|
||||
:disabled="location.address ? false : true" :placeholder="`搜索${rankList[rankInd].title}名称`">
|
||||
</search>
|
||||
</view>
|
||||
<view @tap.stop="toShowRank" class="flex-center c-caption b-1px-l" style="width: 200rpx;">
|
||||
{{rankList[rankInd].title}}
|
||||
<i class="iconfont icon-down-bold ml-md" :class="[{'rotate-180':show_rank_item}]"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
|
||||
<uni-popup @change="popupChange" ref="rank_item" type="top" :custom="true">
|
||||
<view :style="{height: searchHeight + 'px' }"></view>
|
||||
<view class="pd-lg fill-base">
|
||||
<view @tap.stop="handerTabChange(index)" class="f-paragraph c-title" :class="[{'mt-md':index!=0}]"
|
||||
:style="{color:index==rankInd?primaryColor:''}" v-for="(item,index) in rankList" :key="index">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<block v-for="(item,index) in list.data" :key="index">
|
||||
<block v-if="rankList[rankInd].id === 1">
|
||||
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="farm-item fill-base flex-center mt-md ml-md mr-md pd-lg box-shadow radius-24">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-24" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="flex-y-center f-title c-title mt-sm mb-sm">
|
||||
<view class="max-title ellipsis">{{item.title}}</view>
|
||||
<!-- <view class="status-btn flex-center c-caption ml-sm radius-10"
|
||||
:class="[{'fill-space':item.is_open==0},{'fill-body':item.is_open==1}]"
|
||||
:style="{color:item.is_open==1?primaryColor:''}">
|
||||
{{item.is_open==1?'营业中':'闭店中'}}
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="star-fill-info rel">
|
||||
<view class="flex-warp star rel">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill abs" :style="{width: item.star_percent}">
|
||||
<view class="flex-warp">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill icon-font-color"
|
||||
:style="{backgroundImage: '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)'}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-caption c-caption mt-sm"><i
|
||||
class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="addr-text ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="rankList[rankInd].id === 2">
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="farm-item rel fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
|
||||
<view class="more-btn abs flex-center">
|
||||
<view class="flex-y-baseline" :style="{color:primaryColor}">
|
||||
<view>进店选购</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<image mode="aspectFill" lazy-load class="cover box-shadow-mini radius-24" :src="item.cover">
|
||||
</image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="flex-between f-title c-title mt-sm mb-sm">
|
||||
<view class="max-300 ellipsis">{{item.title}}</view>
|
||||
<view class="f-caption c-caption">
|
||||
{{item.distance}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill-info rel">
|
||||
<view class="flex-warp star rel">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="star-fill abs" :style="{width: item.star_percent}">
|
||||
<view class="flex-warp">
|
||||
<view class="item-star flex-center" v-for="(aitem,aindex) in 5" :key="aindex">
|
||||
<i class="iconfont icon-star-bold-fill icon-font-color"
|
||||
:style="{backgroundImage: '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)'}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-caption c-caption mt-sm"><i
|
||||
class="iconfont icon-dingwei mr-sm"></i>
|
||||
<view class="addr-text ellipsis">{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="rankList[rankInd].id === 3">
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="goods-item flex-center mt-md ml-md mr-md pd-lg fill-base radius-24">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="flex-center">
|
||||
<view class="flex-1">
|
||||
<view class="f-title c-title text-bold mt-sm mb-sm ellipsis">{{item.goods_name}}
|
||||
</view>
|
||||
<view class="flex-y-baseline f-caption c-warning">¥<view class="f-lg-title">
|
||||
{{item.show_price}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="f-caption c-caption text-delete">¥{{item.show_init_price}}</view>
|
||||
</view>
|
||||
<image lazy-load class="add-car-img" src="/static/image/shop/add-car.png">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
|
||||
<abnor @confirm="$util.checkAuth({ type: 'userLocation' })" :tip="[{ text: '定位失败,请开启地理位置授权后重试~', color: 0 }]"
|
||||
:button="[{ text: '开启定位' , type: 'confirm' }]" btnSize="" v-if="!loading && !location.lng"> </abnor>
|
||||
|
||||
<view class="space-max-footer"></view>
|
||||
|
||||
<fix-bottom-button @confirm="$util.goUrl({ url: 1, openType: `navigateBack` })"
|
||||
:text="[{ text: '返回首页', type: 'confirm' }]" bgColor="#fff" v-if="isLoad"> </fix-bottom-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
|
||||
export default {
|
||||
components: {
|
||||
uniSegmentedControl
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
searchHeight: 0,
|
||||
rankInd: 0,
|
||||
rankList: [{
|
||||
id: 1,
|
||||
title: '搜农场',
|
||||
methodKey: 'home',
|
||||
method: 'farmerList'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '搜店铺',
|
||||
methodKey: 'shop',
|
||||
method: 'indexStoreList'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '搜商品',
|
||||
methodKey: 'shop',
|
||||
method: 'goodsList'
|
||||
}],
|
||||
param: {
|
||||
page: 1,
|
||||
long: '',
|
||||
lat: '',
|
||||
store_name: ''
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false,
|
||||
show_rank_item: false,
|
||||
goodsInd: 0,
|
||||
goodsInfo: {},
|
||||
subIndex: 0,
|
||||
currentSpecs: {}, //存放最后选中的商品
|
||||
currentNum: 1, //选中数量
|
||||
carIsHave: {
|
||||
id: 0,
|
||||
isHave: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
location: state => state.user.location,
|
||||
}),
|
||||
async onLoad() {
|
||||
this.$util.setNavigationBarColor({
|
||||
color: '#ffffff',
|
||||
bg: ''
|
||||
})
|
||||
if (this.isLoad) return
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
async onShow() {
|
||||
if (!this.isLoad || (this.location.lat && this.rankInd != 2)) return
|
||||
let [err, result] = await uni.getSetting()
|
||||
if (err || !result.authSetting[`scope.userLocation`]) return
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
onShareAppMessage(e) {
|
||||
let path = `/user/pages/store-list`
|
||||
this.$util.log(path);
|
||||
return {
|
||||
title: '',
|
||||
imageUrl: '',
|
||||
path,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getUserInfo']),
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
let {
|
||||
location
|
||||
} = this
|
||||
if (!location.lat) {
|
||||
location = await this.$util.getBmapLocation()
|
||||
this.updateUserItem({
|
||||
key: 'location',
|
||||
val: location
|
||||
})
|
||||
}
|
||||
if (!location.lng) {
|
||||
this.loading = false
|
||||
this.isLoad = true
|
||||
return
|
||||
}
|
||||
await this.getList()
|
||||
setTimeout(() => {
|
||||
this.toSetResHeight()
|
||||
}, 200)
|
||||
},
|
||||
async initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async toSetResHeight() {
|
||||
const query = uni.createSelectorQuery();
|
||||
query.select('.search-info').boundingClientRect(data => {
|
||||
this.searchHeight = data.height
|
||||
}).exec();
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.rankInd = index
|
||||
this.$refs.rank_item.close()
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toShowRank() {
|
||||
let {
|
||||
show_rank_item,
|
||||
} = this
|
||||
if (this.lockTap) return
|
||||
this.lockTap = true
|
||||
setTimeout(() => {
|
||||
let methodModel = show_rank_item ? 'close' : 'open'
|
||||
this.$refs.rank_item[methodModel]()
|
||||
}, 500)
|
||||
},
|
||||
popupChange(e) {
|
||||
let {
|
||||
show
|
||||
} = e
|
||||
this.show_rank_item = show
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
}, 200)
|
||||
},
|
||||
toSearch(val) {
|
||||
this.param.page = 1
|
||||
this.param.store_name = val
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
location,
|
||||
rankList,
|
||||
rankInd
|
||||
} = this
|
||||
let {
|
||||
lat = 0,
|
||||
lng = 0
|
||||
} = location
|
||||
param = Object.assign({}, param, {
|
||||
lat,
|
||||
lng,
|
||||
})
|
||||
let {
|
||||
id: rankType,
|
||||
methodKey,
|
||||
method
|
||||
} = rankList[rankInd]
|
||||
if (rankType == 3) {
|
||||
param.type = 1
|
||||
}
|
||||
if (rankType != 2) {
|
||||
if (rankType == 1) {
|
||||
param.title = param.store_name
|
||||
} else {
|
||||
param.goods_name = param.store_name
|
||||
}
|
||||
delete param.store_name
|
||||
}
|
||||
let newList = await this.$api[methodKey][method](param);
|
||||
if (rankType != 3) {
|
||||
newList.data.map(item => {
|
||||
item.is_open = 1
|
||||
item.star_percent = (item.star * 1 / 5 * 100).toFixed(2) + '%'
|
||||
})
|
||||
}
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.isLoad = true
|
||||
this.$util.hideAll()
|
||||
},
|
||||
// 选择地区
|
||||
async toChooseLocation(e) {
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
|
||||
let [, {
|
||||
address = '',
|
||||
longitude: lng,
|
||||
latitude: lat
|
||||
} = {}] = await uni.chooseLocation();
|
||||
if (!lng) return
|
||||
let location = {
|
||||
lng,
|
||||
lat,
|
||||
address
|
||||
}
|
||||
this.updateUserItem({
|
||||
key: 'location',
|
||||
val: location
|
||||
})
|
||||
this.location = location
|
||||
this.param.page = 1
|
||||
this.getList()
|
||||
},
|
||||
async goDetail(index) {
|
||||
let {
|
||||
id,
|
||||
store_id = 0
|
||||
} = this.list.data[index]
|
||||
let {
|
||||
id: rankType
|
||||
} = this.rankList[this.rankInd]
|
||||
if (rankType === 2) {
|
||||
store_id = id
|
||||
}
|
||||
let url = {
|
||||
1: `/home/pages/farm/detail?id=${id}`,
|
||||
2: `/shop/pages/store?id=${store_id}`,
|
||||
3: `/shop/pages/detail?id=${id}`
|
||||
}
|
||||
this.$util.goUrl({
|
||||
url: url[rankType]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.shop-choose-store {
|
||||
|
||||
.user-store-info {
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
|
||||
.store-bg {
|
||||
width: 100%;
|
||||
height: 168rpx;
|
||||
height: calc(168rpx + env(safe-area-inset-bottom) / 2);
|
||||
padding-bottom: calc(5px + env(safe-area-inset-bottom) / 2);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.search-box-radius {
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
}
|
||||
|
||||
|
||||
.farm-item {
|
||||
.cover {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.icon-dingwei {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status-btn {
|
||||
width: 80rpx;
|
||||
height: 36rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.max-title {
|
||||
max-width: 450rpx;
|
||||
// max-width: 370rpx;
|
||||
}
|
||||
|
||||
.addr-text {
|
||||
max-width: 420rpx;
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 122rpx;
|
||||
height: 46rpx;
|
||||
font-size: 20rpx;
|
||||
background: rgba(112, 152, 64, 0.1);
|
||||
border-radius: 0 25rpx 0 15rpx;
|
||||
|
||||
.iconfont {
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.goods-item {
|
||||
.cover {
|
||||
width: 180rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
|
||||
.add-car-img {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
max-width: 370rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
145
uniapp/uni-app/home/pages/welfare.vue
Normal file
145
uniapp/uni-app/home/pages/welfare.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<view class="home-welfare">
|
||||
|
||||
<fixed>
|
||||
<view class="fill-base pt-big pb-big pl-md pr-md">
|
||||
<search @input="toSearch" type="input" :padding="0" :radius="70"
|
||||
:placeholder="`搜索${placeholder[options.type]}名称`"></search>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<block v-for="(item,index) in list.data" :key="index">
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="welfare-item flex-center mt-md ml-md mr-md pd-lg fill-base radius-16">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold mb-md ellipsis">{{item.title}}
|
||||
</view>
|
||||
<view class="f-caption c-caption">{{item.create_time_text}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
placeholder: {
|
||||
1: '栏目',
|
||||
2: '公告',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
type: 1 //1公益栏目 2系统公告 3运营公告
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false,
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
location: state => state.user.location,
|
||||
}),
|
||||
async onLoad(options) {
|
||||
let {
|
||||
type = 1
|
||||
} = options
|
||||
options.type = type
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.param.type = type
|
||||
await this.initIndex()
|
||||
uni.setNavigationBarTitle({
|
||||
title: type === 1 ? '公益栏目' : '系统公告'
|
||||
})
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo']),
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
toSearch(val) {
|
||||
this.loading = true
|
||||
this.param.page = 1
|
||||
this.param.title = val
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
} = this
|
||||
let newList = await this.$api.home.welfareColumnList(param)
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
async goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/home/pages/article?id=${id}&type=2`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.home-welfare {
|
||||
.welfare-item {
|
||||
.cover {
|
||||
width: 180rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
max-width: 440rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user