Commit 2e31f2ed by cen

Merge branch 'V4.56.0' of http://192.168.3.233:8090/glsx/gl_tape into V4.56.0

2 parents 5122740f 7a06363e
......@@ -308,6 +308,16 @@ module.exports = {
// dj.api.smartcarlife.serviceMerchant.getByMerchantId
return http.post({ method: 'dj.api.smartcarlife.common.createWeappQrcode', projectName: 'boutique', ...data })
},
/**
* 保存日报
*/
saveStaffDailyReport(data) {
return http.post({
method: 'dj.api.smartcarlife.staff.daily.report.save',
projectName: 'boutique',
...data
})
},
/** 不升级常用字符列表 */
getConfigList(data) {
return http.post({ method: 'dj.api.smartcarlife.config.list', projectName: 'boutique', ...data })
......
<template>
<view>
<!-- :key="dateKey" -->
<view class="daily-report">
<view class="common-title">填写日报</view>
<scroll-view
:class="['repoet-view',{full:!orderObj.isDateWithin7Days}]"
scroll-y
>
<template v-if="loadComplete">
<view class="box">
<view class="sub-title">轻改日报</view>
<template v-for="(i,index) in formObject.report">
<view
class="form-item flex"
:key="index"
>
<view class="label flex">
{{i.label}}
<template v-if="i.required">
<view class="required">*</view>
</template>
</view>
<view class="value flex">
<template v-if="i.type == 'input'">
<input
class="input"
:type="i.inputType || 'text'"
:value="orderObj[i.value]"
:placeholder="i.placeholder || '请输入'"
placeholder-class="placeholder"
@blur="handleBlur($event, i)"
:disabled="filterDisabled(isEditReport)"
>
</template>
<template v-else-if="i.type == 'picker'">
<picker
class="picker flex"
:value="orderObj[i.value]"
:range="i.range"
:range-key="i.rangeKey"
@change="orderObj[i.value] = $event.detail.value"
:disabled="filterDisabled(isEditReport)"
>
{{i.range[orderObj[i.value]][i.rangeKey] || ''}}
<uni-icons
type="right"
:size="16"
color="#999"
class="arrow"
></uni-icons>
</picker>
</template>
<template v-else>
{{orderObj[i.value]}}
</template>
</view>
</view>
</template>
</view>
<view class="box">
<view class="sub-title">其他信息</view>
<view class="form-item flex">
<view class="label flex">
备注
</view>
<view class="value">
<input
class="input"
type="text"
v-model="orderObj.remark"
placeholder-class="placeholder"
placeholder="请输入 (500字以内)"
:maxlength="500"
:disabled="filterDisabled(isEditReport)"
>
</view>
</view>
</view>
<template v-for="(item,index) in carBandList">
<view
class="box"
:key="index"
>
<view class="sub-title flex">
{{title(item)}}
<view
class="staff-name"
v-if="orderObj.staffName && index == 0"
>{{orderObj.staffName}}</view>
</view>
<template v-for="(i,ind) in filterTemplateList">
<view
:class="['form-item flex',{name:i.name}]"
:key="ind"
>
<template v-if="i.name">
个人相关
</template>
<template v-else>
<view class="label flex">
{{i.label}}
<template v-if="i.required">
<view class="required">*</view>
</template>
</view>
<view class="value flex">
<input
class="input"
:type="i.type || 'text'"
:value="item[i.key]"
:placeholder="i.inputPlaceholder || '请输入'"
placeholder-class="placeholder"
@blur="handleCarInputBlur($event, i , item)"
:disabled="filterDisabled(isEditReport) || i.disabled"
>
</view>
</template>
</view>
</template>
</view>
</template>
</template>
</scroll-view>
<template v-if="orderObj.isDateWithin7Days">
<view class="btn-box flex">
<template v-if="filterDisabled()">
<template v-if="!isEditReport">
<view
class="btn"
@click="isEditReport = true"
>编辑</view>
</template>
<template v-else>
<view
class="btn cancel-btn"
@click="isEditReport = false"
>取消</view>
<view
class="btn"
@click="submit"
>保存</view>
</template>
</template>
<template v-else>
<view
class="btn"
@click="submit"
>提交</view>
</template>
</view>
</template>
</view>
</template>
<script>
<script type='text/ecmascript-6'>
var weekday = require('dayjs/plugin/weekday')
import dayjs from 'dayjs'
dayjs.extend(weekday)
import GlCell from '@/components/Form/GlCell.vue'
export default {
components: {
GlCell
},
props: {
currentDate: String,
currentMonth: String
},
name: 'DailyReport',
data() {
data () {
return {
dateKey: Date.now(),
loadComplete: false,
formObject: {
report: [
{
label: '今日驻店人数(按店)',
value: 'staffCount',
type: 'input',
required: true,
inputType: 'number'
},
{
label: '当日调休',
value: 'pickerValue',
type: 'picker',
required: true,
rangeKey: 'name',
range: [
{ id: 'N', name: '否' },
{ id: 'Y', name: '是' }
]
},
{
label: '个人成交总金额',
value: 'totalOrderMoney',
},
]
},
orderObj: {},
carBandList: [],
hwOhterObjArray: [
{
label: '店端实际交车数',
key: 'deliveryCount',
type: 'number',
required: true,
min: 0,
max: 100,
},
{
label: '店端总未触客数',
key: 'notDeliveryCount',
type: 'number',
required: true,
min: 0,
max: 100,
},
{
label: '实际售前触客数',
key: 'equityToShopCount',
type: 'number',
required: true,
min: 0,
max: 100,
inputPlaceholder: ''
},
{
label: '实际售后触客数',
key: 'afterSaleEquityToShopCount',
type: 'number',
required: false,
min: 0,
max: 100,
},
{
name: 'person'
},
{
label: '今日成交数',
key: 'totalOrderCount',
type: 'number',
required: false,
min: 0,
max: 100,
templateValue: 3,
disabled: true,
inputPlaceholder: '自动填入系统数据'
}
],
weeklyList: [],
isEditReport: false
}
},
computed: {
userInfo () {
return uni.$storage.get("userInfo")
},
mouthNumber () {
return dayjs(this.currentMonth).daysInMonth()
},
filterTemplateList () {
let { hwOhterObjArray, orderObj: { templateType } } = this
if (templateType == 3) {
return hwOhterObjArray.filter(function (item) {
return item.templateValue != 3
})
} else {
return hwOhterObjArray
}
},
},
watch: {
currentMonth: {
handler (val) {
this.setMonthDay()
},
deep: true,
immediate: true
},
currentDate: {
handler (val) {
this.getStaffDailyReportDetail()
// console.log(val)
},
deep: true,
// immediate: true
}
},
mounted () {
this.initData()
this.getDailyReportCarBrand()
},
methods: {
initData () {
const { merchantId, merchantName, name, uuid, shopMerchantId, shopMerchantName } = this.userInfo
this.orderObj = {
yqMerchantId: merchantId,
yqMerchantName: merchantName,
staffName: name,
staffUuid: uuid,
merchantId: shopMerchantId,
merchantName: shopMerchantName
}
this.getStaffDailyReportDetail()
},
async getDailyReportCarBrand () {
let { userInfo } = this,
{ shopMerchantId } = userInfo
const data = await uni.$api.boutiqueApi.getDailyReportCarBrand({
merchantId: shopMerchantId,
sceneType: 1
})
this.carBandList = data
console.log(this.carBandList)
},
setMonthDay () {
let { mouthNumber } = this,
currentMonth = dayjs(this.currentMonth).format('YYYY-MM'),
nowYear = dayjs(currentMonth).format('YYYY'),
nowMonth = dayjs(currentMonth).format('MM'),
maxDay = dayjs().format('D'),
maxMonth = dayjs().format('YYYY-MM'),
dayNum = currentMonth < maxMonth ? mouthNumber : maxDay,
weekDayList = []
if (currentMonth > maxMonth) return
for (let i = 1; i <= dayNum; i++) {
let date = dayjs(`${nowYear}-${nowMonth}-${i}`).format('YYYY-MM-DD'),
week = ['日', '一', '二', '三', '四', '五', '六'][dayjs(date).weekday()]
weekDayList.push({
day: i,
date,
week,
disabled: false
})
}
let startDay = weekDayList[0].date,
endDay = weekDayList[weekDayList.length - 1].date
let params = {
weekDayList,
yearMonth: currentMonth,
starDay: 1,
starDayLabel: dayjs(startDay).format('YYYY/MM/DD'),
reportStartDate: startDay,
endDayLabel: dayjs(endDay).format('YYYY/MM/DD'),
reportEndDate: endDay,
formatYearMonth: currentMonth
}
this.getStaffDailyReportDetailWeeklyList(params)
},
async getStaffDailyReportDetailWeeklyList (params) {
let { shopMerchantId, merchantId, uuid } = this.userInfo
const data = await uni.$api.boutiqueApi.getStaffDailyReportDetailWeeklyList({
staffUuid: uuid,
yqMerchantId: merchantId,
merchantId: shopMerchantId,
...params,
sceneType: 1,
reportTypeList: [-1]
})
let selectedDay = []
params.weekDayList.map(e => {
let { date } = e
if (!data.includes(date)) selectedDay.push({
date
})
})
this.weeklyList = data
this.$emit('setCalendarSelected', selectedDay)
},
async getStaffDailyReportDetail () {
this.isEditReport = false
this.loadComplete = false
let { currentDate,
userInfo,
carBandList,
hwOhterObjArray,
orderObj } = this,
{ shopMerchantId, merchantId, uuid } = userInfo
const data = await uni.$api.boutiqueApi.getStaffDailyReportDetail({
yqMerchantId: merchantId,
merchantId: shopMerchantId,
staffUuid: uuid,
reportDate: currentDate,
sceneType: 1,
reportTypeList: [-1]
})
let { brandDataList, remark } = data
if (brandDataList && brandDataList.length) {
carBandList = carBandList.map(item => {
let carBand = brandDataList.find(ele => {
if ([0, 1].includes(ele.brandType)) {
return ele.brandType == item.brandType
} else if (ele.brandType == 2) {
return ele.firstBrandId == item.firstBrandId
}
})
if (carBand != null) {
let {
firstBrandId,
firstBrandName,
brandId,
brandName,
brandType
} = item
item = {
...carBand,
firstBrandId,
firstBrandName,
brandId,
brandName,
brandType
}
} else {
hwOhterObjArray.forEach(e => {
item[e.key] = null
})
}
item.error = false
return item
})
}
hwOhterObjArray = hwOhterObjArray.map(item => {
item.error = false
return item
})
let diffDay = dayjs().diff(dayjs(currentDate), 'day')
this.hwOhterObjArray = hwOhterObjArray
this.carBandList = carBandList
this.orderObj = {
...orderObj,
reportDate: currentDate,
isDateWithin7Days: diffDay < 7,
isDateWithin60Days: diffDay < 60,
remark,
lastStaffName: data.lastStaffName,
lastStaffUuid: data.lastStaffUuid,
recordStaffCount: data.staffCount,
totalOrderMoney: data.totalOrderMoney,
totalOrderCount: data.totalOrderCount,
glWorryFreeCount: data.glWorryFreeCount,
cancelOrderCount: data.cancelOrderCount,
cancelOrderMoney: data.cancelOrderMoney,
templateType: data.templateType || 0,
staffCount: data.staffCount,
onBreak: data.onBreak || 'N',
pickerValue: data.onBreak == 'Y' ? 1 : 0,
staffCountError: false,
}
this.loadComplete = true
},
title (item) {
let title = ''
if (item.brandType == 0) title = '问界'
if (item.brandType == 1) title = '鸿蒙'
return title || item.firstBrandName
},
handleBlur (e, i) {
let { value } = e.detail
if (value) {
let key = i.value,
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
this.orderObj[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
this.dateKey = Date.now()
}
},
handleCarInputBlur (e, i, item) {
let { value } = e.detail
if (value) {
let { key } = i,
numbers = value.match(/\d+/g)
numbers = numbers ? numbers.join('') : ''
if (numbers.length > 1) numbers = numbers.replace(/^0+/, '')
item[key] = Math.min(Math.max(Number(numbers), 0), 100).toString()
this.dateKey = Date.now()
}
},
async submit () {
try {
let { orderObj, carBandList } = this
orderObj.isAdmin = false
orderObj.oprBy = orderObj.staffUuid
orderObj.sceneType = 1
orderObj.brandDataList = carBandList
if (orderObj.onBreak == 'Y') {
orderObj.brandDataList.forEach(item => {
item.notDeliveryCount = item.notDeliveryCount || 0
item.equityToShopCount = item.equityToShopCount || 0
})
}
const data = await uni.$api.boutiqueApi.saveStaffDailyReport(orderObj)
if(data) {
this.isEditReport = false
}
} catch (error) {
}
},
filterDisabled (disabledStatus) {
let { weeklyList, currentDate, orderObj: { isDateWithin7Days } } = this
return weeklyList.includes(currentDate) && !disabledStatus || !isDateWithin7Days
}
}
}
</script>
<style scoped lang="scss">
<style scoped lang='scss'>
.daily-report {
height: 100%;
.repoet-view {
height: calc(100% - 248rpx);
}
.full {
height: calc(100% - 120rpx);
}
.box {
margin: 0 48rpx 16rpx;
border-radius: 16rpx;
background: #ffffff;
padding-left: 32rpx;
.sub-title {
line-height: 48rpx;
padding: 16rpx 32rpx 8rpx 0;
color: #777777;
font-size: 24rpx;
.staff-name {
margin-left: auto;
color: #4673ff;
font-size: 24rpx;
}
}
.form-item {
height: 96rpx;
border-bottom: 2rpx solid #f7f7f6;
padding-right: 32rpx;
font-size: 28rpx;
color: #333333;
&:last-of-type {
border-bottom: none;
}
.label {
flex-shrink: 0;
.required {
color: #f24724;
font-size: 28rpx;
margin-left: 8rpx;
}
}
.value {
width: 100%;
height: 100%;
justify-content: flex-end;
.input,
.picker {
width: 100%;
height: 100%;
text-align: right;
line-height: 96rpx;
justify-content: flex-end;
.arrow {
position: relative;
top: 2rpx;
margin-left: 4rpx;
}
}
.placeholder {
color: #999999;
font-size: 28rpx;
}
.textarea {
width: 100%;
}
}
}
.name {
line-height: 48rpx;
height: 72rpx;
color: #777777;
font-size: 24rpx;
border-bottom: none;
}
}
.btn-box {
height: 128rpx;
padding: 0 128rpx;
gap: 0 32rpx;
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 80rpx;
border-radius: 48rpx;
border: 2rpx solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: 28rpx;
font-weight: 500;
}
.cancel-btn {
background: #3b73ff1a;
color: #4673ff;
border: 2rpx solid #fff;
}
}
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!