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.
241 lines
8.9 KiB
241 lines
8.9 KiB
2 years ago
|
<template>
|
||
|
<!-- 布局 flex 组件 view -->
|
||
|
<view class="addDiver_body">
|
||
|
<!-- 卡片 -->
|
||
|
<view class="addDiver_card">
|
||
|
|
||
|
<view class="card_title">
|
||
|
<view class="tiao"></view>
|
||
|
<view style="display: flex;justify-content: space-between;width: 100%;" class="card_title_text">
|
||
|
<view>关联绑定企业</view>
|
||
|
<view @tap='clearFn' class="clear">
|
||
|
<image src="../../static/clear.png" mode="heightFix" style="height: 32rpx;margin-right: 10rpx;"></image>
|
||
|
清除
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
<uni-list>
|
||
|
<uni-list-item link="">
|
||
|
<view class="list_header" slot="header">
|
||
|
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image>
|
||
|
企业名称
|
||
|
</view>
|
||
|
<view style="" slot="body" class="list_right">
|
||
|
<view @tap="jump" slot="body" :style="{color:aboutEnterprise.name?'#333333':' '}" class="list_right list_nosele">
|
||
|
{{aboutEnterprise.name?aboutEnterprise.name:'请选择企业'}}
|
||
|
</view>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<!-- <uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image>
|
||
|
企业类型
|
||
|
</view>
|
||
|
<view slot="body" class="list_right">
|
||
|
<u-radio-group iconPlacement="right" v-model="enterpriseType" placement="row"
|
||
|
@change="groupChange">
|
||
|
<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1"
|
||
|
:key="index" :label="item.name" :name="item.name" @change="radioChange">
|
||
|
{{item.name}}
|
||
|
</u-radio>
|
||
|
</u-radio-group>
|
||
|
</view>
|
||
|
</uni-list-item> -->
|
||
|
<!-- <uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image>
|
||
|
企业车牌</view>
|
||
|
<view style="padding-right: 16px !important;" slot="body" class="list_right">
|
||
|
<view style="width: 100%; ">
|
||
|
<input v-model="aboutEnterprise.plateNumberCompany" placeholder="请输入企业车牌" class="list_right_input" />
|
||
|
</view>
|
||
|
</view>
|
||
|
</uni-list-item> -->
|
||
|
<uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
|
||
|
单日金额上限
|
||
|
</view>
|
||
|
<view slot="body" class="list_right ">
|
||
|
<view style="width: 100%;padding-right: 16px !important;display: flex; ">
|
||
|
<input @input="sxfn('orderAmountToplimit')" type="number" v-model="aboutEnterprise.dayAmountToplimit" class="list_right_input" />
|
||
|
<text class="yuan">元</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
<!-- <image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image> -->
|
||
|
单次金额上限
|
||
|
</view>
|
||
|
<view slot="body" class="list_right ">
|
||
|
<view style="width: 100%;padding-right: 16px !important;display: flex; ">
|
||
|
<input @input="sxfn('dayAmountToplimit')" type="number" v-model="aboutEnterprise.orderAmountToplimit" class="list_right_input" />
|
||
|
<text class="yuan">元</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
<!-- <image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image> -->
|
||
|
单日加油升数上限</view>
|
||
|
<view style="padding-right: 16px !important;display: flex;" slot="body" class="list_right ">
|
||
|
<input @input="sxfn('orderVolumeToplimit')" type="number" v-model="aboutEnterprise.dayVolumeToplimit" class="list_right_input" />
|
||
|
<text class="yuan">升</text>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<uni-list-item>
|
||
|
<view class="list_header" slot="header">
|
||
|
<!-- <image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image> -->
|
||
|
单笔加油升数上限</view>
|
||
|
<view style="padding-right: 16px !important;display: flex;" slot="body" class="list_right ">
|
||
|
<input @input="sxfn('dayVolumeToplimit')" type="number" v-model="aboutEnterprise.orderVolumeToplimit" class="list_right_input" />
|
||
|
<text class="yuan">升</text>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<uni-list-item v-if="aboutEnterprise.companyNature==1">
|
||
|
<view class="list_header" slot="header">
|
||
|
<image src="@/static/bt.png" style="width: 12rpx;position: absolute;left: 0;" mode="widthFix" ></image>
|
||
|
是否共享企业额度</view>
|
||
|
<view style="padding-right: 16px !important;" slot="body" class="list_right">
|
||
|
<u-switch :openText='openText' asyncChange activeColor='#17A00E' inactive-color="#BBBBBB"
|
||
|
size='35' v-model="switchOpen" @change="change"></u-switch>
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
<uni-list-item>
|
||
|
<view class="list_header" slot="header">备注</view>
|
||
|
<view style="padding-right: 16px !important;" slot="body" class="list_right ">
|
||
|
<input v-model="aboutEnterprise.remark" placeholder="请输入备注" class="list_right_input" />
|
||
|
</view>
|
||
|
</uni-list-item>
|
||
|
</uni-list>
|
||
|
</view>
|
||
|
<!-- 底部按钮 -->
|
||
|
<view class="list_footer" >
|
||
|
<button @tap="postFn" class="list_butten ">保存</button>
|
||
|
</view>
|
||
|
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import addDirver from '@/api/addDirver'
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
|
||
|
enterpriseType: '自营',
|
||
|
radiolist1: [{
|
||
|
name: '自营',
|
||
|
disabled: false
|
||
|
},
|
||
|
{
|
||
|
name: '外请',
|
||
|
disabled: false
|
||
|
},
|
||
|
],
|
||
|
aboutEnterprise:{
|
||
|
customerId:'',
|
||
|
customerCode:'',
|
||
|
companyId:'',
|
||
|
companyNature:1,
|
||
|
shareCompanyQuota:0,
|
||
|
dayAmountToplimit:'0',
|
||
|
orderAmountToplimit:'0',
|
||
|
dayVolumeToplimit:'0',
|
||
|
orderVolumeToplimit:'0',
|
||
|
name:'',
|
||
|
nickName:'',
|
||
|
plateNumberCompany:null,
|
||
|
remark:''
|
||
|
},
|
||
|
switchOpen: true,
|
||
|
openText: {
|
||
|
one: '开启',
|
||
|
off: '关闭'
|
||
|
},
|
||
|
}
|
||
|
},
|
||
|
onLoad(e) {
|
||
|
let that = this
|
||
|
uni.$on('company',function(data){
|
||
|
({id:that.aboutEnterprise.companyId,name:that.aboutEnterprise.name}=data)
|
||
|
console.log(data)
|
||
|
})
|
||
|
if(e.jsData){
|
||
|
let data = JSON.parse(e.jsData);
|
||
|
this.aboutEnterprise.customerId = data.customerId
|
||
|
this.aboutEnterprise.customerCode = data.customerCode
|
||
|
this.aboutEnterprise.companyId = data.companyId
|
||
|
this.aboutEnterprise.companyNature = data.companyNature
|
||
|
// this.aboutEnterprise.name = data.companyName
|
||
|
this.aboutEnterprise.nickName = data.nickName
|
||
|
console.log(that.aboutEnterprise,'-*-*-')
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
// 后端不做校验 前端做 骂娘找 后端
|
||
|
sxfn(e){
|
||
|
// if(e=='dayAmountToplimit'){
|
||
|
// if(this.aboutEnterprise.dayAmountToplimit!==''&& this.aboutEnterprise.orderAmountToplimit!=='' && Number(this.aboutEnterprise.orderAmountToplimit) > Number(this.aboutEnterprise.dayAmountToplimit) ){
|
||
|
// this.$nextTick(function(){
|
||
|
// this.aboutEnterprise.orderAmountToplimit = this.aboutEnterprise.dayAmountToplimit
|
||
|
// })
|
||
|
// }
|
||
|
// }else if(e=='dayVolumeToplimit'){
|
||
|
// if(this.aboutEnterprise.dayVolumeToplimit!==''&& this.aboutEnterprise.orderVolumeToplimit!=='' && Number(this.aboutEnterprise.orderVolumeToplimit) > Number(this.aboutEnterprise.dayVolumeToplimit) ){
|
||
|
// this.$nextTick(function(){
|
||
|
// this.aboutEnterprise.orderVolumeToplimit = this.aboutEnterprise.dayVolumeToplimit
|
||
|
// })
|
||
|
// }
|
||
|
// }else if(e=='orderVolumeToplimit'){
|
||
|
// if(this.aboutEnterprise.dayVolumeToplimit!==''&& this.aboutEnterprise.orderVolumeToplimit!=='' && Number(this.aboutEnterprise.orderVolumeToplimit) > Number(this.aboutEnterprise.dayVolumeToplimit) ){
|
||
|
// this.$nextTick(function(){
|
||
|
// this.aboutEnterprise.dayVolumeToplimit = Number(this.aboutEnterprise.orderVolumeToplimit) + 1
|
||
|
// })
|
||
|
// }
|
||
|
// }else if(e=='orderAmountToplimit'){
|
||
|
// if(this.aboutEnterprise.dayAmountToplimit!==''&& this.aboutEnterprise.orderAmountToplimit!=='' && Number(this.aboutEnterprise.orderAmountToplimit) > Number(this.aboutEnterprise.dayAmountToplimit) ){
|
||
|
// this.$nextTick(function(){
|
||
|
// this.aboutEnterprise.dayAmountToplimit = Number(this.aboutEnterprise.orderAmountToplimit ) + 1
|
||
|
// })
|
||
|
// }
|
||
|
// }
|
||
|
},
|
||
|
clearFn(){
|
||
|
let white = ['companyNature','shareCompanyQuota']
|
||
|
Object.keys(this.aboutEnterprise).forEach(key=>{
|
||
|
if(white.includes(key)) return
|
||
|
this.aboutEnterprise[key] = ''
|
||
|
})
|
||
|
this.aboutEnterprise.shareCompanyQuota = 1
|
||
|
this.switchOpen = true
|
||
|
},
|
||
|
postFn(){
|
||
|
let that = this
|
||
|
this.aboutEnterprise.shareCompanyQuota = this.switchOpen?1:0
|
||
|
addDirver.saveOilCard(this.aboutEnterprise).then(res=>{
|
||
|
if(res.code!==20000)return
|
||
|
uni.$emit('updateDriver',that.aboutEnterprise.customerId)
|
||
|
uni.navigateBack()
|
||
|
})
|
||
|
console.log(this.aboutEnterprise)
|
||
|
},
|
||
|
jump(){
|
||
|
uni.navigateTo({
|
||
|
url:'../company/company'
|
||
|
})
|
||
|
},
|
||
|
change(e) {
|
||
|
console.log(this.switchOpen,e)
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
@import url("./driver.css");
|
||
|
|
||
|
</style>
|