helprecords.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="container">
  3. <uni-swipe-action>
  4. <uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, item.sos_id)"
  5. v-for="(item,index) in list">
  6. <view class="list">
  7. <view class="list-left">
  8. <!-- <view class="list-top">
  9. 救援者姓名:{{item.to_name}}
  10. </view> -->
  11. <view class="list-phone">
  12. 救援者联系方式:{{item.rescue_phone}}
  13. </view>
  14. <view class="list-time">
  15. 发起救援时间:{{item.createtime | time}}
  16. </view>
  17. <view class="list-box">
  18. <view class="list-type" v-if="item.status == 1">
  19. 已接受
  20. </view>
  21. <view class="list-type" v-if="item.status == 0">
  22. 待接收
  23. </view>
  24. <view class="list-type" v-if="item.status == 2">
  25. 处理中
  26. </view>
  27. <view class="list-type" v-if="item.status == -2">
  28. 已超时
  29. </view>
  30. <view class="list-type" v-if="item.status == -1">
  31. 拒绝
  32. </view>
  33. <view class="box-item" @click=" item.status == 1 ? tocall(item.rescue_phone): ''"
  34. :class="{'action': (item.status == 1)}">
  35. <image src="../../static/icon/call.png" mode="" class="call"></image>
  36. 拨打电话
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </uni-swipe-action-item>
  42. </uni-swipe-action>
  43. <!-- <view class="list" v-for="(item,index) in list" :key='index'>
  44. </view> -->
  45. <uni-popup ref="popup1" type="center">
  46. <view class="popup-box">
  47. <view class="img">
  48. <image src="../../static/img/map.jpg" mode=""></image>
  49. </view>
  50. <view class="mian">
  51. <view class="delivery">
  52. 求救记录
  53. <!-- {{ i18n.qrhwsdm }} -->
  54. </view>
  55. <view class="nocancel">
  56. 确认删除该记录吗?
  57. <!-- {{ i18n.wfcx }} -->
  58. </view>
  59. <view class="comfirm-box">
  60. <view class="cancel" @click="cancel">
  61. 取消
  62. </view>
  63. <view class="comfirm" @click="comfirm(tmp)">
  64. 确认
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </uni-popup>
  70. <empty v-if="list.length === 0"></empty>
  71. <uni-load-more :status="loadingType"></uni-load-more>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. deleteList,
  77. getseek
  78. } from '@/api/index.js';
  79. import {
  80. getRescueList
  81. } from '@/api/category.js'
  82. import empty from '@/components/empty';
  83. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  84. import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
  85. import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
  86. export default {
  87. components: {
  88. empty,
  89. uniLoadMore,
  90. uniSwipeAction,
  91. uniSwipeActionItem
  92. },
  93. filters: {
  94. time(val) {
  95. let str = ''
  96. if (val) {
  97. var time = new Date(val * 1000);
  98. var y = time.getFullYear();
  99. var m = time.getMonth() + 1;
  100. var d = time.getDate();
  101. var h = time.getHours();
  102. var mm = time.getMinutes();
  103. var s = time.getSeconds();
  104. str = y + '-' + m + '-' + d + ' ' + h + ":" + mm
  105. console.log(str)
  106. }
  107. return str
  108. }
  109. },
  110. data() {
  111. return {
  112. id: '',
  113. options: [{
  114. text: '取消',
  115. style: {
  116. backgroundColor: '#007aff'
  117. }
  118. }, {
  119. text: '确认',
  120. style: {
  121. backgroundColor: '#C90F1B'
  122. }
  123. }],
  124. page: 1,
  125. limit: 10,
  126. delBtnWidth: 60, //删除按钮宽度单位(rpx)
  127. startX: '',
  128. isDel: false,
  129. list: [],
  130. loadingType: 'more',
  131. }
  132. },
  133. onLoad() {
  134. this.loadData();
  135. },
  136. // 下拉加载
  137. onReachBottom() {
  138. this.loadData();
  139. },
  140. methods: {
  141. bindClick(e) {
  142. // console.log(333,e)
  143. // console.log('e.index',e.index)
  144. // console.log('this.tmp',this.tmp)
  145. // console.log('点击了' + (e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮')
  146. if (e.content.text == '取消') {
  147. console.log('点击了左侧取消按钮')
  148. } else {
  149. console.log('点击了右侧确认按钮')
  150. // this.$refs.popup1.open(this.tmp);
  151. this.open(this.id)
  152. }
  153. },
  154. swipeChange(e, id) {
  155. // // console.log('当前状态:' + open + ',下标:' + index)
  156. // console.log('index',index)
  157. this.id = id
  158. console.log('id111111111', id)
  159. // if ( e == 'right' ) {
  160. // this.index = index
  161. // console.log('当前index值:',this.index)
  162. // }
  163. // // console.log(222,e)
  164. },
  165. // 确认删除吗?
  166. comfirm(id) {
  167. console.log(9999888, id)
  168. deleteList({
  169. id: this.id
  170. }).then(({
  171. data
  172. }) => {
  173. window.location.reload(); //重新刷新页面
  174. this.loadData()
  175. this.cancel()
  176. })
  177. },
  178. // 取消
  179. cancel() {
  180. this.$refs.popup1.close();
  181. },
  182. // 打开弹窗
  183. open(tmp) {
  184. console.log('打开弹窗', tmp)
  185. this.$refs.popup1.open(tmp)
  186. },
  187. tocall(num) {
  188. console.log(num);
  189. uni.makePhoneCall({
  190. phoneNumber: num //仅为示例
  191. });
  192. },
  193. // touchS: function(e) {
  194. // // console.log('touchS')
  195. // if (e.touches.length == 1) {
  196. // //设置触摸起始点水平方向位置
  197. // this.startX = e.touches[0].clientX
  198. // console.log(this.startX)
  199. // this.isDel = true
  200. // }
  201. // },
  202. // // 删除
  203. // deleteMember() {
  204. // console.log('删除')
  205. // uni.showModal({
  206. // title:'点击删除'
  207. // })
  208. // },
  209. // cancelDel() {
  210. // console.log('取消删除')
  211. // this.isDel = false
  212. // },
  213. async loadData() {
  214. let obj = this;
  215. if (obj.loadingType === 'noMore') {
  216. //防止重复加载
  217. return;
  218. }
  219. // 修改当前对象状态为加载中
  220. obj.loadingType = 'loading';
  221. getRescueList({
  222. type: 0,
  223. page: obj.page,
  224. limit: obj.limit
  225. }).then(({
  226. data
  227. }) => {
  228. obj.list = obj.list.concat(data);
  229. obj.page++;
  230. if (obj.limit == data.length) {
  231. obj.loadingType = 'more';
  232. } else {
  233. obj.loadingType = 'noMore';
  234. }
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss">
  241. .container {
  242. line-height: 1;
  243. .list {
  244. width: 710rpx;
  245. background: #FFFFFF;
  246. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  247. border-radius: 10rpx;
  248. margin: 20rpx auto 0;
  249. display: flex;
  250. justify-content: space-between;
  251. .list-left {
  252. width: 100%;
  253. padding: 24rpx 0 24rpx 24rpx;
  254. }
  255. .cancel {
  256. background-color: #C9101B;
  257. display: flex;
  258. align-items: center;
  259. padding: 0 30rpx;
  260. color: #FFFFFF;
  261. }
  262. .list-top {
  263. font-size: 28rpx;
  264. font-weight: 500;
  265. color: #333333;
  266. line-height: 36px;
  267. }
  268. .list-phone {
  269. font-size: 24rpx;
  270. font-weight: 500;
  271. color: #666666;
  272. margin-top: 20rpx;
  273. }
  274. .list-time {
  275. font-size: 24rpx;
  276. font-weight: 500;
  277. color: #666666;
  278. margin-top: 20rpx;
  279. }
  280. .list-type {
  281. font-size: 28rpx;
  282. font-weight: 500;
  283. color: #C9101B;
  284. margin-top: 20rpx;
  285. }
  286. .action {
  287. background-color: #C9101B !important;
  288. }
  289. .list-box {
  290. display: flex;
  291. justify-content: space-between;
  292. // justify-content: center;
  293. padding: 0 40rpx;
  294. margin-top: 20rpx;
  295. .box-item {
  296. width: 210rpx;
  297. height: 65rpx;
  298. // background: #C9101B;、
  299. background-color: #aaa;
  300. border-radius: 30rpx;
  301. display: flex;
  302. align-items: center;
  303. justify-content: center;
  304. font-size: 28rpx;
  305. font-weight: 500;
  306. color: #FFFFFF;
  307. .call {
  308. width: 28rpx;
  309. height: 40rpx;
  310. margin-right: 10rpx;
  311. }
  312. }
  313. .box-item1 {
  314. width: 210rpx;
  315. height: 65rpx;
  316. background: #FF4F4F;
  317. border-radius: 30rpx;
  318. display: flex;
  319. align-items: center;
  320. justify-content: center;
  321. font-size: 28rpx;
  322. font-weight: 500;
  323. color: #FFFFFF;
  324. .veo {
  325. width: 40rpx;
  326. height: 40rpx;
  327. margin-right: 10rpx;
  328. }
  329. }
  330. }
  331. }
  332. .popup-box {
  333. width: 522rpx;
  334. height: 605rpx;
  335. background-color: #FFFFFF;
  336. border-radius: 20rpx;
  337. .img {
  338. border-radius: 20rpx 20rpx 0 0;
  339. width: 522rpx;
  340. height: 307rpx;
  341. image {
  342. border-radius: 20rpx 20rpx 0 0;
  343. width: 522rpx;
  344. height: 307rpx;
  345. }
  346. }
  347. .mian {
  348. display: flex;
  349. flex-direction: column;
  350. align-items: center;
  351. padding: 32rpx 32rpx;
  352. background-color: #FFFFFF;
  353. border-radius: 0 0 20rpx 20rpx;
  354. text-align: center;
  355. .delivery {
  356. font-size: 36rpx;
  357. color: #333333;
  358. // margin-top: 46rpx;
  359. }
  360. .nocancel {
  361. font-size: 30rpx;
  362. color: #999999;
  363. margin-top: 26rpx;
  364. }
  365. .comfirm-box {
  366. margin-top: 52rpx;
  367. display: flex;
  368. // margin-bottom: 32rpx;
  369. // justify-content: space-around;
  370. .cancel {
  371. display: flex;
  372. align-items: center;
  373. justify-content: center;
  374. width: 197rpx;
  375. height: 61rpx;
  376. border: 1px solid #C90F1B;
  377. border-radius: 31rpx;
  378. font-size: 24rpx;
  379. color: #C90F1B;
  380. }
  381. .comfirm {
  382. margin-left: 32rpx;
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. width: 197rpx;
  387. height: 61rpx;
  388. background: #C90F1B;
  389. border-radius: 31px;
  390. font-size: 24rpx;
  391. color: #FFFFFF;
  392. }
  393. }
  394. }
  395. }
  396. }
  397. </style>