Commit 2ac400b0 by 李伟康

feat(api): 添加商户基础场景码列表查询接口

- 新增 getMerchantBaseSceneCodeList 方法用于查询员工账号上架门店的小场景值
- 在 dailyTemplateApi 模块中导出新的接口方法
- 更新 Entrance 组件中的驻店日报入口配置逻辑
- 重构驻店日报入口的条件判断和展示逻辑
- 优化入口列表的过滤和展示机制
- 添加新的接口文档注释说明
1 parent a5e76c7b
...@@ -108,6 +108,16 @@ const getGoodsOrderList = async (data = {}) => { ...@@ -108,6 +108,16 @@ const getGoodsOrderList = async (data = {}) => {
...data ...data
}) })
} }
/**
* 查询员工账号上架门店的小场景值
*/
const getMerchantBaseSceneCodeList = async (data = {}) => {
return http.post({
method: 'dj.api.smartcarlife.staffBaseInfo.merchant.baseSceneCode.list',
projectName: 'boutique',
...data
})
}
module.exports = { module.exports = {
getDailyTemplate, getDailyTemplate,
...@@ -118,5 +128,6 @@ module.exports = { ...@@ -118,5 +128,6 @@ module.exports = {
saveDraft, saveDraft,
getDiscussionStaffList, getDiscussionStaffList,
submitReport, submitReport,
getGoodsOrderList getGoodsOrderList,
getMerchantBaseSceneCodeList
} }
...@@ -161,14 +161,6 @@ export default { ...@@ -161,14 +161,6 @@ export default {
noInterception: true noInterception: true
}, },
{ {
icon: 'daily-report',
label: '驻店日报-新',
name: 'staffDailyReport',
page: '/pages/common/dailyNewspaper/index',
eventCode: 'staff_daily_report_page',
noInterception: true
},
{
icon: 'store-daily-report', icon: 'store-daily-report',
label: '门店日报', label: '门店日报',
name: 'storeDailyReport', name: 'storeDailyReport',
...@@ -190,10 +182,18 @@ export default { ...@@ -190,10 +182,18 @@ export default {
{ sceneType, shopMerchantId } = userInfo, { sceneType, shopMerchantId } = userInfo,
newReport = await this.isNewVersionNeed(shopMerchantId) newReport = await this.isNewVersionNeed(shopMerchantId)
if (newReport && sceneType != 7) { if (newReport && sceneType != 7) {
let [staffDailyReport] = entranceList
entranceList[0] = {
...staffDailyReport,
name: 'staffDailyReport',
page: '/pages/common/dailyNewspaper/index',
eventCode: 'staff_daily_report_page',
}
entranceList.map(e => { entranceList.map(e => {
if (['staffDailyReport', 'storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1] if (['staffDailyReport', 'storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1]
}) })
} }
this.$store.dispatch('setNewReport', newReport)
// 先根据场景过滤 // 先根据场景过滤
let list = entranceList.filter(e => e.sceneType?.includes(sceneType)) let list = entranceList.filter(e => e.sceneType?.includes(sceneType))
// 加载阶段或不允许显示时,移除工资申诉入口 // 加载阶段或不允许显示时,移除工资申诉入口
......
...@@ -345,7 +345,7 @@ export default { ...@@ -345,7 +345,7 @@ export default {
/** /**
* 获取门店分类 * 获取门店分类
*/ */
this.getSceneByMerchantId() this.getMerchantBaseSceneCodeList()
}, },
methods: { methods: {
// 处理开始测评(参考 detail.vue 的实现) // 处理开始测评(参考 detail.vue 的实现)
...@@ -770,13 +770,16 @@ export default { ...@@ -770,13 +770,16 @@ export default {
handleTouchStart() { handleTouchStart() {
uni.$emit('reset_timeout') uni.$emit('reset_timeout')
}, },
async getSceneByMerchantId() { async getMerchantBaseSceneCodeList() {
const merchantId = uni.$storage.get('userInfo').shopMerchantId, const { shopMerchantId: merchantId, uuid } = uni.$storage.get('userInfo'),
data = await uni.$api.commonApi.getSceneByMerchantId({ { sceneType } = this,
merchantId data = await uni.$api.dailyTemplateApi.getMerchantBaseSceneCodeList({
merchantId,
staffUuid: uuid,
sceneType
}) })
let baseSceneCode = [] let baseSceneCode = []
if (data && data.length) baseSceneCode = data.map(e => Number(e.baseSceneCode)) if (data && data.length) baseSceneCode = data.map(e => Number(e))
uni.$storage.set('baseSceneCode', baseSceneCode) uni.$storage.set('baseSceneCode', baseSceneCode)
} }
} }
......
...@@ -7,6 +7,9 @@ export default { ...@@ -7,6 +7,9 @@ export default {
computed: { computed: {
userInfo() { userInfo() {
return uni.$storage.get('userInfo') || {} return uni.$storage.get('userInfo') || {}
},
isNewReport() {
return this.$store.state.user.newReport
} }
}, },
mounted() {}, mounted() {},
...@@ -51,7 +54,7 @@ export default { ...@@ -51,7 +54,7 @@ export default {
cancelColor: '#292D33', cancelColor: '#292D33',
confirmText: modalInfo.confirmText, confirmText: modalInfo.confirmText,
confirmColor: '#347BFF', confirmColor: '#347BFF',
success: (res) => { success: res => {
// wx.__HAS_SHOW_MODAL = false; // wx.__HAS_SHOW_MODAL = false;
// if (res.cancel) _this.showNextModal(); // if (res.cancel) _this.showNextModal();
if (res.cancel) this.showNextModal() if (res.cancel) this.showNextModal()
...@@ -64,7 +67,7 @@ export default { ...@@ -64,7 +67,7 @@ export default {
* 轻改日报 * 轻改日报
*/ */
staffDailyReport() { staffDailyReport() {
let { userInfo } = this let { userInfo, isNewReport } = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.$api.interceptionApi uni.$api.interceptionApi
.staffDailyReportMerchantValid({ .staffDailyReportMerchantValid({
...@@ -74,6 +77,7 @@ export default { ...@@ -74,6 +77,7 @@ export default {
sceneType: 1 sceneType: 1
}) })
.then(data => { .then(data => {
console.log(data)
if (data) { if (data) {
// 获取当前日期 // 获取当前日期
let currentDate = new Date() let currentDate = new Date()
...@@ -91,11 +95,22 @@ export default { ...@@ -91,11 +95,22 @@ export default {
console.log(formattedDate) console.log(formattedDate)
const pages = getCurrentPages(), const pages = getCurrentPages(),
currentPage = pages[pages.length - 1] currentPage = pages[pages.length - 1]
if (currentPage.route == 'pages/boutique/tool/index') uni.$emit('jumpToDailyReport', formattedDate) if (currentPage.route == 'pages/boutique/tool/index') {
else if (isNewReport)
uni.navigateTo({ uni.redirectTo({
url: `/pages/boutique/tool/index?componentName=DailyReport&currentDate=${formattedDate}` url: `/pages/common/dailyNewspaper/index?componentName=StaffDailyReport&currentDate=${formattedDate}`
}) })
else uni.$emit('jumpToDailyReport', formattedDate)
} else {
if (isNewReport)
uni.navigateTo({
url: `/pages/common/dailyNewspaper/index?componentName=StaffDailyReport&currentDate=${formattedDate}`
})
else
uni.navigateTo({
url: `/pages/boutique/tool/index?componentName=DailyReport&currentDate=${formattedDate}`
})
}
} }
}) })
resolve(true) resolve(true)
......
...@@ -5,39 +5,22 @@ ...@@ -5,39 +5,22 @@
<template v-if="loadComplete"> <template v-if="loadComplete">
<template v-if="list.length"> <template v-if="list.length">
<view class="daily-report-container"> <view class="daily-report-container">
<template v-for="(i,index) in list"> <template v-for="(i, index) in list">
<view <view :class="['list-box', { 'no-child': !i.children.length }]" :key="index">
:class="['list-box',{ 'no-child': !i.children.length }]"
:key="index"
>
<view class="list-title flex"> <view class="list-title flex">
{{ i.label }} {{ i.label }}
<template v-if="!i.children.length"> <template v-if="!i.children.length">
<view <view :class="['add flex', { 'disabled': !saveBtn }]" @click="addItem(index)">
class="add flex"
@click="addItem(index)"
>
<view class="add-icon"></view> <view class="add-icon"></view>
新增 新增
</view> </view>
</template> </template>
</view> </view>
<template v-if="i.children.length"> <template v-if="i.children.length">
<Table <Table :columns="i.children[0]" :data="i.children" titleKey="label" tableStyle="padding-right:32rpx"
:columns="i.children[0]" customTable cornerText="序号" LeftWidth="104rpx" @rowClick="handleRowClick" :tableIndex="index"
:data="i.children" hasFooter @clickAdd="addItem(index)" :maxLength="i.rules.maxLength">
titleKey="label" <template v-slot:customCell="{ row, colIndex }">
tableStyle="padding-right:32rpx"
customTable
cornerText="序号"
LeftWidth="104rpx"
@rowClick="handleRowClick"
:tableIndex="index"
hasFooter
@clickAdd="addItem(index)"
:maxLength="i.rules.maxLength"
>
<template v-slot:customCell="{row, colIndex}">
<text>{{ formatValue(row[colIndex].value) }}</text> <text>{{ formatValue(row[colIndex].value) }}</text>
<template v-if="row[colIndex].unit && formatValue(row[colIndex].value) != '-'"> <template v-if="row[colIndex].unit && formatValue(row[colIndex].value) != '-'">
<text class="unit">{{ row[colIndex].unit }}</text> <text class="unit">{{ row[colIndex].unit }}</text>
...@@ -50,20 +33,14 @@ ...@@ -50,20 +33,14 @@
</view> </view>
<view class="footer"> <view class="footer">
<Footer> <Footer>
<view <view class="btn default-btn" @click="saveBtn = true" v-if="!saveBtn">编辑</view>
class="btn" <view class="btn" @click="$emit('submitReport', list)" v-else>保存</view>
@click="$emit('submitReport',list)"
>保存</view>
</Footer> </Footer>
</view> </view>
</template> </template>
<nothing v-else /> <nothing v-else />
</template> </template>
<EditForm <EditForm ref="editForm" @onDel="delItem" @onConfirm="confirm" />
ref="editForm"
@onDel="delItem"
@onConfirm="confirm"
/>
</view> </view>
</template> </template>
...@@ -81,17 +58,19 @@ export default { ...@@ -81,17 +58,19 @@ export default {
templateData: { templateData: {
type: Array, type: Array,
default: () => [] default: () => []
} },
ReportStatus: null
}, },
data () { data() {
return { return {
loadComplete: false, loadComplete: false,
list: [] list: [],
saveBtn: true
} }
}, },
watch: { watch: {
templateData: { templateData: {
handler (val) { handler(val) {
this.loadComplete = false this.loadComplete = false
this.list = utils.deepClone(val) this.list = utils.deepClone(val)
setTimeout(() => { setTimeout(() => {
...@@ -100,31 +79,46 @@ export default { ...@@ -100,31 +79,46 @@ export default {
}, },
immediate: true, immediate: true,
deep: true deep: true
},
ReportStatus: {
handler(val) {
this.saveBtn = val != 1
},
immediate: true,
deep: true
},
saveBtn: {
handler(val) {
this.$emit('getSaveBtnStatus', val)
},
immediate: true,
deep: true
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
handleRowClick (row, rowIndex, index) { handleRowClick(row, rowIndex, index) {
let parent = this.list[index] let parent = this.list[index]
this.$refs.editForm.open(row, rowIndex, index, parent) this.$refs.editForm.open(row, rowIndex, index, parent)
}, },
delItem (c_index, index) { delItem(c_index, index) {
this.list[index].children.splice(c_index, 1) this.list[index].children.splice(c_index, 1)
}, },
addItem (index) { addItem(index) {
let { templateData } = this, let { templateData, saveBtn } = this,
parent = this.list[index] parent = this.list[index]
if(!saveBtn) return
this.list[index].children.push(templateData[index].origin_children) 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
this.$refs.editForm.open(data, c_index, index, parent) this.$refs.editForm.open(data, c_index, index, parent)
}, },
confirm (data, c_index, index) { confirm(data, c_index, index) {
this.$set(this.list[index].children, c_index, utils.deepClone(data)) this.$set(this.list[index].children, c_index, utils.deepClone(data))
}, },
formatValue (value) { formatValue(value) {
return value !== null && value !=='' && value !== undefined ? value : '-' return value !== null && value !== '' && value !== undefined ? value : '-'
} }
} }
} }
...@@ -134,6 +128,7 @@ export default { ...@@ -134,6 +128,7 @@ export default {
.daily-report { .daily-report {
height: 100%; height: 100%;
position: relative; position: relative;
&-container { &-container {
height: calc(100% - #{toRpx(184)}); height: calc(100% - #{toRpx(184)});
padding: 0 48rpx; padding: 0 48rpx;
...@@ -141,22 +136,27 @@ export default { ...@@ -141,22 +136,27 @@ export default {
overflow-y: auto; overflow-y: auto;
transform: translateY(48rpx); transform: translateY(48rpx);
} }
.common-title { .common-title {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
} }
.list-box { .list-box {
width: 100%; width: 100%;
border-radius: 16rpx; border-radius: 16rpx;
background: #fff; background: #fff;
padding: 0 0 32rpx 32rpx; padding: 0 0 32rpx 32rpx;
margin-bottom: 32rpx; margin-bottom: 32rpx;
.list-title { .list-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
line-height: 44rpx; line-height: 44rpx;
padding: 32rpx 32rpx 24rpx 0; padding: 32rpx 32rpx 24rpx 0;
transition: all .25s ease-in-out;
.add { .add {
margin-left: auto; margin-left: auto;
height: 64rpx; height: 64rpx;
...@@ -168,11 +168,13 @@ export default { ...@@ -168,11 +168,13 @@ export default {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: #2c66f7; color: #2c66f7;
&-icon { &-icon {
position: relative; position: relative;
width: 28rpx; width: 28rpx;
height: 28rpx; height: 28rpx;
margin-right: 10rpx; margin-right: 10rpx;
&::before, &::before,
&::after { &::after {
position: absolute; position: absolute;
...@@ -183,24 +185,36 @@ export default { ...@@ -183,24 +185,36 @@ export default {
background: #4673ff; background: #4673ff;
border-radius: 4rpx; border-radius: 4rpx;
} }
&::before { &::before {
width: 4rpx; width: 4rpx;
height: 28rpx; height: 28rpx;
} }
&::after { &::after {
width: 28rpx; width: 28rpx;
height: 4rpx; height: 4rpx;
} }
} }
} }
.disabled{
opacity: .5;
}
} }
} }
.no-child { .no-child {
padding-bottom: 0; padding-bottom: 0;
.list-title {
padding-bottom: 32rpx;
}
} }
.footer { .footer {
transform: translateY(48rpx); transform: translateY(48rpx);
height: 136rpx; height: 136rpx;
.btn { .btn {
margin: 0 168rpx; margin: 0 168rpx;
width: 100%; width: 100%;
...@@ -214,6 +228,11 @@ export default { ...@@ -214,6 +228,11 @@ export default {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
} }
.default-btn {
background: #3b73ff1a;
color: #4673ff;
}
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
<Detail :templateData="templateData" /> <Detail :templateData="templateData" />
</template> </template>
<template v-else> <template v-else>
<Edit <Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event" :ReportStatus="ReportStatus" />
:templateData="templateData"
@submitReport="submitReport"
/>
</template> </template>
</view> </view>
</template> </template>
...@@ -21,15 +18,14 @@ export default { ...@@ -21,15 +18,14 @@ export default {
mixins: [mixins], mixins: [mixins],
name: 'NegotiationDetail', name: 'NegotiationDetail',
data () { data() {
return { return {
} }
}, },
computed: { computed: {
}, },
mounted () { mounted() {
this.loadComplete = true
}, },
methods: { methods: {
} }
......
...@@ -18,18 +18,20 @@ ...@@ -18,18 +18,20 @@
</template> </template>
<template v-else> <template v-else>
<FormItem :formItem="i" :rules="i.rules" @onSelect="onSelect($event, index)" <FormItem :formItem="i" :rules="i.rules" @onSelect="onSelect($event, index)"
@onInput="onInput($event, index)" :disabled="itemDisabled(i)" /> @onInput="onInput($event, index)" :disabled="itemDisabled(i)" :readonly="!saveBtn" />
</template> </template>
</template> </template>
<template v-else> <template v-else>
<view class="list-title flex">
{{ i.label }}
</view>
<template v-if="i.children.length"> <template v-if="i.children.length">
<template v-for="(c, c_index) in i.children"> <view class="list-title flex">
<FormItem class="form-item" :formItem="c" :key="c_index" :rules="i.childrenRules[c.key]" {{ i.label }}
@onSelect="onSelect($event, index, c_index)" @onInput="onInput($event, index, c_index)" </view>
:disabled="itemDisabled(c)" /> <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)" :readonly="!saveBtn" />
</template>
</template> </template>
</template> </template>
</template> </template>
...@@ -38,7 +40,8 @@ ...@@ -38,7 +40,8 @@
</view> </view>
<view class="footer"> <view class="footer">
<Footer> <Footer>
<view class="btn" @click="$emit('submitReport', list)">保存</view> <view class="btn default-btn" @click="saveBtn = true" v-if="!saveBtn">编辑</view>
<view class="btn" @click="$emit('submitReport', list)" v-else>保存</view>
</Footer> </Footer>
</view> </view>
</template> </template>
...@@ -62,12 +65,14 @@ export default { ...@@ -62,12 +65,14 @@ export default {
templateData: { templateData: {
type: Array, type: Array,
default: () => [] default: () => []
} },
ReportStatus: null
}, },
data() { data() {
return { return {
loadComplete: false, loadComplete: false,
list: [] list: [],
saveBtn: true
} }
}, },
watch: { watch: {
...@@ -75,13 +80,26 @@ export default { ...@@ -75,13 +80,26 @@ export default {
handler(val) { handler(val) {
this.loadComplete = false this.loadComplete = false
this.list = utils.deepClone(val) this.list = utils.deepClone(val)
console.log(this.list)
setTimeout(() => { setTimeout(() => {
this.loadComplete = true this.loadComplete = true
}, 200) }, 200)
}, },
immediate: true, immediate: true,
deep: true deep: true
},
ReportStatus: {
handler(val) {
this.saveBtn = val != 1
},
immediate: true,
deep: true
},
saveBtn: {
handler(val) {
this.$emit('getSaveBtnStatus', val)
},
immediate: true,
deep: true
} }
}, },
mounted() { mounted() {
...@@ -285,6 +303,11 @@ export default { ...@@ -285,6 +303,11 @@ export default {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
} }
.default-btn {
background: #3b73ff1a;
color: #4673ff;
}
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<view class="report-content "> <view class="report-content ">
<template v-if="!isToday"> <template v-if="!editableDate">
<Detail :templateData="templateData" /> <Detail :templateData="templateData" />
</template> </template>
<template v-else> <template v-else>
<Edit <Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event"
:templateData="templateData" :ReportStatus="ReportStatus" />
@submitReport="submitReport"
/>
</template> </template>
</view> </view>
</template> </template>
...@@ -20,15 +18,15 @@ export default { ...@@ -20,15 +18,15 @@ export default {
components: { Detail, Edit }, components: { Detail, Edit },
mixins: [mixins], mixins: [mixins],
name: 'StaffDailyReport', name: 'StaffDailyReport',
data () { data() {
return { return {
} }
}, },
computed: { computed: {
}, },
mounted () { mounted() {
this.loadComplete = true
}, },
methods: { methods: {
} }
......
<template> <template>
<view class="report-content "> <view class="report-content ">
<view :class="['report-component',{'opacity':showNegotiationList}]"> <view :class="['report-component',{'opacity':showNegotiationList},{'show':showReport}]">
<template v-if="!isToday || ReportStatus == 1"> <template v-if="!isToday || ReportStatus == 1">
<Detail :templateData="templateData" /> <Detail :templateData="templateData" />
</template> </template>
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
@saveReport="saveReport" @saveReport="saveReport"
@submitReport="submitReport" @submitReport="submitReport"
:reportDate="currentDate" :reportDate="currentDate"
:ReportStatus="ReportStatus"
@getSaveBtnStatus="saveBtnStatus = $event"
/> />
</template> </template>
</view> </view>
...@@ -36,7 +38,8 @@ export default { ...@@ -36,7 +38,8 @@ export default {
name: 'StoreDailyReport', name: 'StoreDailyReport',
data () { data () {
return { return {
showNegotiationList: false showNegotiationList: false,
showReport: true
} }
}, },
...@@ -59,7 +62,12 @@ export default { ...@@ -59,7 +62,12 @@ export default {
}, },
methods: { methods: {
changeComponent (val) { changeComponent (val) {
this.showNegotiationList = val if(!val) {
setTimeout(() => { this.showNegotiationList = false }, 450)
}
else this.showNegotiationList = true
this.showReport = !val
this.$emit('changeComponent', { this.$emit('changeComponent', {
title: val ? '洽谈明细表' : '', title: val ? '洽谈明细表' : '',
icon: val ? 'negotiation-detail' : '' icon: val ? 'negotiation-detail' : ''
...@@ -74,9 +82,12 @@ export default { ...@@ -74,9 +82,12 @@ export default {
.report-component { .report-component {
height: 100%; height: 100%;
position: relative; position: relative;
transition: all 0.5s ease-in-out;
} }
.opacity { .opacity {
opacity: 0; left: -100%;
visibility: hidden; }
.show{
left: 0;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<view class="list"> <view :class="['list', { out: isOut }]">
<view class="common-title"> <view class="common-title">
</view> </view>
<view class="list-box"> <view class="list-box">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</view> </view>
<view class="footer"> <view class="footer">
<Footer> <Footer>
<view class="btn" @click="$emit('back')">返回</view> <view class="btn" @click="back">返回</view>
</Footer> </Footer>
</view> </view>
</view> </view>
...@@ -41,7 +41,7 @@ import utils from '@/utils/utils' ...@@ -41,7 +41,7 @@ import utils from '@/utils/utils'
export default { export default {
name: 'negotiationList', name: 'negotiationList',
components: { Nothing, Footer, Table }, components: { Nothing, Footer, Table },
inject: ['userInfo'], inject: ['userInfo','sceneType'],
props: { props: {
currentDate: { currentDate: {
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
if (val) { if (val) {
this.getDiscussionStaffList(val) this.getDiscussionStaffList(val)
this.currentIndex = 0 this.currentIndex = 0
this.isOut = false
} }
}, },
immediate: true, immediate: true,
...@@ -67,7 +68,8 @@ export default { ...@@ -67,7 +68,8 @@ export default {
staffList: [], staffList: [],
loadComplete: false, loadComplete: false,
currentIndex: 0, currentIndex: 0,
list: [] list: [],
isOut: false
} }
}, },
mounted() { mounted() {
...@@ -81,9 +83,11 @@ export default { ...@@ -81,9 +83,11 @@ export default {
async getDiscussionStaffList(reportDate) { async getDiscussionStaffList(reportDate) {
this.loadComplete = false this.loadComplete = false
const { shopMerchantId } = this.userInfo, const { shopMerchantId } = this.userInfo,
{sceneType} = this,
data = await uni.$api.dailyTemplateApi.getDiscussionStaffList({ data = await uni.$api.dailyTemplateApi.getDiscussionStaffList({
merchantId: shopMerchantId, merchantId: shopMerchantId,
reportDate reportDate,
sceneType
}) })
this.staffList = data || [] this.staffList = data || []
this.loadComplete = true this.loadComplete = true
...@@ -92,12 +96,13 @@ export default { ...@@ -92,12 +96,13 @@ export default {
}, },
async getReportDetail(item) { async getReportDetail(item) {
const { shopMerchantId } = this.userInfo, const { shopMerchantId } = this.userInfo,
{ currentDate } = this, { currentDate, sceneType } = this,
data = await uni.$api.dailyTemplateApi.getReportDetail({ data = await uni.$api.dailyTemplateApi.getReportDetail({
merchantId: shopMerchantId, merchantId: shopMerchantId,
staffUuid: item.staffUuid, staffUuid: item.staffUuid,
templateType: 3, templateType: 3,
reportDate: currentDate reportDate: currentDate,
sceneType
}) })
if (data) { if (data) {
let list = JSON.parse(data.jsonContent || '[]') let list = JSON.parse(data.jsonContent || '[]')
...@@ -151,6 +156,10 @@ export default { ...@@ -151,6 +156,10 @@ export default {
this.list = list this.list = list
} }
}, },
back() {
this.isOut = true
this.$emit('back')
}
} }
} }
</script> </script>
...@@ -244,6 +253,10 @@ export default { ...@@ -244,6 +253,10 @@ export default {
} }
} }
.list.out {
animation: list-right-out 0.5s ease-in-out;
}
@keyframes list-left-in { @keyframes list-left-in {
0% { 0% {
left: 100%; left: 100%;
...@@ -253,4 +266,14 @@ export default { ...@@ -253,4 +266,14 @@ export default {
left: 0; left: 0;
} }
} }
@keyframes list-right-out {
0% {
left: 0;
}
100% {
left: 100%;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</view> </view>
<template v-if="hasFooter"> <template v-if="hasFooter">
<view class="footer-row" :style="{ width: tableWidth }" v-if="maxLength && tableData.length < maxLength"> <view class="footer-row" :style="{ width: tableWidth }" v-if="maxLength && tableData.length < maxLength">
<view class="add" @click="$emit('clickAdd')"></view> <view :class="['add', { 'disabled': disabled }]" @click="add"></view>
</view> </view>
</template> </template>
</view> </view>
...@@ -113,6 +113,10 @@ export default { ...@@ -113,6 +113,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
disabled: {
type: Boolean,
default: false
},
}, },
data() { data() {
return { return {
...@@ -141,11 +145,15 @@ export default { ...@@ -141,11 +145,15 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
add() {
if (this.disabled) return
this.$emit('clickAdd')
},
formatValue(value) { formatValue(value) {
return value !== null && value !== '' && value !== undefined ? value : '-' return value !== null && value !== '' && value !== undefined ? value : '-'
}, },
handleRowClick(row, rowIndex) { handleRowClick(row, rowIndex) {
if (this.isDetail) return if (this.isDetail || this.disabled) return
// 清除之前的定时器 // 清除之前的定时器
if (this.clickTimer) { if (this.clickTimer) {
clearTimeout(this.clickTimer) clearTimeout(this.clickTimer)
...@@ -352,4 +360,8 @@ export default { ...@@ -352,4 +360,8 @@ export default {
.is-detail { .is-detail {
color: #999 !important; color: #999 !important;
} }
.disabled {
opacity: .5;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -171,26 +171,22 @@ export default { ...@@ -171,26 +171,22 @@ export default {
} }
) )
}, },
back() { async back() {
let now = dayjs().format('YYYY-MM-DD') const openNotice = await this.checkReport()
if (this.currentDate == now) { console.log(openNotice)
if (this.templateType == 2) { if (openNotice) this.exitInterception()
if (this.reportStatus != 1) this.exitInterception() else this.backPage()
else this.backPage()
} else {
this.exitInterception()
}
} else this.backPage()
}, },
async getReportList() { async getReportList() {
const { uuid, shopMerchantId } = this.userInfo, const { uuid, shopMerchantId } = this.userInfo,
{ templateType, dayList } = this { templateType, dayList, SCENE_TYPE: sceneType } = this
const data = await uni.$api.dailyTemplateApi.getReportList({ const data = await uni.$api.dailyTemplateApi.getReportList({
merchantId: shopMerchantId, merchantId: shopMerchantId,
staffUuid: uuid, staffUuid: uuid,
templateType, templateType,
reportStartDate: dayList[0], reportStartDate: dayList[0],
reportEndDate: dayList[dayList.length - 1] reportEndDate: dayList[dayList.length - 1],
sceneType
}) })
let selectedDay = [] let selectedDay = []
dayList.map(e => { dayList.map(e => {
...@@ -274,20 +270,21 @@ export default { ...@@ -274,20 +270,21 @@ export default {
this.getReportDetail() this.getReportDetail()
}, },
async checkReport() { async checkReport() {
let { templateType, reportStatus } = this, let componentRef = this.$refs[`ref-${this.componentName}`],
currentComponent = this.$refs[`ref-${this.componentName}`] { templateData, templateType, currentDate } = this
if (currentComponent.isToday) { if (templateType != 1) {
if (templateType == 2) { if (!componentRef.isToday) return false
return reportStatus != 1 } else {
} else { let lastDay = dayjs().subtract(7, 'day')
return true if (!lastDay.isBefore(dayjs(currentDate), 'day')) return false
}
} }
return false return templateData.length ? componentRef.saveBtnStatus : false
}, },
async changeDate(e) { async changeDate(e) {
if (e.fullDate == this.currentDate) return if (e.fullDate == this.currentDate) return
const openNotice = await this.checkReport() const openNotice = await this.checkReport()
console.log(openNotice)
if (!openNotice) { if (!openNotice) {
this.$refs.calendar.manualChangeDate(e) this.$refs.calendar.manualChangeDate(e)
this.changeCurrentDate(e) this.changeCurrentDate(e)
...@@ -330,12 +327,13 @@ export default { ...@@ -330,12 +327,13 @@ export default {
try { try {
const { uuid, shopMerchantId } = this.userInfo, const { uuid, shopMerchantId } = this.userInfo,
nowDate = dayjs().format('YYYY-MM-DD'), nowDate = dayjs().format('YYYY-MM-DD'),
{ templateType, currentDate } = this, { templateType, currentDate, SCENE_TYPE: sceneType } = this,
data = await uni.$api.dailyTemplateApi.getReportDetail({ data = await uni.$api.dailyTemplateApi.getReportDetail({
merchantId: shopMerchantId, merchantId: shopMerchantId,
staffUuid: uuid, staffUuid: uuid,
templateType, templateType,
reportDate: currentDate reportDate: currentDate,
sceneType
}) })
if (data) { if (data) {
...@@ -367,10 +365,16 @@ export default { ...@@ -367,10 +365,16 @@ export default {
} }
}) })
this.templateData = templateData this.templateData = templateData
console.log(templateData)
} else { } else {
if (nowDate == currentDate) this.getDailyTemplate() if (this.templateType == 1) {
else uni.hideLoading() let lastDay = dayjs().subtract(7, 'day')
if (lastDay.isBefore(dayjs(currentDate), 'day')) this.getDailyTemplate()
else uni.hideLoading()
} else {
if (nowDate == currentDate) this.getDailyTemplate()
else uni.hideLoading()
}
} }
} catch (error) { } catch (error) {
uni.showToast({ title: error, icon: 'none', mask: true }) uni.showToast({ title: error, icon: 'none', mask: true })
...@@ -498,6 +502,7 @@ export default { ...@@ -498,6 +502,7 @@ export default {
height: toRpx(144); height: toRpx(144);
justify-content: start; justify-content: start;
padding-left: toRpx(32); padding-left: toRpx(32);
transition: all 0.5s ease-in-out;
.sprite-icon { .sprite-icon {
margin-right: toRpx(24); margin-right: toRpx(24);
......
...@@ -7,7 +7,8 @@ export default { ...@@ -7,7 +7,8 @@ export default {
data() { data() {
return { return {
dayjs, dayjs,
nowDate: dayjs().format('YYYY-MM-DD') nowDate: dayjs().format('YYYY-MM-DD'),
saveBtnStatus: false
} }
}, },
props: { props: {
...@@ -19,12 +20,18 @@ export default { ...@@ -19,12 +20,18 @@ export default {
ReportStatus: null ReportStatus: null
}, },
computed: { computed: {
/**可编辑日期 */
editableDate() {
let lastDay = dayjs().subtract(7, 'day'),
{ currentDate } = this
return lastDay.isBefore(dayjs(currentDate), 'day')
},
isToday() { isToday() {
return this.currentDate == this.nowDate return this.currentDate == this.nowDate
}, },
reportParams() { reportParams() {
let { shopMerchantId, shopMerchantName, uuid, name } = this.userInfo, let { shopMerchantId, shopMerchantName, uuid, name, merchantId, merchantName } = this.userInfo,
{ currentDate, templateType, dailyReportRecordId } = this, { currentDate, templateType, dailyReportRecordId, sceneType } = this,
params = { params = {
merchantId: shopMerchantId, merchantId: shopMerchantId,
merchantName: shopMerchantName, merchantName: shopMerchantName,
...@@ -32,7 +39,10 @@ export default { ...@@ -32,7 +39,10 @@ export default {
staffUuid: uuid, staffUuid: uuid,
staffName: name, staffName: name,
dailyReportSource: 2, //1:生意助手员工版小程序,2:平板电脑 dailyReportSource: 2, //1:生意助手员工版小程序,2:平板电脑
templateType: templateType() templateType: templateType(),
yqMerchantId: merchantId,
yqMerchantName: merchantName,
sceneType
} }
if (dailyReportRecordId()) params.dailyReportRecordId = dailyReportRecordId() if (dailyReportRecordId()) params.dailyReportRecordId = dailyReportRecordId()
return params return params
...@@ -111,13 +121,19 @@ export default { ...@@ -111,13 +121,19 @@ export default {
uni.showToast({ title: error, icon: 'none', mask: true }) uni.showToast({ title: error, icon: 'none', mask: true })
} }
}, },
submitReport(res) { async submitReport(res) {
try { try {
const { shopMerchantId } = this.userInfo,
{ sceneType } = this,
carBrandList = await uni.$api.boutiqueApi.getDailyReportCarBrand({
merchantId: shopMerchantId,
sceneType
})
console.log(carBrandList)
const phoneRegex = /^1[3456789]\d{9}$/ const phoneRegex = /^1[3456789]\d{9}$/
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
let { reportParams } = this, let { reportParams } = this,
list = utils.deepClone(res) list = utils.deepClone(res)
console.log('提交日报', list)
let jsonContent = JSON.stringify(list) let jsonContent = JSON.stringify(list)
let requestJson = buildAppNormalizedListsFromJsonContent(jsonContent) let requestJson = buildAppNormalizedListsFromJsonContent(jsonContent)
list.map(e => { list.map(e => {
...@@ -169,6 +185,12 @@ export default { ...@@ -169,6 +185,12 @@ export default {
if (e.type == 'subform') delete e.children if (e.type == 'subform') delete e.children
}) })
requestJson.carBrandList = carBrandList.map(({ firstBrandId, firstBrandName, brandId, brandName }) => ({
firstBrandId,
firstBrandName,
brandId,
brandName
}))
reportParams.jsonContent = JSON.stringify(list) reportParams.jsonContent = JSON.stringify(list)
reportParams.requestJson = JSON.stringify(requestJson) reportParams.requestJson = JSON.stringify(requestJson)
console.log('提交日报', reportParams) console.log('提交日报', reportParams)
......
...@@ -40,6 +40,7 @@ export default { ...@@ -40,6 +40,7 @@ export default {
customerKey: Date.now(), //客户信息KEY customerKey: Date.now(), //客户信息KEY
currentCarInfo: {},//当前选中的车品牌车系 currentCarInfo: {},//当前选中的车品牌车系
carBrandOpenStatus: false, // 车品牌选择弹窗是否打开 carBrandOpenStatus: false, // 车品牌选择弹窗是否打开
newReport: false, // 是否新日报
}; };
}, },
mutations: { mutations: {
...@@ -97,6 +98,9 @@ export default { ...@@ -97,6 +98,9 @@ export default {
setCarBrandOpenStatus (state, value) { setCarBrandOpenStatus (state, value) {
state.carBrandOpenStatus = value; state.carBrandOpenStatus = value;
}, },
setNewReport (state, value) {
state.newReport = value;
},
}, },
actions: { actions: {
...@@ -138,5 +142,9 @@ export default { ...@@ -138,5 +142,9 @@ export default {
setCarBrandOpenStatus ({ commit }, value) { setCarBrandOpenStatus ({ commit }, value) {
commit('setCarBrandOpenStatus', value) commit('setCarBrandOpenStatus', value)
}, },
setNewReport ({ commit }, value) {
commit('setNewReport', value)
},
}, },
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!