index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="四情基地"></uni-nav-bar>
  7. <u-icon name="plus-circle" class="tianjia" @click="clickRight"></u-icon>
  8. </view>
  9. <view class="bases_search">
  10. <view class="bases_search_text">
  11. <u-icon name="search" class="search" @click="search"></u-icon>
  12. <input type="text" v-model="data.search" placeholder="请输入基地名称" @input="searchinput" />
  13. </view>
  14. </view>
  15. <view class="bases">
  16. <view class="bases_list" v-for="(items,index) in baselist" :key="index" @click="details(items.id)">
  17. <view class="bases_list_bgi">
  18. <image :src="items.base_img" mode=""></image>
  19. <view class="bgcolor">
  20. </view>
  21. </view>
  22. <view class="bases_list_text">
  23. <p><span style="margin-right: 30rpx;">{{items.base_name}}</span><span>{{items.base_area}}㎡</span></p>
  24. <p style="font-size: 24rpx;">联系人:{{items.base_charge}}</p>
  25. <p style="font-size: 24rpx;">联系电话:{{items.base_phone}}</p>
  26. <p style="font-size: 24rpx;">地址:{{items.base_name}}</p>
  27. </view>
  28. <u-icon name="more-dot-fill" class="bases_list_xiangqing" @click.native.stop="XQclick(items)"></u-icon>
  29. <view class="photoshow">
  30. <image src="../../static/image/fourMoodBase/1.png" mode=""></image>
  31. <image src="../../static/image/fourMoodBase/3.png" mode=""></image>
  32. <image src="../../static/image/fourMoodBase/5.png" mode=""></image>
  33. <view class="photoshow_num">
  34. {{items.num}}+
  35. </view>
  36. </view>
  37. </view>
  38. <u-action-sheet :list="actionSheetList" v-model="post_show" @click="message"></u-action-sheet>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. Debounce,
  46. Throttle
  47. } from "../../util/anitthro.js"
  48. export default {
  49. data() {
  50. return {
  51. data: {
  52. ret: 'list',
  53. search: '',
  54. page_size: 10,
  55. page: 1
  56. },
  57. baselist: [],
  58. actionSheetList: [{
  59. text: "编辑基地"
  60. }, {
  61. text: "删除基地"
  62. }],
  63. post_show: false,
  64. delid: "",
  65. facilitynum: ""
  66. }
  67. },
  68. methods: {
  69. async getFourbase() { //基地列表
  70. const res = await this.$myRequest({
  71. url: '/api/api_gateway?method=base.bases.base_list',
  72. data: this.data
  73. })
  74. this.baselist = this.baselist.concat(res.data)
  75. console.log(this.baselist)
  76. for(var i=0;i<this.baselist.length;i++){
  77. var arr = this.baselist[i].base_equip.split("#")
  78. this.baselist[i].num = arr.length
  79. }
  80. },
  81. async delbase() { //基地列表
  82. const res = await this.$myRequest({
  83. url: '/api/api_gateway?method=base.bases.base_list',
  84. data: {
  85. ret: "del",
  86. base_id: this.delid.id
  87. }
  88. })
  89. },
  90. clickLeft() { //返回主页
  91. uni.switchTab({
  92. url: "../index/index"
  93. })
  94. },
  95. clickRight() { //添加基地
  96. uni.navigateTo({
  97. url: "./addbase"
  98. })
  99. },
  100. searchinput() { //搜索
  101. this.data.page = 1
  102. this.baselist = []
  103. Debounce(() => {
  104. this.getFourbase()
  105. }, 1000)()
  106. },
  107. search() { //搜索按钮
  108. this.data.page = 1
  109. this.baselist = []
  110. this.getFourbase()
  111. this.$forceUpdate()
  112. },
  113. details(id) { //详情页
  114. uni.navigateTo({
  115. url: "./basefacility?id=" + id
  116. })
  117. },
  118. XQclick(item) { //编辑
  119. this.post_show = !this.post_show
  120. this.delid = item
  121. },
  122. message(index) { //编辑或者删除
  123. console.log(index)
  124. if (index == 1) {
  125. console.log(this.delid.id)
  126. uni.showModal({
  127. title: '提示',
  128. content: '确定要删除该基地吗?',
  129. success: (res) => {
  130. if (res.confirm) {
  131. this.delbase()
  132. } else if (res.cancel) {
  133. console.log('用户点击取消');
  134. }
  135. }
  136. });
  137. } else {
  138. uni.navigateTo({
  139. url: "./modification?id=" + JSON.stringify(this.delid)
  140. })
  141. }
  142. this.$forceUpdate()
  143. }
  144. },
  145. onLoad() {
  146. this.getFourbase()
  147. },
  148. onReachBottom() { //滑动到底部加载
  149. this.data.page++
  150. this.getFourbase()
  151. },
  152. onShow() {
  153. this.$forceUpdate()
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. .tianjia {
  159. position: absolute;
  160. top: 24rpx;
  161. right: 24rpx;
  162. font-size: 38rpx;
  163. }
  164. .bases_search {
  165. width: 100%;
  166. position: fixed;
  167. top: 88px;
  168. z-index: 100;
  169. background-color: #FFFFFF;
  170. .bases_search_text {
  171. width: 90%;
  172. margin: 0 auto;
  173. background-color: #F8F8F8;
  174. height: 60rpx;
  175. border-radius: 30rpx;
  176. display: flex;
  177. line-height: 60rpx;
  178. .search {
  179. padding: 0 20rpx;
  180. font-size: 34rpx;
  181. }
  182. input {
  183. width: 80%;
  184. margin-top: 10rpx;
  185. font-size: 28rpx;
  186. }
  187. }
  188. }
  189. .bases {
  190. width: 100%;
  191. position: relative;
  192. top: 170rpx;
  193. .bases_list {
  194. width: 90%;
  195. margin: 0 auto 20rpx;
  196. height: 276rpx;
  197. position: relative;
  198. .bases_list_bgi {
  199. .bgcolor {
  200. width: 100%;
  201. height: 276rpx;
  202. background-color: rgba(0, 0, 0, 0.3);
  203. border-radius: 25rpx;
  204. }
  205. image {
  206. position: absolute;
  207. top: 0;
  208. left: 0;
  209. width: 100%;
  210. height: 276rpx;
  211. border-radius: 25rpx;
  212. z-index: -1;
  213. }
  214. }
  215. .bases_list_text {
  216. position: absolute;
  217. top: 0;
  218. left: 0;
  219. z-index: 10;
  220. padding: 40rpx;
  221. color: #FFFFFF;
  222. p {
  223. margin-bottom: 10rpx;
  224. }
  225. }
  226. .bases_list_xiangqing {
  227. position: absolute;
  228. top: 20rpx;
  229. right: 20rpx;
  230. transform: rotate(90deg);
  231. font-size: 26rpx;
  232. color: #FFFFFF;
  233. }
  234. .photoshow {
  235. width: 160rpx;
  236. height: 34rpx;
  237. display: flex;
  238. position: absolute;
  239. bottom: 26rpx;
  240. right: 36rpx;
  241. background-color: #a7a8a0;
  242. border-radius: 18rpx;
  243. padding: 4rpx;
  244. image {
  245. width: 32rpx;
  246. height: 32rpx;
  247. margin-right: 4rpx;
  248. }
  249. .photoshow_num {
  250. width: 50rpx;
  251. height: 30rpx;
  252. border: 1px solid #FFFFFF;
  253. border-radius: 17rpx;
  254. text-align: center;
  255. line-height: 28rpx;
  256. font-size: 24rpx;
  257. color: #FFFFFF;
  258. }
  259. }
  260. }
  261. }
  262. </style>