123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615 |
- <template>
- <view class="center">
- <view>
- <view class='wrap'>
- </view>
- <view class='wrap1'>
- <view class="c-row">
- <view class="title">车牌号</view>
- <view class="con-list">
- <picker :range="carNolist" range-key="carNo" @change='carnopicker($event)' mode="selector">
- <view>{{detailData.carNo?detailData.carNo:'请选择车牌号 >'}}</view>
- </picker>
- </view>
- </view>
- <view class="c-row">
- <view class="title">油耗(升)</view>
- <view class="con-list">
- <input type='digit' v-model='fillingDetail.oilConsumption' placeholder="请输入油耗"
- @input='calculate()'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">当前油价(元/升)</view>
- <view class="con-list">
- <input type="digit" v-model='fillingDetail.currentOilPrice' placeholder="请输入当前油价"
- @input='calculate()'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">计算金额(元)</view>
- <view class="con-list">
- <input type="digit" v-model='fillingDetail.currentConsumption' placeholder="不可编辑,自动计算"
- :disabled="true"></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">加油凭证</view>
- </view>
- <view class="voucher">
- <u-upload imageMode='aspectFill' class="upload" :ref="'upload'" name='fileName'
- :file-list="fillingDetail.fileList" :form-data="{companyId: pcUserInfo.compId,
- modelId: '',
- vesselId: ''}" :action="action" :max-size="maxSize" :max-count="9" :size-type="['compressed']"
- @on-success="getImgUrl($event)" @on-remove="onRemove($event)" :show-progress='false'
- :limitType="['png', 'jpg', 'jpeg', 'webp', 'gif']" @on-progress="onProgress"></u-upload>
- <!-- <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="c-row">
- <view class="left">备注</view>
- </view>
- <view style='position:relative;' class="wrap1 no-boder">
- <u-input ref='textarea' class='textarea' v-model="detailData.remark" :type="typeRemark" :border="border"
- placeholder="选填,不超过150字" :height="height" :auto-height="autoHeight" maxlength="150" />
- <view class="remark">
- {{detailData.remark?detailData.remark.length:'0'}}/150个字
- </view>
- </view>
- <view class="footer">
- <!-- <view class="c-row">
- <view class="title">总油耗(升)</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 class="button1" v-if="isUseSubmit">提交申请</view>
- <view @click='submitApply' class="button" v-else>提交申请</view>
- </view>
- </view>
- <u-modal v-model="show" @confirm='submit' content="确定提交申请信息?" :show-cancel-button='true'></u-modal>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import * as config from '../../config'
- import upload from '@/components/upload.vue';
- export default {
- components: {
- upload,
- },
- data() {
- return {
- isUseSubmit: false,
- amountDeadline: "",
- carNolist: [],
- detailData: {
- carNo: '',
- destinationProvince: "",
- destinationCity: "",
- destinationArea: "",
- carNo: "",
- originProvince: "",
- originCity: "",
- originArea: "",
- purpose: '库点费用',
- remark: "",
- warehouseName: '选择仓库',
- },
- height: 150,
- autoHeight: true,
- typeRemark: 'textarea',
- border: true,
- show: false,
- show1: false,
- purposeList: [{
- purpose: "合同费用"
- },
- {
- purpose: "库点费用"
- },
- ],
- pcUserInfo: uni.getStorageSync('pcUserInfo'),
- fillingDetail: {
- serialNumber: 1,
- oilConsumption: "",
- currentOilPrice: "",
- currentConsumption: "",
- addressUrl: [],
- compId: uni.getStorageSync('pcUserInfo').compId,
- commonId: uni.getStorageSync('pcUserInfo').userId,
- fillingId: "",
- tfc: "",
- totalCost: ""
- },
- action: config.def().baseUrlNew + 'appendix/api/uploadFiles',
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- btnLoading: false, //防止重复点击
- isAdd: true,
- tfc: "",
- totalCost: "",
- }
- },
- async onLoad(options) {
- //获取车牌号
- await this.$api.doRequest('get', '/carInfo/selectCars', {
- currentPage: 1,
- pageSize: 9999,
- compId: uni.getStorageSync('pcUserInfo').compId,
- })
- .then(res1 => {
- console.log(111)
- console.log(res1)
- if (res1.data.code == 200) {
- this.carNolist = res1.data.data.records
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- onShow() {
- },
- methods: {
- carnopicker(e) {
- this.detailData.carNo = this.carNolist[e.target.value].carNo
- this.$api.doRequest('get', '/fuelFillingInfo/gettime', {
- carNo: this.detailData.carNo,
- })
- .then(res => {
- console.log(111)
- console.log(res)
- if (res.data.data) {
- this.amountDeadline = res.data.data
- } else {
- uni.showModal({
- content: res.data.message,
- })
- this.isUseSubmit = true
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- async getPlace() {
- console.log(1)
- //获取形势轨迹
- await this.$api.doRequest('post', '/CarPostionController/api/gettrack', {
- // startDate:uni.getStorageSync('jyStartTime'),
- // endDate:uni.getStorageSync('jyEndTime'),
- startDate: "2023-02-20 01:00:00",
- endDate: "2023-02-20 24:00:00",
- }).then(res => {
- console.log(res)
- if (res1.data.code == 200) {
- // uni.hideLoading()
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- selectCon() {
- uni.navigateTo({
- url: '/pages/fuelfilling/selectContract'
- })
- },
- selectWare() {
- uni.navigateTo({
- url: '/pages/fuelfilling/selectWarehouse?warehouseType=1'
- })
- },
- ltCheck(e) {
- this.detailData.purpose = this.purposeList[e[0]].purpose
- if (this.detailData.purpose == "合同费用") {
- this.detailData.expensesPurpose = "1"
- delete this.detailData.warehouseName
- } else if (this.detailData.purpose == "库点费用") {
- this.detailData.expensesPurpose = "3"
- delete this.detailData.contractNo
- }
- console.log(this.detailData)
- },
- getImgUrl(res, index) {
- if (typeof(this.fillingDetail.addressUrl) == 'string') {
- this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
- }
- this.fillingDetail.addressUrl.push(res.data.appendixPath)
- console.log(this.fillingDetail)
- // console.log('------------res-----------')
- },
- onError(error) {
- alert(error)
- console.log('------------error-----------')
- console.log(error)
- },
- onProgress(e) {
- console.log(e)
- },
- onRemove(index, num) {
- if (typeof(this.fillingDetail.addressUrl) == 'string') {
- this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
- }
- this.fillingDetail.addressUrl.splice(index, 1)
- },
- filterFileType(index, lists) {
- console.log(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.currentConsumption = (this.fillingDetail.oilConsumption * this.fillingDetail
- .currentOilPrice).toFixed(2)
- },
- submitApply() {
- var that = this
- if (!that.fillingDetail.oilConsumption) {
- uni.showToast({
- title: "油耗不能为空!",
- icon: "none"
- })
- return
- }
- if (!that.fillingDetail.currentOilPrice) {
- uni.showToast({
- title: "当前油价不能为空!",
- icon: "none"
- })
- return
- }
- if (that.fillingDetail.addressUrl.length == 0) {
- uni.showToast({
- title: "请上传加油凭证!",
- icon: "none"
- })
- return
- }
- this.show = true
- },
- submit() {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- this.fillingDetail.tfc = this.tfc
- this.fillingDetail.totalCost = this.totalCost
- this.fillingDetail.compId = uni.getStorageSync('pcUserInfo').compId
- this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.toString()
- let _obj = {
- compId: uni.getStorageSync('pcUserInfo').compId,
- fillingDetailInfo: this.fillingDetail,
- carNo: this.detailData.carNo,
- flag: 1,
- remark: this.detailData.remark,
- amountDeadline: this.amountDeadline
- }
- console.log(_obj)
- this.$api.doRequest('post', '/fuelFillingInfo/api/addFilling', _obj)
- .then(res => {
- console.log(res)
- uni.hideLoading()
- uni.navigateBack()
- // if (res1.data.code == 200) {
- // this.titleBtn = "申请报销"
- // }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- // that.$api.doRequest('post', '/fillingDetailInfo/api/addFillingDetail',
- // that.fillingDetail
- // )
- // .then(res => {
- // uni.hideLoading()
- // if (res.data.code == 200) {
- // that.$api.msg('提交成功')
- // uni.navigateBack({
- // delta: 1
- // });
- // } else {
- // that.$api.msg(res.data.message)
- // }
- // })
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- .center {
- overflow: hidden;
- }
- 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;
- width: 100%;
- padding: 20px 10px;
- position: fixed;
- bottom: 0;
- .button {
- background: #4089ff;
- width: 90%;
- margin: 0px auto;
- padding: 10px;
- color: #fff;
- text-align: center;
- border-radius: 30px;
- margin-top: 10px;
- }
- .button1 {
- background: #F5F6FA;
- width: 90%;
- margin: 0px auto;
- padding: 10px;
- color: #9b9fa5;
- 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;
- }
- .remark {
- position: absolute;
- right: 10px;
- bottom: 20px;
- color: #AFB3BF;
- }
- .voucher {
- margin-left: 20rpx;
- }
- .wrap1 {
- /* padding-bottom: 10px; */
- font-size: 14px;
- /* background: #fff; */
- margin: 10px;
- border-radius: 10px;
- input {
- font-size: 14px;
- }
- >.title {
- padding: 10px 16px;
- }
- }
- /deep/.u-list-item {
- width: 27vw !important;
- height: 27vw !important;
- }
- </style>
|