Commit 579dae7d9c600695a8f4cc27aa8570c9d939c9b7

Authored by gesilong
2 parents 89cef6cc 3820fc31

Merge branch 'cjerp-3.0-pay' into test_cjerp

  1 +import request from '@/utils/request'
  2 +import { ContentTypeEnum } from '@/utils/httpEnum'
  3 +
  4 +const region = 'cloud-api'
  5 +const baseUrl = '/procurement/fundPaymentRequest'
  6 +
  7 +/**
  8 + * 分页查询请款单列表
  9 + * params: pageIndex, pageSize, planCode, payeeName, workshopId,
  10 + * approvalStatus, startTime, endTime, createBy, deleted(boolean)
  11 + */
  12 +export function queryApi(params) {
  13 + return request({
  14 + url: baseUrl + '/query',
  15 + method: 'get',
  16 + params,
  17 + region
  18 + })
  19 +}
  20 +
  21 +// 根据ID查询详情数据
  22 +export function getDetailApi(id) {
  23 + return request({
  24 + url: baseUrl,
  25 + method: 'get',
  26 + params: { id },
  27 + region
  28 + })
  29 +}
  30 +
  31 +// 修改请款单
  32 +export function updateApi(params) {
  33 + return request({
  34 + url: baseUrl,
  35 + method: 'put',
  36 + data: params,
  37 + contentType: ContentTypeEnum.JSON,
  38 + region
  39 + })
  40 +}
  41 +
  42 +// 提交审核
  43 +export function submitApi(id) {
  44 + return request({
  45 + url: baseUrl + '/submit?id=' + id,
  46 + method: 'put',
  47 + region
  48 + })
  49 +}
  50 +
  51 +// 上传其它附件
  52 +export function uploadOtherFileApi(params) {
  53 + return request({
  54 + url: baseUrl + '/otherAttachment',
  55 + method: 'put',
  56 + data: params,
  57 + contentType: ContentTypeEnum.JSON,
  58 + region
  59 + })
  60 +}
  61 +
  62 +// 取消请款单
  63 +export function cancelApi(id) {
  64 + return request({
  65 + url: baseUrl + '/cancel?id=' + id,
  66 + method: 'put',
  67 + region
  68 + })
  69 +}
  70 +
  71 +// 作废请款单
  72 +export function invalidApi(id) {
  73 + return request({
  74 + url: baseUrl + '/invalid?id=' + id,
  75 + method: 'put',
  76 + region
  77 + })
  78 +}
  79 +
  80 +/**
  81 + * 资金支付供应商信息列表(PC: base-data/supplier-info,即 procurement/fundPaymentSupplier)
  82 + * 用于修改页对方户名/开户银行/账号级联下拉
  83 + */
  84 +export function supplierInfoQueryApi(params) {
  85 + return request({
  86 + url: '/procurement/fundPaymentSupplier/query',
  87 + method: 'get',
  88 + params,
  89 + region
  90 + })
  91 +}
  92 +
  93 +// 分厂下拉数据(PC: base-data/maker,即 baseData/workshop)
  94 +export function workshopQueryApi(params) {
  95 + return request({
  96 + url: '/baseData/workshop/query',
  97 + method: 'get',
  98 + params
  99 + })
  100 +}
... ...
... ... @@ -1459,6 +1459,38 @@
1459 1459 "navigationBarBackgroundColor": "#ffffff",
1460 1460 "navigationBarTextStyle": "black"
1461 1461 }
  1462 + },
  1463 + {
  1464 + "path": "pages/payment-request/index",
  1465 + "style": {
  1466 + "navigationBarTitleText": "请款单",
  1467 + "navigationBarBackgroundColor": "#ffffff",
  1468 + "navigationBarTextStyle": "black"
  1469 + }
  1470 + },
  1471 + {
  1472 + "path": "pages/payment-request/detail",
  1473 + "style": {
  1474 + "navigationBarTitleText": "请款单详情",
  1475 + "navigationBarBackgroundColor": "#ffffff",
  1476 + "navigationBarTextStyle": "black"
  1477 + }
  1478 + },
  1479 + {
  1480 + "path": "pages/payment-request/modify",
  1481 + "style": {
  1482 + "navigationBarTitleText": "编辑请款单",
  1483 + "navigationBarBackgroundColor": "#ffffff",
  1484 + "navigationBarTextStyle": "black"
  1485 + }
  1486 + },
  1487 + {
  1488 + "path": "pages/payment-request/upload",
  1489 + "style": {
  1490 + "navigationBarTitleText": "上传其它附件",
  1491 + "navigationBarBackgroundColor": "#ffffff",
  1492 + "navigationBarTextStyle": "black"
  1493 + }
1462 1494 }
1463 1495 ],
1464 1496 "tabBar": {
... ...
... ... @@ -239,6 +239,12 @@ export default {
239 239 icon: '/static/images/index/draft_order.png',
240 240 link: '/pages/outright-purchase/index',
241 241 name: 'OutrightPurchase'
  242 + },
  243 + {
  244 + text: '请款单',
  245 + icon: '/static/images/index/contract_unlocked_operation.png',
  246 + link: '/pages/payment-request/index',
  247 + name: 'PaymentRequest'
242 248 }
243 249 ]
244 250 },
... ...
  1 +<template>
  2 + <PaymentRequestViewer ref="viewer" :id="id" />
  3 +</template>
  4 +
  5 +<script>
  6 +import PaymentRequestViewer from './viewer.vue'
  7 +
  8 +export default {
  9 + name: 'PaymentRequestApprove',
  10 + components: { PaymentRequestViewer },
  11 + props: { id: { type: [String, Number], default: '' } },
  12 + methods: {
  13 + // 供 BPM 审批通过时取业务表单数据(variables)
  14 + getFormValues() {
  15 + return this.$refs.viewer ? this.$refs.viewer.getFormValues() : {}
  16 + },
  17 + // 供 BPM 审批通过前的校验钩子(请款单审批表单只读,无需校验)
  18 + checkForm() {
  19 + return true
  20 + }
  21 + }
  22 +}
  23 +</script>
