import React, { Component } from "react"; import { connect } from "react-redux"; import { View } from "@tarojs/components"; import { AtSteps, AtButton, AtListItem } from "taro-ui"; import "taro-ui/dist/style/components/steps.scss"; import "taro-ui/dist/style/components/icon.scss"; import "taro-ui/dist/style/components/tabs.scss"; import UserFloatingLayer from "../../components/common/userFloatingLayer"; import { add, minus, asyncAdd } from "../../actions/counter"; import Enterprise from "./enterprise"; import PublicContent from "./publicContent"; import Result from "./result"; import "./index.less"; import Taro from "@tarojs/taro"; import MessageNoticebar from "../../components/common/messageNoticebar"; import InterviewCustomer from "../../pages/interview/index" const items = [ { title: "选择公出企业" }, { title: "填写公出内容" }, { title: "提交公出审核" }, ]; @connect( ({ counter }) => ({ counter, }), (dispatch) => ({ add() { dispatch(add()); }, dec() { dispatch(minus()); }, asyncAdd() { dispatch(asyncAdd()); }, }) ) class ApplyDepart extends Component { constructor(props) { super(props); this.state = { current: 0, enterpriseInfor: {}, selectArrderLocation: {}, resultState: 0, resultId: "", punchClockInfor: {}, // colors: "primary", // color: "secondary", // selectColor: 0, type: 0, isShow: false, tipList: [], // 需要面谈的客户列表,只有业务员自己的客户才能面谈 interviewCustomerList: [], interviewIdx: 0, // 面谈后返回的id uaiIdList: [] }; } componentDidShow() { Taro.eventCenter.on("enterprise", (arg) => { arg.type = this.state.type; // 跳转 this.setState({ current: 1, enterpriseInfor: arg, interviewCustomerList: arg.list.filter(item => item.myUser === 1), interviewIdx: 0 }); }); Taro.eventCenter.on("publicContent", (arg) => { this.setState({ current: 2, resultState: arg.code, resultId: arg.data ? arg.data.id : "", punchClockInfor: arg.data || {}, isShow: arg.isShow, tipList: arg?.list, }); }); Taro.eventCenter.on("enterpriseBack", () => { const { interviewCustomerList } = this.state; if (interviewCustomerList.length) { this.setState({ interviewIdx: interviewCustomerList.length - 1 }); } else { this.setState({ current: 0, }); } }); Taro.eventCenter.on("result", () => { this.setState({ current: 0, enterpriseInfor: {}, selectArrderLocation: {}, resultState: 0, resultId: "", punchClockInfor: {}, }); }); //获取地区选定数据 const chooseLocation = requirePlugin("chooseLocation"); const location = chooseLocation.getLocation(); if (location) { this.setState({ selectArrderLocation: location, }); } } componentDidMount() { } onReachBottom() { if (this.state.current === 0) { Taro.eventCenter.trigger("applyDepartSearchList"); } } handleCustomerPrev() { const { interviewIdx } = this.state; if (interviewIdx == 0) { this.setState({ current: 0, interviewIdx: -1 }); } else { interviewIdx -= 1; this.setState({ interviewIdx }); } } handleCustomerNext({ uaiId }) { let { interviewIdx, uaiIdList } = this.state; interviewIdx = interviewIdx + 1; uaiIdList.push(uaiId); this.setState({ interviewIdx, uaiIdList }); } render() { let userInfor = Taro.getStorageSync('userInfor'); const { interviewCustomerList, interviewIdx } = this.state; return ( {[ { type: 0, title: "业务公出" }, { type: 1, title: "技术公出" }, { type: 2, title: "行政公出" }, ].map((item, index) => ( { this.setState({ type: item.type, }); }} > {item.title} ))} { this.state.type == 0 && interviewCustomerList.length && interviewIdx < interviewCustomerList.length ? ( ) : ( ) } {/* */} ); } } export default ApplyDepart;