helprecords.vue 7.6 KB

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