storeDetail.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <view class="content">
  3. <view class="page-content">
  4. <view class="header">
  5. <u-image width="160rpx" height="160rpx" :border-radius="10" :src="storeInfo?storeInfo.icon:''"></u-image>
  6. <view class="store-info">
  7. <view class="name">
  8. {{storeInfo ?storeInfo.name : ''}}
  9. </view>
  10. <view class="address">
  11. {{storeInfo?storeInfo.addrDetail:''}}
  12. </view>
  13. <view class="location">
  14. <view class="left">
  15. <uni-icons class="icon" size="16" type="paperplane"></uni-icons>
  16. <text>{{storeInfo?storeInfo.distance:''}}km</text>
  17. </view>
  18. <view class="right">
  19. <u-icon class="icon" size="32" name="clock"></u-icon>
  20. <text>{{storeInfo?storeInfo.beginTime:''}}-{{storeInfo?storeInfo.endTime:''}} 营业</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 网点标签 -->
  26. <view class="store-mark">
  27. <text v-for="(item,index) in labelList" :key="index" class="mark-item">
  28. {{item}}
  29. </text>
  30. </view>
  31. <view class="store-server">
  32. 服务项目:
  33. <text v-for="item in storeInfo.itemVOList" :key="item.id">{{item.itemName}}</text>
  34. </view>
  35. <!-- 路线指引 -->
  36. <view class="store-rich store-line" v-if="storeInfo&&storeInfo.guidance">
  37. <view class="line-title">
  38. * 路线指引 *
  39. </view>
  40. <view class="line-content">
  41. <u-parse :html="storeInfo&&storeInfo.guidance?storeInfo.guidance:''"></u-parse>
  42. </view>
  43. </view>
  44. <!-- 温馨提示 -->
  45. <view class="store-rich" v-if="storeInfo&&storeInfo.reminder">
  46. <view class="line-title">
  47. * 温馨提示 *
  48. </view>
  49. <view class="line-content">
  50. <u-parse :html="storeInfo&&storeInfo.reminder?storeInfo.reminder:''"></u-parse>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="footer">
  55. <button type="warn" plain @click="getWaitPhoto">排队情况</button>
  56. <button type="warn" @click="openLocation">立刻导航</button>
  57. </view>
  58. <u-popup v-model="showPop" mode="center" width="90%" height="60%" closeable>
  59. <image class="pop-img" :src="waitPhoto"></image>
  60. </u-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import {getStoreDetail, getWaitPhoto} from '@/api/store.js'
  65. export default {
  66. components: {
  67. },
  68. data() {
  69. return {
  70. // 用户拒绝授权位置信息时默认展示青海西宁位置地图
  71. currentPosition: {
  72. lat: '36.636193',
  73. lng: '101.760521'
  74. },
  75. showPop: false, // 是否显示排队弹窗
  76. storeInfo: null, // 网点详细信息
  77. labelList: [], // 网点标签
  78. waitPhoto: '' // 排队照片
  79. }
  80. },
  81. onLoad(option) {
  82. // 获取当前经纬度
  83. let _this = this
  84. uni.getLocation({
  85. type: 'wgs84', // 默认wgs84
  86. success: function(res) {
  87. _this.currentPosition.lat = res.latitude;
  88. _this.currentPosition.lng = res.longitude;
  89. // 查询门店信息
  90. if (option.id) {
  91. _this.getStoreDetail(option.id)
  92. }
  93. },
  94. fail: function(res) {
  95. console.log(res)
  96. // 查询门店信息
  97. if (option.id) {
  98. _this.getStoreDetail(option.id)
  99. }
  100. },
  101. });
  102. },
  103. methods: {
  104. // 获取网点详情信息
  105. getStoreDetail (id) {
  106. uni.showLoading({
  107. title: '加载中...'
  108. })
  109. let params = {
  110. id: id,
  111. lat: this.currentPosition.lat,
  112. lng: this.currentPosition.lng
  113. }
  114. getStoreDetail(params).then(res=>{
  115. uni.hideLoading()
  116. if (res.status == 200) {
  117. this.storeInfo = Object.assign({},res.data)
  118. if (this.storeInfo.addrDetail.indexOf("省") > 0 && this.storeInfo.addrDetail.indexOf("市") > 0 && this.storeInfo.addrDetail.indexOf("区") >
  119. 0) {
  120. this.storeInfo.addrDetail = this.storeInfo.addrDetail
  121. } else {
  122. if (this.storeInfo.addrDetail.indexOf("市") > 0 && this.storeInfo.addrDetail.indexOf("区") > 0) {
  123. this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrDetail
  124. } else if (this.storeInfo.addrDetail.indexOf("区") > 0) {
  125. this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrCityName + this.storeInfo.addrDetail
  126. } else {
  127. this.storeInfo.addrDetail = this.storeInfo.addrProvinceName + this.storeInfo.addrCityName + this.storeInfo.addrDistrictName + this.storeInfo.addrDetail
  128. }
  129. }
  130. this.getOptionName()
  131. this.storeInfo.distance = this.storeInfo.distanct && this.storeInfo.distanct.distance ? Math.round(this.storeInfo.distanct.distance / 1000) : ''
  132. } else {
  133. }
  134. })
  135. },
  136. // 匹配数据字典 获取相应的name
  137. getOptionName () {
  138. console.log(222)
  139. let storeLabelList = this.$store.state.vuex_storeLabel // 网点标签数据字典列表
  140. let arr = []
  141. this.storeInfo.labelList.map(item =>{
  142. let p = storeLabelList.find((i) => {
  143. return i.code == item
  144. })
  145. if (p) {
  146. arr.push(p.dispName)
  147. }
  148. })
  149. this.labelList = arr
  150. },
  151. // 获取排队情况
  152. getWaitPhoto () {
  153. uni.showLoading({
  154. title: '加载中...',
  155. mask: true
  156. })
  157. let deviceNo = this.storeInfo.deviceVOList && this.storeInfo.deviceVOList.length? this.storeInfo.deviceVOList[0].deviceNo :''
  158. getWaitPhoto({deviceNo:deviceNo}).then(res=>{
  159. uni.hideLoading()
  160. if(res.status==200) {
  161. this.waitPhoto = res.data
  162. this.showPop=true
  163. } else {
  164. this.toashMsg(res.message)
  165. }
  166. })
  167. },
  168. // 打开导航位置信息界面
  169. openLocation () {
  170. let data = this.storeInfo
  171. let _this = this
  172. uni.getLocation({
  173. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  174. success: function (res) {
  175. const latitude = data.lat;
  176. const longitude = data.lng;
  177. uni.openLocation({
  178. latitude: latitude,
  179. longitude: longitude,
  180. name: data.name,
  181. address: data.addrDetail,
  182. success: function () {
  183. console.log('success');
  184. }
  185. })
  186. },
  187. fail:function(){
  188. _this.toashMsg('获取位置信息失败,请先授权开启定位功能!')
  189. }
  190. });
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. page{
  197. height: 100%;
  198. }
  199. .content{
  200. padding: 0 20rpx;
  201. width: 100%;
  202. height: 100%;
  203. display: flex;
  204. flex-direction: column;
  205. .page-content{
  206. flex: 1;
  207. overflow-y: scroll;
  208. }
  209. .header {
  210. padding: 20rpx 0;
  211. display: flex;
  212. .store-info {
  213. display: flex;
  214. flex: 1;
  215. flex-direction: column;
  216. justify-content: space-between;
  217. padding: 0 20rpx;
  218. .name {
  219. font-size: 32rpx;
  220. color: #000;
  221. }
  222. .address{
  223. font-size: 26rpx;
  224. }
  225. .location {
  226. display: flex;
  227. align-items: center;
  228. font-size: 24rpx;
  229. .left {
  230. margin-right: 20rpx;
  231. }
  232. .icon {
  233. color: #999;
  234. margin-right: 5rpx;
  235. }
  236. }
  237. }
  238. }
  239. .store-mark{
  240. padding: 20rpx 0;
  241. width: 100%;
  242. .mark-item{
  243. padding: 10rpx 20rpx;
  244. border: 1px solid #eee;
  245. border-radius: 30rpx;
  246. margin-right: 20rpx;
  247. font-size: 24rpx;
  248. }
  249. }
  250. .store-server{
  251. padding: 20rpx 0;
  252. width: 100%;
  253. font-size: 24rpx;
  254. border-bottom: 1px solid #eee;
  255. text{
  256. margin-right: 30rpx;
  257. }
  258. }
  259. .store-rich{
  260. padding: 20rpx 0;
  261. width: 100%;
  262. display: flex;
  263. flex-direction: column;
  264. align-items: center;
  265. justify-content: center;
  266. }
  267. .store-line{
  268. border-bottom: 1px solid #eee;
  269. }
  270. .footer{
  271. width: 100%;
  272. display: flex;
  273. margin-bottom: 20rpx;
  274. justify-content: space-between;
  275. button{
  276. width: 45%;
  277. }
  278. }
  279. .pop-img{
  280. width: 100%;
  281. height: 100%;
  282. }
  283. }
  284. </style>