[积分商城]PlayX统一订单
This commit is contained in:
250
app/admin/controller/mall/PlayxOrder.php
Normal file
250
app/admin/controller/mall/PlayxOrder.php
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\mall;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
use app\common\model\MallPlayxOrder;
|
||||||
|
use app\common\model\MallPlayxUserAsset;
|
||||||
|
use support\think\Db;
|
||||||
|
use support\Response;
|
||||||
|
use Webman\Http\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayX 统一订单(后台列表)
|
||||||
|
*/
|
||||||
|
class PlayxOrder extends Backend
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var object|null
|
||||||
|
* @phpstan-var \app\common\model\MallPlayxOrder|null
|
||||||
|
*/
|
||||||
|
protected ?object $model = null;
|
||||||
|
|
||||||
|
protected array|string $preExcludeFields = ['id', 'create_time', 'update_time'];
|
||||||
|
|
||||||
|
protected array $withJoinTable = ['mallItem'];
|
||||||
|
|
||||||
|
protected string|array $quickSearchField = ['user_id', 'external_transaction_id', 'playx_transaction_id'];
|
||||||
|
|
||||||
|
protected string|array $indexField = [
|
||||||
|
'id',
|
||||||
|
'user_id',
|
||||||
|
'type',
|
||||||
|
'status',
|
||||||
|
'mall_item_id',
|
||||||
|
'points_cost',
|
||||||
|
'amount',
|
||||||
|
'multiplier',
|
||||||
|
'external_transaction_id',
|
||||||
|
'playx_transaction_id',
|
||||||
|
'grant_status',
|
||||||
|
'fail_reason',
|
||||||
|
'reject_reason',
|
||||||
|
'shipping_company',
|
||||||
|
'shipping_no',
|
||||||
|
'receiver_name',
|
||||||
|
'receiver_phone',
|
||||||
|
'receiver_address',
|
||||||
|
'create_time',
|
||||||
|
'update_time',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->model = new \app\common\model\MallPlayxOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function index(Request $request): Response
|
||||||
|
{
|
||||||
|
$response = $this->initializeBackend($request);
|
||||||
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->get('select') || $request->post('select')) {
|
||||||
|
return $this->select($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||||
|
$res = $this->model
|
||||||
|
->with(['mallItem' => function ($query) {
|
||||||
|
$query->field('id,title');
|
||||||
|
}])
|
||||||
|
->visible(['mallItem' => ['title']])
|
||||||
|
->alias($alias)
|
||||||
|
->where($where)
|
||||||
|
->order($order)
|
||||||
|
->paginate($limit);
|
||||||
|
|
||||||
|
return $this->success('', [
|
||||||
|
'list' => $res->items(),
|
||||||
|
'total' => $res->total(),
|
||||||
|
'remark' => get_route_remark(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHYSICAL 发货:更新 shipping_company/shipping_no,并将状态置为 SHIPPED
|
||||||
|
*/
|
||||||
|
public function ship(Request $request): Response
|
||||||
|
{
|
||||||
|
$response = $this->initializeBackend($request);
|
||||||
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->method() !== 'POST') {
|
||||||
|
return $this->error(__('Parameter error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $request->post();
|
||||||
|
$id = intval($data['id'] ?? 0);
|
||||||
|
$shippingCompany = strval($data['shipping_company'] ?? '');
|
||||||
|
$shippingNo = strval($data['shipping_no'] ?? '');
|
||||||
|
|
||||||
|
if ($id <= 0 || $shippingCompany === '' || $shippingNo === '') {
|
||||||
|
return $this->error(__('Missing required fields'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = MallPlayxOrder::where('id', $id)->find();
|
||||||
|
if (!$order) {
|
||||||
|
return $this->error(__('Record not found'));
|
||||||
|
}
|
||||||
|
if ($order->type !== MallPlayxOrder::TYPE_PHYSICAL) {
|
||||||
|
return $this->error(__('Order type not PHYSICAL'));
|
||||||
|
}
|
||||||
|
if ($order->status !== MallPlayxOrder::STATUS_PENDING) {
|
||||||
|
return $this->error(__('Order status must be PENDING'));
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$order->shipping_company = $shippingCompany;
|
||||||
|
$order->shipping_no = $shippingNo;
|
||||||
|
$order->status = MallPlayxOrder::STATUS_SHIPPED;
|
||||||
|
$order->save();
|
||||||
|
Db::commit();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success(__('Shipped successfully'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHYSICAL 驳回:更新状态为 REJECTED,并退回积分到 available_points
|
||||||
|
*/
|
||||||
|
public function reject(Request $request): Response
|
||||||
|
{
|
||||||
|
$response = $this->initializeBackend($request);
|
||||||
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->method() !== 'POST') {
|
||||||
|
return $this->error(__('Parameter error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $request->post();
|
||||||
|
$id = intval($data['id'] ?? 0);
|
||||||
|
$rejectReason = strval($data['reject_reason'] ?? '');
|
||||||
|
|
||||||
|
if ($id <= 0 || $rejectReason === '') {
|
||||||
|
return $this->error(__('Missing required fields'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = MallPlayxOrder::where('id', $id)->find();
|
||||||
|
if (!$order) {
|
||||||
|
return $this->error(__('Record not found'));
|
||||||
|
}
|
||||||
|
if ($order->type !== MallPlayxOrder::TYPE_PHYSICAL) {
|
||||||
|
return $this->error(__('Order type not PHYSICAL'));
|
||||||
|
}
|
||||||
|
if ($order->status !== MallPlayxOrder::STATUS_PENDING) {
|
||||||
|
return $this->error(__('Order status must be PENDING'));
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$asset = MallPlayxUserAsset::where('user_id', strval($order->user_id ?? ''))->find();
|
||||||
|
if (!$asset) {
|
||||||
|
$asset = MallPlayxUserAsset::create([
|
||||||
|
'user_id' => strval($order->user_id ?? ''),
|
||||||
|
'username' => strval($order->user_id ?? ''),
|
||||||
|
'locked_points' => 0,
|
||||||
|
'available_points' => 0,
|
||||||
|
'today_limit' => 0,
|
||||||
|
'today_claimed' => 0,
|
||||||
|
'today_limit_date' => null,
|
||||||
|
'create_time' => time(),
|
||||||
|
'update_time' => time(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$refund = intval($order->points_cost ?? 0);
|
||||||
|
if ($refund > 0) {
|
||||||
|
$asset->available_points += $refund;
|
||||||
|
$asset->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
||||||
|
$order->reject_reason = $rejectReason;
|
||||||
|
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success(__('Rejected successfully'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动重试(仅红利/提现,且必须 FAILED_RETRYABLE)
|
||||||
|
*/
|
||||||
|
public function retry(Request $request): Response
|
||||||
|
{
|
||||||
|
$response = $this->initializeBackend($request);
|
||||||
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->method() !== 'POST') {
|
||||||
|
return $this->error(__('Parameter error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = intval($request->post('id', 0));
|
||||||
|
if ($id <= 0) {
|
||||||
|
return $this->error(__('Missing required fields'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = MallPlayxOrder::where('id', $id)->find();
|
||||||
|
if (!$order) {
|
||||||
|
return $this->error(__('Record not found'));
|
||||||
|
}
|
||||||
|
if (!in_array($order->type, [MallPlayxOrder::TYPE_BONUS, MallPlayxOrder::TYPE_WITHDRAW], true)) {
|
||||||
|
return $this->error(__('Only BONUS/WITHDRAW can retry'));
|
||||||
|
}
|
||||||
|
if ($order->grant_status !== MallPlayxOrder::GRANT_FAILED_RETRYABLE) {
|
||||||
|
return $this->error(__('Only FAILED_RETRYABLE can retry'));
|
||||||
|
}
|
||||||
|
if (intval($order->retry_count) >= 3) {
|
||||||
|
return $this->error(__('Retry count exceeded'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$order->grant_status = MallPlayxOrder::GRANT_NOT_SENT;
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
return $this->success(__('Retry queued'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
66
app/common/model/MallPlayxOrder.php
Normal file
66
app/common/model/MallPlayxOrder.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\think\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayX 统一订单
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $user_id
|
||||||
|
* @property string $type
|
||||||
|
* @property string $status
|
||||||
|
* @property int $mall_item_id
|
||||||
|
* @property int $points_cost
|
||||||
|
* @property float $amount
|
||||||
|
* @property int $multiplier
|
||||||
|
* @property string $external_transaction_id
|
||||||
|
* @property string $playx_transaction_id
|
||||||
|
* @property string $grant_status
|
||||||
|
* @property string|null $fail_reason
|
||||||
|
* @property int $retry_count
|
||||||
|
* @property string $reject_reason
|
||||||
|
* @property string $shipping_company
|
||||||
|
* @property string $shipping_no
|
||||||
|
* @property string $receiver_name
|
||||||
|
* @property string $receiver_phone
|
||||||
|
* @property string|null $receiver_address
|
||||||
|
*/
|
||||||
|
class MallPlayxOrder extends Model
|
||||||
|
{
|
||||||
|
protected string $name = 'mall_playx_order';
|
||||||
|
|
||||||
|
protected bool $autoWriteTimestamp = true;
|
||||||
|
|
||||||
|
public const TYPE_BONUS = 'BONUS';
|
||||||
|
public const TYPE_PHYSICAL = 'PHYSICAL';
|
||||||
|
public const TYPE_WITHDRAW = 'WITHDRAW';
|
||||||
|
|
||||||
|
public const STATUS_PENDING = 'PENDING';
|
||||||
|
public const STATUS_COMPLETED = 'COMPLETED';
|
||||||
|
public const STATUS_SHIPPED = 'SHIPPED';
|
||||||
|
public const STATUS_REJECTED = 'REJECTED';
|
||||||
|
|
||||||
|
public const GRANT_NOT_SENT = 'NOT_SENT';
|
||||||
|
public const GRANT_SENT_PENDING = 'SENT_PENDING';
|
||||||
|
public const GRANT_ACCEPTED = 'ACCEPTED';
|
||||||
|
public const GRANT_FAILED_RETRYABLE = 'FAILED_RETRYABLE';
|
||||||
|
public const GRANT_FAILED_FINAL = 'FAILED_FINAL';
|
||||||
|
|
||||||
|
protected array $type = [
|
||||||
|
'create_time' => 'integer',
|
||||||
|
'update_time' => 'integer',
|
||||||
|
'points_cost' => 'integer',
|
||||||
|
'amount' => 'float',
|
||||||
|
'multiplier' => 'integer',
|
||||||
|
'retry_count' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function mallItem(): \think\model\relation\BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(MallItem::class, 'mall_item_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
36
web/src/lang/backend/en/mall/playxOrder.ts
Normal file
36
web/src/lang/backend/en/mall/playxOrder.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
user_id: 'user_id',
|
||||||
|
type: 'type',
|
||||||
|
'type BONUS': 'Bonus(BONUS)',
|
||||||
|
'type PHYSICAL': 'Physical(PHYSICAL)',
|
||||||
|
'type WITHDRAW': 'Withdraw(WITHDRAW)',
|
||||||
|
status: 'status',
|
||||||
|
'status PENDING': 'Pending(PENDING)',
|
||||||
|
'status COMPLETED': 'Completed(COMPLETED)',
|
||||||
|
'status SHIPPED': 'Shipped(SHIPPED)',
|
||||||
|
'status REJECTED': 'Rejected(REJECTED)',
|
||||||
|
mall_item_id: 'mall_item_id',
|
||||||
|
mallitem__title: 'title',
|
||||||
|
points_cost: 'points_cost',
|
||||||
|
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',
|
||||||
|
'grant_status ACCEPTED': 'ACCEPTED',
|
||||||
|
'grant_status FAILED_RETRYABLE': 'FAILED_RETRYABLE',
|
||||||
|
'grant_status FAILED_FINAL': 'FAILED_FINAL',
|
||||||
|
fail_reason: 'fail_reason',
|
||||||
|
reject_reason: 'reject_reason',
|
||||||
|
shipping_company: 'shipping_company',
|
||||||
|
shipping_no: 'shipping_no',
|
||||||
|
receiver_name: 'receiver_name',
|
||||||
|
receiver_phone: 'receiver_phone',
|
||||||
|
receiver_address: 'receiver_address',
|
||||||
|
create_time: 'create_time',
|
||||||
|
update_time: 'update_time',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
37
web/src/lang/backend/zh-cn/mall/playxOrder.ts
Normal file
37
web/src/lang/backend/zh-cn/mall/playxOrder.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
user_id: '用户ID',
|
||||||
|
type: '类型',
|
||||||
|
'type BONUS': '红利(BONUS)',
|
||||||
|
'type PHYSICAL': '实物(PHYSICAL)',
|
||||||
|
'type WITHDRAW': '提现(WITHDRAW)',
|
||||||
|
status: '状态',
|
||||||
|
'status PENDING': '处理中(PENDING)',
|
||||||
|
'status COMPLETED': '已完成(COMPLETED)',
|
||||||
|
'status SHIPPED': '已发货(SHIPPED)',
|
||||||
|
'status REJECTED': '已驳回(REJECTED)',
|
||||||
|
mall_item_id: '商品ID',
|
||||||
|
mallitem__title: '商品标题',
|
||||||
|
points_cost: '消耗积分',
|
||||||
|
amount: '现金面值',
|
||||||
|
multiplier: '流水倍数',
|
||||||
|
external_transaction_id: '外部交易幂等键',
|
||||||
|
playx_transaction_id: 'PlayX流水号',
|
||||||
|
grant_status: '发放子状态',
|
||||||
|
'grant_status NOT_SENT': '未发送',
|
||||||
|
'grant_status SENT_PENDING': '已发送排队',
|
||||||
|
'grant_status ACCEPTED': '已接收(accepted)',
|
||||||
|
'grant_status FAILED_RETRYABLE': '失败可重试',
|
||||||
|
'grant_status FAILED_FINAL': '失败最终',
|
||||||
|
fail_reason: '失败原因',
|
||||||
|
reject_reason: '驳回原因',
|
||||||
|
shipping_company: '物流公司',
|
||||||
|
shipping_no: '物流单号',
|
||||||
|
receiver_name: '收货人',
|
||||||
|
receiver_phone: '收货电话',
|
||||||
|
receiver_address: '收货地址',
|
||||||
|
create_time: '创建时间',
|
||||||
|
update_time: '修改时间',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
|
|
||||||
240
web/src/views/backend/mall/playxOrder/index.vue
Normal file
240
web/src/views/backend/mall/playxOrder/index.vue
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('mall.playxOrder.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import createAxios from '/@/utils/axios'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'mall/playxOrder',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/mall.PlayxOrder/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('mall.playxOrder.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('mall.playxOrder.user_id'), prop: 'user_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{
|
||||||
|
label: t('mall.playxOrder.type'),
|
||||||
|
prop: 'type',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
BONUS: t('mall.playxOrder.type BONUS'),
|
||||||
|
PHYSICAL: t('mall.playxOrder.type PHYSICAL'),
|
||||||
|
WITHDRAW: t('mall.playxOrder.type WITHDRAW'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('mall.playxOrder.status'),
|
||||||
|
prop: 'status',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
PENDING: t('mall.playxOrder.status PENDING'),
|
||||||
|
COMPLETED: t('mall.playxOrder.status COMPLETED'),
|
||||||
|
SHIPPED: t('mall.playxOrder.status SHIPPED'),
|
||||||
|
REJECTED: t('mall.playxOrder.status REJECTED'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: t('mall.playxOrder.mall_item_id'), prop: 'mall_item_id', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.playxOrder.mallitem__title'), prop: 'mallItem.title', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.playxOrder.points_cost'), prop: 'points_cost', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ 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',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
NOT_SENT: t('mall.playxOrder.grant_status NOT_SENT'),
|
||||||
|
SENT_PENDING: t('mall.playxOrder.grant_status SENT_PENDING'),
|
||||||
|
ACCEPTED: t('mall.playxOrder.grant_status ACCEPTED'),
|
||||||
|
FAILED_RETRYABLE: t('mall.playxOrder.grant_status FAILED_RETRYABLE'),
|
||||||
|
FAILED_FINAL: t('mall.playxOrder.grant_status FAILED_FINAL'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('mall.playxOrder.fail_reason'),
|
||||||
|
prop: 'fail_reason',
|
||||||
|
align: 'center',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
operatorPlaceholder: t('Fuzzy query'),
|
||||||
|
sortable: false,
|
||||||
|
operator: 'LIKE',
|
||||||
|
},
|
||||||
|
{ label: t('mall.playxOrder.reject_reason'), prop: 'reject_reason', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.shipping_company'), prop: 'shipping_company', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.shipping_no'), prop: 'shipping_no', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.receiver_name'), prop: 'receiver_name', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.receiver_phone'), prop: 'receiver_phone', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.receiver_address'), prop: 'receiver_address', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.playxOrder.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('mall.playxOrder.update_time'), prop: 'update_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{
|
||||||
|
label: t('Operate'),
|
||||||
|
align: 'center',
|
||||||
|
width: 220,
|
||||||
|
render: 'buttons',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
render: 'confirmButton',
|
||||||
|
name: 'retry',
|
||||||
|
title: 'Retry',
|
||||||
|
text: '手动重试',
|
||||||
|
type: 'warning',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) =>
|
||||||
|
(row.type === 'BONUS' || row.type === 'WITHDRAW') && row.grant_status === 'FAILED_RETRYABLE' && row.status === 'PENDING',
|
||||||
|
popconfirm: {
|
||||||
|
title: '确认将该订单加入重试队列?',
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
confirmButtonType: 'warning',
|
||||||
|
},
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.PlayxOrder/retry',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
render: 'basicButton',
|
||||||
|
name: 'ship',
|
||||||
|
title: 'Ship',
|
||||||
|
text: '发货',
|
||||||
|
type: 'success',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) => row.type === 'PHYSICAL' && row.status === 'PENDING',
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
try {
|
||||||
|
const shippingNoRes = await ElMessageBox.prompt('请输入物流单号', '发货', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
const shippingCompanyRes = await ElMessageBox.prompt('请输入物流公司', '发货', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
|
||||||
|
const shippingNo = shippingNoRes.value
|
||||||
|
const shippingCompany = shippingCompanyRes.value
|
||||||
|
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.PlayxOrder/ship',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
shipping_company: shippingCompany,
|
||||||
|
shipping_no: shippingNo,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
} catch {
|
||||||
|
// 用户取消弹窗:不做任何提示,避免控制台报错
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
render: 'basicButton',
|
||||||
|
name: 'reject',
|
||||||
|
title: 'Reject',
|
||||||
|
text: '驳回',
|
||||||
|
type: 'danger',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) => row.type === 'PHYSICAL' && row.status === 'PENDING',
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
try {
|
||||||
|
const res = await ElMessageBox.prompt('请输入驳回原因', '驳回', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.PlayxOrder/reject',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
reject_reason: res.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
} catch {
|
||||||
|
// 用户取消:不提示
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user