feat:新增订单下载列表删除,下载,查询接口联调

This commit is contained in:
Apple 2023-01-04 11:20:31 +08:00
parent 20932d07dd
commit 2edb5a4296
4 changed files with 89 additions and 64 deletions

View File

@ -416,7 +416,6 @@ module.exports = function (webpackEnv) {
} }
] ]
], ],
plugins: [ plugins: [
[ [
require.resolve('babel-plugin-named-asset-import'), require.resolve('babel-plugin-named-asset-import'),
@ -698,7 +697,6 @@ module.exports = function (webpackEnv) {
const entrypointFiles = entrypoints.main.filter( const entrypointFiles = entrypoints.main.filter(
(fileName) => !fileName.endsWith('.map') (fileName) => !fileName.endsWith('.map')
) )
return { return {
files: manifestFiles, files: manifestFiles,
entrypoints: entrypointFiles entrypoints: entrypointFiles

View File

@ -4,6 +4,7 @@ import { Notify } from "zent"
// const Version = "v1.3.0"; // const Version = "v1.3.0";
// window.baseurl = 'http://pre.marketapi.1688sup.com' // window.baseurl = 'http://pre.marketapi.1688sup.com'
let baseurl = "" let baseurl = ""
let download_url='http://192.168.6.193:8091'
if (process.env.NODE_ENV == "test" || process.env.NODE_ENV == "development") { if (process.env.NODE_ENV == "test" || process.env.NODE_ENV == "development") {
// 测试环境 // 测试环境
baseurl = "http://192.168.6.75" baseurl = "http://192.168.6.75"
@ -441,7 +442,7 @@ export const getOrderDetails = (id) => {
} }
//订单导出 //订单导出
export const getOrderExport = (params) => { export const getOrderExport = (params) => {
return derive("get", baseurl + "/order/export", params) return req("get", baseurl + "/order/export", params)
} }
//订单改为成功 //订单改为成功
export const putOrderSuccess = (id) => { export const putOrderSuccess = (id) => {
@ -969,4 +970,21 @@ export const handlerRefund = (orderNumber, data) => {
return req("put", baseurl + `/order/hand_refund/${orderNumber}`, data) return req("put", baseurl + `/order/hand_refund/${orderNumber}`, data)
} }
//订单管理-导出订单
// export const batchSend = (data) => {
// return req("post", baseurl + `/keys/batchSend`, data)
// }
//订单下载列表-列表
export const getdownloadList = (id) => {
return req("get", download_url + `/export/excel/marketOrder/record`)
}
//订单下载列表-数据下载
export const exportDownload = (md5) => {
return derive("get", download_url + `/export/excel/marketOrder/download/${md5}`)
}
//订单下载列表-记录删除
export const deleteDownload = (md5) => {
return req("get", download_url + `/export/excel/marketOrder/delete/${md5}`)
}
export { req } export { req }

View File

@ -1,24 +1,26 @@
import React from "react" import React from "react"
import { import {
Sweetalert, Sweetalert,
Progress Progress,
Notify
} from "zent" } from "zent"
import "@/assets/comm.css" import "@/assets/comm.css"
import Ipt from "@/components/input/main" import Ipt from "@/components/input/main"
import Grid from "@/components/gird/main.js" import Grid from "@/components/gird/main.js"
import TabPage from "@/components/tabPage/main.js" import TabPage from "@/components/tabPage/main.js"
import {getdownloadList,exportDownload,deleteDownload,handelResponse} from "@/assets/api.js"
const Column=[ const Column=[
{ {
title: '订单文件名称', title: '订单文件名称',
name: 'name', name: 'file_name',
prop:'name', prop:'file_name',
type: "normal", type: "normal",
width:'40%' width:'50%'
}, { }, {
title: '生成进度条', title: '生成进度条',
prop:'progress', prop:'progress',
name: 'progress', name: 'progress',
width:'40%', width:'30%',
type: "slot", type: "slot",
}, { }, {
title: '操作', title: '操作',
@ -34,31 +36,7 @@ export default class downloadlist extends React.Component {
super(props) super(props)
this.state = { this.state = {
tabList: [{ title: "订单下载列表" }], tabList: [{ title: "订单下载列表" }],
orderList: [{ orderList: [],
name:'yxxt2022-12-29 17:43:55',
progress:'50',
status:1
},{
name:'yxxt2022-12-29 17:43:55',
progress:'80',
status:3
},{
name:'yxxt2022-12-29 17:43:55',
progress:'100',
status:2
},{
name:'yxxt2022-12-29 17:43:55',
progress:'50',
status:1
},{
name:'yxxt2022-12-29 17:43:55',
progress:'80',
status:3
},{
name:'yxxt2022-12-29 17:43:55',
progress:'100',
status:2
}],
tableHeight: 500, tableHeight: 500,
page: 1, page: 1,
limit: 10, limit: 10,
@ -69,18 +47,27 @@ export default class downloadlist extends React.Component {
componentWillMount() { componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 }) this.setState({ tableHeight: window.innerHeight - 430 })
} }
componentDidMount(){
this.getDownloadList();
}
//删除 //删除
deleteFn(e, row) { deleteFn(e, row) {
let self = this
Sweetalert.confirm({ Sweetalert.confirm({
type: "warning", type: "warning",
closeBtn: true, closeBtn: true,
title: "确认操作", title: "确认操作",
content: ( content: (
<p>是否删除<b>[{row.name}]</b></p> <p>是否删除<b>[{row.file_name}]</b></p>
), ),
onConfirm() { onConfirm() {
console.log('删除'); deleteDownload(row.filter_md5).then(res=>{
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success(msg);
},(err)=>{
Notify.error(err)
})
}).catch()
}, },
onCancel() {}, onCancel() {},
className: "questModal", className: "questModal",
@ -99,8 +86,44 @@ export default class downloadlist extends React.Component {
sureFn() { sureFn() {
this.setState({ page: 1 }) this.setState({ page: 1 })
} }
exportFn(){ exportFn(e,rowData){
exportDownload(rowData.filter_md5)
.then((res) => {
if (res.type == "application/json") {
const reader = new FileReader() //创建一个FileReader实例
reader.readAsText(res, "utf-8") //读取文件,结果用字符串形式表示
reader.onload = function () {
const obj = JSON.parse(reader.result)
Notify.clear()
Notify.error(obj.message)
}
} else {
let bl = new Blob([res])
let fileName = rowData.file_name+ ".zip" //设置文件名
var link = document.createElement("a") //创建<a>标签
link.href = window.URL.createObjectURL(bl)
link.download = fileName //下载的文件名
link.click()
window.URL.revokeObjectURL(link.href) //清除URL
}
})
.catch(err => {})
}
getDownloadList(){
let {page,limit}=this.state;
let data={
page,
limit
}
getdownloadList().then(res=>{
handelResponse(res,(response,msg)=>{
this.setState({total:response.total,orderList:response.data});
},(err)=>{
Notify.error(err)
})
}
).catch(err=>{});
} }
statuStyle(val){ statuStyle(val){
let result; let result;
@ -115,10 +138,6 @@ export default class downloadlist extends React.Component {
} }
return result; return result;
} }
componentWillMount() {
}
//过滤表格枚举状态 //过滤表格枚举状态
render() { render() {
return ( return (
@ -164,12 +183,12 @@ export default class downloadlist extends React.Component {
ComponentHandler={(com, rowData) => { ComponentHandler={(com, rowData) => {
if(com == "progress") if(com == "progress")
{ {
return <Progress percent={rowData.progress} status={this.statuStyle(rowData.progress)} width={180} strokeWidth={5} strokeLinecap={'round'}/> return <Progress percent={rowData.process} status={this.statuStyle(rowData.process)} width={180} strokeWidth={5} strokeLinecap={'round'}/>
} }
if(com == "operation") if(com == "operation")
{ {
return <p> return <p>
<span className={rowData.status!=2?'grid-link disabled':'grid-link'} onClick={(e)=>this.exportFn(e,rowData)}>下载</span> <span className={rowData.status!=3?'grid-link disabled':'grid-link'} onClick={(e)=>this.exportFn(e,rowData)}>下载</span>
<span className={rowData.status==1?'grid-link ml15 disabled':'ml15 grid-link'} onClick={(e)=>this.deleteFn(e,rowData)}>删除</span> <span className={rowData.status==1?'grid-link ml15 disabled':'ml15 grid-link'} onClick={(e)=>this.deleteFn(e,rowData)}>删除</span>
</p> </p>
} }

View File

@ -220,27 +220,17 @@ export default class orderlist extends React.Component {
title: "确认操作", title: "确认操作",
content: <p>是否导出订单</p>, content: <p>是否导出订单</p>,
onConfirm() { onConfirm() {
getOrderExport(data) getOrderExport(data).then((res) => {
.then((res) => { handelResponse(res,(response,msg)=>{
if (res.type == "application/json") { Notify.clear();
const reader = new FileReader() //创建一个FileReader实例 Notify.success(msg);
reader.readAsText(res, "utf-8") //读取文件,结果用字符串形式表示 },(err)=>{
reader.onload = function () { Notify.error(err)
const obj = JSON.parse(reader.result) })
Notify.clear() })
Notify.error(obj.message) .catch((err) => {
} Notify.error(err.message);
} else {
let bl = new Blob([res])
let fileName = "订单管理" + _self.getnow() + ".xlsx" //设置文件名
var link = document.createElement("a") //创建<a>标签
link.href = window.URL.createObjectURL(bl)
link.download = fileName //下载的文件名
link.click()
window.URL.revokeObjectURL(link.href) //清除URL
}
}) })
.catch((err) => {})
}, },
onCancel() {}, onCancel() {},