123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- //车队管理
- <template>
- <view class="center">
- <view class="fleetInfo">
- <view class="fleetInfo_name">队长身份</view>
- <view class="fleetInfo_phone" v-if="fleetInfo.status">{{fleetInfo.status}}</view>
- <view class="fleetInfo_phone" v-else>去认证</view>
- </view>
- <view class="btn_css">
- <view class="btn_item" v-if="!fleetInfo">
- <u-button type="primary" text="去认证" @click="operation(1)"></u-button>
- </view>
- <view class="btn_item" v-else>
- <u-button type="primary" text="编辑" @click="operation(2)"></u-button>
- </view>
- </view>
- <u-divider></u-divider>
- <view class="list_css" v-for="(item,index) in formList">
- <view class="list_left">{{item.driverName}}({{item.accountNumber}})</view>
- <view class="list_right">
- <view class="list_text" v-if="item.status == '待确认'" @click="audit(item,1)">拒绝</view>
- <view class="list_text" v-if="item.status == '待确认'" @click="audit(item,2)">接受</view>
- <view class="list_text" v-if="item.status == '已绑定'">{{item.status}}</view>
- <view class="list_text"
- v-if="item.status == '已绑定'||item.status == '已解绑'||item.status == '已接受'||item.status == '已拒绝'"
- @click="next(item)">删除</view>
- </view>
- </view>
- <u-toast ref="uToast"></u-toast>
- <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
- confirmColor='#2772FB' @confirm="$u.throttle(confirmClick, 5000)" @close="cancelClick"
- @cancel="cancelClick"></u-modal>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- fleetInfo: {},
- tipsShow: false,
- alertTitle: "",
- formList: [],
- distinguish: "",
- id: "",
- sign:"",
- }
- },
- onLoad() {
- this.getInfo()
- },
- onShow() {
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onNavigationBarButtonTap(e) {
- this.$u.route("/pages/mine/fleet/fleetBill")
- },
- methods: {
- solution() {
- let that = this
- uni.showLoading({
- mask: true,
- title: '加载中'
- })
- this.tipsShow = false
- this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/deleteBind', {
- id: this.id
- }).then(res => {
- uni.hideLoading()
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: "删除成功!",
- complete() {
- that.getInfo()
- }
- })
- } else {
- uni.hideLoading()
- uni.$u.toast(res.message);
- }
- }).catch(res => {
- uni.hideLoading()
- uni.$u.toast(res.message);
- });
- },
- next(obj) {
- this.tipsShow = true
- this.alertTitle = "确定删除" + obj.driverName + "信息?"
- this.id = obj.id
- this.sign="删除"
- },
- audit(obj, val) {
- if (val == 1) {
- this.alertTitle = "确定拒绝" + obj.driverName + "加入车队?"
- this.distinguish = "2"
- } else if (val == 2) {
- this.alertTitle = "确定接受" + obj.driverName + "加入车队?"
- this.distinguish = "1"
- }
- this.id = obj.id
- this.tipsShow = true
- },
- operation(val) {
- if (val == 1) {
- uni.$u.route('/pages/mine/fleet/carCaptainAuthentication');
- } else {
- uni.$u.route('/pages/mine/fleet/carCaptainAuthentication', {
- data: JSON.stringify(this.fleetInfo),
- });
- }
- },
- leave() {
- this.tipsShow = true
- },
- cancelClick() {
- this.tipsShow = false
- },
- confirmClick() {
- let that = this
- if(this.sign == "删除"){ //删除操作
- this.solution()
- }else{
- uni.showLoading({
- mask: true,
- title: '加载中'
- })
- this.tipsShow = false
- this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/examine', {
- id: this.id,
- examineFlag: this.distinguish
- }).then(res => {
- if (res.code == 200) {
- uni.hideLoading()
- if (this.distinguish == 1) {
- this.$refs.uToast.show({
- type: 'success',
- message: "接受成功!",
- complete() {
- that.getInfo()
- }
- })
- } else {
- this.$refs.uToast.show({
- type: 'success',
- message: "拒绝成功!",
- complete() {
- that.getInfo()
- }
- })
- }
- } else {
- uni.hideLoading()
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.hideLoading()
- uni.$u.toast(res.message);
- });
- }
-
- },
- getInfo() {
- this.$request.baseRequest('get', '/hyCarCaptainInfo/getCarCaptain', {
- commonId: this.userInfo.id
- }).then(res => {
- if (res.code == 200) {
- if (res.data) {
- this.fleetInfo = res.data
- //车队人员
- this.$request.baseRequest('get', '/hyBindCarCaptainInfo/api/selectPage', {
- carCaptainCommonId: this.fleetInfo.commonId,
- pageSize: 10,
- currentPage: 1
- }).then(res => {
- if (res.code == 200) {
- this.formList = res.data.records
- // if(res.data.total == 0){
- // this.status = 'nomore'
- // }else{
- // this.status = 'loadmore'
- // }
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- }
- } else {
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .center {
- padding: 20rpx 30rpx;
- }
- .fleetInfo {
- display: flex;
- width: 100%;
- margin-top: 30rpx;
- .fleetInfo_name {
- width: 50%;
- }
- .fleetInfo_phone {
- width: 50%;
- text-align: right;
- }
- }
- .btn_css {
- display: flex;
- margin-top: 30rpx;
- .btn_item {
- width: 120rpx;
- margin-right: 20rpx;
- }
- }
- .list_css {
- display: flex;
- margin: 10rpx 0;
- .list_left {
- width: 50%;
- }
- .list_right {
- display: flex;
- justify-content: flex-end;
- width: 50%;
- .list_text {
- margin: 0 10rpx;
- }
- }
- }
- </style>
|