Merge branch 'master' into master-6-9
This commit is contained in:
@@ -1,120 +0,0 @@
|
|||||||
alias ll='ls -alhG'
|
|
||||||
|
|
||||||
# Starship prompt
|
|
||||||
eval "$(starship init zsh)"
|
|
||||||
|
|
||||||
# zsh-autosuggestions 自动补全
|
|
||||||
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
||||||
|
|
||||||
# NVM 懒加载 - 只在第一次使用相关命令时再初始化
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
_nvm_default_bin() {
|
|
||||||
local default_alias version_dir
|
|
||||||
[ -r "$NVM_DIR/alias/default" ] || return 1
|
|
||||||
|
|
||||||
default_alias="$(<"$NVM_DIR/alias/default")"
|
|
||||||
default_alias="${default_alias#"${default_alias%%[![:space:]]*}"}"
|
|
||||||
default_alias="${default_alias%"${default_alias##*[![:space:]]}"}"
|
|
||||||
|
|
||||||
case "$default_alias" in
|
|
||||||
v[0-9]*)
|
|
||||||
version_dir="$NVM_DIR/versions/node/$default_alias"
|
|
||||||
;;
|
|
||||||
[0-9]*)
|
|
||||||
version_dir="$(ls -d "$NVM_DIR"/versions/node/v"$default_alias".* 2>/dev/null | tail -n 1)"
|
|
||||||
;;
|
|
||||||
node|stable|lts/*)
|
|
||||||
version_dir="$(ls -d "$NVM_DIR"/versions/node/v* 2>/dev/null | sort -V | tail -n 1)"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ -n "$version_dir" ] && [ -x "$version_dir/bin/node" ] || return 1
|
|
||||||
printf '%s\n' "$version_dir/bin"
|
|
||||||
}
|
|
||||||
if _nvm_default_node_bin="$(_nvm_default_bin)"; then
|
|
||||||
export PATH="$_nvm_default_node_bin:$PATH"
|
|
||||||
fi
|
|
||||||
unset _nvm_default_node_bin
|
|
||||||
_lazy_load_nvm() {
|
|
||||||
unset -f nvm node npm npx pnpm yarn 2>/dev/null
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] || return 1
|
|
||||||
\. "$NVM_DIR/nvm.sh"
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
||||||
hash -r 2>/dev/null
|
|
||||||
}
|
|
||||||
nvm() { _lazy_load_nvm && nvm "$@"; }
|
|
||||||
node() { _lazy_load_nvm && node "$@"; }
|
|
||||||
npm() { _lazy_load_nvm && npm "$@"; }
|
|
||||||
npx() { _lazy_load_nvm && npx "$@"; }
|
|
||||||
pnpm() { _lazy_load_nvm && pnpm "$@"; }
|
|
||||||
yarn() { _lazy_load_nvm && yarn "$@"; }
|
|
||||||
export PATH="/Applications/EServer/bin:$PATH"
|
|
||||||
function EC_start(){
|
|
||||||
/Applications/EasyConnect.app/Contents/Resources/bin/EasyMonitor > /dev/null 2>&1 &
|
|
||||||
/Applications/EasyConnect.app/Contents/MacOS/EasyConnect > /dev/null 2>&1 &
|
|
||||||
open /Applications/EasyConnect.app
|
|
||||||
}
|
|
||||||
|
|
||||||
function EC_kill(){
|
|
||||||
pkill EasyMonitor
|
|
||||||
pkill ECAgent
|
|
||||||
pkill ECAgentProxy
|
|
||||||
pkill EasyConnect
|
|
||||||
}
|
|
||||||
# The following lines have been added by Docker Desktop to enable Docker CLI completions.
|
|
||||||
fpath=(/Users/long/.docker/completions $fpath)
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit
|
|
||||||
# End of Docker CLI completions
|
|
||||||
|
|
||||||
|
|
||||||
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/
|
|
||||||
|
|
||||||
# pyenv 懒加载 - 只在第一次使用 Python 相关命令时再初始化
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
_lazy_load_pyenv() {
|
|
||||||
unset -f pyenv python python3 pip pip3 2>/dev/null
|
|
||||||
|
|
||||||
local pyenv_bin
|
|
||||||
pyenv_bin="$(command -v pyenv 2>/dev/null)"
|
|
||||||
if [ -z "$pyenv_bin" ] && [ -x /opt/homebrew/bin/pyenv ]; then
|
|
||||||
pyenv_bin=/opt/homebrew/bin/pyenv
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "$pyenv_bin" ] || return 1
|
|
||||||
|
|
||||||
eval "$("$pyenv_bin" init --path)"
|
|
||||||
eval "$("$pyenv_bin" init - zsh)"
|
|
||||||
hash -r 2>/dev/null
|
|
||||||
}
|
|
||||||
pyenv() { _lazy_load_pyenv && pyenv "$@"; }
|
|
||||||
python() { _lazy_load_pyenv && python "$@"; }
|
|
||||||
python3() { _lazy_load_pyenv && python3 "$@"; }
|
|
||||||
pip() { _lazy_load_pyenv && pip "$@"; }
|
|
||||||
pip3() { _lazy_load_pyenv && pip3 "$@"; }
|
|
||||||
|
|
||||||
# 引入 bash 配置
|
|
||||||
if [ -f ~/.bash_profile ]; then
|
|
||||||
source ~/.bash_profile
|
|
||||||
fi
|
|
||||||
if [ -f ~/.bashrc ]; then
|
|
||||||
source ~/.bashrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Added by Windsurf
|
|
||||||
export PATH="/Users/long/.codeium/windsurf/bin:$PATH"
|
|
||||||
|
|
||||||
# Added by Antigravity
|
|
||||||
export PATH="/Users/long/.antigravity/antigravity/bin:$PATH"
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# MindOS Desktop — CLI (mindos)
|
|
||||||
export PATH="$HOME/.mindos/bin:$PATH"
|
|
||||||
|
|
||||||
source "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# Added by Antigravity
|
|
||||||
export PATH="/Users/long/.antigravity/antigravity/bin:$PATH"
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
alias ll='ls -alhG'
|
|
||||||
|
|
||||||
# Starship prompt
|
|
||||||
eval "$(starship init zsh)"
|
|
||||||
|
|
||||||
# zsh-autosuggestions 自动补全
|
|
||||||
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
||||||
|
|
||||||
# NVM
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
|
||||||
\. "$NVM_DIR/nvm.sh"
|
|
||||||
fi
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
||||||
export PATH="/Applications/EServer/bin:$PATH"
|
|
||||||
function EC_start(){
|
|
||||||
/Applications/EasyConnect.app/Contents/Resources/bin/EasyMonitor > /dev/null 2>&1 &
|
|
||||||
/Applications/EasyConnect.app/Contents/MacOS/EasyConnect > /dev/null 2>&1 &
|
|
||||||
open /Applications/EasyConnect.app
|
|
||||||
}
|
|
||||||
|
|
||||||
function EC_kill(){
|
|
||||||
pkill EasyMonitor
|
|
||||||
pkill ECAgent
|
|
||||||
pkill ECAgentProxy
|
|
||||||
pkill EasyConnect
|
|
||||||
}
|
|
||||||
# The following lines have been added by Docker Desktop to enable Docker CLI completions.
|
|
||||||
fpath=(/Users/long/.docker/completions $fpath)
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit
|
|
||||||
# End of Docker CLI completions
|
|
||||||
|
|
||||||
|
|
||||||
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
export PATH="/opt/homebrew/bin:$PYENV_ROOT/bin:$PATH"
|
|
||||||
if command -v pyenv >/dev/null 2>&1; then
|
|
||||||
eval "$(pyenv init --path)"
|
|
||||||
eval "$(pyenv init - zsh)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 引入 bash 配置
|
|
||||||
if [ -f ~/.bash_profile ]; then
|
|
||||||
source ~/.bash_profile
|
|
||||||
fi
|
|
||||||
if [ -f ~/.bashrc ]; then
|
|
||||||
source ~/.bashrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Added by Windsurf
|
|
||||||
export PATH="/Users/long/.codeium/windsurf/bin:$PATH"
|
|
||||||
|
|
||||||
# Added by Antigravity
|
|
||||||
export PATH="/Users/long/.antigravity/antigravity/bin:$PATH"
|
|
||||||
|
|
||||||
if command -v nvm >/dev/null 2>&1; then
|
|
||||||
_nvm_default_version="$(nvm version default 2>/dev/null)"
|
|
||||||
if [ -n "$_nvm_default_version" ] && [ -d "$NVM_DIR/versions/node/$_nvm_default_version/bin" ]; then
|
|
||||||
export PATH="$NVM_DIR/versions/node/$_nvm_default_version/bin:$PATH"
|
|
||||||
fi
|
|
||||||
unset _nvm_default_version
|
|
||||||
fi
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# MindOS Desktop — CLI (mindos)
|
|
||||||
export PATH="$HOME/.mindos/bin:$PATH"
|
|
||||||
|
|
||||||
source "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# Added by Antigravity
|
|
||||||
export PATH="/Users/long/.antigravity/antigravity/bin:$PATH"
|
|
||||||
@@ -1096,6 +1096,11 @@
|
|||||||
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="方式" min-width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatPayOrderSource(row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="创建时间" min-width="136">
|
<el-table-column label="创建时间" min-width="136">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -1154,6 +1159,11 @@
|
|||||||
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="方式" min-width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatPayOrderSource(row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="创建时间" min-width="136">
|
<el-table-column label="创建时间" min-width="136">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -1783,7 +1793,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="o in editPaidOrders"
|
v-for="o in editPaidOrders"
|
||||||
:key="o.id"
|
:key="o.id"
|
||||||
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)}`"
|
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)} · ${formatPayOrderSource(o)}`"
|
||||||
:value="o.id"
|
:value="o.id"
|
||||||
class="!h-auto py-1.5"
|
class="!h-auto py-1.5"
|
||||||
>
|
>
|
||||||
@@ -1793,7 +1803,7 @@
|
|||||||
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between text-xs text-gray-400 mt-1">
|
<div class="flex items-center justify-between text-xs text-gray-400 mt-1">
|
||||||
<span class="truncate pr-2">{{ formatPoCategory(o.order_type) }}<template v-if="o.remark"> · {{ o.remark }}</template></span>
|
<span class="truncate pr-2">{{ formatPoCategory(o.order_type) }} · {{ formatPayOrderSource(o) }}<template v-if="o.remark"> · {{ o.remark }}</template></span>
|
||||||
<span class="shrink-0">{{ String(o.create_time || '').substring(0, 16) }}</span>
|
<span class="shrink-0">{{ String(o.create_time || '').substring(0, 16) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2287,13 +2297,13 @@
|
|||||||
>
|
>
|
||||||
<el-form-item label="添加方式" prop="add_mode">
|
<el-form-item label="添加方式" prop="add_mode">
|
||||||
<el-radio-group v-model="addPayOrderForm.add_mode">
|
<el-radio-group v-model="addPayOrderForm.add_mode">
|
||||||
<el-radio value="create">手动创建</el-radio>
|
<el-radio value="create">付呗</el-radio>
|
||||||
<el-radio value="link">关联已有</el-radio>
|
<el-radio value="link">关联已有</el-radio>
|
||||||
<el-radio value="completion_only">直接完单申请</el-radio>
|
<el-radio value="completion_only">直接完单申请</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 手动创建模式 -->
|
<!-- 付呗(手动创建支付单) -->
|
||||||
<template v-if="addPayOrderForm.add_mode === 'create'">
|
<template v-if="addPayOrderForm.add_mode === 'create'">
|
||||||
<el-form-item label="费用类别" prop="order_type">
|
<el-form-item label="费用类别" prop="order_type">
|
||||||
<el-select v-model="addPayOrderForm.order_type" class="w-full">
|
<el-select v-model="addPayOrderForm.order_type" class="w-full">
|
||||||
@@ -2358,12 +2368,17 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="o in addPayOrderAvailableList"
|
v-for="o in addPayOrderAvailableList"
|
||||||
:key="o.id"
|
:key="o.id"
|
||||||
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)}`"
|
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)} · ${formatPayOrderSource(o)}`"
|
||||||
:value="o.id"
|
:value="o.id"
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex flex-col gap-0.5 py-0.5">
|
||||||
<span class="text-sm">{{ o.order_no }}</span>
|
<div class="flex items-center justify-between">
|
||||||
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
<span class="text-sm">{{ o.order_no }}</span>
|
||||||
|
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-400">
|
||||||
|
{{ formatPoCategory(o.order_type) }} · {{ formatPayOrderSource(o) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -3980,10 +3995,14 @@ const detailLinkedPayOrders = computed(() => {
|
|||||||
return Array.isArray(arr) ? arr : []
|
return Array.isArray(arr) ? arr : []
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 需代收:业务订单总金额 − 关联已付总额 */
|
/** 需代收:优先用关联时记录的固定快照值;历史单(无快照)回退实时计算 总金额 − 关联已付总额 */
|
||||||
const detailAgencyToCollect = computed(() => {
|
const detailAgencyToCollect = computed(() => {
|
||||||
const d = detailData.value
|
const d = detailData.value
|
||||||
if (!d) return 0
|
if (!d) return 0
|
||||||
|
const snap = d.agency_collect_amount
|
||||||
|
if (snap !== null && snap !== undefined && snap !== '') {
|
||||||
|
return Number(snap) || 0
|
||||||
|
}
|
||||||
const total = Number(d.amount) || 0
|
const total = Number(d.amount) || 0
|
||||||
const paid = Number(d.linked_pay_paid_total) || 0
|
const paid = Number(d.linked_pay_paid_total) || 0
|
||||||
return Math.round((total - paid) * 100) / 100
|
return Math.round((total - paid) * 100) / 100
|
||||||
@@ -4692,7 +4711,7 @@ const editDiagnosisCreatorDeptBreadcrumbs = computed(() => {
|
|||||||
.filter((segs) => segs.length > 0)
|
.filter((segs) => segs.length > 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
const editPaidOrders = ref<Array<{ id: number; order_no?: string; amount?: number | string; order_type?: number | string; remark?: string; create_time?: string }>>([])
|
const editPaidOrders = ref<Array<{ id: number; order_no?: string; amount?: number | string; order_type?: number | string; remark?: string; create_time?: string; payment_method?: string; create_type?: string }>>([])
|
||||||
const editPaidOrdersLoading = ref(false)
|
const editPaidOrdersLoading = ref(false)
|
||||||
const editDepositMin = ref(0)
|
const editDepositMin = ref(0)
|
||||||
|
|
||||||
@@ -4708,6 +4727,24 @@ function formatPoCategory(t: unknown) {
|
|||||||
return m[Number(t)] || '未知'
|
return m[Number(t)] || '未知'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatPayOrderSource(row: { payment_method?: unknown; create_type?: unknown }) {
|
||||||
|
const createType = String(row?.create_type || '')
|
||||||
|
if (createType === 'wechat_work') return '企业微信对外收款'
|
||||||
|
if (createType === 'fubei') return '付呗'
|
||||||
|
const paymentMethod = String(row?.payment_method || '')
|
||||||
|
const methodMap: Record<string, string> = {
|
||||||
|
alipay: '支付宝',
|
||||||
|
wechat: '微信',
|
||||||
|
wechat_work: '企业微信',
|
||||||
|
fubei: '付呗',
|
||||||
|
manual: '手动确认到账'
|
||||||
|
}
|
||||||
|
if (paymentMethod && methodMap[paymentMethod]) {
|
||||||
|
return methodMap[paymentMethod]
|
||||||
|
}
|
||||||
|
return '普通订单'
|
||||||
|
}
|
||||||
|
|
||||||
const editLinkedPaidTotal = computed(() => {
|
const editLinkedPaidTotal = computed(() => {
|
||||||
const ids = new Set(editForm.pay_order_ids.map((x) => Number(x)))
|
const ids = new Set(editForm.pay_order_ids.map((x) => Number(x)))
|
||||||
let s = 0
|
let s = 0
|
||||||
@@ -5701,7 +5738,7 @@ const addPayOrderAlertTitle = computed(() => {
|
|||||||
if (addPayOrderForm.add_mode === 'completion_only') {
|
if (addPayOrderForm.add_mode === 'completion_only') {
|
||||||
return '不创建或关联支付单,仅提交完单申请,由审核人员在支付审核时处理。'
|
return '不创建或关联支付单,仅提交完单申请,由审核人员在支付审核时处理。'
|
||||||
}
|
}
|
||||||
return '可以手动创建新支付单,或关联已存在但未绑定的支付单。'
|
return '可以通过付呗创建新支付单,或关联已存在但未绑定的支付单。'
|
||||||
})
|
})
|
||||||
|
|
||||||
const addPayOrderForm = reactive({
|
const addPayOrderForm = reactive({
|
||||||
|
|||||||
@@ -962,6 +962,11 @@
|
|||||||
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="方式" min-width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatPayOrderSource(row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="创建时间" min-width="136">
|
<el-table-column label="创建时间" min-width="136">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -1020,6 +1025,11 @@
|
|||||||
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
<el-tag v-if="row.is_exempt === 1" type="warning" size="small" class="ml-1">豁免</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="方式" min-width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatPayOrderSource(row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
<el-table-column prop="creator_name" label="创建人" width="80" show-overflow-tooltip />
|
||||||
<el-table-column label="创建时间" min-width="136">
|
<el-table-column label="创建时间" min-width="136">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -1555,7 +1565,7 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="o in editPaidOrders"
|
v-for="o in editPaidOrders"
|
||||||
:key="o.id"
|
:key="o.id"
|
||||||
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)}`"
|
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)} · ${formatPayOrderSource(o)}`"
|
||||||
:value="o.id"
|
:value="o.id"
|
||||||
class="!h-auto py-1.5"
|
class="!h-auto py-1.5"
|
||||||
>
|
>
|
||||||
@@ -1565,7 +1575,7 @@
|
|||||||
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between text-xs text-gray-400 mt-1">
|
<div class="flex items-center justify-between text-xs text-gray-400 mt-1">
|
||||||
<span class="truncate pr-2">{{ formatPoCategory(o.order_type) }}<template v-if="o.remark"> · {{ o.remark }}</template></span>
|
<span class="truncate pr-2">{{ formatPoCategory(o.order_type) }} · {{ formatPayOrderSource(o) }}<template v-if="o.remark"> · {{ o.remark }}</template></span>
|
||||||
<span class="shrink-0">{{ String(o.create_time || '').substring(0, 16) }}</span>
|
<span class="shrink-0">{{ String(o.create_time || '').substring(0, 16) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1971,7 +1981,7 @@
|
|||||||
@closed="addPayOrderFormRef?.clearValidate()"
|
@closed="addPayOrderFormRef?.clearValidate()"
|
||||||
>
|
>
|
||||||
<el-alert
|
<el-alert
|
||||||
title="可以手动创建新支付单,或关联已存在但未绑定的支付单。"
|
:title="addPayOrderAlertTitle"
|
||||||
type="info"
|
type="info"
|
||||||
:closable="false"
|
:closable="false"
|
||||||
show-icon
|
show-icon
|
||||||
@@ -1987,12 +1997,13 @@
|
|||||||
>
|
>
|
||||||
<el-form-item label="添加方式" prop="add_mode">
|
<el-form-item label="添加方式" prop="add_mode">
|
||||||
<el-radio-group v-model="addPayOrderForm.add_mode">
|
<el-radio-group v-model="addPayOrderForm.add_mode">
|
||||||
<el-radio value="create">手动创建</el-radio>
|
<el-radio value="create">付呗</el-radio>
|
||||||
<el-radio value="link">关联已有</el-radio>
|
<el-radio value="link">关联已有</el-radio>
|
||||||
|
<el-radio value="completion_only">直接完单申请</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 手动创建模式 -->
|
<!-- 付呗(手动创建支付单) -->
|
||||||
<template v-if="addPayOrderForm.add_mode === 'create'">
|
<template v-if="addPayOrderForm.add_mode === 'create'">
|
||||||
<el-form-item label="费用类别" prop="order_type">
|
<el-form-item label="费用类别" prop="order_type">
|
||||||
<el-select v-model="addPayOrderForm.order_type" class="w-full">
|
<el-select v-model="addPayOrderForm.order_type" class="w-full">
|
||||||
@@ -2028,6 +2039,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- 直接完单申请(不创建/关联支付单) -->
|
||||||
|
<template v-else-if="addPayOrderForm.add_mode === 'completion_only'">
|
||||||
|
<el-alert
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
class="!mb-0"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
不新增或关联支付单,仅向审核人员提交「完成订单」申请;提交后支付审核将变为待审核,审核通过后将自动结案。
|
||||||
|
</template>
|
||||||
|
</el-alert>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 关联已有模式 -->
|
<!-- 关联已有模式 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-form-item label="选择支付单" prop="link_pay_order_id">
|
<el-form-item label="选择支付单" prop="link_pay_order_id">
|
||||||
@@ -2043,12 +2068,17 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="o in addPayOrderAvailableList"
|
v-for="o in addPayOrderAvailableList"
|
||||||
:key="o.id"
|
:key="o.id"
|
||||||
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)}`"
|
:label="`${o.order_no} · ¥${o.amount} · ${formatPoCategory(o.order_type)} · ${formatPayOrderSource(o)}`"
|
||||||
:value="o.id"
|
:value="o.id"
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex flex-col gap-0.5 py-0.5">
|
||||||
<span class="text-sm">{{ o.order_no }}</span>
|
<div class="flex items-center justify-between">
|
||||||
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
<span class="text-sm">{{ o.order_no }}</span>
|
||||||
|
<span class="text-orange-500 font-medium ml-4">¥{{ o.amount }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-400">
|
||||||
|
{{ formatPoCategory(o.order_type) }} · {{ formatPayOrderSource(o) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -2059,7 +2089,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 完单申请选项 -->
|
<!-- 完单申请选项 -->
|
||||||
<el-form-item label="完单申请">
|
<el-form-item v-if="addPayOrderForm.add_mode !== 'completion_only'" label="完单申请">
|
||||||
<el-radio-group v-model="addPayOrderForm.completion_request">
|
<el-radio-group v-model="addPayOrderForm.completion_request">
|
||||||
<el-radio :value="0">不申请</el-radio>
|
<el-radio :value="0">不申请</el-radio>
|
||||||
<el-radio :value="1">申请完成订单</el-radio>
|
<el-radio :value="1">申请完成订单</el-radio>
|
||||||
@@ -2531,6 +2561,7 @@ import {
|
|||||||
prescriptionOrderRevokePayAudit,
|
prescriptionOrderRevokePayAudit,
|
||||||
prescriptionOrderPatchPrescriptionPatient,
|
prescriptionOrderPatchPrescriptionPatient,
|
||||||
prescriptionOrderLinkPayOrder,
|
prescriptionOrderLinkPayOrder,
|
||||||
|
prescriptionOrderRequestCompletion,
|
||||||
prescriptionOrderSubmitGancaoRecipel,
|
prescriptionOrderSubmitGancaoRecipel,
|
||||||
prescriptionOrderPreviewGancaoRecipel,
|
prescriptionOrderPreviewGancaoRecipel,
|
||||||
prescriptionDetail,
|
prescriptionDetail,
|
||||||
@@ -3495,10 +3526,14 @@ const detailLinkedPayOrders = computed(() => {
|
|||||||
return Array.isArray(arr) ? arr : []
|
return Array.isArray(arr) ? arr : []
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 需代收:业务订单总金额 − 关联已付总额 */
|
/** 需代收:优先用关联时记录的固定快照值;历史单(无快照)回退实时计算 总金额 − 关联已付总额 */
|
||||||
const detailAgencyToCollect = computed(() => {
|
const detailAgencyToCollect = computed(() => {
|
||||||
const d = detailData.value
|
const d = detailData.value
|
||||||
if (!d) return 0
|
if (!d) return 0
|
||||||
|
const snap = d.agency_collect_amount
|
||||||
|
if (snap !== null && snap !== undefined && snap !== '') {
|
||||||
|
return Number(snap) || 0
|
||||||
|
}
|
||||||
const total = Number(d.amount) || 0
|
const total = Number(d.amount) || 0
|
||||||
const paid = Number(d.linked_pay_paid_total) || 0
|
const paid = Number(d.linked_pay_paid_total) || 0
|
||||||
return Math.round((total - paid) * 100) / 100
|
return Math.round((total - paid) * 100) / 100
|
||||||
@@ -4041,7 +4076,7 @@ const editDiagnosisCreatorDeptBreadcrumbs = computed(() => {
|
|||||||
.filter((segs) => segs.length > 0)
|
.filter((segs) => segs.length > 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
const editPaidOrders = ref<Array<{ id: number; order_no?: string; amount?: number | string; order_type?: number | string; remark?: string; create_time?: string }>>([])
|
const editPaidOrders = ref<Array<{ id: number; order_no?: string; amount?: number | string; order_type?: number | string; remark?: string; create_time?: string; payment_method?: string; create_type?: string }>>([])
|
||||||
const editPaidOrdersLoading = ref(false)
|
const editPaidOrdersLoading = ref(false)
|
||||||
const editDepositMin = ref(0)
|
const editDepositMin = ref(0)
|
||||||
|
|
||||||
@@ -4057,6 +4092,24 @@ function formatPoCategory(t: unknown) {
|
|||||||
return m[Number(t)] || '未知'
|
return m[Number(t)] || '未知'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatPayOrderSource(row: { payment_method?: unknown; create_type?: unknown }) {
|
||||||
|
const createType = String(row?.create_type || '')
|
||||||
|
if (createType === 'wechat_work') return '企业微信对外收款'
|
||||||
|
if (createType === 'fubei') return '付呗'
|
||||||
|
const paymentMethod = String(row?.payment_method || '')
|
||||||
|
const methodMap: Record<string, string> = {
|
||||||
|
alipay: '支付宝',
|
||||||
|
wechat: '微信',
|
||||||
|
wechat_work: '企业微信',
|
||||||
|
fubei: '付呗',
|
||||||
|
manual: '手动确认到账'
|
||||||
|
}
|
||||||
|
if (paymentMethod && methodMap[paymentMethod]) {
|
||||||
|
return methodMap[paymentMethod]
|
||||||
|
}
|
||||||
|
return '普通订单'
|
||||||
|
}
|
||||||
|
|
||||||
const editLinkedPaidTotal = computed(() => {
|
const editLinkedPaidTotal = computed(() => {
|
||||||
const ids = new Set(editForm.pay_order_ids.map((x) => Number(x)))
|
const ids = new Set(editForm.pay_order_ids.map((x) => Number(x)))
|
||||||
let s = 0
|
let s = 0
|
||||||
@@ -4898,8 +4951,14 @@ const addPayOrderRowId = ref(0)
|
|||||||
const addPayOrderFormRef = ref<FormInstance>()
|
const addPayOrderFormRef = ref<FormInstance>()
|
||||||
const addPayOrderAvailableLoading = ref(false)
|
const addPayOrderAvailableLoading = ref(false)
|
||||||
const addPayOrderAvailableList = ref<any[]>([])
|
const addPayOrderAvailableList = ref<any[]>([])
|
||||||
|
const addPayOrderAlertTitle = computed(() => {
|
||||||
|
if (addPayOrderForm.add_mode === 'completion_only') {
|
||||||
|
return '不创建或关联支付单,仅提交完单申请,由审核人员在支付审核时处理。'
|
||||||
|
}
|
||||||
|
return '可以通过付呗创建新支付单,或关联已存在但未绑定的支付单。'
|
||||||
|
})
|
||||||
const addPayOrderForm = reactive({
|
const addPayOrderForm = reactive({
|
||||||
add_mode: 'create' as 'create' | 'link',
|
add_mode: 'create' as 'create' | 'link' | 'completion_only',
|
||||||
order_type: 3,
|
order_type: 3,
|
||||||
pay_amount: undefined as number | undefined,
|
pay_amount: undefined as number | undefined,
|
||||||
pay_remark: '',
|
pay_remark: '',
|
||||||
@@ -4907,38 +4966,44 @@ const addPayOrderForm = reactive({
|
|||||||
completion_request: 0
|
completion_request: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const addPayOrderRules: FormRules = {
|
const addPayOrderRules = computed<FormRules>(() => {
|
||||||
add_mode: [{ required: true, message: '请选择添加方式', trigger: 'change' }],
|
const rules: FormRules = {
|
||||||
order_type: [{ required: true, message: '请选择费用类别', trigger: 'change' }],
|
add_mode: [{ required: true, message: '请选择添加方式', trigger: 'change' }]
|
||||||
pay_amount: [
|
}
|
||||||
{ required: true, message: '请输入支付金额', trigger: 'blur' },
|
if (addPayOrderForm.add_mode === 'create') {
|
||||||
{
|
rules.order_type = [{ required: true, message: '请选择费用类别', trigger: 'change' }]
|
||||||
validator: (_rule, v, cb) => {
|
rules.pay_amount = [
|
||||||
const n = Number(v)
|
{ required: true, message: '请输入支付金额', trigger: 'blur' },
|
||||||
if (!Number.isFinite(n) || n <= 0) {
|
{
|
||||||
cb(new Error('金额须大于 0'))
|
validator: (_rule, v, cb) => {
|
||||||
} else {
|
const n = Number(v)
|
||||||
cb()
|
if (!Number.isFinite(n) || n <= 0) {
|
||||||
}
|
cb(new Error('金额须大于 0'))
|
||||||
},
|
} else {
|
||||||
trigger: 'blur'
|
cb()
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
link_pay_order_ids: [
|
trigger: 'blur'
|
||||||
{
|
}
|
||||||
required: true,
|
]
|
||||||
message: '请至少选择一个支付单',
|
} else if (addPayOrderForm.add_mode === 'link') {
|
||||||
trigger: 'change',
|
rules.link_pay_order_ids = [
|
||||||
validator: (_rule, v, cb) => {
|
{
|
||||||
if (!Array.isArray(v) || v.length === 0) {
|
required: true,
|
||||||
cb(new Error('请至少选择一个支付单'))
|
message: '请至少选择一个支付单',
|
||||||
} else {
|
trigger: 'change',
|
||||||
cb()
|
validator: (_rule, v, cb) => {
|
||||||
|
if (!Array.isArray(v) || v.length === 0) {
|
||||||
|
cb(new Error('请至少选择一个支付单'))
|
||||||
|
} else {
|
||||||
|
cb()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
return rules
|
||||||
|
})
|
||||||
|
|
||||||
async function loadAddPayOrderAvailable(diagnosisId: number, currentLinkedIds: number[] = []) {
|
async function loadAddPayOrderAvailable(diagnosisId: number, currentLinkedIds: number[] = []) {
|
||||||
if (!diagnosisId) {
|
if (!diagnosisId) {
|
||||||
@@ -4986,7 +5051,10 @@ async function submitAddPayOrder() {
|
|||||||
await addPayOrderFormRef.value.validate()
|
await addPayOrderFormRef.value.validate()
|
||||||
addPayOrderSaving.value = true
|
addPayOrderSaving.value = true
|
||||||
try {
|
try {
|
||||||
if (addPayOrderForm.add_mode === 'create') {
|
if (addPayOrderForm.add_mode === 'completion_only') {
|
||||||
|
await prescriptionOrderRequestCompletion({ id: addPayOrderRowId.value })
|
||||||
|
feedback.msgSuccess('完单申请已提交,请等待支付审核')
|
||||||
|
} else if (addPayOrderForm.add_mode === 'create') {
|
||||||
// 手动创建新支付单
|
// 手动创建新支付单
|
||||||
await prescriptionOrderAddPayOrder({
|
await prescriptionOrderAddPayOrder({
|
||||||
id: addPayOrderRowId.value,
|
id: addPayOrderRowId.value,
|
||||||
|
|||||||
@@ -174,9 +174,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="支付方式" width="100">
|
<el-table-column label="支付方式" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ getPaymentMethodText(row.payment_method) }}
|
{{ getCreateTypeText(row) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@
|
|||||||
<span class="text-red-500 font-semibold">¥{{ detailData.amount }}</span>
|
<span class="text-red-500 font-semibold">¥{{ detailData.amount }}</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="支付方式">
|
<el-descriptions-item label="支付方式">
|
||||||
{{ getPaymentMethodText(detailData.payment_method) }}
|
{{ getCreateTypeText(detailData) }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="支付时间">
|
<el-descriptions-item label="支付时间">
|
||||||
{{ detailData.payment_time || '-' }}
|
{{ detailData.payment_time || '-' }}
|
||||||
@@ -1148,7 +1148,8 @@ const submitCreateOrder = async () => {
|
|||||||
patient_id: createForm.patient_id,
|
patient_id: createForm.patient_id,
|
||||||
order_type: createForm.order_type,
|
order_type: createForm.order_type,
|
||||||
amount: createForm.amount,
|
amount: createForm.amount,
|
||||||
remark: createForm.remark
|
remark: createForm.remark,
|
||||||
|
create_type: 'wechat_work'
|
||||||
}
|
}
|
||||||
const res: any = await orderCreateForWechatWork(params)
|
const res: any = await orderCreateForWechatWork(params)
|
||||||
const orderNo = res?.order_no ?? res?.data?.order_no
|
const orderNo = res?.order_no ?? res?.data?.order_no
|
||||||
@@ -1160,7 +1161,8 @@ const submitCreateOrder = async () => {
|
|||||||
patient_id: createForm.patient_id,
|
patient_id: createForm.patient_id,
|
||||||
order_type: createForm.order_type,
|
order_type: createForm.order_type,
|
||||||
amount: createForm.amount,
|
amount: createForm.amount,
|
||||||
remark: createForm.remark
|
remark: createForm.remark,
|
||||||
|
create_type: createForm.createType
|
||||||
}
|
}
|
||||||
if (createForm.createType === 'fubei') {
|
if (createForm.createType === 'fubei') {
|
||||||
params.payment_channel = 'fubei'
|
params.payment_channel = 'fubei'
|
||||||
@@ -1247,6 +1249,26 @@ const getPaymentMethodText = (method: string | null) => {
|
|||||||
return methodMap[method] || '未知'
|
return methodMap[method] || '未知'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 支付方式展示:优先按「创建方式」三值显示;历史单/无 create_type 时回退真实支付渠道文案
|
||||||
|
const getCreateTypeText = (row: any) => {
|
||||||
|
const createTypeMap: Record<string, string> = {
|
||||||
|
normal: '普通订单',
|
||||||
|
wechat_work: '企业微信对外收款',
|
||||||
|
fubei: '付呗'
|
||||||
|
}
|
||||||
|
const ct = row?.create_type
|
||||||
|
if (ct === 'wechat_work' || ct === 'fubei') {
|
||||||
|
return createTypeMap[ct]
|
||||||
|
}
|
||||||
|
if (ct === 'normal' && row?.payment_method) {
|
||||||
|
return getPaymentMethodText(row.payment_method)
|
||||||
|
}
|
||||||
|
if (ct && createTypeMap[ct]) {
|
||||||
|
return createTypeMap[ct]
|
||||||
|
}
|
||||||
|
return getPaymentMethodText(row?.payment_method)
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑订单
|
// 编辑订单
|
||||||
const handleEditOrder = (row: any) => {
|
const handleEditOrder = (row: any) => {
|
||||||
editOrderForm.value = {
|
editOrderForm.value = {
|
||||||
|
|||||||
@@ -415,6 +415,10 @@ const detailLinkedPayOrders = computed(() => {
|
|||||||
const detailAgencyToCollect = computed(() => {
|
const detailAgencyToCollect = computed(() => {
|
||||||
const d = detailData.value
|
const d = detailData.value
|
||||||
if (!d) return 0
|
if (!d) return 0
|
||||||
|
const snap = d.agency_collect_amount
|
||||||
|
if (snap !== null && snap !== undefined && snap !== '') {
|
||||||
|
return Number(snap) || 0
|
||||||
|
}
|
||||||
const total = Number(d.amount) || 0
|
const total = Number(d.amount) || 0
|
||||||
const paid = Number(d.linked_pay_paid_total) || 0
|
const paid = Number(d.linked_pay_paid_total) || 0
|
||||||
return Math.round((total - paid) * 100) / 100
|
return Math.round((total - paid) * 100) / 100
|
||||||
|
|||||||
@@ -207,6 +207,11 @@ class OrderController extends BaseAdminController
|
|||||||
$params['creator_id'] = $this->adminId;
|
$params['creator_id'] = $this->adminId;
|
||||||
$params['payment_channel'] = (string)$this->request->post('payment_channel', 'normal');
|
$params['payment_channel'] = (string)$this->request->post('payment_channel', 'normal');
|
||||||
$params['require_payment_slip_audit'] = (int)$this->request->post('require_payment_slip_audit', 0);
|
$params['require_payment_slip_audit'] = (int)$this->request->post('require_payment_slip_audit', 0);
|
||||||
|
// 创建方式:优先取前端透传的 create_type,否则按 payment_channel 派生(fubei→fubei,其余 normal)
|
||||||
|
$createTypeReq = (string)$this->request->post('create_type', '');
|
||||||
|
$params['create_type'] = in_array($createTypeReq, ['normal', 'wechat_work', 'fubei'], true)
|
||||||
|
? $createTypeReq
|
||||||
|
: ($params['payment_channel'] === 'fubei' ? 'fubei' : 'normal');
|
||||||
|
|
||||||
$result = OrderLogic::create($params);
|
$result = OrderLogic::create($params);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@@ -227,6 +232,7 @@ class OrderController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$params = (new OrderValidate())->post()->goCheck('create');
|
$params = (new OrderValidate())->post()->goCheck('create');
|
||||||
$params['creator_id'] = $this->adminId;
|
$params['creator_id'] = $this->adminId;
|
||||||
|
$params['create_type'] = 'wechat_work';
|
||||||
|
|
||||||
$result = OrderLogic::createForWechatWork($params);
|
$result = OrderLogic::createForWechatWork($params);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ use think\facade\Log;
|
|||||||
*/
|
*/
|
||||||
class OrderLogic
|
class OrderLogic
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 创建方式统一三值:normal 普通订单 / wechat_work 企业微信对外收款 / fubei 付呗
|
||||||
|
*/
|
||||||
|
private const CREATE_TYPES = ['normal', 'wechat_work', 'fubei'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 生成订单号
|
* @notes 生成订单号
|
||||||
* @return string
|
* @return string
|
||||||
@@ -31,6 +36,34 @@ class OrderLogic
|
|||||||
return 'ORD' . date('YmdHis') . mt_rand(100000, 999999);
|
return 'ORD' . date('YmdHis') . mt_rand(100000, 999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function normalizeCreateType(
|
||||||
|
?string $createType,
|
||||||
|
?string $paymentMethod = null,
|
||||||
|
?string $payeeUserid = null,
|
||||||
|
?string $payerExternalUserid = null,
|
||||||
|
?string $remark = null
|
||||||
|
): string {
|
||||||
|
$raw = trim((string) $createType);
|
||||||
|
if (in_array($raw, self::CREATE_TYPES, true)) {
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentMethod = trim((string) $paymentMethod);
|
||||||
|
if ($paymentMethod === 'fubei') {
|
||||||
|
return 'fubei';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
trim((string) $payeeUserid) !== ''
|
||||||
|
|| trim((string) $payerExternalUserid) !== ''
|
||||||
|
|| str_contains((string) $remark, '企业微信')
|
||||||
|
) {
|
||||||
|
return 'wechat_work';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'normal';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 创建订单
|
* @notes 创建订单
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@@ -43,6 +76,8 @@ class OrderLogic
|
|||||||
if (!in_array($channel, ['normal', 'fubei'], true)) {
|
if (!in_array($channel, ['normal', 'fubei'], true)) {
|
||||||
$channel = 'normal';
|
$channel = 'normal';
|
||||||
}
|
}
|
||||||
|
$paymentMethod = $channel === 'fubei' ? 'fubei' : null;
|
||||||
|
$createType = self::normalizeCreateType((string)($params['create_type'] ?? ''), $paymentMethod);
|
||||||
$requirePaymentSlipAudit = (int)($params['require_payment_slip_audit'] ?? 0) === 1;
|
$requirePaymentSlipAudit = (int)($params['require_payment_slip_audit'] ?? 0) === 1;
|
||||||
|
|
||||||
$order = new Order();
|
$order = new Order();
|
||||||
@@ -51,6 +86,7 @@ class OrderLogic
|
|||||||
$order->creator_id = $params['creator_id'];
|
$order->creator_id = $params['creator_id'];
|
||||||
$order->order_type = $params['order_type'];
|
$order->order_type = $params['order_type'];
|
||||||
$order->amount = $params['amount'];
|
$order->amount = $params['amount'];
|
||||||
|
$order->create_type = $createType;
|
||||||
// 付呗且申请审核支付单:待审核(5);否则待支付(1)
|
// 付呗且申请审核支付单:待审核(5);否则待支付(1)
|
||||||
if ($channel === 'fubei') {
|
if ($channel === 'fubei') {
|
||||||
$order->payment_method = 'fubei';
|
$order->payment_method = 'fubei';
|
||||||
@@ -183,6 +219,10 @@ class OrderLogic
|
|||||||
$order->payment_method = 'wechat';
|
$order->payment_method = 'wechat';
|
||||||
$needSave = true;
|
$needSave = true;
|
||||||
}
|
}
|
||||||
|
if ((string) ($order->create_type ?? '') !== 'wechat_work') {
|
||||||
|
$order->create_type = 'wechat_work';
|
||||||
|
$needSave = true;
|
||||||
|
}
|
||||||
if ($paymentTimeStr !== '' && (string)$order->payment_time !== $paymentTimeStr) {
|
if ($paymentTimeStr !== '' && (string)$order->payment_time !== $paymentTimeStr) {
|
||||||
$order->payment_time = $paymentTimeStr;
|
$order->payment_time = $paymentTimeStr;
|
||||||
$needSave = true;
|
$needSave = true;
|
||||||
@@ -235,6 +275,7 @@ class OrderLogic
|
|||||||
$order->amount = $amount;
|
$order->amount = $amount;
|
||||||
$order->status = $targetStatus;
|
$order->status = $targetStatus;
|
||||||
$order->payment_method = 'wechat';
|
$order->payment_method = 'wechat';
|
||||||
|
$order->create_type = 'wechat_work';
|
||||||
$order->payment_time = $paymentTimeStr;
|
$order->payment_time = $paymentTimeStr;
|
||||||
$order->trade_no = $tradeNo;
|
$order->trade_no = $tradeNo;
|
||||||
$remark = '企业微信直接收款同步,待关联患者';
|
$remark = '企业微信直接收款同步,待关联患者';
|
||||||
@@ -283,6 +324,7 @@ class OrderLogic
|
|||||||
$order->amount = $amount;
|
$order->amount = $amount;
|
||||||
$order->status = 2; // 已支付
|
$order->status = 2; // 已支付
|
||||||
$order->payment_method = 'wechat';
|
$order->payment_method = 'wechat';
|
||||||
|
$order->create_type = 'wechat_work';
|
||||||
$order->payment_time = date('Y-m-d H:i:s');
|
$order->payment_time = date('Y-m-d H:i:s');
|
||||||
$order->trade_no = $tradeNo;
|
$order->trade_no = $tradeNo;
|
||||||
$order->remark = '企业微信直接收款,待关联患者';
|
$order->remark = '企业微信直接收款,待关联患者';
|
||||||
@@ -536,6 +578,13 @@ class OrderLogic
|
|||||||
$n->creator_id = $order->creator_id;
|
$n->creator_id = $order->creator_id;
|
||||||
$n->order_type = (int) $typeList[$i];
|
$n->order_type = (int) $typeList[$i];
|
||||||
$n->amount = $amt;
|
$n->amount = $amt;
|
||||||
|
$n->create_type = self::normalizeCreateType(
|
||||||
|
(string) ($order->create_type ?? ''),
|
||||||
|
(string) ($order->payment_method ?? ''),
|
||||||
|
(string) ($order->payee_userid ?? ''),
|
||||||
|
(string) ($order->payer_external_userid ?? ''),
|
||||||
|
(string) ($order->remark ?? '')
|
||||||
|
);
|
||||||
if ($st === 5) {
|
if ($st === 5) {
|
||||||
$n->payment_method = 'fubei';
|
$n->payment_method = 'fubei';
|
||||||
$n->status = 5;
|
$n->status = 5;
|
||||||
@@ -1213,7 +1262,7 @@ class OrderLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rows = $q
|
$rows = $q
|
||||||
->field(['id', 'order_no', 'order_type', 'amount', 'status', 'create_time', 'creator_id', 'remark', 'is_exempt'])
|
->field(['id', 'order_no', 'order_type', 'amount', 'status', 'create_time', 'creator_id', 'remark', 'is_exempt', 'payment_method', 'create_type'])
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|||||||
@@ -696,6 +696,8 @@ class PrescriptionOrderLogic
|
|||||||
{
|
{
|
||||||
PrescriptionOrderPayOrder::where('prescription_order_id', (int) $order->id)->delete();
|
PrescriptionOrderPayOrder::where('prescription_order_id', (int) $order->id)->delete();
|
||||||
$order->linked_pay_order_id = null;
|
$order->linked_pay_order_id = null;
|
||||||
|
// 解除关联后刷新「需代收」固定快照(已付归零 → 需代收=总金额)
|
||||||
|
self::refreshAgencyCollectSnapshot((int) $order->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -768,7 +770,7 @@ class PrescriptionOrderLogic
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$rows = Order::whereIn('id', $ids)->whereNull('delete_time')
|
$rows = Order::whereIn('id', $ids)->whereNull('delete_time')
|
||||||
->field(['id', 'order_no', 'order_type', 'amount', 'status', 'create_time', 'creator_id', 'remark', 'is_exempt'])
|
->field(['id', 'order_no', 'order_type', 'amount', 'status', 'create_time', 'creator_id', 'remark', 'is_exempt', 'payment_method', 'create_type'])
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->whereIn('status', [2, 4, 5])
|
->whereIn('status', [2, 4, 5])
|
||||||
->select()
|
->select()
|
||||||
@@ -837,6 +839,35 @@ class PrescriptionOrderLogic
|
|||||||
$arr['deposit_min_amount'] = self::depositMinAmount();
|
$arr['deposit_min_amount'] = self::depositMinAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新「需代收」固定快照:按当前 总金额 − 关联已付总额(支付单 status ∈ {2 已支付, 5 待审核})写入 agency_collect_amount。
|
||||||
|
* 在关联/新增支付单、建单、改总金额、解除关联等写操作末尾调用;之后退款/审核状态变化不再影响该值。
|
||||||
|
*/
|
||||||
|
private static function refreshAgencyCollectSnapshot(int $id): void
|
||||||
|
{
|
||||||
|
if ($id <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$order = PrescriptionOrder::where('id', $id)->whereNull('delete_time')->find();
|
||||||
|
if (!$order) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$amount = round((float) $order->amount, 2);
|
||||||
|
$paid = 0.0;
|
||||||
|
$ids = self::linkedPayOrderIdList($id);
|
||||||
|
if ($ids !== []) {
|
||||||
|
$payOrders = Order::whereIn('id', $ids)->whereNull('delete_time')->field(['amount', 'status'])->select();
|
||||||
|
foreach ($payOrders as $po) {
|
||||||
|
$st = (int) $po->status;
|
||||||
|
if ($st === 2 || $st === 5) {
|
||||||
|
$paid += (float) $po->amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$order->agency_collect_amount = round($amount - $paid, 2);
|
||||||
|
$order->save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string,mixed> $params
|
* @param array<string,mixed> $params
|
||||||
* @return array<string,mixed>|false
|
* @return array<string,mixed>|false
|
||||||
@@ -969,7 +1000,9 @@ class PrescriptionOrderLogic
|
|||||||
self::replacePayOrderLinks((int) $order->id, $payOrderIds);
|
self::replacePayOrderLinks((int) $order->id, $payOrderIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = $order->toArray();
|
self::refreshAgencyCollectSnapshot((int) $order->id);
|
||||||
|
|
||||||
|
$out = PrescriptionOrder::where('id', (int) $order->id)->find()->toArray();
|
||||||
self::maskInternalCostIfNeeded($out, $adminInfo);
|
self::maskInternalCostIfNeeded($out, $adminInfo);
|
||||||
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
||||||
self::attachLinkedPayOrders($out);
|
self::attachLinkedPayOrders($out);
|
||||||
@@ -1737,7 +1770,9 @@ class PrescriptionOrderLogic
|
|||||||
|
|
||||||
self::writeLog((int) $order->id, $adminId, $adminInfo, 'edit', '编辑了业务订单及相关信息');
|
self::writeLog((int) $order->id, $adminId, $adminInfo, 'edit', '编辑了业务订单及相关信息');
|
||||||
|
|
||||||
$out = $order->toArray();
|
self::refreshAgencyCollectSnapshot((int) $order->id);
|
||||||
|
|
||||||
|
$out = PrescriptionOrder::where('id', (int) $order->id)->find()->toArray();
|
||||||
self::maskInternalCostIfNeeded($out, $adminInfo);
|
self::maskInternalCostIfNeeded($out, $adminInfo);
|
||||||
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
||||||
self::attachLinkedPayOrders($out);
|
self::attachLinkedPayOrders($out);
|
||||||
@@ -2281,12 +2316,16 @@ class PrescriptionOrderLogic
|
|||||||
$order->payment_slip_audit_remark = '';
|
$order->payment_slip_audit_remark = '';
|
||||||
self::syncFulfillmentStatus($order);
|
self::syncFulfillmentStatus($order);
|
||||||
|
|
||||||
// 将关联的已支付支付单(status=2,且payment_method='manual')恢复为待审核(status=5)
|
// 将关联的已支付补齐支付单恢复为待审核:兼容旧 manual 与新 fubei/create_type=fubei 两种标记
|
||||||
$payOrderIds = self::linkedPayOrderIdList($id);
|
$payOrderIds = self::linkedPayOrderIdList($id);
|
||||||
if (!empty($payOrderIds)) {
|
if (!empty($payOrderIds)) {
|
||||||
Order::whereIn('id', $payOrderIds)
|
Order::whereIn('id', $payOrderIds)
|
||||||
->where('status', 2) // 只恢复已支付状态的
|
->where('status', 2) // 只恢复已支付状态的
|
||||||
->where('payment_method', 'manual') // 只恢复手动创建的
|
->where(function ($query) {
|
||||||
|
$query->where('payment_method', 'manual')
|
||||||
|
->whereOr('payment_method', 'fubei')
|
||||||
|
->whereOr('create_type', 'fubei');
|
||||||
|
})
|
||||||
->update([
|
->update([
|
||||||
'status' => 5, // 待审核
|
'status' => 5, // 待审核
|
||||||
'payment_time' => null
|
'payment_time' => null
|
||||||
@@ -2378,7 +2417,8 @@ class PrescriptionOrderLogic
|
|||||||
$payOrder->order_type = $orderType;
|
$payOrder->order_type = $orderType;
|
||||||
$payOrder->amount = $amount;
|
$payOrder->amount = $amount;
|
||||||
$payOrder->status = 5; // 待审核
|
$payOrder->status = 5; // 待审核
|
||||||
$payOrder->payment_method = 'manual';
|
$payOrder->payment_method = 'fubei'; // 补齐支付单按「付呗」记账
|
||||||
|
$payOrder->create_type = 'fubei';
|
||||||
$payOrder->payment_time = null; // 审核通过后再设置支付时间
|
$payOrder->payment_time = null; // 审核通过后再设置支付时间
|
||||||
$payOrder->remark = $remark;
|
$payOrder->remark = $remark;
|
||||||
|
|
||||||
@@ -2420,7 +2460,9 @@ class PrescriptionOrderLogic
|
|||||||
}
|
}
|
||||||
self::writeLog($id, $adminId, $adminInfo, 'add_pay_order', $logMsg);
|
self::writeLog($id, $adminId, $adminInfo, 'add_pay_order', $logMsg);
|
||||||
|
|
||||||
$out = $order->toArray();
|
self::refreshAgencyCollectSnapshot($id);
|
||||||
|
|
||||||
|
$out = PrescriptionOrder::where('id', $id)->find()->toArray();
|
||||||
self::maskInternalCostIfNeeded($out, $adminInfo);
|
self::maskInternalCostIfNeeded($out, $adminInfo);
|
||||||
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
||||||
self::attachLinkedPayOrders($out);
|
self::attachLinkedPayOrders($out);
|
||||||
@@ -2531,7 +2573,9 @@ class PrescriptionOrderLogic
|
|||||||
}
|
}
|
||||||
self::writeLog($id, $adminId, $adminInfo, 'link_pay_order', $logMsg);
|
self::writeLog($id, $adminId, $adminInfo, 'link_pay_order', $logMsg);
|
||||||
|
|
||||||
$out = $order->toArray();
|
self::refreshAgencyCollectSnapshot($id);
|
||||||
|
|
||||||
|
$out = PrescriptionOrder::where('id', $id)->find()->toArray();
|
||||||
self::maskInternalCostIfNeeded($out, $adminInfo);
|
self::maskInternalCostIfNeeded($out, $adminInfo);
|
||||||
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
||||||
self::attachLinkedPayOrders($out);
|
self::attachLinkedPayOrders($out);
|
||||||
@@ -3415,7 +3459,11 @@ class PrescriptionOrderLogic
|
|||||||
$item['export_refund_amount'] = $refundStored > 0
|
$item['export_refund_amount'] = $refundStored > 0
|
||||||
? number_format($refundStored, 2, '.', '')
|
? number_format($refundStored, 2, '.', '')
|
||||||
: '';
|
: '';
|
||||||
$item['export_agency_collect'] = number_format(round($amt - $paid, 2), 2, '.', '');
|
// 需代收:优先用固定快照值 agency_collect_amount;历史单为 NULL 时回退实时 amt − paid
|
||||||
|
$agencySnap = $item['agency_collect_amount'] ?? null;
|
||||||
|
$item['export_agency_collect'] = ($agencySnap !== null && $agencySnap !== '')
|
||||||
|
? number_format(round((float) $agencySnap, 2), 2, '.', '')
|
||||||
|
: number_format(round($amt - $paid, 2), 2, '.', '');
|
||||||
|
|
||||||
$item['export_tracking_number'] = (string) ($item['tracking_number'] ?? '');
|
$item['export_tracking_number'] = (string) ($item['tracking_number'] ?? '');
|
||||||
$signTs = $poId > 0 ? (int) ($signTsByPoId[$poId] ?? 0) : 0;
|
$signTs = $poId > 0 ? (int) ($signTsByPoId[$poId] ?? 0) : 0;
|
||||||
@@ -4149,6 +4197,9 @@ class PrescriptionOrderLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 总金额变化后刷新「需代收」固定快照,保持与新总额一致
|
||||||
|
self::refreshAgencyCollectSnapshot($id);
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
$summary = sprintf('将订单金额从 ¥%.2f 修改为 ¥%.2f', $oldAmount, $newAmount);
|
$summary = sprintf('将订单金额从 ¥%.2f 修改为 ¥%.2f', $oldAmount, $newAmount);
|
||||||
self::writeLog($id, $adminId, $adminInfo, 'update_amount', $summary);
|
self::writeLog($id, $adminId, $adminInfo, 'update_amount', $summary);
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- 支付单:创建方式(统一为三值,用于支付方式显示)
|
||||||
|
ALTER TABLE `zyt_order`
|
||||||
|
ADD COLUMN `create_type` varchar(20) NOT NULL DEFAULT 'normal' COMMENT '创建方式:normal 普通订单 / wechat_work 企业微信对外收款 / fubei 付呗' AFTER `payment_method`;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- 处方业务订单:需代收固定值(关联支付单/改总金额时快照,NULL 表示按实时计算回退)
|
||||||
|
ALTER TABLE `zyt_tcm_prescription_order`
|
||||||
|
ADD COLUMN `agency_collect_amount` decimal(10,2) DEFAULT NULL COMMENT '需代收固定值(关联/改额时快照,NULL 表示按实时计算回退)' AFTER `refund_amount`;
|
||||||
Reference in New Issue
Block a user