network.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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" :key="item.id">
  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" :key="boxItem.id">
  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 { stationDevice, getWaitToCleanDetailHeader } from '@/api/cleared.js'
  58. export default {
  59. data() {
  60. return {
  61. stationNo: '', // 网点编号
  62. lat: '',
  63. lng: '',
  64. mapCtx: null, // 地图对象
  65. markers: [], // 标注点
  66. stationData: null, // 网点信息
  67. deviceData: [], // 设备信息
  68. };
  69. },
  70. onLoad(options) {
  71. this.stationNo = options.stationNo
  72. this.getStation() // 网点信息
  73. this.getDevice() // 设备信息
  74. // 开启分享
  75. uni.showShareMenu({
  76. withShareTicket: true,
  77. menus: ['shareAppMessage', 'shareTimeline']
  78. })
  79. },
  80. methods: {
  81. // 网点信息
  82. getStation(){
  83. getWaitToCleanDetailHeader({ stationNo: this.stationNo }).then(res => {
  84. if(res.status == 200){
  85. this.stationData = res.data
  86. this.markers = []
  87. this.markers.push({
  88. latitude: res.data.lat,
  89. longitude: res.data.lng,
  90. width: 30,
  91. height: 30,
  92. iconPath: "/static/store.png"
  93. })
  94. this.lng = res.data.lng
  95. this.lat = res.data.lat
  96. }else{
  97. this.stationData = null
  98. this.markers = []
  99. this.lng = ''
  100. this.lat = ''
  101. }
  102. })
  103. },
  104. // 设备信息
  105. getDevice(){
  106. stationDevice({ stationNo: this.stationNo }).then(res => {
  107. if(res.status == 200){
  108. this.deviceData = res.data
  109. }else{
  110. this.deviceData = []
  111. }
  112. })
  113. },
  114. // 根据垃圾类型获取兑换规则
  115. getRule(type){
  116. let row = null
  117. if(this.stationData.goldExRuleItemList){
  118. row = this.stationData.goldExRuleItemList.find(item => item.rubbishType == type)
  119. }
  120. return { rubbishWeight: row.rubbishWeight || 0, goleNum: row.goleNum || 0 }
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .content{
  127. width: 100%;
  128. padding: 0;
  129. .details{
  130. margin: 20upx;
  131. .details-address{
  132. display: flex;
  133. align-items: center;
  134. padding: 20upx;
  135. background: #FFFFFF;
  136. border-radius: 15upx;
  137. box-shadow: 0upx 3upx 6upx #eee;
  138. margin-bottom: 20upx;
  139. .store-pic{
  140. width: 120rpx;
  141. height:120rpx;
  142. margin-right: 20rpx;
  143. }
  144. .store-info{
  145. >view{
  146. font-size: 24upx;
  147. padding: 5upx 0;
  148. color: #666;
  149. &:first-child{
  150. font-weight: bold;
  151. font-size: 30upx;
  152. color: #333;
  153. }
  154. }
  155. }
  156. }
  157. .details-dev{
  158. .details-dev-box{
  159. padding: 20upx 20upx 5upx;
  160. background: #FFFFFF;
  161. border-radius: 15upx;
  162. box-shadow: 0upx 3upx 6upx #eee;
  163. margin-bottom: 20upx;
  164. .details-dev-title{
  165. border-bottom: 1px solid #F8F8F8;
  166. padding: 10upx 0 20upx;
  167. text{
  168. color: #666;
  169. }
  170. }
  171. .details-dev-cons{
  172. padding: 10upx 0;
  173. display: flex;
  174. flex-wrap: wrap;
  175. .dev-item{
  176. width: 50%;
  177. display: flex;
  178. align-items: center;
  179. > view{
  180. padding: 25upx 10upx 15upx 0;
  181. &:last-child{
  182. view{
  183. display: flex;
  184. align-items: center;
  185. .u-tag{
  186. margin-left: 10upx;
  187. }
  188. }
  189. }
  190. }
  191. .item-pic-con{
  192. position: relative;
  193. padding-left: 30rpx;
  194. .full-sign{
  195. font-size: 24rpx;
  196. padding: 4rpx 10rpx 14rpx;
  197. color: #fff;
  198. background: url('/static/full-bg.png') no-repeat;
  199. background-size: 100% 100%;
  200. transform: scale(0.8);
  201. position: absolute;
  202. left: 0;
  203. top: 0;
  204. width: 68rpx;
  205. height: 55rpx;
  206. z-index: 9;
  207. }
  208. }
  209. .dev-main{
  210. .rule-con{
  211. color: #666;
  212. font-size: 24upx;
  213. .goleNum{
  214. color: #eb0000;
  215. font-size: 26rpx;
  216. font-weight: bold;
  217. margin-left: 4rpx;
  218. }
  219. .ld-pic{
  220. width: 30rpx;
  221. height: 30rpx;
  222. margin-left: 6rpx;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>