<template>
|
<view class="full-page ">
|
<view class="list">
|
<up-form labelPosition="left" :model="state.publicJob" ref="formRef" labelWidth='140rpx'>
|
<view class="content c-p-l-24 c-p-b-120">
|
<up-form-item label="申请日期" prop="planStartTime" :borderBottom='false' ref="item1">
|
<up-input v-model="state.publicJob.planStartTime" border="none" placeholder="请点击选择部门"
|
readonly></up-input>
|
</up-form-item>
|
<up-form-item label="部门" prop="departmentId" :borderBottom='false' ref="item1">
|
<up-input v-model="state.publicJob.depart.name" border="none" placeholder="请点击选择部门"
|
readonly></up-input>
|
</up-form-item>
|
<up-form-item label="姓名" prop="name" :borderBottom='false' ref="item1">
|
<up-input v-model="state.publicJob.planPeople" border="none" placeholder="请填写姓名"
|
readonly></up-input>
|
</up-form-item>
|
<up-form-item label="请示类别" prop="name" :borderBottom='false' ref="item1">
|
<up-input v-model="leibie" border="none" placeholder="请填写姓名" readonly></up-input>
|
</up-form-item>
|
<up-form-item label="金额" prop="planMoney" :borderBottom='false' ref="item1">
|
<up-input v-model="state.publicJob.planMoney" border="none" placeholder="请填写金额"
|
type="digit"></up-input>
|
</up-form-item>
|
<up-form-item label="科目" prop="rewardContent" :borderBottom='false' ref="item1">
|
<up-input v-model="state.publicJob.rewardContent" border="none" placeholder="请点击选择科目"
|
readonly></up-input>
|
</up-form-item>
|
<up-form-item label="摘要" prop="planContent" :borderBottom='false' ref="item1">
|
<view class="c-p-b-20">
|
<up-textarea v-model="state.publicJob.planContent" border="none" readonly
|
placeholder="请填写摘要"></up-textarea>
|
</view>
|
</up-form-item>
|
<up-form-item label="发票" prop="idCardFace" v-if='state.publicJob.houbufapiaoStatus!=="Wu"'>
|
<view class="" v-if="state.invoice&&state.invoice.length>0">
|
<image class="fui-upload__img" v-for="(item,index) in state.invoice"
|
:style="{width:200+'rpx',height:200+'rpx'}" :key="item.keyid" :src="item"
|
mode="aspectFill" @tap.stop="previewImage(index,'invoice')"></image>
|
</view>
|
<view class="" v-else>
|
未上传发票
|
</view>
|
</up-form-item>
|
<up-form-item label="附件" prop="idCardFace">
|
<view class="" v-if="state.file&&state.file.length>0">
|
<image class="fui-upload__img" v-for="(item,index) in state.file"
|
:style="{width:200+'rpx',height:200+'rpx'}" :key="item.keyid" :src="item"
|
mode="aspectFill" @tap.stop="previewImage(index)"></image>
|
</view>
|
<view class="" v-else>
|
未上传附件
|
</view>
|
</up-form-item>
|
<up-form-item label="账户" prop="firmAccountId" required :borderBottom='false' ref="item1"
|
@click='openzhanghuPicker'>
|
<up-input v-model="state.publicJob.firmAccountName" border="none" placeholder="请点击选择账户"
|
readonly></up-input>
|
</up-form-item>
|
</view>
|
</up-form>
|
</view>
|
<view class="tabbtns">
|
<view class="chuany-flex">
|
<up-button type='success' class="text-69" :text="'付款'" :loading='isLoading' :loadingText="'付款中'"
|
@click="saveOrder('Yes')"></up-button>
|
<!-- <up-button color='#fece01' class="text-69" :text="'不批准'" :loading='isLoading' :loadingText="'提交中'"
|
@click="saveOrder('No')"></up-button> -->
|
</view>
|
|
</view>
|
<u-picker :show="zhanghuPicker" :columns="zhanghuList" keyName="accountName" @cancel='openzhanghuPicker'
|
:defaultIndex='defaultIndex' @confirm='confirmzhanghuPicker'></u-picker>
|
|
</view>
|
</template>
|
|
<script setup>
|
import {
|
apiBaseUrl
|
} from '@/common/setting/constVarsHelper.js';
|
import {
|
ref,
|
reactive,
|
getCurrentInstance,
|
onMounted,
|
computed
|
} from 'vue';
|
import {
|
onLoad,
|
onShow,
|
onReady,
|
onHide
|
} from "@dcloudio/uni-app";
|
const {
|
$upload,
|
$api,
|
$util,
|
$db
|
} = getCurrentInstance().appContext.config.globalProperties
|
let role = ref()
|
let detailId = ref()
|
let leibie = '费用报销'
|
let zhanghuPicker = ref(false)
|
let zhanghuList = ref()
|
let state = reactive({
|
publicJob: {
|
departmentId: '', //部门Id
|
departmentName: '',
|
depart: {},
|
name: '', //姓名
|
rewardResult: '', //科目id
|
rewardContent: '', //科目名称
|
planMoney: '', //金额
|
planContent: '', //摘要
|
houbufapiaoStatus: 'You', //有无发票
|
workPlanAttachments: [], //附件&发票
|
firmAccountId: ''
|
},
|
invoice: [],
|
file: []
|
})
|
let rules = {
|
firmAccountId: {
|
required: true,
|
message: '账户不能为空',
|
trigger: ['blur', 'change']
|
},
|
}
|
onLoad((options) => {
|
let data = $db.get('userInfo').userCompany
|
// role.value = options.role
|
detailId.value = options.detailId
|
getRolePlaneList()
|
$api.GetFirmAccountList().then(res => {
|
zhanghuList = [res.data]
|
})
|
})
|
|
const formRef = ref(null);
|
onReady(() => {
|
formRef.value.setRules(rules);
|
})
|
onShow(() => {})
|
onMounted(() => {
|
formRef.value.setRules(rules);
|
|
});
|
let isLoading = ref(false)
|
const previewImage = (index, val) => {
|
if (val === 'invoice') {
|
uni.previewImage({
|
current: state.invoice[index],
|
loop: true,
|
urls: state.invoice
|
})
|
} else {
|
uni.previewImage({
|
current: state.file[index],
|
loop: true,
|
urls: state.file
|
})
|
}
|
|
}
|
const confirmzhanghuPicker = (arr) => {
|
state.publicJob.firmAccountId = String(arr.value[0].keyid)
|
state.publicJob.firmAccountName = arr.value[0].accountName
|
openzhanghuPicker()
|
}
|
const openzhanghuPicker = () => {
|
zhanghuPicker.value = !zhanghuPicker.value
|
}
|
const getRolePlaneList = () => {
|
let getList = null
|
// if (role.value == 'zhuGuan') {
|
// getList = $api.zhuGuanGetPlanInfo
|
// } else {
|
// getList = $api.jingLiGetPlanInfo
|
// }
|
$api.caiWuGetPlanInfo(detailId.value).then(res => {
|
state.publicJob = res.data
|
state.publicJob.planStartTime = $util.formatDate(state.publicJob.planStartTime)
|
state.publicJob.workPlanAttachments.forEach(item => {
|
if (item.attachmentType == 1) {
|
state.invoice.push(item.planAttachment)
|
} else {
|
state.file.push(item.planAttachment)
|
}
|
})
|
})
|
}
|
const saveOrder = (approvalStatus) => {
|
isLoading.value = true
|
let functionOrder = null
|
// if (role.value == 'zhuGuan') {
|
// functionOrder = $api.ApprovalPlan
|
// } else {
|
// functionOrder = $api.BaoxiaoPlan
|
// }
|
let obj = {
|
oA_WorkPlanId: state.publicJob.keyid,
|
firmAccountId: state.publicJob.firmAccountId
|
}
|
formRef.value.validate().then(res => {
|
$api.caiWuApprovalPlan(obj).then(res => {
|
if (res.code == 1) {
|
uni.navigateBack()
|
$util.showToast({
|
title: "付款成功!",
|
icon: "success"
|
})
|
} else {
|
$util.showToast({
|
title: res.error
|
})
|
}
|
isLoading.value = false
|
})
|
})
|
|
}
|
</script>
|
|
<style>
|
.list {}
|
|
.u-button {
|
width: 280rpx !important;
|
margin: 0;
|
}
|
|
.content {
|
width: 100%;
|
box-sizing: border-box;
|
background-color: #fff;
|
}
|
|
.u-textarea {
|
padding: 0 !important;
|
}
|
|
.u-form-item__body {
|
padding: 5px 0 !important;
|
}
|
</style>
|