更新销售业绩结算记录

This commit is contained in:
yyy 2025-03-06 18:27:00 +08:00
parent 1044a15904
commit ceee093e2c
7 changed files with 722 additions and 24 deletions

View File

@ -2,65 +2,113 @@ import api from './api'
export function customerCreate(data) {
return api.post('/crm/customer/create', data, { login: false })
return api.post('/crm/customer/create', data, {
login: false
})
}
export function customerUpdate(data) {
return api.put('/crm/customer/update', data, { login: false })
return api.put('/crm/customer/update', data, {
login: false
})
}
export function getCustomerListPage(data) {
return api.get(`/crm/customer/page2`, data, { login: false })
return api.get(`/crm/customer/page2`, data, {
login: false
})
}
export function getDictData(data) {
return api.get(`/system/dict-data/type`, data, { login: false })
return api.get(`/system/dict-data/type`, data, {
login: false
})
}
export function createRecord(data) {
return api.post(`/crm/record/create`, data, { login: false })
return api.post(`/crm/record/create`, data, {
login: false
})
}
export function getCustomer(data) {
return api.get(`/crm/customer/get`, data, { login: false })
return api.get(`/crm/customer/get`, data, {
login: false
})
}
export function getRecordPage(data) {
return api.get(`/crm/record/page`, data, { login: false })
return api.get(`/crm/record/page`, data, {
login: false
})
}
export function getContactsPage(data) {
return api.get(`/crm/customer-contacts/page`, data, { login: false })
return api.get(`/crm/customer-contacts/page`, data, {
login: false
})
}
export function createContact(data) {
return api.post(`/crm/customer-contacts/create`, data, { login: false })
return api.post(`/crm/customer-contacts/create`, data, {
login: false
})
}
export function updateContact(data) {
return api.put(`/crm/customer-contacts/update`, data, { login: false })
return api.put(`/crm/customer-contacts/update`, data, {
login: false
})
}
export function getContacts(data) {
return api.get(`/crm/customer-contacts/get`, data, { login: false })
return api.get(`/crm/customer-contacts/get`, data, {
login: false
})
}
export function getCustomerDoOpen(data) {
return api.get(`/crm/customer/do-open`, data, { login: false })
return api.get(`/crm/customer/do-open`, data, {
login: false
})
}
export function getCustomerReceive(data) {
return api.get(`/crm/customer/receive`, data, { login: false })
return api.get(`/crm/customer/receive`, data, {
login: false
})
}
export function delCustomer(data) {
return api.delete(`/crm/customer/delete`, data, { login: false })
return api.delete(`/crm/customer/delete`, data, {
login: false
})
}
export function transferCustomer(data) {
return api.post(`/crm/customer/transfer`, data, { login: false })
return api.post(`/crm/customer/transfer`, data, {
login: false
})
}
//获得销售业绩结算记录分页
export function getSalesPerformancePage(data) {
return api.get(`/crm/sales-performance-settlement/page`, data, {
login: false
})
}
//获得销售业绩结算记录
export function getSalesPerformance(data) {
return api.get(`/crm/sales-performance-settlement/get`, data, {
login: false
})
}
//更新销售业绩结算记录
export function updateSalesPerformance(data) {
return api.put(`/crm/sales-performance-settlement/update`, data, {
login: false
})
}

View File

@ -1,5 +1,5 @@
export const VUE_APP_API_URL = 'https://api.znkjfw.com/admin-api'
// export const VUE_APP_API_URL = 'http://192.168.0.107:48080/admin-api'
// export const VUE_APP_API_URL = 'https://api.znkjfw.com/admin-api'
export const VUE_APP_API_URL = 'http://192.168.0.172:48080/admin-api'
export const VUE_APP_UPLOAD_URL = VUE_APP_API_URL + '/infra/file/upload'
export const VUE_APP_UPLOAD_URL2 = VUE_APP_API_URL + '/system/user/profile/update-avatar'
export const APP_ID = 'wx91fcb30adb2df321'

View File

@ -328,6 +328,20 @@
"navigationBarTitleText": "商品详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/performanceSet/list",
"style": {
"navigationBarTitleText": "业绩结算列表",
"enablePullDownRefresh": false
}
},
{
"path": "pages/performanceSet/detail",
"style": {
"navigationBarTitleText": "业绩结算详情",
"enablePullDownRefresh": false
}
}
]

View File

@ -0,0 +1,175 @@
<template>
<uv-navbar :fixed="false" :title="title" left-arrow @leftClick="$onClickLeft" />
<view class="bg-white page" v-if="form">
<uv-form :model="form" ref="uForm" labelWidth="88">
<uv-form-item label="用户名称:" prop="nickname" required>
<div class="disable-div">{{form.nickname}}</div>
</uv-form-item>
<uv-form-item label="年份:" prop="year" required>
<div class="disable-div">{{form.year}}</div>
</uv-form-item>
<uv-form-item label="月份:" prop="month" required>
<div class="disable-div">{{form.month}}</div>
</uv-form-item>
<uv-form-item label="实际回款额:" prop="actualPayment" required>
<div class="disable-div">{{form.actualPayment}}</div>
</uv-form-item>
<uv-form-item label="实际销售额:" prop="actualSale" required>
<div class="disable-div">{{form.actualSale}}</div>
</uv-form-item>
<uv-form-item label="评分:" prop="score" required>
<div class="disable-div">{{form.score}}</div>
</uv-form-item>
<uv-form-item label="销售任务:" prop="saleTask" required>
<div class="disable-div">{{form.saleTask}}%</div>
</uv-form-item>
<uv-form-item label="回款任务:" prop="paymentTask" required>
<div class="disable-div">{{form.paymentTask}}%</div>
</uv-form-item>
<uv-form-item label="评分任务:" prop="scoreTask" required>
<div class="disable-div">{{form.scoreTask||0}}%</div>
</uv-form-item>
<uv-form-item label="核发比例:" prop="proportionOfIssuance" required>
<div class="disable-div">{{form.proportionOfIssuance}}</div>
</uv-form-item>
<uv-form-item label="总分:" prop="totalScore" required>
<div class="disable-div">{{form.totalScore}}</div>
</uv-form-item>
</uv-form>
<view style="margin-top: 30rpx;"
v-if="userInfo.id == form.userId && form.canConfirmFlag === 1 && form.confirmFlag === 0">
<uv-button type="primary" color="#09b4f1" text="确定" @click="onSubmit"></uv-button>
</view>
</view>
</template>
<script setup>
import {
ref,
unref,
computed
} from 'vue'
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
getSalesPerformance,
updateSalesPerformance
} from '@/api/customer'
import {
useMainStore
} from '@/store/store'
import {
storeToRefs
} from 'pinia'
import {
handleLoginFailure
} from '@/utils'
const main = useMainStore()
const {
isLogin,
} = storeToRefs(main)
const title = ref('业绩结算详情')
const form = ref('')
const id = ref('')
onLoad((opt) => {
if (isLogin) {
id.value = opt.id
getDetail()
isConfirmShow()
} else {
handleLoginFailure()
}
})
const getDetail = async () => {
getSalesPerformance({
id: id.value
}).then(res => {
form.value = res
})
}
//
const onSubmit = () => {
form.value.confirmFlag = 1
updateSalesPerformance(form.value).then(res => {
uni.showToast({
title: '确认成功',
icon: 'success',
duration: 2000
})
getDetail()
})
}
const userInfo = ref()
const isConfirmShow = async () => {
if (uni.getStorageSync('userinfo')) {
userInfo.value = uni.getStorageSync('userinfo')
} else {
userInfo = await userGetUserInfo()
main.SET_MEMBER(userInfo)
}
}
</script>
<style lang="scss" scoped>
.page {
padding: 0rpx 22rpx 40rpx 34rpx;
}
.list {
margin: 40rpx 15rpx 60rpx;
.item {
position: relative;
border-radius: 15rpx;
box-shadow: 1px 0px 5px rgba(50, 50, 50, 0.3);
padding: 25rpx 35rpx;
margin-bottom: 45rpx;
.number {
margin-bottom: 20rpx;
}
.content {
margin-bottom: 20rpx;
.price {
width: 245rpx;
font-size: 28rpx;
color: #fa3534;
}
}
.close {
position: absolute;
right: -8px;
top: -30rpx;
background-color: #fff;
border-radius: 50%;
height: 60rpx;
width: 60rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 1px 0px 5px rgba(50, 50, 50, 0.3);
}
}
}
.disable-div {
background-color: #f7f7f7;
box-shadow: 0 0 0 1px #efefef inset;
display: inline-flex;
flex-grow: 1;
align-items: center;
padding: 20rpx;
background-image: none;
border-radius: 10rpx;
color: #666;
}
</style>