... ...
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <!-- 基础信息 -->
  6 + <view class="section">
  7 + <view class="company-row">
  8 + <text class="company">{{ form.companyShortName || '-' }}</text>
  9 + <text v-if="requestKindName" class="kind-tag">{{ requestKindName }}</text>
  10 + </view>
  11 + <view :class="['status', `status_${form.approvalStatus}`]" />
  12 + <view class="row"><text class="label">分厂</text><text class="value">{{ form.workshopName || '-' }}</text></view>
  13 + <view class="row"><text class="label">计划编号</text><text class="value">{{ formatPlanCodes(form.planCodes) || '-' }}</text></view>
  14 + <view class="row"><text class="label">日期</text><text class="value">{{ form.requestDate || '-' }}</text></view>
  15 + <view class="row"><text class="label">付款方式</text><text class="value">{{ bizTypeName || '-' }}</text></view>
  16 + <view class="row"><text class="label">对方户名</text><text class="value">{{ form.payeeName || '-' }}</text></view>
  17 + <view class="row"><text class="label">开户银行</text><text class="value">{{ form.bankName || '-' }}</text></view>
  18 + <view class="row"><text class="label">账号</text><text class="value">{{ form.bankAccount || '-' }}</text></view>
  19 + <view class="row"><text class="label">创建人</text><text class="value">{{ form.createBy || '-' }}</text></view>
  20 + <view class="row"><text class="label">创建时间</text><text class="value">{{ form.createTime || '-' }}</text></view>
  21 + </view>
  22 +
  23 + <!-- 请款明细 -->
  24 + <view class="sub-table">
  25 + <view class="sub-header">
  26 + <image class="sub-bar" src="/static/images/title.png" />
  27 + <text class="sub-title">请款明细</text>
  28 + <view class="sub-toggle" @click="toggle('lines')">
  29 + <image class="sub-toggle_icon" :src="collapse.lines ? '/static/images/down.png' : '/static/images/up.png'" />
  30 + <text class="sub-toggle_text">{{ collapse.lines ? '展开' : '收起' }}</text>
  31 + </view>
  32 + </view>
  33 + <view v-if="!collapse.lines" class="sub-body">
  34 + <view v-if="!lines.length" class="empty-tip">暂无明细</view>
  35 + <view v-for="(item, idx) in lines" :key="idx" class="card">
  36 + <view class="card-index">第 {{ idx + 1 }} 行</view>
  37 + <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
  38 + <view class="row"><text class="label">预付金额</text><text class="value">{{ formatAmount(item.prepaidAmount) }}</text></view>
  39 + <view class="row"><text class="label">申请金额</text><text class="value">{{ formatAmount(item.applyAmount) }}</text></view>
  40 + </view>
  41 + <view class="total-row">
  42 + <text class="total-title">合计金额</text>
  43 + <view class="total-item">
  44 + <text class="total-label">预付金额</text>
  45 + <text class="total-value">{{ formatAmount(form.totalPrepayAmount) }}</text>
  46 + </view>
  47 + <view class="total-item">
  48 + <text class="total-label">申请金额</text>
  49 + <text class="total-value">{{ formatAmount(form.totalApplyAmount) }}</text>
  50 + </view>
  51 + </view>
  52 + </view>
  53 + </view>
  54 +
  55 + <!-- 补充信息 -->
  56 + <view class="title-header">
  57 + <image class="title-header_icon" src="/static/images/title.png" />
  58 + <span>补充信息</span>
  59 + </view>
  60 + <view class="section">
  61 + <view class="row"><text class="label">请款说明</text><text class="value">{{ form.requestRemark || '-' }}</text></view>
  62 + <view v-if="form.requestKind === 'SUPPLEMENT'" class="row">
  63 + <text class="label">补充说明</text><text class="value">{{ form.supplementRemark || '-' }}</text>
  64 + </view>
  65 + <view v-if="form.requestKind === 'SUPPLEMENT' && supplementFileList.length" class="row">
  66 + <text class="label">补充说明附件</text>
  67 + <view class="value">
  68 + <view v-for="(item, i) in supplementFileList" :key="item.fileId || i" class="file-item"
  69 + @click="downloadAttachment(item)">
  70 + <text class="value act">{{ item.fileName }}</text>
  71 + </view>
  72 + </view>
  73 + </view>
  74 + <view v-if="attachmentFileList.length" class="row">
  75 + <text class="label">请款附件</text>
  76 + <view class="value">
  77 + <view v-for="(item, i) in attachmentFileList" :key="item.fileId || i" class="file-item"
  78 + @click="downloadAttachment(item)">
  79 + <text class="value act">{{ item.fileName }}</text>
  80 + </view>
  81 + </view>
  82 + </view>
  83 + <view v-if="otherFileList.length" class="row">
  84 + <text class="label">其它附件</text>
  85 + <view class="value">
  86 + <view v-for="(item, i) in otherFileList" :key="item.fileId || i" class="file-item"
  87 + @click="downloadAttachment(item)">
  88 + <text class="value act">{{ item.fileName }}</text>
  89 + </view>
  90 + </view>
  91 + </view>
  92 + </view>
  93 + </view>
  94 + </scroll-view>
  95 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  96 + </view>
  97 +</template>
  98 +
  99 +<script>
  100 +import { getDetailApi, submitApi, cancelApi, invalidApi } from '@/api/payment-request.js'
  101 +import DetailButtons from '@/components/detail-buttons/index.vue'
  102 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  103 +import { downloadFile } from '@/utils/downloadFile.js'
  104 +
  105 +export default {
  106 + name: 'PaymentRequestDetail',
  107 + components: { DetailButtons },
  108 + data() {
  109 + return {
  110 + id: '',
  111 + form: {},
  112 + lines: [],
  113 + collapse: { lines: false },
  114 + buttons: [
  115 + { text: '修改', visible: true, variant: 'outline', event: 'edit' },
  116 + { text: '上传其它附件', visible: true, variant: 'outline', event: 'upload' },
  117 + { text: '提交审核', visible: true, variant: 'primary', event: 'submit' },
  118 + { text: '取消', visible: true, variant: 'outline', event: 'cancel', style: { color: 'rgba(0,0,0,0.9)', border: '1px solid #DCDCDC' } },
  119 + { text: '作废', visible: true, variant: 'danger', event: 'invalid' },
  120 + { text: '审批', visible: true, variant: 'primary', event: 'audit' },
  121 + { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
  122 + ],
  123 + dicOptions: {
  124 + DELIVERY_METHOD: [],
  125 + REQUEST_KIND: []
  126 + }
  127 + }
  128 + },
  129 + computed: {
  130 + statusFlags() {
  131 + const m = this.form || {}
  132 + const e = String(m.approvalStatus || '')
  133 + return {
  134 + isDraft: e === 'DRAFT',
  135 + isAudit: e === 'AUDIT',
  136 + isPass: e === 'PASS',
  137 + isRefuse: e === 'REFUSE',
  138 + canExamine: e === 'AUDIT' && m.showExamine === true,
  139 + canExamineDetail: m.showExamineDetail === true,
  140 + }
  141 + },
  142 + // 付款方式名称(code 转名称)
  143 + bizTypeName() {
  144 + const v = (this.form && this.form.bizType) || ''
  145 + if (!v) return ''
  146 + return getDicName('DELIVERY_METHOD', v, this.dicOptions.DELIVERY_METHOD) || v
  147 + },
  148 + // 请款单类型名称
  149 + requestKindName() {
  150 + const v = (this.form && this.form.requestKind) || ''
  151 + if (!v) return ''
  152 + return getDicName('REQUEST_KIND', v, this.dicOptions.REQUEST_KIND) || ''
  153 + },
  154 + displayButtons() {
  155 + const f = this.statusFlags
  156 + const isDeleted = this.form && this.form.deleted === true
  157 + return [
  158 + { ...this.buttons[0], visible: !isDeleted && (f.isDraft || f.isRefuse) && this.$auth.hasPermi('fund-payment:payment-request:modify') },
  159 + { ...this.buttons[1], visible: !isDeleted && f.isPass && this.$auth.hasPermi('fund-payment:payment-request:upload') },
  160 + { ...this.buttons[2], visible: !isDeleted && (f.isDraft || f.isRefuse) && this.$auth.hasPermi('fund-payment:payment-request:submit') },
  161 + { ...this.buttons[3], visible: !isDeleted && (f.isDraft || f.isRefuse) && this.$auth.hasPermi('fund-payment:payment-request:cancel') },
  162 + { ...this.buttons[4], visible: !isDeleted && f.isPass && this.$auth.hasPermi('fund-payment:payment-request:invalid') },
  163 + { ...this.buttons[5], visible: !isDeleted && f.canExamine && this.$auth.hasPermi('fund-payment:payment-request:approve') },
  164 + { ...this.buttons[6], visible: !isDeleted && f.canExamineDetail && this.$auth.hasPermi('fund-payment:payment-request:view') },
  165 + ]
  166 + },
  167 + // 请款附件列表(多文件逗号分隔解析)
  168 + attachmentFileList() {
  169 + return this.parseAttachmentList(
  170 + (this.form && this.form.requestFileIds) || (this.form && this.form.attachmentFileIds) || '',
  171 + (this.form && this.form.requestFileName) || (this.form && this.form.attachmentFileNames) || ''
  172 + )
  173 + },
  174 + // 补充说明附件列表
  175 + supplementFileList() {
  176 + return this.parseAttachmentList(
  177 + (this.form && this.form.supplementFileIds) || '',
  178 + (this.form && this.form.supplementFileNames) || ''
  179 + )
  180 + },
  181 + // 其它附件列表
  182 + otherFileList() {
  183 + return this.parseAttachmentList(
  184 + (this.form && this.form.otherFileIds) || '',
  185 + (this.form && this.form.otherFileNames) || ''
  186 + )
  187 + },
  188 + },
  189 + onLoad(query) {
  190 + this.id = (query && (query.id || query.code)) || ''
  191 + if (this.id) this.loadDetail(this.id)
  192 + },
  193 + onShow() {
  194 + // 修改/上传附件返回后刷新详情
  195 + let needRefresh = ''
  196 + try { needRefresh = uni.getStorageSync('PAYMENT_REQUEST_DETAIL_NEED_REFRESH') } catch (e) {}
  197 + if (!needRefresh) return
  198 + try { uni.removeStorageSync('PAYMENT_REQUEST_DETAIL_NEED_REFRESH') } catch (e) {}
  199 + if (this.id) this.loadDetail(this.id)
  200 + },
  201 + created() {
  202 + this.loadDicData()
  203 + },
  204 + methods: {
  205 + toggle(key) {
  206 + this.collapse = { ...this.collapse, [key]: !this.collapse[key] }
  207 + },
  208 + async loadDicData() {
  209 + try {
  210 + const results = await getDicByCodes(['DELIVERY_METHOD', 'REQUEST_KIND'])
  211 + this.dicOptions.DELIVERY_METHOD = (results.DELIVERY_METHOD && results.DELIVERY_METHOD.data) || []
  212 + this.dicOptions.REQUEST_KIND = (results.REQUEST_KIND && results.REQUEST_KIND.data) || []
  213 + } catch (e) {
  214 + this.dicOptions = { DELIVERY_METHOD: [], REQUEST_KIND: [] }
  215 + }
  216 + },
  217 + async loadDetail(id) {
  218 + uni.showLoading({ title: '加载中...', mask: true })
  219 + try {
  220 + const res = await getDetailApi(id)
  221 + const m = (res && res.data) || {}
  222 + this.form = m
  223 + this.lines = Array.isArray(m.lines) ? m.lines : []
  224 + } catch (e) {
  225 + this.form = {}
  226 + this.lines = []
  227 + uni.showToast({ title: '加载详情失败', icon: 'none' })
  228 + } finally {
  229 + uni.hideLoading()
  230 + }
  231 + },
  232 + // 附件字段(多文件逗号分隔)解析为文件列表
  233 + parseAttachmentList(idsStr, namesStr) {
  234 + const ids = String(idsStr || '').split(',').map(x => x.trim()).filter(Boolean)
  235 + const names = String(namesStr || '').split(',').map(x => x.trim())
  236 + return ids.map((id, idx) => ({
  237 + fileId: id,
  238 + fileName: names[idx] || `附件${idx + 1}`
  239 + }))
  240 + },
  241 + downloadAttachment(item) {
  242 + const id = (item && item.fileId) || ''
  243 + const fileName = (item && item.fileName) || ''
  244 + if (!id) return
  245 + downloadFile(id, fileName)
  246 + },
  247 + // 计划编号格式化(接口返回数组,转为逗号分隔文本)
  248 + formatPlanCodes(v) {
  249 + if (v === null || v === undefined || v === '') return ''
  250 + if (Array.isArray(v)) return v.filter(Boolean).join(',')
  251 + return String(v)
  252 + },
  253 + formatAmount(v) {
  254 + if (v === null || v === undefined || v === '') return '-'
  255 + const n = Number(v)
  256 + if (isNaN(n)) return String(v)
  257 + return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
  258 + },
  259 + handleButtonClick(btn) {
  260 + if (!btn || btn.disabled) return
  261 + const map = {
  262 + edit: () => this.onEdit(),
  263 + upload: () => this.onUpload(),
  264 + submit: () => this.onSubmitReview(),
  265 + cancel: () => this.onCancel(),
  266 + invalid: () => this.onInvalid(),
  267 + audit: () => this.onAudit(),
  268 + auditDetail: () => this.onAuditDetail(),
  269 + }
  270 + const fn = map[btn.event]
  271 + if (typeof fn === 'function') fn()
  272 + },
  273 + onEdit() {
  274 + const id = this.form.id || this.id
  275 + if (id) uni.navigateTo({ url: `/pages/payment-request/modify?id=${id}` })
  276 + },
  277 + onUpload() {
  278 + const id = this.form.id || this.id
  279 + if (id) uni.navigateTo({ url: `/pages/payment-request/upload?id=${id}` })
  280 + },
  281 + // 提交审核
  282 + onSubmitReview() {
  283 + const id = this.form.id || this.id
  284 + if (!id) return
  285 + uni.showModal({
  286 + title: '提示',
  287 + content: '确认提交审核吗?',
  288 + success: async (res) => {
  289 + if (res.confirm) {
  290 + try {
  291 + await submitApi(id)
  292 + uni.showToast({ title: '提交审核成功', icon: 'success' })
  293 + this.afterAction()
  294 + } catch (e) {
  295 + uni.showToast({ title: (e && e.msg) || '提交审核失败', icon: 'none' })
  296 + }
  297 + }
  298 + }
  299 + })
  300 + },
  301 + // 取消
  302 + onCancel() {
  303 + const id = this.form.id || this.id
  304 + if (!id) return
  305 + uni.showModal({
  306 + title: '提示',
  307 + content: '确认取消该请款单吗?',
  308 + success: async (res) => {
  309 + if (res.confirm) {
  310 + try {
  311 + await cancelApi(id)
  312 + uni.showToast({ title: '取消成功', icon: 'success' })
  313 + this.afterAction()
  314 + } catch (e) {
  315 + uni.showToast({ title: (e && e.msg) || '取消失败', icon: 'none' })
  316 + }
  317 + }
  318 + }
  319 + })
  320 + },
  321 + // 作废
  322 + onInvalid() {
  323 + const id = this.form.id || this.id
  324 + if (!id) return
  325 + uni.showModal({
  326 + title: '提示',
  327 + content: '确认作废该请款单吗?',
  328 + success: async (res) => {
  329 + if (res.confirm) {
  330 + try {
  331 + await invalidApi(id)
  332 + uni.showToast({ title: '作废成功', icon: 'success' })
  333 + this.afterAction()
  334 + } catch (e) {
  335 + uni.showToast({ title: (e && e.msg) || '作废失败', icon: 'none' })
  336 + }
  337 + }
  338 + }
  339 + })
  340 + },
  341 + // 审批:写入业务 id 后跳转 BPM 待办审核页
  342 + onAudit() {
  343 + uni.setStorageSync('sourceBusinessId', this.form.id || this.id)
  344 + uni.navigateTo({ url: '/pages/flow/audit' })
  345 + },
  346 + // 审核详情:写入业务 id 后跳转 BPM 流程实例页
  347 + onAuditDetail() {
  348 + uni.setStorageSync('sourceBusinessId', this.form.id || this.id)
  349 + uni.navigateTo({ url: '/pages/flow/audit_detail' })
  350 + },
  351 + // 操作成功后:刷新列表并返回
  352 + afterAction() {
  353 + try { uni.setStorageSync('PAYMENT_REQUEST_LIST_NEED_REFRESH', '1') } catch (e) {}
  354 + setTimeout(() => { uni.navigateBack() }, 400)
  355 + }
  356 + }
  357 +}
  358 +</script>
  359 +
  360 +<style lang="scss" scoped>
  361 +.page {
  362 + display: flex;
  363 + flex-direction: column;
  364 + height: 100%;
  365 +}
  366 +
  367 +.scroll {
  368 + flex: 1;
  369 + padding: 8rpx 0 144rpx;
  370 +}
  371 +
  372 +.detail-page {
  373 + background: #f3f3f3;
  374 +}
  375 +
  376 +.section {
  377 + padding: 32rpx;
  378 + background: #fff;
  379 + margin-bottom: 20rpx;
  380 + position: relative;
  381 +
  382 + .status {
  383 + position: absolute;
  384 + top: 16rpx;
  385 + right: 52rpx;
  386 + width: 180rpx;
  387 + height: 146rpx;
  388 + background-repeat: no-repeat;
  389 + background-size: 100% 100%;
  390 + background-position: center;
  391 +
  392 + &_AUDIT {
  393 + background-image: url('~@/static/images/dev_manage/status_1.png');
  394 + }
  395 +
  396 + &_PASS {
  397 + background-image: url('~@/static/images/dev_manage/status_2.png');
  398 + }
  399 +
  400 + &_REFUSE {
  401 + background-image: url('~@/static/images/dev_manage/status_3.png');
  402 + }
  403 +
  404 + &_CANCEL {
  405 + background-image: url('~@/static/images/dev_manage/status_4.png');
  406 + }
  407 + }
  408 +}
  409 +
  410 +.company-row {
  411 + display: flex;
  412 + align-items: center;
  413 + margin-bottom: 32rpx;
  414 +
  415 + .company {
  416 + font-size: 36rpx;
  417 + font-weight: 600;
  418 + color: rgba(0, 0, 0, 0.9);
  419 + padding-top: 10rpx;
  420 + line-height: 50rpx;
  421 + }
  422 +
  423 + .kind-tag {
  424 + flex-shrink: 0;
  425 + margin-left: 16rpx;
  426 + margin-top: 10rpx;
  427 + padding: 4rpx 12rpx;
  428 + border-radius: 6rpx;
  429 + font-size: 22rpx;
  430 + line-height: 32rpx;
  431 + background: #FFF1E9;
  432 + color: #E37318;
  433 + }
  434 +}
  435 +
  436 +.row {
  437 + display: flex;
  438 + margin-bottom: 28rpx;
  439 +
  440 + &:last-child {
  441 + margin-bottom: 0;
  442 + }
  443 +
  444 + .label {
  445 + max-width: 420rpx;
  446 + margin-right: 20rpx;
  447 + line-height: 32rpx;
  448 + font-size: 28rpx;
  449 + color: rgba(0, 0, 0, 0.6);
  450 + }
  451 +
  452 + .value {
  453 + flex: 1;
  454 + line-height: 32rpx;
  455 + font-size: 28rpx;
  456 + color: rgba(0, 0, 0, 0.9);
  457 + text-align: right;
  458 + word-break: break-all;
  459 +
  460 + &.act {
  461 + color: $theme-primary;
  462 + }
  463 + }
  464 +
  465 + .file-item {
  466 + margin-bottom: 12rpx;
  467 +
  468 + &:last-child {
  469 + margin-bottom: 0;
  470 + }
  471 + }
  472 +}
  473 +
  474 +.title-header {
  475 + display: flex;
  476 + align-items: center;
  477 + padding: 24rpx 32rpx 12rpx;
  478 + background-color: #ffffff;
  479 +
  480 + .title-header_icon {
  481 + width: 36rpx;
  482 + height: 36rpx;
  483 + margin-right: 12rpx;
  484 + }
  485 +
  486 + span {
  487 + font-size: 34rpx;
  488 + font-weight: 600;
  489 + color: rgba(0, 0, 0, 0.9);
  490 + }
  491 +}
  492 +
  493 +.sub-table {
  494 + background: #fff;
  495 + margin-bottom: 20rpx;
  496 +}
  497 +
  498 +.sub-header {
  499 + display: flex;
  500 + align-items: center;
  501 + padding: 16rpx 0 16rpx 32rpx;
  502 +
  503 + .sub-bar {
  504 + width: 6rpx;
  505 + height: 32rpx;
  506 + margin-right: 14rpx;
  507 + }
  508 +
  509 + .sub-title {
  510 + font-size: 30rpx;
  511 + font-weight: 600;
  512 + color: rgba(0, 0, 0, 0.9);
  513 + flex: 1;
  514 + line-height: 42rpx;
  515 + }
  516 +
  517 + .sub-toggle {
  518 + display: flex;
  519 + align-items: center;
  520 + padding: 0 12rpx;
  521 + height: 56rpx;
  522 +
  523 + .sub-toggle_icon {
  524 + width: 24rpx;
  525 + height: 24rpx;
  526 + margin-right: 8rpx;
  527 + }
  528 +
  529 + .sub-toggle_text {
  530 + font-size: 26rpx;
  531 + color: rgba(0, 0, 0, 0.6);
  532 + }
  533 + }
  534 +}
  535 +
  536 +.sub-body {
  537 + padding: 0 32rpx 24rpx;
  538 +
  539 + .empty-tip {
  540 + text-align: center;
  541 + padding: 60rpx 0;
  542 + color: rgba(0, 0, 0, 0.4);
  543 + font-size: 28rpx;
  544 + }
  545 +
  546 + .card {
  547 + position: relative;
  548 + background: #fafafa;
  549 + border-radius: 12rpx;
  550 + padding: 32rpx 28rpx 20rpx;
  551 + margin-bottom: 24rpx;
  552 +
  553 + .card-index {
  554 + position: absolute;
  555 + top: 0;
  556 + right: 0;
  557 + background: rgba(24, 144, 255, 0.08);
  558 + color: $theme-primary;
  559 + font-size: 22rpx;
  560 + line-height: 36rpx;
  561 + padding: 0 16rpx;
  562 + border-bottom-left-radius: 12rpx;
  563 + border-top-right-radius: 12rpx;
  564 + }
  565 +
  566 + .row {
  567 + align-items: center;
  568 + justify-content: space-between;
  569 + padding: 14rpx 0;
  570 + margin-bottom: 0;
  571 + border-bottom: 1rpx dashed #f2f2f2;
  572 +
  573 + &:last-child {
  574 + border-bottom: none;
  575 + }
  576 +
  577 + .label {
  578 + flex-shrink: 0;
  579 + width: 220rpx;
  580 + max-width: none;
  581 + margin-right: 0;
  582 + font-size: 28rpx;
  583 + color: rgba(0, 0, 0, 0.6);
  584 + line-height: 40rpx;
  585 + }
  586 +
  587 + .value {
  588 + flex: 1;
  589 + text-align: right;
  590 + font-size: 28rpx;
  591 + color: rgba(0, 0, 0, 0.9);
  592 + line-height: 40rpx;
  593 + overflow: hidden;
  594 + text-overflow: ellipsis;
  595 + white-space: nowrap;
  596 + }
  597 + }
  598 + }
  599 +
  600 + .total-row {
  601 + display: flex;
  602 + align-items: center;
  603 + padding: 20rpx 28rpx;
  604 + border-radius: 12rpx;
  605 + border: 1rpx solid #e5e6eb;
  606 + background: #fafafa;
  607 +
  608 + .total-title {
  609 + flex-shrink: 0;
  610 + font-size: 28rpx;
  611 + font-weight: 600;
  612 + color: rgba(0, 0, 0, 0.9);
  613 + margin-right: 32rpx;
  614 + }
  615 +
  616 + .total-item {
  617 + display: flex;
  618 + align-items: center;
  619 + margin-right: 32rpx;
  620 +
  621 + &:last-child {
  622 + margin-right: 0;
  623 + }
  624 +
  625 + .total-label {
  626 + font-size: 26rpx;
  627 + color: rgba(0, 0, 0, 0.6);
  628 + margin-right: 8rpx;
  629 + }
  630 +
  631 + .total-value {
  632 + font-size: 26rpx;
  633 + color: rgba(0, 0, 0, 0.9);
  634 + }
  635 + }
  636 + }
  637 +}
  638 +</style>
... ...
  1 +<template>
  2 + <view class="page">
  3 + <view class="dev-list-fixed">
  4 + <view class="search-row">
  5 + <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入计划编号" clearButton="auto"
  6 + cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search"
  7 + @input="onSearchInput" />
  8 + <view class="tool-icons">
  9 + <image class="tool-icon" src="/static/images/dev_manage/filter_icon.png" @click="openFilter" />
  10 + </view>
  11 + </view>
  12 + <view class="tabs">
  13 + <view v-for="(t, i) in tabs" :key="i" :class="['tab', { active: deleted === t.value }]"
  14 + @click="switchTab(t)">
  15 + {{ t.label }}
  16 + </view>
  17 + </view>
  18 + </view>
  19 +
  20 + <!-- 列表卡片组件 -->
  21 + <view class="list-box">
  22 + <card-list ref="cardRef" :fetch-fn="fetchList" :query="query" :extra="extraParams" row-key="id"
  23 + :enable-refresh="true" :enable-load-more="true" @loaded="onCardLoaded" @error="onCardError">
  24 + <template v-slot="{ item }">
  25 + <view class="card" @click.stop="onCardClick(item)">
  26 + <view class="card-header">
  27 + <text class="title omit2">{{ item.payeeName || '-' }}</text>
  28 + <text :class="['status', `status_${item.approvalStatus}`]">{{ getAuditStatusText(item.approvalStatus) }}</text>
  29 + </view>
  30 + <view class="info-row">
  31 + <text>计划编号</text>
  32 + <text>{{ formatPlanCodes(item.planCodes) || '-' }}</text>
  33 + </view>
  34 + <view class="info-row">
  35 + <text>分厂</text>
  36 + <text>{{ item.workshopName || '-' }}</text>
  37 + </view>
  38 + <view class="info-row">
  39 + <text>类型</text>
  40 + <text :class="['category', { 'category_SUPPLEMENT': item.requestKind === 'SUPPLEMENT' }]">{{ getRequestKindText(item.requestKind) }}</text>
  41 + </view>
  42 + <view class="info-row">
  43 + <text>日期</text>
  44 + <text>{{ item.requestDate || '-' }}</text>
  45 + </view>
  46 + <view class="info-row">
  47 + <text>创建人</text>
  48 + <text>{{ item.createBy || '-' }}</text>
  49 + </view>
  50 + </view>
  51 + </template>
  52 + </card-list>
  53 + </view>
  54 +
  55 + <!-- 筛选弹框 -->
  56 + <filter-modal :visible.sync="filterVisible" :value.sync="filterForm" title="筛选" @reset="onFilterReset"
  57 + @confirm="onFilterConfirm">
  58 + <template v-slot="{ model }">
  59 + <view class="filter-form">
  60 + <view class="form-item">
  61 + <view class="label">户名</view>
  62 + <input class="input" v-model="model.payeeName" placeholder="请输入户名" />
  63 + </view>
  64 + <view class="form-item">
  65 + <view class="label">分厂</view>
  66 + <picker mode="selector" :range="workshopLabels" @change="onWorkshopChange($event, model)">
  67 + <view class="fake-select">
  68 + <text v-if="workshopLabel" class="value">{{ workshopLabel }}</text>
  69 + <text v-else class="placeholder">请选择分厂</text>
  70 + </view>
  71 + </picker>
  72 + </view>
  73 + <view class="form-item">
  74 + <view class="label">审核状态</view>
  75 + <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
  76 + v-model="model.approvalStatus" :localdata="approvalStatusOptions" />
  77 + </view>
  78 + <view class="form-item">
  79 + <view class="label">创建人</view>
  80 + <input class="input" v-model="model.createBy" placeholder="请输入创建人" />
  81 + </view>
  82 + <view class="form-item">
  83 + <view class="label">创建时间</view>
  84 + <uni-datetime-picker type="daterange" v-model="model.timeRange" start="2023-01-01" />
  85 + </view>
  86 + </view>
  87 + </template>
  88 + </filter-modal>
  89 + </view>
  90 +</template>
  91 +
  92 +<script>
  93 +import CardList from '@/components/card/index.vue'
  94 +import FilterModal from '@/components/filter/index.vue'
  95 +import { queryApi, workshopQueryApi } from '@/api/payment-request.js'
  96 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  97 +
  98 +export default {
  99 + components: {
  100 + CardList,
  101 + FilterModal
  102 + },
  103 + data() {
  104 + return {
  105 + searchKeyword: '',
  106 + searchKeywordDebounced: '',
  107 + searchDebounceTimer: null,
  108 + // 有效/作废 tab(false=有效,true=作废)
  109 + deleted: false,
  110 + tabs: [
  111 + { label: '有效', value: false },
  112 + { label: '作废', value: true }
  113 + ],
  114 + // 给到 card 的筛选值
  115 + query: {
  116 + payeeName: '',
  117 + workshopId: '',
  118 + approvalStatus: '',
  119 + createBy: '',
  120 + timeRange: []
  121 + },
  122 + extraParams: {},
  123 + currentItems: [],
  124 + // 筛选弹框
  125 + filterVisible: false,
  126 + filterForm: {
  127 + payeeName: '',
  128 + workshopId: '',
  129 + approvalStatus: '',
  130 + createBy: '',
  131 + timeRange: []
  132 + },
  133 + // 分厂下拉选项
  134 + workshopOptions: [],
  135 + workshopLabel: '',
  136 + dicOptions: {
  137 + AUDIT_STATUS: [],
  138 + REQUEST_KIND: []
  139 + }
  140 + }
  141 + },
  142 + computed: {
  143 + workshopLabels() {
  144 + return ['全部'].concat(this.workshopOptions.map(it => it.label))
  145 + },
  146 + // 审核状态筛选选项(字典项转换为 {value, text})
  147 + approvalStatusOptions() {
  148 + return [{ value: '', text: '全部' }].concat(
  149 + (this.dicOptions.AUDIT_STATUS || []).map(it => ({ value: it.code, text: it.name }))
  150 + )
  151 + },
  152 + extraCombined() {
  153 + return {
  154 + planCode: this.searchKeywordDebounced || undefined,
  155 + deleted: this.deleted
  156 + }
  157 + }
  158 + },
  159 + watch: {
  160 + extraCombined: {
  161 + deep: true,
  162 + handler(v) {
  163 + this.extraParams = v
  164 + },
  165 + immediate: true
  166 + }
  167 + },
  168 + created() {
  169 + this.loadDicData()
  170 + this.loadWorkshopOptions()
  171 + },
  172 + onShow() {
  173 + let needRefresh = ''
  174 + try { needRefresh = uni.getStorageSync('PAYMENT_REQUEST_LIST_NEED_REFRESH') } catch (e) {}
  175 + if (!needRefresh) return
  176 + try { uni.removeStorageSync('PAYMENT_REQUEST_LIST_NEED_REFRESH') } catch (e) {}
  177 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.reload) {
  178 + this.$refs.cardRef.reload()
  179 + }
  180 + },
  181 + onReachBottom() {
  182 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) {
  183 + this.$refs.cardRef.onLoadMore()
  184 + }
  185 + },
  186 + beforeDestroy() {
  187 + if (this.searchDebounceTimer) {
  188 + clearTimeout(this.searchDebounceTimer)
  189 + this.searchDebounceTimer = null
  190 + }
  191 + },
  192 + methods: {
  193 + async loadDicData() {
  194 + const dicCodes = ['AUDIT_STATUS', 'REQUEST_KIND']
  195 + try {
  196 + const results = await getDicByCodes(dicCodes)
  197 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  198 + this.dicOptions.REQUEST_KIND = (results.REQUEST_KIND && results.REQUEST_KIND.data) || []
  199 + } catch (e) {
  200 + this.dicOptions = { AUDIT_STATUS: [], REQUEST_KIND: [] }
  201 + }
  202 + },
  203 + async loadWorkshopOptions() {
  204 + try {
  205 + const res = await workshopQueryApi({ pageIndex: 1, pageSize: 9999 })
  206 + const _data = (res && res.data) || {}
  207 + const datas = _data.datas || _data.list || _data.records || []
  208 + this.workshopOptions = datas.map(item => ({
  209 + label: item.name || '',
  210 + value: item.id || ''
  211 + })).filter(it => it.value)
  212 + } catch (e) {
  213 + this.workshopOptions = []
  214 + }
  215 + },
  216 + getAuditStatusText(status) {
  217 + const v = status == null ? '' : String(status)
  218 + if (!v) return '-'
  219 + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v
  220 + },
  221 + // 计划编号格式化(接口返回数组,转为逗号分隔文本)
  222 + formatPlanCodes(v) {
  223 + if (v === null || v === undefined || v === '') return ''
  224 + if (Array.isArray(v)) return v.filter(Boolean).join(',')
  225 + return String(v)
  226 + },
  227 + getRequestKindText(kind) {
  228 + const v = kind == null ? '' : String(kind)
  229 + if (!v) return '-'
  230 + return getDicName('REQUEST_KIND', v, this.dicOptions.REQUEST_KIND) || v
  231 + },
  232 + onCardLoaded({ items }) {
  233 + this.currentItems = items
  234 + },
  235 + onCardError() {
  236 + uni.showToast({ title: '列表加载失败', icon: 'none' })
  237 + },
  238 + // 输入实时搜索:1200ms 防抖
  239 + onSearchInput() {
  240 + if (this.searchDebounceTimer) clearTimeout(this.searchDebounceTimer)
  241 + this.searchDebounceTimer = setTimeout(() => {
  242 + this.searchKeywordDebounced = this.searchKeyword
  243 + this.searchDebounceTimer = null
  244 + }, 1200)
  245 + },
  246 + search(e) {
  247 + const val = e && e.value != null ? e.value : this.searchKeyword
  248 + this.searchKeyword = val
  249 + this.searchKeywordDebounced = val
  250 + },
  251 + // 有效/作废 tab 切换
  252 + switchTab(t) {
  253 + this.deleted = t.value
  254 + },
  255 + onWorkshopChange(e, model) {
  256 + const idx = Number(e.detail.value)
  257 + if (idx <= 0) {
  258 + model.workshopId = ''
  259 + this.workshopLabel = ''
  260 + } else {
  261 + const opt = this.workshopOptions[idx - 1]
  262 + model.workshopId = opt ? opt.value : ''
  263 + this.workshopLabel = opt ? opt.label : ''
  264 + }
  265 + },
  266 + openFilter() {
  267 + this.filterForm = {
  268 + payeeName: this.query.payeeName || '',
  269 + workshopId: this.query.workshopId || '',
  270 + approvalStatus: this.query.approvalStatus || '',
  271 + createBy: this.query.createBy || '',
  272 + timeRange: Array.isArray(this.query.timeRange) ? this.query.timeRange.slice(0) : []
  273 + }
  274 + const found = this.workshopOptions.find(it => it.value === this.filterForm.workshopId)
  275 + this.workshopLabel = found ? found.label : ''
  276 + this.filterVisible = true
  277 + },
  278 + onFilterReset(payload) {
  279 + this.filterForm = payload
  280 + this.workshopLabel = ''
  281 + },
  282 + onFilterConfirm(payload) {
  283 + this.query = {
  284 + payeeName: payload.payeeName || '',
  285 + workshopId: payload.workshopId || '',
  286 + approvalStatus: payload.approvalStatus || '',
  287 + createBy: payload.createBy || '',
  288 + timeRange: Array.isArray(payload.timeRange) ? payload.timeRange : []
  289 + }
  290 + },
  291 + // 列表接口
  292 + fetchList({ pageIndex, pageSize, query, extra }) {
  293 + const q = query || {}
  294 + const e = extra || {}
  295 + const range = Array.isArray(q.timeRange) ? q.timeRange : []
  296 + const params = {
  297 + pageIndex,
  298 + pageSize,
  299 + deleted: e.deleted === true,
  300 + planCode: e.keyword || '',
  301 + payeeName: q.payeeName || '',
  302 + workshopId: q.workshopId || '',
  303 + approvalStatus: q.approvalStatus || '',
  304 + createBy: q.createBy || '',
  305 + startTime: range && range.length === 2 ? range[0] : '',
  306 + endTime: range && range.length === 2 ? range[1] : ''
  307 + }
  308 + return queryApi(params)
  309 + .then(res => {
  310 + const _data = (res && res.data) || {}
  311 + const records = _data.datas || _data.list || _data.records || []
  312 + const totalCount = _data.totalCount || _data.count || 0
  313 + const hasNext = _data.hasNext || false
  314 + return { records, totalCount, hasNext }
  315 + })
  316 + .catch(err => {
  317 + console.error('fetchList error', err)
  318 + this.onCardError()
  319 + return { records: [], totalCount: 0, hasNext: false }
  320 + })
  321 + },
  322 + onCardClick(item) {
  323 + const id = (item && item.id) || ''
  324 + if (!id) return
  325 + uni.navigateTo({
  326 + url: '/pages/payment-request/detail?id=' + encodeURIComponent(id)
  327 + })
  328 + }
  329 + }
  330 +}
  331 +</script>
  332 +
  333 +<style lang="scss" scoped>
  334 +.page {
  335 + display: flex;
  336 + flex-direction: column;
  337 + height: 100vh;
  338 +}
  339 +
  340 +.dev-list-fixed {
  341 + position: fixed;
  342 + top: 96rpx;
  343 + left: 0;
  344 + right: 0;
  345 + z-index: 2;
  346 + background: #fff;
  347 +
  348 + .search-row {
  349 + display: flex;
  350 + align-items: center;
  351 + padding: 16rpx 32rpx;
  352 +
  353 + .uni-searchbar {
  354 + padding: 0;
  355 + flex: 1;
  356 + }
  357 +
  358 + .tool-icons {
  359 + display: flex;
  360 +
  361 + .tool-icon {
  362 + width: 48rpx;
  363 + height: 48rpx;
  364 + display: block;
  365 + margin-left: 32rpx;
  366 + }
  367 + }
  368 + }
  369 +
  370 + .tabs {
  371 + display: flex;
  372 + align-items: center;
  373 + justify-content: space-between;
  374 + padding: 26rpx 34rpx;
  375 + border-bottom: solid 1px #e7e7e7;
  376 +
  377 + .tab {
  378 + width: 50%;
  379 + text-align: center;
  380 + color: rgba(0, 0, 0, 0.9);
  381 + line-height: 44rpx;
  382 + position: relative;
  383 + font-size: 30rpx;
  384 + font-weight: 600;
  385 +
  386 + &.active {
  387 + color: $theme-primary;
  388 +
  389 + &::after {
  390 + content: '';
  391 + position: absolute;
  392 + left: 50%;
  393 + transform: translateX(-50%);
  394 + bottom: -13px;
  395 + width: 32rpx;
  396 + height: 6rpx;
  397 + border-radius: 4rpx;
  398 + background: $theme-primary;
  399 + }
  400 + }
  401 + }
  402 + }
  403 +}
  404 +
  405 +/* 仅当前页覆盖 uni-search-bar 盒子高度 */
  406 +::v-deep .uni-searchbar__box {
  407 + height: 80rpx !important;
  408 + justify-content: start;
  409 +
  410 + .uni-searchbar__box-search-input {
  411 + font-size: 32rpx !important;
  412 + }
  413 +}
  414 +
  415 +.list-box {
  416 + flex: 1;
  417 + padding-top: 236rpx;
  418 +
  419 + .card {
  420 + position: relative;
  421 + }
  422 +
  423 + .card-header {
  424 + margin-bottom: 28rpx;
  425 + position: relative;
  426 +
  427 + .title {
  428 + font-size: 36rpx;
  429 + font-weight: 600;
  430 + line-height: 50rpx;
  431 + color: rgba(0, 0, 0, 0.9);
  432 + width: 578rpx;
  433 + }
  434 +
  435 + .status {
  436 + font-weight: 600;
  437 + position: absolute;
  438 + top: -32rpx;
  439 + right: -12rpx;
  440 + height: 48rpx;
  441 + line-height: 48rpx;
  442 + color: #fff;
  443 + font-size: 24rpx;
  444 + padding: 0 14rpx;
  445 + border-radius: 6rpx;
  446 + box-sizing: content-box;
  447 +
  448 + // 草稿
  449 + &.status_DRAFT {
  450 + background: #e7e7e7;
  451 + color: rgba(0, 0, 0, 0.9);
  452 + }
  453 +
  454 + // 审核中
  455 + &.status_AUDIT {
  456 + background: $theme-primary;
  457 + }
  458 +
  459 + // 审核通过
  460 + &.status_PASS {
  461 + background: #2ba471;
  462 + }
  463 +
  464 + // 已驳回
  465 + &.status_REFUSE {
  466 + background: #d54941;
  467 + }
  468 +
  469 + // 已取消
  470 + &.status_CANCEL {
  471 + background: #e7e7e7;
  472 + color: rgba(0, 0, 0, 0.9);
  473 + }
  474 + }
  475 + }
  476 +
  477 + .info-row {
  478 + display: flex;
  479 + align-items: center;
  480 + color: rgba(0, 0, 0, 0.6);
  481 + font-size: 28rpx;
  482 + margin-bottom: 24rpx;
  483 + height: 32rpx;
  484 +
  485 + &:last-child {
  486 + margin-bottom: 0;
  487 + }
  488 +
  489 + text {
  490 + width: 50%;
  491 +
  492 + &:last-child {
  493 + color: rgba(0, 0, 0, 0.9);
  494 + width: 50%;
  495 + overflow: hidden;
  496 + text-overflow: ellipsis;
  497 + white-space: nowrap;
  498 + }
  499 +
  500 + &.category {
  501 + display: inline-block;
  502 + padding: 4rpx 12rpx;
  503 + border-radius: 6rpx;
  504 + font-size: 24rpx;
  505 + width: auto;
  506 +
  507 + // 补充请款单
  508 + &.category_SUPPLEMENT {
  509 + background: #FFF1E9;
  510 + color: #E37318;
  511 + }
  512 + }
  513 + }
  514 + }
  515 +}
  516 +
  517 +.filter-form {
  518 + .form-item {
  519 + margin-bottom: 24rpx;
  520 + }
  521 +
  522 + .label {
  523 + margin-bottom: 20rpx;
  524 + color: rgba(0, 0, 0, 0.9);
  525 + height: 44rpx;
  526 + line-height: 44rpx;
  527 + font-size: 30rpx;
  528 + }
  529 +
  530 + .input {
  531 + width: 100%;
  532 + height: 72rpx;
  533 + line-height: 72rpx;
  534 + padding: 0 24rpx;
  535 + border: 1rpx solid #e7e7e7;
  536 + border-radius: 8rpx;
  537 + font-size: 28rpx;
  538 + color: rgba(0, 0, 0, 0.9);
  539 + background: #fff;
  540 + box-sizing: border-box;
  541 + }
  542 +
  543 + .fake-select {
  544 + height: 72rpx;
  545 + line-height: 72rpx;
  546 + padding: 0 24rpx;
  547 + border: 1rpx solid #e7e7e7;
  548 + border-radius: 8rpx;
  549 + font-size: 28rpx;
  550 +
  551 + .value {
  552 + color: rgba(0, 0, 0, 0.9);
  553 + }
  554 +
  555 + .placeholder {
  556 + color: #999;
  557 + }
  558 + }
  559 +
  560 + .uni-easyinput {
  561 + border: 1rpx solid #f3f3f3;
  562 + }
  563 +}
  564 +
  565 +/* 深度覆盖 uni-data-checkbox(mode=tag)内部的 tag 展示与间距 */
  566 +::v-deep .filter-form .uni-data-checklist .checklist-group {
  567 + .checklist-box {
  568 + &.is--tag {
  569 + width: 212rpx;
  570 + margin-top: 0;
  571 + margin-bottom: 24rpx;
  572 + margin-right: 24rpx;
  573 + height: 80rpx;
  574 + padding: 0;
  575 + border-radius: 12rpx;
  576 + background-color: #f3f3f3;
  577 + border-color: #f3f3f3;
  578 +
  579 + &:nth-child(3n) {
  580 + margin-right: 0;
  581 + }
  582 +
  583 + .checklist-content {
  584 + display: flex;
  585 + justify-content: center;
  586 + }
  587 +
  588 + .checklist-text {
  589 + color: rgba(0, 0, 0, 0.9);
  590 + font-size: 28rpx;
  591 + }
  592 + }
  593 +
  594 + &.is-checked {
  595 + background-color: $theme-primary-plain-bg !important;
  596 + border-color: $theme-primary-plain-bg !important;
  597 +
  598 + .checklist-text {
  599 + color: $theme-primary !important;
  600 + }
  601 + }
  602 + }
  603 +}
  604 +</style>
