123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700 |
- <template>
- <view class="container">
- <uni-swipe-action>
- <uni-swipe-action-item :right-options="options" @click="bindClick" @change="swipeChange($event, item.id)" v-for="(item,index) in list">
- <view :style="item.txtStyle" class="list">
- <view class="box">
- <view class="box-1">
- <view class="box-2">
- <view class="box-top">
- 求救者姓名:{{item.name}}
- </view>
- <view class="box-time">
- 求救时间:{{item.add_time}}
- </view>
- </view>
- <view class="navImg" @click="toNav(item, index)">
- <image src="../../static/img/img10.png" mode=""></image>
- <view class="tip">导航</view>
- </view>
- </view>
-
- <view class="box-sub-box" v-if="item.status==0">
- <view class="sub-box1" @click="agree(item,index)">
- 接受
- </view>
- <view class="sub-box2" @click="refuse(item,index)">
- 拒绝
- </view>
- </view>
- <view class="box-sub-box" v-if="item.status !==0">
- <view class="red-font" v-if="item.status == 1">
- 已接受
- </view>
- <view class="red-font" v-if="item.status == 2">
- 已拒绝
- </view>
- <view class="sub-box3" @click="tocall(item.phone)">
- <image src="../../static/icon/call.png" mode="" class="call"></image>
- 拨打电话
- </view>
- </view>
- <!-- <view class="remove" @click="delItem">删除</view> -->
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- <empty v-if="list.length === 0"></empty>
- <uni-load-more :status="loadingType"></uni-load-more>
- <uni-popup ref="popup" type="bottom" @click="close">
- <view class="popup_row">
- <view class="rows">
- <view class="rows-item" @click="toGaodeMap">
- 高德地图
- </view>
- <view class="rows-item" @click="tobaiDuMap">
- 百度地图
- </view>
- <view class="rows-item" @click="totengxunMap">
- 腾讯地图
- </view>
- </view>
- </view>
- </uni-popup>
-
- <uni-popup ref="popup1" type="center">
- <view class="popup-box">
- <view class="img">
- <image src="../../static/img/map.jpg" mode=""></image>
- </view>
- <view class="mian">
- <view class="delivery">
- 救援记录
- <!-- {{ i18n.qrhwsdm }} -->
- </view>
- <view class="nocancel">
- 确认删除该记录吗?
- <!-- {{ i18n.wfcx }} -->
- </view>
- <view class="comfirm-box">
- <view class="cancel" @click="cancel">
- 取消
- </view>
- <view class="comfirm" @click="comfirm(tmp)">
- 确认
- </view>
- </view>
- </view>
- </view>
-
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- deleteList,
- getrescue,
- change_rescue
- } from '@/api/index.js';
- import empty from '@/components/empty';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import uniPopup from '@/components/uni-popup/uni-popup.vue';
- import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
- import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
- export default {
- components: {
- empty,
- uniPopup,
- uniLoadMore,
- uniSwipeAction,
- uniSwipeActionItem
- },
- data() {
- return {
- id:'',
- tmp:'',
- options: [{
- text: '取消',
- style: {
- backgroundColor: '#007aff'
- }
- }, {
- text: '确认',
- style: {
- backgroundColor: '#C90F1B'
- }
- }],
- page: 1,
- limit: 10,
- list: [],
- loadingType: 'more',
- latitude2: '',
- longitude2: '',
- longitude4: '',
- latitude4: '',
- address: '',
- }
- },
- onLoad() {
- this.loadData();
- let obj = this;
- try {
- let locationAddress
- // #ifdef H5
- let wxOjb = require('jweixin-module');
- locationAddress = wxOjb.getLocation;
- // #endif
- // #ifdef MP
- locationAddress = uni.getLocation;
- // #endif
- // #ifdef H5
- wxOjb.ready(() => {
- console.log('加载完毕注册事件');
- locationAddress({
- type: 'wgs84',
- success: function(res) {
- console.log('获取经纬度', res);
- obj.longitude4 = res.longitude
- obj.latitude4 = res.latitude
- // obj.loadData();
- },
- fail(e) {
- console.log('失败', e);
- window.location.reload();
- }
- });
- })
- // #endif
- // #ifdef MP
- locationAddress({
- type: 'wgs84',
- success: function(res) {
- console.log('获取经纬度', res);
- obj.longitude4 = res.longitude
- obj.latitude4 = res.latitude
- // obj.loadData();
- },
- fail(e) {
- console.log('失败', e);
- window.location.reload();
- }
- });
- // #endif
- } catch (e) {
- let locationAddress
- // #ifdef H5
- let wxOjb = require('jweixin-module');
- locationAddress = wxOjb.getLocation;
- // #endif
- // #ifdef MP
- locationAddress = uni.getLocation;
- // #endif
- // #ifdef H5
- wxOjb.ready(() => {
- console.log('加载完毕注册事件');
- locationAddress({
- type: 'wgs84',
- success: function(res) {
- console.log('获取经纬度', res);
- obj.longitude4 = res.longitude
- obj.latitude4 = res.latitude
- // obj.loadData();
- },
- fail(e) {
- console.log('失败', e);
- window.location.reload();
- }
- });
- })
- // #endif
- // #ifdef MP
- locationAddress({
- type: 'wgs84',
- success: function(res) {
- console.log('获取经纬度', res);
- obj.longitude4 = res.longitude
- obj.latitude4 = res.latitude
- // obj.loadData();
- },
- fail(e) {
- console.log('失败', e);
- window.location.reload();
- }
- });
- // #endif
- }
- },
- methods: {
- bindClick(e) {
- // console.log(333,e)
- // console.log('e.index',e.index)
- // console.log('this.tmp',this.tmp)
- // console.log('点击了' + (e.position === 'left' ? '左侧' : '右侧') + e.content.text + '按钮')
- if ( e.content.text == '取消' ) {
- console.log('点击了左侧取消按钮')
- } else {
- console.log('点击了右侧确认按钮')
- // this.$refs.popup1.open(this.tmp);
- this.open(this.id)
- }
- },
- swipeChange(e, id) {
- // // console.log('当前状态:' + open + ',下标:' + index)
- // console.log('index',index)
- this.id = id
- console.log('id111111111',id)
- // if ( e == 'right' ) {
- // this.index = index
- // console.log('当前index值:',this.index)
- // }
- // // console.log(222,e)
- },
- // 确认删除吗?
- comfirm (id) {
- console.log(9999888,id)
- deleteList({
- id: this.id
- }).then(({ data }) => {
- window.location.reload(); //重新刷新页面
- this.loadData()
- this.cancel()
- })
- },
- // 取消
- cancel(){
- this.$refs.popup1.close();
- },
- // 打开弹窗
- open(tmp) {
- console.log('打开弹窗',tmp)
- this.$refs.popup1.open(tmp)
- },
- // bindClick(){
- // console.log(2222)
- // },
- async loadData() {
- let obj = this;
- if (obj.loadingType === 'noMore') {
- //防止重复加载
- return;
- }
- // 修改当前对象状态为加载中
- obj.loadingType = 'loading';
- getrescue({
- page: obj.page,
- limit: obj.limit
- }).then(({
- data
- }) => {
- obj.list = obj.list.concat(data);
- obj.page++;
- if (obj.limit == data.length) {
- obj.loadingType = 'more';
- } else {
- obj.loadingType = 'noMore';
- }
- })
- },
- // 点击导航
- toNav(item, index) {
- console.log(item, index)
- let obj = this
- obj.latitude2 = item.latitude
- obj.longitude2 = item.longitude
- obj.address = item.address
- this.$refs.popup.open();
- },
- // 调用高德
- toGaodeMap() {
- let latitude = this.latitude2
- let longitude = this.longitude2
- let address = this.address
- console.log('选择高德', latitude, longitude, address)
- // window.location.href = 'https://uri.amap.com/marker?position=30.537043,120.567191&name=浙江省嘉兴市桐乡市高桥镇高桥大道51号'
- window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`
- // window.location.href = `http://uri.amap.com/navigation?from=114.02597366,22.54605355&to=114.029243,22.609562&mode=car&src=nyx_super`
- // http://uri.amap.com/navigation?from=" + fromLongitude + "," + fromLatitude + "&to="+ longitude + "," + latitude + "&mode=car&src=nyx_super
- },
- // 调用腾讯
- totengxunMap() {
- let latitude = this.latitude2
- let longitude = this.longitude2
- let address = this.address
- console.log('选择腾讯', latitude, longitude)
- window.location.href = `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
- },
- // 调用百度
- tobaiDuMap() {
- let latitude = this.latitude2
- let longitude = this.longitude2
- let latitude6 = this.latitude4
- let longitude6 = this.longitude4
- let address = this.address
- console.log('选择百度', latitude, longitude)
- console.log('获取当前经纬度', latitude6, longitude6)
- window.location.href =
- `http://api.map.baidu.com/direction?origin=latlng:${latitude6},${longitude6}|name:我的位置&destination=${latitude},${longitude}&mode=driving®ion=${ address }&output=html&src=webapp.baidu.openAPIdemo`
- //`bdapp://map/navi?location=${longitude},${latitude}&coord_type=gc02&title=${address}&content=${address}&output=html&src=andr.baidu.openAPIdemo `
- },
- // 拨打电话
- tocall(num) {
- console.log(num);
- uni.makePhoneCall({
- phoneNumber: num //仅为示例
- });
- },
- //同意
- agree(item, index) {
- let obj = this;
- uni.showModal({
- content: '是否要接受该求救?',
- success: res => {
- if (res.confirm) {
- change_rescue({
- id: item.id,
- status: 1
- }).then((data) => {
- obj.list[index].status = 1;
- console.log(obj.list[index].status);
- })
- }
- }
- });
- },
- //拒绝
- refuse(item, index) {
- let obj = this;
- uni.showModal({
- content: '是否要拒绝该求救?',
- success: res => {
- if (res.confirm) {
- change_rescue({
- id: item.id,
- status: 2
- }).then((data) => {
- obj.list[index].status = 2;
- console.log(item);
- })
- }
- }
- })
- },
- // @touchstart="touchS" @touchmove="touchM" :data-index="index" @touchend="touchE"
- // touchS(e) {
- // uni.showModal({
- // title: '执行touchS方法',
- // content: JSON.stringify(e)
- // })
- // if (e.touches.length == 1) {
- // //设置触摸起始点水平方向位置
- // this.startX = e.touches[0].clientX
- // // console.log(this.startX)
- // }
- // },
- // touchM(e) {
- // console.log('执行touchE方法', e)
- // uni.showModal({
- // title: '执行touchM方法',
- // content: JSON.stringify(e)
- // })
- // if (e.touches.length == 1) {
- // //手指移动时水平方向位置
- // var moveX = e.touches[0].clientX;
- // //手指起始点位置与移动期间的差值
- // var disX = this.startX - moveX;
- // var delBtnWidth = this.delBtnWidth;
- // var txtStyle = "";
- // if (disX == 0 || disX < 0) { //如果移动距离小于等于0,说明向右滑动,文本层位置不变
- // txtStyle = "left:0px";
- // } else if (disX > 0) { //移动距离大于0,文本层left值等于手指移动距离
- // txtStyle = "left:-" + disX + "px";
- // if (disX >= delBtnWidth) {
- // //控制手指移动距离最大值为删除按钮的宽度
- // txtStyle = "left:-" + delBtnWidth + "px";
- // }
- // }
- // //获取手指触摸的是哪一项
- // var index = e.currentTarget.dataset.index;
- // var list = this.list;
- // console.log(999, e.currentTarget.dataset)
- // // list[index].txtStyle = txtStyle;
- // // console.log(list[index].txtStyle)
- // //更新列表的状态
- // this.list = list;
- // }
- // },
- // touchE(e) {
- // console.log('执行touchE方法', e)
- // uni.showModal({
- // title: '执行touchE方法',
- // content: JSON.stringify(e)
- // })
- // if (e.changedTouches.length == 1) {
- // //手指移动结束后水平位置
- // var endX = e.changedTouches[0].clientX;
- // //触摸开始与结束,手指移动的距离
- // var disX = this.startX - endX;
- // var delBtnWidth = this.delBtnWidth;
- // //如果距离小于删除按钮的1/2,不显示删除按钮
- // var txtStyle = disX > delBtnWidth / 2 ? "left:-" + delBtnWidth + "px" : "left:0px";
- // //获取手指触摸的是哪一项
- // var index = e.currentTarget.dataset.index;
- // var list = this.list;
- // // list[index].txtStyle = txtStyle;
- // // console.log(list[index].txtStyle)
- // //更新列表的状态{
- // this.list = list
- // }
- // }
- }
- }
- </script>
- <style lang="scss">
- .container {
- line-height: 1;
- .box {
- width: 750rpx;
- background: #FFFFFF;
- box-shadow: 0px 5rpx 5rpx 0px rgba(34, 24, 20, 0.06);
- border-radius: 10rpx;
- margin: 20rpx auto 0;
- padding: 30rpx;
- position: relative;
- .box-top {
- font-size: 28rpx;
- font-weight: 500;
- color: #333333;
- }
- .box-time {
- margin-top: 20rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #666666;
- }
- .box-1 {
- display: flex;
- justify-content: space-between;
- }
- .navImg {
- width: 50rpx;
- height: 50rpx;
- image {
- width: 50rpx;
- height: 50rpx;
- }
- .tip {
- margin-top: 6rpx;
- color: #7F7F7F;
- font-size: 21rpx;
- text-align: right;
- // background-color: pink;
- }
- }
- .box-sub-box {
- margin-top: 44rpx;
- display: flex;
- justify-content: space-between;
- padding: 0 80rpx;
- .red-font {
- width: 175rpx;
- height: 59rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 28rpx;
- font-weight: 500;
- color: #C90F1B;
- }
- .sub-box1 {
- width: 175rpx;
- height: 59rpx;
- background: #C90F1B;
- border-radius: 29rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .sub-box2 {
- width: 175rpx;
- height: 59rpx;
- background: #F3F3F3;
- border-radius: 29rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #333333;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .sub-box3 {
- width: 200rpx;
- height: 59rpx;
- background: #C90F1B;
- border-radius: 29rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- .call {
- width: 28rpx;
- height: 40rpx;
- margin-right: 10rpx;
- }
- }
- }
- }
- .popup-box {
- width: 522rpx;
- height: 605rpx;
- background-color: #FFFFFF;
- border-radius: 20rpx;
-
- .img {
- border-radius: 20rpx 20rpx 0 0;
- width: 522rpx;
- height: 307rpx;
-
- image {
- border-radius: 20rpx 20rpx 0 0;
- width: 522rpx;
- height: 307rpx;
- }
- }
-
- .mian {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 32rpx 32rpx;
- background-color: #FFFFFF;
- border-radius: 0 0 20rpx 20rpx;
- text-align: center;
-
- .delivery {
- font-size: 36rpx;
- color: #333333;
- // margin-top: 46rpx;
- }
-
- .nocancel {
- font-size: 30rpx;
- color: #999999;
- margin-top: 26rpx;
- }
-
- .comfirm-box {
- margin-top: 52rpx;
- display: flex;
- // margin-bottom: 32rpx;
-
- // justify-content: space-around;
- .cancel {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 197rpx;
- height: 61rpx;
- border: 1px solid #C90F1B;
- border-radius: 31rpx;
-
- font-size: 24rpx;
- color: #C90F1B;
- }
-
- .comfirm {
- margin-left: 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 197rpx;
- height: 61rpx;
- background: #C90F1B;
- border-radius: 31px;
- font-size: 24rpx;
- color: #FFFFFF;
- }
- }
- }
- }
- .popup_row {
- width: 100%;
- height: 500rpx;
- background-color: #ffffff;
- border-radius: 20rpx 20rpx 0 0;
- display: flex;
- justify-content: center;
- align-items: center;
- .rows {
- width: 100%;
- padding: 0 24rpx;
- .rows-item {
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- width: 100%;
- font-size: 32rpx;
- color: #303133;
- // border-bottom: 1rpx solid #f0f0f0;
- }
- // .row-1 {
- // margin: auto;
- // .first_aid {
- // width: 300rpx;
- // height: 300rpx;
- // }
- // }
- // .row-2 {
- // font-size: 38rpx;
- // margin-top: 20rpx;
- // }
- }
- }
- .remove {
- display: flex;
- border-radius: 0 12rpx 12rpx 0;
- align-items: center;
- justify-content: center;
- // margin-right: 22rpx;
- position: absolute;
- right: 0;
- top: 0;
- font-size: 30rpx;
- width: 110rpx;
- height: 100%;
- color: #FFFFFF;
- background-color: #C90F1B;
- ;
- }
- }
- </style>
|