Commit 5ec4f568 authored by daniel's avatar daniel

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

parent 554d5132
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
@update:value="updateStatus" :value="query.status" animated pane-style="padding:0;"> @update:value="updateStatus" :value="query.status" animated pane-style="padding:0;">
<n-tab-pane <n-tab-pane
v-for="item in OrderStatusOptions" v-for="item in tradeStatusOptions"
:name="item.value" :name="item.value"
:tab="item.name+'('+item.total+')'"/> :tab="item.name+'('+item.total+')'"/>
</n-tabs> </n-tabs>
...@@ -135,8 +135,8 @@ ...@@ -135,8 +135,8 @@
:tab="item.name+'('+item.total+')'"/> :tab="item.name+'('+item.total+')'"/>
</n-tabs> </n-tabs>
</div> </div>
<div class="ml-auto" v-if="!isSetting"> <div class="ml-auto" v-if="!isConfigTab">
<n-input v-model:value="keyword" placeholder="请输入关键字进行搜索" :clearable="true" @change="fetchData" /> <n-input v-model:value="query.markNo" placeholder="请输入参赛号" :clearable="true" @change="fetchOrders" />
</div> </div>
</div> </div>
<div class="w-full gap-x-2 flex flex-row items-center mt-3"> <div class="w-full gap-x-2 flex flex-row items-center mt-3">
...@@ -168,10 +168,10 @@ ...@@ -168,10 +168,10 @@
</div> </div>
</n-card> </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" :bordered="false"
:remote="true" @update:checked-row-keys="handleCheck"/> :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 <n-form
ref="depositFormRef" ref="depositFormRef"
:model="depositForm" :model="depositForm"
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
content="是否确定开始随机分配?" content="是否确定开始随机分配?"
positive-text="确认" positive-text="确认"
negative-text="取消" negative-text="取消"
@positive-click="randomAssign" @positive-click
/> />
<n-modal <n-modal
v-model:show="showBatchModal" v-model:show="showBatchModal"
...@@ -375,19 +375,36 @@ ...@@ -375,19 +375,36 @@
// 增值 // 增值
{ key: 'UN_PICKED', name: '未选', color: 'success', value: 0 }, { key: 'UN_PICKED', name: '未选', color: 'success', value: 0 },
]) ])
// 自动与手动 // 订单类型
const AutoEnum = const OrderTypeEnum =
new SuperEnum([ 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类型 // tab类型
const TabEnum = const TabEnum =
new SuperEnum([ new SuperEnum([
{ key: 'SETTING', name: '押金配置', color: 'warning', value: 1 },
{ key: 'ORDER', name: '订单列表', color: 'success', value: 2 }, { 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>
<script> <script>
...@@ -395,23 +412,18 @@ ...@@ -395,23 +412,18 @@
const { useMessage, useNotification, dateZhCN, NButton, NTag, zhCN, NSpace, NImageGroup, NImage, NText } = naive const { useMessage, useNotification, dateZhCN, NButton, NTag, zhCN, NSpace, NImageGroup, NImage, NText } = naive
// 添加全局 loading 指令 // 添加全局 loading 指令
const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=' + 'gk/invoice' + '&cmptId=' + getCId() const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=' + 'gk/invoice' + '&cmptId=' + getCId()
const BASE_ECC_URL = "https://ecc.geexek.com" // const BASE_ECC_URL = "https://ecc.geexek.com"
// 人员列表 const BASE_ECC_URL = "http://localhost:8081"
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 RANDOM_ASSIGN_URL = BASE_ECC_URL + '/api-pick/v1/pick-up-batch?cmptId=' + getCId() const RANDOM_ASSIGN_URL = BASE_ECC_URL + '/api-pick/v1/pick-up-batch?cmptId=' + getCId()
// TODO 保存押金配置 // 保存GPS押金配置
const SAVE_DEPOSIT_URL = "http://localhost:8081/api-gps-config/v1/save" const SAVE_DEPOSIT_URL = BASE_ECC_URL + "/api-gps-config/v1/save"
const GET_DEPOSIT_URL = "http://localhost:8081/api-gps-config/v1//getByCmptId?cmptId=" + getCId() // 获取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 GET_CMPT_URL = "https://timerbackend.geexek.com/getCmpt.do?cmptId=" + getCId()
const MyApp = defineComponent({ const MyApp = defineComponent({
...@@ -421,13 +433,13 @@ ...@@ -421,13 +433,13 @@
const message = useMessage() const message = useMessage()
const notification = useNotification() const notification = useNotification()
const loading = ref(false) const loading = ref(false)
/***----------------选手名单相关 start -----------------*/ /***---------------- 订单相关 start -----------------*/
const tabIndex = ref(1) const tabIndex = ref(2)
const isSetting = computed(() => tabIndex.value === 1) const isConfigTab = computed(() => tabIndex.value === 1)
const PLAYER = "player" const PLAYER = "player"
const MARK_NO = "markNo" const MARK_NO = "markNo"
// 状态统计 // 状态统计
const OrderStatusOptions = ref([ const tradeStatusOptions = ref([
{ {
name: '全部', name: '全部',
value: '', value: '',
...@@ -440,22 +452,17 @@ ...@@ -440,22 +452,17 @@
}, },
{ {
name: '待支付', name: '待支付',
value: 2, value: 0,
total: 0 total: 0
}, },
{ {
name: '已退款', name: '全额退款',
value: 4, value: 4,
total: 0 total: 0
}, },
{ {
name: '退款中', name: '部分退款',
value: 4, value: 3,
total: 0
},
{
name: '已关闭',
value: 5,
total: 0 total: 0
}, },
]) ])
...@@ -499,56 +506,96 @@ ...@@ -499,56 +506,96 @@
// 勾选的行数据 // 勾选的行数据
const checkedRowKeys = ref([]) const checkedRowKeys = ref([])
// 列表配置 // 列表配置
const playersColumns = [ const orderColumns = [
{ {
type: 'selection', type: 'selection',
}, },
{ {
title: '姓名', title: '订单号',
key: 'name', key: 'applyId',
width: 100,
},
{
title: '交易单号',
key: 'tradeNo',
width: 100,
}, },
{ {
title: '参赛号', title: '参赛号',
key: MARK_NO, 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: '手机号', title: '交易金额',
key: 'phone', key: 'amount',
align: 'center',
}, },
{ {
title: '证件号', title: '创建时间',
key: 'identityNo', key: 'createTime',
align: 'center',
width: 100,
},
{
title: '更新时间',
key: 'updateTime',
align: 'center',
width: 100,
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 200,
fixed: 'right', fixed: 'right',
align: 'center', align: 'center',
render: (row) => { render: (row) => {
// 两个按钮,一个 编辑 一个 删除 // 两个按钮,一个 编辑 一个 删除
return h(NSpace, {}, [ return h(NSpace, {}, [
h(NButton, { row.tradeStatus === TradeStatusEnum.PAY_SUCCESS.value && h(NButton, {
type: 'error', type: 'error',
size: 'small', size: 'small',
onClick: async () => { 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 @@ ...@@ -565,34 +612,25 @@
prefix: (info) => "共" + info.itemCount + "条数据", prefix: (info) => "共" + info.itemCount + "条数据",
onChange: (page) => { onChange: (page) => {
pagination.page = page pagination.page = page
fetchData() fetchOrders()
}, },
onUpdatePageSize: (pageSize) => { onUpdatePageSize: (pageSize) => {
pagination.pageSize = pageSize pagination.pageSize = pageSize
pagination.page = 1 pagination.page = 1
fetchData() fetchOrders()
} }
}) })
// 查询的参数 // 查询的参数
const query = reactive({ const query = reactive({
keyword: undefined,
isPickUp: 1,
markNo: undefined, markNo: undefined,
tradeStatus: undefined,
}) })
const keyword = ref('')
// 删除自助选号 // 删除自助选号
const showModal = ref(false) const showModal = ref(false)
const showBatchModal = 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 -----------------*/ /***----------------订单列表 end -----------------*/
/***----------------押金配置 start -----------------*/ /***----------------押金配置 start -----------------*/
// ref 押金表单 // ref 押金表单
...@@ -616,58 +654,44 @@ ...@@ -616,58 +654,44 @@
message: '请输入押金金额', message: '请输入押金金额',
}, },
} }
/***----------------押金配置 end -----------------*/
/***----------------订单列表 start -----------------*/
function handleCheck(rowKeys) {
checkedRowKeys.value = rowKeys
}
function rowKey(row) {
return row.markNo
}
// 状态更新 // 状态更新
const updateStatus = (value) => { const updateStatus = (value) => {
pagination.page = 1 pagination.page = 1
query.isPickUp = value query.tradeStatus = value
fetchData() fetchOrders()
} }
// 状态tab // 状态tab
const updateTab = (value) => { const updateTab = (value) => {
tabIndex.value = value tabIndex.value = value
fetchData() if (value === TabEnum.ORDER.value) {
} fetchOrders()
// 上传完成 getOrderStats()
const uploadFinish = ({ } else {
file, getDeposit()
event }
}) => { // 全部状态下不获取统计
const response = JSON.parse(event?.target?.response) // getOrderStats()
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: ""
})
} }
// 获取自助选号分页列表 // 获取自助选号分页列表
const fetchData = async () => { const fetchOrders = async () => {
list.value = [] orders.value = []
loading.value = true loading.value = true
let params = { let params = {
...query, ...query,
current: pagination.page, current: pagination.page,
size: pagination.pageSize, size: pagination.pageSize,
cmptId: getCId(), 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", method: "POST",
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -680,51 +704,29 @@ ...@@ -680,51 +704,29 @@
return return
} }
if (res.code === 200) { if (res.code === 200) {
list.value = res.data.records orders.value = res.data.records
pagination.itemCount = res.data.total 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 { } else {
message.error(res.message) message.error(res.message)
} }
} }
// 获取统计 用fetch改造 // 获取统计 用fetch改造
const getStats = async () => { const getOrderStats = async () => {
loading.value = true loading.value = true
let params = { let params = {
page: 1, page: 1,
size: 1, size: 1,
cmptId: getCId(), cmptId: getCId(),
} }
let paramsList = [1, 0].map(v => ({ let paramsList = tradeStatusOptions.value.map(v => ({
...params, ...params,
isPickUp: v, tradeStatus: v.value,
})) }))
const requests = paramsList.map(v => { const requests = paramsList.map(v => {
// 发起请求 // 发起请求
const url = isSetting.value ? PLAYERS_URL : MARK_NO_URL return fetch(GET_ORDER_PAGE_URL, {
return fetch(url, {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -734,50 +736,17 @@ ...@@ -734,50 +736,17 @@
}) })
const res = await Promise.all(requests) const res = await Promise.all(requests)
loading.value = false loading.value = false
if (isSetting.value) { tradeStatusOptions.value[0].total = res[0].data.total
OrderStatusOptions.value[1].total = res[0].data.total tradeStatusOptions.value[1].total = res[1].data.total
OrderStatusOptions.value[2].total = res[1].data.total tradeStatusOptions.value[2].total = res[2].data.total
} else { tradeStatusOptions.value[3].total = res[3].data.total
OrderStatusOptions.value[1].total = res[0].data.total tradeStatusOptions.value[4].total = res[4].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
}
// 文件上传成功
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() // 富文本编辑器 .setContent() .getContent()
let editor; let editor;
/***---------------- 自助选号相关 end -----------------*/ /***---------------- 自助选号相关 end -----------------*/
...@@ -805,7 +774,7 @@ ...@@ -805,7 +774,7 @@
} }
if (res.code === 200) { if (res.code === 200) {
message.success('保存成功') message.success('保存成功')
fetchData() fetchOrders()
getDeposit() getDeposit()
} else { } else {
message.error(res.message) message.error(res.message)
...@@ -874,51 +843,49 @@ ...@@ -874,51 +843,49 @@
/***---------------- 押金交互相关 end -----------------*/ /***---------------- 押金交互相关 end -----------------*/
onMounted(() => { onMounted(() => {
fetchData() // getDeposit()
getDeposit() fetchOrders()
getOrderStats()
getCmptInfo() getCmptInfo()
editor = UE.getEditor('rich-text-container'); editor = UE.getEditor('rich-text-container');
}) })
return { return {
// 自助选号相关 // 公共
updateStatus, tabIndex,
loading,
StatusEnum,
TabEnum,
OrderTypeEnum,
TradeStatusEnum,
PayTypeEnum,
updateTab, updateTab,
list, // 订单相关
tradeStatusOptions,
orders,
query, query,
pagination, pagination,
playersColumns, orderColumns,
isSetting, isConfigTab,
showModal, showModal,
showBatchModal, showBatchModal,
handleCheck,
checkedRowKeys, checkedRowKeys,
// 文件相关 fetchOrders,
keyword, updateStatus,
fetchData, handleCheck,
tabIndex, // gps 相关
randomAssign,
// 公共数据
loading,
StatusEnum,
TabEnum,
OrderStatusOptions,
GpsStatusOptions, GpsStatusOptions,
// 名单导出
exportExcel,
download,
uploadFinish,
onChange,
PLAYER, PLAYER,
MARK_NO, MARK_NO,
// 押金相关 // 押金相关
depositForm, depositForm,
depositRules, depositRules,
roadOptions, roadOptions,
depositFormRef,
saveDeposit, saveDeposit,
getDeposit, getDeposit,
batchRefund, 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