View File

@ -0,0 +1,454 @@
<template>
<uv-navbar :fixed="false" @leftClick="$onClickLeft" bgColor="#09b4f1">
<template v-slot:left>
<uv-icon name="arrow-left" size="19" color="#ffffff"></uv-icon>
</template>
<template v-slot:center>
<text style="color:#ffffff">{{title}}</text>
</template>
</uv-navbar>
<view class="container">
<view class="pb-2 flex px-5" style="background-color: #09b4f1;">
<uv-search placeholder="搜索用户名称" v-model="keyword" bgColor="#ffffff" :customStyle="customStyle"
:show-action="false" @change="onSearch"></uv-search>
<uv-icon name="http://sys.znkjfw.com/imgs/crmimages/screen.png" :size="26" @click="openSearch"></uv-icon>
</view>
<view class="wrap">
<scroll-view scroll-y class="sv" :style="{height:scrollHeight+'px'}" :scroll-top="scrollTop" lower-threshold="20"
@scroll="scroll" @scrolltolower="reachBottom">
<view class="page-box" @touchmove="handletouchstart" @touchend="handletouchend">
<block v-if="dataList.length > 0">
<view class="client" v-for="(item, index) in dataList" :key="index" @click.stop="toDetail(item)">
<view class="content">
<view class="title ">用户名称</view>
<view class="value ">{{item.nickname}}</view>
</view>
<view class="content">
<view class="title ">日期</view>
<view class="value ">{{item.year}}-{{item.month}}</view>
</view>
<view class="content">
<view class="title ">实际回款额</view>
<view class="value ">{{item.actualPayment}}</view>
</view>
<view class="content">
<view class="title ">实际销售额</view>
<view class="value ">{{item.actualSale}}</view>
</view>
<view class="content">
<view class="title ">销售任务</view>
<view class="value ">{{item.saleTask||0}}%</view>
</view>
<view class="content">
<view class="title ">回款任务</view>
<view class="value ">{{item.paymentTask||0}}%</view>
</view>
<view class="content">
<view class="title ">评分任务</view>
<view class="value ">{{item.scoreTask||0}}%</view>
</view>
<view class="content">
<view class="title ">评分</view>
<view class="value ">{{item.score||0}}</view>
</view>
<view style="display: flex;align-items: center;justify-content: space-between;">
<view class="content">
<view class="title ">总分</view>
<view class="value ">{{item.totalScore||0}}</view>
</view>
<view @click.stop="onSubmitItem(item)"
v-if="userInfo.id == item.userId && item.canConfirmFlag === 1 && item.confirmFlag === 0">
<uv-button type="primary" color="#09b4f1" text="确定">确认</uv-button>
</view>
</view>
</view>
<uv-load-more :status=" listStatus" />
</block>
<uv-empty text="暂无数据" v-else margin-top="100" mode="list"></uv-empty>
</view>
</scroll-view>
</view>
<uv-popup ref="popup" @change="change" mode="top" bgColor="" :customStyle="customStyle2" :overlay="true">
<view class="p-2">
<uv-form labelPosition="top" ref="form" labelWidth="70">
<uv-form-item label="年份" @click="showYearSelect">
<uv-input v-model="dealYearName" disabled disabledColor="#ffffff" placeholder="请选择年份">
<template v-slot:suffix>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-input>
</uv-form-item>
<uv-form-item label="月份" @click="showMonthSelect">
<uv-input v-model="dealMonthName" disabled disabledColor="#ffffff" placeholder="请选择月份">
<template v-slot:suffix>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-input>
</uv-form-item>
<view class="flex mt-2">
<view class="flex-1" style="margin-right: 8rpx;">
<uv-button type="success" :plain="true" text="确定" @click="onSubmit"></uv-button>
</view>
<view class="flex-1" style="margin-left: 8rpx;">
<uv-button type="error" :plain="true" text="重置" @click="onReset"></uv-button>
</view>
</view>
</uv-form>
</view>
</uv-popup>
<uv-action-sheet ref="yearSelect" :actions="yearActions" title="请选择年份" @select="onYearSelect">
</uv-action-sheet>
<uv-action-sheet ref="monthSelect" :actions="monthActions" title="请选择月份" @select="onMonthSelect">
</uv-action-sheet>
</view>
</template>
<script setup>
import {
ref,
computed
} from 'vue'
import {
onLoad,
onShow,
onReady
} from '@dcloudio/uni-app'
import {
getSalesPerformancePage,
updateSalesPerformance
} from '@/api/customer'
import {
formatDateTime
} from '@/utils/util'
import {
useMainStore
} from '@/store/store'
import {
storeToRefs
} from 'pinia'
import {
handleLoginFailure
} from '@/utils'
const main = useMainStore()
const {
isLogin,
} = storeToRefs(main)
const title = ref('业绩结算')
const keyword = ref('')
const scrollHeight = ref(0)
const pH = ref(0)
const scrollTop = ref(-1)
const specClass = ref('hide')
const oldScrollTop = ref(0)
const dataList = ref([])
const dx = ref(0)
const page = ref(1)
const pageSize = ref(10)
const lastPage = ref(false)
const listStatus = ref('loadmore')
const isRefresh = ref(false)
const yearActions = ref(
[{
name: '2022',
value: 2020
}, {
name: '2023',
value: 2023
},
{
name: '2024',
value: 2024
},
{
name: '2025',
value: 2025
},
{
name: '2026',
value: 2026
},
{
name: '2027',
value: 2027
}, {
name: '2028',
value: 2028
}
]
)
const monthActions = ref(
[{
name: "一月",
value: 1
},
{
name: "二月",
value: 2
},
{
name: "三月",
value: 3
},
{
name: "四月",
value: 4
},
{
name: "五月",
value: 5
},
{
name: "六月",
value: 6
},
{
name: "七月",
value: 7
},
{
name: "八月",
value: 8
},
{
name: "九月",
value: 9
},
{
name: "十月",
value: 10
},
{
name: "十一月",
value: 11
},
{
name: "十二月",
value: 12
}
]
)
defineExpose({
isRefresh
})
const customStyle = computed(() => {
return {
paddingLeft: '10rpx',
paddingRight: '120rpx'
}
})
const statusBarHeight = ref(0)
statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
const customStyle2 = computed(() => {
return {
paddingTop: (uni.getSystemInfoSync().statusBarHeight + 40) + 'px',
paddingBottom: 15 + 'px',
backgroundColor: '#ffffff'
}
})
const popup = ref()
onReady(() => {
uni.getSystemInfo({
success(res) {
pH.value = res.windowHeight
let scrollH = uni.createSelectorQuery().select(".sv")
scrollH.boundingClientRect(data => {
let pH0 = pH.value
scrollHeight.value = pH0 - data.top - 5
}).exec()
}
})
})
onLoad((e) => {
getCustomerList();
isConfirmShow()
})
onShow(() => {
if (isRefresh.value) {
isRefresh.value = false
page.value = 1
lastPage.value = false
scrollTop.value = 0
dataList.value = []
getCustomerList()
}
})
const userInfo = ref()
const isConfirmShow = async () => {
if (uni.getStorageSync('userinfo')) {
userInfo.value = uni.getStorageSync('userinfo')
} else {
userInfo = await userGetUserInfo()
main.SET_MEMBER(userInfo)
}
}
const onSubmitItem = (item) => {
item.confirmFlag = 1
updateSalesPerformance(item).then(res => {
uni.showToast({
title: '确认成功',
icon: 'success',
duration: 2000
})
getCustomerList()
})
}
const openSearch = () => {
popup.value.open()
}
//
const toDetail = (item) => {
uni.navigateTo({
url: `/pages/components/pages/performanceSet/detail?id=${item.id}`
})
}
//
const yearSelect = ref()
const dealYearName = ref()
const dealYear = ref('')
const showYearSelect = () => {
yearSelect.value.open()
}
const onYearSelect = (val) => {
dealYearName.value = val.name
dealYear.value = val.value
}
//
const monthSelect = ref()
const dealMonthName = ref()
const dealMonth = ref('')
const showMonthSelect = () => {
monthSelect.value.open()
}
const onMonthSelect = (val) => {
dealMonthName.value = val.name
dealMonth.value = val.value
}
const onReset = () => {
dealMonth.value = undefined
dealYear.value = undefined
dealMonthName.value = ''
dealYearName.value = ''
}
const onSubmit = () => {
page.value = 1
lastPage.value = false
getCustomerList()
popup.value.close()
}
const handletouchstart = () => {
specClass.value = 'show'
}
const handletouchend = () => {
specClass.value = 'hide'
}
//
const getCustomerList = async (isNextPage, pages) => {
await getSalesPerformancePage({
pageNo: page.value,
pageSize: pageSize.value,
nickname: keyword.value,
month: dealMonth.value,
year: dealYear.value,
}).then(res => {
res.list.forEach((item, index) => {
if (item.tags) {
item.tagsArr = item.tags.split(',')
}
})
if (res) {
//
if (res.list.length < 10) {
listStatus.value = 'nomore'
}
//
if (res.list.length == 0) {
lastPage.value = true
}
//
if (isNextPage) {
dataList.value = dataList.value.concat(res.list)
return
}
dataList.value = res.list
}
})
}
// scroll
const scroll = (e) => {
oldScrollTop.value = e.detail.scrollTop; //
}
//
const reachBottom = () => {
if (lastPage.value || listStatus.value == 'loading') return;
if (!lastPage.value) {
listStatus.value = 'loading';
setTimeout(() => {
listStatus.value = 'loadmore'
getCustomerList(true, ++page.value)
}, 500)
}
}
//
const onSearch = () => {
page.value = 1
lastPage.value = false
getCustomerList()
}
</script>
<style lang="scss" scoped>
.container {
background-color: #F7F7F7;
}
.page-box {
padding: 20rpx 20rpx 45rpx;
}
.client {
width: 710rpx;
background-color: #ffffff;
padding: 14px 24rpx;
border-radius: 20rpx;
box-sizing: border-box;
font-size: 28rpx;
margin-bottom: 22rpx;
.content {
display: flex;
align-items: center;
padding: 8rpx 0;
.title {
font-size: 28rpx;
color: #000;
}
.value {
font-size: 28rpx;
color: #666;
}
}
}
.wrap {
display: flex;
flex-direction: column;
width: 100%;
}
</style>

