Merge pull request '完成发货接口的开发' (#61) from Brunch_LPQ into main
commit
b3d05f8d65
@ -0,0 +1,9 @@
|
||||
package com.itmk.web.order.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SendParm {
|
||||
private Long orderId;
|
||||
}
|
@ -1,6 +1,11 @@
|
||||
import http from "../../http";
|
||||
import type { OrderListParm } from "./OrderModel";
|
||||
//列表
|
||||
export const gePcOrdertListApi = (parm:OrderListParm)=>{
|
||||
return http.get("/wxapi/order/getPcOrderList",parm)
|
||||
export const gePcOrdertListApi = (parm: OrderListParm) => {
|
||||
return http.get("/wxapi/order/getPcOrderList", parm)
|
||||
}
|
||||
|
||||
// 发货
|
||||
export const sendOrderApi = (orderId: string) => {
|
||||
return http.put("/wxapi/order/sendOrder", { orderId: orderId })
|
||||
}
|
@ -1,63 +1,77 @@
|
||||
import type { OrderListParm } from '../../api/order/OrderModel'
|
||||
import {nextTick, onMounted, reactive, ref} from 'vue'
|
||||
import { gePcOrdertListApi } from '../../api/order'
|
||||
export default function useOrderTable(){
|
||||
//表格高度
|
||||
const tableHeight = ref(0)
|
||||
//表格数据
|
||||
const tableList = ref([])
|
||||
//表格查询的参数
|
||||
const listParm = reactive<OrderListParm>({
|
||||
currentPage:1,
|
||||
pageSize:10,
|
||||
type:'',
|
||||
userName:'',
|
||||
total:0
|
||||
})
|
||||
//列表
|
||||
const getList = async()=>{
|
||||
let res = await gePcOrdertListApi(listParm)
|
||||
if(res && res.code == 200){
|
||||
//设置表格数据
|
||||
tableList.value = res.data.records;
|
||||
//设置分页总条数
|
||||
listParm.total = res.data.total;
|
||||
}
|
||||
}
|
||||
//搜索
|
||||
const searchBtn = ()=>{
|
||||
getList()
|
||||
}
|
||||
//重置
|
||||
const resetBtn = ()=>{
|
||||
listParm.currentPage = 1;
|
||||
listParm.type = ''
|
||||
getList()
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { gePcOrdertListApi, sendOrderApi } from '../../api/order'
|
||||
import useInstance from '@/hooks/useInstance'
|
||||
export default function useOrderTable() {
|
||||
const { global } = useInstance()
|
||||
//表格高度
|
||||
const tableHeight = ref(0)
|
||||
//表格数据
|
||||
const tableList = ref([])
|
||||
//表格查询的参数
|
||||
const listParm = reactive<OrderListParm>({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
type: '',
|
||||
userName: '',
|
||||
total: 0
|
||||
})
|
||||
//列表
|
||||
const getList = async () => {
|
||||
let res = await gePcOrdertListApi(listParm)
|
||||
if (res && res.code == 200) {
|
||||
//设置表格数据
|
||||
tableList.value = res.data.records;
|
||||
//设置分页总条数
|
||||
listParm.total = res.data.total;
|
||||
}
|
||||
//页容量改变触发
|
||||
const sizeChange = (size:number)=>{
|
||||
listParm.pageSize = size;
|
||||
}
|
||||
//搜索
|
||||
const searchBtn = () => {
|
||||
getList()
|
||||
}
|
||||
//重置
|
||||
const resetBtn = () => {
|
||||
listParm.currentPage = 1;
|
||||
listParm.type = ''
|
||||
getList()
|
||||
}
|
||||
//页容量改变触发
|
||||
const sizeChange = (size: number) => {
|
||||
listParm.pageSize = size;
|
||||
getList()
|
||||
}
|
||||
//页数改变触发
|
||||
const currentChange = (page: number) => {
|
||||
listParm.currentPage = page;
|
||||
getList()
|
||||
}
|
||||
// 发货
|
||||
const sendOrder = async (orderId: string) => {
|
||||
let confirm = await global.$myconfirm('确定发货吗?')
|
||||
if (confirm) {
|
||||
let res = await sendOrderApi(orderId)
|
||||
if (res && res.code == 200) {
|
||||
getList()
|
||||
}
|
||||
}
|
||||
//页数改变触发
|
||||
const currentChange = (page:number)=>{
|
||||
listParm.currentPage = page;
|
||||
getList()
|
||||
}
|
||||
onMounted(()=>{
|
||||
getList()
|
||||
nextTick(()=>{
|
||||
tableHeight.value = window.innerHeight - 220
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
nextTick(() => {
|
||||
tableHeight.value = window.innerHeight - 220
|
||||
})
|
||||
return{
|
||||
tableList,
|
||||
listParm,
|
||||
getList,
|
||||
searchBtn,
|
||||
resetBtn,
|
||||
sizeChange,
|
||||
currentChange,
|
||||
tableHeight
|
||||
}
|
||||
})
|
||||
return {
|
||||
tableList,
|
||||
sendOrder,
|
||||
listParm,
|
||||
getList,
|
||||
searchBtn,
|
||||
resetBtn,
|
||||
sizeChange,
|
||||
currentChange,
|
||||
tableHeight
|
||||
}
|
||||
}
|
Loading…
Reference in new issue