123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- //车队管理
- <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.name">
- <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="tips_info">
- <span>绑定司机</span>
- <image class='yanjingicon' @click="changeStatus(1)" v-if="isShow == 2" src="../../../static/yioncang.png">
- </image>
- <image class='yanjingicon' @click="changeStatus(2)" v-if="isShow == 1" src="../../../static/xianshi.png">
- </image>
- <!-- <u--image :showLoading="true" src="../../../static/yioncang.png" width="80px" height="80px" @click="click"></u--image> -->
- </view>
- <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 == '已解绑'||item.status == '已接受'||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>
- <view>
- <u-loadmore :status="loadStatus" />
- </view>
- <u-toast ref="uToast"></u-toast>
- <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
- confirmColor='#F5BA3C' @confirm="$u.throttle(confirmClick, 1000)" @close="cancelClick"
- @cancel="cancelClick"></u-modal>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- //分页
- pageSize: 20,
- currentPage: 1,
- fleetInfo: {},
- tipsShow: false,
- alertTitle: "",
- formList: [],
- distinguish: "",
- id: "",
- sign: "",
- isShow: 1,
- isLoadMore: false, //是否加载中
- loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- }
- },
- onLoad() {
- this.getInfo()
- },
- onShow() {},
- //下拉刷新
- onPullDownRefresh() {
- this.currentPage = 1
- this.isLoadMore = false
- this.loadStatus = 'loading'
- this.nextGetInfo()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() { //上拉触底函数
- if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
- this.isLoadMore = true
- this.currentPage += 1
- this.nextGetInfo()
- }
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onNavigationBarButtonTap(e) {
- if (this.fleetInfo.name) { //判断是否有队长身份
- this.$u.route("/pages/mine/fleet/fleetBill")
- } else {
- this.$refs.uToast.show({
- type: 'error',
- message: "您还没有认证车队长身份!",
- complete() {
- that.getInfo()
- }
- })
- }
- },
- methods: {
- changeStatus(val) {
- this.isShow = val
- if (val == 1) {
- if (this.fleetInfo.name) { //判断是否有队长身份
- this.currentPage = 1
- this.nextGetInfo()
- }
- } else if (val == 2) {
- this.formList = []
- }
- },
- 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.nextGetInfo()
- }else{
- this.isLoadMore = true
- this.loadStatus = 'nomore'
- }
- } else {
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- nextGetInfo() {
- //车队人员
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- this.$request.baseRequest('get', '/hyBindCarCaptainInfo/api/selectPage', {
- carCaptainCommonId: this.userInfo.id,
- pageSize: this.pageSize,
- currentPage: this.currentPage
- }).then(res => {
- if (res.code == 200) {
- // this.formList = res.data.records
- if (res.data.records.length > 0) {
- this.isLoadMore = false
- this.loadStatus = 'loadmore'
- } else {
- this.isLoadMore = true
- this.loadStatus = 'nomore'
- }
- if (this.currentPage == 1) {
- this.formList = res.data.records
- if (res.data.records.length < 20) {
- this.loadStatus = 'nomore'
- }
- } else {
- this.formList = this.formList.concat(res.data.records)
- }
- uni.hideLoading()
- } else {
- uni.hideLoading()
- }
- })
- .catch(res => {
- uni.hideLoading()
- 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: 30rpx 0;
- .list_left {
- width: 50%;
- }
- .list_right {
- display: flex;
- justify-content: flex-end;
- width: 50%;
- .list_text {
- margin: 0 10rpx;
- }
- }
- }
- .tips_info {
- margin: 20rpx 0;
- .yanjingicon {
- margin: 0 20rpx;
- width: 22px;
- height: 22px;
- top: 10rpx
- }
- }
- </style>
|