订单消费记录线上线下

This commit is contained in:
zzyuan 2025-03-18 16:12:25 +08:00
parent c76fb1a5ce
commit f7fcdb6453
4 changed files with 1329 additions and 209 deletions

View File

@ -152,3 +152,24 @@ export function writeOffOrderApi(data) {
})
}
// 订单-同步订单状态
export function syncOrderPayStateApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/sync-pay-state',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}

195
src/api/order/reserve.js Normal file
View File

@ -0,0 +1,195 @@
import request from '@/utils/request'
// 系统区域权限树
export function systemAreaTreeApi(data) {
return request({
url: '/smart-canteen/api/v2/alloc/area/system-auth/tree',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 通过区域Id查询食堂
export function getCanteenByAreaApi(data) {
return request({
url: '/smart-canteen/api/v2/alloc/canteen/list-all-auth-canteen',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 通过食堂Id查询档口
export function getStallByCanteenApi(data) {
return request({
url: '/smart-canteen/api/v2/alloc/canteen/list-multiple-auth-stall',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单类型
export function orderTypeListApi(data) {
return request({
url: '/smart-canteen/api/v2/order/enums/type-list',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 配送方式
export function deliveryTypeListApi(data) {
return request({
url: '/smart-canteen/api/v2/alloc/canteen/list-delivery-type-enum',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单状态
export function orderStateListApi(data) {
return request({
url: '/smart-canteen/api/v2/order/enums/state-mix-list',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单支付状态
export function orderPayAllTypeApi(data) {
return request({
url: '/smart-canteen/api/v2/pay/all/type',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 核身方式
export function orderNuclearModeListApi(data) {
return request({
url: '/smart-canteen/api/v2/order/enums/nuclear/mode-list',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 用户类型
export function queryPsnTypeByPageApi(data) {
return request({
url: '/smart-canteen/api/v1/cust/psntype/queryPsnTypeByPage',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 组织
export function custOrgTreeApi(data) {
return request({
url: '/smart-canteen/custOrg/tenant/tree',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 订单列表-分页
export function orderPageListApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/page/detail',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单详情
export function orderDetailInfoApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/info',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单-部分退款
export function refundOrderPartApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/part/refund',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单-退单
export function refundOrderApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/refund',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单-核销
export function writeOffOrderApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/write/off',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 订单-同步订单状态
export function syncOrderPayStateApi(data) {
return request({
url: '/smart-canteen/api/v2/web/order/sync-pay-state',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}

View File

@ -143,19 +143,32 @@
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="primary"
size="mini" :disabled="multiple"
@click="handleBatchRefund"
>批量退单</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
size="mini" :disabled="multiple"
@click="handleBatchWriteOff"
>批量核销</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col> -->
type="primary"
size="mini" :disabled="multiple"
@click="handleSyncPayState"
>同步订单状态</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
<el-table v-loading="loading" :data="tableListData" height="800" ref="multipleTable" :row-key="(row)=>{return row.orderId}" @selection-change="handleOrderSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
<el-table-column label="序号" align="center" width="80" type="index" fixed="left">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * 10 + scope.$index + 1}}</span>
@ -216,12 +229,12 @@
>详情</el-button>
<el-button
size="mini"
type="text" v-if="scope.row.orderStateMix==11"
type="text" v-if="scope.row.orderStateMix==1||scope.row.orderStateMix==11"
@click="handleRefundPart(scope.row)"
>部分退款</el-button>
<el-button
size="mini"
type="text" v-if="scope.row.orderStateMix==11"
type="text" v-if="scope.row.orderStateMix==1||scope.row.orderStateMix==11"
@click="handleRefund(scope.row)"
>退单</el-button>
<el-button
@ -492,12 +505,30 @@
<el-button @click="openPart=false"> </el-button>
</div>
</el-dialog>
<!-- 提醒对话框 -->
<el-dialog :title="handleType+'提醒'" :visible.sync="openRemind" width="40%" append-to-body>
<div class="remind-question">请问是否对以下可{{handleType}}订单进行{{handleType}}操作</div>
<div class="remind-title">{{handleType}}订单 {{ableList.length}} </div>
<div v-for="(item,index) in ableList" :key="item.orderId">{{ (index+1) }}. 订单编号:{{item.orderId}}用户姓名:{{item.custName}}用户编号:{{item.custNum}}订单金额:{{(item.payableAmount/100).toFixed(2)}}</div>
<div class="remind-title">不可{{handleType}}订单 {{unableList.length}} </div>
<div v-for="(item,index) in unableList" :key="item.orderId">{{ (index+1) }}. 订单编号:{{item.orderId}}用户姓名:{{item.custName}}:{{item.custNum}}订单金额:{{(item.payableAmount/100).toFixed(2)}}</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmRemind" :disabled="ableList.length==0"> </el-button>
<el-button @click="openRemind=false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi,orderStateListApi,orderPayAllTypeApi,queryPsnTypeByPageApi,orderNuclearModeListApi,custOrgTreeApi} from "@/api/order/offline";
import { orderPageListApi,orderDetailInfoApi,refundOrderPartApi,refundOrderApi,writeOffOrderApi } from "@/api/order/offline";
import { orderPageListApi,orderDetailInfoApi,refundOrderPartApi,refundOrderApi,writeOffOrderApi,syncOrderPayStateApi } from "@/api/order/offline";
export default {
name: "",
@ -551,10 +582,12 @@
treeAreaOptions:[],//
canteenOptions:[],//-
stallOptions:[],//-
//
orderStateOptions:[],
orderPayOptions:[],
nuclearModeOptions:[],
psnTypeOptions:[],
//
treeOrgOptions:[],
//
queryParams: {
@ -579,6 +612,7 @@
},
//
orderInfoData: {},
//退
openPart:false,
orderDetailList:[],
refundType:'1',
@ -593,6 +627,14 @@
}
]
},
//
batchIds:[],
batchList:[],//
//退
handleType:"退单",
ableList:[],
unableList:[],
openRemind:false,
};
},
@ -795,6 +837,96 @@
this.$modal.msgSuccess("核销成功");
}).catch(() => {});
},
// ----------
handleOrderSelectionChange(selection){
this.batchIds = selection.map((item) => item.orderId)
this.batchList = selection;
this.single = selection.length !== 1
this.multiple = !selection.length
},
//退
handleBatchRefund(){
this.handleType="退单"
this.ableList = []
this.unableList = []
this.batchList.forEach(item=>{
if(item.orderStateMix==1||item.orderStateMix==11){
this.ableList.push(item)
}else{
this.unableList.push(item)
}
})
this.openRemind = true
},
//
handleBatchWriteOff(){
this.handleType="核销"
this.ableList = []
this.unableList = []
this.batchList.forEach(item=>{
if(item.orderStateMix==1){
this.ableList.push(item)
}else{
this.unableList.push(item)
}
})
this.openRemind = true
},
confirmRemind(){
console.log(this.ableList.length)
if(this.ableList.length>0){
if(this.handleType=="退单"){
this.ableList.forEach(item=>{
let param = {
backType: 1,
macOrderId:item.macOrderId,
orderId:item.orderId
}
refundOrderApi(param).then(response => {
if(response.code!=200){
this.$modal.msgError(response.msg);
}
});
})
this.$modal.msgSuccess("退单成功");
}
if(this.handleType=="核销"){
this.ableList.forEach(item=>{
let param = {
orderId:item.orderId
}
writeOffOrderApi(param).then(response => {
if(response.code!=200){
this.$modal.msgError(response.msg);
}
});
})
this.$modal.msgSuccess("核销成功");
}
setTimeout(()=>{
this.getList()
this.$refs.multipleTable.clearSelection()
},1000)
}
},
//
handleSyncPayState(){
if(this.batchIds.length>0){
this.batchIds.forEach(item=>{
syncOrderPayStateApi({orderId:item}).then(response => {
if(response.code!=200){
this.$modal.msgError(response.msg);
}
});
})
this.$modal.msgSuccess("同步已完成");
this.getList()
this.$refs.multipleTable.clearSelection()
}else{
this.$modal.msgError("请先勾选订单数据!");
}
},
//
formatDate(date) {
// YYYY-MM-DD

File diff suppressed because it is too large Load Diff