import React, { Component } from "react"; import { View, Image, Button, Text } from "@tarojs/components"; import Taro, { getCurrentInstance } from "@tarojs/taro"; import Skeleton from "taro-skeleton"; import dayjs from 'dayjs'; import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtTextarea } from 'taro-ui'; import { getPublicList, limitUser, addSupplement } from "../../utils/servers/servers"; import noData from '../../image/noData.png'; import "./index.less"; import "taro-ui/dist/style/components/flex.scss"; import "taro-ui/dist/style/components/action-sheet.scss"; import "taro-ui/dist/style/components/icon.scss"; import "taro-ui/dist/style/components/list.scss"; import "taro-ui/dist/style/components/modal.scss"; import MessageNoticebar from "../../components/common/messageNoticebar"; import { getContactType } from "../../utils/tools"; import Superior from "../../components/common/superior"; class CustomerProfile extends Component { $instance = getCurrentInstance(); constructor(props) { super(props); this.state = { data: [], loading: false, isOpen: false, opinion: "", type: 1, id: "", text: "", myUser: -1, isSuperior: false, }; this.getPublicList = this.getPublicList.bind(this); this.addSupplement = this.addSupplement.bind(this); } componentDidMount() { this.getPublicList(); } componentDidShow() { } getPublicList() { this.setState({ loading: true }) getPublicList({ id: this.$instance.router.params.id, }) .then((v) => { if (v.error.length === 0) { this.setState({ data: v.data.list, myUser: v.data.myUser, loading: false, }) } else { Taro.showToast({ title: v.error[0].message, icon: "none" }); } }) .catch((err) => { this.setState({ loading: false }) Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" }); }); } limitUser() { limitUser({ uid: this.$instance.router.params.id, // hours: 1, }).then((v) => { if (v.error.length === 0) { } else { Taro.showToast({ title: v.error[0].message, icon: "none", }); } }).catch(() => { }) } onShareAppMessage() { this.limitUser(); return { title: "面谈记录", path: "pages/situation/index?id=" + this.$instance.router.params.id + "&signBills=" + this.$instance.router.params.signBills + "&nickname=" + this.$instance.router.params.nickname, }; } // 公出补充 addSupplement() { const { type, id, opinion, text } = this.state let obj = {} if (type == 1) { obj = { id, supplement: (opinion ? opinion + "/" : "") + text } } else if (type == 2) { obj = { id, nextPlan: (opinion ? opinion + "/" : "") + text } } addSupplement(obj).then((v) => { if (v.error.length === 0) { Taro.showToast({ title: "填写成功", }); this.setState({ isOpen: false, id: "", text: "", }) this.getPublicList(); } else { Taro.showToast({ title: v.error[0].message, icon: "none", }); } }).catch(() => { }) } render() { const { data, loading, type, opinion, myUser } = this.state; return ( {data && data.length === 0 ? ( 暂无公出情况 ) : ( {this.$instance.router.params.nickname}   {["未签单", "已签单"][this.$instance.router.params.signBills]} {myUser == 1 && } { e.stopPropagation() this.setState({ isSuperior: true }) }} >上级指导 { this.state.isSuperior && { this.setState({ isSuperior: false }) }} /> } { e.stopPropagation() Taro.navigateTo({ url: "/pages/customerProfile/index?id=" + this.$instance.router.params.id + "&signBills=" + this.$instance.router.params.signBills, }); }} >客户档案 { data.map(item => 跟进方式 跟进人 跟进时间 次数 {getContactType(item.contactType)} {item.followName} {!!item.followTime && dayjs(item.followTime).format('YYYY-MM-DD HH:mm')} {item.followCount} {/* 跟进方式:{getContactType(item.contactType)} 跟进人:{item.followName} 跟进部门:{item.followDep} 跟进说明:{item.result} 跟进时间:{item.followTime} 跟进次数:{item.followCount} */} 跟进部门:{item.followDep} 跟进说明:{item.result} 公出时间:{item.releaseStarts} 公出人:{item.aname} 公出目标:{item.remarks} 公出计划:{item.plan} 预计效果:{item.expectedEffect} 本次公出目标总结 (包括后续面谈时间、内容、沟通对象、沟通结果) { myUser == 1 && { e.stopPropagation() this.setState({ type: 1, id: item.prdId, opinion: item.supplement, isOpen: true, }) }} >填写 } {item.supplement || "无"} 下一步公出计划 (下一步公出计划) { myUser == 1 && { e.stopPropagation() this.setState({ type: 2, id: item.prdId, opinion: item.nextPlan, isOpen: true, }) }} >填写 } {item.nextPlan || "无"} ) } )} { this.state.isOpen && 公出企业-{type == 1 ? "本次共出目标" : type == 2 ? "下一步公出计划" : ""} {this.$instance.router.params.nickname} { this.setState({ text: e }) }} maxLength={200} placeholder={type == 1 ? '请填写本次公出目标总结,包括后续面谈时间、内容、沟通对象、沟通结果等内容' : type == 2 ? "请填写下一步公出计划" : ""} /> { !!opinion ? opinion.split("/").map(item => {/* */} {/* */} {item || "暂无"} ) : 暂无信息 } } ); } } export default CustomerProfile;