主分支:2025年8月12日 - 合并前

This commit is contained in:
PC-202311141343\Administrator
2025-08-12 16:57:23 +08:00
parent d6024d1f37
commit 297526cd8d
25 changed files with 22963 additions and 257 deletions

13
.hbuilderx/launch.json Normal file
View File

@@ -0,0 +1,13 @@
{
"version" : "1.0",
"configurations" : [
{
"playground" : "standard",
"type" : "uni-app:app-android"
},
{
"openVueDevtools" : true,
"type" : "uni-app:h5"
}
]
}

18144
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -128,14 +128,14 @@ app.post('/api/businessDaily', (req,res) => {
// 查询CRM系统 Daily business
app.post('/api/businessCRMList', (req,res) => {
res.json(Mock.mock({
code: 0,
code: 200,
data: {
list:[
{id:1,name:'走访报告',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReport'},
{id:2,name:'走访报告添加',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportAdd'},
{id:3,name:'走访报告详情',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportDetail'},
{id:4,name:'走访报告内容录入',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportEnter'},
{id:5,name:'市场信息管理',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/marketInformation'},
{id:5,name:'市场信息管理',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/marketInformation/marketInformation'},
{id:6,name:'修改周计划',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/weekPlanUpdate'},
{id:7,name:'签到打卡',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/vistorCheckin'},
{id:8,name:'打卡统计',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/checkinStatistics'},
@@ -164,7 +164,7 @@ app.post('/api/businessCRMList', (req,res) => {
// 首页待办数据
app.post('/api/backBlogCount', (req,res) => {
res.json(Mock.mock({
code: 0,
code: 200,
data: {
count1:3,
count2:7,
@@ -190,7 +190,7 @@ app.post('/api/stepData', (req,res) => {
data: {
date:new Date().getTime(),
list:[
{ id:1,desc: '2025秋季产品发布前期准备会在科研楼0317会议室召开。', title: '13:30 — 15:30',beginTime:'13:30',endTime:'15:30'},
{ id:1,desc: '2025秋季产品发布前期准备会1s在科研楼0317会议室召开。', title: '13:30 — 15:30',beginTime:'13:30',endTime:'15:30'},
{ id:2,desc: '生产间安全巡检。', title: '16:30 — 18:00',beginTime:'16:30',endTime:'18:00'},
]
}

59
src/api/crm/api_ys.js Normal file
View File

@@ -0,0 +1,59 @@
import request from "@/utils/request"
export function getYsVisistList(data) {
return request.get({
url: '/app/appVisistReport/list',
data: data
})
}
//市场信息列表接口
export function CrmMarketInformationList(data) {
return request.get({
url: '/app/informationMarketInformation/list',
data: data
})
}
//市场信息模块待审核改为提交
export function handleCrmMarketInfo(data) {
return request.post({
url: '/app/informationMarketInformation/handleCrmMarketInfo',
data
})
}
//获取客户名称
export function getYsCustomerList(data) {
return request.get({
url: '/app/appCustomerIfno/pageList',
data
})
}
//市场信息模块提交
export function crmMarketInformationAdd(data) {
return request.post({
url: '/app/informationMarketInformation/add',
data
})
}
//市场信息模块查询
export function crminformationItemForDetail(data) {
return request.get({
url: '/app/informationMarketInformation/getDetail',
data
})
}
//客户人员信息查询
export function crmCustomerUser(data) {
return request.get({
url: '/app/appCrmCusUserNewController/crmCustomerUser',
data
})
}
//市场信息根据ID删除
export function crmMarketInformationDelete(data) {
return request.get({
url: '/app/informationMarketInformation/delete',
data
})
}

View File

@@ -10,8 +10,8 @@ export const RequestMethodsEnum = {
};
export const RequestCodeEnum = {
SUCCESS: 0, //成功
FAILED: -1, // 失败
SUCCESS: 200, //成功
FAILED: 500, // 失败
TOKEN_INVALID: 10003 // TOKEN失效未登录
};

View File

@@ -0,0 +1,170 @@
<template>
<view class="con-body">
<view >
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'选择客户单位'" :leftFlag="true" :rightFlag="false">
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<uni-easyinput prefixIcon="search" v-model="searchContent" placeholder="请输入客户单位名称" clearable
@iconClick="iconClick">
</uni-easyinput>
<view class="inner-box">
<view class="list-cont">
<radio-group class="block" @change="radioChange">
<view class="item" v-for="(item, index) in dataList">
<radio class='radio' :value="index" ></radio>
<view class="name">{{item.cusName+""+item.shortName+""}}</view>
</view>
</radio-group>
</view>
</view>
</view>
</view>
</template>
<script setup>
import customHeader from '@/components/customHeader.vue'
import { getYsCustomerList } from '../../../api/crm/api_ys.js'
import { onMounted, reactive, ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useMessage } from '../../../utils/message.js'
const message = useMessage();
//点击查询客户人员
const queryParams = ref({
cusName: '',
nickName:'',
pageNum: 1,
pageSize: 10
})
onMounted(() => {
})
onLoad(options => {
queryParams.value.cusName = options.cusName
})
const dataList = ref([])
//查询某一客户人员
let searchContent = ref('')
function iconClick() {
message.toast('点击了查询,当前内容:' + searchContent.value)
}
//监视查询的内容的变化
let queryCusForm = reactive({})
watch(searchContent,(newValue,oldValue)=>{
console.log("输入内容:",searchContent.value)
queryCusForm.cusName = searchContent.value
getYsCustomerList(queryCusForm).then(res=>{
dataList.value = res.rows
})
})
function radioChange(event) {
const selectedIndex = event.detail.value
let test = dataList.value[selectedIndex]
// 发送全局事件
uni.$emit('onCustomerSelected', test)
let cusName = test.cusName;//客户名称
let cusId = test.cusId;//客户ID
uni.navigateBack()//返回上一页
}
</script>
<style scoped lang="scss">
.con-body{
background: white;
}
/* Container for the checkbox group */
.checkbox-group.block {
width: 100%;
}
/* Each item row */
.itemClass {
display: flex;
align-items: center;
padding: 10rpx 0;
margin-left: 15rpx;
border-bottom: 1px solid #eee;
/* optional divider */
}
/* Checkbox styling */
.checkBoxClass {
margin-right: 12rpx;
}
/* Content container */
.clientClass {
flex: 1;
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 36rpx;
color: #333;
/* default text color */
}
/* Blue username text */
.blue-text {
/* or any blue you prefer */
margin-right: 5rpx;
}
.inner-box {
width: 100%;
padding: 10px;
box-sizing: border-box;
}
.list-cont {
width: 100%;
}
.block {
width: 100%;
}
.item {
display: flex;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #eee;
}
.radio {
margin-right: 12px;
transform: scale(0.9);
}
.name {
flex: 1;
font-size: 16px;
color: #333;
}
.checked {
color: #007AFF; /* 选中状态的颜色 */
}
</style>

View File

@@ -0,0 +1,136 @@
<template>
<view class="con-body">
<view >
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'走访报告添加客户人员'" :leftFlag="true" :rightFlag="false">
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<uni-easyinput prefixIcon="search" v-model="searchContent" placeholder="请输入客户人员名称" clearable
@iconClick="iconClick">
</uni-easyinput>
<checkbox-group class="block" @change="checkboxChange">
<view class="itemClass" v-for="(item, index) in dataList" :key="item.userId">
<checkbox class='checkBoxClass' :value="item.userName"
v-model="item.userName"></checkbox>
<view class="clientClass">
<text class="blue-text">{{ item.userName }}</text>
{{ " | " }}
{{ item.userDept != null ? item.userDept : ' ' }}
{{ item.job != null ? item.job : ' ' }}
{{ item.mobilePhone }}
{{ item.remark != null ? item.remark : ' ' }}
</view>
</view>
</checkbox-group>
</view>
</view>
</template>
<script setup>
import customHeader from '@/components/customHeader.vue'
import { crmCustomerUser } from '../../../api/crm/api_ys.js'
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useMessage } from '../../../utils/message.js'
import cache from '../../../utils/cache'
const message = useMessage();
//点击查询客户人员
const queryParams = ref({
cusName: '',
pageNum: 1,
pageSize: 10
})
onMounted(() => {
getClientUserName()
})
onLoad(options => {
queryParams.value.cusName = options.cusName
})
const dataList = ref([])
function getClientUserName() {
crmCustomerUser(queryParams.value).then(res => {
dataList.value = res.rows
})
}
//查询某一客户人员
let searchContent = ref('')
function iconClick() {
message.toast('点击了查询,当前内容:' + searchContent.value)
}
//监视查询的内容的变化
watch(searchContent,(newValue,oldValue)=>{
queryParams.value.nickName = searchContent.value
//变化了之后,重新查询内容
crmCustomerUser(queryParams.value).then(res => {
dataList.value = res.rows
})
})
//勾选内容
function checkboxChange(e) {
cache.set('checkedRCClientList', e.detail.value)
}
</script>
<style scoped lang="scss">
.con-body{
background: white;
}
/* Container for the checkbox group */
.checkbox-group.block {
width: 100%;
}
/* Each item row */
.itemClass {
display: flex;
align-items: center;
padding: 10rpx 0;
margin-left: 15rpx;
border-bottom: 1px solid #eee;
/* optional divider */
}
/* Checkbox styling */
.checkBoxClass {
margin-right: 12rpx;
}
/* Content container */
.clientClass {
flex: 1;
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 36rpx;
color: #333;
/* default text color */
}
/* Blue username text */
.blue-text {
/* or any blue you prefer */
margin-right: 5rpx;
}
</style>

View File

@@ -1,224 +0,0 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'市场信息管理'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="handleAdd">
<uni-icons type="plus" size="24" color="#B7D2FF"></uni-icons>新增
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
<!-- 正文内容 -->
<view class="all-body market-con">
<view class="nav-list">
<view class="nav-item" :class="{active:index==activeTab}"
v-for="(item,index) in tabList" :key="index"
@click="handleNav(index)"
>{{ item }}</view>
</view>
<!-- 分页部分 -->
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff"
class="scroll-h" :class="{'loading-scroll':cssFlag}">
<!-- 市场机会信息 -->
<block v-if="activeTab === 0">
市场机会信息内容
</block>
<!-- 重大事项信息 -->
<block v-if="activeTab === 1">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.title }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}" size="mini">{{ item.statusName }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">产生影响</view>
<view class="font-gray">{{ item.desc }}</view>
</view>
</view>
</view>
</block>
</mescroll-uni>
</view>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import customHeader from '@/components/customHeader.vue'
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import { getNavBarPaddingTop } from '@/utils/system.js'
import { mattersList } from '@/api/business.js'
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})
const activeTab = ref(1);// 默认重大事项信息
const tabList = ['市场机会信息', '重大事项信息', '竞争对手信息', '人员变动信息','多标签效果','多标签效果'];
let handleNav = (index)=>{
console.log(index)
activeTab.value = index;
}
// 新增
let handleAdd = () => {
// uni.navigateTo({ url: '/pages/business/CRM/visitorReportAdd' })
}
// 查询列表
let list = ref([]);
const mescrollRef = ref(null);
const upOption = ref({
page: { num: 0, size: 10 },
noMoreSize: 5,
empty: { tip: '~ 空空如也 ~' },
textLoading: '加载中...',
textNoMore: '已经到底了'
});
const downOption = ref({
auto: true,
textInOffset: '下拉刷新',
textOutOffset: '释放更新',
textLoading: '刷新中...'
});
let cssFlag=ref(false);//控制样式
const mescrollInit = (mescroll) => {
cssFlag.value = true;
mescrollRef.value = mescroll;
};
// 下拉刷新
const downCallback = async (mescroll) => {
try {
setTimeout(async () => {
const res = await getMattersList(1, upOption.value.page.size);
cssFlag.value = false;
list.value = res.list;
mescroll.resetUpScroll();
}, 500);
} catch (error) {
mescroll.endErr();
} finally {
setTimeout(async () => {
mescroll.endSuccess();
}, 500);
}
}
// 上拉加载更多
const upCallback = async (mescroll) => {
try {
setTimeout(async () => {
const res = await getMattersList(mescroll.num, mescroll.size);
if (mescroll.num === 1) {
list.value = res.list;
} else {
list.value.push(...res.list);
}
mescroll.endBySize(res.list.length, res.total);
}, 500);
} catch (error) {
mescroll.endErr();
}
}
// 获取数据列表
const getMattersList = (pageIndex, pageSize) => {
return new Promise(async (resolve) => {
let param = {
pageIndex,
pageSize
}
let res = await mattersList(param);
resolve({
list: res.list,
total: res.totalCount
});
});
}
</script>
<style scoped>
.all-body{
/* #ifdef APP-PLUS */
top:88rpx;
height: calc(100vh - 44px);
/* #endif */
/* #ifndef APP-PLUS */
top:100rpx;
height: calc(100vh - 48px);
/* #endif */
}
/*.market-con{
} */
.nav-list{
display: flex;
flex-wrap: wrap;
/* #ifdef APP-PLUS */
padding:80rpx 30rpx 0;
/* #endif */
/* #ifndef APP-PLUS */
padding:20rpx 30rpx 0;
/* #endif */
}
.nav-list .nav-item{
background-color:#05A3F4;
border-radius: 10rpx;
color:#FFFFFF;
font-size:28rpx;
text-align: center;
padding:10rpx 25rpx;
margin-right:15rpx;
margin-bottom:20rpx;
}
.nav-list .nav-item:nth-child(3n){
margin-right:0;
}
.nav-list .nav-item.active{
background-color: #fff;
color:#3384DF;
font-weight: bold;
}
.report-list .r-list{
align-items:flex-start;
}
.scroll-h {
/* #ifdef APP-PLUS */
height: calc(100vh - 155px);
/* #endif */
/* #ifndef APP-PLUS */
height: calc(100vh - 135px);
/* #endif */
}
.white-bg {
padding-top:10rpx;
padding-bottom: 10rpx;
}
.report-list .title{
display: flex;
}
</style>

View File

@@ -0,0 +1,233 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'通用表单添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="通用表单类型" name="generalFormType" class="f-c-right">
<picker @change="onGeneralFormTypeChange" :value="generalFormTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[generalFormTypeIndex]?.name || '请选择通用表单类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="信息内容" name="informationContent" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.informationContent"
placeholder="请输入信息内容" class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd
} from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
generalFormType:"专项市场调研信息",//通用表单类型
informationContent: "", //信息内容
picture: "", //、图片
photos: null,
description: null,
informationType:"通用表单" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
generalFormType: {
rules: [{
required: true,
errorMessage: '请选择通用表单类型'
}]
},
informationContent: {
rules: [{
required: true,
errorMessage: '请输入信息内容'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '专项市场调研信息'
},
{
id: 1,
name: '供货改进需求信息'
},
{
id: 2,
name: '客户赞扬、抱怨信息'
},
{
id: 3,
name: '领导承诺'
},
{
id: 4,
name: '待办事项'
},
{
id: 5,
name: '备忘录'
}
])
const generalFormTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onGeneralFormTypeChange = (e) => {
generalFormTypeIndex.value = e.detail.value
console.log('generalFormTypeIndex:', array.value[e.detail.value]?.name)
formData.value.generalFormType = array.value[e.detail.value]?.name || ''
}
// 如果你原来在 onShow 中做了类似这样:
// let res = currPage.data.cusData; 判断是否传入了客户信息
// 那么在 Vue3 中通常是通过路由参数或者 Vuex/Pinia 等状态管理获取
// 暂时不做,如你后续需要可继续补充
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,268 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'通用表单添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="通用表单类型" name="generalFormType" class="f-c-right">
<picker @change="onGeneralFormTypeChange" :value="generalFormTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[generalFormTypeIndex]?.name || '请选择通用表单类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="信息内容" name="informationContent" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.informationContent"
placeholder="请输入信息内容" class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete
} from '@/api/crm/api_ys.js'
import { onLoad } from '@dcloudio/uni-app'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
generalFormType:"专项市场调研信息",//通用表单类型
informationContent: "", //信息内容
picture: "", //、图片
photos: null,
description: null,
informationType:"通用表单" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
generalFormType: {
rules: [{
required: true,
errorMessage: '请选择通用表单类型'
}]
},
informationContent: {
rules: [{
required: true,
errorMessage: '请输入信息内容'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '专项市场调研信息'
},
{
id: 1,
name: '供货改进需求信息'
},
{
id: 2,
name: '客户赞扬、抱怨信息'
},
{
id: 3,
name: '领导承诺'
},
{
id: 4,
name: '待办事项'
},
{
id: 5,
name: '备忘录'
}
])
const generalFormTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onGeneralFormTypeChange = (e) => {
generalFormTypeIndex.value = e.detail.value
console.log('generalFormTypeIndex:', array.value[e.detail.value]?.name)
formData.value.generalFormType = array.value[e.detail.value]?.name || ''
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete(formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,459 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'竞争对手信息添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<!-- <uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item> -->
<uni-forms-item label="竞争单位" name="competitiveUnits" class="f-c-right">
<picker @change="onCompetitiveUnitsChange" :value="competitiveUnitsIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[competitiveUnitsIndex]?.name || '请选择竞争单位' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="信息类型" name="competitorLevelOne" class="f-c-right">
<picker @change="onCompetitorLevelOneChange" :value="competitorLevelOne" :range="array1"
:range-key="'name'">
<view class="picker">
{{ array1[competitorLevelOneIndex]?.name || '请选择信息类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="具体分类" name="competitorLevelTwo" class="f-c-right">
<picker
@change="onCompetitorLevelTwoChange"
:value="competitorLevelTwoIndex"
:range="currentCompetitorLevelTwoArray"
:range-key="'name'"
>
<view class="picker">
{{ currentCompetitorLevelTwoArray[competitorLevelTwoIndex]?.name || '请选择具体分类' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="具体信息" name="specificMatters" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.specificMatters" :placeholder="dynamicPlaceholder"
class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd
} from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
competitiveUnits: "振华云科", //竞争对手
competitorLevelOne: "基本信息", //竞争对手一级标签
competitorLevelTwo: "", //竞争对手二级标签
specificMatters: "", //具体事情
remark: "", //、备注
picture: "", //、图片
informationType: "竞争对手信息" //信息类型
})
// 表单验证规则
const rules = {
competitiveUnits: {
rules: [{
required: true,
errorMessage: '请选择竞争单位'
}]
},
competitorLevelOne: {
rules: [{
required: true,
errorMessage: '请选择信息类型'
}]
},
competitorLevelTwo: {
rules: [{
required: true,
errorMessage: '请选择具体分类'
}]
},
specificMatters: {
rules: [{
required: true,
errorMessage: '请输入具体信息'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '振华云科'
},
{
id: 1,
name: '四川永星'
},
{
id: 2,
name: '风华邦科'
},
{
id: 3,
name: '株洲宏达'
},
{
id: 4,
name: '福建火炬'
},
{
id: 5,
name: '福建毫米'
},
{
id: 6,
name: '广州创天'
},
{
id: 7,
name: '贝迪斯'
},
{
id: 8,
name: '禹龙通电子'
},
{
id: 9,
name: '成都昊天'
},
{
id: 10,
name: '风华特种'
},
{
id: 11,
name: '济宁正和'
},
{
id: 12,
name: '盛世'
},
{
id: 13,
name: '广东意杰'
},
{
id: 14,
name: '西安威特'
},
{
id: 15,
name: '盛雷城'
},
{
id: 16,
name: '广东福德'
},
{
id: 17,
name: '咸阳智联'
},
{
id: 18,
name: '安徽来福'
},
{
id: 19,
name: '国巨'
},
{
id: 20,
name: '开步电子'
},
{
id: 21,
name: '成都宏鸣'
},
{
id: 22,
name: '其他'
},
])
const array1 = ref([{
id: 0,
name: '基本信息'
},
{
id: 1,
name: '业务信息'
},
])
const array2 = ref([{
id: 0,
name: '资质情况'
},
{
id: 1,
name: '人员情况'
},
{
id: 2,
name: '产品种类(新研制产品、主推产品)'
},
{
id: 3,
name: '近三年销售情况'
},
{
id: 4,
name: '市场组织架构'
},
{
id: 5,
name: '市场策略'
},
{
id: 6,
name: '竞争对手变化产生的市场机会'
},
{
id: 7,
name: '其他'
},
])
const array3 = ref([{
id: 0,
name: '质量问题'
},
{
id: 1,
name: '重大市场活动'
},
{
id: 2,
name: '市场占有率'
},
{
id: 3,
name: '与客户人员的关系'
},
{
id: 4,
name: '竞争动向'
},
{
id: 5,
name: '其他'
},
])
const dynamicPlaceholder = computed(() => {
const placeholderMap = {
'资质情况': '2020年通过IATF16949 汽车质量管理体系认证IATF证书编号0368475CASC证书编号2020A069/四川永星目前有二筛条件已经拿到CANS认证可以对电阻器进行二筛。',
'人员情况': '893厂现有员工900余人在全国设立6个办事处/云科成都办事处有五人,负责成都、绵阳、重庆,对接凯天的是罗晓波',
'产品种类(新研制产品、主推产品)': '云科已申请RN5161系列进入SAST-G目录目前尚未完成进目录工作。/云科2022年薄膜电路产品上市。',
'近三年销售情况': '2021年云科销售浆料8亿元/1、云科一年在隆盛的电阻销售额在200万左右保险丝的销售额也在200万左右。2、云科一季度在607所的销售额大概在150万左右',
'市场组织架构': '1、云科市场部新上任一位领导与九院13所领导副所长关系密切2、西安办事处新换办事处主任杨文建是振华集团领导的亲属3、云科北京片区今年更换领导是从振华富调过去的并且把原来负责九院的业务员吴明金撤了更换了新的业务员1、振华云科的河南地区新增一位业务员胡心圣。2、佰威达的老板是施广勤同时也是博威的老板。',
'市场策略': '1、外围进攻通过熔断器、射频等产品抢占常规电阻器份额例如中航工业金城南京机电液压工程研究中心云科的片阻已有少量供货。2、盯住高价值产品抢占我们高价值产品合金箔、熔断器、射频的最主要客户的市场份额例如九院16所、兵器212所但目前仍未得手。低价策略风华和火炬今年想以低价策略进驻抢占份额。目前普军级F精度报价0.5J精度报价0.2。',
'竞争对手变化产生的市场机会': '893将一部分股份卖给北海银河银河快倒闭时改行做医药行业不景气',
'其他': '请输入其他补充信息',
'质量问题': '在核九院五所云科产品出现批次性硫化问题云科及时处理用抗硫化产品做了替代。893在梅岭说我司08年质量问题基础采购员都知道了这个情况说不敢选择我司火工品。目前常规片式产品普军等级云科与我司均为8毛893报6毛未选择他们。',
'重大市场活动': '云科在航天五院举办党建活动',
'市场占有率': '云科在航天领域的市场占有率为30%信息来源是XXX)/振华云科在航天航空的份额占比大概在60%,大都基于领导层的关系基础,几乎不会来司拜访用户。',
'与客户人员的关系': '振华集团高层跟118厂高层关系很好有时会来上海组织联谊活动/青岛整流器制造有限公司有云科内线,了解我公司价格。',
'竞争动向': '中电科技集团重庆声光电有限公司的106项目893中标/云科最近一次竞标常规国军标0.55元/只单一规格用量60万只)D精度厚膜0.9元/只(2个规格共20万只),通过这次竞标得到三个单一规格电阻的采购。'
}
return placeholderMap[formData.value.competitorLevelTwo] || '请输入具体信息'
})
const competitiveUnitsIndex = ref(0)
// 当前选中的信息类型
const competitorLevelOneIndex = ref(0)
const competitorLevelOne = ref('基本信息')
// 当前选中的具体分类索引
const competitorLevelTwoIndex = ref(0)
// 当前显示的具体分类选项数组(动态切换 array2 / array3
const currentCompetitorLevelTwoArray = ref(array2.value)
// 当前选中的具体分类名称
const competitorLevelTwo = ref('')
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onCompetitiveUnitsChange = (e) => {
competitiveUnitsIndex.value = e.detail.value
console.log('competitiveUnitsIndex:', array.value[e.detail.value]?.name)
formData.value.competitiveUnits = array.value[e.detail.value]?.name || ''
}
const onCompetitorLevelOneChange = (e) => {
if (e.detail.value >= 0 && e.detail.value < array1.value.length) {
competitorLevelOneIndex.value = e.detail.value
} else {
console.error('选择了无效的索引,重置为 0')
competitorLevelOneIndex.value = 0
}
const selectedType = array1.value[e.detail.value]?.name
console.log('选中的信息类型:', selectedType)
formData.value.competitorLevelOne = selectedType
if (selectedType === '基本信息') {
currentCompetitorLevelTwoArray.value = array2.value
competitorLevelTwoIndex.value = 0
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[0]?.name || ''
} else if (selectedType === '业务信息') {
currentCompetitorLevelTwoArray.value = array3.value
competitorLevelTwoIndex.value = 0
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[0]?.name || ''
} else {
currentCompetitorLevelTwoArray.value = []
formData.value.competitorLevelTwo = ''
}
}
const onCompetitorLevelTwoChange = (e) => {
competitorLevelTwoIndex.value = e.detail.value
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[e.detail.value]?.name || ''
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,500 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'竞争对手信息添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<!-- <uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item> -->
<uni-forms-item label="竞争单位" name="competitiveUnits" class="f-c-right">
<picker @change="onCompetitiveUnitsChange" :value="competitiveUnitsIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[competitiveUnitsIndex]?.name || '请选择竞争单位' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="信息类型" name="competitorLevelOne" class="f-c-right">
<picker @change="onCompetitorLevelOneChange" :value="competitorLevelOne" :range="array1"
:range-key="'name'">
<view class="picker">
{{ array1[competitorLevelOneIndex]?.name || '请选择信息类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="具体分类" name="competitorLevelTwo" class="f-c-right">
<picker
@change="onCompetitorLevelTwoChange"
:value="competitorLevelTwoIndex"
:range="currentCompetitorLevelTwoArray"
:range-key="'name'"
>
<view class="picker">
{{ currentCompetitorLevelTwoArray[competitorLevelTwoIndex]?.name || '请选择具体分类' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="具体信息" name="specificMatters" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.specificMatters" :placeholder="dynamicPlaceholder"
class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete
} from '@/api/crm/api_ys.js'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
import { onLoad } from '@dcloudio/uni-app'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
competitiveUnits: "振华云科", //竞争对手
competitorLevelOne: "基本信息", //竞争对手一级标签
competitorLevelTwo: "", //竞争对手二级标签
specificMatters: "", //具体事情
remark: "", //、备注
picture: "", //、图片
informationType: "竞争对手信息" //信息类型
})
// 表单验证规则
const rules = {
competitiveUnits: {
rules: [{
required: true,
errorMessage: '请选择竞争单位'
}]
},
competitorLevelOne: {
rules: [{
required: true,
errorMessage: '请选择信息类型'
}]
},
competitorLevelTwo: {
rules: [{
required: true,
errorMessage: '请选择具体分类'
}]
},
specificMatters: {
rules: [{
required: true,
errorMessage: '请输入具体信息'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '振华云科'
},
{
id: 1,
name: '四川永星'
},
{
id: 2,
name: '风华邦科'
},
{
id: 3,
name: '株洲宏达'
},
{
id: 4,
name: '福建火炬'
},
{
id: 5,
name: '福建毫米'
},
{
id: 6,
name: '广州创天'
},
{
id: 7,
name: '贝迪斯'
},
{
id: 8,
name: '禹龙通电子'
},
{
id: 9,
name: '成都昊天'
},
{
id: 10,
name: '风华特种'
},
{
id: 11,
name: '济宁正和'
},
{
id: 12,
name: '盛世'
},
{
id: 13,
name: '广东意杰'
},
{
id: 14,
name: '西安威特'
},
{
id: 15,
name: '盛雷城'
},
{
id: 16,
name: '广东福德'
},
{
id: 17,
name: '咸阳智联'
},
{
id: 18,
name: '安徽来福'
},
{
id: 19,
name: '国巨'
},
{
id: 20,
name: '开步电子'
},
{
id: 21,
name: '成都宏鸣'
},
{
id: 22,
name: '其他'
},
])
const array1 = ref([{
id: 0,
name: '基本信息'
},
{
id: 1,
name: '业务信息'
},
])
const array2 = ref([{
id: 0,
name: '资质情况'
},
{
id: 1,
name: '人员情况'
},
{
id: 2,
name: '产品种类(新研制产品、主推产品)'
},
{
id: 3,
name: '近三年销售情况'
},
{
id: 4,
name: '市场组织架构'
},
{
id: 5,
name: '市场策略'
},
{
id: 6,
name: '竞争对手变化产生的市场机会'
},
{
id: 7,
name: '其他'
},
])
const array3 = ref([{
id: 0,
name: '质量问题'
},
{
id: 1,
name: '重大市场活动'
},
{
id: 2,
name: '市场占有率'
},
{
id: 3,
name: '与客户人员的关系'
},
{
id: 4,
name: '竞争动向'
},
{
id: 5,
name: '其他'
},
])
const dynamicPlaceholder = computed(() => {
const placeholderMap = {
'资质情况': '2020年通过IATF16949 汽车质量管理体系认证IATF证书编号0368475CASC证书编号2020A069/四川永星目前有二筛条件已经拿到CANS认证可以对电阻器进行二筛。',
'人员情况': '893厂现有员工900余人在全国设立6个办事处/云科成都办事处有五人,负责成都、绵阳、重庆,对接凯天的是罗晓波',
'产品种类(新研制产品、主推产品)': '云科已申请RN5161系列进入SAST-G目录目前尚未完成进目录工作。/云科2022年薄膜电路产品上市。',
'近三年销售情况': '2021年云科销售浆料8亿元/1、云科一年在隆盛的电阻销售额在200万左右保险丝的销售额也在200万左右。2、云科一季度在607所的销售额大概在150万左右',
'市场组织架构': '1、云科市场部新上任一位领导与九院13所领导副所长关系密切2、西安办事处新换办事处主任杨文建是振华集团领导的亲属3、云科北京片区今年更换领导是从振华富调过去的并且把原来负责九院的业务员吴明金撤了更换了新的业务员1、振华云科的河南地区新增一位业务员胡心圣。2、佰威达的老板是施广勤同时也是博威的老板。',
'市场策略': '1、外围进攻通过熔断器、射频等产品抢占常规电阻器份额例如中航工业金城南京机电液压工程研究中心云科的片阻已有少量供货。2、盯住高价值产品抢占我们高价值产品合金箔、熔断器、射频的最主要客户的市场份额例如九院16所、兵器212所但目前仍未得手。低价策略风华和火炬今年想以低价策略进驻抢占份额。目前普军级F精度报价0.5J精度报价0.2。',
'竞争对手变化产生的市场机会': '893将一部分股份卖给北海银河银河快倒闭时改行做医药行业不景气',
'其他': '请输入其他补充信息',
'质量问题': '在核九院五所云科产品出现批次性硫化问题云科及时处理用抗硫化产品做了替代。893在梅岭说我司08年质量问题基础采购员都知道了这个情况说不敢选择我司火工品。目前常规片式产品普军等级云科与我司均为8毛893报6毛未选择他们。',
'重大市场活动': '云科在航天五院举办党建活动',
'市场占有率': '云科在航天领域的市场占有率为30%信息来源是XXX)/振华云科在航天航空的份额占比大概在60%,大都基于领导层的关系基础,几乎不会来司拜访用户。',
'与客户人员的关系': '振华集团高层跟118厂高层关系很好有时会来上海组织联谊活动/青岛整流器制造有限公司有云科内线,了解我公司价格。',
'竞争动向': '中电科技集团重庆声光电有限公司的106项目893中标/云科最近一次竞标常规国军标0.55元/只单一规格用量60万只)D精度厚膜0.9元/只(2个规格共20万只),通过这次竞标得到三个单一规格电阻的采购。'
}
return placeholderMap[formData.value.competitorLevelTwo] || '请输入具体信息'
})
const competitiveUnitsIndex = ref(0)
// 当前选中的信息类型
const competitorLevelOneIndex = ref(0)
const competitorLevelOne = ref('基本信息')
// 当前选中的具体分类索引
const competitorLevelTwoIndex = ref(0)
// 当前显示的具体分类选项数组(动态切换 array2 / array3
const currentCompetitorLevelTwoArray = ref(array2.value)
// 当前选中的具体分类名称
const competitorLevelTwo = ref('')
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onCompetitiveUnitsChange = (e) => {
competitiveUnitsIndex.value = e.detail.value
console.log('competitiveUnitsIndex:', array.value[e.detail.value]?.name)
formData.value.competitiveUnits = array.value[e.detail.value]?.name || ''
}
const onCompetitorLevelOneChange = (e) => {
if (e.detail.value >= 0 && e.detail.value < array1.value.length) {
competitorLevelOneIndex.value = e.detail.value
} else {
console.error('选择了无效的索引,重置为 0')
competitorLevelOneIndex.value = 0
}
const selectedType = array1.value[e.detail.value]?.name
console.log('选中的信息类型:', selectedType)
formData.value.competitorLevelOne = selectedType
if (selectedType === '基本信息') {
currentCompetitorLevelTwoArray.value = array2.value
competitorLevelTwoIndex.value = 0
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[0]?.name || ''
} else if (selectedType === '业务信息') {
currentCompetitorLevelTwoArray.value = array3.value
competitorLevelTwoIndex.value = 0
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[0]?.name || ''
} else {
currentCompetitorLevelTwoArray.value = []
formData.value.competitorLevelTwo = ''
}
}
const onCompetitorLevelTwoChange = (e) => {
competitorLevelTwoIndex.value = e.detail.value
formData.value.competitorLevelTwo = currentCompetitorLevelTwoArray.value[e.detail.value]?.name || ''
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete(formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,227 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'重点型号任务信息添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="重点型号" name="keyModels" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.keyModels"
placeholder="请输入重点型号" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="目前状态" name="currentStatus" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.currentStatus"
placeholder="请输入目前状态" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="批产计划" name="batchProductionPlan" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.batchProductionPlan"
placeholder="请输入批产计划" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="外协、外包、上级单位情况" name="situationOfSuperiorUnits" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.situationOfSuperiorUnits"
placeholder="请输入外协、外包、上级单位情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="下级配套单位" name="lowerLevelSupportingUnits" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.lowerLevelSupportingUnits"
placeholder="请输入下级配套单位" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd
} from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
keyModels: null,//重点型号
currentStatus: null,//目前状态
batchProductionPlan: null,//批产计划
situationOfSuperiorUnits: null,//外协、外包、上级单位情况
lowerLevelSupportingUnits: null,//下级配套单位
remark: "", //、备注
informationType:"重点型号任务信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
keyModels: {
rules: [{
required: true,
errorMessage: '请输入重点型号'
}]
},
currentStatus: {
rules: [{
required: true,
errorMessage: '请输入目前状态'
}]
},
batchProductionPlan: {
rules: [{
required: true,
errorMessage: '请输入批产计划'
}]
},
situationOfSuperiorUnits: {
rules: [{
required: true,
errorMessage: '请输入外协、外包、上级单位情况'
}]
},
lowerLevelSupportingUnits: {
rules: [{
required: true,
errorMessage: '请输入下级配套单位'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,267 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'重点型号任务信息修改'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="重点型号" name="keyModels" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.keyModels"
placeholder="请输入重点型号" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="目前状态" name="currentStatus" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.currentStatus"
placeholder="请输入目前状态" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="批产计划" name="batchProductionPlan" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.batchProductionPlan"
placeholder="请输入批产计划" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="外协、外包、上级单位情况" name="situationOfSuperiorUnits" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.situationOfSuperiorUnits"
placeholder="请输入外协、外包、上级单位情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="下级配套单位" name="lowerLevelSupportingUnits" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.lowerLevelSupportingUnits"
placeholder="请输入下级配套单位" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete
} from '@/api/crm/api_ys.js'
import { onLoad } from '@dcloudio/uni-app'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
keyModels: null,//重点型号
currentStatus: null,//目前状态
batchProductionPlan: null,//批产计划
situationOfSuperiorUnits: null,//外协、外包、上级单位情况
lowerLevelSupportingUnits: null,//下级配套单位
remark: "", //、备注
informationType:"重点型号任务信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
keyModels: {
rules: [{
required: true,
errorMessage: '请输入重点型号'
}]
},
currentStatus: {
rules: [{
required: true,
errorMessage: '请输入目前状态'
}]
},
batchProductionPlan: {
rules: [{
required: true,
errorMessage: '请输入批产计划'
}]
},
situationOfSuperiorUnits: {
rules: [{
required: true,
errorMessage: '请输入外协、外包、上级单位情况'
}]
},
lowerLevelSupportingUnits: {
rules: [{
required: true,
errorMessage: '请输入下级配套单位'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete(formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,262 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'重大事项添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="重大事项类型" name="opportunityType" class="f-c-right">
<picker @change="onOpportunityTypeChange" :value="opportunityTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[opportunityTypeIndex]?.name || '请选择重大事项类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="了解途径" name="understandTheWay" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.understandTheWay"
placeholder="请输入了解途径" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="产生的影响" name="theImpactGenerated" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.theImpactGenerated"
placeholder="请输入产生的影响" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="公司应对策略" name="companyResponseStrategy" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.companyResponseStrategy"
placeholder="请输入公司应对策略" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd
} from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
majorTypesOfMatters: "", //重大事项类型
understandTheWay: "", //了解途径
theImpactGenerated: "", //、产生的影响
companyResponseStrategy: "", //、公司应对策略
remark: "", //、备注
picture: "", //、图片
photos: null,
informationType: "重大事项信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
majorTypesOfMatters: {
rules: [{
required: true,
errorMessage: '请选择重大事项类型'
}]
},
understandTheWay: {
rules: [{
required: true,
errorMessage: '请输入了解途径'
}]
},
theImpactGenerated: {
rules: [{
required: true,
errorMessage: '请输入产生的影响'
}]
},
companyResponseStrategy: {
rules: [{
required: true,
errorMessage: '请输入公司应对策略'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '质量问题'
},
{
id: 1,
name: '客户重大变更'
},
{
id: 2,
name: '行业重大事项'
}
])
const form = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
const opportunityTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
// 如果你原来在 onShow 中做了类似这样:
// let res = currPage.data.cusData; 判断是否传入了客户信息
// 那么在 Vue3 中通常是通过路由参数或者 Vuex/Pinia 等状态管理获取
// 暂时不做,如你后续需要可继续补充
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,300 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'重大事项修改'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="重大事项类型" name="opportunityType" class="f-c-right">
<picker @change="onOpportunityTypeChange" :value="opportunityTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[opportunityTypeIndex]?.name || '请选择重大事项类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="了解途径" name="understandTheWay" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.understandTheWay"
placeholder="请输入了解途径" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="产生的影响" name="theImpactGenerated" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.theImpactGenerated"
placeholder="请输入产生的影响" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="公司应对策略" name="companyResponseStrategy" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.companyResponseStrategy"
placeholder="请输入公司应对策略" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import { onLoad } from '@dcloudio/uni-app'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete
} from '@/api/crm/api_ys.js'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
majorTypesOfMatters: "", //重大事项类型
understandTheWay: "", //了解途径
theImpactGenerated: "", //、产生的影响
companyResponseStrategy: "", //、公司应对策略
remark: "", //、备注
picture: "", //、图片
photos: null,
informationType: "重大事项信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
majorTypesOfMatters: {
rules: [{
required: true,
errorMessage: '请选择重大事项类型'
}]
},
understandTheWay: {
rules: [{
required: true,
errorMessage: '请输入了解途径'
}]
},
theImpactGenerated: {
rules: [{
required: true,
errorMessage: '请输入产生的影响'
}]
},
companyResponseStrategy: {
rules: [{
required: true,
errorMessage: '请输入公司应对策略'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '质量问题'
},
{
id: 1,
name: '客户重大变更'
},
{
id: 2,
name: '行业重大事项'
}
])
const form = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
const opportunityTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete (formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,482 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'市场信息管理'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="handleAdd">
<uni-icons type="plus" size="24" color="#B7D2FF"></uni-icons>新增
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
<!-- 正文内容 -->
<view class="all-body market-con">
<view class="nav-list">
<view class="nav-item" :class="{active:index==activeTab}" v-for="(item,index) in tabList"
:key="index" @click="handleNav(index)">{{ item }}</view>
</view>
<!-- 分页部分 -->
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff"
class="scroll-h" :class="{'loading-scroll':cssFlag}">
<!-- 市场机会信息 -->
<block v-if="activeTab === 0">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index"
@click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.cusName }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini" @click="itemView(item)">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">机会类型:{{item.opportunityType}}
</view>
<view class="font-bold" style="padding-bottom:10rpx">
机会所处状态:{{item.opportunityStatus}}</view>
<!-- <view class="font-gray">{{ item.desc }}</view>灰色样式 -->
</view>
</view>
</view>
</block>
<!-- 重大事项信息 -->
<block v-if="activeTab === 1">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.cusName }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">
产生的影响:{{item.theImpactGenerated}}</view>
<view class="font-bold" style="padding-bottom:10rpx">
重大事项类型:{{item.majorTypesOfMatters}}</view>
<!-- <view class="font-gray">{{ item.desc }}</view> -->
</view>
</view>
</view>
</block>
<!-- 竞争对手信息 -->
<block v-if="activeTab === 2">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.competitiveUnits }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">
竞争对手一级标签:{{item.competitorLevelOne}}</view>
<view class="font-bold" style="padding-bottom:10rpx">
竞争对手二级标签:{{item.competitorLevelTwo}}</view>
<!-- <view class="font-gray">{{ item.desc }}</view> -->
</view>
</view>
</view>
</block>
<!-- 人员变化信息 -->
<block v-if="activeTab === 3">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.cusName }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">客户人员名称:{{item.cusUserName}}
</view>
<view class="font-bold" style="padding-bottom:10rpx">原职务:{{item.originalPosition}}
</view>
<view class="font-bold" style="padding-bottom:10rpx">现职务:{{item.currentPosition}}
</view>
<!-- <view class="font-gray">{{ item.desc }}</view> -->
</view>
</view>
</view>
</block>
<!-- 重点型号任务信息 -->
<block v-if="activeTab === 4">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.cusName }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">重点型号:{{item.keyModels}}</view>
<view class="font-bold" style="padding-bottom:10rpx">目前状态:{{item.currentStatus}}
</view>
<view class="font-gray">{{ item.desc }}</view>
</view>
</view>
</view>
</block>
<!-- 通用表单 -->
<block v-if="activeTab === 5">
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="itemClick(item)">
<view class="report-list">
<view class="title r-list">
<view class="r-left" style="font-size:38rpx;">{{ item.cusName }}</view>
<view class="r-right btn-gray flex-auto" :class="{'btn-blue':item.status==2}"
size="mini">{{ item.state }}</view>
</view>
<view style="padding:0rpx 0 10rpx">
<view class="font-bold" style="padding-bottom:10rpx">标签:{{item.generalFormType}}
</view>
<view class="font-gray">内容:{{ item.informationContent }}</view>
</view>
</view>
</view>
</block>
</mescroll-uni>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import {
getNavBarPaddingTop
} from '@/utils/system.js'
import {
mattersList
} from '@/api/business.js'
import {
CrmMarketInformationList,
handleCrmMarketInfo
} from '@/api/crm/api_ys.js'
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})
const mescrollInstance = ref(null);
const activeTab = ref(0); // 默认市场机会
const tabList = ['市场机会', '重大事项信息', '竞争对手信息', '人员变化信息', '重点型号任务信息', '通用表单'];
let handleNav = (index) => {
console.log(index + " 切换列表");
activeTab.value = index;
// 先重置列表(可选,避免新旧数据混在一起)
list.value = [];
// 手动触发 mescroll 下拉刷新,重新加载当前 tab 的数据
if (mescrollInstance.value) {
mescrollInstance.value.triggerDownScroll(); // 关键!触发下拉刷新,会调用 downCallback
}
}
// 新增
let handleAdd = () => {
if (activeTab.value == 0) {
console.log("市场机会")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/marketOpportunities'
})
} else if (activeTab.value == 1) {
console.log("重大机会事项")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/majorMatter'
})
} else if (activeTab.value == 2) {
console.log("竞争对手信息")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/competitor'
})
} else if (activeTab.value == 3) {
console.log("人员变化信息")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/personnelChanges'
})
} else if (activeTab.value == 4) {
console.log("重点型号任务信息")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/keyModelTasks'
})
} else if (activeTab.value == 5) {
console.log("通用表单")
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/beCurrent'
})
} else {
console.log("其他?")
}
// uni.navigateTo({ url: '/pages/business/CRM/visitorReportAdd' })
}
// 查询列表
let list = ref([]);
const mescrollRef = ref(null);
const upOption = ref({
page: {
num: 0,
size: 10
},
noMoreSize: 5,
empty: {
tip: '~ 空空如也 ~'
},
textLoading: '加载中...',
textNoMore: '已经到底了'
});
const downOption = ref({
auto: true,
textInOffset: '下拉刷新',
textOutOffset: '释放更新',
textLoading: '刷新中...'
});
let cssFlag = ref(false); //控制样式
const mescrollInit = (mescroll) => {
cssFlag.value = true;
mescrollRef.value = mescroll;
mescrollInstance.value = mescroll;
};
// 下拉刷新
const downCallback = async (mescroll) => {
try {
const pageNo = 1;
const pageSize = upOption.value.size;
const type = activeTab.value + 1; // 当前tab索引
const description = tabList[activeTab.value]; // 当前tab文字
const res = await getCrmMarketInformationList(pageNo, pageSize, type, description);
list.value = res.list;
mescroll.resetUpScroll();
} catch (error) {
mescroll.endErr();
} finally {
mescroll.endSuccess();
}
}
// 上拉加载更多
const upCallback = async (mescroll) => {
try {
const pageNo = mescroll.num;
const pageSize = mescroll.size;
const type = activeTab.value; // 当前tab索引
const description = tabList[activeTab.value]; // 当前tab文字
const res = await getCrmMarketInformationList(pageNo, pageSize, type, description);
if (mescroll.num === 1) {
list.value = res.list;
} else {
list.value.push(...res.list);
}
mescroll.endBySize(res.list.length, res.total);
} catch (error) {
mescroll.endErr();
}
}
// 获取数据列表
const getCrmMarketInformationList = async (pageNo, pageSize, type, description) => {
const param = {
pageNo,
pageSize,
type,
description
};
const res = await CrmMarketInformationList(param);
return {
list: res.rows,
total: res.total
};
}
const itemView = async (item) => {
const state = (item.state || "").trim().toLowerCase()
if (state === "待提交" || state === "驳回") {
uni.showModal({
title: '操作确认',
content: '是否为商业航天行业板块信息?',
confirmText: '是',
cancelText: '否',
success: async (res) => {
if (res.confirm) {
item.commercialAerospace = "是"
try {
const res = await handleCrmMarketInfo(item)
if (res.code == 200) {
uni.showToast({
title: '提交成功',
duration: 2000
})
} else {
uni.showToast({
title: res.msg || '操作失败',
icon: 'none'
})
}
reload()
} catch {
uni.showToast({
title: '提交失败,请重试',
icon: 'none'
})
}
} else if (res.cancel) {
item.commercialAerospace = "否"
try {
const res = await handleCrmMarketInfo(item)
if (res.code == 200) {
uni.showToast({
title: '提交成功',
duration: 2000
})
} else {
uni.showToast({
title: res.msg || '操作失败',
icon: 'none'
})
}
reload()
} catch {
uni.showToast({
title: '提交失败,请重试',
icon: 'none'
})
}
}
}
})
} else {
uni.showToast({
title: "当前状态不可操作",
icon: "none",
duration: 2000
})
}
}
const itemClick = async (item) => {
if(item.informationType=='市场机会'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/marketOpportunitiesDetail?informationId='+ item.informationId
})
}else if(item.informationType=='重大事项信息'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/majorMatterDetail?informationId='+ item.informationId
})
}else if(item.informationType=='竞争对手信息'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/competitorDetail?informationId='+ item.informationId
})
}else if(item.informationType=='人员变化信息'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/personnelChangesDetail?informationId='+ item.informationId
})
}else if(item.informationType=='重点型号任务信息'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/keyModelTasksDetail?informationId='+ item.informationId
})
}else if(item.informationType=='通用表单'){
uni.navigateTo({
url: '/pages/business/CRM/marketInformation/beCurrentDetail?informationId='+ item.informationId
})
}
else{
console.log("其他")
}
// console.log(item)
// uni.navigateTo({ url: '/pages/business/CRM/visitorReportAdd' })
}
</script>
<style scoped>
.all-body {
/* #ifdef APP-PLUS */
top: 88rpx;
height: calc(100vh - 44px);
/* #endif */
/* #ifndef APP-PLUS */
top: 100rpx;
height: calc(100vh - 48px);
/* #endif */
}
/*.market-con{
} */
.nav-list {
display: flex;
flex-wrap: wrap;
/* #ifdef APP-PLUS */
padding: 80rpx 30rpx 0;
/* #endif */
/* #ifndef APP-PLUS */
padding: 20rpx 30rpx 0;
/* #endif */
}
.nav-list .nav-item {
background-color: #05A3F4;
border-radius: 10rpx;
color: #FFFFFF;
font-size: 28rpx;
text-align: center;
padding: 10rpx 25rpx;
margin-right: 15rpx;
margin-bottom: 20rpx;
}
.nav-list .nav-item:nth-child(3n) {
margin-right: 0;
}
.nav-list .nav-item.active {
background-color: #fff;
color: #3384DF;
font-weight: bold;
}
.report-list .r-list {
align-items: flex-start;
}
.scroll-h {
/* #ifdef APP-PLUS */
height: calc(100vh - 155px);
/* #endif */
/* #ifndef APP-PLUS */
height: calc(100vh - 135px);
/* #endif */
}
.white-bg {
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.report-list .title {
display: flex;
}
</style>

View File

@@ -0,0 +1,337 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'市场机会添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view
@click="chooseCustomer"
class="form-item-container"
>
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="机会类型" name="opportunityType" class="f-c-right">
<picker @change="onOpportunityTypeChange" :value="opportunityTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[opportunityTypeIndex]?.name || '请选择机会类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="了解途径" name="understandTheWay" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.understandTheWay"
placeholder="请输入了解途径" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="机会描述" name="opportunityDescription" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.opportunityDescription"
placeholder="请输入机会描述" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="机会所处状态" name="opportunityStatus" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.opportunityStatus"
placeholder="请输入机会所处状态" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="预测金额情况" name="predictedAmount" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.predictedAmount"
placeholder="请输入预测金额或情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="竞争情况" name="competitionSituation" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.competitionSituation"
placeholder="请输入竞争情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark"
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref, onMounted, reactive, onUnmounted, computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import { isEmpty } from '@/utils/validate.js'
import {crmMarketInformationAdd } from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
opportunityType: {
rules: [{
required: true,
errorMessage: '请选择机会类型'
}]
},
understandTheWay: {
rules: [{
required: true,
errorMessage: '请输入了解途径'
}]
},
opportunityDescription: {
rules: [{
required: true,
errorMessage: '请输入机会描述'
}]
},
opportunityStatus: {
rules: [{
required: true,
errorMessage: '请输入机会所处状态'
}]
},
predictedAmount: {
rules: [{
required: true,
errorMessage: '请输入预测金额或情况'
}]
},
competitionSituation: {
rules: [{
required: true,
errorMessage: '请输入竞争情况'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '新产品需求'
},
{
id: 1,
name: '新客户开发'
},
{
id: 2,
name: '批产任务'
},
{
id: 3,
name: '新研任务'
},
{
id: 4,
name: '二筛服务'
},
{
id: 5,
name: '对手失利'
},
{
id: 6,
name: '其它'
}
])
const form = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// picker 选项
const opportunityTypeOptions = ref([{
id: 0,
name: '新产品需求'
},
{
id: 1,
name: '新客户开发'
},
{
id: 2,
name: '批产任务'
},
{
id: 3,
name: '新研任务'
},
{
id: 4,
name: '二筛服务'
},
{
id: 5,
name: '对手失利'
},
{
id: 6,
name: '其它'
}
])
const opportunityTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer(){
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
console.log("收到客户数据的值:", customerUser)
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
// TODO: 在这里添加提交到后端的逻辑,比如调用 api.CrmMarketInformationAdd(formData.value)
// 暂时只做校验提示
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
// 如果你原来在 onShow 中做了类似这样:
// let res = currPage.data.cusData; 判断是否传入了客户信息
// 那么在 Vue3 中通常是通过路由参数或者 Vuex/Pinia 等状态管理获取
// 暂时不做,如你后续需要可继续补充
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,364 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'市场机会修改'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view
@click="chooseCustomer"
class="form-item-container"
>
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="机会类型" name="opportunityType" class="f-c-right">
<picker @change="onOpportunityTypeChange" :value="opportunityTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[opportunityTypeIndex]?.name || '请选择机会类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="了解途径" name="understandTheWay" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.understandTheWay"
placeholder="请输入了解途径" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="机会描述" name="opportunityDescription" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.opportunityDescription"
placeholder="请输入机会描述" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="机会所处状态" name="opportunityStatus" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.opportunityStatus"
placeholder="请输入机会所处状态" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="预测金额情况" name="predictedAmount" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.predictedAmount"
placeholder="请输入预测金额或情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="竞争情况" name="competitionSituation" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.competitionSituation"
placeholder="请输入竞争情况" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark"
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref, onMounted, reactive, onUnmounted, computed ,watch
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import { isEmpty } from '@/utils/validate.js'
import { onLoad } from '@dcloudio/uni-app'
import {crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete } from '@/api/crm/api_ys.js'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
const message = useMessage();
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
opportunityType: {
rules: [{
required: true,
errorMessage: '请选择机会类型'
}]
},
understandTheWay: {
rules: [{
required: true,
errorMessage: '请输入了解途径'
}]
},
opportunityDescription: {
rules: [{
required: true,
errorMessage: '请输入机会描述'
}]
},
opportunityStatus: {
rules: [{
required: true,
errorMessage: '请输入机会所处状态'
}]
},
predictedAmount: {
rules: [{
required: true,
errorMessage: '请输入预测金额或情况'
}]
},
competitionSituation: {
rules: [{
required: true,
errorMessage: '请输入竞争情况'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '新产品需求'
},
{
id: 1,
name: '新客户开发'
},
{
id: 2,
name: '批产任务'
},
{
id: 3,
name: '新研任务'
},
{
id: 4,
name: '二筛服务'
},
{
id: 5,
name: '对手失利'
},
{
id: 6,
name: '其它'
}
])
const form = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// picker 选项
const opportunityTypeOptions = ref([{
id: 0,
name: '新产品需求'
},
{
id: 1,
name: '新客户开发'
},
{
id: 2,
name: '批产任务'
},
{
id: 3,
name: '新研任务'
},
{
id: 4,
name: '二筛服务'
},
{
id: 5,
name: '对手失利'
},
{
id: 6,
name: '其它'
}
])
const opportunityTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer(){
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
console.log("收到客户数据的值:", customerUser)
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete (formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,334 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'人员变化添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="客户人员" name="cusUserName" class="f-c-right">
<uni-easyinput v-model="formData.cusUserName" placeholder="请选择客户人员" name="input"
@focus="chooseClientUser"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="原职务" name="originalPosition" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.originalPosition"
placeholder="请输入原职务" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="现职务" name="currentPosition" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.currentPosition"
placeholder="请输入现职务" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="现职务是否与我司业务相关" name="positionOfOurCompany" class="f-c-right">
<picker @change="onpoSitionOfOurCompanyChange" :value="positionOfOurCompanyIndex"
:range="array" :range-key="'name'">
<view class="picker">
{{ array[positionOfOurCompanyIndex]?.name || '请选择机会类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="公关力度" name="developmentEfforts" class="f-c-right">
<picker @change="onDevelopmentEffortsChange" :value="developmentEffortsIndex"
:range="array1" :range-key="'name'">
<view class="picker">
{{ array1[developmentEffortsIndex]?.name || '请选择公关力度' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="继任者" name="successor" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.successor" placeholder="请输入继任者"
class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import cache from '@/utils/cache'
import { onShow, onUnload } from '@dcloudio/uni-app';
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd
} from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
cusUserName: null, //客户人员名称
originalPosition: null, //原职务
currentPosition: null, //现职务
positionOfOurCompany: '是', //现职务是否与我公司业务相关
developmentEfforts: '加强', //攻关力度
successor: null, //继任者
remark: "", //、备注
picture: "", //、图片
photos: null,
cusPersonnel: '',
informationType: "人员变化信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
cusUserName: {
rules: [{
required: true,
errorMessage: '请选择客户人员'
}]
},
originalPosition: {
rules: [{
required: true,
errorMessage: '请输入原职务'
}]
},
currentPosition: {
rules: [{
required: true,
errorMessage: '请输入现职务'
}]
},
positionOfOurCompany: {
rules: [{
required: true,
errorMessage: '请选择现职务是否与我公司业务相关'
}]
},
developmentEfforts: {
rules: [{
required: true,
errorMessage: '请选择公关力度'
}]
},
successor: {
rules: [{
required: true,
errorMessage: '请输入继任者'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '是'
},
{
id: 1,
name: '否'
}
])
const array1 = ref([{
id: 0,
name: '加强'
},
{
id: 1,
name: '维持'
},
{
id: 2,
name: '减弱'
}
])
const opportunityTypeIndex = ref(0)
const positionOfOurCompanyIndex = ref(0)
const developmentEffortsIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
console.log("收到客户数据的值:", customerUser)
}
//选择客户人员
function chooseClientUser() {
console.log('点击了输入框', formData.value.cusName);
uni.navigateTo({
url: '/pages/business/CRM/customerUserList?cusName=' + formData.value.cusName
})
}
//页面渲染完成后查询catch的get
onShow(() => {
if (cache.get('checkedRCClientList') != null && cache.get('checkedRCClientList') != []) {
formData.value.cusUserName = cache.get('checkedRCClientList')
}
})
//页面卸载之后,删除缓存信息
onUnload(() => {
handleDeleteLocal()
})
//删除缓存
let handleDeleteLocal = () => {
cache.remove('checkedRCClientList');
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const cusUserName1 = formData.value.cusUserName;
const stringOfNames = cusUserName1.join(",")
formData.value.cusUserName = stringOfNames
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log('表单数据:', formData.value)
// TODO: 在这里添加提交到后端的逻辑,比如调用 api.CrmMarketInformationAdd(formData.value)
// 暂时只做校验提示
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
const onpoSitionOfOurCompanyChange = (e) => {
positionOfOurCompanyIndex.value = e.detail.value
console.log('positionOfOurCompanyIndex:', array.value[e.detail.value]?.name)
formData.value.positionOfOurCompany = array.value[e.detail.value]?.name || ''
}
const onDevelopmentEffortsChange = (e) => {
developmentEffortsIndex.value = e.detail.value
console.log('developmentEffortsIndex:', array1.value[e.detail.value]?.name)
formData.value.opportunityType = array1.value[e.detail.value]?.name || ''
}
// 如果你原来在 onShow 中做了类似这样:
// let res = currPage.data.cusData; 判断是否传入了客户信息
// 那么在 Vue3 中通常是通过路由参数或者 Vuex/Pinia 等状态管理获取
// 暂时不做,如你后续需要可继续补充
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -0,0 +1,369 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'人员变化添加'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="客户名称" name="cusName" class="f-c-right">
<view @click="chooseCustomer" class="form-item-container">
<text class="name">{{ formData.cusName || '点击选择客户' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="客户人员" name="cusUserName" class="f-c-right">
<uni-easyinput v-model="formData.cusUserName" placeholder="请选择客户人员" name="input"
@focus="chooseClientUser"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="原职务" name="originalPosition" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.originalPosition"
placeholder="请输入原职务" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="现职务" name="currentPosition" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.currentPosition"
placeholder="请输入现职务" class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="现职务是否与我司业务相关" name="positionOfOurCompany" class="f-c-right">
<picker @change="onpoSitionOfOurCompanyChange" :value="positionOfOurCompanyIndex"
:range="array" :range-key="'name'">
<view class="picker">
{{ array[positionOfOurCompanyIndex]?.name || '请选择机会类型' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="公关力度" name="developmentEfforts" class="f-c-right">
<picker @change="onDevelopmentEffortsChange" :value="developmentEffortsIndex"
:range="array1" :range-key="'name'">
<view class="picker">
{{ array1[developmentEffortsIndex]?.name || '请选择公关力度' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="继任者" name="successor" required
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.successor" placeholder="请输入继任者"
class="form-texarea" />
</uni-forms-item>
<uni-forms-item label="备注" name="remark" class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.remark" placeholder="请输入备注"
class="form-texarea" />
</uni-forms-item>
</uni-forms>
<view class="footer-con">
<button class="btn-default" type="default" @click="handleDelete" size="mini"> </button>
<button class="btn-primary" type="primary" @click="submitForm" size="mini">保存/修改</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
reactive,
onUnmounted,
computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import { onShow, onUnload,onLoad } from '@dcloudio/uni-app';
import {
getGuestList
} from '@/api/business.js'
import {
isEmpty
} from '@/utils/validate.js'
import {
crmMarketInformationAdd,crminformationItemForDetail,crmMarketInformationDelete
} from '@/api/crm/api_ys.js'
import { useMessage } from '@/utils/message.js'
import cache from '@/utils/cache.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
const guestArr = ref([])
const guestIndex = ref(0)
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
cusUserName: null, //客户人员名称
originalPosition: null, //原职务
currentPosition: null, //现职务
positionOfOurCompany: '是', //现职务是否与我公司业务相关
developmentEfforts: '加强', //攻关力度
successor: null, //继任者
remark: "", //、备注
picture: "", //、图片
photos: null,
cusPersonnel: '',
informationType: "人员变化信息" //信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择客户'
}]
},
cusUserName: {
rules: [{
required: true,
errorMessage: '请选择客户人员'
}]
},
originalPosition: {
rules: [{
required: true,
errorMessage: '请输入原职务'
}]
},
currentPosition: {
rules: [{
required: true,
errorMessage: '请输入现职务'
}]
},
positionOfOurCompany: {
rules: [{
required: true,
errorMessage: '请选择现职务是否与我公司业务相关'
}]
},
developmentEfforts: {
rules: [{
required: true,
errorMessage: '请选择公关力度'
}]
},
successor: {
rules: [{
required: true,
errorMessage: '请输入继任者'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '是'
},
{
id: 1,
name: '否'
}
])
const array1 = ref([{
id: 0,
name: '加强'
},
{
id: 1,
name: '维持'
},
{
id: 2,
name: '减弱'
}
])
const opportunityTypeIndex = ref(0)
const positionOfOurCompanyIndex = ref(0)
const developmentEffortsIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer() {
uni.navigateTo({
url: '/pages/business/CRM/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
uni.$on('onCustomerSelected', handleCustomerSelected)
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
console.log("收到客户数据的值:", customerUser)
}
//选择客户人员
function chooseClientUser() {
console.log('点击了输入框', formData.value.cusName);
uni.navigateTo({
url: '/pages/business/CRM/customerUserList?cusName=' + formData.value.cusName
})
}
//页面渲染完成后查询catch的get
onShow(() => {
if (cache.get('checkedRCClientList') != null && cache.get('checkedRCClientList') != []) {
formData.value.cusUserName = cache.get('checkedRCClientList')
}
})
//页面卸载之后,删除缓存信息
onUnload(() => {
handleDeleteLocal()
})
//删除缓存
let handleDeleteLocal = () => {
cache.remove('checkedRCClientList');
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const cusUserName1 = formData.value.cusUserName;
const stringOfNames = cusUserName1.join(",")
formData.value.cusUserName = stringOfNames
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
// TODO: 在这里添加提交到后端的逻辑,比如调用 api.CrmMarketInformationAdd(formData.value)
// 暂时只做校验提示
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
const onpoSitionOfOurCompanyChange = (e) => {
positionOfOurCompanyIndex.value = e.detail.value
console.log('positionOfOurCompanyIndex:', array.value[e.detail.value]?.name)
formData.value.positionOfOurCompany = array.value[e.detail.value]?.name || ''
}
const onDevelopmentEffortsChange = (e) => {
developmentEffortsIndex.value = e.detail.value
console.log('developmentEffortsIndex:', array1.value[e.detail.value]?.name)
formData.value.opportunityType = array1.value[e.detail.value]?.name || ''
}
//定义查询参数
const queryParams = ref({
informationId: 0
})
onMounted(() => {
crminformationItemForDetail1()
})
onLoad(options => {
queryParams.value.informationId = options.informationId
})
const dataList = ref([])
function crminformationItemForDetail1() {
crminformationItemForDetail(queryParams.value).then(res => {
formData.value = res.rows[0]
})
}
// 根据ID删除表单
const handleDelete = async () => {
try {
const res = await crmMarketInformationDelete(formData.value);
uni.showToast({
title: '删除成功',
icon: 'success'
})
uni.$emit('refreshMarketOpportunityList')
uni.navigateBack(1)
} catch (err) {
console.log('表单验证失败:', err)
}
}
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
height: calc(120vh - 100px)
/* #endif */
/* #ifndef APP-PLUS */
height:calc(120vh - 80px)
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -64,7 +64,7 @@ import { ref, onMounted } from 'vue'
import customHeader from '@/components/customHeader.vue'
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import { getNavBarPaddingTop } from '@/utils/system.js'
import { visitorReportList } from '@/api/business.js'
import { getYsVisistList } from '@/api/crm/api_ys.js'
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
@@ -111,7 +111,7 @@ const mescrollInit = (mescroll) => {
const downCallback = async (mescroll) => {
try {
setTimeout(async ()=>{
const res = await getVisitorReportList(1, upOption.value.page.size);
const res = await getGetYsVisistList(1, upOption.value.page.size);
cssFlag.value = false;
list.value = res.list;
mescroll.resetUpScroll();
@@ -128,7 +128,7 @@ const downCallback = async (mescroll) => {
const upCallback = async (mescroll) => {
try {
setTimeout(async ()=>{
const res = await getVisitorReportList(mescroll.num, mescroll.size);
const res = await getGetYsVisistList(mescroll.num, mescroll.size);
if (mescroll.num === 1) {
list.value = res.list;
} else {
@@ -142,14 +142,14 @@ const upCallback = async (mescroll) => {
}
// 获取数据列表
const getVisitorReportList = (pageIndex, pageSize) => {
const getGetYsVisistList = (pageIndex, pageSize) => {
return new Promise(async (resolve) => {
let param = {
pageIndex,
pageSize
}
let res = await visitorReportList(param);
let res = await getYsVisistList(param);
resolve({
list: res.list,
total: res.totalCount

View File

@@ -149,7 +149,6 @@ import { getNavBarPaddingTop} from '@/utils/system.js'
import { backBlogCount,swiperList,stepData,salesTask,commonServices,newsQueryList } from '@/api/home.js';
import { getWeekStr,formatTimestamp } from '@/utils/datetime.js'
import { formatMoney } from '@/utils/formatter.js'
// 下拉刷新
const mescrollRef = ref(null);
const mescrollInit = (mescroll) => {
@@ -162,6 +161,7 @@ const downOption = ref({
textLoading: '刷新中...'
});
// 下拉刷新
const downCallback = async (mescroll) => {
try {

View File

@@ -41,8 +41,8 @@ const requestHooks = {
// console.log(code,data,msg,show)
switch (code) {
case RequestCodeEnum.SUCCESS:
msg && show && message.toast(msg);
return data;
msg && message.toast(msg);
return response.data;
case RequestCodeEnum.FAILED:
message.toast(msg);
return Promise.reject(msg);
@@ -50,12 +50,10 @@ const requestHooks = {
if (isAuth && isLogin) {
}
return Promise.reject();
default:
message.toast(msg)
// return data;
// return response.data;
return Promise.reject(msg);
}
},
@@ -72,7 +70,7 @@ const requestHooks = {
const defaultOptions = {
requestOptions: {// 请求配置
timeout: 10 * 1000,
header: { version: '1.0.0' }
header: { version: '1.0.0',AppToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzU0NzI5NzEwLCJleHAiOjE3NTUzMzQ1MTB9.Jas3EQ98u3ZhbrGv0NeESMZPuBjq9PZIzPEV9LcDjjKH19BWiyXJkPUlGrUVuzQKUWrwYCnqXfeZHjm0pLf_UQ' }
},
baseUrl: `${import.meta.env.VITE_APP_BASE_URL || ''}`,// 基础 URL
isReturnDefaultResponse: false,// 是否返回默认响应

View File

@@ -40,4 +40,12 @@ export function isUrl(url) {
const urlRegex = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
return urlRegex.test(url);
}
/**
* 是否为空
*/
export function isEmpty(value) {
if (value === null || value === undefined) return true
if (typeof value === 'string') return value.trim() === ''
if (Array.isArray(value)) return value.length === 0
return false
}