... ...
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <!-- 基础信息 -->
  6 + <view class="section">
  7 + <view class="company-row">
  8 + <text class="company">{{ form.companyShortName || '-' }}</text>
  9 + <text v-if="requestKindName" class="kind-tag">{{ requestKindName }}</text>
  10 + </view>
  11 + <view class="row"><text class="label">分厂</text><text class="value">{{ form.workshopName || '-' }}</text></view>
  12 + <view class="row"><text class="label">计划编号</text><text class="value">{{ formatPlanCodes(form.planCodes) || '-' }}</text></view>
  13 + <view class="row"><text class="label">日期</text><text class="value">{{ form.requestDate || '-' }}</text></view>
  14 + </view>
  15 +
  16 + <!-- 收款信息 -->
  17 + <view class="title-header">
  18 + <image class="title-header_icon" src="/static/images/title.png" />
  19 + <span>收款信息</span>
  20 + </view>
  21 + <view class="section">
  22 + <uni-list>
  23 + <uni-list-item class="select-item" :class="form.payeeName ? 'is-filled' : 'is-empty'" clickable
  24 + :rightText="form.payeeName || '请选择'" showArrow @click="openSheet('payeeName')">
  25 + <template v-slot:body>
  26 + <view class="item-title"><text class="required">*</text><text>对方户名</text></view>
  27 + </template>
  28 + </uni-list-item>
  29 + <uni-list-item class="select-item" :class="form.bankName ? 'is-filled' : 'is-empty'" clickable
  30 + :rightText="form.bankName || '请选择'" showArrow @click="openSheet('bankName')">
  31 + <template v-slot:body>
  32 + <view class="item-title"><text class="required">*</text><text>开户银行</text></view>
  33 + </template>
  34 + </uni-list-item>
  35 + <uni-list-item class="select-item" :class="form.bankAccount ? 'is-filled' : 'is-empty'" clickable
  36 + :rightText="form.bankAccount || '请选择'" showArrow @click="openSheet('bankAccount')">
  37 + <template v-slot:body>
  38 + <view class="item-title"><text class="required">*</text><text>账号</text></view>
  39 + </template>
  40 + </uni-list-item>
  41 + </uni-list>
  42 + </view>
  43 +
  44 + <!-- 请款明细 -->
  45 + <view class="sub-table">
  46 + <view class="sub-header">
  47 + <image class="sub-bar" src="/static/images/title.png" />
  48 + <text class="sub-title">请款明细</text>
  49 + </view>
  50 + <view class="sub-body">
  51 + <view v-if="!lines.length" class="empty-tip">暂无明细</view>
  52 + <view v-for="(item, idx) in lines" :key="idx" class="card">
  53 + <view class="card-index">第 {{ idx + 1 }} 行</view>
  54 + <view class="row">
  55 + <text class="label">计划编号</text>
  56 + <text class="value">{{ item.planCode || '-' }}</text>
  57 + </view>
  58 + <view class="row">
  59 + <text class="label">预付金额</text>
  60 + <text class="value">{{ formatAmount(item.prepaidAmount) }}</text>
  61 + </view>
  62 + <view class="row">
  63 + <text class="label"><text class="required">*</text>申请金额</text>
  64 + <view class="amount-row">
  65 + <input class="amount-input" type="digit" v-model="item.applyAmount"
  66 + placeholder="请输入申请金额" placeholder-style="color: rgba(0,0,0,0.4); font-size: 28rpx;" />
  67 + </view>
  68 + </view>
  69 + </view>
  70 + <view class="total-row">
  71 + <text class="total-title">合计金额</text>
  72 + <view class="total-item">
  73 + <text class="total-label">预付金额</text>
  74 + <text class="total-value">{{ totalPrepaidAmount }}</text>
  75 + </view>
  76 + <view class="total-item">
  77 + <text class="total-label">申请金额</text>
  78 + <text class="total-value">{{ totalApplyAmount }}</text>
  79 + </view>
  80 + </view>
  81 + </view>
  82 + </view>
  83 +
  84 + <!-- 补充信息 -->
  85 + <view class="title-header">
  86 + <image class="title-header_icon" src="/static/images/title.png" />
  87 + <span>补充信息</span>
  88 + </view>
  89 + <view class="section">
  90 + <view class="row textarea-row">
  91 + <text class="label"><text class="required">*</text>请款说明</text>
  92 + <view class="value">
  93 + <textarea class="textarea" v-model="form.requestRemark" placeholder="请输入请款说明"
  94 + placeholder-style="color: rgba(0,0,0,0.4); font-size: 28rpx;" />
  95 + </view>
  96 + </view>
  97 + <view v-if="form.requestKind === 'SUPPLEMENT'" class="row textarea-row">
  98 + <text class="label">补充说明</text>
  99 + <view class="value">
  100 + <text class="value-text">{{ form.supplementRemark || '-' }}</text>
  101 + </view>
  102 + </view>
  103 + <view v-if="form.requestKind === 'SUPPLEMENT' && supplementFileList.length" class="row">
  104 + <text class="label">补充说明附件</text>
  105 + <view class="value">
  106 + <view v-for="(item, i) in supplementFileList" :key="item.fileId || i" class="file-item"
  107 + @click="downloadAttachment(item)">
  108 + <text class="value act">{{ item.fileName }}</text>
  109 + </view>
  110 + </view>
  111 + </view>
  112 + <view v-if="attachmentFileList.length" class="row">
  113 + <text class="label">请款附件</text>
  114 + <view class="value">
  115 + <view v-for="(item, i) in attachmentFileList" :key="item.fileId || i" class="file-item"
  116 + @click="downloadAttachment(item)">
  117 + <text class="value act">{{ item.fileName }}</text>
  118 + </view>
  119 + </view>
  120 + </view>
  121 + </view>
  122 + </view>
  123 + </scroll-view>
  124 + <view class="footer">
  125 + <button class="btn submit" type="primary" :loading="loading" @click="onSubmit">保存</button>
  126 + </view>
  127 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options"
  128 + v-model="sheet.value" @confirm="onSheetConfirm" />
  129 + </view>
  130 +</template>
  131 +
  132 +<script>
  133 +import { getDetailApi, updateApi, supplierInfoQueryApi } from '@/api/payment-request.js'
  134 +import SingleSelectSheet from '@/components/single-select/index.vue'
  135 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  136 +import { downloadFile } from '@/utils/downloadFile.js'
  137 +
  138 +export default {
  139 + name: 'PaymentRequestModify',
  140 + components: { SingleSelectSheet },
  141 + data() {
  142 + return {
  143 + id: '',
  144 + loading: false,
  145 + form: {
  146 + id: '',
  147 + supplierId: '',
  148 + companyShortName: '',
  149 + workshopName: '',
  150 + planCodes: '',
  151 + requestDate: '',
  152 + requestKind: '',
  153 + payeeName: '',
  154 + bankName: '',
  155 + bankAccount: '',
  156 + requestRemark: '',
  157 + supplementRemark: '',
  158 + // 请款附件(多文件逗号分隔,只读展示)
  159 + requestFileIds: '',
  160 + requestFileName: '',
  161 + // 补充说明附件(多文件逗号分隔,只读展示)
  162 + supplementFileIds: '',
  163 + supplementFileNames: '',
  164 + },
  165 + // 请款明细(计划编号/预付金额只读,申请金额可编辑)
  166 + lines: [],
  167 + // 资金支付供应商信息列表(户名/银行/账号级联数据源)
  168 + supplierInfoList: [],
  169 + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' },
  170 + dicOptions: {
  171 + REQUEST_KIND: []
  172 + }
  173 + }
  174 + },
  175 + computed: {
  176 + // 请款单类型名称
  177 + requestKindName() {
  178 + const v = (this.form && this.form.requestKind) || ''
  179 + if (!v) return ''
  180 + return getDicName('REQUEST_KIND', v, this.dicOptions.REQUEST_KIND) || ''
  181 + },
  182 + // 对方户名下拉选项(customerName 去重)
  183 + payeeNameOptions() {
  184 + const map = new Map()
  185 + (this.supplierInfoList || []).forEach(item => {
  186 + if (item.customerName && !map.has(item.customerName)) {
  187 + map.set(item.customerName, { label: item.customerName, value: item.customerName })
  188 + }
  189 + })
  190 + return Array.from(map.values())
  191 + },
  192 + // 开户银行下拉选项(当前户名对应的开户银行去重)
  193 + bankNameOptions() {
  194 + const map = new Map()
  195 + (this.supplierInfoList || [])
  196 + .filter(item => item.customerName === this.form.payeeName)
  197 + .forEach(item => {
  198 + if (item.bankName && !map.has(item.bankName)) {
  199 + map.set(item.bankName, { label: item.bankName, value: item.bankName })
  200 + }
  201 + })
  202 + return Array.from(map.values())
  203 + },
  204 + // 账号下拉选项(当前户名+开户银行对应的账号)
  205 + bankAccountOptions() {
  206 + const map = new Map()
  207 + (this.supplierInfoList || [])
  208 + .filter(item => item.customerName === this.form.payeeName && item.bankName === this.form.bankName)
  209 + .forEach(item => {
  210 + if (item.cardNo && !map.has(item.cardNo)) {
  211 + map.set(item.cardNo, { label: item.cardNo, value: item.cardNo })
  212 + }
  213 + })
  214 + return Array.from(map.values())
  215 + },
  216 + // 预付金额合计(根据明细行求和)
  217 + totalPrepaidAmount() {
  218 + return this.sumLines('prepaidAmount')
  219 + },
  220 + // 申请金额合计(根据明细行求和)
  221 + totalApplyAmount() {
  222 + return this.sumLines('applyAmount')
  223 + },
  224 + // 请款附件列表
  225 + attachmentFileList() {
  226 + return this.parseAttachmentList(this.form.requestFileIds, this.form.requestFileName)
  227 + },
  228 + // 补充说明附件列表
  229 + supplementFileList() {
  230 + return this.parseAttachmentList(this.form.supplementFileIds, this.form.supplementFileNames)
  231 + },
  232 + },
  233 + onLoad(query) {
  234 + this.id = (query && (query.id || query.code)) || ''
  235 + this.loadDicData()
  236 + this.initData()
  237 + },
  238 + methods: {
  239 + async loadDicData() {
  240 + try {
  241 + const results = await getDicByCodes(['REQUEST_KIND'])
  242 + this.dicOptions.REQUEST_KIND = (results.REQUEST_KIND && results.REQUEST_KIND.data) || []
  243 + } catch (e) {
  244 + this.dicOptions = { REQUEST_KIND: [] }
  245 + }
  246 + },
  247 + async initData() {
  248 + uni.showLoading({ title: '加载中...', mask: true })
  249 + try {
  250 + // 供应商信息用于户名/银行/账号下拉回显
  251 + try {
  252 + const res = await supplierInfoQueryApi({ pageIndex: 1, pageSize: 9999 })
  253 + const _data = (res && res.data) || {}
  254 + this.supplierInfoList = _data.datas || _data.list || _data.records || []
  255 + } catch (e) {
  256 + this.supplierInfoList = []
  257 + }
  258 + const res = await getDetailApi(this.id)
  259 + const m = (res && res.data) || {}
  260 + // 优先按资金支付供应商信息ID匹配记录回显户名/开户银行/账号
  261 + const matched = (this.supplierInfoList || []).find(item => item.id === (m.supplierId || ''))
  262 + this.form = {
  263 + id: m.id || this.id,
  264 + supplierId: m.supplierId || '',
  265 + companyShortName: m.companyShortName || '',
  266 + workshopName: m.workshopName || '',
  267 + planCodes: m.planCodes || '',
  268 + requestDate: m.requestDate || '',
  269 + requestKind: m.requestKind || '',
  270 + payeeName: (matched && matched.customerName) || m.payeeName || '',
  271 + bankName: (matched && matched.bankName) || m.bankName || '',
  272 + bankAccount: (matched && matched.cardNo) || m.bankAccount || '',
  273 + requestRemark: m.requestRemark || '',
  274 + supplementRemark: m.supplementRemark || '',
  275 + requestFileIds: m.requestFileIds || m.attachmentFileIds || '',
  276 + requestFileName: m.requestFileName || m.attachmentFileNames || '',
  277 + supplementFileIds: m.supplementFileIds || '',
  278 + supplementFileNames: m.supplementFileNames || '',
  279 + }
  280 + // 请款明细回显(保留提交所需字段)
  281 + this.lines = (Array.isArray(m.lines) ? m.lines : []).map(item => ({
  282 + planId: item.planId || '',
  283 + planCode: item.planCode || '',
  284 + prepaidAmount: item.prepaidAmount === null || item.prepaidAmount === undefined ? '' : String(item.prepaidAmount),
  285 + applyAmount: item.applyAmount === null || item.applyAmount === undefined ? '' : String(item.applyAmount),
  286 + }))
  287 + } catch (e) {
  288 + uni.showToast({ title: '加载详情失败', icon: 'none' })
  289 + } finally {
  290 + uni.hideLoading()
  291 + }
  292 + },
  293 + // 明细行金额求和(非法值按 0 处理,保留两位小数)
  294 + sumLines(field) {
  295 + const total = (this.lines || []).reduce((acc, item) => {
  296 + const num = parseFloat(item[field])
  297 + return acc + (isNaN(num) ? 0 : num)
  298 + }, 0)
  299 + return total.toFixed(2)
  300 + },
  301 + // 附件字段(多文件逗号分隔)解析为文件列表
  302 + parseAttachmentList(idsStr, namesStr) {
  303 + const ids = String(idsStr || '').split(',').map(x => x.trim()).filter(Boolean)
  304 + const names = String(namesStr || '').split(',').map(x => x.trim())
  305 + return ids.map((id, idx) => ({
  306 + fileId: id,
  307 + fileName: names[idx] || `附件${idx + 1}`
  308 + }))
  309 + },
  310 + downloadAttachment(item) {
  311 + const id = (item && item.fileId) || ''
  312 + const fileName = (item && item.fileName) || ''
  313 + if (!id) return
  314 + downloadFile(id, fileName)
  315 + },
  316 + // 计划编号格式化(接口返回数组,转为逗号分隔文本)
  317 + formatPlanCodes(v) {
  318 + if (v === null || v === undefined || v === '') return ''
  319 + if (Array.isArray(v)) return v.filter(Boolean).join(',')
  320 + return String(v)
  321 + },
  322 + formatAmount(v) {
  323 + if (v === null || v === undefined || v === '') return '-'
  324 + const n = Number(v)
  325 + if (isNaN(n)) return String(v)
  326 + return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
  327 + },
  328 + openSheet(field) {
  329 + let options = []
  330 + let title = ''
  331 + let value = ''
  332 + if (field === 'payeeName') {
  333 + title = '对方户名'
  334 + options = this.payeeNameOptions
  335 + value = this.form.payeeName
  336 + } else if (field === 'bankName') {
  337 + title = '开户银行'
  338 + options = this.bankNameOptions
  339 + value = this.form.bankName
  340 + } else if (field === 'bankAccount') {
  341 + title = '账号'
  342 + options = this.bankAccountOptions
  343 + value = this.form.bankAccount
  344 + }
  345 + const match = options.find(o => String(o.value) === String(value))
  346 + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' }
  347 + },
  348 + onSheetConfirm({ value }) {
  349 + const field = this.sheet.field
  350 + this.form[field] = value
  351 + if (field === 'payeeName') {
  352 + // 户名变化:清空开户银行、账号
  353 + this.form.bankName = ''
  354 + this.form.bankAccount = ''
  355 + this.form.supplierId = ''
  356 + } else if (field === 'bankName') {
  357 + // 开户银行变化:清空账号
  358 + this.form.bankAccount = ''
  359 + this.form.supplierId = ''
  360 + } else if (field === 'bankAccount') {
  361 + // 账号变化:确定资金支付供应商信息ID
  362 + const matched = (this.supplierInfoList || []).find(
  363 + item => item.customerName === this.form.payeeName
  364 + && item.bankName === this.form.bankName
  365 + && item.cardNo === this.form.bankAccount
  366 + )
  367 + this.form.supplierId = (matched && matched.id) || ''
  368 + }
  369 + this.sheet.visible = false
  370 + },
  371 + formatApplyAmount() {
  372 + // 申请金额统一保留两位小数
  373 + (this.lines || []).forEach(item => {
  374 + const num = parseFloat(item.applyAmount)
  375 + if (!isNaN(num)) {
  376 + item.applyAmount = num.toFixed(2)
  377 + }
  378 + })
  379 + },
  380 + async onSubmit() {
  381 + // 必填校验
  382 + if (!this.form.payeeName) {
  383 + uni.showToast({ title: '请选择对方户名', icon: 'none' })
  384 + return
  385 + }
  386 + if (!this.form.bankName) {
  387 + uni.showToast({ title: '请选择开户银行', icon: 'none' })
  388 + return
  389 + }
  390 + if (!this.form.bankAccount) {
  391 + uni.showToast({ title: '请选择账号', icon: 'none' })
  392 + return
  393 + }
  394 + if (!String(this.form.requestRemark || '').trim()) {
  395 + uni.showToast({ title: '请输入请款说明', icon: 'none' })
  396 + return
  397 + }
  398 + if (this.lines.some(item => item.applyAmount === '' || item.applyAmount === null || item.applyAmount === undefined)) {
  399 + uni.showToast({ title: '请填写申请金额', icon: 'none' })
  400 + return
  401 + }
  402 + this.formatApplyAmount()
  403 + const confirmRes = await new Promise(resolve => {
  404 + uni.showModal({ title: '提示', content: '确定保存修改吗?', success: resolve })
  405 + })
  406 + if (!(confirmRes && confirmRes.confirm)) return
  407 + const data = {
  408 + id: this.form.id,
  409 + supplierId: this.form.supplierId,
  410 + payeeName: this.form.payeeName,
  411 + bankName: this.form.bankName,
  412 + bankAccount: this.form.bankAccount,
  413 + requestRemark: this.form.requestRemark,
  414 + supplementRemark: this.form.supplementRemark,
  415 + supplementFileIds: this.form.supplementFileIds,
  416 + supplementFileNames: this.form.supplementFileNames,
  417 + lines: this.lines.map(item => ({
  418 + planId: item.planId || '',
  419 + planCode: item.planCode || '',
  420 + prepaidAmount: item.prepaidAmount === null || item.prepaidAmount === undefined ? '' : String(item.prepaidAmount),
  421 + applyAmount: item.applyAmount === null || item.applyAmount === undefined ? '' : String(item.applyAmount),
  422 + }))
  423 + }
  424 + this.loading = true
  425 + try {
  426 + await updateApi(data)
  427 + uni.showToast({ title: '保存成功', icon: 'success' })
  428 + try {
  429 + uni.setStorageSync('PAYMENT_REQUEST_LIST_NEED_REFRESH', '1')
  430 + uni.setStorageSync('PAYMENT_REQUEST_DETAIL_NEED_REFRESH', '1')
  431 + } catch (e) { }
  432 + setTimeout(() => { uni.navigateBack() }, 400)
  433 + } catch (e) {
  434 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  435 + } finally {
  436 + this.loading = false
  437 + }
  438 + }
  439 + }
  440 +}
  441 +</script>
  442 +
  443 +<style lang="scss" scoped>
  444 +.page {
  445 + display: flex;
  446 + flex-direction: column;
  447 + height: 100%;
  448 +}
  449 +
  450 +.scroll {
  451 + flex: 1;
  452 + padding: 8rpx 0 176rpx;
  453 +}
  454 +
  455 +.detail-page {
  456 + background: #f3f3f3;
  457 +}
  458 +
  459 +.footer {
  460 + z-index: 2;
  461 + position: fixed;
  462 + left: 0;
  463 + right: 0;
  464 + bottom: 0;
  465 + padding: 32rpx;
  466 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  467 + background: #fff;
  468 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  469 +
  470 + .btn {
  471 + height: 80rpx;
  472 + line-height: 80rpx;
  473 + border-radius: 12rpx;
  474 + font-size: 32rpx;
  475 + }
  476 +
  477 + .submit {
  478 + background: $theme-primary;
  479 + color: #fff;
  480 + }
  481 +}
  482 +
  483 +.section {
  484 + padding: 32rpx;
  485 + background: #fff;
  486 + margin-bottom: 20rpx;
  487 + position: relative;
  488 +}
  489 +
  490 +.company-row {
  491 + display: flex;
  492 + align-items: center;
  493 + margin-bottom: 32rpx;
  494 +
  495 + .company {
  496 + font-size: 36rpx;
  497 + font-weight: 600;
  498 + color: rgba(0, 0, 0, 0.9);
  499 + padding-top: 10rpx;
  500 + line-height: 50rpx;
  501 + }
  502 +
  503 + .kind-tag {
  504 + flex-shrink: 0;
  505 + margin-left: 16rpx;
  506 + margin-top: 10rpx;
  507 + padding: 4rpx 12rpx;
  508 + border-radius: 6rpx;
  509 + font-size: 22rpx;
  510 + line-height: 32rpx;
  511 + background: #FFF1E9;
  512 + color: #E37318;
  513 + }
  514 +}
  515 +
  516 +.row {
  517 + display: flex;
  518 + margin-bottom: 28rpx;
  519 +
  520 + &:last-child {
  521 + margin-bottom: 0;
  522 + }
  523 +
  524 + .label {
  525 + max-width: 420rpx;
  526 + margin-right: 20rpx;
  527 + line-height: 32rpx;
  528 + font-size: 28rpx;
  529 + color: rgba(0, 0, 0, 0.6);
  530 +
  531 + .required {
  532 + color: #d54941;
  533 + margin-right: 6rpx;
  534 + }
  535 + }
  536 +
  537 + .value {
  538 + flex: 1;
  539 + line-height: 32rpx;
  540 + font-size: 28rpx;
  541 + color: rgba(0, 0, 0, 0.9);
  542 + text-align: right;
  543 + word-break: break-all;
  544 +
  545 + &.act {
  546 + color: $theme-primary;
  547 + }
  548 + }
  549 +
  550 + .file-item {
  551 + margin-bottom: 12rpx;
  552 + text-align: right;
  553 +
  554 + &:last-child {
  555 + margin-bottom: 0;
  556 + }
  557 + }
  558 +}
  559 +
  560 +.textarea-row {
  561 + align-items: flex-start;
  562 +
  563 + .textarea {
  564 + width: 100%;
  565 + height: 160rpx;
  566 + padding: 16rpx 24rpx;
  567 + box-sizing: border-box;
  568 + border: 1rpx solid #e7e7e7;
  569 + border-radius: 8rpx;
  570 + background: #fff;
  571 + font-size: 28rpx;
  572 + color: rgba(0, 0, 0, 0.9);
  573 + line-height: 40rpx;
  574 + }
  575 +
  576 + .value-text {
  577 + display: block;
  578 + text-align: right;
  579 + line-height: 40rpx;
  580 + white-space: pre-wrap;
  581 + }
  582 +}
  583 +
  584 +.title-header {
  585 + display: flex;
  586 + align-items: center;
  587 + padding: 24rpx 32rpx 12rpx;
  588 + background-color: #ffffff;
  589 +
  590 + .title-header_icon {
  591 + width: 36rpx;
  592 + height: 36rpx;
  593 + margin-right: 12rpx;
  594 + }
  595 +
  596 + span {
  597 + font-size: 34rpx;
  598 + font-weight: 600;
  599 + color: rgba(0, 0, 0, 0.9);
  600 + }
  601 +}
  602 +
  603 +.sub-table {
  604 + background: #fff;
  605 + margin-bottom: 20rpx;
  606 +}
  607 +
  608 +.sub-header {
  609 + display: flex;
  610 + align-items: center;
  611 + padding: 16rpx 0 16rpx 32rpx;
  612 +
  613 + .sub-bar {
  614 + width: 6rpx;
  615 + height: 32rpx;
  616 + margin-right: 14rpx;
  617 + }
  618 +
  619 + .sub-title {
  620 + font-size: 30rpx;
  621 + font-weight: 600;
  622 + color: rgba(0, 0, 0, 0.9);
  623 + flex: 1;
  624 + line-height: 42rpx;
  625 + }
  626 +}
  627 +
  628 +.sub-body {
  629 + padding: 0 32rpx 24rpx;
  630 +
  631 + .empty-tip {
  632 + text-align: center;
  633 + padding: 60rpx 0;
  634 + color: rgba(0, 0, 0, 0.4);
  635 + font-size: 28rpx;
  636 + }
  637 +
  638 + .card {
  639 + position: relative;
  640 + background: #fafafa;
  641 + border-radius: 12rpx;
  642 + padding: 32rpx 28rpx 20rpx;
  643 + margin-bottom: 24rpx;
  644 +
  645 + .card-index {
  646 + position: absolute;
  647 + top: 0;
  648 + right: 0;
  649 + background: rgba(24, 144, 255, 0.08);
  650 + color: $theme-primary;
  651 + font-size: 22rpx;
  652 + line-height: 36rpx;
  653 + padding: 0 16rpx;
  654 + border-bottom-left-radius: 12rpx;
  655 + border-top-right-radius: 12rpx;
  656 + }
  657 +
  658 + .row {
  659 + align-items: center;
  660 + justify-content: space-between;
  661 + padding: 14rpx 0;
  662 + margin-bottom: 0;
  663 + border-bottom: 1rpx dashed #f2f2f2;
  664 +
  665 + &:last-child {
  666 + border-bottom: none;
  667 + }
  668 +
  669 + .label {
  670 + flex-shrink: 0;
  671 + width: 220rpx;
  672 + max-width: none;
  673 + margin-right: 0;
  674 + font-size: 28rpx;
  675 + color: rgba(0, 0, 0, 0.6);
  676 + line-height: 40rpx;
  677 +
  678 + .required {
  679 + color: #d54941;
  680 + margin-right: 6rpx;
  681 + }
  682 + }
  683 +
  684 + .value {
  685 + flex: 1;
  686 + text-align: right;
  687 + font-size: 28rpx;
  688 + color: rgba(0, 0, 0, 0.9);
  689 + line-height: 40rpx;
  690 + overflow: hidden;
  691 + text-overflow: ellipsis;
  692 + white-space: nowrap;
  693 + }
  694 +
  695 + .amount-row {
  696 + flex: 1;
  697 + display: flex;
  698 + align-items: center;
  699 + justify-content: flex-end;
  700 +
  701 + .amount-input {
  702 + width: 100%;
  703 + height: 64rpx;
  704 + line-height: 64rpx;
  705 + padding: 0 24rpx;
  706 + box-sizing: border-box;
  707 + border-radius: 8rpx;
  708 + background: #fff;
  709 + border: 1rpx solid #dcdcdc;
  710 + font-size: 28rpx;
  711 + color: rgba(0, 0, 0, 0.9);
  712 + text-align: right;
  713 + }
  714 + }
  715 + }
  716 + }
  717 +
  718 + .total-row {
  719 + display: flex;
  720 + align-items: center;
  721 + padding: 20rpx 28rpx;
  722 + border-radius: 12rpx;
  723 + border: 1rpx solid #e5e6eb;
  724 + background: #fafafa;
  725 +
  726 + .total-title {
  727 + flex-shrink: 0;
  728 + font-size: 28rpx;
  729 + font-weight: 600;
  730 + color: rgba(0, 0, 0, 0.9);
  731 + margin-right: 32rpx;
  732 + }
  733 +
  734 + .total-item {
  735 + display: flex;
  736 + align-items: center;
  737 + margin-right: 32rpx;
  738 +
  739 + &:last-child {
  740 + margin-right: 0;
  741 + }
  742 +
  743 + .total-label {
  744 + font-size: 26rpx;
  745 + color: rgba(0, 0, 0, 0.6);
  746 + margin-right: 8rpx;
  747 + }
  748 +
  749 + .total-value {
  750 + font-size: 26rpx;
  751 + color: rgba(0, 0, 0, 0.9);
  752 + }
  753 + }
  754 + }
  755 +}
  756 +
  757 +::v-deep .uni-list {
  758 + background: transparent;
  759 +
  760 + .uni-list--border-top {
  761 + background-color: transparent !important;
  762 + }
  763 +
  764 + &-item {
  765 + &__container {
  766 + padding: 32rpx 0;
  767 + }
  768 +
  769 + &__content-title {
  770 + font-size: 32rpx;
  771 + color: rgba(0, 0, 0, 0.9);
  772 + }
  773 +
  774 + &__extra-text {
  775 + font-size: 30rpx;
  776 + }
  777 + }
  778 +
  779 + .uni-list--border {
  780 + background-color: #f2f2f2 !important;
  781 + }
  782 +}
  783 +
  784 +::v-deep .select-item {
  785 + &.is-empty {
  786 + .uni-list-item__extra-text {
  787 + color: rgba(0, 0, 0, 0.4) !important;
  788 + }
  789 + }
  790 +
  791 + &.is-filled {
  792 + .uni-list-item__extra-text {
  793 + color: rgba(0, 0, 0, 0.9) !important;
  794 + }
  795 + }
  796 +}
  797 +
  798 +.item-title {
  799 + flex: none;
  800 + min-height: 48rpx;
  801 + line-height: 48rpx;
  802 + font-size: 32rpx;
  803 + color: rgba(0, 0, 0, 0.9);
  804 +
  805 + .required {
  806 + color: #d54941;
  807 + margin-right: 6rpx;
  808 + }
  809 +}
  810 +</style>
... ...
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <!-- 基础信息 -->
  6 + <view class="section">
  7 + <view class="company-row">
  8 + <text class="company">{{ form.companyShortName || '-' }}</text>
  9 + <text v-if="requestKindName" class="kind-tag">{{ requestKindName }}</text>
  10 + </view>
  11 + <view class="row"><text class="label">分厂</text><text class="value">{{ form.workshopName || '-' }}</text></view>
  12 + <view class="row"><text class="label">计划编号</text><text class="value">{{ formatPlanCodes(form.planCodes) || '-' }}</text></view>
  13 + <view class="row"><text class="label">日期</text><text class="value">{{ form.requestDate || '-' }}</text></view>
  14 + <view class="row"><text class="label">对方户名</text><text class="value">{{ form.payeeName || '-' }}</text></view>
  15 + <view class="row"><text class="label">开户银行</text><text class="value">{{ form.bankName || '-' }}</text></view>
  16 + <view class="row"><text class="label">账号</text><text class="value">{{ form.bankAccount || '-' }}</text></view>
  17 + </view>
  18 +
  19 + <!-- 请款明细 -->
  20 + <view class="sub-table">
  21 + <view class="sub-header">
  22 + <image class="sub-bar" src="/static/images/title.png" />
  23 + <text class="sub-title">请款明细</text>
  24 + </view>
  25 + <view class="sub-body">
  26 + <view v-if="!lines.length" class="empty-tip">暂无明细</view>
  27 + <view v-for="(item, idx) in lines" :key="idx" class="card">
  28 + <view class="card-index">第 {{ idx + 1 }} 行</view>
  29 + <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
  30 + <view class="row"><text class="label">预付金额</text><text class="value">{{ formatAmount(item.prepaidAmount) }}</text></view>
  31 + <view class="row"><text class="label">申请金额</text><text class="value">{{ formatAmount(item.applyAmount) }}</text></view>
  32 + </view>
  33 + <view class="total-row">
  34 + <text class="total-title">合计金额</text>
  35 + <view class="total-item">
  36 + <text class="total-label">预付金额</text>
  37 + <text class="total-value">{{ totalPrepaidAmount }}</text>
  38 + </view>
  39 + <view class="total-item">
  40 + <text class="total-label">申请金额</text>
  41 + <text class="total-value">{{ totalApplyAmount }}</text>
  42 + </view>
  43 + </view>
  44 + </view>
  45 + </view>
  46 +
  47 + <!-- 补充信息 -->
  48 + <view class="title-header">
  49 + <image class="title-header_icon" src="/static/images/title.png" />
  50 + <span>补充信息</span>
  51 + </view>
  52 + <view class="section">
  53 + <view class="row"><text class="label">请款说明</text><text class="value">{{ form.requestRemark || '-' }}</text></view>
  54 + <view class="row"><text class="label">补充说明</text><text class="value">{{ form.supplementRemark || '-' }}</text></view>
  55 + </view>
  56 +
  57 + <!-- 其它附件 -->
  58 + <view class="sub-table">
  59 + <view class="sub-header">
  60 + <image class="sub-bar" src="/static/images/title.png" />
  61 + <text class="sub-title">其它附件</text>
  62 + <view class="upload-btn" @click="selectFile">上传文件</view>
  63 + </view>
  64 + <view class="sub-body">
  65 + <view v-if="!fileList.length" class="empty-tip">暂无附件,请上传</view>
  66 + <view v-for="(file, idx) in fileList" :key="file.id || idx" class="file-item">
  67 + <text class="file-name">{{ file.name || '未命名文件' }}</text>
  68 + <text class="file-del" @click="removeFile(idx)">删除</text>
  69 + </view>
  70 + </view>
  71 + </view>
  72 + </view>
  73 + </scroll-view>
  74 + <view class="footer">
  75 + <button class="btn submit" type="primary" :loading="loading" @click="onSubmit">保存</button>
  76 + </view>
  77 + </view>
  78 +</template>
  79 +
  80 +<script>
  81 +import { getDetailApi, uploadOtherFileApi } from '@/api/payment-request.js'
  82 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  83 +import upload from '@/utils/upload'
  84 +import { uploadFileApi } from '@/api/base.js'
  85 +
  86 +export default {
  87 + name: 'PaymentRequestUpload',
  88 + data() {
  89 + return {
  90 + id: '',
  91 + loading: false,
  92 + form: {
  93 + id: '',
  94 + companyShortName: '',
  95 + workshopName: '',
  96 + planCodes: '',
  97 + requestDate: '',
  98 + requestKind: '',
  99 + payeeName: '',
  100 + bankName: '',
  101 + bankAccount: '',
  102 + requestRemark: '',
  103 + supplementRemark: '',
  104 + // 其它附件(多文件逗号分隔)
  105 + otherFileIds: '',
  106 + otherFileNames: '',
  107 + },
  108 + lines: [],
  109 + // 其它附件列表 [{ id, name }]
  110 + fileList: [],
  111 + dicOptions: {
  112 + REQUEST_KIND: []
  113 + }
  114 + }
  115 + },
  116 + computed: {
  117 + requestKindName() {
  118 + const v = (this.form && this.form.requestKind) || ''
  119 + if (!v) return ''
  120 + return getDicName('REQUEST_KIND', v, this.dicOptions.REQUEST_KIND) || ''
  121 + },
  122 + // 预付金额合计(根据明细行求和)
  123 + totalPrepaidAmount() {
  124 + return this.sumLines('prepaidAmount')
  125 + },
  126 + // 申请金额合计(根据明细行求和)
  127 + totalApplyAmount() {
  128 + return this.sumLines('applyAmount')
  129 + },
  130 + },
  131 + onLoad(query) {
  132 + this.id = (query && (query.id || query.code)) || ''
  133 + this.loadDicData()
  134 + this.loadDetail()
  135 + },
  136 + methods: {
  137 + async loadDicData() {
  138 + try {
  139 + const results = await getDicByCodes(['REQUEST_KIND'])
  140 + this.dicOptions.REQUEST_KIND = (results.REQUEST_KIND && results.REQUEST_KIND.data) || []
  141 + } catch (e) {
  142 + this.dicOptions = { REQUEST_KIND: [] }
  143 + }
  144 + },
  145 + async loadDetail() {
  146 + if (!this.id) {
  147 + uni.showToast({ title: '缺少单据ID', icon: 'none' })
  148 + return
  149 + }
  150 + uni.showLoading({ title: '加载中...', mask: true })
  151 + try {
  152 + const res = await getDetailApi(this.id)
  153 + const m = (res && res.data) || {}
  154 + this.form = {
  155 + id: m.id || this.id,
  156 + companyShortName: m.companyShortName || '',
  157 + workshopName: m.workshopName || '',
  158 + planCodes: m.planCodes || '',
  159 + requestDate: m.requestDate || '',
  160 + requestKind: m.requestKind || '',
  161 + payeeName: m.payeeName || '',
  162 + bankName: m.bankName || '',
  163 + bankAccount: m.bankAccount || '',
  164 + requestRemark: m.requestRemark || '',
  165 + supplementRemark: m.supplementRemark || '',
  166 + otherFileIds: m.otherFileIds || '',
  167 + otherFileNames: m.otherFileNames || '',
  168 + }
  169 + this.lines = (Array.isArray(m.lines) ? m.lines : []).map(item => ({
  170 + planId: item.planId || '',
  171 + planCode: item.planCode || '',
  172 + prepaidAmount: item.prepaidAmount === null || item.prepaidAmount === undefined ? '' : String(item.prepaidAmount),
  173 + applyAmount: item.applyAmount === null || item.applyAmount === undefined ? '' : String(item.applyAmount),
  174 + }))
  175 + // 已传其它附件回显(多文件逗号分隔)
  176 + const ids = String(m.otherFileIds || '').split(',').filter(Boolean)
  177 + const names = String(m.otherFileNames || '').split(',').filter(Boolean)
  178 + this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' }))
  179 + } catch (e) {
  180 + uni.showToast({ title: '加载详情失败', icon: 'none' })
  181 + } finally {
  182 + uni.hideLoading()
  183 + }
  184 + },
  185 + // 明细行金额求和(非法值按 0 处理,保留两位小数)
  186 + sumLines(field) {
  187 + const total = (this.lines || []).reduce((acc, item) => {
  188 + const num = parseFloat(item[field])
  189 + return acc + (isNaN(num) ? 0 : num)
  190 + }, 0)
  191 + return total.toFixed(2)
  192 + },
  193 + // 计划编号格式化(接口返回数组,转为逗号分隔文本)
  194 + formatPlanCodes(v) {
  195 + if (v === null || v === undefined || v === '') return ''
  196 + if (Array.isArray(v)) return v.filter(Boolean).join(',')
  197 + return String(v)
  198 + },
  199 + formatAmount(v) {
  200 + if (v === null || v === undefined || v === '') return '-'
  201 + const n = Number(v)
  202 + if (isNaN(n)) return String(v)
  203 + return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
  204 + },
  205 + // 选择并上传文件(多文件逐个追加)
  206 + selectFile() {
  207 + if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') {
  208 + uni.chooseMessageFile({
  209 + count: 9,
  210 + type: 'all',
  211 + success: async res => {
  212 + const files = (res && res.tempFiles) || []
  213 + if (!files.length) return
  214 + uni.showLoading({ title: '上传中...', mask: true })
  215 + try {
  216 + for (const f of files) {
  217 + const name = f.name || 'file'
  218 + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' })
  219 + const d = r && r.data ? r.data : r
  220 + const id = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId))))
  221 + ? String(d.id || d.fileId || d.data.id || d.data.fileId)
  222 + : ''
  223 + if (id) this.fileList.push({ id, name })
  224 + }
  225 + } catch (e) {
  226 + uni.showToast({ title: '上传失败', icon: 'none' })
  227 + } finally {
  228 + uni.hideLoading()
  229 + }
  230 + },
  231 + fail: () => {
  232 + uni.showToast({ title: '未选择文件', icon: 'none' })
  233 + }
  234 + })
  235 + return
  236 + }
  237 + // H5 兜底:动态创建原生 input
  238 + try {
  239 + const input = document.createElement('input')
  240 + input.type = 'file'
  241 + input.multiple = true
  242 + input.style.position = 'fixed'
  243 + input.style.left = '-9999px'
  244 + document.body.appendChild(input)
  245 + input.addEventListener('change', this.onFileChange)
  246 + input.click()
  247 + setTimeout(() => { document.body.removeChild(input) }, 1000)
  248 + } catch (e) {
  249 + uni.showToast({ title: '无法打开文件选择', icon: 'none' })
  250 + }
  251 + },
  252 + async onFileChange(e) {
  253 + const files = (e && e.target && e.target.files) || []
  254 + if (!files.length) return
  255 + uni.showLoading({ title: '上传中...', mask: true })
  256 + try {
  257 + for (const file of files) {
  258 + const name = file.name || ''
  259 + const fd = new FormData()
  260 + fd.append('file', file, name)
  261 + const d = await uploadFileApi(fd)
  262 + const data = d && d.data ? d.data : d
  263 + const id = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId))))
  264 + ? String(data.id || data.fileId || data.data.id || data.data.fileId)
  265 + : ''
  266 + if (id) this.fileList.push({ id, name })
  267 + }
  268 + } catch (e2) {
  269 + uni.showToast({ title: '上传失败', icon: 'none' })
  270 + } finally {
  271 + uni.hideLoading()
  272 + if (e && e.target) e.target.value = ''
  273 + }
  274 + },
  275 + removeFile(idx) {
  276 + this.fileList.splice(idx, 1)
  277 + },
  278 + async onSubmit() {
  279 + const ids = this.fileList.map(it => it.id).filter(Boolean)
  280 + const names = this.fileList.map(it => it.name).filter(Boolean)
  281 + const data = {
  282 + id: this.form.id || this.id,
  283 + otherFileIds: ids.join(','),
  284 + otherFileNames: names.join(',')
  285 + }
  286 + const confirmRes = await new Promise(resolve => {
  287 + uni.showModal({ title: '提示', content: '确定保存附件吗?', success: resolve })
  288 + })
  289 + if (!(confirmRes && confirmRes.confirm)) return
  290 + this.loading = true
  291 + try {
  292 + await uploadOtherFileApi(data)
  293 + uni.showToast({ title: '保存成功', icon: 'success' })
  294 + try {
  295 + uni.setStorageSync('PAYMENT_REQUEST_LIST_NEED_REFRESH', '1')
  296 + uni.setStorageSync('PAYMENT_REQUEST_DETAIL_NEED_REFRESH', '1')
  297 + } catch (e) { }
  298 + setTimeout(() => { uni.navigateBack() }, 400)
  299 + } catch (e) {
  300 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  301 + } finally {
  302 + this.loading = false
  303 + }
  304 + }
  305 + }
  306 +}
  307 +</script>
  308 +
  309 +<style lang="scss" scoped>
  310 +.page {
  311 + display: flex;
  312 + flex-direction: column;
  313 + height: 100%;
  314 +}
  315 +
  316 +.scroll {
  317 + flex: 1;
  318 + padding: 8rpx 0 176rpx;
  319 +}
  320 +
  321 +.detail-page {
  322 + background: #f3f3f3;
  323 +}
  324 +
  325 +.footer {
  326 + z-index: 2;
  327 + position: fixed;
  328 + left: 0;
  329 + right: 0;
  330 + bottom: 0;
  331 + padding: 32rpx;
  332 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  333 + background: #fff;
  334 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  335 +
  336 + .btn {
  337 + height: 80rpx;
  338 + line-height: 80rpx;
  339 + border-radius: 12rpx;
  340 + font-size: 32rpx;
  341 + }
  342 +
  343 + .submit {
  344 + background: $theme-primary;
  345 + color: #fff;
  346 + }
  347 +}
  348 +
  349 +.section {
  350 + padding: 32rpx;
  351 + background: #fff;
  352 + margin-bottom: 20rpx;
  353 +}
  354 +
  355 +.company-row {
  356 + display: flex;
  357 + align-items: center;
  358 + margin-bottom: 32rpx;
  359 +
  360 + .company {
  361 + font-size: 36rpx;
  362 + font-weight: 600;
  363 + color: rgba(0, 0, 0, 0.9);
  364 + padding-top: 10rpx;
  365 + line-height: 50rpx;
  366 + }
  367 +
  368 + .kind-tag {
  369 + flex-shrink: 0;
  370 + margin-left: 16rpx;
  371 + margin-top: 10rpx;
  372 + padding: 4rpx 12rpx;
  373 + border-radius: 6rpx;
  374 + font-size: 22rpx;
  375 + line-height: 32rpx;
  376 + background: #FFF1E9;
  377 + color: #E37318;
  378 + }
  379 +}
  380 +
  381 +.row {
  382 + display: flex;
  383 + margin-bottom: 28rpx;
  384 +
  385 + &:last-child {
  386 + margin-bottom: 0;
  387 + }
  388 +
  389 + .label {
  390 + max-width: 420rpx;
  391 + margin-right: 20rpx;
  392 + line-height: 32rpx;
  393 + font-size: 28rpx;
  394 + color: rgba(0, 0, 0, 0.6);
  395 + }
  396 +
  397 + .value {
  398 + flex: 1;
  399 + line-height: 32rpx;
  400 + font-size: 28rpx;
  401 + color: rgba(0, 0, 0, 0.9);
  402 + text-align: right;
  403 + word-break: break-all;
  404 + }
  405 +}
  406 +
  407 +.title-header {
  408 + display: flex;
  409 + align-items: center;
  410 + padding: 24rpx 32rpx 12rpx;
  411 + background-color: #ffffff;
  412 +
  413 + .title-header_icon {
  414 + width: 36rpx;
  415 + height: 36rpx;
  416 + margin-right: 12rpx;
  417 + }
  418 +
  419 + span {
  420 + font-size: 34rpx;
  421 + font-weight: 600;
  422 + color: rgba(0, 0, 0, 0.9);
  423 + }
  424 +}
  425 +
  426 +.sub-table {
  427 + background: #fff;
  428 + margin-bottom: 20rpx;
  429 +}
  430 +
  431 +.sub-header {
  432 + display: flex;
  433 + align-items: center;
  434 + padding: 16rpx 0 16rpx 32rpx;
  435 +
  436 + .sub-bar {
  437 + width: 6rpx;
  438 + height: 32rpx;
  439 + margin-right: 14rpx;
  440 + }
  441 +
  442 + .sub-title {
  443 + font-size: 30rpx;
  444 + font-weight: 600;
  445 + color: rgba(0, 0, 0, 0.9);
  446 + flex: 1;
  447 + line-height: 42rpx;
  448 + }
  449 +
  450 + .upload-btn {
  451 + margin-right: 32rpx;
  452 + height: 56rpx;
  453 + line-height: 56rpx;
  454 + padding: 0 24rpx;
  455 + font-size: 26rpx;
  456 + border-radius: 8rpx;
  457 + background: $theme-primary;
  458 + color: #fff;
  459 + }
  460 +}
  461 +
  462 +.sub-body {
  463 + padding: 0 32rpx 24rpx;
  464 +
  465 + .empty-tip {
  466 + text-align: center;
  467 + padding: 60rpx 0;
  468 + color: rgba(0, 0, 0, 0.4);
  469 + font-size: 28rpx;
  470 + }
  471 +
  472 + .card {
  473 + position: relative;
  474 + background: #fafafa;
  475 + border-radius: 12rpx;
  476 + padding: 32rpx 28rpx 20rpx;
  477 + margin-bottom: 24rpx;
  478 +
  479 + .card-index {
  480 + position: absolute;
  481 + top: 0;
  482 + right: 0;
  483 + background: rgba(24, 144, 255, 0.08);
  484 + color: $theme-primary;
  485 + font-size: 22rpx;
  486 + line-height: 36rpx;
  487 + padding: 0 16rpx;
  488 + border-bottom-left-radius: 12rpx;
  489 + border-top-right-radius: 12rpx;
  490 + }
  491 +
  492 + .row {
  493 + align-items: center;
  494 + justify-content: space-between;
  495 + padding: 14rpx 0;
  496 + margin-bottom: 0;
  497 + border-bottom: 1rpx dashed #f2f2f2;
  498 +
  499 + &:last-child {
  500 + border-bottom: none;
  501 + }
  502 +
  503 + .label {
  504 + flex-shrink: 0;
  505 + width: 220rpx;
  506 + max-width: none;
  507 + margin-right: 0;
  508 + font-size: 28rpx;
  509 + color: rgba(0, 0, 0, 0.6);
  510 + line-height: 40rpx;
  511 + }
  512 +
  513 + .value {
  514 + flex: 1;
  515 + text-align: right;
  516 + font-size: 28rpx;
  517 + color: rgba(0, 0, 0, 0.9);
  518 + line-height: 40rpx;
  519 + overflow: hidden;
  520 + text-overflow: ellipsis;
  521 + white-space: nowrap;
  522 + }
  523 + }
  524 + }
  525 +
  526 + .total-row {
  527 + display: flex;
  528 + align-items: center;
  529 + padding: 20rpx 28rpx;
  530 + border-radius: 12rpx;
  531 + border: 1rpx solid #e5e6eb;
  532 + background: #fafafa;
  533 +
  534 + .total-title {
  535 + flex-shrink: 0;
  536 + font-size: 28rpx;
  537 + font-weight: 600;
  538 + color: rgba(0, 0, 0, 0.9);
  539 + margin-right: 32rpx;
  540 + }
  541 +
  542 + .total-item {
  543 + display: flex;
  544 + align-items: center;
  545 + margin-right: 32rpx;
  546 +
  547 + &:last-child {
  548 + margin-right: 0;
  549 + }
  550 +
  551 + .total-label {
  552 + font-size: 26rpx;
  553 + color: rgba(0, 0, 0, 0.6);
  554 + margin-right: 8rpx;
  555 + }
  556 +
  557 + .total-value {
  558 + font-size: 26rpx;
  559 + color: rgba(0, 0, 0, 0.9);
  560 + }
  561 + }
  562 + }
  563 +
  564 + .file-item {
  565 + display: flex;
  566 + align-items: center;
  567 + justify-content: space-between;
  568 + padding: 20rpx 24rpx;
  569 + margin-bottom: 16rpx;
  570 + background: #fafafa;
  571 + border-radius: 8rpx;
  572 +
  573 + &:last-child {
  574 + margin-bottom: 0;
  575 + }
  576 +
  577 + .file-name {
  578 + flex: 1;
  579 + font-size: 28rpx;
  580 + color: rgba(0, 0, 0, 0.9);
  581 + word-break: break-all;
  582 + margin-right: 20rpx;
  583 + }
  584 +
  585 + .file-del {
  586 + flex-shrink: 0;
  587 + font-size: 26rpx;
  588 + color: #d54941;
  589 + }
  590 + }
  591 +}
  592 +</style>
... ...
  1 +<template>
  2 + <view class="page">
  3 + <!-- 基础信息 -->
  4 + <view class="section">
  5 + <view class="company-row">
  6 + <text class="company">{{ form.companyShortName || '-' }}</text>
  7 + <text v-if="requestKindName" class="kind-tag">{{ requestKindName }}</text>
  8 + </view>
  9 + <view class="row"><text class="label">分厂</text><text class="value">{{ form.workshopName || '-' }}</text></view>
  10 + <view class="row"><text class="label">计划编号</text><text class="value">{{ formatPlanCodes(form.planCodes) || '-' }}</text></view>
  11 + <view class="row"><text class="label">日期</text><text class="value">{{ form.requestDate || '-' }}</text></view>
  12 + <view class="row"><text class="label">付款方式</text><text class="value">{{ bizTypeName || '-' }}</text></view>
  13 + <view class="row"><text class="label">对方户名</text><text class="value">{{ form.payeeName || '-' }}</text></view>
  14 + <view class="row"><text class="label">开户银行</text><text class="value">{{ form.bankName || '-' }}</text></view>
  15 + <view class="row"><text class="label">账号</text><text class="value">{{ form.bankAccount || '-' }}</text></view>
  16 + </view>
  17 +
  18 + <!-- 请款明细 -->
  19 + <view class="sub-table">
  20 + <view class="sub-header">
  21 + <image class="sub-bar" src="/static/images/title.png" />
  22 + <text class="sub-title">请款明细</text>
  23 + </view>
  24 + <view class="sub-body">
  25 + <view v-if="!lines.length" class="empty-tip">暂无明细</view>
  26 + <view v-for="(item, idx) in lines" :key="idx" class="card">
  27 + <view class="card-index">第 {{ idx + 1 }} 行</view>
  28 + <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
  29 + <view class="row"><text class="label">预付金额</text><text class="value">{{ formatAmount(item.prepaidAmount) }}</text></view>
  30 + <view class="row"><text class="label">申请金额</text><text class="value">{{ formatAmount(item.applyAmount) }}</text></view>
  31 + </view>
  32 + <view class="total-row">
  33 + <text class="total-title">合计金额</text>
  34 + <view class="total-item">
  35 + <text class="total-label">预付金额</text>
  36 + <text class="total-value">{{ formatAmount(form.totalPrepayAmount) }}</text>
  37 + </view>
  38 + <view class="total-item">
  39 + <text class="total-label">申请金额</text>
  40 + <text class="total-value">{{ formatAmount(form.totalApplyAmount) }}</text>
  41 + </view>
  42 + </view>
  43 + </view>
  44 + </view>
  45 +
  46 + <!-- 补充信息 -->
  47 + <view class="title-header">
  48 + <image class="title-header_icon" src="/static/images/title.png" />
  49 + <span>补充信息</span>
  50 + </view>
  51 + <view class="section">
  52 + <view class="row"><text class="label">请款说明</text><text class="value">{{ form.requestRemark || '-' }}</text></view>
  53 + <view v-if="form.requestKind === 'SUPPLEMENT'" class="row">
  54 + <text class="label">补充说明</text><text class="value">{{ form.supplementRemark || '-' }}</text>
  55 + </view>
  56 + <view v-if="form.requestKind === 'SUPPLEMENT' && supplementFileList.length" class="row">
  57 + <text class="label">补充说明附件</text>
  58 + <view class="value">
  59 + <view v-for="(item, i) in supplementFileList" :key="item.fileId || i" class="file-item"
  60 + @click="downloadAttachment(item)">
  61 + <text class="value act">{{ item.fileName }}</text>
  62 + </view>
  63 + </view>
  64 + </view>
  65 + <view v-if="attachmentFileList.length" class="row">
  66 + <text class="label">请款附件</text>
  67 + <view class="value">
  68 + <view v-for="(item, i) in attachmentFileList" :key="item.fileId || i" class="file-item"
  69 + @click="downloadAttachment(item)">
  70 + <text class="value act">{{ item.fileName }}</text>
  71 + </view>
  72 + </view>
  73 + </view>
  74 + </view>
  75 + </view>
  76 +</template>
  77 +
  78 +<script>
  79 +import { getDetailApi } from '@/api/payment-request.js'
  80 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  81 +import { downloadFile } from '@/utils/downloadFile.js'
  82 +
  83 +export default {
  84 + name: 'PaymentRequestViewer',
  85 + props: { id: { type: [String, Number], default: '' } },
  86 + data() {
  87 + return {
  88 + form: {},
  89 + lines: [],
  90 + dicOptions: {
  91 + DELIVERY_METHOD: [],
  92 + REQUEST_KIND: []
  93 + }
  94 + }
  95 + },
  96 + computed: {
  97 + // 付款方式名称(code 转名称)
  98 + bizTypeName() {
  99 + const v = (this.form && this.form.bizType) || ''
  100 + if (!v) return ''
  101 + return getDicName('DELIVERY_METHOD', v, this.dicOptions.DELIVERY_METHOD) || v
  102 + },
  103 + // 请款单类型名称
  104 + requestKindName() {
  105 + const v = (this.form && this.form.requestKind) || ''
  106 + if (!v) return ''
  107 + return getDicName('REQUEST_KIND', v, this.dicOptions.REQUEST_KIND) || ''
  108 + },
  109 + // 请款附件列表(多文件逗号分隔解析)
  110 + attachmentFileList() {
  111 + return this.parseAttachmentList(
  112 + (this.form && this.form.requestFileIds) || (this.form && this.form.attachmentFileIds) || '',
  113 + (this.form && this.form.requestFileName) || (this.form && this.form.attachmentFileNames) || ''
  114 + )
  115 + },
  116 + // 补充说明附件列表
  117 + supplementFileList() {
  118 + return this.parseAttachmentList(
  119 + (this.form && this.form.supplementFileIds) || '',
  120 + (this.form && this.form.supplementFileNames) || ''
  121 + )
  122 + },
  123 + },
  124 + created() {
  125 + this.loadDicData()
  126 + },
  127 + watch: {
  128 + id: {
  129 + immediate: true,
  130 + handler(val) {
  131 + const v = (val !== undefined && val !== null) ? String(val) : ''
  132 + if (v) this.loadDetail(v)
  133 + }
  134 + }
  135 + },
  136 + methods: {
  137 + async loadDicData() {
  138 + try {
  139 + const results = await getDicByCodes(['DELIVERY_METHOD', 'REQUEST_KIND'])
  140 + this.dicOptions.DELIVERY_METHOD = (results.DELIVERY_METHOD && results.DELIVERY_METHOD.data) || []
  141 + this.dicOptions.REQUEST_KIND = (results.REQUEST_KIND && results.REQUEST_KIND.data) || []
  142 + } catch (e) {
  143 + this.dicOptions = { DELIVERY_METHOD: [], REQUEST_KIND: [] }
  144 + }
  145 + },
  146 + // 按业务 id 加载请款单详情
  147 + async loadDetail(id) {
  148 + try {
  149 + const res = await getDetailApi(id)
  150 + const m = (res && res.data) || {}
  151 + this.form = m
  152 + this.lines = Array.isArray(m.lines) ? m.lines : []
  153 + } catch (e) {
  154 + this.form = {}
  155 + this.lines = []
  156 + }
  157 + },
  158 + // 附件字段(多文件逗号分隔)解析为文件列表
  159 + parseAttachmentList(idsStr, namesStr) {
  160 + const ids = String(idsStr || '').split(',').map(x => x.trim()).filter(Boolean)
  161 + const names = String(namesStr || '').split(',').map(x => x.trim())
  162 + return ids.map((id, idx) => ({
  163 + fileId: id,
  164 + fileName: names[idx] || `附件${idx + 1}`
  165 + }))
  166 + },
  167 + downloadAttachment(item) {
  168 + const id = (item && item.fileId) || ''
  169 + const fileName = (item && item.fileName) || ''
  170 + if (!id) return
  171 + downloadFile(id, fileName)
  172 + },
  173 + // 计划编号格式化(接口返回数组,转为逗号分隔文本)
  174 + formatPlanCodes(v) {
  175 + if (v === null || v === undefined || v === '') return ''
  176 + if (Array.isArray(v)) return v.filter(Boolean).join(',')
  177 + return String(v)
  178 + },
  179 + formatAmount(v) {
  180 + if (v === null || v === undefined || v === '') return '-'
  181 + const n = Number(v)
  182 + if (isNaN(n)) return String(v)
  183 + return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
  184 + },
  185 + // 供 BPM 审批通过时取业务表单数据(variables)
  186 + getFormValues() {
  187 + const m = this.form || {}
  188 + return JSON.parse(JSON.stringify(m))
  189 + },
  190 + // 供 BPM 审批通过前的校验钩子(请款单审批表单只读,无需校验)
  191 + checkForm() {
  192 + return true
  193 + }
  194 + }
  195 +}
  196 +</script>
  197 +
  198 +<style lang="scss" scoped>
  199 +.page {
  200 + padding-bottom: 20rpx;
  201 + background: #f3f3f3;
  202 +}
  203 +
  204 +.section {
  205 + padding: 32rpx;
  206 + background: #fff;
  207 + margin-bottom: 20rpx;
  208 + position: relative;
  209 +}
  210 +
  211 +.company-row {
  212 + display: flex;
  213 + align-items: center;
  214 + margin-bottom: 32rpx;
  215 +
  216 + .company {
  217 + font-size: 36rpx;
  218 + font-weight: 600;
  219 + color: rgba(0, 0, 0, 0.9);
  220 + padding-top: 10rpx;
  221 + line-height: 50rpx;
  222 + }
  223 +
  224 + .kind-tag {
  225 + flex-shrink: 0;
  226 + margin-left: 16rpx;
  227 + margin-top: 10rpx;
  228 + padding: 4rpx 12rpx;
  229 + border-radius: 6rpx;
  230 + font-size: 22rpx;
  231 + line-height: 32rpx;
  232 + background: #FFF1E9;
  233 + color: #E37318;
  234 + }
  235 +}
  236 +
  237 +.row {
  238 + display: flex;
  239 + margin-bottom: 28rpx;
  240 +
  241 + &:last-child {
  242 + margin-bottom: 0;
  243 + }
  244 +
  245 + .label {
  246 + max-width: 420rpx;
  247 + margin-right: 20rpx;
  248 + line-height: 32rpx;
  249 + font-size: 28rpx;
  250 + color: rgba(0, 0, 0, 0.6);
  251 + }
  252 +
  253 + .value {
  254 + flex: 1;
  255 + line-height: 32rpx;
  256 + font-size: 28rpx;
  257 + color: rgba(0, 0, 0, 0.9);
  258 + text-align: right;
  259 + word-break: break-all;
  260 +
  261 + &.act {
  262 + color: $theme-primary;
  263 + }
  264 + }
  265 +
  266 + .file-item {
  267 + margin-bottom: 12rpx;
  268 +
  269 + &:last-child {
  270 + margin-bottom: 0;
  271 + }
  272 + }
  273 +}
  274 +
  275 +.title-header {
  276 + display: flex;
  277 + align-items: center;
  278 + padding: 24rpx 32rpx 12rpx;
  279 + background-color: #ffffff;
  280 +
  281 + .title-header_icon {
  282 + width: 36rpx;
  283 + height: 36rpx;
  284 + margin-right: 12rpx;
  285 + }
  286 +
  287 + span {
  288 + font-size: 34rpx;
  289 + font-weight: 600;
  290 + color: rgba(0, 0, 0, 0.9);
  291 + }
  292 +}
  293 +
  294 +.sub-table {
  295 + background: #fff;
  296 + margin-bottom: 20rpx;
  297 +}
  298 +
  299 +.sub-header {
  300 + display: flex;
  301 + align-items: center;
  302 + padding: 16rpx 0 16rpx 32rpx;
  303 +
  304 + .sub-bar {
  305 + width: 6rpx;
  306 + height: 32rpx;
  307 + margin-right: 14rpx;
  308 + }
  309 +
  310 + .sub-title {
  311 + font-size: 30rpx;
  312 + font-weight: 600;
  313 + color: rgba(0, 0, 0, 0.9);
  314 + flex: 1;
  315 + line-height: 42rpx;
  316 + }
  317 +}
  318 +
  319 +.sub-body {
  320 + padding: 0 32rpx 24rpx;
  321 +
  322 + .empty-tip {
  323 + text-align: center;
  324 + padding: 60rpx 0;
  325 + color: rgba(0, 0, 0, 0.4);
  326 + font-size: 28rpx;
  327 + }
  328 +
  329 + .card {
  330 + position: relative;
  331 + background: #fafafa;
  332 + border-radius: 12rpx;
  333 + padding: 32rpx 28rpx 20rpx;
  334 + margin-bottom: 24rpx;
  335 +
  336 + .card-index {
  337 + position: absolute;
  338 + top: 0;
  339 + right: 0;
  340 + background: rgba(24, 144, 255, 0.08);
  341 + color: $theme-primary;
  342 + font-size: 22rpx;
  343 + line-height: 36rpx;
  344 + padding: 0 16rpx;
  345 + border-bottom-left-radius: 12rpx;
  346 + border-top-right-radius: 12rpx;
  347 + }
  348 +
  349 + .row {
  350 + align-items: center;
  351 + justify-content: space-between;
  352 + padding: 14rpx 0;
  353 + margin-bottom: 0;
  354 + border-bottom: 1rpx dashed #f2f2f2;
  355 +
  356 + &:last-child {
  357 + border-bottom: none;
  358 + }
  359 +
  360 + .label {
  361 + flex-shrink: 0;
  362 + width: 220rpx;
  363 + max-width: none;
  364 + margin-right: 0;
  365 + font-size: 28rpx;
  366 + color: rgba(0, 0, 0, 0.6);
  367 + line-height: 40rpx;
  368 + }
  369 +
  370 + .value {
  371 + flex: 1;
  372 + text-align: right;
  373 + font-size: 28rpx;
  374 + color: rgba(0, 0, 0, 0.9);
  375 + line-height: 40rpx;
  376 + overflow: hidden;
  377 + text-overflow: ellipsis;
  378 + white-space: nowrap;
  379 + }
  380 + }
  381 + }
  382 +
  383 + .total-row {
  384 + display: flex;
  385 + align-items: center;
  386 + padding: 20rpx 28rpx;
  387 + border-radius: 12rpx;
  388 + border: 1rpx solid #e5e6eb;
  389 + background: #fafafa;
  390 +
  391 + .total-title {
  392 + flex-shrink: 0;
  393 + font-size: 28rpx;
  394 + font-weight: 600;
  395 + color: rgba(0, 0, 0, 0.9);
  396 + margin-right: 32rpx;
  397 + }
  398 +
  399 + .total-item {
  400 + display: flex;
  401 + align-items: center;
  402 + margin-right: 32rpx;
  403 +
  404 + &:last-child {
  405 + margin-right: 0;
  406 + }
  407 +
  408 + .total-label {
  409 + font-size: 26rpx;
  410 + color: rgba(0, 0, 0, 0.6);
  411 + margin-right: 8rpx;
  412 + }
  413 +
  414 + .total-value {
  415 + font-size: 26rpx;
  416 + color: rgba(0, 0, 0, 0.9);
  417 + }
  418 + }
  419 + }
  420 +}
  421 +</style>
