Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4619d737
authored
Feb 25, 2024
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix 驻店日报 bug修复
1 parent
88914b9f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
59 deletions
store/index.js
tabWorkOrder/api.js
tabWorkOrder/pages/staffDaily/staffDaily.js
tabWorkOrder/pages/staffDaily/staffDaily.wxml
utils/timeFormat/time-utils.js
store/index.js
View file @
4619d73
import
api
from
'~/api/api.js'
import
{
envIndex
}
from
'~/config'
import
{
removeSystemStorage
}
from
'~/utils/cache/storageApi'
import
util
from
'~/utils/util.js'
// const app = getApp()
// console.log(app, 'app')
// console.log(wx)globalData
...
...
@@ -206,6 +208,7 @@ export const getBusinessSchoolScene = () => {
// 扫码进来的处理
export
const
checkScene
=
options
=>
{
// let query = options.query
let
{
query
}
=
options
if
(
query
)
{
...
...
@@ -217,9 +220,22 @@ export const checkScene = options => {
}
console
.
log
(
query
,
'query'
)
let
userInfo
=
wx
.
$util
.
getStorageSync
(
'dj_boutique_user_info'
)
if
(
query
&&
query
.
reportDate
)
{
// const app = getApp()
// console.log(app, 'app');
// app.globalData.yqdInfo = {}
// app.globalData.YQorderSetting = ''
// app.globalData.YQList = ''
// app.globalData.businessSchoolScene = ''
util
.
removeStorage
()
removeSystemStorage
()
// wx.$relogin = relogin
}
// 判断对象是否满足任意一个key
// console.log(query, ' query')
if
(
query
&&
(
query
.
scene
||
query
.
merchantId
||
query
.
type
||
query
.
page
))
{
// 如果是跳转员工日报页面,需先情况之前的用户登录信息
if
(
query
.
merchantId
&&
!
query
.
reportDate
)
{
// &&options.patch == 'tabIndex/pages/index/index'
...
...
tabWorkOrder/api.js
View file @
4619d73
...
...
@@ -175,5 +175,10 @@ module.exports = {
/** 批复员工日报 */
staffDailyReportApprove
(
data
)
{
return
api
.
post
(
'dj.api.smartcarlife.staff.daily.report.approve'
,
data
)
},
/** 4s店查询对应的园区店 */
querySceneRefByShop
(
data
)
{
return
api
.
post
(
'dj.api.scenemerchantref.querySceneRefByShop'
,
data
)
}
}
tabWorkOrder/pages/staffDaily/staffDaily.js
View file @
4619d73
...
...
@@ -85,7 +85,7 @@ Page({
})
},
changePicker
(
e
)
{
console
.
log
(
e
)
//
console.log(e)
let
{
merchantRange
,
pickerType
,
staffList
}
=
this
.
data
let
{
value
}
=
e
.
detail
if
(
pickerType
==
'merchant'
)
{
...
...
@@ -123,7 +123,7 @@ Page({
}
try
{
target
.
map
(
key
=>
{
if
(
!
obj
[
key
])
{
if
(
!
obj
[
key
]
&&
obj
[
key
]
!=
0
)
{
throw
key
}
})
...
...
@@ -142,7 +142,7 @@ Page({
// 判断是否有审批意见
let
{
approvedContent
,
approvedSource
,
orderObj
,
timeBean
}
=
this
.
data
if
(
!
approvedContent
.
length
)
{
wx
.
$util
.
showToast
(
'请输入审批意见'
)
return
wx
.
$util
.
showToast
(
'请输入审批意见'
)
}
let
params
=
{
// approvedContent,
...
...
@@ -154,19 +154,28 @@ Page({
approvedSource
,
approvalList
:
[{
approvedBy
:
approvedSource
==
0
?
orderObj
.
approvedBy
:
'区域督导'
,
approvedContent
}]
}
console
.
log
(
params
,
'submitApproval'
);
//
console.log(params, 'submitApproval');
api
.
staffDailyReportApprove
(
params
)
.
then
(
res
=>
{
console
.
log
(
res
)
//
console.log(res)
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
this
.
setData
({
approvedContent
:
''
,
approvedContentCurrentWordNumber
:
0
})
wx
.
$util
.
showToast
(
'提交成功'
)
this
.
getStaffReport
()
// wx.$util.showToast('提交成功')
wx
.
showModal
({
title
:
'提示'
,
content
:
'提交成功'
,
showCancel
:
false
,
confirmText
:
'确定'
,
confirmColor
:
'#347BFF'
,
success
(
res
)
{
}
})
}
else
{
wx
.
$util
.
showToast
(
message
)
}
...
...
@@ -180,14 +189,14 @@ Page({
let
{
role
,
approvedSource
,
orderObj
,
formData
}
=
this
.
data
// 是督导和老板,提交评论
// console.log(approvedSource != '', approvedSource, 'approvedSource')
console
.
log
(
approvedSource
,
[
0
,
1
].
includes
(
approvedSource
),
'submitApproval'
,);
//
console.log(approvedSource, [0, 1].includes(approvedSource), 'submitApproval',);
if
([
0
,
1
,
'0'
,
'1'
].
includes
(
approvedSource
))
{
return
this
.
submitApproval
()
}
if
((
role
!=
'staff'
||
!
orderObj
.
isDateWithin7Days
)
&&
(
role
!=
'super'
||
!
orderObj
.
isDateWithin60Days
))
return
wx
.
$util
.
showToast
(
'已超过提交时效'
)
// let { orderObj, formData } = this.data
let
key
=
this
.
checkRequired
(
orderObj
)
console
.
log
(
key
)
//
console.log(key)
// debugger
if
(
key
)
{
this
.
showToast
(
toastList
[
key
])
...
...
@@ -207,17 +216,26 @@ Page({
})
orderObj
[
name
]
=
arr
})
console
.
log
(
orderObj
,
'orderObj'
)
//
console.log(orderObj, 'orderObj')
wx
.
$util
.
showLoading
()
api
.
staffDailyReportSave
(
orderObj
)
.
then
(
result
=>
{
wx
.
$util
.
hideLoading
()
console
.
log
(
'result'
,
result
)
//
console.log('result', result)
let
{
code
,
data
,
message
}
=
result
if
(
code
==
0
)
{
wx
.
$util
.
showToast
(
'提交成功'
)
this
.
getStaffDailyReportDetailWeeklyList
()
// wx.$util.showToast('提交成功')
wx
.
showModal
({
title
:
'提示'
,
content
:
'提交成功'
,
showCancel
:
false
,
confirmText
:
'确定'
,
confirmColor
:
'#347BFF'
,
success
(
res
)
{
}
})
}
else
{
wx
.
$util
.
showToast
(
message
)
}
...
...
@@ -314,7 +332,7 @@ Page({
},
getStaffDailyReportDetailWeeklyList
()
{
let
{
orderObj
,
timeBean
}
=
this
.
data
console
.
log
({
...
orderObj
,
...
timeBean
},
'getStaffDailyReportDetailWeeklyList'
);
//
console.log({ ...orderObj, ...timeBean }, 'getStaffDailyReportDetailWeeklyList');
orderObj
?.
merchantId
&&
api
.
staffDailyReportDetailWeeklyList
({
...
orderObj
,
...
timeBean
}).
then
(
res
=>
{
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
...
...
@@ -338,7 +356,7 @@ Page({
orderObj
:
{
yqMerchantId
,
merchantId
,
staffUuid
,
reportDate
},
formData
}
=
this
.
data
console
.
log
({
yqMerchantId
,
merchantId
,
staffUuid
,
reportDate
},
'getStaffReport'
);
//
console.log({ yqMerchantId, merchantId, staffUuid, reportDate }, 'getStaffReport');
merchantId
&&
api
.
staffDailyReportDetail
({
yqMerchantId
,
merchantId
,
staffUuid
,
reportDate
}).
then
(
res
=>
{
let
{
code
,
data
,
message
}
=
res
// console.log(data, 'data')
...
...
@@ -420,35 +438,67 @@ Page({
},
getConversionEmployeeList
()
{
// debugger
let
{
orderObj
}
=
this
.
data
comApi
.
getConversionEmployeeList
({
merchantId
:
orderObj
.
merchantId
})
.
then
(
res
=>
{
// debugger
console
.
log
(
res
,
'res'
)
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
if
(
!
data
.
length
)
{
// 没有员工
wx
.
$util
.
showToast
(
'该门店没有员工'
)
}
else
{
this
.
setData
({
staffList
:
data
,
staffCurrent
:
0
,
[
'orderObj.staffUuid'
]:
data
[
0
].
uuid
,
[
'orderObj.staffName'
]:
data
[
0
].
staffName
,
[
'orderObj.yqMerchantId'
]:
data
[
0
].
yqMerchantId
,
[
'orderObj.yqMerchantName'
]:
data
[
0
].
yqMerchantName
})
this
.
getStaffReport
()
this
.
getStaffDailyReportDetailWeeklyList
()
}
}
else
{
wx
.
$util
.
showToast
(
message
)
let
{
orderObj
,
scene
}
=
this
.
data
// 先查4s店对应的园区店,再用园区店查员工
api
.
querySceneRefByShop
({
scene
,
merchantId
:
orderObj
.
merchantId
}).
then
((
result
)
=>
{
// console.log(result, 'result')
let
{
code
,
data
,
message
}
=
result
if
(
code
==
0
)
{
console
.
log
(
data
.
yqMerchant
?.
merchantId
,
'!data.yqMerchant?.merchantId)'
);
if
(
!
data
.
yqMerchant
?.
merchantId
)
{
this
.
setData
({
staffList
:
[]
})
return
wx
.
$util
.
showToast
(
'该4s店查无数据'
)
}
})
this
.
setData
({
[
'orderObj.yqMerchantId'
]:
data
.
yqMerchant
.
merchantId
,
[
'orderObj.yqMerchantName'
]:
data
.
yqMerchant
.
merchantName
,
})
comApi
.
getConversionEmployeeList
({
merchantId
:
data
.
yqMerchant
.
merchantId
})
.
then
(
res
=>
{
// debugger
// console.log(res, 'res')
let
{
code
,
data
,
message
}
=
res
if
(
code
==
0
)
{
if
(
!
data
.
length
)
{
this
.
setData
({
staffList
:
[]
})
// 没有员工
wx
.
$util
.
showToast
(
'该门店没有员工'
)
}
else
{
this
.
setData
({
staffList
:
data
,
staffCurrent
:
0
,
[
'orderObj.staffUuid'
]:
data
[
0
].
uuid
,
[
'orderObj.staffName'
]:
data
[
0
].
staffName
,
// ['orderObj.yqMerchantId']: data[0].yqMerchantId,
// ['orderObj.yqMerchantName']: data[0].yqMerchantName
})
this
.
getStaffReport
()
this
.
getStaffDailyReportDetailWeeklyList
()
}
}
else
{
wx
.
$util
.
showToast
(
message
)
}
})
}
else
{
wx
.
$util
.
message
(
message
)
}
}).
catch
((
err
)
=>
{
});
},
getListShop4s
(
e
=
{})
{
// let { value } = e?.detail
...
...
@@ -464,7 +514,7 @@ Page({
})
.
then
(
result
=>
{
let
{
code
,
data
,
message
}
=
result
console
.
log
(
result
,
'result'
)
//
console.log(result, 'result')
if
(
code
==
0
)
{
this
.
setData
({
merchantRange
:
data
.
list
,
...
...
@@ -482,7 +532,7 @@ Page({
}
else
{
wx
.
$util
.
showToast
(
message
)
}
console
.
log
(
result
,
'result'
)
//
console.log(result, 'result')
})
.
catch
(
err
=>
{
})
},
...
...
@@ -491,7 +541,7 @@ Page({
},
initData
(
userInfo
)
{
let
{
orderObj
,
reportDate
,
role
}
=
this
.
data
console
.
log
(
this
.
data
,
'initData'
);
//
console.log(this.data, 'initData');
// const { sceneType, } = userInfo
// 根据不同角色做页面回显
const
isStaff
=
app
.
globalData
.
isStaff
||
false
...
...
@@ -507,7 +557,7 @@ Page({
this
.
setReportDate
()
setTimeout
(()
=>
{
console
.
log
(
this
.
data
.
role
,
this
.
data
,
'roleOther'
);
//
console.log(this.data.role, this.data, 'roleOther');
if
(
this
.
data
.
role
==
'other'
)
{
this
.
getStaffReport
()
this
.
getStaffDailyReportDetailWeeklyList
()
...
...
@@ -516,7 +566,7 @@ Page({
})
if
(
isStaff
)
{
console
.
log
(
userInfo
,
'userInfo'
);
//
console.log(userInfo, 'userInfo');
const
{
merchantId
,
merchantName
,
name
,
uuid
,
shopMerchantId
,
shopMerchantName
}
=
userInfo
this
.
setData
({
role
:
'staff'
,
...
...
@@ -545,30 +595,37 @@ Page({
// 4s店-员工-员工数据 的请求逻辑
this
.
getListShop4s
()
}
console
.
log
(
this
.
data
,
'roleOther'
);
//
console.log(this.data, 'roleOther');
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
if
(
options
)
{
for
(
const
key
in
options
)
{
options
[
key
]
=
decodeURIComponent
(
options
[
key
])
}
}
console
.
log
(
options
,
'options,onLoad'
);
this
.
setData
({
flag
:
true
})
let
{
orderObj
}
=
this
.
data
console
.
log
(
options
.
hasOwnProperty
(
'approvedSource'
),
options
,
'approvedSource'
);
//
console.log(options.hasOwnProperty('approvedSource'), options, 'approvedSource');
if
(
options
.
hasOwnProperty
(
'approvedSource'
))
{
this
.
setData
({
role
:
'other'
,
approvedSource
:
options
.
approvedSource
,
merchantRange
:
[{
merchantName
:
options
.
merchantName
,
merchantId
:
options
.
merhchantid
}],
orderObj
:
{
...
orderObj
,
...
options
}
},
reportDate
:
options
.
reportDate
},
this
.
initData
({}))
}
// else {
// this.initData(wx.$util.getUserInfo())
...
...
tabWorkOrder/pages/staffDaily/staffDaily.wxml
View file @
4619d73
...
...
@@ -68,7 +68,8 @@
</view>
<view class="approvalFromSuperiorsCon">
<view class="title">
上级批复
<!-- -->
{{role=='other'? approvedSource == 0 ? orderObj.approvedBy : '区域督导' : '上级批复'}}
<text class="data">({{timeBean.starDayLabel+ '-' + timeBean.endDayLabel}})</text>
</view>
<view class="tips">数据来源生意助手小程序,每周更新</view>
...
...
utils/timeFormat/time-utils.js
View file @
4619d73
...
...
@@ -8,7 +8,11 @@ function getWeekDayList(selectWeek, selectDay) {
// 2.用循环七次添加周一到周日对应得周几和几号
var
selectWeekTime
=
getCurrentTimeStamp
(
selectDay
)
+
selectWeek
*
7
*
24
*
60
*
60
*
1000
var
mondayTime
=
selectWeekTime
-
(
getWeekNumber
(
selectWeekTime
)
-
1
)
*
24
*
60
*
60
*
1000
// console.log(mondayTime, 'mondayTime')
// let testDate = new Date(mondayTime)
// console.log(getWeekNumber(selectWeekTime), getWeekNumber(selectWeekTime) - 1, 'getWeekNumber(selectWeekTime) - 1')
// console.log(getDataFormat(selectWeekTime), 'selectWeekTime')
// console.log(getDataFormat(mondayTime), 'mondayTime')
var
timeBean
=
{
selectDay
:
0
,
yearMonth
:
''
,
...
...
@@ -112,7 +116,8 @@ function getWeek(res) {
//时间戳转周几 0123456 --
function
getWeekNumber
(
res
)
{
var
days
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
];
// var days = [6, 0, 1, 2, 3, 4, 5,];
var
days
=
[
7
,
1
,
2
,
3
,
4
,
5
,
6
];
var
time
=
new
Date
(
res
);
var
dayIndex
=
time
.
getDay
();
return
days
[
dayIndex
];
...
...
@@ -134,19 +139,33 @@ function getDataFormat(res) {
return
`
${
year
}
-
${
month
}
-
${
day
}
`
}
// function isTimestampInCurrentWeek(timestamp) {
// const currentDate = new Date()
// const currentDay = currentDate.getDay() // 获取当前日期是星期几
// // 计算当前周的起始日期(周一)
// const currentWeekStart = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - currentDay + 1)
// console.log(currentWeekStart, 'currentWeekStart');
// // 计算当前周的结束日期(周日)
// const currentWeekEnd = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + (7 - currentDay), 23, 59, 59, 999)
// console.log(currentWeekEnd, 'currentWeekEnd');
// const targetDate = new Date(timestamp) // 不再乘以1000
// return targetDate >= currentWeekStart && targetDate <= currentWeekEnd
// }
function
isTimestampInCurrentWeek
(
timestamp
)
{
const
currentDate
=
new
Date
()
const
currentDay
=
currentDate
.
getDay
()
// 获取当前日期是星期几
const
currentDate
=
new
Date
()
;
const
currentDay
=
currentDate
.
getDay
()
;
// 获取当前日期是星期几
// 计算当前周的起始日期(周一)
const
currentWeekStart
=
new
Date
(
currentDate
.
getFullYear
(),
currentDate
.
getMonth
(),
currentDate
.
getDate
()
-
currentDay
+
1
)
const
currentWeekStart
=
new
Date
(
currentDate
.
getFullYear
(),
currentDate
.
getMonth
(),
currentDate
.
getDate
()
-
currentDay
+
(
currentDay
===
0
?
-
6
:
1
));
// 计算当前周的结束日期(周日)
const
currentWeekEnd
=
new
Date
(
current
Date
.
getFullYear
(),
currentDate
.
getMonth
(),
currentDate
.
getDate
()
+
(
7
-
currentDay
),
23
,
59
,
59
,
999
)
const
currentWeekEnd
=
new
Date
(
current
WeekStart
.
getFullYear
(),
currentWeekStart
.
getMonth
(),
currentWeekStart
.
getDate
()
+
6
,
23
,
59
,
59
,
999
);
const
targetDate
=
new
Date
(
timestamp
)
// 不再乘以1000
const
targetDate
=
new
Date
(
timestamp
)
;
return
targetDate
>=
currentWeekStart
&&
targetDate
<=
currentWeekEnd
return
targetDate
>=
currentWeekStart
&&
targetDate
<=
currentWeekEnd
;
}
function
getWeeksDiff
(
startDate
,
endDate
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment