fix layout
This commit is contained in:
@@ -1,51 +1,55 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分账户详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<div v-can="permissionCodes.point.accountRead" class="point-account-detail">
|
||||
<card-container v-if="customer" v-entrance-transition>
|
||||
<customer-profile-card :customer="customer" />
|
||||
</card-container>
|
||||
<section v-if="account" class="account-card" v-entrance-transition>
|
||||
<div class="header">
|
||||
<div>积分卡</div>
|
||||
<div class="time dark-white" v-text="formatTimestamp(account.createdAt!)" />
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分账户详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.point.accountRead" class="point-account-detail">
|
||||
<card-container v-if="customer" v-entrance-transition>
|
||||
<customer-profile-card :customer="customer" />
|
||||
</card-container>
|
||||
<section v-if="account" class="account-card" v-entrance-transition>
|
||||
<div class="header">
|
||||
<div>积分卡</div>
|
||||
<div class="time dark-white" v-text="formatTimestamp(account.createdAt!)" />
|
||||
</div>
|
||||
<div class="balance">
|
||||
<t-icon name="money" size="2rem" />
|
||||
<div class="value" v-text="balanceText" />
|
||||
</div>
|
||||
<div class="id" v-text="account.id?.toUpperCase()" />
|
||||
</section>
|
||||
<t-cell-group v-if="account" title="积分统计" theme="card" v-entrance-transition>
|
||||
<t-cell title="累计获得" :note="formatPoints(account.totalEarned)" />
|
||||
<t-cell title="累计消耗" :note="formatPoints(account.totalConsumed)" />
|
||||
<t-cell title="累计撤销" :note="formatPoints(account.totalRevoked)" />
|
||||
<t-cell title="人工调整" :note="formatSignedPoints(account.totalAdjusted)" />
|
||||
</t-cell-group>
|
||||
<section v-if="customer" class="actions" v-entrance-transition>
|
||||
<t-button
|
||||
v-can="permissionCodes.point.ledgerRead"
|
||||
class="bg-white"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
@click="toLedger"
|
||||
>
|
||||
查看积分流水
|
||||
</t-button>
|
||||
<t-button
|
||||
v-can="permissionCodes.point.adjust"
|
||||
theme="primary"
|
||||
@click="toAdjust"
|
||||
>
|
||||
人工调整积分
|
||||
</t-button>
|
||||
</section>
|
||||
<t-empty v-if="!account" :description="isLoading ? '正在加载积分账户' : '积分账户不存在或已被删除'" />
|
||||
</div>
|
||||
<div class="balance">
|
||||
<t-icon name="money" size="2rem" />
|
||||
<div class="value" v-text="balanceText" />
|
||||
</div>
|
||||
<div class="id" v-text="account.id?.toUpperCase()" />
|
||||
</section>
|
||||
<t-cell-group v-if="account" title="积分统计" theme="card" v-entrance-transition>
|
||||
<t-cell title="累计获得" :note="formatPoints(account.totalEarned)" />
|
||||
<t-cell title="累计消耗" :note="formatPoints(account.totalConsumed)" />
|
||||
<t-cell title="累计撤销" :note="formatPoints(account.totalRevoked)" />
|
||||
<t-cell title="人工调整" :note="formatSignedPoints(account.totalAdjusted)" />
|
||||
</t-cell-group>
|
||||
<section v-if="customer" class="actions" v-entrance-transition>
|
||||
<t-button
|
||||
v-can="permissionCodes.point.ledgerRead"
|
||||
class="bg-white"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
@click="toLedger"
|
||||
>
|
||||
查看积分流水
|
||||
</t-button>
|
||||
<t-button
|
||||
v-can="permissionCodes.point.adjust"
|
||||
theme="primary"
|
||||
@click="toAdjust"
|
||||
>
|
||||
人工调整积分
|
||||
</t-button>
|
||||
</section>
|
||||
<t-empty v-if="!account" :description="isLoading ? '正在加载积分账户' : '积分账户不存在或已被删除'" />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -190,7 +194,7 @@ onMounted(async () => {
|
||||
.point-account-detail {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
padding: 0 0 1rem;
|
||||
flex-direction: column;
|
||||
|
||||
.account-card {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<main v-can="permissionCodes.point.accountRead" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.point.accountRead" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,87 +1,91 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分流水详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<div v-if="customer" v-can="permissionCodes.point.ledgerRead" class="point-ledger-detail">
|
||||
<customer-profile-card
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
@click="toCustomerDetail"
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分流水详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<t-cell-group
|
||||
v-if="ledger?.accountId && canReadPointAccount"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-cell title="积分账户" arrow @click="toPointAccount" />
|
||||
</t-cell-group>
|
||||
<template v-if="ledger">
|
||||
<t-cell-group title="积分流水" theme="card" v-entrance-transition>
|
||||
<t-cell title="流水类型">
|
||||
<template #note>
|
||||
<t-tag
|
||||
:theme="getDeltaTheme(ledger.pointDelta)"
|
||||
:content="getChangeTypeText(ledger.changeType)"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="积分变化" :note="getPointDeltaText(ledger.pointDelta)" />
|
||||
<t-cell title="变化前余额" :note="getPointText(ledger.balanceBefore)" />
|
||||
<t-cell title="变化后余额" :note="getPointText(ledger.balanceAfter)" />
|
||||
<t-cell title="发生时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="ledger.occurredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="流水备注" :note="Text.display(ledger.remark)" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="触发事件" theme="card" v-entrance-transition>
|
||||
<template v-if="triggerEvent">
|
||||
<t-cell title="事件名称" :note="triggerEvent.name || '未命名事件'" />
|
||||
<t-cell title="事件类型" :note="getEventValueTypeText(triggerEvent)" />
|
||||
<t-cell title="事件说明" :note="Text.display(triggerEvent.description)" />
|
||||
<t-cell title="查看事件详情" :arrow="canReadEvent" :hover="canReadEvent" @click="toEventDetail" />
|
||||
</template>
|
||||
<center-tips v-else :content="getEventEmptyText()" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="事件记录" theme="card" v-entrance-transition>
|
||||
<template v-if="eventRecord">
|
||||
<t-cell title="登记事件" :note="eventRecord.event?.name || triggerEvent?.name || '未知事件'" />
|
||||
<t-cell title="登记时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="eventRecord.registeredAt" underline />
|
||||
<main class="page-content scroll column">
|
||||
<div v-if="customer" v-can="permissionCodes.point.ledgerRead" class="point-ledger-detail">
|
||||
<customer-profile-card
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
@click="toCustomerDetail"
|
||||
/>
|
||||
<t-cell-group
|
||||
v-if="ledger?.accountId && canReadPointAccount"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-cell title="积分账户" arrow @click="toPointAccount" />
|
||||
</t-cell-group>
|
||||
<template v-if="ledger">
|
||||
<t-cell-group title="积分流水" theme="card" v-entrance-transition>
|
||||
<t-cell title="流水类型">
|
||||
<template #note>
|
||||
<t-tag
|
||||
:theme="getDeltaTheme(ledger.pointDelta)"
|
||||
:content="getChangeTypeText(ledger.changeType)"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="积分变化" :note="getPointDeltaText(ledger.pointDelta)" />
|
||||
<t-cell title="变化前余额" :note="getPointText(ledger.balanceBefore)" />
|
||||
<t-cell title="变化后余额" :note="getPointText(ledger.balanceAfter)" />
|
||||
<t-cell title="发生时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="ledger.occurredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="流水备注" :note="Text.display(ledger.remark)" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="触发事件" theme="card" v-entrance-transition>
|
||||
<template v-if="triggerEvent">
|
||||
<t-cell title="事件名称" :note="triggerEvent.name || '未命名事件'" />
|
||||
<t-cell title="事件类型" :note="getEventValueTypeText(triggerEvent)" />
|
||||
<t-cell title="事件说明" :note="Text.display(triggerEvent.description)" />
|
||||
<t-cell title="查看事件详情" :arrow="canReadEvent" :hover="canReadEvent" @click="toEventDetail" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell v-if="hasEventNumberValue" title="事件数值" :note="getEventNumberValueText()" />
|
||||
<t-cell v-if="hasSubmittedPointValue" title="提交积分值" :note="getSignedPointText(eventRecord.pointValue)" />
|
||||
<t-cell v-if="hasEarnedPointValue" title="本次积分变化" :note="getSignedPointText(eventRecord.earnedPointValue)" />
|
||||
<t-cell title="登记人" :note="Text.display(eventRecord.operator?.nick || eventRecord.operator?.name)" />
|
||||
<t-cell title="记录备注" :note="Text.display(eventRecord.remark)" />
|
||||
<t-cell title="查看记录详情" arrow hover @click="toEventRecordDetail" />
|
||||
<center-tips v-else :content="getEventEmptyText()" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="事件记录" theme="card" v-entrance-transition>
|
||||
<template v-if="eventRecord">
|
||||
<t-cell title="登记事件" :note="eventRecord.event?.name || triggerEvent?.name || '未知事件'" />
|
||||
<t-cell title="登记时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="eventRecord.registeredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell v-if="hasEventNumberValue" title="事件数值" :note="getEventNumberValueText()" />
|
||||
<t-cell v-if="hasSubmittedPointValue" title="提交积分值" :note="getSignedPointText(eventRecord.pointValue)" />
|
||||
<t-cell v-if="hasEarnedPointValue" title="本次积分变化" :note="getSignedPointText(eventRecord.earnedPointValue)" />
|
||||
<t-cell title="登记人" :note="Text.display(eventRecord.operator?.nick || eventRecord.operator?.name)" />
|
||||
<t-cell title="记录备注" :note="Text.display(eventRecord.remark)" />
|
||||
<t-cell title="查看记录详情" arrow hover @click="toEventRecordDetail" />
|
||||
</template>
|
||||
<center-tips v-else :content="getRecordEmptyText()" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="命中规则" theme="card" v-entrance-transition>
|
||||
<template v-if="hitRule">
|
||||
<t-cell title="规则名称" :note="hitRule.name || '未命名规则'" />
|
||||
<t-cell title="规则模式" :note="hitRule.ruleMode === 'GROOVY' ? '脚本规则' : '简单规则'" />
|
||||
<t-cell title="规则积分" :note="getRulePointText(hitRule)" />
|
||||
<t-cell v-if="hitRule.ruleMode === 'GROOVY'" title="执行脚本" :note="getRuleScriptText(hitRule)" />
|
||||
<t-cell title="规则状态" :note="getRuleStatusText(hitRule.status)" />
|
||||
<t-cell title="规则优先级" :note="getPointText(hitRule.priority)" />
|
||||
<t-cell title="命中后停止匹配" :note="hitRule.exclusive ? '是' : '否'" />
|
||||
<t-cell title="规则备注" :note="Text.display(hitRule.remark)" />
|
||||
<t-cell title="查看规则详情" :arrow="canReadRule" :hover="canReadRule" @click="toPointRuleDetail" />
|
||||
</template>
|
||||
<center-tips v-else :content="getRuleEmptyText()" />
|
||||
</t-cell-group>
|
||||
</template>
|
||||
<center-tips v-else :content="getRecordEmptyText()" />
|
||||
</t-cell-group>
|
||||
<t-cell-group title="命中规则" theme="card" v-entrance-transition>
|
||||
<template v-if="hitRule">
|
||||
<t-cell title="规则名称" :note="hitRule.name || '未命名规则'" />
|
||||
<t-cell title="规则模式" :note="hitRule.ruleMode === 'GROOVY' ? '脚本规则' : '简单规则'" />
|
||||
<t-cell title="规则积分" :note="getRulePointText(hitRule)" />
|
||||
<t-cell v-if="hitRule.ruleMode === 'GROOVY'" title="执行脚本" :note="getRuleScriptText(hitRule)" />
|
||||
<t-cell title="规则状态" :note="getRuleStatusText(hitRule.status)" />
|
||||
<t-cell title="规则优先级" :note="getPointText(hitRule.priority)" />
|
||||
<t-cell title="命中后停止匹配" :note="hitRule.exclusive ? '是' : '否'" />
|
||||
<t-cell title="规则备注" :note="Text.display(hitRule.remark)" />
|
||||
<t-cell title="查看规则详情" :arrow="canReadRule" :hover="canReadRule" @click="toPointRuleDetail" />
|
||||
</template>
|
||||
<center-tips v-else :content="getRuleEmptyText()" />
|
||||
</t-cell-group>
|
||||
</template>
|
||||
<t-empty v-else :description="isLoading ? '正在加载积分流水' : '积分流水快照不存在,请从积分流水列表进入'" />
|
||||
<t-empty v-else :description="isLoading ? '正在加载积分流水' : '积分流水快照不存在,请从积分流水列表进入'" />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -372,7 +376,7 @@ watch(() => [route.params.id, route.query.snapshot], async () => {
|
||||
.point-ledger-detail {
|
||||
gap: 1rem;
|
||||
min-height: 100vh;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
padding: 0 0 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<main v-can="permissionCodes.point.ledgerRead" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.point.ledgerRead" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,75 +1,79 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="permissionCodes.pointRedeemSku.manage" class="redeem-sku-edit">
|
||||
<t-form class="form card" v-entrance-transition>
|
||||
<product-select-form-item
|
||||
v-model="selection"
|
||||
:selected-product="form.product"
|
||||
required-mark
|
||||
@select="handleProductSelection"
|
||||
/>
|
||||
<t-form-item label="默认积分" required-mark>
|
||||
<t-input
|
||||
v-model.trim="form.pointText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
placeholder="每单位所需积分"
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="配置状态" content-align="right" arrow @click="statusVisible = true">
|
||||
<span v-text="statusText(form.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="累计上限">
|
||||
<t-input v-model.trim="form.totalText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label="每日上限">
|
||||
<t-input v-model.trim="form.dailyText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label="每月上限">
|
||||
<t-input v-model.trim="form.monthlyText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<span class="tips gray">数量上限按兑换业务单位计算,最多三位小数。留空表示不限</span>
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model.trim="form.remark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-button
|
||||
v-if="form.id"
|
||||
class="cell-button"
|
||||
theme="danger"
|
||||
v-entrance-transition
|
||||
content="删除"
|
||||
@click="remove"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.pointRedeemSku.manage" class="redeem-sku-edit">
|
||||
<t-form class="form card" v-entrance-transition>
|
||||
<product-select-form-item
|
||||
v-model="selection"
|
||||
:selected-product="form.product"
|
||||
required-mark
|
||||
@select="handleProductSelection"
|
||||
/>
|
||||
<t-form-item label="默认积分" required-mark>
|
||||
<t-input
|
||||
v-model.trim="form.pointText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
placeholder="每单位所需积分"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="配置状态" content-align="right" arrow @click="statusVisible = true">
|
||||
<span v-text="statusText(form.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="累计上限">
|
||||
<t-input v-model.trim="form.totalText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label="每日上限">
|
||||
<t-input v-model.trim="form.dailyText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label="每月上限">
|
||||
<t-input v-model.trim="form.monthlyText" type="number" align="right" borderless placeholder="不限" />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<span class="tips gray">数量上限按兑换业务单位计算,最多三位小数。留空表示不限</span>
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model.trim="form.remark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-button
|
||||
v-if="form.id"
|
||||
class="cell-button"
|
||||
theme="danger"
|
||||
v-entrance-transition
|
||||
content="删除"
|
||||
@click="remove"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
<t-popup v-model="statusVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="statusDraft"
|
||||
:columns="statusOptions"
|
||||
title="配置状态"
|
||||
@cancel="statusVisible = false"
|
||||
@confirm="confirmStatus"
|
||||
/>
|
||||
</t-popup>
|
||||
</div>
|
||||
<t-popup v-model="statusVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="statusDraft"
|
||||
:columns="statusOptions"
|
||||
title="配置状态"
|
||||
@cancel="statusVisible = false"
|
||||
@confirm="confirmStatus"
|
||||
/>
|
||||
</t-popup>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -227,7 +231,7 @@ onMounted(async () => {
|
||||
.redeem-sku-edit {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 2rem;
|
||||
padding: 0 0 2rem;
|
||||
flex-direction: column;
|
||||
|
||||
.tips {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.pointRedeemSku.manage" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.pointRedeemSku.manage" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,143 +1,147 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="客户兑换"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="兑换"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="permissionCodes.pointRedemption.create" class="redemption-create">
|
||||
<t-form class="form card" label-width="7rem" v-entrance-transition>
|
||||
<t-form-item label="客户" required-mark>
|
||||
<t-input
|
||||
:model-value="customerName || '请选择客户'"
|
||||
class="customer"
|
||||
readonly
|
||||
borderless
|
||||
placeholder="选择或扫码客户"
|
||||
@click="customerVisible = true"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
@click.stop="customerVisible = true"
|
||||
>选择</t-button>
|
||||
<t-button theme="primary" size="extra-small" @click.stop="toggleScanner">
|
||||
<span v-text="scannerVisible ? '关闭扫码' : '扫码'" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
<div v-if="scannerVisible" class="code-scanner-wrapper">
|
||||
<code-scanner
|
||||
visible
|
||||
:status-text="scanStatus"
|
||||
active-text="正在识别客户编码,请将条码或二维码移入取景框。"
|
||||
@decode="handleDecodedText"
|
||||
@status-change="handleScanStatusChange"
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="客户兑换"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="兑换"
|
||||
/>
|
||||
</div>
|
||||
<customer-profile-card
|
||||
v-if="customer"
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<t-form-item v-if="customer" label="积分余额" content-align="right">
|
||||
<span class="orange" v-text="pointBalanceText" />
|
||||
</t-form-item>
|
||||
<t-form-item label="兑换商品" required-mark content-align="right" arrow @click="skuVisible = true">
|
||||
<span v-text="skuName || '请选择兑换商品'" />
|
||||
</t-form-item>
|
||||
<product-sku-form-item
|
||||
:sku="selectedSku?.sku"
|
||||
:unit="selectedSku?.unit"
|
||||
/>
|
||||
<t-form-item label="兑换数量" content-align="right" required-mark>
|
||||
<t-stepper
|
||||
v-model="quantity"
|
||||
size="large"
|
||||
:min="quantityStep"
|
||||
:step="quantityStep"
|
||||
:integer="quantityIsInteger"
|
||||
theme="outline"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="预计消耗积分" content-align="right">
|
||||
<span v-text="estimatedPointText" />
|
||||
</t-form-item>
|
||||
<template v-if="canAdjust">
|
||||
<t-form-item label="实际消耗扣分">
|
||||
<t-input v-model.trim="actualPointText" type="number" align="right" borderless placeholder="默认扣分" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model="remark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
</template>
|
||||
<div class="photo-wrap">
|
||||
<attachment-selector
|
||||
v-model:items="photos"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="兑换凭证照片"
|
||||
/>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.pointRedemption.create" class="redemption-create">
|
||||
<t-form class="form card" label-width="7rem" v-entrance-transition>
|
||||
<t-form-item label="客户" required-mark>
|
||||
<t-input
|
||||
:model-value="customerName || '请选择客户'"
|
||||
class="customer"
|
||||
readonly
|
||||
borderless
|
||||
placeholder="选择或扫码客户"
|
||||
@click="customerVisible = true"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
@click.stop="customerVisible = true"
|
||||
>选择</t-button>
|
||||
<t-button theme="primary" size="extra-small" @click.stop="toggleScanner">
|
||||
<span v-text="scannerVisible ? '关闭扫码' : '扫码'" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
<div v-if="scannerVisible" class="code-scanner-wrapper">
|
||||
<code-scanner
|
||||
visible
|
||||
:status-text="scanStatus"
|
||||
active-text="正在识别客户编码,请将条码或二维码移入取景框。"
|
||||
@decode="handleDecodedText"
|
||||
@status-change="handleScanStatusChange"
|
||||
/>
|
||||
</div>
|
||||
<customer-profile-card
|
||||
v-if="customer"
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<t-form-item v-if="customer" label="积分余额" content-align="right">
|
||||
<span class="orange" v-text="pointBalanceText" />
|
||||
</t-form-item>
|
||||
<t-form-item label="兑换商品" required-mark content-align="right" arrow @click="skuVisible = true">
|
||||
<span v-text="skuName || '请选择兑换商品'" />
|
||||
</t-form-item>
|
||||
<product-sku-form-item
|
||||
:sku="selectedSku?.sku"
|
||||
:unit="selectedSku?.unit"
|
||||
/>
|
||||
<t-form-item label="兑换数量" content-align="right" required-mark>
|
||||
<t-stepper
|
||||
v-model="quantity"
|
||||
size="large"
|
||||
:min="quantityStep"
|
||||
:step="quantityStep"
|
||||
:integer="quantityIsInteger"
|
||||
theme="outline"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="预计消耗积分" content-align="right">
|
||||
<span v-text="estimatedPointText" />
|
||||
</t-form-item>
|
||||
<template v-if="canAdjust">
|
||||
<t-form-item label="实际消耗扣分">
|
||||
<t-input v-model.trim="actualPointText" type="number" align="right" borderless placeholder="默认扣分" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model="remark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
</template>
|
||||
<div class="photo-wrap">
|
||||
<attachment-selector
|
||||
v-model:items="photos"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="兑换凭证照片"
|
||||
/>
|
||||
</div>
|
||||
</t-form>
|
||||
</div>
|
||||
</t-form>
|
||||
</main>
|
||||
<customer-selector
|
||||
v-model="customerId"
|
||||
v-model:visible="customerVisible"
|
||||
:enable-scan="false"
|
||||
@change="loadCustomer"
|
||||
/>
|
||||
<bottom-popup
|
||||
v-model="skuVisible"
|
||||
title="选择兑换商品"
|
||||
height="70vh"
|
||||
right-button-text=""
|
||||
@left-button-click="closeSkuPicker"
|
||||
>
|
||||
<div class="sku-picker">
|
||||
<t-cell
|
||||
v-for="item in skuList"
|
||||
:key="item.id"
|
||||
:title="item.product?.name || item.sku?.name || '未命名产品'"
|
||||
:note="`${formatPoint(item.defaultPointCost)} / ${item.unit?.name || '单位未知'}`"
|
||||
class="item"
|
||||
@click="selectSku(item)"
|
||||
>
|
||||
<template #left-icon>
|
||||
<t-image
|
||||
v-if="getProductPhoto(item)"
|
||||
:src="getProductPhoto(item)"
|
||||
:alt="item.product?.name || item.sku?.name || '产品图片'"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="avatar fallback"
|
||||
v-text="(item.product?.name || item.sku?.name || '产').slice(0, 1)"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-empty v-if="!skuList.length" description="暂无启用的兑换商品" />
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</div>
|
||||
<customer-selector
|
||||
v-model="customerId"
|
||||
v-model:visible="customerVisible"
|
||||
:enable-scan="false"
|
||||
@change="loadCustomer"
|
||||
/>
|
||||
<bottom-popup
|
||||
v-model="skuVisible"
|
||||
title="选择兑换商品"
|
||||
height="70vh"
|
||||
right-button-text=""
|
||||
@left-button-click="closeSkuPicker"
|
||||
>
|
||||
<div class="sku-picker">
|
||||
<t-cell
|
||||
v-for="item in skuList"
|
||||
:key="item.id"
|
||||
:title="item.product?.name || item.sku?.name || '未命名产品'"
|
||||
:note="`${formatPoint(item.defaultPointCost)} / ${item.unit?.name || '单位未知'}`"
|
||||
class="item"
|
||||
@click="selectSku(item)"
|
||||
>
|
||||
<template #left-icon>
|
||||
<t-image
|
||||
v-if="getProductPhoto(item)"
|
||||
:src="getProductPhoto(item)"
|
||||
:alt="item.product?.name || item.sku?.name || '产品图片'"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="avatar fallback"
|
||||
v-text="(item.product?.name || item.sku?.name || '产').slice(0, 1)"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-empty v-if="!skuList.length" description="暂无启用的兑换商品" />
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -359,7 +363,7 @@ onMounted(async () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.redemption-create {
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 2rem;
|
||||
padding: 0 0 2rem;
|
||||
|
||||
.form {
|
||||
|
||||
|
||||
@@ -1,78 +1,82 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="兑换详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<div v-can="permissionCodes.pointRedemption.create" class="redemption-detail">
|
||||
<customer-profile-card
|
||||
v-if="customer"
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="兑换详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<t-cell-group v-if="item" title="兑换信息" theme="card" v-entrance-transition>
|
||||
<t-cell title="客户" :note="item.customer?.name || item.customerId || '-'" />
|
||||
<t-cell title="兑换商品" :note="item.productNameSnapshot || item.skuNameSnapshot || '-'" />
|
||||
<t-cell title="兑换数量" :note="`${quantityText(item.quantity)} ${item.unitSnapshot || ''}`" />
|
||||
<t-cell title="积分" :note="`${formatPoint(item.actualPointCost)}${item.actualPointCost !== item.defaultPointCost ? '(已减免)' : ''}`" />
|
||||
<t-cell title="状态" :note="statusText(item.status)" />
|
||||
<t-cell title="兑换时间" :note="timeText(item.redeemedAt)" />
|
||||
<t-cell v-if="item.remark" title="备注" :note="item.remark" />
|
||||
<div class="photo-wrap bg-white">
|
||||
<attachment-selector :items="redemptionPhotoItems" title="兑换凭证" readonly />
|
||||
</div>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="returnList.length" title="退货记录" theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-for="record in returnList"
|
||||
:key="record.id"
|
||||
:title="`退货 ${quantityText(record.quantity)} ${item?.unitSnapshot || ''}`"
|
||||
:note="`${formatPoint(record.pointCost)} · ${timeText(record.returnedAt)}`"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-empty v-if="!item" :description="loading ? '正在加载兑换单' : '兑换单不存在'" />
|
||||
<t-button
|
||||
v-if="canReturn"
|
||||
class="return-button cell-button"
|
||||
theme="danger"
|
||||
content="冲正兑换"
|
||||
v-entrance-transition
|
||||
@click="returnVisible = true"
|
||||
/>
|
||||
</div>
|
||||
<bottom-popup
|
||||
v-model="returnVisible"
|
||||
title="冲正兑换"
|
||||
left-button-text="取消"
|
||||
:right-button-text="returning ? '提交中' : '确认冲正'"
|
||||
@left-button-click="returnVisible = false"
|
||||
@right-button-click="submitReturn"
|
||||
>
|
||||
<div class="return-form">
|
||||
<t-form class="form card" label-width="6rem">
|
||||
<t-form-item label="剩余数量">
|
||||
<span v-text="`${remainText} ${item?.unitSnapshot || ''}`" />
|
||||
</t-form-item>
|
||||
<t-form-item label="冲正数量" required-mark>
|
||||
<t-input v-model.trim="returnQuantity" type="number" align="right" borderless />
|
||||
</t-form-item>
|
||||
<t-form-item label="冲正原因">
|
||||
<t-textarea v-model.trim="returnRemark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="returnPhotos"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="冲正凭证照片"
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.pointRedemption.create" class="redemption-detail">
|
||||
<customer-profile-card
|
||||
v-if="customer"
|
||||
class="customer-profile"
|
||||
:customer="customer"
|
||||
v-entrance-transition
|
||||
/>
|
||||
<t-cell-group v-if="item" title="兑换信息" theme="card" v-entrance-transition>
|
||||
<t-cell title="客户" :note="item.customer?.name || item.customerId || '-'" />
|
||||
<t-cell title="兑换商品" :note="item.productNameSnapshot || item.skuNameSnapshot || '-'" />
|
||||
<t-cell title="兑换数量" :note="`${quantityText(item.quantity)} ${item.unitSnapshot || ''}`" />
|
||||
<t-cell title="积分" :note="`${formatPoint(item.actualPointCost)}${item.actualPointCost !== item.defaultPointCost ? '(已减免)' : ''}`" />
|
||||
<t-cell title="状态" :note="statusText(item.status)" />
|
||||
<t-cell title="兑换时间" :note="timeText(item.redeemedAt)" />
|
||||
<t-cell v-if="item.remark" title="备注" :note="item.remark" />
|
||||
<div class="photo-wrap bg-white">
|
||||
<attachment-selector :items="redemptionPhotoItems" title="兑换凭证" readonly />
|
||||
</div>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="returnList.length" title="退货记录" theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-for="record in returnList"
|
||||
:key="record.id"
|
||||
:title="`退货 ${quantityText(record.quantity)} ${item?.unitSnapshot || ''}`"
|
||||
:note="`${formatPoint(record.pointCost)} · ${timeText(record.returnedAt)}`"
|
||||
/>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</t-cell-group>
|
||||
<t-empty v-if="!item" :description="loading ? '正在加载兑换单' : '兑换单不存在'" />
|
||||
<t-button
|
||||
v-if="canReturn"
|
||||
class="return-button cell-button"
|
||||
theme="danger"
|
||||
content="冲正兑换"
|
||||
v-entrance-transition
|
||||
@click="returnVisible = true"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
<bottom-popup
|
||||
v-model="returnVisible"
|
||||
title="冲正兑换"
|
||||
left-button-text="取消"
|
||||
:right-button-text="returning ? '提交中' : '确认冲正'"
|
||||
@left-button-click="returnVisible = false"
|
||||
@right-button-click="submitReturn"
|
||||
>
|
||||
<div class="return-form">
|
||||
<t-form class="form card" label-width="6rem">
|
||||
<t-form-item label="剩余数量">
|
||||
<span v-text="`${remainText} ${item?.unitSnapshot || ''}`" />
|
||||
</t-form-item>
|
||||
<t-form-item label="冲正数量" required-mark>
|
||||
<t-input v-model.trim="returnQuantity" type="number" align="right" borderless />
|
||||
</t-form-item>
|
||||
<t-form-item label="冲正原因">
|
||||
<t-textarea v-model.trim="returnRemark" maxlength="500" autosize />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="returnPhotos"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="冲正凭证照片"
|
||||
/>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -225,7 +229,7 @@ onMounted(load);
|
||||
.redemption-detail {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 2rem;
|
||||
padding: 0 0 2rem;
|
||||
flex-direction: column;
|
||||
|
||||
.return-button {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.pointRedemption.create" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.pointRedemption.create" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="refreshing"
|
||||
|
||||
+107
-103
@@ -1,108 +1,112 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分规则详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="rule?.id && canUpdate"
|
||||
@click="toEdit"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="编辑"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="permissionCodes.pointRule.read" class="point-rule-detail">
|
||||
<section v-if="rule" class="rule-header" v-entrance-transition>
|
||||
<div class="point-icon" :class="{ consume: isConsumeRule }">
|
||||
<t-icon name="money" size="1.75rem" />
|
||||
</div>
|
||||
<div class="header-content">
|
||||
<div class="title-row">
|
||||
<h2 v-text="rule.name || '未命名规则'" />
|
||||
<t-tag :theme="getStatusTheme(rule.status)" variant="light-outline" :content="getStatusText(rule.status)" />
|
||||
</div>
|
||||
<div class="point-value" v-text="rulePointText" />
|
||||
</div>
|
||||
</section>
|
||||
<t-cell-group v-if="rule" title="基本信息" theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-if="rule.triggerSourceType === 'EVENT_RECORD'"
|
||||
title="触发事件"
|
||||
:note="event?.name || '未绑定事件'"
|
||||
:arrow="canReadEvent && !!event?.id"
|
||||
:hover="canReadEvent && !!event?.id"
|
||||
@click="toEventDetail"
|
||||
/>
|
||||
<t-cell v-else-if="rule.triggerSourceType === 'SALES_ORDER_PAID'" title="触发来源" note="订单首次全额实收" />
|
||||
<t-cell title="规则名称" :note="rule.name || '未命名规则'" />
|
||||
<t-cell title="规则状态">
|
||||
<template #note>
|
||||
<t-tag :theme="getStatusTheme(rule.status)" variant="light-outline" :content="getStatusText(rule.status)" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="规则备注" :note="Text.display(rule.remark)" />
|
||||
</t-cell-group>
|
||||
<t-cell-group
|
||||
v-if="rule"
|
||||
class="script"
|
||||
title="积分配置"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="积分规则详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<t-cell title="规则模式" :note="rule.ruleMode === 'GROOVY' ? '脚本规则' : '简单规则'" />
|
||||
<t-cell v-if="rule.ruleMode !== 'GROOVY'" title="固定积分" :note="formatPointValue(rule.pointValue)" />
|
||||
<template v-if="rule?.ruleMode === 'GROOVY'">
|
||||
<t-cell title="执行脚本" :note="scriptName" />
|
||||
<t-cell class="description empty-cell-title-margin">
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<span>脚本说明</span>
|
||||
<span class="tips orange">如需调整规则请联系技术支持</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #description>
|
||||
<markdown-view :content="rule.groovyScript?.description || '暂无脚本说明'" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell class="empty-cell-title-margin" title="脚本代码">
|
||||
<template #description>
|
||||
<code-editor
|
||||
v-if="scriptContent"
|
||||
:value="scriptContent"
|
||||
language="groovy"
|
||||
readonly
|
||||
line-numbers
|
||||
class="code"
|
||||
/>
|
||||
<center-tips v-else :content="'暂无脚本代码'" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="rule?.id && canUpdate"
|
||||
@click="toEdit"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="编辑"
|
||||
/>
|
||||
</template>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="rule" title="其他配置" theme="card" v-entrance-transition>
|
||||
<t-cell title="规则优先级" :note="formatNumber(rule.priority)" />
|
||||
<t-cell title="命中后停止匹配" :note="rule.exclusive ? '是' : '否'" />
|
||||
<t-cell title="生效开始" :note="formatDate(rule.beginAt)" />
|
||||
<t-cell title="生效结束" :note="formatDate(rule.endAt)" />
|
||||
<t-cell title="创建时间" :note="formatDate(rule.createdAt, '未知时间')" />
|
||||
<t-cell title="更新时间" :note="formatDate(rule.updatedAt, '未知时间')" />
|
||||
</t-cell-group>
|
||||
<t-button
|
||||
v-if="rule && canDelete"
|
||||
class="cell-button"
|
||||
:loading="isDeleting"
|
||||
theme="danger"
|
||||
@click="confirmRemove"
|
||||
>
|
||||
删除
|
||||
</t-button>
|
||||
<t-empty v-if="!rule" :description="isLoading ? '正在加载积分规则' : '积分规则不存在'" />
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.pointRule.read" class="point-rule-detail">
|
||||
<section v-if="rule" class="rule-header" v-entrance-transition>
|
||||
<div class="point-icon" :class="{ consume: isConsumeRule }">
|
||||
<t-icon name="money" size="1.75rem" />
|
||||
</div>
|
||||
<div class="header-content">
|
||||
<div class="title-row">
|
||||
<h2 v-text="rule.name || '未命名规则'" />
|
||||
<t-tag :theme="getStatusTheme(rule.status)" variant="light-outline" :content="getStatusText(rule.status)" />
|
||||
</div>
|
||||
<div class="point-value" v-text="rulePointText" />
|
||||
</div>
|
||||
</section>
|
||||
<t-cell-group v-if="rule" title="基本信息" theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-if="rule.triggerSourceType === 'EVENT_RECORD'"
|
||||
title="触发事件"
|
||||
:note="event?.name || '未绑定事件'"
|
||||
:arrow="canReadEvent && !!event?.id"
|
||||
:hover="canReadEvent && !!event?.id"
|
||||
@click="toEventDetail"
|
||||
/>
|
||||
<t-cell v-else-if="rule.triggerSourceType === 'SALES_ORDER_PAID'" title="触发来源" note="订单首次全额实收" />
|
||||
<t-cell title="规则名称" :note="rule.name || '未命名规则'" />
|
||||
<t-cell title="规则状态">
|
||||
<template #note>
|
||||
<t-tag :theme="getStatusTheme(rule.status)" variant="light-outline" :content="getStatusText(rule.status)" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="规则备注" :note="Text.display(rule.remark)" />
|
||||
</t-cell-group>
|
||||
<t-cell-group
|
||||
v-if="rule"
|
||||
class="script"
|
||||
title="积分配置"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-cell title="规则模式" :note="rule.ruleMode === 'GROOVY' ? '脚本规则' : '简单规则'" />
|
||||
<t-cell v-if="rule.ruleMode !== 'GROOVY'" title="固定积分" :note="formatPointValue(rule.pointValue)" />
|
||||
<template v-if="rule?.ruleMode === 'GROOVY'">
|
||||
<t-cell title="执行脚本" :note="scriptName" />
|
||||
<t-cell class="description empty-cell-title-margin">
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<span>脚本说明</span>
|
||||
<span class="tips orange">如需调整规则请联系技术支持</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #description>
|
||||
<markdown-view :content="rule.groovyScript?.description || '暂无脚本说明'" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell class="empty-cell-title-margin" title="脚本代码">
|
||||
<template #description>
|
||||
<code-editor
|
||||
v-if="scriptContent"
|
||||
:value="scriptContent"
|
||||
language="groovy"
|
||||
readonly
|
||||
line-numbers
|
||||
class="code"
|
||||
/>
|
||||
<center-tips v-else :content="'暂无脚本代码'" />
|
||||
</template>
|
||||
</t-cell>
|
||||
</template>
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="rule" title="其他配置" theme="card" v-entrance-transition>
|
||||
<t-cell title="规则优先级" :note="formatNumber(rule.priority)" />
|
||||
<t-cell title="命中后停止匹配" :note="rule.exclusive ? '是' : '否'" />
|
||||
<t-cell title="生效开始" :note="formatDate(rule.beginAt)" />
|
||||
<t-cell title="生效结束" :note="formatDate(rule.endAt)" />
|
||||
<t-cell title="创建时间" :note="formatDate(rule.createdAt, '未知时间')" />
|
||||
<t-cell title="更新时间" :note="formatDate(rule.updatedAt, '未知时间')" />
|
||||
</t-cell-group>
|
||||
<t-button
|
||||
v-if="rule && canDelete"
|
||||
class="cell-button"
|
||||
:loading="isDeleting"
|
||||
theme="danger"
|
||||
@click="confirmRemove"
|
||||
>
|
||||
删除
|
||||
</t-button>
|
||||
<t-empty v-if="!rule" :description="isLoading ? '正在加载积分规则' : '积分规则不存在'" />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -326,7 +330,7 @@ watch(() => route.params.id, async () => {
|
||||
.point-rule-detail {
|
||||
gap: 1rem;
|
||||
min-height: 100vh;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
padding: 0 0 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
+158
-154
@@ -1,159 +1,163 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="userStore.hasPermissions(savePermissionCode)"
|
||||
@click="saveRule"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="userStore.hasPermissions(savePermissionCode)"
|
||||
@click="saveRule"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="pageAccess" class="point-rule-edit">
|
||||
<t-form class="form card" label-width="7rem">
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="触发来源" required-mark arrow @click="openTriggerSourcePicker">
|
||||
<span class="picker-text" v-text="getTriggerSourceText(formModel.triggerSourceType)" />
|
||||
</t-form-item>
|
||||
<t-form-item v-if="formModel.triggerSourceType === 'EVENT_RECORD'" label="触发事件" required-mark arrow @click="openEventPicker">
|
||||
<span class="picker-text" v-text="selectedEventName" />
|
||||
</t-form-item>
|
||||
<t-form-item v-else label-width="0" class="form-tips">订单首次全额实收时触发,同一订单每条规则只生效一次</t-form-item>
|
||||
<t-form-item label="规则名称" required-mark>
|
||||
<t-input v-model.trim="formModel.name" align="right" borderless placeholder="例如:每次登记加 10 分" />
|
||||
</t-form-item>
|
||||
<t-form-item label="规则状态" arrow @click="openStatusPicker">
|
||||
<span class="picker-text" v-text="getStatusText(formModel.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="规则备注">
|
||||
<t-textarea v-model.trim="formModel.remark" :autosize="{ minRows: 3, maxRows: 5 }" placeholder="规则说明" />
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="规则模式" arrow @click="openRuleModePicker">
|
||||
<span class="picker-text" v-text="getRuleModeText(formModel.ruleMode)" />
|
||||
</t-form-item>
|
||||
<template v-if="formModel.ruleMode === 'GROOVY'">
|
||||
<t-form-item label="执行脚本" required-mark arrow @click="openScriptPicker">
|
||||
<span class="picker-text" v-text="selectedScriptText" />
|
||||
</t-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<t-form-item label="积分动作" arrow @click="openPointActionPicker">
|
||||
<span class="picker-text" v-text="getPointActionText(formModel.pointAction)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="积分数量" required-mark>
|
||||
<t-input
|
||||
v-model.trim="formModel.pointValueText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
placeholder="请输入数量"
|
||||
/>
|
||||
</t-form-item>
|
||||
</template>
|
||||
</card-container>
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="生效开始" arrow @click="openBeginAtPicker">
|
||||
<div class="time-value">
|
||||
<span class="picker-text" v-text="formModel.beginAtText || '不限'" />
|
||||
<t-button v-if="formModel.beginAtText" size="extra-small" content="不限" @click.stop="clearBeginAt" />
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="生效结束" arrow @click="openEndAtPicker">
|
||||
<div class="time-value">
|
||||
<span class="picker-text" v-text="formModel.endAtText || '不限'" />
|
||||
<t-button v-if="formModel.endAtText" size="extra-small" content="不限" @click.stop="clearEndAt" />
|
||||
</div>
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
<card-container tips="命中规则并执行积分动作后不再匹配后续规则" v-entrance-transition>
|
||||
<t-form-item label="独占匹配" content-align="right">
|
||||
<t-switch size="small" v-model="formModel.exclusive" />
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
</t-form>
|
||||
</div>
|
||||
</main>
|
||||
<t-popup v-model="eventPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="eventPickerDraft"
|
||||
:columns="eventPickerColumns"
|
||||
title="选择触发事件"
|
||||
@cancel="eventPickerVisible = false"
|
||||
@confirm="confirmEventPicker"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="pageAccess" class="point-rule-edit">
|
||||
<t-form class="form card" label-width="7rem">
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="触发来源" required-mark arrow @click="openTriggerSourcePicker">
|
||||
<span class="picker-text" v-text="getTriggerSourceText(formModel.triggerSourceType)" />
|
||||
</t-form-item>
|
||||
<t-form-item v-if="formModel.triggerSourceType === 'EVENT_RECORD'" label="触发事件" required-mark arrow @click="openEventPicker">
|
||||
<span class="picker-text" v-text="selectedEventName" />
|
||||
</t-form-item>
|
||||
<t-form-item v-else label-width="0" class="form-tips">订单首次全额实收时触发,同一订单每条规则只生效一次</t-form-item>
|
||||
<t-form-item label="规则名称" required-mark>
|
||||
<t-input v-model.trim="formModel.name" align="right" borderless placeholder="例如:每次登记加 10 分" />
|
||||
</t-form-item>
|
||||
<t-form-item label="规则状态" arrow @click="openStatusPicker">
|
||||
<span class="picker-text" v-text="getStatusText(formModel.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="规则备注">
|
||||
<t-textarea v-model.trim="formModel.remark" :autosize="{ minRows: 3, maxRows: 5 }" placeholder="规则说明" />
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="规则模式" arrow @click="openRuleModePicker">
|
||||
<span class="picker-text" v-text="getRuleModeText(formModel.ruleMode)" />
|
||||
</t-form-item>
|
||||
<template v-if="formModel.ruleMode === 'GROOVY'">
|
||||
<t-form-item label="执行脚本" required-mark arrow @click="openScriptPicker">
|
||||
<span class="picker-text" v-text="selectedScriptText" />
|
||||
</t-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<t-form-item label="积分动作" arrow @click="openPointActionPicker">
|
||||
<span class="picker-text" v-text="getPointActionText(formModel.pointAction)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="积分数量" required-mark>
|
||||
<t-input
|
||||
v-model.trim="formModel.pointValueText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
placeholder="请输入数量"
|
||||
/>
|
||||
</t-form-item>
|
||||
</template>
|
||||
</card-container>
|
||||
<card-container v-entrance-transition>
|
||||
<t-form-item label="生效开始" arrow @click="openBeginAtPicker">
|
||||
<div class="time-value">
|
||||
<span class="picker-text" v-text="formModel.beginAtText || '不限'" />
|
||||
<t-button v-if="formModel.beginAtText" size="extra-small" content="不限" @click.stop="clearBeginAt" />
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="生效结束" arrow @click="openEndAtPicker">
|
||||
<div class="time-value">
|
||||
<span class="picker-text" v-text="formModel.endAtText || '不限'" />
|
||||
<t-button v-if="formModel.endAtText" size="extra-small" content="不限" @click.stop="clearEndAt" />
|
||||
</div>
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
<card-container tips="命中规则并执行积分动作后不再匹配后续规则" v-entrance-transition>
|
||||
<t-form-item label="独占匹配" content-align="right">
|
||||
<t-switch size="small" v-model="formModel.exclusive" />
|
||||
</t-form-item>
|
||||
</card-container>
|
||||
</t-form>
|
||||
</t-popup>
|
||||
<t-popup v-model="triggerSourcePickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="triggerSourcePickerDraft"
|
||||
:columns="triggerSourcePickerColumns"
|
||||
title="触发来源"
|
||||
@cancel="triggerSourcePickerVisible = false"
|
||||
@confirm="confirmTriggerSourcePicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="statusPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="statusPickerDraft"
|
||||
:columns="statusPickerColumns"
|
||||
title="规则状态"
|
||||
@cancel="statusPickerVisible = false"
|
||||
@confirm="confirmStatusPicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="pointActionPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="pointActionPickerDraft"
|
||||
:columns="pointActionPickerColumns"
|
||||
title="积分动作"
|
||||
@cancel="pointActionPickerVisible = false"
|
||||
@confirm="confirmPointActionPicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="ruleModePickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="ruleModePickerDraft"
|
||||
:columns="ruleModePickerColumns"
|
||||
title="规则模式"
|
||||
@cancel="ruleModePickerVisible = false"
|
||||
@confirm="confirmRuleModePicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<point-rule-script-picker
|
||||
v-model="formModel.groovyScriptId"
|
||||
v-model:visible="scriptPickerVisible"
|
||||
:scripts="availableScriptList"
|
||||
/>
|
||||
<t-popup v-model="beginAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-model="beginAtDraftText"
|
||||
:start="minimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="生效开始"
|
||||
@cancel="beginAtPickerVisible = false"
|
||||
@confirm="confirmBeginAt"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="endAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-model="endAtDraftText"
|
||||
:start="endAtMinimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="生效结束"
|
||||
@cancel="endAtPickerVisible = false"
|
||||
@confirm="confirmEndAt"
|
||||
/>
|
||||
</t-popup>
|
||||
</div>
|
||||
<t-popup v-model="eventPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="eventPickerDraft"
|
||||
:columns="eventPickerColumns"
|
||||
title="选择触发事件"
|
||||
@cancel="eventPickerVisible = false"
|
||||
@confirm="confirmEventPicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="triggerSourcePickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="triggerSourcePickerDraft"
|
||||
:columns="triggerSourcePickerColumns"
|
||||
title="触发来源"
|
||||
@cancel="triggerSourcePickerVisible = false"
|
||||
@confirm="confirmTriggerSourcePicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="statusPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="statusPickerDraft"
|
||||
:columns="statusPickerColumns"
|
||||
title="规则状态"
|
||||
@cancel="statusPickerVisible = false"
|
||||
@confirm="confirmStatusPicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="pointActionPickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="pointActionPickerDraft"
|
||||
:columns="pointActionPickerColumns"
|
||||
title="积分动作"
|
||||
@cancel="pointActionPickerVisible = false"
|
||||
@confirm="confirmPointActionPicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="ruleModePickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="ruleModePickerDraft"
|
||||
:columns="ruleModePickerColumns"
|
||||
title="规则模式"
|
||||
@cancel="ruleModePickerVisible = false"
|
||||
@confirm="confirmRuleModePicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<point-rule-script-picker
|
||||
v-model="formModel.groovyScriptId"
|
||||
v-model:visible="scriptPickerVisible"
|
||||
:scripts="availableScriptList"
|
||||
/>
|
||||
<t-popup v-model="beginAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-model="beginAtDraftText"
|
||||
:start="minimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="生效开始"
|
||||
@cancel="beginAtPickerVisible = false"
|
||||
@confirm="confirmBeginAt"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="endAtPickerVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-model="endAtDraftText"
|
||||
:start="endAtMinimumDateTimeText"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="生效结束"
|
||||
@cancel="endAtPickerVisible = false"
|
||||
@confirm="confirmEndAt"
|
||||
/>
|
||||
</t-popup>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -574,7 +578,7 @@ onMounted(async () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.point-rule-edit {
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 calc(1rem + env(safe-area-inset-bottom, 0));
|
||||
padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0));
|
||||
|
||||
.form {
|
||||
gap: 1rem;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<navbar-actions :actions="actionList" :visible="canShowActionMenu" />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.pointRule.read" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.pointRule.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="list-wrapper pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
Reference in New Issue
Block a user