... ...
... ... @@ -35,6 +35,8 @@ import MaterialTestViewer from '@/pages/material-test/materialTestViewer.vue'
35 35 import MaterialSettlementViewer from '@/pages/material-settlement/materialSettlementViewer.vue'
36 36 import WarehouseMaterialViewer from '@/pages/warehouse-material/warehouseMaterialViewer.vue'
37 37 import OutrightPurchaseViewer from '@/pages/outright-purchase/outrightPurchaseViewer.vue'
  38 +import PaymentRequestViewer from '@/pages/payment-request/viewer.vue'
  39 +import PaymentRequestApprove from '@/pages/payment-request/approve.vue'
38 40
39 41 export default function registerComponents(Vue) {
40 42 Vue.component('CustomerDevelopViewer', CustomerDevelopViewer)
... ... @@ -74,4 +76,6 @@ export default function registerComponents(Vue) {
74 76 Vue.component('MaterialSettlementViewer', MaterialSettlementViewer)
75 77 Vue.component('WarehouseMaterialViewer', WarehouseMaterialViewer)
76 78 Vue.component('OutrightPurchaseViewer', OutrightPurchaseViewer)
  79 + Vue.component('PaymentRequestViewer', PaymentRequestViewer)
  80 + Vue.component('PaymentRequestApprove', PaymentRequestApprove)
77 81 }
... ...
... ... @@ -190,6 +190,12 @@ export const getSysFlowComponentPath = (bizFlag) => {
190 190 case 'BUYOUT_ACCOUNT_ORDER_EDIT': // 买断入库核算单
191 191 componentPath = 'OutrightPurchaseViewer'; // 买断入库核算单-审批
192 192 break;
  193 + case 'FUND_PAYMENT_REQUEST': // 请款单
  194 + componentPath = 'PaymentRequestViewer'; // 请款单-审批详情
  195 + break;
  196 + case 'FUND_PAYMENT_REQUEST_EDIT': // 请款单
  197 + componentPath = 'PaymentRequestApprove'; // 请款单-审批
  198 + break;
193 199 }
194 200 return componentPath;
195 201 };
... ...