123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <template>
- <view class="container">
- <view class="dataList">
- <view class="search">
- <view class="tui-rolling-search">
- <tui-icon name="search-2" :size="32" unit="rpx"></tui-icon>
- <form @submit="searchSubmit">
- <input class="searchinput" placeholder="搜索" placeholder-class="placeholder"
- @confirm="searchSubmit" confirm-type="search" name="search"
- :value="where.keyword">
- </form>
- </view>
- </view>
- <view class="list acea-row row-between-wrapper">
- <block v-for="(item, index) in dataList" :key="index">
- <view @tap="selectTap" :data-item="item" class="item">
- <view class="text">
- <view class="nametitle">{{item.title}}</view>
- <view class="indicators">
- <text class="indctext">地址: {{item.province_name}}{{item.city_name}}{{item.district_name}}{{item.house_number}}</text>
- </view>
- </view>
- <view class="buttonbox">
- <view class="distance">
- <tui-icon name="position-fill" :size="16" color="#ff1e02"></tui-icon><text
- v-if="item.distance" class="kmclass">{{item.distance}}km</text>
- </view>
- <button class="itembutton">选择</button>
- </view>
- </view>
- </block>
- <view class="loadingicon acea-row row-center-wrapper" v-if="dataList.length > 0">
- <text class="loading iconfont icon-jiazai" :hidden="loading==false"></text>
- </view>
- </view>
- </view>
- <tui-tabbar :current="current">
- </tui-tabbar>
- </view>
- </template>
- <script>
- var app = getApp();
- export default {
- data() {
- return {
- current: '',
- dataList: [],
- navH: "",
- goodsid: '',
- where: {
- keyword: '',
- priceOrder: '',
- salesOrder: '',
- news: 0,
- page: 1,
- limit: 10,
- cid: 0,
- latitude: "",
- longitude: ""
- },
- price: 0,
- stock: 0,
- nows: false,
- loadend: false,
- loading: false,
- bottommenulist: [],
- host_product: "",
- title: "",
- position: "",
- latitude: "",
- longitude: "",
- cid: ""
- };
- },
- components: {},
- props: {},
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- const _this = this; //位置授权
- this.where.cid = options.cid || ''
- this.goodsid = options.goodsid || ''
- // #ifdef MP-WEIXIN
- this.current = "/" + this.__route__;
- // #endif
- //#ifdef H5
- this.current = this.$route.path;
- //#endif
- _this.title = options.title || '';
- _this.where.keyword = options.searchValue || '';
- this.getPosition();
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- this.where.page = 1;
- this.loadend = false;
- this.dataList = [];
- this.get_data_list();
- uni.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- this.get_data_list();
- },
- methods: {
- //获取定位信息
- getPosition() {
- const _this = this;
- // #ifdef MP-WEIXIN
- wx.authorize({
- scope: 'scope.userFuzzyLocation',
- success: res => {
- //console.log(res)
- wx.getFuzzyLocation({
- type: 'wgs84',
- success(res) {
- _this.position = res.address;
- _this.where.latitude = res.latitude;
- _this.where.longitude = res.longitude;
- _this.loadend = false;
- _this.get_data_list();
- }
- });
- },
- fail: res => {
- //console.log('失败:', res);
- }
- });
- // #endif
- //#ifdef H5 || APP-PLUS
- uni.getLocation({
- type: 'wgs84',
- success: function(lb) {
- _this.where.latitude = lb.latitude;
- _this.where.longitude = lb.longitude;
- _this.get_data_list();
- console.log(lb.longitude, lb.latitude);
- },
- })
- //#endif
- },
- selectTap: function(e) {
- const _this = this;
- var item = e.currentTarget.dataset.item;
- _this.$request.post('operatingcity.getcity', {
- samkey: (new Date()).valueOf(),
- city_id:item.id
- }).then(res => {
- uni.navigateBack({});
- });
- },
- searchSubmit: function(e) {
- var that = this;
- that.where.keyword = e.detail.value;
- that.where.page = 1;
- that.loadend = false;
- this.get_data_list(true);
- },
- //点击事件处理
- set_where: function(e) {
- this.cid = e.currentTarget.dataset.cid;
- this.loadend = false;
- this.where.page = 1;
- this.get_data_list(true);
- },
- //设置where条件
- setWhere: function() {
- this.where.salesOrder = 'asc';
- if (this.cid) {
- this.where.cid = this.cid;
- }
- },
- //查找
- get_data_list: function(isPage) {
- var that = this;
- this.setWhere();
- if (that.loadend) return;
- if (that.loading) return;
- if (isPage === true) {
- that.dataList = [];
- that.where.page =1;
- }
- that.where.samkey =(new Date()).valueOf();
- //console.log(that.where);
- that.$request.post('operatingcity.list', that.where).then(res => {
- var dataList = res.data.data;
- var loadend = dataList.length < that.where.limit;
- that.where.page = that.where.page + 1;
- that.loadend = loadend;
- that.loading = false;
- that.dataList = dataList;
- });
- }
- }
- };
- </script>
- <style>
- page {
- font-size: 28rpx;
- background-color: #f5f5f5;
- color: #333;
- }
- .container {
- padding-bottom: 228rpx;
- color: #333;
- }
- .dataList .search {
- width: 100%;
- padding-top: 13rpx;
- padding-bottom: 13rpx;
- padding-left: 15rpx;
- padding-right: 15rpx;
- box-sizing: border-box;
- align-items: center;
- background-color: #f5f5f5;
- position: fixed;
- display: flex;
- left: 0;
- z-index: 99999;
- }
- .searchinput {
- padding-left: 10rpx;
- }
- .tui-rolling-search {
- width: 100%;
- height: 66rpx;
- border-radius: 35rpx;
- padding: 0 40rpx 0 30rpx;
- box-sizing: border-box;
- background-color: #fff;
- display: flex;
- align-items: center;
- flex-wrap: nowrap;
- color: #999;
- }
- .tui-city-name {
- padding-left: 6rpx;
- padding-right: 0rpx;
- color: #333;
- font-size: 24rpx;
- line-height: 24rpx;
- }
- .tui-city-line {
- color: #d3d3d3;
- padding-left: 16rpx;
- padding-right: 20rpx;
- font-size: 24rpx;
- line-height: 24rpx;
- }
- .dataList .bg-color {
- background-color: #f5f5f5;
- }
- .dataList .search .location {
- color: #333;
- font-size: 28rpx;
- flex: 1;
- display: flex;
- margin-top: 22rpx;
- line-height: 40rpx;
- }
- .dataList .nav {
- width: 1000rpx;
- display: flex;
- color: #454545;
- font-size: 28rpx;
- background-color: #fff;
- }
- .dataList .nav .item {
- text-align: center;
- height: 100%;
- padding: 25rpx;
- }
- .dataList .nav .item.font-color {
- font-weight: bold;
- }
- .dataList .nav .item image {
- width: 88rpx;
- height: 88rpx;
- margin-left: 10rpx;
- }
- .dataList .list {
- padding: 20rpx;
- padding-top: 68rpx;
- margin-top: 6rpx;
- }
- .kmclass {
- padding-left: 5rpx;
- color: #333333;
- }
- .dataList .list .item {
- background-color: #fff;
- display: flex;
- margin-top: 20rpx;
- padding: 20rpx;
- border-radius: 18rpx;
- }
- .dataList .list .item .text {
- width: 100%;
- padding: 0 0 0 22rpx;
- font-size: 28rpx;
- color: #373333;
- }
- .dataList .list .item .text .money {
- font-size: 23rpx;
- margin-top: 50rpx;
- }
- .dataList .list .item .text .money .num {
- font-size: 32rpx;
- }
- .dataList .list .item .text .vip {
- font-size: 22rpx;
- color: #aaa;
- margin-top: 12rpx;
- }
- .dataList .list .item .text .vip .vip-money {
- font-size: 24rpx;
- color: #282828;
- font-weight: bold;
- }
- .dataList .list .item .text .vip .vip-money image {
- width: 46rpx;
- height: 21rpx;
- margin-left: 4rpx;
- }
- .dataList .list .item .buttonbox {
- margin-top: 40rpx;
- width: 200rpx;
- padding: 0 0 0 22rpx;
- font-size: 28rpx;
- color: #373333;
- }
- .nametitle {
- font-size: 32rpx;
- padding-top: 2rpx;
- word-break: break-all;
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .tztitle {
- font-size: 28rpx;
- margin-top: 10rpx;
- padding-top: 2rpx;
- word-break: break-all;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .distance {
- text-align: center;
- }
- .itembutton {
- margin-top: 10rpx;
- font-size: 24rpx;
- color: #ffffff;
- align-items: center;
- background-color: #52c276;
- }
- .noCommodity {
- background-color: #fff;
- }
- .indicators {
- color: #909090;
- margin-top: 10rpx;
- }
- .belong {
- color: #909090;
- margin-top: 20rpx;
- }
- .indctext {
- padding-left: 3rpx;
- padding-right: 15rpx;
- }
- </style>
|