View File

@ -169,8 +169,9 @@
import AddressSelect from '@/components/AddressSelect/index.vue'
import {
formatDateTime,
timestampToDate,
prePage,
timestampToDate
getFileType
} from '@/utils/util'
const title = ref('添加回款')
const labelPosition = ref('left')

View File

@ -126,25 +126,25 @@
},
{
title: '线索',
index: 1,
index: 2,
image: 'http://sys.znkjfw.com/imgs/crmimages/2.png',
path: '/pages/components/pages/clues/index'
},
{
title: '客户',
index: 2,
index: 3,
image: 'http://sys.znkjfw.com/imgs/crmimages/1.png',
path: '/pages/customer/index'
},
{
title: '合同',
index: 3,
index: 4,
image: 'http://sys.znkjfw.com/imgs/crmimages/index006.png',
path: '/pages/components/pages/contract/index'
},
{
title: '产品',
index: 4,
index: 5,
image: 'http://sys.znkjfw.com/imgs/crmimages/8.png',
path: '/pages/components/pages/product/index'
},
@ -173,16 +173,22 @@
},
{
title: '销售简报',
index: 1,
index: 2,
image: 'http://sys.znkjfw.com/imgs/crmimages/10.png',
path: '/pages/components/pages/analysis/sales'
},
{
title: '排行榜',
index: 1,
index: 3,
image: 'http://sys.znkjfw.com/imgs/crmimages/9.png',
path: '/pages/components/pages/analysis/rank'
},
{
title: '业绩结算',
index: 4,
image: 'https://api.znkjfw.com/admin-api/infra/file/4/get/invoice_png_179_1741244639133.png',
path: '/pages/components/pages/performanceSet/list'
}
]
const customStyle = computed(() => {