1.优化后台页面样式
2.优化统一订单中红利的状态和失败原因 3.移除项目中冗余代码和字段
This commit is contained in:
75
web/src/components/table/fieldRender/failReason.vue
Normal file
75
web/src/components/table/fieldRender/failReason.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<div class="mall-order-fail-reason-table-cell">
|
||||
<template v-if="fullText !== ''">
|
||||
<el-tooltip placement="top" effect="dark" popper-class="mall-order-reason-tooltip" :enterable="true">
|
||||
<template #content>
|
||||
<div class="mall-order-fail-reason-tooltip-body">{{ fullText }}</div>
|
||||
</template>
|
||||
<span class="mall-order-fail-reason-ellipsis">{{ displayText }}</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { TableColumnCtx } from 'element-plus'
|
||||
import { getCellValue } from '/@/components/table/index'
|
||||
|
||||
interface Props {
|
||||
row: TableRow
|
||||
field: TableColumn
|
||||
column: TableColumnCtx<TableRow>
|
||||
index: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
/** 与后台换行一致;无换行时在 attempt N: 前补行首,便于阅读 */
|
||||
function normalizeFailReasonText(raw: unknown): string {
|
||||
if (raw === null || raw === undefined) {
|
||||
return ''
|
||||
}
|
||||
let t = String(raw)
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/\r/g, '\n')
|
||||
t = t.replace(/([^\n])(attempt\s+\d+:)/gi, '$1\n$2')
|
||||
return t
|
||||
}
|
||||
|
||||
const rawCell = computed(() => getCellValue(props.row, props.field, props.column, props.index))
|
||||
|
||||
const fullText = computed(() => normalizeFailReasonText(rawCell.value))
|
||||
|
||||
const displayText = computed(() => fullText.value)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.mall-order-fail-reason-table-cell {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mall-order-fail-reason-ellipsis {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.el-popper.mall-order-reason-tooltip {
|
||||
max-width: min(560px, 90vw);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mall-order-reason-tooltip .mall-order-fail-reason-tooltip-body {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
@@ -19,7 +19,6 @@ export default {
|
||||
amount: 'Cash amount',
|
||||
multiplier: 'Turnover multiplier',
|
||||
external_transaction_id: 'Order number',
|
||||
playx_transaction_id: 'PlayX transaction ID',
|
||||
grant_status: 'Grant status',
|
||||
'grant_status NOT_SENT': 'Not sent',
|
||||
'grant_status SENT_PENDING': 'Sent (queued)',
|
||||
|
||||
@@ -16,7 +16,6 @@ export default {
|
||||
amount: 'amount',
|
||||
multiplier: 'multiplier',
|
||||
external_transaction_id: 'external_transaction_id',
|
||||
playx_transaction_id: 'playx_transaction_id',
|
||||
grant_status: 'grant_status',
|
||||
'grant_status NOT_SENT': 'NOT_SENT',
|
||||
'grant_status SENT_PENDING': 'SENT_PENDING',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export default {
|
||||
id: 'ID',
|
||||
claim_request_id: '领取订单号',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
claimed_amount: '领取积分',
|
||||
create_time: '创建时间',
|
||||
'quick Search Fields': 'ID',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
id: 'ID',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
date: '业务日期',
|
||||
username: '用户名',
|
||||
yesterday_win_loss_net: '昨日净输赢',
|
||||
|
||||
@@ -3,23 +3,22 @@ export default {
|
||||
manual_retry: '手动重试',
|
||||
retry_confirm: '确认将该订单加入重试队列?',
|
||||
id: 'ID',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
type: '类型',
|
||||
'type BONUS': '红利(BONUS)',
|
||||
'type PHYSICAL': '实物(PHYSICAL)',
|
||||
'type WITHDRAW': '提现(WITHDRAW)',
|
||||
status: '状态',
|
||||
'status PENDING': '处理中(PENDING)',
|
||||
'status COMPLETED': '已完成(COMPLETED)',
|
||||
'status SHIPPED': '已发货(SHIPPED)',
|
||||
'status REJECTED': '已驳回(REJECTED)',
|
||||
'status PENDING': '处理中',
|
||||
'status COMPLETED': '已完成',
|
||||
'status SHIPPED': '已发货',
|
||||
'status REJECTED': '已驳回',
|
||||
mall_item_id: '商品ID',
|
||||
mallitem__title: '商品标题',
|
||||
points_cost: '消耗积分',
|
||||
amount: '现金面值',
|
||||
multiplier: '流水倍数',
|
||||
external_transaction_id: '订单号',
|
||||
playx_transaction_id: 'PlayX流水号',
|
||||
grant_status: '推送playx状态',
|
||||
'grant_status NOT_SENT': '未发送',
|
||||
'grant_status SENT_PENDING': '已发送排队',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export default {
|
||||
id: 'ID',
|
||||
claim_request_id: '领取订单号',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
claimed_amount: '领取积分',
|
||||
create_time: '创建时间',
|
||||
'quick Search Fields': 'ID',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
id: 'ID',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
date: '业务日期',
|
||||
username: '用户名',
|
||||
yesterday_win_loss_net: '昨日净输赢',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
id: 'ID',
|
||||
user_id: '用户ID',
|
||||
user_id: 'Playx-ID',
|
||||
type: '类型',
|
||||
'type BONUS': '红利(BONUS)',
|
||||
'type PHYSICAL': '实物(PHYSICAL)',
|
||||
@@ -16,7 +16,6 @@ export default {
|
||||
amount: '现金面值',
|
||||
multiplier: '流水倍数',
|
||||
external_transaction_id: '订单号',
|
||||
playx_transaction_id: 'PlayX流水号',
|
||||
grant_status: '推送playx状态',
|
||||
'grant_status NOT_SENT': '未发送',
|
||||
'grant_status SENT_PENDING': '已发送排队',
|
||||
|
||||
@@ -2,7 +2,7 @@ export default {
|
||||
id: 'ID',
|
||||
username: '用户名',
|
||||
phone: '手机号',
|
||||
playx_user_id: 'PlayX用户ID',
|
||||
playx_user_id: 'PlayX-ID',
|
||||
locked_points: '待领取积分',
|
||||
available_points: '可用积分',
|
||||
today_limit: '今日可领取上限',
|
||||
|
||||
@@ -2,7 +2,7 @@ export default {
|
||||
id: 'ID',
|
||||
username: '用户名',
|
||||
phone: '手机号',
|
||||
playx_user_id: 'PlayX用户ID',
|
||||
playx_user_id: 'PlayX-ID',
|
||||
locked_points: '待领取积分',
|
||||
available_points: '可用积分',
|
||||
today_limit: '今日可领取上限',
|
||||
|
||||
@@ -2,7 +2,7 @@ export default {
|
||||
'User name': '用户名',
|
||||
'User nickname': '用户昵称',
|
||||
balance: '余额',
|
||||
'User ID': '用户ID',
|
||||
'User ID': 'Playx-ID',
|
||||
'Change balance': '变更余额',
|
||||
'Before change': '变更前',
|
||||
'After change': '变更后',
|
||||
|
||||
@@ -12,6 +12,26 @@ import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
|
||||
import { useUserInfo } from '/@/stores/userInfo'
|
||||
import { isAdminApp } from '/@/utils/common'
|
||||
|
||||
/** 与后台 LoadLangPack 一致:优先与当前 i18n 语言对齐,再回落到 config */
|
||||
function resolveAdminThinkLang(): string {
|
||||
const cfg = useConfig()
|
||||
try {
|
||||
const loc = i18n?.global?.locale?.value
|
||||
if (loc !== undefined && loc !== null && loc !== '') {
|
||||
const v = String(loc).toLowerCase().replace('_', '-')
|
||||
if (v === 'zh-cn' || v === 'zh') {
|
||||
return 'zh-cn'
|
||||
}
|
||||
if (v === 'en') {
|
||||
return 'en'
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// i18n 未就绪时忽略
|
||||
}
|
||||
return cfg.lang.defaultLang
|
||||
}
|
||||
|
||||
window.requests = []
|
||||
window.tokenRefreshing = false
|
||||
const pendingMap = new Map()
|
||||
@@ -50,7 +70,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
baseURL: getUrl(),
|
||||
timeout: 1000 * 10,
|
||||
headers: {
|
||||
'think-lang': config.lang.defaultLang,
|
||||
'think-lang': resolveAdminThinkLang(),
|
||||
},
|
||||
responseType: 'json',
|
||||
})
|
||||
@@ -93,7 +113,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
if (token) (config.headers as anyObj).batoken = token
|
||||
const userToken = options.anotherToken || userInfo.getToken()
|
||||
if (userToken) (config.headers as anyObj)['ba-user-token'] = userToken
|
||||
;(config.headers as anyObj)['think-lang'] = useConfig().lang.defaultLang
|
||||
;(config.headers as anyObj)['think-lang'] = resolveAdminThinkLang()
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
@@ -30,6 +30,7 @@ defineOptions({
|
||||
|
||||
const { t } = useI18n()
|
||||
const tableRef = useTemplateRef('tableRef')
|
||||
|
||||
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete']).map((btn) =>
|
||||
btn.name === 'edit'
|
||||
? {
|
||||
@@ -80,7 +81,7 @@ const baTable = new baTableClass(
|
||||
align: 'center',
|
||||
effect: 'dark',
|
||||
custom: { PENDING: 'success', COMPLETED: 'primary', SHIPPED: 'info', REJECTED: 'loading' },
|
||||
minWidth: 160,
|
||||
minWidth: 100,
|
||||
operator: 'eq',
|
||||
sortable: false,
|
||||
render: 'tag',
|
||||
@@ -91,7 +92,14 @@ const baTable = new baTableClass(
|
||||
REJECTED: t('mall.order.status REJECTED'),
|
||||
},
|
||||
},
|
||||
{ label: t('mall.order.mall_item_id'), prop: 'mall_item_id', align: 'center', operator: 'RANGE', sortable: false },
|
||||
{
|
||||
label: t('mall.order.mall_item_id'),
|
||||
prop: 'mall_item_id',
|
||||
align: 'center',
|
||||
show: false,
|
||||
operator: 'RANGE',
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
label: t('mall.order.mallitem__title'),
|
||||
prop: 'mallItem.title',
|
||||
@@ -114,14 +122,6 @@ const baTable = new baTableClass(
|
||||
sortable: false,
|
||||
operator: 'LIKE',
|
||||
},
|
||||
{
|
||||
label: t('mall.order.playx_transaction_id'),
|
||||
prop: 'playx_transaction_id',
|
||||
align: 'center',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
sortable: false,
|
||||
operator: 'LIKE',
|
||||
},
|
||||
{
|
||||
label: t('mall.order.grant_status'),
|
||||
prop: 'grant_status',
|
||||
@@ -151,7 +151,8 @@ const baTable = new baTableClass(
|
||||
label: t('mall.order.fail_reason'),
|
||||
prop: 'fail_reason',
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 140,
|
||||
render: 'failReason',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
sortable: false,
|
||||
operator: 'LIKE',
|
||||
@@ -160,7 +161,8 @@ const baTable = new baTableClass(
|
||||
label: t('mall.order.reject_reason'),
|
||||
prop: 'reject_reason',
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 140,
|
||||
render: 'failReason',
|
||||
sortable: false,
|
||||
operator: 'LIKE',
|
||||
operatorPlaceholder: t('Fuzzy query'),
|
||||
@@ -315,5 +317,3 @@ onMounted(() => {
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@@ -69,7 +69,6 @@ const baTable = new baTableClass(
|
||||
{ label: t('mall.playxOrder.amount'), prop: 'amount', align: 'center', operator: 'RANGE', sortable: false },
|
||||
{ label: t('mall.playxOrder.multiplier'), prop: 'multiplier', align: 'center', operator: 'eq', sortable: false },
|
||||
{ label: t('mall.playxOrder.external_transaction_id'), prop: 'external_transaction_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||
{ label: t('mall.playxOrder.playx_transaction_id'), prop: 'playx_transaction_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||
{
|
||||
label: t('mall.playxOrder.grant_status'),
|
||||
prop: 'grant_status',
|
||||
|
||||
Reference in New Issue
Block a user