来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
269 lines
10 KiB
Plaintext
269 lines
10 KiB
Plaintext
<view class="cost-panel">
|
||
<view class="seg-tabs">
|
||
<view class="seg-tab {{tab === 'add' ? 'active' : ''}}" bindtap="onTabAdd">添加其他成本</view>
|
||
<view class="seg-tab {{tab === 'history' ? 'active' : ''}}" bindtap="onTabHistory">成本历史</view>
|
||
</view>
|
||
|
||
<view wx:if="{{error}}" class="error-bar">{{error}}</view>
|
||
|
||
<view wx:if="{{tab === 'add'}}" class="form-block">
|
||
<view class="field">
|
||
<text class="field-label">凭证/发票{{requireVoucher ? '' : '(选填)'}}</text>
|
||
<view class="voucher-row">
|
||
<view
|
||
wx:if="{{voucherCount < maxVouchers}}"
|
||
class="voucher-add"
|
||
bindtap="chooseVoucher"
|
||
>
|
||
+ 上传
|
||
</view>
|
||
</view>
|
||
<view class="field-hint">可一次选多张;AI 按类型分组。识别失败可手填金额并选类型</view>
|
||
<view wx:if="{{requireVoucher && !voucherCount}}" class="field-hint">须上传至少 1 张凭证</view>
|
||
</view>
|
||
|
||
<view wx:for="{{groups}}" wx:key="groupKey" class="group-card {{item.matched ? '' : 'is-unmatched'}}">
|
||
<view class="group-head">
|
||
<block wx:if="{{item.isPending}}">
|
||
<text class="group-title">识别中</text>
|
||
<view class="group-type-link" bindtap="skipPendingAi">改为手填</view>
|
||
</block>
|
||
<block wx:elif="{{item.matched}}">
|
||
<text class="group-title">{{item.subtypeLabel}}</text>
|
||
<view
|
||
class="group-type-link"
|
||
data-group-key="{{item.groupKey}}"
|
||
bindtap="openTypePicker"
|
||
>改类型</view>
|
||
</block>
|
||
<block wx:else>
|
||
<text class="group-title">{{item.suggestedLabel}}</text>
|
||
<view class="group-head-actions">
|
||
<button
|
||
class="mini-btn"
|
||
size="mini"
|
||
data-group-key="{{item.groupKey}}"
|
||
bindtap="confirmCreateSuggested"
|
||
>新建此分类</button>
|
||
<view
|
||
class="group-type-link"
|
||
data-group-key="{{item.groupKey}}"
|
||
bindtap="openTypePicker"
|
||
>选已有</view>
|
||
</view>
|
||
</block>
|
||
</view>
|
||
|
||
<view wx:if="{{item.isPending}}" class="unmatched-box">
|
||
<text class="unmatched-hint">识别较慢时可点「改为手填」,自行填金额并选类型</text>
|
||
</view>
|
||
<view wx:elif="{{!item.matched}}" class="unmatched-box">
|
||
<text class="unmatched-hint">可手填下方金额;须新建或选已有类型后再提交</text>
|
||
</view>
|
||
|
||
<view class="voucher-row compact">
|
||
<view
|
||
wx:for="{{item.vouchers}}"
|
||
wx:for-item="voucher"
|
||
wx:for-index="vIndex"
|
||
wx:key="id"
|
||
class="voucher-item"
|
||
>
|
||
<image
|
||
class="voucher-img"
|
||
src="{{voucher.preview}}"
|
||
mode="aspectFill"
|
||
data-url="{{voucher.preview}}"
|
||
bindtap="previewVoucher"
|
||
/>
|
||
<view
|
||
class="voucher-remove"
|
||
data-group-key="{{item.groupKey}}"
|
||
data-id="{{voucher.id}}"
|
||
catchtap="removeVoucher"
|
||
>×</view>
|
||
<text class="voucher-amount">{{voucher.amountCaption}}</text>
|
||
<view class="kind-row">
|
||
<text
|
||
class="kind-opt {{voucher.document_kind === 'invoice' ? 'active' : ''}}"
|
||
data-group-key="{{item.groupKey}}"
|
||
data-id="{{voucher.id}}"
|
||
data-kind="invoice"
|
||
catchtap="toggleDocumentKind"
|
||
>发票</text>
|
||
<text
|
||
class="kind-opt {{voucher.document_kind !== 'invoice' ? 'active' : ''}}"
|
||
data-group-key="{{item.groupKey}}"
|
||
data-id="{{voucher.id}}"
|
||
data-kind="voucher"
|
||
catchtap="toggleDocumentKind"
|
||
>凭证</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{!item.isPending}}" class="group-fields">
|
||
<view class="field">
|
||
<text class="field-label">组合计金额</text>
|
||
<input
|
||
class="field-control"
|
||
type="digit"
|
||
placeholder="请输入金额"
|
||
value="{{item.amount}}"
|
||
data-group-key="{{item.groupKey}}"
|
||
bindinput="onGroupAmountInput"
|
||
/>
|
||
</view>
|
||
<view class="field">
|
||
<text class="field-label">备注</text>
|
||
<input
|
||
class="field-control"
|
||
placeholder="选填"
|
||
value="{{item.remark}}"
|
||
data-group-key="{{item.groupKey}}"
|
||
bindinput="onGroupRemarkInput"
|
||
/>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{!groups.length}}" class="empty-groups">上传凭证后将按类型自动分组</view>
|
||
|
||
<button class="submit-btn" loading="{{submitting}}" disabled="{{submitting}}" bindtap="submitFreeCost">
|
||
提交{{groups.length > 1 ? '全部组' : ''}}
|
||
</button>
|
||
</view>
|
||
|
||
<view wx:else class="history-block">
|
||
<view class="chip-row">
|
||
<view
|
||
wx:for="{{periodOptions}}"
|
||
wx:key="key"
|
||
class="chip {{periodKey === item.key ? 'active' : ''}}"
|
||
data-key="{{item.key}}"
|
||
bindtap="onPeriodTap"
|
||
>{{item.label}}</view>
|
||
<view class="chip invoice-upload-btn" bindtap="chooseInvoice">上传发票</view>
|
||
</view>
|
||
<view class="hist-sum">
|
||
<view class="hist-sum-item">
|
||
<text class="hist-sum-label">已入账</text>
|
||
<text class="hist-sum-value posted">¥{{postedAmountText}}</text>
|
||
</view>
|
||
<view class="hist-sum-item">
|
||
<text class="hist-sum-label">已驳回</text>
|
||
<text class="hist-sum-value rejected">¥{{rejectedAmountText}}</text>
|
||
</view>
|
||
</view>
|
||
<view wx:if="{{loading}}" class="loading-wrap"><van-loading size="24px" /></view>
|
||
<van-empty wx:elif="{{!historyRows.length}}" description="暂无自己的其他成本" />
|
||
<view wx:else class="hist-list">
|
||
<view wx:for="{{historyRows}}" wx:key="id" class="hist-row">
|
||
<view
|
||
class="hist-thumb-wrap"
|
||
data-url="{{item.coverUrl}}"
|
||
data-urls="{{item.voucherUrls}}"
|
||
bindtap="previewHistoryVoucher"
|
||
>
|
||
<image wx:if="{{item.coverUrl}}" class="hist-thumb" src="{{item.coverUrl}}" mode="aspectFill" />
|
||
<view wx:else class="hist-thumb hist-thumb-empty">无图</view>
|
||
<view wx:if="{{item.voucherCount > 1}}" class="hist-thumb-badge">{{item.voucherCount}}</view>
|
||
</view>
|
||
<view class="hist-main">
|
||
<view class="hist-line1">
|
||
<text class="hist-type">{{item.typeLabel}}</text>
|
||
<text class="hist-amount">¥{{item.amountText}}</text>
|
||
</view>
|
||
<view class="hist-line2">
|
||
<text class="hist-remark">{{item.remarkText || '无备注'}}</text>
|
||
<text class="hist-status {{item.statusTone}}">{{item.statusText}}</text>
|
||
</view>
|
||
<view wx:if="{{item.createdAtText || item.invoiceUrls.length}}" class="hist-line3">
|
||
<text class="hist-time">{{item.createdAtText}}</text>
|
||
<text
|
||
wx:if="{{item.invoiceUrls.length}}"
|
||
class="group-type-link"
|
||
data-urls="{{item.invoiceUrls}}"
|
||
catchtap="previewHistoryInvoice"
|
||
>发票</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view wx:if="{{!loading && historyTotal > 0 && historyPageCount > 1}}" class="hist-pager">
|
||
<view
|
||
class="pager-btn {{canHistoryPrev ? '' : 'is-disabled'}}"
|
||
bindtap="onHistoryPrev"
|
||
>上一页</view>
|
||
<text class="pager-info">{{historyPage}} / {{historyPageCount}}</text>
|
||
<view
|
||
class="pager-btn {{canHistoryNext ? '' : 'is-disabled'}}"
|
||
bindtap="onHistoryNext"
|
||
>下一页</view>
|
||
</view>
|
||
</view>
|
||
|
||
<root-portal enable="{{true}}">
|
||
<view wx:if="{{showTypePicker}}" class="sheet-mask" catchtap="closeTypePicker">
|
||
<view class="type-sheet" catchtap="noop">
|
||
<view class="type-sheet-title">选择类型</view>
|
||
<scroll-view scroll-y class="type-sheet-list" show-scrollbar="{{false}}">
|
||
<view
|
||
wx:for="{{types}}"
|
||
wx:key="code"
|
||
class="type-sheet-item {{typePickerIndex === index ? 'is-active' : ''}}"
|
||
data-index="{{index}}"
|
||
bindtap="onTypePickerItemTap"
|
||
>{{item.label || item.code}}</view>
|
||
</scroll-view>
|
||
<view class="type-sheet-add" bindtap="openAddTypeFromPicker">+ 新增类型</view>
|
||
<view class="type-sheet-actions">
|
||
<button class="modal-btn ghost" bindtap="closeTypePicker">取消</button>
|
||
<button class="modal-btn" bindtap="confirmTypePicker">确定</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{showAddType}}" class="modal-mask" catchtap="closeAddType">
|
||
<view class="modal-card" catchtap="noop">
|
||
<view class="modal-title">新增成本类型</view>
|
||
<input
|
||
class="field-control"
|
||
placeholder="例如:停车费"
|
||
maxlength="40"
|
||
value="{{newTypeName}}"
|
||
bindinput="onNewTypeInput"
|
||
focus="{{showAddType}}"
|
||
/>
|
||
<view class="modal-actions">
|
||
<button class="modal-btn ghost" disabled="{{addingType}}" bindtap="closeAddType">取消</button>
|
||
<button class="modal-btn" loading="{{addingType}}" disabled="{{addingType}}" bindtap="confirmAddType">确定</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{showInvoiceSheet}}" class="modal-mask" catchtap="closeInvoiceSheet">
|
||
<view class="modal-card" catchtap="noop">
|
||
<view class="modal-title">上传发票</view>
|
||
<view class="invoice-ocr">{{invoiceOcrText}}</view>
|
||
<scroll-view wx:if="{{invoiceCandidates.length}}" scroll-y class="invoice-cand-list" show-scrollbar="{{false}}">
|
||
<view
|
||
wx:for="{{invoiceCandidates}}"
|
||
wx:key="id"
|
||
class="invoice-cand {{item.selected ? 'is-active' : ''}}"
|
||
data-id="{{item.id}}"
|
||
bindtap="toggleInvoiceCandidate"
|
||
>
|
||
<text class="invoice-cand-main">{{item.subtype_label}} ¥{{item.amountText}}</text>
|
||
<text class="invoice-cand-sub">{{item.subText}}</text>
|
||
</view>
|
||
</scroll-view>
|
||
<view class="modal-actions">
|
||
<button class="modal-btn ghost" disabled="{{invoiceSubmitting}}" bindtap="closeInvoiceSheet">取消</button>
|
||
<button class="modal-btn" loading="{{invoiceSubmitting}}" disabled="{{invoiceSubmitting}}" bindtap="confirmInvoiceSheet">确定</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</root-portal>
|
||
</view>
|