|
@@ -1,24 +1,31 @@
|
|
|
<template>
|
|
|
<view class="power-setting-main">
|
|
|
<view class="flex-row power-setting-head">
|
|
|
- <img class="head-img" src="https://qiniu.bms16.com/FprjgdYTzB9LDkHZT1F-p_kQKNty" alt="">
|
|
|
- <view class="head-name">名字</view>
|
|
|
- <text class="head-email">1007929522@Mail.com</text>
|
|
|
+ <img class="head-img" :src="headimg" alt="">
|
|
|
+ <view class="head-name">{{nickname}}</view>
|
|
|
+ <text class="head-email">{{form.email}}</text>
|
|
|
</view>
|
|
|
<view class="setting-card" style="margin-bottom: 20rpx;">
|
|
|
<view class="setting-card-name">权限设置</view>
|
|
|
- <view class="setting-card-list flex-row">
|
|
|
+ <view @click="selctFn(4)" class="setting-card-list flex-row">
|
|
|
<img src="https://qiniu.bms16.com/FgFEr3CUA43kd7yVCDcK4F7v9_zx" alt="">
|
|
|
<view class="setting-list-text flex-row flex-between">
|
|
|
- <text>查看实时位置</text>
|
|
|
- <img class="setting-list-arrow" src="https://qiniu.bms16.com/FrA97op1dwM9XWH1ocqnF5FFlqoY" alt="">
|
|
|
+ <text>查看实时位置</text>
|
|
|
+ <img v-if="form.authority_list.indexOf(4) == -1" class="setting-list-arrow"
|
|
|
+ src="https://qiniu.bms16.com/FrA97op1dwM9XWH1ocqnF5FFlqoY" alt="">
|
|
|
+ <img v-else class="setting-list-arrow" src="https://qiniu.bms16.com/FuA5w59wrvsisg3bGhe3hQ2dR3Bk"
|
|
|
+ alt="">
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="setting-card-list flex-row">
|
|
|
+ <view @click="selctFn(5)" class="setting-card-list flex-row">
|
|
|
<img src="https://qiniu.bms16.com/FmcZqGTnt64_v2xpgNbqS9Fa-fwy" alt="">
|
|
|
<view class="setting-list-text flex-row flex-between">
|
|
|
- <text>使用换电</text>
|
|
|
- <img class="setting-list-arrow" src="https://qiniu.bms16.com/FuA5w59wrvsisg3bGhe3hQ2dR3Bk" alt="">
|
|
|
+ <text>使用换电</text>
|
|
|
+ <!-- <img class="setting-list-arrow" src="https://qiniu.bms16.com/FuA5w59wrvsisg3bGhe3hQ2dR3Bk" alt=""> -->
|
|
|
+ <img v-if="form.authority_list.indexOf(5) == -1" class="setting-list-arrow"
|
|
|
+ src="https://qiniu.bms16.com/FrA97op1dwM9XWH1ocqnF5FFlqoY" alt="">
|
|
|
+ <img v-else class="setting-list-arrow" src="https://qiniu.bms16.com/FuA5w59wrvsisg3bGhe3hQ2dR3Bk"
|
|
|
+ alt="">
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -37,16 +44,29 @@
|
|
|
<view class="setting-list-text flex-row">感应解锁</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="check-btn add-btn">确认添加</view>
|
|
|
- <!-- <view class="check-btn del-btn">删除成员</view> -->
|
|
|
+
|
|
|
+ <view v-if="!target_user_id" @click="submit" class="check-btn add-btn">确认添加</view>
|
|
|
+ <view v-else @click="delSubmit" class="check-btn del-btn">删除成员</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- var config = require('../../common/config.js');
|
|
|
+ var config = require('../../common/config_gyq.js');
|
|
|
+ var http = require('../../common/request.js');
|
|
|
+ import {
|
|
|
+ msg
|
|
|
+ } from '../../utils/util.js';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ headimg: "",
|
|
|
+ nickname: "",
|
|
|
+ target_user_id:0,
|
|
|
+ form: {
|
|
|
+ car_sn: "",
|
|
|
+ email: "",
|
|
|
+ authority_list: [5]
|
|
|
+ }
|
|
|
};
|
|
|
}
|
|
|
/**
|
|
@@ -54,9 +74,91 @@
|
|
|
*/
|
|
|
,
|
|
|
onLoad: function(options) {
|
|
|
+ this.form.car_sn = uni.getStorageSync('car_info').car_sn || '';
|
|
|
+ if(options.id){
|
|
|
+ this.target_user_id = options.id
|
|
|
+ this.carInfoFn()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.form.email = options.email;
|
|
|
+ this.form.headimg = options.headimg;
|
|
|
+ this.form.nickname = options.nickname;
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ async carInfoFn(){
|
|
|
+ let {
|
|
|
+ data
|
|
|
+ } = await http.postApi(config.API_FLK_CAR_EDIT_SHARE_INFO, {
|
|
|
+ car_sn: this.form.car_sn,
|
|
|
+ target_user_id: this.target_user_id
|
|
|
+ })
|
|
|
+ if(data.code == 200){
|
|
|
+ data.data.authority = data.data.authority.map(item=>{
|
|
|
+ return Number(item)
|
|
|
+ })
|
|
|
+ this.form.authority_list = data.data.authority
|
|
|
+ this.form.email = data.data.email
|
|
|
+ this.nickname = data.data.nickname
|
|
|
+ this.headimg = data.data.headimg
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async delSubmit() {
|
|
|
+ let res = await uni.showModal({
|
|
|
+ content:'确定删除这个成员吗?'
|
|
|
+ })
|
|
|
+ if(!res[1].confirm) return
|
|
|
+ let {
|
|
|
+ data
|
|
|
+ } = await http.postApi(config.API_FLK_CAR_REMOVE_SHARE_USER, {
|
|
|
+ car_sn: this.form.car_sn,
|
|
|
+ email: this.form.email
|
|
|
+ })
|
|
|
+ uni.showLoading({
|
|
|
+ mask:true,
|
|
|
+ title:'删除中...'
|
|
|
+ })
|
|
|
+ msg(data.msg)
|
|
|
+ if(data.code == 200){
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ },800)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async submit() {
|
|
|
+ uni.showLoading({
|
|
|
+ mask: true,
|
|
|
+ title: '提交中...'
|
|
|
+ })
|
|
|
+ let {
|
|
|
+ data
|
|
|
+ } = await http.postApi(config.API_FLK_CAR_ADD_SHARE_USER, this.form)
|
|
|
+ if (data.code == 200) {
|
|
|
+ msg("添加成功!")
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 2
|
|
|
+ })
|
|
|
+ }, 800)
|
|
|
+ } else {
|
|
|
+ msg(data.msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selctFn(type) {
|
|
|
+ if (this.form.authority_list.indexOf(type) != -1) {
|
|
|
+ this.form.authority_list = this.form.authority_list.filter(item => item !== type);
|
|
|
+ } else {
|
|
|
+ this.form.authority_list.push(type)
|
|
|
+ }
|
|
|
+ if(this.target_user_id) this.editFn()
|
|
|
+
|
|
|
+ },
|
|
|
+ async editFn(){
|
|
|
+ let {
|
|
|
+ data
|
|
|
+ } = await http.postApi(config.API_FLK_CAR_ADD_SHARE_USER,this.form)
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|