Commit 5ec4f568 authored by daniel's avatar daniel

feat(gpsDeposit): gps订单列表完善

parent 554d5132
......@@ -121,7 +121,7 @@
@update:value="updateStatus" :value="query.status" animated pane-style="padding:0;">
<n-tab-pane
v-for="item in OrderStatusOptions"
v-for="item in tradeStatusOptions"
:name="item.value"
:tab="item.name+'('+item.total+')'"/>
</n-tabs>
......@@ -135,8 +135,8 @@
:tab="item.name+'('+item.total+')'"/>
</n-tabs>
</div>
<div class="ml-auto" v-if="!isSetting">
<n-input v-model:value="keyword" placeholder="请输入关键字进行搜索" :clearable="true" @change="fetchData" />
<div class="ml-auto" v-if="!isConfigTab">
<n-input v-model:value="query.markNo" placeholder="请输入参赛号" :clearable="true" @change="fetchOrders" />
</div>
</div>
<div class="w-full gap-x-2 flex flex-row items-center mt-3">
......@@ -168,10 +168,10 @@
</div>
</n-card>
<!-- 搜索框 -->
<n-data-table v-if="!isSetting" :columns="playersColumns" :loading="loading" :row-key="rowKey" :data="list" :pagination="pagination"
<n-data-table v-if="!isConfigTab" :columns="orderColumns" :loading="loading" :row-key="rowKey" :data="orders" :pagination="pagination"
:bordered="false"
:remote="true" @update:checked-row-keys="handleCheck"/>
<n-card v-show="isSetting" title="押金详情" :bordered="false" >
<n-card v-show="isConfigTab" title="押金详情" :bordered="false" >
<n-form
ref="depositFormRef"
:model="depositForm"
......@@ -221,7 +221,7 @@
content="是否确定开始随机分配?"
positive-text="确认"
negative-text="取消"
@positive-click="randomAssign"
@positive-click
/>
<n-modal
v-model:show="showBatchModal"
......@@ -375,19 +375,36 @@
// 增值
{ key: 'UN_PICKED', name: '未选', color: 'success', value: 0 },
])
// 自动与手动
const AutoEnum =
// 订单类型
const OrderTypeEnum =
new SuperEnum([
{ key: 'AUTO', name: '自动', color: 'warning', value: 1 },
{ key: 'GPS', name: 'GPS押金', color: 'info', value: 1 },
// 增值
{ key: 'MANUAL', name: '手动', color: 'success', value: 0 },
{ key: 'BUS', name: '班车票', color: 'success', value: 2 },
])
// 支付方式
const PayTypeEnum =
new SuperEnum([
{ key: 'ALIPAY', name: '支付宝支付', color: 'info', value: 1 },
// 增值
{ key: 'WECHAT', name: '微信支付', color: 'success', value: 2 },
])
// 订单状态 支付状态:0-待支付,1-支付成功,2-支付失败,3-部分退款,4-全额退款
const TradeStatusEnum =
new SuperEnum([
{ key: 'WAIT_PAY', name: '待支付', color: '', value: 0 },
// 增值
{ key: 'PAY_SUCCESS', name: '支付成功', color: 'success', value: 1 },
{ key: 'PAY_FAILED', name: '支付失败', color: 'error', value: 2 },
{ key: 'PART_REFUND', name: '部分退款', color: 'info', value: 3 },
{ key: 'FULL_REFUND', name: '全额退款', color: 'warning', value: 4 },
])
// tab类型
const TabEnum =
new SuperEnum([
{ key: 'SETTING', name: '押金配置', color: 'warning', value: 1 },
{ key: 'ORDER', name: '订单列表', color: 'success', value: 2 },
{ key: 'DEVICE', name: '设备列表', color: 'success', value: 3 },
{ key: 'SETTING', name: '押金配置', color: 'warning', value: 1 },
// { key: 'DEVICE', name: '设备列表', color: 'success', value: 3 },
])
</script>
<script>
......@@ -395,23 +412,18 @@
const { useMessage, useNotification, dateZhCN, NButton, NTag, zhCN, NSpace, NImageGroup, NImage, NText } = naive
// 添加全局 loading 指令
const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=' + 'gk/invoice' + '&cmptId=' + getCId()
const BASE_ECC_URL = "https://ecc.geexek.com"
// 人员列表
const PLAYERS_URL = BASE_ECC_URL + '/api-pick/v1/enroll-page'
const PLAYERS_EXPORT_URL = BASE_ECC_URL + '/api-pick/v1/export-markno-enroll?cmptId=' + getCId()
const PLAYERS_IMPORT_URL = BASE_ECC_URL + '/api-pick/v1/import-mark-enroll'
const PLAYERS_DOWNLOAD_URL = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E9%80%89%E5%8F%B7%E5%90%8D%E5%8D%95%E8%A1%A8%E6%A8%A1%E7%89%88v1.xlsx"
// 号码簿列表
const MARK_NO_URL = BASE_ECC_URL + '/api-pick/v1/mark-list'
const MARK_NO_EXPORT_URL = BASE_ECC_URL + '/api-pick/v1/export-markno-library-v1?cmptId=' + getCId()
const MARK_NO_IMPORT_URL = BASE_ECC_URL + '/api-pick/v1/import-mark-library'
const MARK_NO_DOWNLOAD_URL = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E5%8F%82%E8%B5%9B%E5%8F%B7%E5%85%A5%E5%BA%93%E6%A8%A1%E7%89%88v1.xlsx"
// const BASE_ECC_URL = "https://ecc.geexek.com"
const BASE_ECC_URL = "http://localhost:8081"
// 随机分配名单
const RANDOM_ASSIGN_URL = BASE_ECC_URL + '/api-pick/v1/pick-up-batch?cmptId=' + getCId()
// TODO 保存押金配置
const SAVE_DEPOSIT_URL = "http://localhost:8081/api-gps-config/v1/save"
const GET_DEPOSIT_URL = "http://localhost:8081/api-gps-config/v1//getByCmptId?cmptId=" + getCId()
// 保存GPS押金配置
const SAVE_DEPOSIT_URL = BASE_ECC_URL + "/api-gps-config/v1/save"
// 获取GPS押金
const GET_DEPOSIT_URL = BASE_ECC_URL + "/api-gps-config/v1/getByCmptId?cmptId=" + getCId()
// 获取订单
const GET_ORDER_PAGE_URL = BASE_ECC_URL + "/api-order/v1/order-list"
// 获取赛事信息
const GET_CMPT_URL = "https://timerbackend.geexek.com/getCmpt.do?cmptId=" + getCId()
const MyApp = defineComponent({
......@@ -421,13 +433,13 @@
const message = useMessage()
const notification = useNotification()
const loading = ref(false)
/***----------------选手名单相关 start -----------------*/
const tabIndex = ref(1)
const isSetting = computed(() => tabIndex.value === 1)
/***---------------- 订单相关 start -----------------*/
const tabIndex = ref(2)
const isConfigTab = computed(() => tabIndex.value === 1)
const PLAYER = "player"
const MARK_NO = "markNo"
// 状态统计
const OrderStatusOptions = ref([
const tradeStatusOptions = ref([
{
name: '全部',
value: '',
......@@ -440,22 +452,17 @@
},
{
name: '待支付',
value: 2,
value: 0,
total: 0
},
{
name: '已退款',
name: '全额退款',
value: 4,
total: 0
},
{
name: '退款中',
value: 4,
total: 0
},
{
name: '已关闭',
value: 5,
name: '部分退款',
value: 3,
total: 0
},
])
......@@ -499,56 +506,96 @@
// 勾选的行数据
const checkedRowKeys = ref([])
// 列表配置
const playersColumns = [
const orderColumns = [
{
type: 'selection',
},
{
title: '姓名',
key: 'name',
title: '订单号',
key: 'applyId',
width: 100,
},
{
title: '交易单号',
key: 'tradeNo',
width: 100,
},
{
title: '参赛号',
key: MARK_NO,
width: 100,
},
{
title: '状态',
key: 'tradeStatus',
width: 100,
render: (row) => {
// 两个按钮,一个 编辑 一个 删除
return h(NSpace, {
vertical: true
}, [
h(NTag, {
size: "small",
type: TradeStatusEnum[row.tradeStatus].color,
}, TradeStatusEnum[row.tradeStatus].name),
h(NTag, {
size: "small",
type: OrderTypeEnum[row.orderType].color,
}, OrderTypeEnum[row.orderType].name),
h(NTag, {
size: "small",
type: PayTypeEnum[row.payType].color,
}, PayTypeEnum[row.orderType].name),
])
}
},
{
title: '手机号',
key: 'phone',
title: '交易金额',
key: 'amount',
align: 'center',
},
{
title: '证件号',
key: 'identityNo',
title: '创建时间',
key: 'createTime',
align: 'center',
width: 100,
},
{
title: '更新时间',
key: 'updateTime',
align: 'center',
width: 100,
},
{
title: '操作',
key: 'action',
width: 200,
fixed: 'right',
align: 'center',
render: (row) => {
// 两个按钮,一个 编辑 一个 删除
return h(NSpace, {}, [
h(NButton, {
row.tradeStatus === TradeStatusEnum.PAY_SUCCESS.value && h(NButton, {
type: 'error',
size: 'small',
onClick: async () => {
}
}, '发放'),
h(NButton, {
type: 'primary',
size: 'small',
onClick: () => {
}
}, '归还'),
h(NButton, {
type: 'primary',
size: 'small',
onClick: async () => {
}
}, '退款'),
// h(NButton, {
// type: 'primary',
// size: 'small',
// onClick: () => {
// }
// }, '归还'),
// h(NButton, {
// type: 'primary',
// size: 'small',
// onClick: async () => {
// }
// }, '退款'),
])
}
......@@ -565,34 +612,25 @@
prefix: (info) => "共" + info.itemCount + "条数据",
onChange: (page) => {
pagination.page = page
fetchData()
fetchOrders()
},
onUpdatePageSize: (pageSize) => {
pagination.pageSize = pageSize
pagination.page = 1
fetchData()
fetchOrders()
}
})
// 查询的参数
const query = reactive({
keyword: undefined,
isPickUp: 1,
markNo: undefined,
tradeStatus: undefined,
})
const keyword = ref('')
// 删除自助选号
const showModal = ref(false)
const showBatchModal = ref(false)
// 名单列表
const list = ref([])
// 订单列表
const orders = ref([])
/***----------------订单列表 start -----------------*/
function handleCheck(rowKeys) {
checkedRowKeys.value = rowKeys
}
function rowKey(row) {
return row.markNo
}
/***----------------订单列表 end -----------------*/
/***----------------押金配置 start -----------------*/
// ref 押金表单
......@@ -616,58 +654,44 @@
message: '请输入押金金额',
},
}
/***----------------押金配置 end -----------------*/
/***----------------订单列表 start -----------------*/
function handleCheck(rowKeys) {
checkedRowKeys.value = rowKeys
}
function rowKey(row) {
return row.markNo
}
// 状态更新
const updateStatus = (value) => {
pagination.page = 1
query.isPickUp = value
fetchData()
query.tradeStatus = value
fetchOrders()
}
// 状态tab
const updateTab = (value) => {
tabIndex.value = value
fetchData()
}
// 上传完成
const uploadFinish = ({
file,
event
}) => {
const response = JSON.parse(event?.target?.response)
file.url = response.content
return file
}
// 重置form数据
const resetForm = () => {
Object.assign(formData, {
id: null,
remarks: null,
name: "",
markNo: "",
phone: "",
area: "",
province: "",
city: "",
location: "",
deliveryNo: "",
expressCompany: "",
status: StatusEnum.SUBMIT.value,
remark: ""
})
if (value === TabEnum.ORDER.value) {
fetchOrders()
getOrderStats()
} else {
getDeposit()
}
// 全部状态下不获取统计
// getOrderStats()
}
// 获取自助选号分页列表
const fetchData = async () => {
list.value = []
const fetchOrders = async () => {
orders.value = []
loading.value = true
let params = {
...query,
current: pagination.page,
size: pagination.pageSize,
cmptId: getCId(),
keyword: keyword.value,
}
// 发起请求
const [err, res] = await to(fetch(PLAYERS_URL, {
const [err, res] = await to(fetch(GET_ORDER_PAGE_URL, {
method: "POST",
headers: {
'Content-Type': 'application/json'
......@@ -680,51 +704,29 @@
return
}
if (res.code === 200) {
list.value = res.data.records
orders.value = res.data.records
pagination.itemCount = res.data.total
// // 全部状态下不获取统计
getStats()
} else {
message.error(res.message)
}
}
// 随机分配名单
const randomAssign = async () => {
loading.value = true
const [err, res] = await to(fetch(RANDOM_ASSIGN_URL, {
method: "GET",
headers: {
'Content-Type': 'application/json'
}
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
}
if (res.code === 200) {
message.success('随机分配成功')
fetchData()
} else {
message.error(res.message)
}
}
// 获取统计 用fetch改造
const getStats = async () => {
const getOrderStats = async () => {
loading.value = true
let params = {
page: 1,
size: 1,
cmptId: getCId(),
}
let paramsList = [1, 0].map(v => ({
let paramsList = tradeStatusOptions.value.map(v => ({
...params,
isPickUp: v,
tradeStatus: v.value,
}))
const requests = paramsList.map(v => {
// 发起请求
const url = isSetting.value ? PLAYERS_URL : MARK_NO_URL
return fetch(url, {
return fetch(GET_ORDER_PAGE_URL, {
method: "POST",
headers: {
'Content-Type': 'application/json'
......@@ -734,50 +736,17 @@
})
const res = await Promise.all(requests)
loading.value = false
if (isSetting.value) {
OrderStatusOptions.value[1].total = res[0].data.total
OrderStatusOptions.value[2].total = res[1].data.total
} else {
OrderStatusOptions.value[1].total = res[0].data.total
OrderStatusOptions.value[2].total = res[1].data.total
}
OrderStatusOptions.value[0].total = OrderStatusOptions.value[2].total + OrderStatusOptions.value[1].total
}
// 名单导出
const exportExcel = (type) => {
const url = type === PLAYER ? PLAYERS_EXPORT_URL : MARK_NO_EXPORT_URL
window.location.href = url
}
tradeStatusOptions.value[0].total = res[0].data.total
tradeStatusOptions.value[1].total = res[1].data.total
tradeStatusOptions.value[2].total = res[2].data.total
tradeStatusOptions.value[3].total = res[3].data.total
tradeStatusOptions.value[4].total = res[4].data.total
// 文件上传成功
const onChange = async (fileEvent, type) => {
loading.value = true
const formData = new FormData();
formData.append('file', fileEvent.file.file);
formData.append('cmptId', getCId());
const url = type === PLAYER ? PLAYERS_IMPORT_URL : MARK_NO_IMPORT_URL
const [err, res] = await to(fetch(url, {
method: "POST",
body: formData
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
}
fileList.value = []
if (res.code === 200) {
message.success('导入成功')
fetchData()
} else {
message.error(res.message)
}
}
// 导出
const download = (type) => {
const url = type === PLAYER ? PLAYERS_DOWNLOAD_URL : MARK_NO_DOWNLOAD_URL
window.location.href = url
}
// 富文本编辑器 .setContent() .getContent()
let editor;
/***---------------- 自助选号相关 end -----------------*/
......@@ -805,7 +774,7 @@
}
if (res.code === 200) {
message.success('保存成功')
fetchData()
fetchOrders()
getDeposit()
} else {
message.error(res.message)
......@@ -874,51 +843,49 @@
/***---------------- 押金交互相关 end -----------------*/
onMounted(() => {
fetchData()
getDeposit()
// getDeposit()
fetchOrders()
getOrderStats()
getCmptInfo()
editor = UE.getEditor('rich-text-container');
})
return {
// 自助选号相关
updateStatus,
// 公共
tabIndex,
loading,
StatusEnum,
TabEnum,
OrderTypeEnum,
TradeStatusEnum,
PayTypeEnum,
updateTab,
list,
// 订单相关
tradeStatusOptions,
orders,
query,
pagination,
playersColumns,
isSetting,
orderColumns,
isConfigTab,
showModal,
showBatchModal,
handleCheck,
checkedRowKeys,
// 文件相关
keyword,
fetchData,
tabIndex,
randomAssign,
// 公共数据
loading,
StatusEnum,
TabEnum,
OrderStatusOptions,
fetchOrders,
updateStatus,
handleCheck,
// gps 相关
GpsStatusOptions,
// 名单导出
exportExcel,
download,
uploadFinish,
onChange,
PLAYER,
MARK_NO,
// 押金相关
depositForm,
depositRules,
roadOptions,
depositFormRef,
saveDeposit,
getDeposit,
batchRefund,
depositFormRef,
}
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment