123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- <template>
- <view class="center">
- <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='detailData.fillingDetailInfo.oilConsumption' placeholder="请输入油耗"
- @input='calculate()'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">当前油价(元/升)</view>
- <view class="con-list">
- <input type="digit" v-model='detailData.fillingDetailInfo.currentOilPrice' placeholder="请输入当前油价"
- @input='calculate()'></input>
- </view>
- </view>
- <view class="c-row">
- <view class="title">计算金额(元)</view>
- <view class="con-list">
- <input type="digit" v-model='detailData.fillingDetailInfo.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="detailData.fillingDetailInfo.urlList" :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>
- </view>
- </view>
- <view class="c-row">
- <view class="left">备注</view>
- </view>
- <view style='position:relative;' class="wrap1 no-boder">
- <u-input ref='textarea' :clearable='false' 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 @click='submitApply' class="button">提交申请</view>
- </view>
- </view>
-
- <u-modal v-model="show" @confirm='submit' content="确定提交申请信息?" :show-cancel-button='true'></u-modal>
- </view>
- </template>
- <script>
- import * as config from '../../config'
- import upload from '@/components/upload.vue';
- export default {
- components: {
- upload,
- },
- data() {
- return {
- id: "",
- carNolist: [],
- detailData: {
- fillingDetailInfo: {
- oilConsumption: ''
- }
- },
- height: 150,
- autoHeight: true,
- typeRemark: 'textarea',
- border: true,
- show: false,
- show1: false,
- purposeList: [{
- purpose: "合同费用"
- },
- {
- purpose: "库点费用"
- },
- ],
- pcUserInfo: uni.getStorageSync('pcUserInfo'),
- action: config.def().baseUrlNew + 'appendix/api/uploadFiles',
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- btnLoading: false, //防止重复点击
- isAdd: true,
- tfc: "",
- totalCost: "",
- }
- },
- onLoad(options) {
- console.log(options.id)
- this.id = options.id
- this.getInfo()
- },
- onShow() {
- },
- methods: {
- getInfo() {
- var that = this
- uni.showLoading({
- mask: true,
- title: "加载中..."
- })
- this.$api.doRequest('get', '/fuelFillingInfo/getFilling', {
- id: this.id
- }).then(res => {
- uni.hideLoading()
- if (res.data.code == 200) {
- this.detailData = res.data.data
- // if (this.detailData.fillingDetailInfoList) {
- // for (let i = 0; i < this.detailData.fillingDetailInfoList.length; i++) {
- let urlList = []
- if (this.detailData.fillingDetailInfo.addressUrl) {
- let datalist = this.detailData.fillingDetailInfo.addressUrl.split(",")
- for (let j = 0; j < datalist.length; j++) {
- urlList.push({
- url: datalist[j]
- })
- }
- this.detailData.fillingDetailInfo.urlList = urlList
- }
- }
- })
- },
- carnopicker(e) {
- this.detailData.carNo = this.carNolist[e.target.value].carNo
- },
- 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.detailData.fillingDetailInfo.addressUrl) == 'string') {
- this.detailData.fillingDetailInfo.addressUrl = this.detailData.fillingDetailInfo.addressUrl.split(',')
- }
- this.detailData.fillingDetailInfo.addressUrl.push(res.data.appendixPath)
- console.log(this.detailData.fillingDetailInfo)
- // console.log('------------res-----------')
- },
- onError(error) {
- alert(error)
- console.log('------------error-----------')
- console.log(error)
- },
- onProgress(e) {
- console.log(e)
- },
- onRemove(index, num) {
- if (typeof(this.detailData.fillingDetailInfo.addressUrl) == 'string') {
- this.detailData.fillingDetailInfo.addressUrl = this.detailData.fillingDetailInfo.addressUrl.split(',')
- }
- this.detailData.fillingDetailInfo.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() {
- this.detailData.fillingDetailInfo.currentConsumption = (this.detailData.fillingDetailInfo.oilConsumption *
- this.detailData.fillingDetailInfo.currentOilPrice).toFixed(2)
- },
- submitApply() {
- var that = this
- if (!this.detailData.fillingDetailInfo.oilConsumption) {
- uni.showToast({
- title: "油耗不能为空!",
- icon: "none"
- })
- return
- }
- if (!this.detailData.fillingDetailInfo.currentOilPrice) {
- uni.showToast({
- title: "当前油价不能为空!",
- icon: "none"
- })
- return
- }
- if (this.detailData.fillingDetailInfo.addressUrl.length == 0) {
- uni.showToast({
- title: "请上传加油凭证!",
- icon: "none"
- })
- return
- }
- this.show = true
- },
- submit() {
- var that = this
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- this.detailData.fillingDetailInfo.tfc = that.tfc
- this.detailData.fillingDetailInfo.totalCost = that.totalCost
- this.detailData.fillingDetailInfo.compId = uni.getStorageSync('pcUserInfo').compId
- this.detailData.fillingDetailInfo.addressUrl = this.detailData.fillingDetailInfo.addressUrl.toString()
- this.detailData.fillingDetailInfo.compId = uni.getStorageSync('pcUserInfo').compId
- this.detailData.flag = 2
- delete this.detailData.fillingDetailInfo.urlList
- that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling', this.detailData)
- .then(res => {
- console.log(res)
- uni.hideLoading()
- uni.showToast({
- title: '编辑成功',
- icon: "none"
- })
- setTimeout(()=>{
- uni.navigateBack()
- })
- // if (res1.data.code == 200) {
- // this.titleBtn = "申请报销"
- // }
- })
- .catch(res => {
- uni.showToast({
- title: res.message,
- icon: "none"
- })
- // uni.$u.toast(res.message);
- });
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- .center {
- overflow: hidden;
- padding-bottom:200rpx;
- }
- 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;
- }
- }
- .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: 8rpx;
- color: #AFB3BF;
- }
- /deep/.uni-textarea-textarea{
- height:61px;
-
- }
- .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>
|