storeDetail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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">
  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">
  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.toFixed(8);
  88. _this.currentPosition.lng = res.longitude.toFixed(8);
  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. uni.getLocation({
  172. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  173. success: function (res) {
  174. const latitude = data.lat;
  175. const longitude = data.lng;
  176. uni.openLocation({
  177. latitude: latitude,
  178. longitude: longitude,
  179. name: data.name,
  180. address: data.addrDetail,
  181. success: function () {
  182. console.log('success');
  183. }
  184. })
  185. }
  186. });
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .content{
  193. padding: 0 20rpx;
  194. width: 100%;
  195. .page-content{
  196. flex: 1;
  197. overflow-y: scroll;
  198. }
  199. .header {
  200. padding: 20rpx 0;
  201. display: flex;
  202. .store-info {
  203. display: flex;
  204. flex: 1;
  205. flex-direction: column;
  206. justify-content: space-between;
  207. padding: 0 20rpx;
  208. .name {
  209. font-size: 32rpx;
  210. color: #000;
  211. }
  212. .address{
  213. font-size: 26rpx;
  214. }
  215. .location {
  216. display: flex;
  217. align-items: center;
  218. font-size: 24rpx;
  219. .left {
  220. margin-right: 20rpx;
  221. }
  222. .icon {
  223. color: #999;
  224. margin-right: 5rpx;
  225. }
  226. }
  227. }
  228. }
  229. .store-mark{
  230. padding: 20rpx 0;
  231. width: 100%;
  232. .mark-item{
  233. padding: 10rpx 20rpx;
  234. border: 1px solid #eee;
  235. border-radius: 30rpx;
  236. margin-right: 20rpx;
  237. font-size: 24rpx;
  238. }
  239. }
  240. .store-server{
  241. padding: 20rpx 0;
  242. width: 100%;
  243. font-size: 24rpx;
  244. border-bottom: 1px solid #eee;
  245. text{
  246. margin-right: 30rpx;
  247. }
  248. }
  249. .store-rich{
  250. padding: 20rpx 0;
  251. width: 100%;
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. justify-content: center;
  256. }
  257. .store-line{
  258. border-bottom: 1px solid #eee;
  259. }
  260. .footer{
  261. width: 100%;
  262. display: flex;
  263. margin-bottom: 20rpx;
  264. justify-content: space-between;
  265. button{
  266. width: 45%;
  267. }
  268. }
  269. .pop-img{
  270. width: 100%;
  271. height: 100%;
  272. }
  273. }
  274. </style>