helprecords copy.vue 8.1 KB

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