store.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="content">
  3. <map
  4. id="map"
  5. :latitude="lat"
  6. :longitude="lng"
  7. scale="18"
  8. show-compass
  9. show-location
  10. :markers="markers"
  11. style="width: 100%; height:500rpx;">
  12. </map>
  13. <!-- 网点信息及设备 -->
  14. <view class="details" v-if="stationData">
  15. <view class="details-address">
  16. <image src="/static/md-big-pic.png" class="store-pic"></image>
  17. <view class="store-info">
  18. <view>{{ stationData.name }}</view>
  19. <view>{{ stationData.provinceName||'' }}{{ stationData.cityName||'' }}{{ stationData.districtName||'' }}{{ stationData.address||'' }}</view>
  20. <view>
  21. 营业时间:
  22. <text v-for="(tItem, tInd) in stationData.deliveryTimeRuleItemList" :key="tInd">
  23. {{ tItem.openTime }} - {{ tItem.closeTime }}{{ tInd == stationData.deliveryTimeRuleItemList.length - 1 ? '' : ',' }}
  24. </text>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 设备列表 -->
  29. <view class="details-dev">
  30. <view class="details-dev-box" v-for="item in deviceData">
  31. <view class="details-dev-title">设备编号:<text>{{ item.srcDeviceCode }}</text></view>
  32. <view class="details-dev-cons">
  33. <view class="dev-item" v-for="boxItem in item.deviceTypeBoxList">
  34. <view class="item-pic-con">
  35. <text v-if="boxItem.flag==1" class="full-sign">已满</text>
  36. <u-image mode="aspectFit" height="80" width="80" :src="`/static/${boxItem.rubbishType}.png`" class="type-sign"></u-image>
  37. </view>
  38. <view class="dev-main">
  39. <view>
  40. {{ boxItem.rubbishTypeDictValue }}
  41. </view>
  42. <view class="rule-con">
  43. {{ getRule(boxItem.rubbishType).rubbishWeight }}g/
  44. <text class="goleNum">{{ getRule(boxItem.rubbishType).goleNum }}</text>
  45. <image src="/static/ledou.png" class="ld-pic"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <u-empty v-if="deviceData.length==0" icon-size="60" text="暂无设备" mode="list" margin-top="120"></u-empty>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { stationDetail, stationDevice } from '@/api/station.js'
  58. export default {
  59. data() {
  60. return {
  61. stationId: '', // 网点id
  62. stationNo: '', // 网点编号
  63. lat: '',
  64. lng: '',
  65. mapCtx: null, // 地图对象
  66. markers: [], // 标注点
  67. stationData: null, // 网点信息
  68. deviceData: [], // 设备信息
  69. };
  70. },
  71. onLoad(options) {
  72. this.stationId = options.id
  73. this.stationNo = options.stationNo
  74. this.getStation() // 网点信息
  75. this.getDevice() // 设备信息
  76. // 开启分享
  77. uni.showShareMenu({
  78. withShareTicket: true,
  79. menus: ['shareAppMessage', 'shareTimeline']
  80. })
  81. },
  82. methods: {
  83. // 网点信息
  84. getStation(){
  85. stationDetail({ id: this.stationId }).then(res => {
  86. if(res.status == 200){
  87. this.stationData = res.data
  88. this.markers = []
  89. this.markers.push({
  90. latitude: res.data.lat,
  91. longitude: res.data.lng,
  92. width: 30,
  93. height: 30,
  94. iconPath: "/static/store.png"
  95. })
  96. this.lng = res.data.lng
  97. this.lat = res.data.lat
  98. }else{
  99. this.stationData = null
  100. this.markers = []
  101. this.lng = ''
  102. this.lat = ''
  103. }
  104. })
  105. },
  106. // 设备信息
  107. getDevice(){
  108. stationDevice({ stationNo: this.stationNo }).then(res => {
  109. if(res.status == 200){
  110. this.deviceData = res.data
  111. }else{
  112. this.deviceData = []
  113. }
  114. })
  115. },
  116. // 根据垃圾类型获取兑换规则
  117. getRule(type){
  118. let row = null
  119. if(this.stationData.goldExRuleItemList){
  120. row = this.stationData.goldExRuleItemList.find(item => item.rubbishType == type)
  121. }
  122. return { rubbishWeight: row.rubbishWeight || 0, goleNum: row.goleNum || 0 }
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. .content{
  129. width: 100%;
  130. padding: 0;
  131. .details{
  132. margin: 20upx;
  133. .details-address{
  134. display: flex;
  135. align-items: center;
  136. padding: 20upx;
  137. background: #FFFFFF;
  138. border-radius: 15upx;
  139. box-shadow: 0upx 3upx 6upx #eee;
  140. margin-bottom: 20upx;
  141. .store-pic{
  142. width: 120rpx;
  143. height:120rpx;
  144. margin-right: 20rpx;
  145. }
  146. .store-info{
  147. >view{
  148. font-size: 24upx;
  149. padding: 5upx 0;
  150. color: #666;
  151. &:first-child{
  152. font-weight: bold;
  153. font-size: 30upx;
  154. color: #333;
  155. }
  156. }
  157. }
  158. }
  159. .details-dev{
  160. .details-dev-box{
  161. padding: 20upx 20upx 5upx;
  162. background: #FFFFFF;
  163. border-radius: 15upx;
  164. box-shadow: 0upx 3upx 6upx #eee;
  165. margin-bottom: 20upx;
  166. .details-dev-title{
  167. border-bottom: 1px solid #F8F8F8;
  168. padding: 10upx 0 20upx;
  169. text{
  170. color: #666;
  171. }
  172. }
  173. .details-dev-cons{
  174. padding: 10upx 0;
  175. display: flex;
  176. flex-wrap: wrap;
  177. .dev-item{
  178. width: 50%;
  179. display: flex;
  180. align-items: center;
  181. > view{
  182. padding: 25upx 10upx 15upx 0;
  183. &:last-child{
  184. view{
  185. display: flex;
  186. align-items: center;
  187. .u-tag{
  188. margin-left: 10upx;
  189. }
  190. }
  191. }
  192. }
  193. .item-pic-con{
  194. position: relative;
  195. padding-left: 30rpx;
  196. .full-sign{
  197. font-size: 24rpx;
  198. padding: 4rpx 10rpx 14rpx;
  199. color: #fff;
  200. background: url('/static/full-bg.png') no-repeat;
  201. background-size: 100% 100%;
  202. transform: scale(0.8);
  203. position: absolute;
  204. left: 0;
  205. top: 0;
  206. width: 68rpx;
  207. height: 55rpx;
  208. z-index: 9;
  209. }
  210. }
  211. .dev-main{
  212. .rule-con{
  213. color: #666;
  214. font-size: 24upx;
  215. .goleNum{
  216. color: #eb0000;
  217. font-size: 26rpx;
  218. font-weight: bold;
  219. margin-left: 4rpx;
  220. }
  221. .ld-pic{
  222. width: 30rpx;
  223. height: 30rpx;
  224. margin-left: 6rpx;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </style>