| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <view class="container">
- <view class="content-box"><!-- @click="openAddress(item)" -->
- <view class="item">
- <view class="info flex_item">
- <view>头像:</view>
- <image :src="caller_info.avatar"></image>
- </view>
- <view class="info" v-if="list.status == 0 || list.status == 2">救援者姓名:救援者{{list.caller_info.helper}}</view>
- <view class="info" v-if="list.status == 1 || list.status == 3">救援者姓名:{{list.caller_info.nickname}}</view>
- <view class="info" v-if="list.status == 1 || list.status == 3">手机号:{{caller_info.mobile}}</view>
- <!-- <view class="info">求救信息:{{list.help_info}}</view> -->
- <view class="info">创建时间:{{list.createtime}}</view>
- <view class="info">状态:{{list.status_text}}</view>
- </view>
- <view class="box-btn flex" v-if="list.status == 0">
- <view class="accept" @click.stop="access(list)">接受</view>
- <view class="refuse" @click.stop="refuse(list)">拒绝</view>
- </view>
- <view class="box-btn flex" v-if="list.status == 1">
- <view class="accept" @click="success()">完成救援</view>
- <view class="refuse blue" @click="openAddress()">前往导航</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { sosInfo,accessSos,refuseSos,successSos } from '@/api/record.js';
- import { getTime } from '@/utils/rocessor.js';
- export default {
- data() {
- return {
- list:'',
- id:'',
- caller_info:''
- };
- },
- onLoad(option) {
- this.id = option.id;
- },
- onShow() {
- this.loadData();
- },
- //下拉刷新
- onPullDownRefresh() {
- this.loadData();
- },
- methods: {
- loadData(){
- let obj = this;
- sosInfo({
- id:obj.id,
- }).then(({ data }) => {
- obj.list = data;
- obj.caller_info = data.caller_info;
- console.log(obj.caller_info)
- obj.list.createtime = getTime(data.createtime)
- })
- .catch(e => {
- console.log(e);
- });
- },
- openAddress(){
- let obj = this;
- uni.openLocation({
- latitude:+obj.list.lat,
- longitude:+obj.list.lng,
- success(e){
- console.log(e)
- },
- fail(e) {
- console.log(e);
- }
- })
- },
- //救援完成
- success(){
- let obj = this;
- successSos({
- id: obj.id
- }).then(( data ) => {
- console.log(data)
- obj.$api.msg(data.msg);
- obj.loadData();
- }).catch((e) => {
- obj.$api.msg(e.message);
- console.log(e)
- });
- },
- //同意救援
- access(){
- let obj = this;
- uni.showModal({
- title: '提示',
- content: '您确定要接受求救吗',
- success: function (res) {
- if (res.confirm) {
- accessSos({
- id: obj.id
- }).then((data) => {
- obj.$api.msg(data.msg);
- obj.loadData();
- }).catch((e) => {
- obj.$api.msg(e.message);
- console.log(e)
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- //拒绝救援
- refuse(){
- let obj = this;
- uni.showModal({
- title: '提示',
- content: '您确定要拒绝求救吗?',
- success: function (res) {
- if (res.confirm) {
- refuseSos({
- id: obj.id
- }).then((data) => {
- obj.loadData();
- }).catch((e) => {
- obj.$api.msg(e.message);
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #ffffff;
- height: 100%;
- .container{
- width: 100%;
- height: 100%;
- padding-top: 25rpx;
- }
- }
- .content-box {
- width: 100%;
- padding: 47rpx 30rpx;
- font-size: 28rpx;
- color: #666666;
- }
- .item{
- margin-bottom: 100rpx;
- }
- .info {
- font-size: 28rpx;
- color: #333333;
- font-weight: 500;
- padding: 28rpx 0rpx;
- border-bottom: 2rpx solid #F0F0F0;
- image{
- width: 100rpx;
- height: 100rpx;
- border-radius: 100%;
- }
- }
- .status {
- font-size: 28rpx;
- font-weight: bold;
- color: rgba(255, 79, 79, 1);
- }
- .box-btn{
- width: 80%;
- margin: 0rpx auto;
- .accept{
- background: #FF4F4F;
- border-radius: 50rpx;
- color: #FFFFFF;
- padding: 20rpx 70rpx;
- }
- .refuse{
- text-align: center;
- background: #F3F3F3;
- border-radius: 50rpx;
- padding: 20rpx 70rpx;
- }
- .blue{
- background: #6786FB;
- color: #FFFFFF;
- }
- }
- </style>
|