help.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="container">
  3. <view class="swiper-box">
  4. <scroll-view class="cate-list">
  5. <view class="nodata" v-if="list.length == 0"><image src="/static/img/img011.png"></image></view>
  6. <view v-for="(item, index) in list" class="content-box">
  7. <view class="flex">
  8. <view class="item">
  9. <view class="name" v-if="item.status == 0 || item.status == 2">救援者姓名:救援者{{ item.helper }}</view>
  10. <view class="name" v-if="item.status == 1 || item.status == 3">救援者姓名:{{ item.helper_nickname }}</view>
  11. <view class="phone" v-if="item.status == 1 || item.status == 3">手机号:{{ item.helper_mobile }}</view>
  12. <view class="time">救援时间:{{ item.createtime }}</view>
  13. </view>
  14. <view class="call-btn" v-if="item.status == 1" @click.stop="Tocall(item)"><image src="/static/img/img016.png"></image></view>
  15. </view>
  16. <view class="tpl">{{ item.status_text }}</view>
  17. </view>
  18. <uni-load-more :status="loadingType"></uni-load-more>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { mapState, mapMutations } from 'vuex';
  25. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  26. import empty from '@/components/empty';
  27. import { mySosList, accessSos, refuseSos } from '@/api/record.js';
  28. import { getTime } from '@/utils/rocessor.js';
  29. export default {
  30. components: {
  31. uniLoadMore,
  32. empty
  33. },
  34. data() {
  35. return {
  36. userInfo: '', //用户信息
  37. list: [],
  38. list1: [],
  39. limit: 100, //每次加载数据条数
  40. page: 1, //当前页数
  41. loadingType: 'more', //加载更多状态
  42. loading: 0
  43. };
  44. },
  45. onLoad() {},
  46. onShow() {
  47. this.loadData('refresh');
  48. },
  49. //下拉刷新
  50. onPullDownRefresh() {
  51. this.page = 1;
  52. this.loadData('refresh');
  53. },
  54. methods: {
  55. async loadData(type) {
  56. //这里是将订单挂载到tab列表下
  57. let obj = this;
  58. if (type != 'refresh') {
  59. //没有更多数据直接跳出方法
  60. if (obj.loadingType === 'nomore') {
  61. return;
  62. } else {
  63. // 设置当前为数据载入中
  64. obj.loadingType = 'loading';
  65. }
  66. } else {
  67. //当重新加载数据时更新状态为可继续添加数据
  68. obj.loadingType = 'more';
  69. }
  70. mySosList({
  71. status: -1,
  72. page: obj.page,
  73. limit: obj.limit
  74. })
  75. .then(({ data }) => {
  76. if (type === 'refresh') {
  77. obj.list1 = [];
  78. }
  79. let arr = data.map(e => {
  80. e.createtime = getTime(e.createtime);
  81. return e;
  82. });
  83. obj.list = obj.list.concat(arr);
  84. //判断是否还有下一页,有是more 没有是nomore
  85. if (obj.limit == obj.list.length) {
  86. obj.page++;
  87. obj.loadingType = 'more';
  88. } else {
  89. obj.loadingType = 'nomore';
  90. }
  91. // 判断是否为刷新数据
  92. if (type == 'refresh') {
  93. // 判断是否为点击搜索按钮跳转加载
  94. if (obj.loading == 1) {
  95. uni.hideLoading();
  96. } else {
  97. uni.stopPullDownRefresh();
  98. }
  99. }
  100. })
  101. .catch(e => {
  102. obj.loadingType = 'nomore';
  103. uni.hideLoading();
  104. });
  105. },
  106. //拨打电话
  107. Tocall(item) {
  108. uni.makePhoneCall({
  109. phoneNumber: item.helper_mobile
  110. });
  111. },
  112. navTo(url) {
  113. uni.navigateTo({
  114. url
  115. });
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss">
  121. page {
  122. background: #f8f6f6;
  123. height: 100%;
  124. .container {
  125. width: 100%;
  126. height: 100%;
  127. .swiper-box {
  128. height: 90%;
  129. padding-top: 25rpx;
  130. }
  131. }
  132. }
  133. .nodata {
  134. width: 430rpx;
  135. margin: 0rpx auto;
  136. padding-top: 80rpx;
  137. image {
  138. width: 430rpx;
  139. height: 337rpx;
  140. }
  141. .text {
  142. text-align: center;
  143. color: #999999;
  144. font-size: 26rpx;
  145. }
  146. }
  147. .swiper-box {
  148. height: calc(100% - 40px);
  149. }
  150. .list-scroll-content {
  151. height: 100%;
  152. }
  153. .navbar {
  154. overflow: hidden;
  155. white-space: nowrap;
  156. background: #fff;
  157. padding: 0rpx 25rpx;
  158. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  159. .nav-item {
  160. text-align: center;
  161. display: inline-block;
  162. height: 100%;
  163. font-size: 28rpx;
  164. color: $font-color-dark;
  165. position: relative;
  166. width: 25%;
  167. padding: 25rpx 0rpx;
  168. &.current {
  169. color: #ff6666;
  170. &:after {
  171. content: '';
  172. position: absolute;
  173. left: 50%;
  174. bottom: 0;
  175. transform: translateX(-50%);
  176. width: 35px;
  177. height: 0;
  178. border-bottom: 2px solid #ff6666;
  179. }
  180. }
  181. }
  182. }
  183. .call-btn {
  184. image {
  185. width: 100rpx;
  186. height: 100rpx;
  187. }
  188. }
  189. .content-box {
  190. width: 90%;
  191. margin: 0rpx auto;
  192. background-color: #ffffff;
  193. border-radius: 15rpx;
  194. padding: 47rpx 30rpx;
  195. font-size: 24rpx;
  196. line-height: 60rpx;
  197. color: #666666;
  198. margin-bottom: 25rpx;
  199. }
  200. .item {
  201. .name {
  202. font-size: 28rpx;
  203. color: #333333;
  204. font-weight: 500;
  205. }
  206. }
  207. .call-btn {
  208. image {
  209. width: 100rpx;
  210. height: 100rpx;
  211. }
  212. }
  213. .box-btn {
  214. width: 80%;
  215. margin: 0rpx auto;
  216. margin-top: 30rpx;
  217. text-align: center;
  218. .accept {
  219. background: #ff4f4f;
  220. color: #ffffff;
  221. padding: 0rpx 30rpx;
  222. width: 35%;
  223. }
  224. .refuse {
  225. background: #f3f3f3;
  226. width: 35%;
  227. padding: 0rpx 30rpx;
  228. }
  229. }
  230. .tpl {
  231. font-size: 28rpx;
  232. font-weight: bold;
  233. color: rgba(255, 79, 79, 1);
  234. }
  235. </style>