123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- <template>
- <view class="center">
- <view>
- <view class='wrap'>
- <view class="c-row">
- <view class="title">车牌号</view>
- <view class="con-list">
- {{detailData.carNo}}
- </view>
- </view>
- <view class="c-row">
- <view class="title">行程轨迹</view>
- <view class="con-list">
- <view class="flex align-center">
- <view class="item1">
- <view class="ssx">{{$helper.getProvinceAbbreviation(detailData.originProvince)}}</view>
- <view class="level2-title">
- {{$helper.filterUrban(detailData.originCity)}}
- {{$helper.filterArea(detailData.originArea)}}
- </view>
- </view>
- <image class="jt-icon item2" src="@/static/images/fuel/jt.png" mode='widthFix'>
- </image>
- <view class="item3">
- <view class="ssx">{{$helper.getProvinceAbbreviation(detailData.destinationProvince)}}
- </view>
- <view class="level2-title">{{$helper.filterUrban(detailData.destinationCity)}}
- {{$helper.filterArea(detailData.destinationArea)}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class='wrap1' v-for="(item , index) in fillingDetail.fillingDetailInfoList" :Key="index">
- <view class="tit">加油-{{index+1}}</view>
- <image src="../../static/img/sign/jian@2x.png" class="eliminate1" @click="delApply(index)">
- </image>
- <image src="../../static/img/sign/jia@2x.png" class="eliminate2" @click="addApply(index)">
- </image>
- <view class="c-row">
- <view class="title">油耗(升)</view>
- <view class="con-list">
- <input v-model='item.oilConsumption' placeholder="请输入油耗" @input='calculate(index)'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">当前油价(元/升)</view>
- <view class="con-list">
- <input type="digit" v-model='item.currentOilPrice' placeholder="请输入当前油价"
- @input='calculate(index)'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">计算金额(元)</view>
- <view class="con-list">
- <input type="digit" v-model='item.currentConsumption' placeholder="不可编辑,自动计算"
- :disabled="true"></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">加油凭证</view>
- </view>
- <view class="voucher">
- <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="9"
- :size-type="['compressed']" @on-success="getImgUrl($event,index)" @on-error="onError"
- @on-remove="onRemove($event,index)" @on-uploaded="isAdd = true" :before-upload="filterFileType"
- @on-progress="onProgress"></upload>
- </view>
- </view>
- <view class="footer">
- <view class="c-row">
- <view class="title">总油耗(L)</view>
- <view class="con-list">
- <input :disabled="true" v-model='tfc' placeholder="不可编辑,自动计算" type="digit"></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">合计金额(元)</view>
- <view class="con-list">
- <input :disabled="true" v-model='totalCost' placeholder="不可编辑,自动计算" type="digit"></input>
- </view>
- </view>
- <view @click='submitApply' class="button">提交申请</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import upload from '@/components/upload.vue';
- export default {
- components: {
- upload,
- },
- data() {
- return {
- detailData: {
- carNo: '',
- destinationProvince: "",
- destinationCity: "",
- destinationArea: "",
- carNo: "",
- originProvince: "",
- originCity: "",
- originArea: "",
- },
- fillingDetail: {
- fillingDetailInfoList: [{
- oilConsumption: "",
- currentOilPrice: "",
- currentConsumption: "",
- addressUrl: [],
- compId: uni.getStorageSync('pcUserInfo').compId,
- commonId: uni.getStorageSync('pcUserInfo').userId,
- fillingId: "",
- }],
- tfc: "",
- totalCost: ""
- },
- action: this.$uploadUrl,
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- btnLoading: false, //防止重复点击
- isAdd: true,
- tfc: "",
- totalCost: ""
- }
- },
- onLoad(options) {
- this.id = options.id
- this.fillingDetail.fillingDetailInfoList[0].fillingId = this.id
- },
- onShow() {
- var that = this
- if (this.id) {
- this.seeInfo()
- }
- },
- methods: {
- seeInfo() {
- this.$api.doRequest('get', '/fuelFillingInfo/getFilling', {
- id: this.id
- }).then(res => {
- if (res.data.code == 200) {
- this.detailData = res.data.data
- }
- })
- },
- getImgUrl(res, index) {
- this.fillingDetail.fillingDetailInfoList[index].addressUrl.push(res)
- // if(this.fillingDetail.fillingDetailInfoList[index].addressUrl){
- // this.fillingDetail.fillingDetailInfoList[index].addressUrl = this.fillingDetail.fillingDetailInfoList[index].addressUrl +","+res
- // }else{
- // this.fillingDetail.fillingDetailInfoList[index].addressUrl = res
- // }
- // console.log(res)
- // console.log('------------res-----------')
- },
- onError(error) {
- alert(error)
- console.log('------------error-----------')
- console.log(error)
- },
- onProgress(e) {
- console.log(e)
- },
- onRemove(index, num) {
- this.fillingDetail.fillingDetailInfoList[num].addressUrl.splice(index, 1)
- },
- filterFileType(index, lists) {
- if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
- lists.splice(index, 1);
- // 当前文件不支持
- uni.showModal({
- title: '暂不支持当前图片类型',
- showCancel: false
- });
- } else {
- this.isAdd = false;
- }
- },
- calculate(index) {
- this.fillingDetail.fillingDetailInfoList[index].currentConsumption = (this.fillingDetail
- .fillingDetailInfoList[index].oilConsumption * this.fillingDetail.fillingDetailInfoList[index]
- .currentOilPrice)
- .toFixed(2)
- this.tfc = ""
- this.totalCost = ""
- for (let i = 0; i < this.fillingDetail.fillingDetailInfoList.length; i++) {
- this.tfc = (Number(this.tfc) + Number(this.fillingDetail.fillingDetailInfoList[i].oilConsumption))
- .toFixed(2)
- this.totalCost = (Number(this.totalCost) + Number(this.fillingDetail.fillingDetailInfoList[i]
- .currentConsumption)).toFixed(2)
- this.$forceUpdate()
- }
- },
- delApply(index) {
- this.fillingDetail.fillingDetailInfoList.splice(index, 1)
- },
- addApply() {
- this.fillingDetail.fillingDetailInfoList.push({
- oilConsumption: "",
- currentOilPrice: "",
- currentConsumption: "",
- addressUrl: [],
- compId: uni.getStorageSync('pcUserInfo').compId,
- commonId: uni.getStorageSync('pcUserInfo').userId,
- fillingId: this.id
- })
- },
- submitApply() {
- var that = this
- for (let i = 0; i < that.fillingDetail.fillingDetailInfoList.length; i++) {
- let count = i + 1
- if (!that.fillingDetail.fillingDetailInfoList[i].oilConsumption) {
- uni.showToast({
- title: "加油-" + count + " 油耗不能为空!",
- icon: "none"
- })
- return
- }
- if (!that.fillingDetail.fillingDetailInfoList[i].currentOilPrice) {
- uni.showToast({
- title: "加油-" + count + " 当前油价不能为空!",
- icon: "none"
- })
- return
- }
- if (that.fillingDetail.fillingDetailInfoList[i].addressUrl.length == 0) {
- uni.showToast({
- title: "加油-" + count + " 请上传加油凭证!",
- icon: "none"
- })
- return
- }
- }
- uni.showModal({
- content: "确定提交申请信息?",
- showCancel: true,
- confirmText: '提交',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- that.fillingDetail.tfc = that.tfc
- that.fillingDetail.totalCost = that.totalCost
- for (let i = 0; i < that.fillingDetail.fillingDetailInfoList.length; i++) {
- that.fillingDetail.fillingDetailInfoList[i].addressUrl = that.fillingDetail
- .fillingDetailInfoList[i].addressUrl.toString()
- }
- that.$api.doRequest('post', '/fillingDetailInfo/api/addFillingDetail',
- that.fillingDetail
- )
- .then(res => {
- uni.hideLoading()
- if (res.data.code == 200) {
- that.$api.msg('提交成功')
- uni.navigateTo({
- url: '/pages/fuelfilling/the_fuel_filling'
- })
- } else {
- that.$api.msg('提交失败')
- }
- })
- }
- }
- })
- },
- }
- }
- </script>
- <style lang='scss' scoped>
- .center {
- padding-bottom: 400rpx;
- }
- page {
- background: #F5F6FA;
- }
- .title_b {
- margin: 20rpx 20rpx 0rpx 20rpx;
- padding: 20rpx 10rpx 20rpx 10rpx;
- font-weight: 550;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- position: relative;
- }
- .level2-title {}
- .level2-title {
- font-weight: 700;
- color: #000000;
- }
- .jt-icon {
- position: relative;
- top: 6rpx;
- width: 60rpx;
- margin: 0 20rpx;
- }
- .xf-iamge {
- width: 74rpx;
- height: 43rpx;
- position: absolute;
- top: -20rpx;
- right: 0;
- }
- .ssx {
- width: 20px;
- height: 20px;
- background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 5px;
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- .item1,
- .item3 {
- // width: 40%;
- display: flex;
- .text {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- }
- .item1 .text {
- text-align: left;
- }
- .item3 .text {
- text-align: right;
- }
- }
- .align-center {
- align-items: center;
- justify-content: flex-end;
- }
- .wrap1 {
- background: #fff;
- margin: 10px;
- border-radius: 15px 10px;
- margin-top: 18px;
- input {}
- .tit {
- margin-left: 14px;
- width: 47px;
- padding-top: 10px;
- }
- .eliminate1 {
- max-width: 50%;
- width: 20px;
- height: 20px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 5px;
- margin-top: -20px;
- margin-left: 73px;
- }
- .eliminate2 {
- max-width: 50%;
- width: 20px;
- height: 20px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 5px;
- margin-top: -20px;
- margin-left: 100px;
- }
- .upload {
- /* margin-left: 157px; */
- }
- }
- .wrap {
- background: #fff;
- margin: 10px;
- border-radius: 15px 10px;
- margin-top: 18px;
- input {}
- >.title {
- padding: 10px 16px;
- }
- }
- .footer {
- background: #fff;
- position: fixed;
- bottom: 0;
- width: 100%;
- padding: 20px 10px;
- z-index: 10;
- height: 25%;
- .button {
- background: #4089ff;
- width: 90%;
- margin: 250px auto;
- padding: 10px;
- color: #fff;
- text-align: center;
- border-radius: 30px;
- margin-top: 10px;
- }
- }
- .buns_item {
- display: flex;
- padding: 80rpx 0 50rpx 0;
- justify-content: space-around;
- }
- .but_css {
- background: #22C572;
- width: 40%;
- padding: 20rpx;
- color: #fff;
- text-align: center;
- border-radius: 20rpx;
- }
- /deep/.u-radio-group {
- flex-direction: row-reverse;
- }
- .no-boder {
- border: 0;
- }
- .textarea {
- background: #F9F9FA;
- border: 1px solid #EEEEEE;
- }
- .voucher{
- margin-left: 20rpx;
- }
- </style>
|