Commit 1f605298 by 李伟康

feat(dailyReport): 重构日报系统并新增多项功能

- 修改环境配置将默认索引从2改为1,更新IP地址配置
- 新增日报模板API接口包括新版本检查、月度待邀约数、草稿保存等功能
- 重构入口组件实现动态获取入口列表并根据用户场景过滤显示
- 优化日报页面结构支持多种日报类型并新增洽谈明细编辑功能
- 添加日报详情页面支持查看历史记录和当前填写状态
- 新增日报组件混合类封装通用的数据处理和验证逻辑
- 优化洽谈明细编辑页面支持表格数据编辑和保存功能
- 调整日报页面UI样式和布局提升用户体验和交互效果
1 parent 00dbb88a
import http from '../request/http' import http from '../request/http'
import { env } from '../../env' import { env } from '../../env'
const ENV = env == 'ip' ? 'develop' : env, const ENV = env == 'ip' ? 'develop' : env,
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?env=${ENV}` configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?env=${ENV}`
/** /**
* *
* @param {*} templateType 1: 驻店 2:门店 3:洽谈 * @param {*} templateType 1: 驻店 2:门店 3:洽谈
...@@ -33,7 +35,7 @@ const getReportList = async (data = {}) => { ...@@ -33,7 +35,7 @@ const getReportList = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.weekly.list', method: 'dj.api.smartcarlife.dailyReport.weekly.list',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) }, false, 'ip')
} }
/** /**
查询日报详情 查询日报详情
...@@ -43,12 +45,78 @@ const getReportDetail = async (data = {}) => { ...@@ -43,12 +45,78 @@ const getReportDetail = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.detail.get', method: 'dj.api.smartcarlife.dailyReport.detail.get',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) }, false, 'ip')
} }
/**
是否需要新版本日报填报
*/
const isNewVersionNeed = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.new.version.isNeed',
projectName: 'boutique',
...data
}, false, 'ip')
}
/**
查询门店日报本月待邀约数
*/
const getMonthlyPendingCount = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.monthly.pending.count',
projectName: 'boutique',
...data
}, false, 'ip')
}
/**
查询洽谈明细驻店人员名单
*/
const getDiscussionStaffList = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.discussion.staff.list',
projectName: 'boutique',
...data
}, false, 'ip')
}
/**
日报草稿数据保存
*/
const saveDraft = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.dynamic.draft.save',
projectName: 'boutique',
...data
}, false, 'ip')
}
/**
日报数据提交
*/
const submitReport = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.dailyReport.dynamic.save',
projectName: 'boutique',
...data
}, false, 'ip')
}
/**
* 当前门店驻店人员在选中成交日期交付的延保及权益订单
*/
const getGoodsOrderList = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.goodsOrder.product.outputValue.list',
projectName: 'boutique',
...data
}, false, 'ip')
}
module.exports = { module.exports = {
getDailyTemplate, getDailyTemplate,
getReportList, getReportList,
getReportDetail getReportDetail,
isNewVersionNeed,
getMonthlyPendingCount,
saveDraft,
getDiscussionStaffList,
submitReport,
getGoodsOrderList
} }
...@@ -5,7 +5,7 @@ const HOST = { ...@@ -5,7 +5,7 @@ const HOST = {
scrm: domain, scrm: domain,
dj: djDomain, dj: djDomain,
merchant: merchantDomain, merchant: merchantDomain,
ip: 'http://192.168.1.125:8080' ip: 'http://192.168.1.96:8292'
} }
/** 接口 message 转可展示的 Toast 文案(非字符串、过长在部分端上会导致不弹提示) */ /** 接口 message 转可展示的 Toast 文案(非字符串、过长在部分端上会导致不弹提示) */
......
...@@ -42,125 +42,17 @@ export default { ...@@ -42,125 +42,17 @@ export default {
// 工资申诉入口是否允许显示 // 工资申诉入口是否允许显示
wageAppealAllowed: false, wageAppealAllowed: false,
// 工资申诉入口加载中,加载完成前不展示避免误显示 // 工资申诉入口加载中,加载完成前不展示避免误显示
loadingEntrance: true loadingEntrance: true,
entranceList: []
} }
}, },
created () { created () {
this.getEntranceList()
// 组件创建时请求工资申诉入口权限 // 组件创建时请求工资申诉入口权限
this.fetchWageAppealEntrance() this.fetchWageAppealEntrance()
}, },
computed: { computed: {
entranceList () {
let { sceneType } = uni.$storage.get('userInfo') || {},
entranceList = [
{
icon: 'daily-report',
label: '驻店日报',
name: 'DailyReport',
sceneType: [0, 1, 7],
noInterception:true
},
{
icon: 'create-order',
label: '新建工单',
name: 'CreateOrder',
sceneType: [0, 1]
},
{
icon: 'equity-order',
label: '权益提单',
name: 'EquityManagement',
sceneType: [0]
},
{
icon: 'defeat-order',
label: '战败下单',
name: 'DefeatOrder',
sceneType: [0, 1]
},
{
icon: 'order-management',
label: '工单列表',
name: 'OrderManagement',
sceneType: [0, 1]
},
{
icon: 'wage-appeal',
label: '工资申诉',
name: 'WageAppeal',
sceneType: [0, 1],
noInterception:true
},
{
icon: 'evaluation-management',
label: '评估单管理',
name: 'EvaluationFormList',
sceneType: [7]
},
{
icon: 'carInfoIcon',
label: '车况信息',
name: 'CarConditionInfo',
page: '/pages/usedCar/inspectionReport/index?h5Entry=carInfo',
sceneType: [7]
},
{
icon: 'delivery-management',
label: '交付管理',
name: 'DeliveryManagement',
page: '/pages/usedCar/deliveryManagement/index',
sceneType: [7],
checkDailyReport:false
},
{
icon: 'report-management',
label: '报告管理',
name: 'ReportManagement',
page: '/pages/usedCar/reportManagement/index',
sceneType: [7],
checkDailyReport:false
},
{
icon: 'report',
label: '检测管理',
name: 'InspectionReport',
page: '/pages/usedCar/inspectionReport/index',
sceneType: [7],
noInterception:true
},
{
icon: 'daily-report',
label: '驻店日报 (新)',
page: '/pages/common/dailyNewspaper/index',
name: 'staffDailyReport',
sceneType: [0, 1],
noInterception:true
},
{
icon: 'store-daily-report',
label: '门店日报',
name: 'storeDailyReport',
page: '/pages/common/dailyNewspaper/index',
sceneType: [0, 1],
noInterception:true
},
{
icon: 'negotiation-detail',
name: 'NegotiationDetailList',
label: '洽谈明细',
page: '/pages/common/dailyNewspaper/index',
sceneType: [0, 1],
noInterception:true
},
]
// 先根据场景过滤
let list = entranceList.filter(e => e.sceneType.includes(sceneType))
// 加载阶段或不允许显示时,移除工资申诉入口
if (this.loadingEntrance || !this.wageAppealAllowed) {
list = list.filter(e => e.name !== 'WageAppeal')
}
return list
}
}, },
methods: { methods: {
// 请求工资申诉入口权限,并设置显示开关 // 请求工资申诉入口权限,并设置显示开关
...@@ -195,6 +87,121 @@ export default { ...@@ -195,6 +87,121 @@ export default {
handleClick (item) { handleClick (item) {
// 这里可以根据实际需求进行跳转或功能处理 // 这里可以根据实际需求进行跳转或功能处理
this.$emit('entranceClick', item) this.$emit('entranceClick', item)
},
isNewVersionNeed (merchantId) {
return uni.$api.dailyTemplateApi.isNewVersionNeed({ merchantId })
},
async getEntranceList () {
let entranceList = [
{
icon: 'daily-report',
label: '驻店日报',
name: 'DailyReport',
sceneType: [0, 1, 7],
noInterception: true
},
{
icon: 'create-order',
label: '新建工单',
name: 'CreateOrder',
sceneType: [0, 1]
},
{
icon: 'equity-order',
label: '权益提单',
name: 'EquityManagement',
sceneType: [0]
},
{
icon: 'defeat-order',
label: '战败下单',
name: 'DefeatOrder',
sceneType: [0, 1]
},
{
icon: 'order-management',
label: '工单列表',
name: 'OrderManagement',
sceneType: [0, 1]
},
{
icon: 'wage-appeal',
label: '工资申诉',
name: 'WageAppeal',
sceneType: [0, 1],
noInterception: true
},
{
icon: 'evaluation-management',
label: '评估单管理',
name: 'EvaluationFormList',
sceneType: [7]
},
{
icon: 'carInfoIcon',
label: '车况信息',
name: 'CarConditionInfo',
page: '/pages/usedCar/inspectionReport/index?h5Entry=carInfo',
sceneType: [7]
},
{
icon: 'delivery-management',
label: '交付管理',
name: 'DeliveryManagement',
page: '/pages/usedCar/deliveryManagement/index',
sceneType: [7],
checkDailyReport: false
},
{
icon: 'report-management',
label: '报告管理',
name: 'ReportManagement',
page: '/pages/usedCar/reportManagement/index',
sceneType: [7],
checkDailyReport: false
},
{
icon: 'report',
label: '检测管理',
name: 'InspectionReport',
page: '/pages/usedCar/inspectionReport/index',
sceneType: [7],
noInterception: true
},
{
icon: 'store-daily-report',
label: '门店日报',
name: 'storeDailyReport',
page: '/pages/common/dailyNewspaper/index',
// sceneType: [0, 1],
noInterception: true
},
{
icon: 'negotiation-detail',
name: 'NegotiationDetail',
label: '洽谈明细',
page: '/pages/common/dailyNewspaper/index',
// sceneType: [0, 1],
noInterception: true
},
]
let userInfo = uni.$storage.get('userInfo'),
{ sceneType, shopMerchantId } = userInfo,
newReport = await this.isNewVersionNeed(shopMerchantId)
if (!newReport && sceneType != 7) {
entranceList[0].name = 'staffDailyReport'
entranceList[0].page = '/pages/common/dailyNewspaper/index'
entranceList.map(e => {
if (['storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1]
})
}
// 先根据场景过滤
let list = entranceList.filter(e => e.sceneType?.includes(sceneType))
// 加载阶段或不允许显示时,移除工资申诉入口
if (this.loadingEntrance || !this.wageAppealAllowed) {
list = list.filter(e => e.name !== 'WageAppeal')
}
this.entranceList = list
} }
} }
} }
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 2 const index = 1
/** /**
* *
0本地 0本地
...@@ -50,7 +50,7 @@ const domain = { ...@@ -50,7 +50,7 @@ const domain = {
const djDomain = { const djDomain = {
// ip: 'http://dj.dev.glsx.com.cn', // ip: 'http://dj.dev.glsx.com.cn',
ip: 'http://192.168.1.104:8292', ip: 'http://192.168.1.96:8292',
dev: 'http://dj.dev.glsx.com.cn', dev: 'http://dj.dev.glsx.com.cn',
beta: 'https://dj.beta.glsx.com.cn', //预发布 appid: wx9f91c1ec493eb425 beta: 'https://dj.beta.glsx.com.cn', //预发布 appid: wx9f91c1ec493eb425
uat: 'https://dj.test.glsx.com.cn', //测试 appid: wxe10067a63c1856ac uat: 'https://dj.test.glsx.com.cn', //测试 appid: wxe10067a63c1856ac
......
<template>
<view class="daily-report">
<view class="common-title">
</view>
<template v-if="loadComplete">
<template v-if="list.length">
<view class="list-box">
<view class="list-title">{{ }}</view>
<view >
<Table
:columns="columns"
:data="list"
tableStyle="padding-right:32rpx"
/>
</view>
<view class="list-title">{{ }}</view>
<view >
<Table
:columns="columns"
:data="list"
tableStyle="padding-right:32rpx"
/>
</view>
</view>
</template>
<nothing v-else />
</template>
</view>
</template>
<script type='text/ecmascript-6'>
import Table from '../components/Table'
import Nothing from '../components/Nothing'
export default {
components: { Table, Nothing },
name: 'detail',
data () {
return {
columns: [
{ title: '数据1' },
{ title: '数据2' },
{ title: '数据3' },
{ title: '数据4' },
{ title: '数据5' },
{ title: '数据6' },
{ title: '数据7' },
{ title: '数据8' },
{ title: '数据9' },
{ title: '数据10' },
{ title: '数据11' },
{ title: '数据12' },
{ title: '数据13' },
{ title: '数据14' },
{ title: '数据15' },
{ title: '数据16' },
{ title: '数据17' },
{ title: '数据18' },
{ title: '数据19' },
{ title: '数据20' },
],
loadComplete: false,
list: [
{
rowHeader: '交车日期',
data: ['XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX']
},
{
rowHeader: '部门',
data: ['3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3']
},
{
rowHeader: '推荐人',
data: ['5', '5', '5', '1', '5', '5', '4', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5']
},
{
rowHeader: '客户名称',
data: ['张三', '张三', '张三23423423234SCSDSDsdsd多少点', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三']
},
{
rowHeader: '客户电话',
data: ['12345678901', 'ddd', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', 123]
}
]
}
},
computed: {
},
mounted () {
this.loadComplete = true
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.daily-report {
height: 100%;
position: relative;
.common-title {
position: absolute;
top: 0;
left: 0;
}
.list-box {
position: absolute;
width: calc(100% - #{toRpx(96)});
height: calc(100% - #{toRpx(80)});
border-radius: 32rpx;
background: #fff;
top: 48rpx;
left: 50%;
transform: translateX(-50%);
padding: 0 0 32rpx 32rpx;
overflow-x: auto;
.list-title {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
position: sticky;
top: 0;
z-index: 50;
background: #fff;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -46,7 +46,10 @@ ...@@ -46,7 +46,10 @@
</view> </view>
<view class="footer"> <view class="footer">
<Footer> <Footer>
<view class="btn">保存</view> <view
class="btn"
@click="$emit('saveReport',list)"
>保存</view>
</Footer> </Footer>
</view> </view>
</template> </template>
...@@ -68,7 +71,7 @@ import utils from '@/utils/utils' ...@@ -68,7 +71,7 @@ import utils from '@/utils/utils'
import EditForm from '../components/EditForm' import EditForm from '../components/EditForm'
export default { export default {
components: { Table, Nothing, Footer, EditForm }, components: { Table, Nothing, Footer, EditForm },
name: 'NegotiationDetailList', name: 'edit',
inject: ['sceneType'], inject: ['sceneType'],
props: { props: {
templateData: { templateData: {
...@@ -85,8 +88,11 @@ export default { ...@@ -85,8 +88,11 @@ export default {
watch: { watch: {
templateData: { templateData: {
handler (val) { handler (val) {
if (!this.list.length) this.list = utils.deepClone(val) this.loadComplete = false
this.loadComplete = true this.list = utils.deepClone(val)
setTimeout(() => {
this.loadComplete = true
}, 100)
}, },
immediate: true, immediate: true,
deep: true deep: true
...@@ -104,7 +110,7 @@ export default { ...@@ -104,7 +110,7 @@ export default {
}, },
addItem (index) { addItem (index) {
let { templateData } = this let { templateData } = this
this.list[index].children.push(templateData[index].children[0]) this.list[index].children.push(templateData[index].origin_children)
let data = this.list[index].children[this.list[index].children.length - 1], let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1, c_index = this.list[index].children.length - 1,
parent = this.list[index] parent = this.list[index]
......
<template> <template>
<view class="daily-report"> <view class="report-content ">
<view class="common-title"> <template v-if="!isToday">
</view> <Detail />
<template v-if="loadComplete"> </template>
<template v-if="list.length"> <template v-else>
<view class="list-box"> <Edit
<view class="list-title">{{ title }}</view> :templateData="templateData"
<view :class="[checkTable(list)]"> @saveReport="saveReport"
<Table />
:columns="columns"
:data="list"
tableStyle="padding-right:32rpx"
close
/>
</view>
<view class="list-title">{{ title }}</view>
<view :class="[checkTable(list)]">
<Table
:columns="columns"
:data="list"
tableStyle="padding-right:32rpx"
/>
</view>
</view>
</template>
<nothing v-else />
</template> </template>
</view> </view>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Table from '../components/Table' import mixins from '../mixins'
import Nothing from '../components/Nothing' import Detail from './detail'
import Edit from './edit'
export default { export default {
components: { Table, Nothing }, components: { Detail, Edit },
name: 'NegotiationDetailList', mixins: [mixins],
inject: ['sceneType'],
name: 'NegotiationDetail',
data () { data () {
return { return {
columns: [
{ title: '数据1' },
{ title: '数据2' },
{ title: '数据3' },
{ title: '数据4' },
{ title: '数据5' },
{ title: '数据6' },
{ title: '数据7' },
{ title: '数据8' },
{ title: '数据9' },
{ title: '数据10' },
{ title: '数据11' },
{ title: '数据12' },
{ title: '数据13' },
{ title: '数据14' },
{ title: '数据15' },
{ title: '数据16' },
{ title: '数据17' },
{ title: '数据18' },
{ title: '数据19' },
{ title: '数据20' },
],
loadComplete: false,
list: [
{
rowHeader: '交车日期',
data: ['XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX', 'XX']
},
{
rowHeader: '部门',
data: ['3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3']
},
{
rowHeader: '推荐人',
data: ['5', '5', '5', '1', '5', '5', '4', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5']
},
{
rowHeader: '客户名称',
data: ['张三', '张三', '张三23423423234SCSDSDsdsd多少点', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三']
},
{
rowHeader: '客户电话',
data: ['12345678901', 'ddd', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', '12345678901', 123]
}
]
} }
}, },
computed: { computed: {
title () {
let sceneName = {
0: '延保/权益',
1: '轻改'
}[this.sceneType]
return `洽谈明细 (${sceneName})`
}
}, },
mounted () { mounted () {
this.loadComplete = true this.loadComplete = true
}, },
methods: { methods: {
checkTable (list) {
return list.length >= 12 ? 'table-box' : ''
}
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.daily-report { .report-content {
height: 100%; height: 100%;
position: relative; position: relative;
.common-title {
position: absolute;
top: 0;
left: 0;
}
.list-box {
position: absolute;
width: calc(100% - #{toRpx(96)});
height: calc(100% - #{toRpx(80)});
border-radius: 32rpx;
background: #fff;
top: 48rpx;
left: 50%;
transform: translateX(-50%);
padding: 0 0 32rpx 32rpx;
overflow-x: auto;
.list-title {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
position: sticky;
top: 0;
z-index: 50;
background: #fff;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
详情
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="daily-report">
<view class="common-title">
基础信息
</view>
<template v-if="loadComplete">
<template v-if="list.length">
<view class="daily-report-container">
<template v-for="(i,index) in list">
<view
:class="['list-item',{'block':['group','divider','textarea'].includes(i.type)},{'list-box':i.type == 'group'}]"
:key="index"
v-if="itemShow(i)"
>
<template v-if="i.type != 'group'">
<template v-if="i.type == 'divider'">
<view class="divider flex">
<view class="text">{{ i.label }}</view>
</view>
</template>
<template v-else>
<FormItem
:formItem="i"
:rules="i.rules"
@onSelect="onSelect($event, index)"
@onInput="onInput($event, index)"
:disabled="itemDisabled(i)"
/>
</template>
</template>
<template v-else>
<view class="list-title flex">
{{ i.label }}
</view>
<template v-if="i.children.length">
<template v-for="(c,c_index) in i.children">
<FormItem
class="form-item"
:formItem="c"
:key="c_index"
:rules="i.childrenRules[c.key]"
@onSelect="onSelect($event,index, c_index)"
@onInput="onInput($event, index, c_index)"
:disabled="itemDisabled(c)"
/>
</template>
</template>
</template>
</view>
</template>
</view>
<view class="footer">
<Footer>
<view class="btn">保存</view>
</Footer>
</view>
</template>
<nothing v-else />
</template>
<EditForm
ref="editForm"
@onDel="delItem"
@onConfirm="confirm"
/>
</view>
</template>
<script type='text/ecmascript-6'>
import Nothing from '../components/Nothing'
import Table from '../components/Table'
import Footer from '../components/Footer'
import utils from '@/utils/utils'
import EditForm from '../components/EditForm'
import FormItem from '../components/FormItem.vue'
export default {
name: 'StoreDailyReport',
components: { Table, Nothing, Footer, EditForm, FormItem },
props: {
templateData: {
type: Array,
default: () => []
}
},
data () {
return {
loadComplete: false,
list: []
}
},
watch: {
templateData: {
handler (val) {
this.loadComplete = false
this.list = utils.deepClone(val)
setTimeout(() => {
this.loadComplete = true
}, 100)
},
immediate: true,
deep: true
}
},
mounted () {
},
methods: {
itemShow (i) {
if (i.rules) {
let { keys, result } = i.rules,
{ list } = this
if (keys && result) {
let params = keys.map((c, index) => `val${index + 1}`),
// 将 new Function 改为 eval 方式
func = eval(`(function(${params.join(',')}) { return ${result}; })`),
value = []
keys.map(key => {
let item = list.find(i => i.key == key)
if (item) value.push(item.value || null)
})
return func(...value)
} else return true
} else {
return true
}
},
handleRowClick (row, rowIndex, index) {
let parent = this.list[index]
this.$refs.editForm.open(row, rowIndex, index, parent)
},
delItem (c_index, index) {
this.list[index].children.splice(c_index, 1)
},
addItem (index) {
let { templateData } = this
this.list[index].children.push(templateData[index].children[0])
let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1,
parent = this.list[index]
this.$refs.editForm.open(data, c_index, index, parent)
},
confirm (data, c_index, index) {
this.$set(this.list[index].children, c_index, utils.deepClone(data))
},
onInput (val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val)
},
onSelect (val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val)
},
itemDisabled (i) {
let disabled = i.disabled
if (i.disabledFun) {
let { keys, result } = i.disabledFun,
{ list } = this,
params = keys.map((i, index) => `val${index + 1}`),
// 将 new Function 改为 eval 方式
func = eval(`(function(${params.join(',')}) { return ${result}; })`),
value = []
keys.map(key => {
let item = list.find(i => i.key == key)
if (item) value.push(item.value || null)
})
return func(...value)
}
return disabled
},
}
}
</script>
<style scoped lang='scss'>
.daily-report {
height: 100%;
position: relative;
&-container {
height: calc(100% - #{toRpx(256)});
padding: 0 48rpx;
box-sizing: border-box;
overflow-y: auto;
display: flex;
flex-wrap: wrap;
gap: 24rpx 32rpx;
align-content: start;
.list-item,
.form-item {
width: calc((100% - 32rpx) / 2);
}
.block {
width: 100%;
}
.divider {
color: #999999;
font-size: 24rpx;
line-height: 32rpx;
position: relative;
justify-content: center;
.text {
position: relative;
padding: 0 24rpx;
}
&::before,
&:after {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
border-top: 1px dashed #999999;
width: calc(50% - #{toRpx(72)});
height: 0;
}
&::before {
left: 0;
}
&::after {
right: 0;
}
}
.list-box {
width: 100%;
border-radius: 32rpx;
display: flex;
flex-wrap: wrap;
gap: 24rpx 32rpx;
.list-title {
color: #333333;
width: 100%;
font-size: 32rpx;
font-weight: 500;
line-height: 48rpx;
padding: 8rpx 32rpx 0 0;
}
}
.no-child {
padding-bottom: 0;
}
}
&-box {
position: absolute;
width: calc(100% - #{toRpx(96)});
height: calc(100% - #{toRpx(80)});
border-radius: 32rpx;
background: #fff;
top: 48rpx;
left: 50%;
transform: translateX(-50%);
padding: 0 0 32rpx 32rpx;
overflow-x: auto;
.list-title {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
position: sticky;
top: 0;
z-index: 50;
background: #fff;
}
}
.footer {
height: 136rpx;
.btn {
margin: 0 168rpx;
width: 100%;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 80rpx;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: 28rpx;
font-weight: 500;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<view class="daily-report"> <view class="report-content ">
<view class="common-title"> <template v-if="!isToday">
基础信息 <Detail />
</view>
<template v-if="loadComplete">
<template v-if="list.length">
<view class="daily-report-container">
<template v-for="(i,index) in list">
<view
:class="['list-item',{'block':['group','divider','textarea'].includes(i.type)},{'list-box':i.type == 'group'}]"
:key="index"
v-if="itemShow(i)"
>
<template v-if="i.type != 'group'">
<template v-if="i.type == 'divider'">
<view class="divider flex">
<view class="text">{{ i.label }}</view>
</view>
</template>
<template v-else>
<FormItem
:formItem="i"
:rules="i.rules"
@onSelect="onSelect($event, index)"
@onInput="onInput($event, index)"
:disabled="itemDisabled(i)"
/>
</template>
</template>
<template v-else>
<view class="list-title flex">
{{ i.label }}
</view>
<template v-if="i.children.length">
<template v-for="(c,c_index) in i.children">
<FormItem
class="form-item"
:formItem="c"
:key="c_index"
:rules="i.childrenRules[c.key]"
@onSelect="onSelect($event,index, c_index)"
@onInput="onInput($event, index, c_index)"
:disabled="itemDisabled(c)"
/>
</template>
</template>
</template>
</view>
</template>
</view>
<view class="footer">
<Footer>
<view class="btn">保存</view>
</Footer>
</view>
</template>
<nothing v-else />
</template> </template>
<EditForm <template v-else>
ref="editForm" <Edit :templateData="templateData" />
@onDel="delItem" </template>
@onConfirm="confirm"
/>
</view> </view>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Nothing from '../components/Nothing' import mixins from '../mixins'
import Table from '../components/Table' import Detail from './detail'
import Footer from '../components/Footer' import Edit from './edit'
import utils from '@/utils/utils'
import EditForm from '../components/EditForm'
import FormItem from '../components/FormItem.vue'
export default { export default {
name: 'StoreDailyReport', components: { Detail, Edit },
components: { Table, Nothing, Footer, EditForm, FormItem }, mixins: [mixins],
props: { name: 'StaffDailyReport',
templateData: {
type: Array,
default: () => []
}
},
data () { data () {
return { return {
loadComplete: false,
list: []
} }
}, },
watch: { computed: {
templateData: {
handler (val) {
if (!this.list.length) this.list = utils.deepClone(val)
this.loadComplete = true
},
immediate: true,
deep: true
}
}, },
mounted () { mounted () {
this.loadComplete = true
}, },
methods: { methods: {
itemShow (i) {
if (i.rules) {
let { keys, result } = i.rules,
{ list } = this
if (keys && result) {
let params = keys.map((c, index) => `val${index + 1}`),
// 将 new Function 改为 eval 方式
func = eval(`(function(${params.join(',')}) { return ${result}; })`),
value = []
keys.map(key => {
let item = list.find(i => i.key == key)
if (item) value.push(item.value || null)
})
return func(...value)
} else return true
} else {
return true
}
},
handleRowClick (row, rowIndex, index) {
let parent = this.list[index]
this.$refs.editForm.open(row, rowIndex, index, parent)
},
delItem (c_index, index) {
this.list[index].children.splice(c_index, 1)
},
addItem (index) {
let { templateData } = this
this.list[index].children.push(templateData[index].children[0])
let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1,
parent = this.list[index]
this.$refs.editForm.open(data, c_index, index, parent)
},
confirm (data, c_index, index) {
this.$set(this.list[index].children, c_index, utils.deepClone(data))
},
onInput (val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val)
},
onSelect (val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val)
},
itemDisabled (i) {
let disabled = i.disabled
if (i.disabledFun) {
let { keys, result } = i.disabledFun,
{ list } = this,
params = keys.map((i, index) => `val${index + 1}`),
// 将 new Function 改为 eval 方式
func = eval(`(function(${params.join(',')}) { return ${result}; })`),
value = []
keys.map(key => {
let item = list.find(i => i.key == key)
if (item) value.push(item.value || null)
})
return func(...value)
}
return disabled
},
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.daily-report { .report-content {
height: 100%; height: 100%;
position: relative; position: relative;
&-container {
height: calc(100% - #{toRpx(256)});
padding: 0 48rpx;
box-sizing: border-box;
overflow-y: auto;
display: flex;
flex-wrap: wrap;
gap: 24rpx 32rpx;
align-content: start;
.list-item ,.form-item{
width: calc((100% - 32rpx) / 2);
}
.block {
width: 100%;
}
.divider {
color: #999999;
font-size: 24rpx;
line-height: 32rpx;
position: relative;
justify-content: center;
.text {
position: relative;
padding: 0 24rpx;
}
&::before,
&:after {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
border-top: 1px dashed #999999;
width: calc(50% - #{toRpx(72)});
height: 0;
}
&::before {
left: 0;
}
&::after {
right: 0;
}
}
.list-box {
width: 100%;
border-radius: 32rpx;
display: flex;
flex-wrap: wrap;
gap: 24rpx 32rpx;
.list-title {
color: #333333;
width: 100%;
font-size: 32rpx;
font-weight: 500;
line-height: 48rpx;
padding: 8rpx 32rpx 0 0;
}
}
.no-child {
padding-bottom: 0;
}
}
&-box {
position: absolute;
width: calc(100% - #{toRpx(96)});
height: calc(100% - #{toRpx(80)});
border-radius: 32rpx;
background: #fff;
top: 48rpx;
left: 50%;
transform: translateX(-50%);
padding: 0 0 32rpx 32rpx;
overflow-x: auto;
.list-title {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
position: sticky;
top: 0;
z-index: 50;
background: #fff;
}
}
.footer {
height: 136rpx;
.btn {
margin: 0 168rpx;
width: 100%;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 80rpx;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: 28rpx;
font-weight: 500;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
门店详情
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="list">
<view class="common-title">
</view>
<view class="list-box">
<template v-if="loadComplete">
<template v-if="staffList.length">
<scroll-view scroll-x>
<view class="name-list">
<view
:class="['name-item', currentIndex === index ? 'active' : '', 'flex']"
v-for="(item, index) in staffList"
:key="index"
@click="changeSatffView(index)"
>{{ item.staffName }}</view>
</view>
</scroll-view>
<view class="content">
<template v-for="(i,index) in list">
<view
class="table-box"
:key="`t-${index}`"
v-if="i.children && i.children.length"
>
<view class="table-title">{{ i.label }}</view>
<Table
:columns="i.columns"
:data="i.dataList"
tableStyle="padding-right:32rpx"
/>
</view>
</template>
</view>
</template>
<Nothing v-else />
</template>
</view>
<view class="footer">
<Footer>
<view
class="btn"
@click="$emit('back')"
>返回</view>
</Footer>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import Nothing from '../components/Nothing'
import Footer from '../components/Footer'
import Table from '../components/Table'
export default {
name: 'negotiationList',
components: { Nothing, Footer, Table },
inject: ['userInfo'],
props: {
currentDate: {
type: String,
default: ''
}
},
watch: {
currentDate: {
handler (val) {
if (val) {
this.getDiscussionStaffList(val)
this.currentIndex = 0
}
},
immediate: true,
deep: true
},
},
data () {
return {
staffList: [],
loadComplete: false,
currentIndex: 0,
list: []
}
},
mounted () {
},
methods: {
changeSatffView (index) {
if (this.currentIndex === index) return
this.currentIndex = index
this.getReportDetail(this.staffList[index])
},
async getDiscussionStaffList (reportDate) {
this.loadComplete = false
const { shopMerchantId } = this.userInfo,
data = await uni.$api.dailyTemplateApi.getDiscussionStaffList({
merchantId: shopMerchantId,
reportDate
})
this.staffList = data || []
this.loadComplete = true
if (data && data.length) this.getReportDetail(data[0])
},
async getReportDetail (item) {
const { shopMerchantId } = this.userInfo,
{ currentDate } = this,
data = await uni.$api.dailyTemplateApi.getReportDetail({
merchantId: shopMerchantId,
staffUuid: item.staffUuid,
templateType: 3,
reportDate: currentDate
})
if (data) {
let list = JSON.parse(data.jsonContent || '[]')
list.map(item => {
let columns = [],
dataList = [],
values = {}
if (item.children && item.children.length) {
item.children.map((child, index) => {
child.map(k => {
if (!values[k.key]) values[k.key] = []
values[k.key].push(k.value)
})
columns.push({ title: `数据${index + 1}` })
})
let rowData = item.children[0] || []
rowData.map(row => {
dataList.push({
rowHeader: row.label,
data: values[row.key]
})
})
}
item.columns = columns
item.dataList = dataList
})
this.list = list
}
},
}
}
</script>
<style scoped lang='scss'>
.list {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2;
animation: list-left-in 0.5s ease-in-out;
.common-title {
position: absolute;
top: 0;
left: 0;
}
&-box {
height: calc(100% - #{toRpx(136)});
box-sizing: border-box;
.name-list {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
overflow-x: auto;
gap: 16rpx;
padding: 48rpx 48rpx 32rpx;
.name-item {
padding: 0 48rpx;
height: 72rpx;
color: #6c6f75;
font-size: 28rpx;
line-height: 40rpx;
border-radius: 16rpx;
background: #f5f7fa;
box-sizing: border-box;
border: 2rpx solid #f5f7fa;
}
.active {
border-color: #fff;
font-weight: 500;
color: #fff;
background: linear-gradient(180deg, #6795ff 0%, #4a84f9 100%);
}
}
.content {
height: calc(100% - #{toRpx(152)});
box-sizing: border-box;
margin: 0 48rpx;
padding: 0 32rpx 32rpx;
border-radius: 32rpx;
background: #fff;
overflow-y: auto;
.table-title {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
position: sticky;
top: 0;
z-index: 50;
background: #fff;
}
}
}
.footer {
height: 136rpx;
.btn {
margin: 0 168rpx;
width: 100%;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 80rpx;
background: #3b73ff1a;
color: #4673ff;
font-size: 28rpx;
font-weight: 500;
}
}
}
@keyframes list-left-in {
0% {
left: 100%;
}
100% {
left: 0;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="order-list">
<template v-for="(i, index) in listData">
<view
:key="index"
@click="choose(i)"
:class="['item flex', { active: checkActive(i) }]"
>
<view class="sprite-icon icon-tag-checked"></view>
{{ i.productName }}
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
export default {
mixins: [popupmixin],
name: 'OrderList',
inject: ['userInfo'],
data () {
return {
}
},
computed: {
idKey () {
let { params: { idKey }, sceneType } = this
return Array.isArray(idKey) ? idKey[sceneType] : idKey
}
},
mounted () {
},
methods: {
async getList (searchValue, search) {
const { userInfo, params, data } = this,
{ cacheData } = params
this.currentId = ''
if (!search && cacheData && cacheData.length) {
this.initData(cacheData)
return
}
this.componentLoading(params)
console.log(data)
const { shopMerchantId,uuid } = userInfo,
apiParams = {
merchantId: shopMerchantId,
sellerUserId: uuid,
carBrandTypeFlag: '',
saleDate: ''
}
const res = await uni.$api.dailyTemplateApi.getGoodsOrderList(apiParams)
this.updateParams(params, res || [])
},
initData (list) {
const { data, data: { key }, params: { multiple } } = this
if (data[key]) {
this.currentId = data[key]
let item = list.find(i => i.orderCode == this.currentId)
this.$emit('choose', item)
}
this.list = list
this.$emit('onComplete')
},
originalDataSearch (searchValue) {
if (!searchValue) this.searchStatus = false
else {
searchValue = searchValue.toUpperCase()
let { list } = this,
orderList = JSON.parse(JSON.stringify(list)),
arr = []
orderList.map(e => {
if (e.staffName && e.staffName.toUpperCase().indexOf(searchValue) != -1) arr.push(e)
})
this.searchList = arr
this.searchStatus = true
}
},
choose (i) {
this.currentId = i.orderCode
this.$emit('choose', i)
},
checkActive (i) {
let { currentId, data: { key }, data } = this
return currentId ? i.orderCode == currentId : i.orderCode == data[key]
}
}
}
</script>
<style scoped lang="scss">
.order-list {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
...@@ -52,7 +52,15 @@ const componentConfig = { ...@@ -52,7 +52,15 @@ const componentConfig = {
noData: false, noData: false,
}, },
4: { 4: {
name: 'OrderList',
title: '选择订单',
placeholder: '请输入订单号',
idKey: ['orderCode'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false,
hideSearch: true
}, },
} }
......
...@@ -94,6 +94,8 @@ import Popup from '@/components/Popup.vue' ...@@ -94,6 +94,8 @@ import Popup from '@/components/Popup.vue'
import config from './config' import config from './config'
import EmployeeList from './components/EmployeeList.vue' import EmployeeList from './components/EmployeeList.vue'
import CarModelList from './components/CarModelList.vue' import CarModelList from './components/CarModelList.vue'
import OrderList from './components/OrderList.vue'
import dayjs from 'dayjs'; import dayjs from 'dayjs';
export default { export default {
...@@ -101,6 +103,7 @@ export default { ...@@ -101,6 +103,7 @@ export default {
Popup, Popup,
EmployeeList, EmployeeList,
CarModelList, CarModelList,
OrderList,
}, },
name: '', name: '',
props: { props: {
......
...@@ -128,6 +128,7 @@ export default { ...@@ -128,6 +128,7 @@ export default {
* @param parent 父级数据 * @param parent 父级数据
*/ */
open (data, c_index, index, parent) { open (data, c_index, index, parent) {
console.log(data, c_index, index, parent)
this.data = utils.deepClone(data) || {} this.data = utils.deepClone(data) || {}
this.c_index = c_index || 0 this.c_index = c_index || 0
this.index = index || 0 this.index = index || 0
...@@ -179,7 +180,9 @@ export default { ...@@ -179,7 +180,9 @@ export default {
this.$set(this.data[index], 'value', val) this.$set(this.data[index], 'value', val)
}, },
onSelect (val, index) { onSelect (val, index) {
this.$set(this.data[index], 'value', val) this.$set(this.data[index], 'value', val)
console.log(this.data[index])
}, },
openSelect (item, type, index) { openSelect (item, type, index) {
this.currentItem = item this.currentItem = item
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
:maxlength="11" :maxlength="11"
placeholder-class="placeholderStyle" placeholder-class="placeholderStyle"
type="tel" type="tel"
@input="input"
/> />
</template> </template>
<template v-else-if="item.type == 'textarea'"> <template v-else-if="item.type == 'textarea'">
...@@ -169,6 +170,7 @@ export default { ...@@ -169,6 +170,7 @@ export default {
multipleSelect: 1, multipleSelect: 1,
datetime: 5, datetime: 5,
carBrandSelect: 3 carBrandSelect: 3
}[item.type] || 0 }[item.type] || 0
return popupType return popupType
}, },
...@@ -189,7 +191,8 @@ export default { ...@@ -189,7 +191,8 @@ export default {
select (e) { select (e) {
let { item, popupType } = this let { item, popupType } = this
if (item.optionsKey || item.type == 'datetime' || item.type == 'carBrandSelect') { if (item.optionsKey || item.type == 'datetime' || item.type == 'carBrandSelect') {
if(item.optionsKey == 'storeStaffList') popupType = 2 if (item.optionsKey == 'storeStaffList') popupType = 2
if(item.optionsKey == 'orderList') popupType = 4
this.$emit('openSelect', item, popupType) this.$emit('openSelect', item, popupType)
} else { } else {
this.$emit('onSelect', item.options[e.detail.value].value) this.$emit('onSelect', item.options[e.detail.value].value)
......
...@@ -144,7 +144,9 @@ export default { ...@@ -144,7 +144,9 @@ export default {
data: { data: {
handler (val) { handler (val) {
this.tableData = val || [] this.tableData = val || []
this.getTableWidth() this.$nextTick(() => {
this.getTableWidth()
})
}, },
immediate: true immediate: true
} }
...@@ -166,12 +168,12 @@ export default { ...@@ -166,12 +168,12 @@ export default {
getTableWidth () { getTableWidth () {
const query = uni.createSelectorQuery() const query = uni.createSelectorQuery()
query.select(`#${this.id}`).boundingClientRect(data => { query.select(`#${this.id}`).boundingClientRect(data => {
if (data && data.width) this.tableWidth = data.width + 'px' if (data && data.width) this.tableWidth = data.width + 'px'
}).exec() }).exec()
if (!this.tableWidth) setTimeout(() => { if (!this.tableWidth) setTimeout(() => {
this.getTableWidth() this.getTableWidth()
}, 500) }, 500)
} }
} }
} }
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<view class="detail-content"> <view class="detail-content">
<view class="detail-left"> <view class="detail-left">
<view class="common-title"> <view class="common-title">
<div :class="['sprite-icon',`icon-${titleIcon}-mini`]"></div> <div :class="['sprite-icon',`icon-${assignIcon || titleIcon}-mini`]"></div>
{{ title }} {{assignTitle || title }}
</view> </view>
<view class="content"> <view class="content">
<image <image
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
backgroundColor="transparent" backgroundColor="transparent"
:selected="selectedDays" :selected="selectedDays"
:date="currentDate" :date="currentDate"
:calendarItemStyle="{width:'84rpx',height:'84rpx'}" :calendarItemStyle="{width:'84rpx',height:'90rpx'}"
/> />
</view> </view>
</view> </view>
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
:ref="`ref-${componentName}`" :ref="`ref-${componentName}`"
:is="componentName" :is="componentName"
:templateData="templateData" :templateData="templateData"
:currentDate="currentDate"
@changeComponent="changeComponent"
/> />
</view> </view>
</view> </view>
...@@ -63,19 +65,22 @@ import dayjs from 'dayjs' ...@@ -63,19 +65,22 @@ import dayjs from 'dayjs'
import NoticePopup from '@/components/NoticePopup.vue' import NoticePopup from '@/components/NoticePopup.vue'
import StaffDailyReport from './StaffDailyReport/index.vue' import StaffDailyReport from './StaffDailyReport/index.vue'
import StoreDailyReport from './StoreDailyReport/index.vue' import StoreDailyReport from './StoreDailyReport/index.vue'
import NegotiationDetailList from './NegotiationDetail/index.vue' import NegotiationDetail from './NegotiationDetail/index.vue'
import EditNegotiationDetail from './NegotiationDetail/edit.vue' import EditNegotiationDetail from './NegotiationDetail/edit.vue'
export default { export default {
components: { components: {
NoticePopup, NoticePopup,
StaffDailyReport, StaffDailyReport,
StoreDailyReport, StoreDailyReport,
NegotiationDetailList, NegotiationDetail,
EditNegotiationDetail EditNegotiationDetail
}, },
provide () { provide () {
return { return {
sceneType: this.SCENE_TYPE sceneType: this.SCENE_TYPE,
userInfo: this.userInfo,
templateType: () => this.templateType,
dailyReportRecordId: () => this.dailyReportRecordId,
} }
}, },
data () { data () {
...@@ -88,7 +93,10 @@ export default { ...@@ -88,7 +93,10 @@ export default {
selectedDays: [], // 填写日报日期 selectedDays: [], // 填写日报日期
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'), // 上个月份 lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'), // 上个月份
enterType: '', enterType: '',
templateData: [] templateData: [],
assignTitle: '',
assignIcon: '',
dailyReportRecordId:''
} }
}, },
computed: { computed: {
...@@ -113,32 +121,26 @@ export default { ...@@ -113,32 +121,26 @@ export default {
return { return {
staffdailyreport: '驻店日报', staffdailyreport: '驻店日报',
storedailyreport: '门店日报', storedailyreport: '门店日报',
negotiationdetaillist: '洽谈明细', negotiationdetail: '洽谈明细'
editnegotiationdetail: '洽谈明细'
}[this.componentName.toLowerCase()] }[this.componentName.toLowerCase()]
}, },
titleIcon () { titleIcon () {
return { return {
staffdailyreport: 'daily-report', staffdailyreport: 'daily-report',
storedailyreport: 'store-daily-report', storedailyreport: 'store-daily-report',
negotiationdetaillist: 'negotiation-detail', negotiationdetail: 'negotiation-detail'
editnegotiationdetail: 'negotiation-detail'
}[this.componentName.toLowerCase()] }[this.componentName.toLowerCase()]
}, },
componentName () { componentName () {
let { currentDate, options } = this, let { options } = this,
componentName = options.componentName || '' componentName = options.componentName || ''
if (componentName && componentName.toLowerCase() == 'negotiationdetaillist' && currentDate == dayjs().format('YYYY-MM-DD')) {
componentName = 'EditNegotiationDetail'
}
return componentName return componentName
}, },
templateType () { templateType () {
return { return {
staffdailyreport: 1, staffdailyreport: 1,
storedailyreport: 2, storedailyreport: 2,
negotiationdetaillist: 3, negotiationdetail: 3,
editnegotiationdetail: 3
}[this.componentName.toLowerCase()] }[this.componentName.toLowerCase()]
}, },
dayList () { dayList () {
...@@ -159,9 +161,10 @@ export default { ...@@ -159,9 +161,10 @@ export default {
}, },
onLoad (options) { onLoad (options) {
this.options = options this.options = options
if (options.currentDate) this.setCurrentDate(options.currentDate)
this.getReportList() this.getReportList()
this.getDailyTemplate(options.componentName) this.getReportDetail()
if (options.currentDate) this.setCurrentDate(options.currentDate) // this.getDailyTemplate()
}, },
onUnload () { onUnload () {
}, },
...@@ -169,7 +172,6 @@ export default { ...@@ -169,7 +172,6 @@ export default {
async getReportList () { async getReportList () {
const { uuid, shopMerchantId } = this.userInfo, const { uuid, shopMerchantId } = this.userInfo,
{ templateType, dayList } = this { templateType, dayList } = this
const data = await uni.$api.dailyTemplateApi.getReportList({ const data = await uni.$api.dailyTemplateApi.getReportList({
merchantId: shopMerchantId, merchantId: shopMerchantId,
staffUuid: uuid, staffUuid: uuid,
...@@ -177,10 +179,15 @@ export default { ...@@ -177,10 +179,15 @@ export default {
reportStartDate: dayList[0], reportStartDate: dayList[0],
reportEndDate: dayList[dayList.length - 1] reportEndDate: dayList[dayList.length - 1]
}) })
let selectedDay = []
console.log(data) dayList.map(e => {
if (!data.includes(e)) selectedDay.push({
date: e
})
})
this.selectedDays = selectedDay
}, },
async getDailyTemplate (componentName) { async getDailyTemplate () {
const hasCommonElement = (arrA, arrB) => { const hasCommonElement = (arrA, arrB) => {
return arrA.some(item => arrB.includes(item)) return arrA.some(item => arrB.includes(item))
} }
...@@ -189,14 +196,8 @@ export default { ...@@ -189,14 +196,8 @@ export default {
const setA = new Set(arrA); const setA = new Set(arrA);
return arrB.every(item => setA.has(item)); return arrB.every(item => setA.has(item));
} }
const type = { const { templateType, CAR_BRAND_ID, BASE_SCENE_CODE } = this,
staffdailyreport: 1, data = await uni.$api.dailyTemplateApi.getDailyTemplate(templateType)
storedailyreport: 2,
negotiationdetaillist: 3,
editnegotiationdetail: 3
}[componentName.toLowerCase()],
{ SCENE_TYPE, CAR_BRAND_ID, BASE_SCENE_CODE } = this,
data = await uni.$api.dailyTemplateApi.getDailyTemplate(type)
let templateData = Object.values(data) let templateData = Object.values(data)
// .filter(item => { // .filter(item => {
// // 场景类型过滤 // // 场景类型过滤
...@@ -239,8 +240,11 @@ export default { ...@@ -239,8 +240,11 @@ export default {
} }
else return item.baseSceneCode?.length ? hasCommonElement(item.baseSceneCode, BASE_SCENE_CODE) : true else return item.baseSceneCode?.length ? hasCommonElement(item.baseSceneCode, BASE_SCENE_CODE) : true
}) })
templateData.map(e =>{
if(e.children && e.type == 'subform') e.origin_children = e.children[0]
})
console.log(templateData)
this.templateData = templateData this.templateData = templateData
console.log(templateData)
}, },
setCurrentDate (currentDate) { setCurrentDate (currentDate) {
console.log(currentDate) console.log(currentDate)
...@@ -248,7 +252,28 @@ export default { ...@@ -248,7 +252,28 @@ export default {
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
changeCurrentDate (e) { changeCurrentDate (e) {
this.templateData = []
this.currentDate = e.fulldate this.currentDate = e.fulldate
this.getReportDetail()
},
async getReportDetail () {
const { uuid, shopMerchantId } = this.userInfo,
nowDate = dayjs().format('YYYY-MM-DD'),
{ templateType, currentDate } = this,
data = await uni.$api.dailyTemplateApi.getReportDetail({
merchantId: shopMerchantId,
staffUuid: uuid,
templateType,
reportDate: currentDate
})
if (data) {
this.dailyReportRecordId = data.id
this.templateData = JSON.parse(data.jsonContent || '[]')
console.log(this.templateData)
}
else {
if (nowDate == currentDate) this.getDailyTemplate()
}
}, },
changeMonth (e) { changeMonth (e) {
this.currentMonth = `${e.year}-${e.month}` this.currentMonth = `${e.year}-${e.month}`
...@@ -264,6 +289,10 @@ export default { ...@@ -264,6 +289,10 @@ export default {
this.transmissionOfData = val this.transmissionOfData = val
} }
}, },
changeComponent (val) {
this.assignTitle = val.title
this.assignIcon = val.icon
}
} }
} }
......
import dayjs from "dayjs"
export default {
inject: ['sceneType', 'userInfo', 'templateType', 'dailyReportRecordId'],
data () {
return {
dayjs,
nowDate: dayjs().format('YYYY-MM-DD'),
}
},
props: {
currentDate: String,
templateData: {
type: Array,
default: () => ([])
}
},
computed: {
isToday () {
return this.currentDate == this.nowDate
},
reportParams () {
let { shopMerchantId, shopMerchantName, uuid, name } = this.userInfo,
{ currentDate, templateType,dailyReportRecordId } = this
return {
merchantId: shopMerchantId,
merchantName: shopMerchantName,
reportDate: currentDate,
staffUuid: uuid,
staffName: name,
dailyReportSource: 2,//1:生意助手员工版小程序,2:平板电脑
templateType: templateType(),
dailyReportRecordId: dailyReportRecordId()
}
},
},
watch: {
},
methods: {
async saveReport (list) {
try {
let { reportParams } = this
console.log('保存日报', reportParams)
console.log(list)
list.map(e => {
if (e.children && e.children.length) e.children.map((c, cIndex) => {
let isArray = Array.isArray(c)
if (isArray) {
c.map(i => {
// if(i.required && (i.value == null || i.value == undefined)) throw `${e.label}第${cIndex+1}项${i.label}不能为空`
})
} else {
}
})
})
reportParams.jsonContent = JSON.stringify(list)
const data = await uni.$api.dailyTemplateApi.saveDraft(reportParams)
console.log(data)
} catch (error) {
uni.showToast({ title: error, icon: 'none' })
}
},
submitReport () {
console.log('提交日报')
},
}
}
\ No newline at end of file \ No newline at end of file
...@@ -166,7 +166,7 @@ $uni-primary: #4673ff !default; ...@@ -166,7 +166,7 @@ $uni-primary: #4673ff !default;
.uni-calendar-item__weeks-box-circle { .uni-calendar-item__weeks-box-circle {
position: absolute; position: absolute;
bottom: toRpx(10); bottom: toRpx(6);
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
width: toRpx(12); width: toRpx(12);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!