import React from "react";
import $ from "jquery/src/ajax";
import "./public.less";
import "./shouKuan.less";
import { AutoComplete, Button, Input, Spin, Table, Select, message, Tabs, Tag, Tooltip, Modal } from "antd";
import OrderDesc from "../orderDetail/orderDesc";
import { ChooseList } from "../../order/orderNew/chooseList"
import ReactToPrint from "react-to-print";
import OrderItemStatus from "../../../common/orderItemStatus";
import { salesList } from "@/dataDic.js";
import ShowModalDiv from "@/showModal.jsx";
import VipLogs from "../../../common/logPopup/viplogs";//会员日志
import { splitUrl, getApprovalTag } from "@/tools";
import ImgList from "../../../common/imgList";
import Cascaders from "../../../common/cascaders";
const { TabPane } = Tabs;
//财务专员会员项目审核
const ProjectVip = React.createClass({
//
getInitialState() {
return {
dvisible: false,
pageNo: 1,
totalPage: 0,
searchValues: {
status: "1"
},//查询条件
loading: false,
changeList: undefined,// 子组件改变的表格title数组
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.setState({
pageNo: page,
});
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return "共" + total + "条数据";
},
},
columns: [
{
title: "销售类型",
dataIndex: "salesType",
key: "salesType",
render: (text, record) => {
return (
{salesList[text]}
);
},
},
{
title: "合同编号",
dataIndex: "contractNo",
key: "contractNo",
width: 160,
render: (text, record) => {
return (
{
e.stopPropagation();
let input = document.getElementById("copyText");
input.value = text;
input.select();
document.execCommand("copy");
message.success("复制成功");
}}
>
复制
}
>
{text}
{getApprovalTag(record.approval)}
);
},
},
{
title: "客户名称",
dataIndex: "userName",
key: "userName",
width: 160,
render: text => {
return (
{text}
)
}
},
{
title: "订单编号",
dataIndex: "orderNo",
key: "orderNo",
width: 140,
render: (text, record) => {
return (
{
e.stopPropagation();
let input = document.getElementById("copyText");
input.value = text;
input.select();
document.execCommand("copy");
message.success("复制成功");
}}
>
复制
}
>
{text}
{record.totalAmount >= 10 && 大客户}
{record.projectType == 1 && 会员}
);
},
},
{
title: "订单部门",
dataIndex: "depName",
key: "depName",
},
{
title: "订单负责人",
dataIndex: "salesmanName",
key: "salesmanName",
},
{
title: "财务负责人",
dataIndex: "financeName",
key: "financeName",
},
{
title: "会员项目",
dataIndex: "projectName",
key: "projectName",
render: (text, record) => {
return (
{text}
{(record.memberType == 1 || record.memberType == 2) && 特批项目}
)
}
},
{
title: "数量",
dataIndex: "commodityQuantity",
key: "commodityQuantity",
},
{
title: "总年限",
dataIndex: "yearSum",
key: "yearSum",
render: (text, record) => {
return (
{["", "一年", "二年", "三年", "四年", "五年"][text]}
);
}
},
{
title: "年限",
dataIndex: "serviceLife",
key: "serviceLife",
render: (text, record) => {
return (
{!!text && JSON.parse(text).toString()}
);
}
},
{
title: "本次派单",
dataIndex: "serviceYear",
key: "serviceYear",
render: (text, record) => {
return (
{!text ? "" : text}
);
}
},
{
title: "项目说明",
dataIndex: "taskComment",
key: "taskComment",
render: (text, record) => {
return (
{text}
);
}
},
{
title: "状态",
dataIndex: "status",
key: "status",
width: 80,
render: (text, record) => {
return (
{text != 1 &&
{["", "财务审核", `公司/部门管理审核`, "通过", "驳回"][text]}
}
{text == 1 &&
{record.examineType == 1
? "财务审核" : record.examineType == 2
? "财务复审" : record.examineType == 3 && "财务审核"
}
{record.examineType == 3 &&
财务复审
}
}
);
}
},
{
title: "操作",
dataIndex: "pictureUrl",
key: "pictureUrl",
width: 90,
render: (text, recard) => {
return (
);
},
},
],
dataSource: [],
fjlist: [],// 营销员列表
checkOrderNo: "",//操作订单编号
checkData: "",//操作描述
checkVisible: "",//审核弹窗开关
checkId: "",//会员项目编号
result: -1,//1同意 0驳回
imgListVisible: false,//附件弹窗
pictureUrlArr: [],//附件
recard: {},
};
},
componentWillMount() {
this.loadData();
// this.departmentList();
},
// 获取订单部门
departmentList() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectSuperId",
data: {},
success: function (data) {
let thedata = data.data;
let theArr = [];
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
} else {
thedata.map(function (item, index) {
theArr.push({
key: index,
name: item.name,
id: item.id,
});
});
}
this.setState({
departmentArr: theArr,
});
}.bind(this),
}).always(
function () {
}.bind(this)
);
},
// 列表数据
loadData(pageNo, pageSize) {
const { searchValues, pagination } = this.state
this.setState({
loading: true,
});
let datas = Object.assign(searchValues, {
pageNo: pageNo || 1,
pageSize: pageSize || 10,
shiroType: 2, //财务审核
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/orderProject/memberList",
data: datas,
success: function (data) {
this.setState({
loading: false,
});
if (data.error && data.error.length === 0) {
if (data.data.list) {
pagination.current = data.data.pageNo;
pagination.total = data.data.totalCount;
if (data.data && data.data.list && !data.data.list.length) {
pagination.current = 0;
pagination.total = 0;
}
this.setState({
dataSource: data.data.list,
pagination: this.state.pagination,
pageNo: data.data.pageNo,
totalPage: data.data.totalPage,
});
} else {
this.setState({
dataSource: data.data,
pagination: false,
});
}
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
// 点击行
tableRowClick(record) {
this.state.RowData = record;
this.setState({
showDesc: true,
});
},
// 关闭
closeDesc(e, s) {
this.state.showDesc = e;
if (s) {
this.loadData(this.state.pageNo);
}
},
// 搜索
search() {
this.setState({
selectedRowKeys: []
})
this.loadData();
},
// 重置
reset() {
this.setState({
searchValues: JSON.parse(JSON.stringify({})),
}, () => {
this.Cascaders.empty();
this.loadData();
})
},
// 点击审核
checkRemark(nmb) {
this.setState({
checkVisible: true,
checkId: this.state.recard.id,
result: nmb
});
},
// 审核
toExamine() {
if (!this.state.checkData) {
message.warning("请填写审核说明~");
return;
}
this.setState({
loading: true,
});
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/orderProject/examineMemberProject",
data: {
id: this.state.checkId,
remarks: this.state.checkData,
result: this.state.result, //1同意 0驳回
type: 0, //0财务审核 1特批审核
},
}).done(
function (data) {
if (!data.error.length) {
message.success("审核成功!");
this.setState({
loading: false,
checkVisible: false,
checkData: '',
imgListVisible: false,
});
this.loadData()
} else {
message.warning(data.error[0].message);
}
}.bind(this)
);
},
// 更改表格显示数据
changeList(arr) {
const newArr = [];
this.state.columns.forEach((item) => {
arr.forEach((val) => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr,
});
},
// 导出当前列表
exportAll() {
message.config({
duration: 20,
});
let loading = message.loading("下载中...");
this.setState({
exportPendingLoading: true,
});
let data = {
shiroType: 2, //财务审核
};
let obj1 = JSON.parse(JSON.stringify(this.state.searchValues));
data = Object.assign(data, obj1);
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: "/api/admin/orderProject/memberList/export",
data,
success: function (data) {
if (data.error.length === 0) {
this.download(data.data);
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
loading();
this.setState({
exportPendingLoading: false,
});
}.bind(this)
);
},
// 打印
printAll() {
this.setState({
dvisible: true,
});
this.loadData(1, 9999999);
},
// 下载
download(fileName) {
window.location.href =
globalConfig.context + "/open/download?fileName=" + fileName;
},
// 查询订单负责人列表
followUp(e) {
const { searchValues } = this.state;
this.setState({
searchValues: Object.assign(searchValues, {
aname: e,
}),
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/listAdminByName",
data: {
adminName: e,
},
success: function (data) {
let thedata = data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
thedata = {};
}
this.setState({
fjlist: thedata,
});
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
// 选中订单负责人
selectF(value) {
const { searchValues, fjlist } = this.state;
const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
this.setState({
searchValues: Object.assign(searchValues, {
salesmanId: newdataSources.find((item) => item.name == value).id,
}),
});
},
// 失去焦点
blurChange(e) {
let theType = "";
let contactLists = this.state.customerArr || [];
if (e) {
contactLists.map(function (item) {
if (item.name == e.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes: theType,
});
},
// 删除数组最后一项(删除操作列)
truncate(arr) {
return arr.filter(function (v, i, ar) {
return i !== ar.length - 1
})
},
render() {
const { TextArea } = Input
const { searchValues, departmentArr = [] } = this.state
const dataSources = this.state.fjlist || [];
const options = dataSources.map((group) => (
{group.name}
));
return (
{ this.setState({ showModal: false }) }} />
会员项目审核
{/* 订单详情 */}
{
//打印预览
this.state.dvisible &&
{
this.loadData();
this.setState({
dvisible: false,
});
}}
>
{
this.refs.all = e;
}}
>
(
)}
content={() => this.refs.all}
/>
}
{
//审核弹窗
this.state.checkVisible &&
{
this.loadData()
this.setState({
checkVisible: false,
checkData: '',
})
}}
>
}
{
//查看附件
this.state.imgListVisible &&
{
this.setState({
imgListVisible: false,
});
}}
onCancel={() => {
this.setState({
imgListVisible: false,
});
}}
width="600px"
title="审核"
footer=""
>
付款情况:
{this.state.recard.memberType == "0"
? "已付会员节点全款" : this.state.recard.memberType == "1"
? "已付部分期款,需特批" : this.state.recard.memberType == "2"
? "未付款,需特批" : ""}
附件:
{
this.state.recard.status == 1 && this.state.recard.myExamine == 0 &&
}
{
this.state.recard.status == 1 && this.state.recard.myExamine == 0 &&
}
}
);
},
});
export default ProjectVip;