oil-station/gasStation-uni/pagesMy/fleetInfo/index.vue

276 lines
5.9 KiB
Vue
Raw Normal View History

2024-09-22 14:30:12 +08:00
<template>
<view class="content">
<view class="container">
2024-09-23 13:41:19 +08:00
<view class="box-hang">
<view class=""><span style="color: red;">*</span>车队名称</view>
2024-09-22 14:30:12 +08:00
<view class="dis">
2024-09-26 13:45:57 +08:00
<input v-model="fleetInfo.fleetName" style="text-align: right;" placeholder="请输入"></input>
2024-09-22 14:30:12 +08:00
</view>
</view>
2024-09-23 13:41:19 +08:00
<view class="box-hang">
<view class=""><span style="color: red;">*</span>开户门店</view>
2024-09-27 17:33:11 +08:00
<view class="dis" @click="show1=!show1">
2024-09-27 10:20:09 +08:00
<text>{{storeName || '暂未选择'}}</text>
<u-icon name="arrow-right" size="14"></u-icon>
2024-09-23 13:41:19 +08:00
</view>
</view>
2024-09-27 10:20:09 +08:00
<view class="box-hang" @click="show = !show">
2024-09-23 13:41:19 +08:00
<view class=""><span style="color: red;">*</span>开户类型</view>
<view class="dis">
2024-09-27 10:20:09 +08:00
<text>{{fleetInfo.cardType}}</text>
2024-09-23 13:41:19 +08:00
</view>
</view>
<view class="box-hang" style="margin-top: 10px;">
<view class=""><span style="color: red;">*</span>是否启用</view>
<view class="dis">
2024-09-27 17:33:11 +08:00
<u-switch v-model="fleetInfo.status" activeValue='qy' inactiveValue='jy' activeColor="#6DD400"
inactiveColor="rgb(230, 230, 230)"></u-switch>
2024-09-23 13:41:19 +08:00
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>管理员</view>
<view class="dis">
2024-09-27 17:33:11 +08:00
<text>{{fleetInfo.fleetLeader}}</text>
<!-- <image style="width: 24px;height: 24px;margin-left: 5px;" src="@/static/my/fleetRemove.png"></image> -->
2024-09-23 13:41:19 +08:00
</view>
</view>
2024-09-27 17:33:11 +08:00
<!-- <view class="box-end">
2024-09-23 13:41:19 +08:00
<image style="width: 15px;height: 15px;margin-right: 5px;margin-top: 6px;"
2024-09-26 13:45:57 +08:00
src="@/static/my/fleetAdd.png"></image>
2024-09-23 13:41:19 +08:00
<text>添加管理员</text>
2024-09-27 17:33:11 +08:00
</view> -->
2024-09-23 13:41:19 +08:00
2024-09-27 17:33:11 +08:00
<view class="but-sub" @click="submitFrom()">保存</view>
2024-09-23 13:41:19 +08:00
2024-09-27 17:33:11 +08:00
<u-picker :show="show" :columns="columns" @cancel="cancel" @confirm="confirm" ></u-picker>
<u-picker :show="show1" :columns="columns1" @cancel="cancel1" @confirm="confirm1"
keyName="name"></u-picker>
2024-09-22 14:30:12 +08:00
</view>
</view>
</template>
<script>
import request from '../../utils/request';
export default {
data() {
return {
title: '',
List: [],
pageNo: 1,
pageSize: 10,
totalPage: '',
2024-09-23 13:41:19 +08:00
value: "xxxxxx",
value1: true,
show: false,
2024-09-27 10:20:09 +08:00
columns: [
['储值卡', '囤油卡']
],
2024-09-27 17:33:11 +08:00
show1: false,
columns1: [],
2024-09-26 13:45:57 +08:00
// 员工列表信息
staffList: [],
2024-09-27 10:20:09 +08:00
fleetInfo: {
2024-09-27 17:33:11 +08:00
cardType: '储值卡',
status: 'qy'
2024-09-27 10:20:09 +08:00
},
storeName: '',
2024-09-27 17:33:11 +08:00
storeList: [],
user: {},
fleetId:''
2024-09-22 14:30:12 +08:00
}
},
onPullDownRefresh() {
//下拉刷新
2024-09-23 13:41:19 +08:00
2024-09-22 14:30:12 +08:00
},
onReachBottom() {
// 触底加载
2024-09-26 13:45:57 +08:00
if (this.pageNo >= this.totalPage) {} else {
2024-09-22 14:30:12 +08:00
this.pageNo++
2024-09-23 13:41:19 +08:00
2024-09-22 14:30:12 +08:00
}
},
2024-09-27 17:33:11 +08:00
onLoad(e) {
if (e.fleetId){
this.fleetId = e.fleetId
this.getFleetInfo()
}else{
this.getUser()
this.getStoreList(uni.getStorageSync('storeId'))
}
},
onShow() {
},
2024-09-22 14:30:12 +08:00
components: {
},
methods: {
2024-09-27 17:33:11 +08:00
getFleetInfo() {
request({
url: '/fleetInfo/' + this.fleetId,
method: 'get',
}).then(res => {
if (res.code == 200) {
this.fleetInfo = res.data
this.getStoreList(res.data.storeId)
}
})
},
submitFrom(){
if (!this.fleetInfo.fleetName){
uni.showToast({
title:"请输入车队名称",
icon:'none'
})
return;
}
if (this.fleetInfo.id){
request({
url: '/fleetInfo',
method: 'put',
data:this.fleetInfo
}).then(res => {
uni.navigateTo({
url:'/pagesHome/cardDetails/index?type=fleet&fleetId='+res.data
})
})
}else{
request({
url: 'fleetInfo/addFleetInfo',
method: 'post',
data:this.fleetInfo
}).then(res => {
uni.navigateTo({
url:'/pagesHome/cardDetails/index?type=fleet&fleetId='+res.data
})
})
}
},
// 查询当前登录用户信息
getUser() {
request({
url: 'business/userManager/user/getUser',
method: 'get',
}).then(res => {
if (res.data) {
this.user = res.data
this.fleetInfo.fleetLeader = res.data.name
this.fleetInfo.mobile = res.data.mobile
this.fleetInfo.userId = res.data.id
}
})
},
getStoreList(storeId) {
2024-09-26 13:45:57 +08:00
request({
2024-09-27 10:20:09 +08:00
url: '/business/storeInformation/store/selectByStoreId',
2024-09-26 13:45:57 +08:00
method: 'get',
2024-09-27 10:20:09 +08:00
params: {
chainStoreId: uni.getStorageSync("chainStoreId"),
}
}).then(res => {
if (res.code == 200) {
this.storeList = res.data
this.storeList.forEach(item => {
2024-09-27 17:33:11 +08:00
if (item.id == storeId) {
2024-09-27 10:20:09 +08:00
this.storeName = item.name
2024-09-27 17:33:11 +08:00
this.fleetInfo.storeId = storeId
2024-09-27 10:20:09 +08:00
}
})
2024-09-27 17:33:11 +08:00
this.columns1 = []
this.columns1.push(this.storeList)
2024-09-27 10:20:09 +08:00
}
2024-09-26 13:45:57 +08:00
})
},
2024-09-27 17:33:11 +08:00
cancel1() {
this.show1 = false
},
confirm1(e) {
this.storeName = e.value[0].name
this.fleetInfo.storeId = e.value[0].id
this.show1 = false
},
2024-09-23 13:41:19 +08:00
cancel() {
this.show = false
},
2024-09-27 17:33:11 +08:00
confirm(e) {
this.fleetInfo.cardType = e.value[0]
2024-09-23 13:41:19 +08:00
this.show = false
},
2024-09-22 14:30:12 +08:00
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
2024-09-23 13:41:19 +08:00
padding-top: 10px;
2024-09-22 14:30:12 +08:00
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
2024-09-23 13:41:19 +08:00
2024-09-22 14:30:12 +08:00
.box-hang {
background-color: white;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
2024-09-23 13:41:19 +08:00
padding: 15px 15px;
2024-09-22 14:30:12 +08:00
border-bottom: 1px solid #f4f5f6;
}
2024-09-23 13:41:19 +08:00
2024-09-22 14:30:12 +08:00
.dis {
color: #a69999;
}
2024-09-23 13:41:19 +08:00
.box-end {
text-align: center;
margin-top: 10px;
}
.but-sub {
width: 305px;
height: 40px;
line-height: 40px;
margin: 0 auto;
background-color: #FF9655;
color: white;
border-radius: 50px;
text-align: center;
2024-09-23 17:39:15 +08:00
position: absolute;
2024-09-24 08:52:56 +08:00
bottom: 40px;
left: 11%;
2024-09-23 13:41:19 +08:00
}
2024-09-22 14:30:12 +08:00
</style>