You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini-manage/pages/user/select-team/select-team.vue

203 lines
4.7 KiB

<template>
<view>
<view class="username paddtop10">
<view class="namecont">班组选择</view>
<picker mode="selector" style="width: 90%;" :range="classGroupList" range-key="name" @change="changeclass">
<view class="date text1" style="padding: 0 50rpx;">{{className}}</view>
</picker>
<image class="flright" style="width: 15px;height: 15px;" src="../../../static/img/downj.png"></image>
</view>
<view class="width80 height40 backcor008 border-r font14 fotct fcorfff" v-if="typeid == 1"
style="position: fixed;bottom: 40px;" @click="swapGroupTask()">
交接班次
</view>
<view class="width80 height40 backcor008 border-r font14 fotct fcorfff" v-if="typeid == 2"
style="position: fixed;bottom: 40px;" @click="startGroupTask()">
开始班次
</view>
</view>
</template>
<script>
import {
startGroupTask,
getClassGroupList,
swapGroupTask
} from '../../../Utils/Api.js';
let app = getApp();
export default {
data() {
return {
typeid: '', //入口类型
classGroupList: '', //班组列表
className: '', // 班组名称
classId: '' ,//id
userinfo: '', //用户信息
}
},
onLoad(options) {
this.typeid = options.typeid;
this.userinfo = app.globalData.userInfo;
if (options.typeid == 1) {
uni.setNavigationBarTitle({
title: '交换班次'
})
}
if (options.typeid == 2) {
uni.setNavigationBarTitle({
title: '开始班次'
})
}
this.getClassGroupList();
},
methods: {
//查询班组
getClassGroupList() {
uni.showLoading({
title: '加载中...'
})
let datas = {
pageNum: 1,
pageSize: 9999
}
getClassGroupList(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
this.classGroupList = res.return_data.list;
this.classId = res.return_data.list[0].id;
this.className = res.return_data.list[0].name;
}
})
},
//选择班组
changeclass(e) {
this.classId = this.classGroupList[e.target.value].id;
this.className = this.classGroupList[e.target.value].name;
},
//开始班次
startGroupTask() {
let that = this;
uni.showModal({
title: '开始班次',
content: '是否开始当前班次?',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '操作中'
})
let datas = {
gasId: that.userinfo.merchantStore.id,
gasClassGroupId: that.classId
}
startGroupTask(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
})
uni.navigateBack({})
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
}
}
})
},
//交换班次
swapGroupTask() {
let that = this;
uni.showModal({
title: '交换班次',
content: '是否交换当前班次?',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '操作中'
})
let datas = {
gasId: that.userinfo.merchantStore.id,
gasClassGroupId: that.classId
}
swapGroupTask(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
})
uni.navigateBack({})
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
}
}
})
}
}
}
</script>
<style lang="scss">
.username {
width: calc(100% - 90upx);
height: 100upx;
display: flex;
align-items: center;
background-color: rgba($color: #ffffff, $alpha: 0.1);
border-bottom: 1px solid #f6f6f6;
padding: 8upx 45upx;
input {
width: 50%;
height: 50upx;
font-size: 16px;
color: #333333;
font-weight: blod;
}
.get-code {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
right: 7px;
z-index: 3;
border: 1px solid #bfbfbf;
width: 25%;
padding: 3px 5px;
border-radius: 22px;
&:after {
content: " ";
width: 1upx;
height: 50upx;
position: absolute;
z-index: 3;
margin-right: 100%;
left: 0;
top: 20upx;
}
}
.namecont {
color: #666666;
width: 28%;
}
}
</style>