123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <view class="content">
- <view class="page-content">
- <view class="header">
- <u-image width="160rpx" height="160rpx" :border-radius="10" :src="storeInfo?storeInfo.icon:''"></u-image>
- <view class="store-info">
- <view class="name">
- {{storeInfo ?storeInfo.name : ''}}
- </view>
- <view class="address">
- {{storeInfo?storeInfo.addrDetail:''}}
- </view>
- <view class="location">
- <view class="left">
- <uni-icons class="icon" size="16" type="paperplane"></uni-icons>
- <text>{{storeInfo?storeInfo.distance:''}}km</text>
- </view>
- <view class="right">
- <u-icon class="icon" size="32" name="clock"></u-icon>
- <text>{{storeInfo?storeInfo.beginTime:''}}-{{storeInfo?storeInfo.endTime:''}} 营业</text>
- </view>
- </view>
- </view>
- </view>
-
- <view class="store-mark">
- <text v-for="(item,index) in labelList" :key="index" class="mark-item">
- {{item}}
- </text>
- </view>
- <view class="store-server">
- 服务项目:
- <text v-for="item in storeInfo.itemVOList" :key="item.id">{{item.itemName}}</text>
- </view>
-
- <view class="store-rich store-line" v-if="storeInfo&&storeInfo.guidance">
- <view class="line-title">
- * 路线指引 *
- </view>
- <view class="line-content">
- <u-parse :html="storeInfo&&storeInfo.guidance?storeInfo.guidance:''"></u-parse>
- </view>
- </view>
-
- <view class="store-rich" v-if="storeInfo&&storeInfo.reminder">
- <view class="line-title">
- * 温馨提示 *
- </view>
- <view class="line-content">
- <u-parse :html="storeInfo&&storeInfo.reminder?storeInfo.reminder:''"></u-parse>
- </view>
- </view>
- </view>
- <view class="footer">
- <button type="warn" :loading="loading" plain @click="getWaitPhoto">排队情况</button>
- <button type="warn" @click="openLocation">立刻导航</button>
- </view>
- <u-popup v-model="showPop" mode="center" @close="showPop=false" width="90%" height="60%" closeable>
- <image mode="aspectFit" class="pop-img" :src="waitPhoto"></image>
- </u-popup>
- </view>
- </template>
- <script>
- import {getStoreDetail, getWaitPhoto} from '@/api/store.js'
- export default {
- components: {
- },
- data() {
- return {
-
- currentPosition: {
- lat: '36.636193',
- lng: '101.760521'
- },
- showPop: false,
- storeInfo: null,
- labelList: [],
- waitPhoto: '',
- loading: false
- }
- },
- onLoad(option) {
-
- let _this = this
- this.pageInit()
- uni.getLocation({
- type: 'wgs84',
- success: function(res) {
- _this.currentPosition.lat = res.latitude;
- _this.currentPosition.lng = res.longitude;
-
- if (option.id) {
- _this.getStoreDetail(option.id)
- }
- },
- fail: function(res) {
- console.log(res)
-
- if (option.id) {
- _this.getStoreDetail(option.id)
- }
- },
- });
-
- },
- methods: {
- pageInit () {
- this.storeInfo = null
- this.labelList = []
- this.loading = false
- },
-
- getStoreDetail (id) {
- uni.showLoading({
- title: '加载中...'
- })
- let params = {
- id: id,
- lat: this.currentPosition.lat,
- lng: this.currentPosition.lng
- }
- getStoreDetail(params).then(res=>{
- uni.hideLoading()
- if (res.status == 200) {
- this.storeInfo = Object.assign({},res.data)
- if (this.storeInfo.addrDetail.indexOf("省") > 0 && this.storeInfo.addrDetail.indexOf("市") > 0 && this.storeInfo.addrDetail.indexOf("区") >
- 0) {
- this.storeInfo.addrDetail = this.storeInfo.addrDetail
- } else {
- if (this.storeInfo.addrDetail.indexOf("市") > 0 && this.storeInfo.addrDetail.indexOf("区") > 0) {
- this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrDetail
- } else if (this.storeInfo.addrDetail.indexOf("区") > 0) {
- this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrCityName + this.storeInfo.addrDetail
- } else {
- this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrCityName + this.storeInfo.addrDistrictName + this.storeInfo.addrDetail
- }
- }
- this.getOptionName()
- this.storeInfo.distance = this.storeInfo.distanct && this.storeInfo.distanct.distance ? Math.round(this.storeInfo.distanct.distance / 1000) : ''
- } else {
- }
- })
- },
-
- getOptionName () {
- console.log(222)
- let storeLabelList = this.$store.state.vuex_storeLabel
- let arr = []
- this.storeInfo.labelList.map(item =>{
- let p = storeLabelList.find((i) => {
- return i.code == item
- })
- if (p) {
- arr.push(p.dispName)
- }
- })
- this.labelList = arr
- },
-
- getWaitPhoto () {
- this.loading = true
- let deviceNo = this.storeInfo.deviceVOList && this.storeInfo.deviceVOList.length? this.storeInfo.deviceVOList[0].deviceNo :''
- getWaitPhoto({deviceNo:deviceNo}).then(res=>{
- this.loading = false
- if(res.status==200) {
- this.waitPhoto = res.data ? res.data : '/static/img/noPic.jpg'
- this.showPop=true
- }
- })
- },
-
- openLocation () {
- let data = this.storeInfo
- let _this = this
- uni.getLocation({
- type: 'gcj02',
- success: function (res) {
- const latitude = data.lat;
- const longitude = data.lng;
- uni.openLocation({
- latitude: latitude,
- longitude: longitude,
- name: data.name,
- address: data.addrDetail,
- success: function () {
- console.log('success');
- }
- })
- },
- fail:function(){
- _this.toashMsg('获取位置信息失败,请先授权开启定位功能!')
- }
- });
- }
-
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- }
- .content{
- padding: 0 20rpx;
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- .page-content{
- flex: 1;
- overflow-y: scroll;
- }
- .header {
- padding: 20rpx 0;
- display: flex;
- .store-info {
- display: flex;
- flex: 1;
- flex-direction: column;
- justify-content: space-between;
- padding: 0 20rpx;
- .name {
- font-size: 32rpx;
- color: #000;
- }
- .address{
- font-size: 26rpx;
- }
- .location {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- .left {
- margin-right: 20rpx;
- }
- .icon {
- color: #999;
- margin-right: 5rpx;
- }
- }
- }
- }
- .store-mark{
- padding: 20rpx 0;
- width: 100%;
- .mark-item{
- padding: 10rpx 20rpx;
- border: 1px solid #eee;
- border-radius: 30rpx;
- margin-right: 20rpx;
- font-size: 24rpx;
- }
- }
- .store-server{
- padding: 20rpx 0;
- width: 100%;
- font-size: 24rpx;
- border-bottom: 1px solid #eee;
- text{
- margin-right: 30rpx;
- }
- }
- .store-rich{
- padding: 20rpx 0;
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .store-line{
- border-bottom: 1px solid #eee;
- }
- .footer{
- width: 100%;
- display: flex;
- margin-bottom: 20rpx;
- justify-content: space-between;
- button{
- width: 45%;
- }
- }
- .pop-img{
- width: 100%;
- height: 100%;
- }
- }
- </style>
|