123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- import { apiFlowDetail, apiSealAdd, apiSearchCustome, apiSearchContract,apiSearchAllCustome,getBelongCompany } from "@/api/approve/seal.js";
- import { uploadFiles } from "@/utils/uploadFile.js";
- import { preViewFile } from "../utils/util.js";
- export const sealMixin = {
- computed: {
- typeLength() {
- if (this.type.length > 0) {
- return true;
- } else {
- return false;
- }
- },
- },
- watch: {
- showCustome() {
- this.searchCustomeVal = "";
- this.searchCustomeStatus = true;
- this.searchCustomeList = [];
- this.searchContractList = [];
- },
- showType() {
- if (!this.showType) {
- this.temType = JSON.parse(JSON.stringify(this.type));
- }
- },
- },
- data() {
- return {
- showPurpose: false, //显示用印用途选项
- purposeArr: ["销售合同", "代付合同", "总对总协议", "渠道合同", "付款通知函", "招投标", "战略合作协议"],
- purpose: "",
- showType: false, //显示用印用途选项
- typeArr: ["合同章", "公章", "法人章","电子合同章"],
- type: [],
- temType: [], //临时存放选择的用印用途
- showServiceType: false, //显示业务类型选项
- ServiceTypeArr: ["新签合同", "续约合同", "补充协议",'代付合同'],
- ServiceType: "", //业务类型
- showCustome: false, //显示搜索客户名称
- customeName: "", //客户名称
- fileNum: "", //文件数
- remark: "", //备注
- CreditCode: "", //社会统一信用代码
- UseCompanyName: "", //实际使用方客户名称
- ContractId: 0, //合同id
- // file: {
- // type: "",
- // img: "",
- // url: "",
- // }, //上传附件 文件
- // 上传的附件列表 需求更改,可上传多个附件 crm-8.7
- fileList:[],
- processData: null, //流程数据
- radioVal: "系统合同",
- searchCustomeVal: "", //搜索客户输入数据
- searchCustomeStatus: true, //搜索客户 是否有结果
- searchCustomeList: [], //搜索到的客户名称列表
- searchContractList: [], //选择搜索中的客户后合同列表数据
- allCustome:{
- index:1,
- list:[],
- finished:false,
- loading:false
- },
- temCustomeName:'',
-
- //归属公司弹窗
- showBelongCompanyPop:false,
- belongCompany:'',
- belongCompanyOptions:[]
- };
- },
- methods: {
- async getBelongCompanyOptions() {
- const res = await getBelongCompany()
- if(res.code !==200 ) return
- this.belongCompanyOptions = res.data || []
- },
- //删除上传的附件
- handleDeleteCheckFile(file) {
- this.fileList = this.fileList.filter(item => item.url!= file.url)
- },
- //预览文件
- handlePreviewFiles(e) {
- if (e.type === "pdf" || e.type === "word") {
- preViewFile(e.url);
- } else {
- uni.previewImage({
- urls: [e.url],
- });
- }
- },
- //上传附件
- async handleUpload() {
- const res = await uploadFiles({ type: "all" });
- const reg = /\.(pdf)$/;
- const reg2 = /\.doc|\.docx$/;
- if (reg.test(res[0])) {
- this.fileList.push({
- type: "pdf",
- url: res[0],
- img: require("../static/pdf.png"),
- });
- } else if (reg2.test(res[0])) {
- this.fileList.push({
- type: "word",
- url: res[0],
- img: require("../static/word.png"),
- });
- } else {
- this.fileList.push({
- type: "img",
- url: res[0],
- img: res[0],
- });
- }
- },
- // 客户搜索
- // 先搜索出客户 再通过客户去请求出客户下面存在的合同
- onSearchValChange(e) {
- this.searchCustomeVal = e.detail;
- },
- //搜索客户
- async onSearch() {
- if (!this.searchCustomeVal) {
- uni.showToast({
- title: "请输入搜索关键字",
- icon: "none",
- });
- return;
- }
- this.searchContractList = [];
- this.searchCustomeList = [];
- const res = await apiSearchCustome({ Keyword: this.searchCustomeVal });
- if (res.code === 200) {
- this.searchCustomeList = res.data;
- if (res.data.length === 0) {
- this.searchCustomeStatus = false;
- } else {
- this.searchCustomeStatus = true;
- }
- }
- },
- // 搜索客户对应的合同
- async getContract(e) {
- const res = await apiSearchContract({ Keyword: e });
- if (res.code === 200) {
- if (res.data.List) {
- this.searchContractList = res.data.List;
- } else {
- uni.showToast({
- title: "此客户无合同,请重新选择",
- icon: "none",
- });
- }
- }
- },
-
- //归属公司选择
- handleComfirmBelongCmpany(e) {
- this.belongCompany = e.detail.value;
- this.showBelongCompanyPop = false;
- },
- // 选择用印用途
- handlePurposeConfirm(e) {
- this.purpose = e.detail.value;
- this.showPurpose = false;
- },
- //确认盖章类型
- handleTypeConfirm(e) {
- this.type = JSON.parse(JSON.stringify(this.temType));
- this.showType = false;
- this.getProcessData();
- },
- // 盖章类型变换
- onChangeType(e) {
- this.temType = e.detail;
- },
- //选择业务类型
- handleServiceTypeConfirm(e) {
- this.ServiceType = e.detail.value;
- this.showServiceType = false;
- },
- //合同章5 公章、法人章 6
- async getProcessData() {
- if(this.type.length===0) return
- let id = 0;
- if (this.type.includes("公章") || this.type.includes("法人章")) {
- id = 6;
- } else {
- id = 5;
- }
- let res = await apiFlowDetail({ FlowId: id });
- if (res.code === 200) {
- this.processData = res.data || null;
- }
- },
- handleAllCutomeInput(e){
- this.temCustomeName=e.detail.value
- this.allCustome.index=1
- this.allCustome.list=[]
- this.allCustome.finished=false
- this.allCustome.loading=false
- if(this.temCustomeName){
- this.getSearchAllCustome()
- }
- },
- // 搜素全部客户
- async getSearchAllCustome(){
- this.allCustome.loading=true
- const res=await apiSearchAllCustome({
- PageSize:20,
- CurrentIndex:this.allCustome.index,
- Keyword:this.temCustomeName,
- })
- this.allCustome.loading=false
- if(res.code===200){
- if(res.data){
- this.allCustome.list=[...this.allCustome.list,...res.data]
- }else{
- this.allCustome.finished=true
- }
- }
- },
- // 搜素全部客户弹窗触底
- handleScrollToLower(){
- if(this.allCustome.loading||this.allCustome.finished) return
- this.allCustome.index++
- this.getSearchAllCustome()
- },
- chooseAllCustomeItem(e){
- this.customeName=e.CompanyName
- this.allCustome.index=1
- this.allCustome.list=[]
- this.allCustome.finished=false
- this.allCustome.loading=false
-
- },
- // 收起搜索弹窗
- handleClickPage(){
- if(this.allCustome.list.length>0){
- this.allCustome.index=1
- this.allCustome.list=[]
- this.allCustome.finished=false
- this.allCustome.loading=false
- }
- },
- },
- };
|