store.vue 5.6 KB

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