index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="content">
  3. <view class="supplyList">
  4. <view
  5. class="supplyCard"
  6. v-for="(field, i) in fieldList"
  7. :key="i"
  8. @tap="toDetail(field.id)"
  9. >
  10. <view class="image_content">
  11. <image :src="field.pic_path ? shareUrl + field.pic_path : '/static/nodata.svg'" mode="aspectFill" />
  12. </view>
  13. <view class="info">
  14. <view class="title">
  15. {{ field.name }}
  16. </view>
  17. <view class="time">
  18. <view style="margin-bottom: 10rpx;">
  19. <view>开放时间</view>
  20. <view style="margin-top: 6rpx;">{{field.open_days}}:{{field.open_hours}}</view>
  21. </view>
  22. <view class="field-btn-box">
  23. <button :class="{
  24. close: field.order_status == '未开放',
  25. free: field.order_status == '空闲',
  26. full: field.order_status == '今日已满',
  27. can: field.order_status == '今日可约',}">
  28. {{field.order_status}}</button>
  29. <!-- <button style="background: #00a8ea;" :disabled="field.order_status == '今日已满' || field.order_status == '未开放'">前往预约</button> -->
  30. <button style="background: #00a8ea;">前往预约</button>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import md5 from "@/common/md5.js";
  40. export default {
  41. data() {
  42. return {
  43. fieldList: [],
  44. shareUrl:getApp().globalData.shareUrl,
  45. };
  46. },
  47. onLoad() {
  48. this.getMyList();
  49. },
  50. methods: {
  51. toDetail(index) {
  52. uni.navigateTo({
  53. url: "/pages/makeField/viewDetail?id=" + index,
  54. });
  55. },
  56. getMyList() {
  57. let md5Sign = md5(
  58. "method=" +
  59. "area" +
  60. "&timestamp=" +
  61. getApp().globalData.globalTimestamp +
  62. "&secret=" +
  63. getApp().globalData.secret
  64. );
  65. let url =
  66. getApp().globalData.shareUrl +
  67. "api/api.php" +
  68. "?method=area&source=area&action=list&timestamp=" +
  69. getApp().globalData.globalTimestamp +
  70. "&sign=" +
  71. md5Sign;
  72. uni.request({
  73. url: url,
  74. method: "POST",
  75. header: {
  76. "content-type": "application/x-www-form-urlencoded",
  77. },
  78. data: {
  79. // method:'area',
  80. page:'',
  81. page_size :''
  82. },
  83. success: (res) => {
  84. if (res.data.code === 200) {
  85. let list = res.data.data.list;
  86. // list.forEach((item,index)=>{
  87. // item.statusName = '空闲'
  88. // })
  89. // list[1].statusName = '今日已满';
  90. // list[2].statusName = '今日可约';
  91. this.fieldList = list;
  92. }
  93. },
  94. fail: () => {
  95. console.log("连接失败");
  96. },
  97. });
  98. },
  99. },
  100. };
  101. </script>
  102. <style lang="scss" scope>
  103. .active {
  104. color: $uni-color-primary;
  105. }
  106. .content {
  107. font-size: 32rpx;
  108. margin: 0 5%;
  109. .supplyList {
  110. .supplyCard {
  111. display: flex;
  112. width: 92%;
  113. margin: 3% 0;
  114. padding: 2% 4%;
  115. height: 5%;
  116. border-radius: 30rpx;
  117. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
  118. .image_content {
  119. margin-right: 5%;
  120. display: flex;
  121. align-items: center;
  122. image {
  123. width: 300rpx;
  124. height: 265rpx;
  125. object-fit: cover;
  126. border-radius: 6rpx;
  127. background-color: #e4e4e4;
  128. }
  129. }
  130. .info {
  131. width: 100%;
  132. display: flex;
  133. flex-flow: column;
  134. justify-content: space-between;
  135. // justify-content: space-around;
  136. .title {
  137. width: 100%;
  138. text-overflow: -o-ellipsis-lastline;
  139. overflow: hidden;
  140. text-overflow: ellipsis;
  141. display: -webkit-box;
  142. -webkit-line-clamp: 2;
  143. line-clamp: 2;
  144. -webkit-box-orient: vertical;
  145. font-size: 32rpx;
  146. }
  147. .time {
  148. font-weight: 100;
  149. font-size: 24rpx;
  150. color: #7f7f7f;
  151. height: 60%;
  152. display: flex;
  153. flex-direction: column;
  154. justify-content: space-around;
  155. // margin-top: 20rpx;
  156. .field-btn-box {
  157. display: flex;
  158. justify-content: space-between;
  159. align-items: center;
  160. button{
  161. background: #95f204;
  162. color: #fff;
  163. font-size: 18rpx;
  164. margin: 0;
  165. };
  166. .close {
  167. background: #7f7f7f;
  168. };
  169. .free {
  170. background: #95f204;
  171. };
  172. .full {
  173. background: #f59a23;
  174. }
  175. .can {
  176. background: #5498ff;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. }
  183. }
  184. </style>