Commit 49ab890a by 张立顺

feat 功能联调

1 parent 81446f6c
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 0; let index = 2;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
// 0待报价、1待确认、2待支付、3已支付、4已支付 5(已完成)、-1战败 // 0待报价、1待确认、2待支付、3已支付、4已支付 5(已完成)、-1战败
const orderStatusObj = { const orderStatusObj = {
'0': '待报价', 0: '待报价',
'1': '待确认', 1: '待确认',
'2': '待支付', 2: '待支付',
'3': '已支付', 3: '已支付',
'4': '已支付', 4: '已支付',
'5': '已完成', 5: '已完成',
'-1': '战败', '-1': '战败',
'9': '已撤销', 9: '已撤销',
'11': '已失效', 11: '已失效',
'6': '已退款' 6: '已退款',
14: '审批中'
} }
const orderStatusList = [{ const orderStatusList = [
{
confName: '待报价', confName: '待报价',
confId: '0' confId: '0'
}, { },
{
confName: '待确认', confName: '待确认',
confId: '1' confId: '1'
}, { },
{
confName: '待支付', confName: '待支付',
confId: '2' confId: '2'
}, { },
{
confName: '已支付', confName: '已支付',
confId: '3' confId: '3'
}, { },
{
confName: '已完成', confName: '已完成',
confId: '5' confId: '5'
}, { },
{
confName: '已退款', confName: '已退款',
confId: '6' confId: '6'
}, },
...@@ -37,7 +44,8 @@ const orderStatusList = [{ ...@@ -37,7 +44,8 @@ const orderStatusList = [{
{ {
confName: '错误订单', confName: '错误订单',
confId: '11' confId: '11'
}, { },
{
confName: '战败', confName: '战败',
confId: '-1' confId: '-1'
} }
...@@ -46,4 +54,4 @@ const orderStatusList = [{ ...@@ -46,4 +54,4 @@ const orderStatusList = [{
export default { export default {
orderStatusObj, orderStatusObj,
orderStatusList orderStatusList
}
\ No newline at end of file \ No newline at end of file
}
...@@ -820,6 +820,9 @@ Page({ ...@@ -820,6 +820,9 @@ Page({
console.log('调接口---') console.log('调接口---')
// 标记错误--补录订单 // 标记错误--补录订单
if (orderInfo.resetOrder && orderInfo.id) { if (orderInfo.resetOrder && orderInfo.id) {
orderInfo.zyPayUrl = '' // 标记错误工单重新下单,将合同协议字段清除,需重新校验是否上传并重新上传
orderInfo.payType = 5 // 支付方式 5:嘀加收款
orderInfo.payee = 0 // 收款方 0:嘀加收款
orderInfo.oldQuotationId = orderInfo.id orderInfo.oldQuotationId = orderInfo.id
orderInfo.transactionNo = orderInfo.transactionNo =
orderInfo.transactionNo || orderInfo.outTradeNo orderInfo.transactionNo || orderInfo.outTradeNo
......
...@@ -324,6 +324,14 @@ ...@@ -324,6 +324,14 @@
background: #FFF5E6; background: #FFF5E6;
padding: var(--fontSize4) var(--fontSize8); padding: var(--fontSize4) var(--fontSize8);
border-radius: var(--fontSize4); border-radius: var(--fontSize4);
font-size: var(--fontSize24);
}
.approving-txt {
color: #FF9D0A;
background: #ff9d0a1a;
padding: var(--fontSize4) var(--fontSize8);
border-radius: var(--fontSize4);
} }
.list .content { .list .content {
...@@ -503,7 +511,7 @@ ...@@ -503,7 +511,7 @@
color: #347BFF; color: #347BFF;
} }
.refund-box{ .refund-box {
margin-left: var(--fontSize16); margin-left: var(--fontSize16);
background: #FFF2E0; background: #FFF2E0;
padding: var(--fontSize4) var(--fontSize8); padding: var(--fontSize4) var(--fontSize8);
...@@ -835,6 +843,7 @@ ...@@ -835,6 +843,7 @@
padding-left: var(--fontSize24); padding-left: var(--fontSize24);
margin: 0 auto; margin: 0 auto;
} }
.modalbox:last-child { .modalbox:last-child {
margin-top: var(--fontSize16); margin-top: var(--fontSize16);
} }
...@@ -865,65 +874,112 @@ ...@@ -865,65 +874,112 @@
width: calc(100% - 36rpx); width: calc(100% - 36rpx);
} }
.repeal-modal{ .repeal-modal {
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.6);
position: fixed; position: fixed;
top: 0; top: 0;
right: 0; right: 0;
left: 0; left: 0;
bottom: 0; bottom: 0;
z-index: 999; z-index: 999;
}
.repeal-wrap{
width: 622rpx;
height: 496rpx;
background: #FFFFFF;
border-radius: 20rpx;
transform: translate(-50%, -50%);
position: absolute;
top: 50%;
left: 50%;
padding: 40rpx 0 0;
box-sizing: border-box;
}
.repeal-wrap .title{
font-weight: 600;
font-size: 32rpx;
color: #222222;
text-align: center;
line-height: 48rpx;
}
.repeal-wrap .textarea-wrap{
margin: 40rpx 0;
padding: 0 40rpx ;
width: 100%;
box-sizing: border-box;
}
.repeal-wrap .textarea{
background: #F4F5F7;
width: 100%;
height: 224rpx;
padding: 24rpx;
box-sizing: border-box;
border-radius: 12rpx;
}
.repeal-wrap .footer{
position: absolute;
bottom: 0;
border-top: 2rpx solid #EBEDF0;
display: flex;
width: 100%;
}
.repeal-wrap .footer .btn{
height: 96rpx;
line-height: 96rpx;
flex: 1;
font-weight: 400;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.repeal-wrap .footer .btn:last-child{
color: #3582EE;
border-left: 2rpx solid #EBEDF0;
} }
.repeal-wrap {
width: 622rpx;
height: 496rpx;
background: #FFFFFF;
border-radius: 20rpx;
transform: translate(-50%, -50%);
position: absolute;
top: 50%;
left: 50%;
padding: 40rpx 0 0;
box-sizing: border-box;
}
.repeal-wrap .title {
font-weight: 600;
font-size: 32rpx;
color: #222222;
text-align: center;
line-height: 48rpx;
}
.repeal-wrap .textarea-wrap {
margin: 40rpx 0;
padding: 0 40rpx;
width: 100%;
box-sizing: border-box;
}
.repeal-wrap .textarea {
background: #F4F5F7;
width: 100%;
height: 224rpx;
padding: 24rpx;
box-sizing: border-box;
border-radius: 12rpx;
}
.repeal-wrap .footer {
position: absolute;
bottom: 0;
border-top: 2rpx solid #EBEDF0;
display: flex;
width: 100%;
}
.repeal-wrap .footer .btn {
height: 96rpx;
line-height: 96rpx;
flex: 1;
font-weight: 400;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.repeal-wrap .footer .btn:last-child {
color: #3582EE;
border-left: 2rpx solid #EBEDF0;
}
.error-order-box {
box-sizing: border-box;
padding: 16rpx;
border-radius: 8rpx;
// opacity: 1;
// border: 2rpx solid #181a1f1a;
background: #f7f8fa;
margin-bottom: 16rpx;
.label {
color: #999EA8;
margin-right: 30rpx;
}
.value {
color: #5A5E66;
}
.row+.row {
margin-top: 6rpx;
}
}
.abnormal-tag {
display: flex;
.text {
margin-left: 15rpx;
}
}
.error-icon {
display: inline-block;
width: 28rpx;
height: 24rpx;
margin-left: 9rpx;
// margin-right: 6rpx;
margin-top: 3rpx;
}
\ No newline at end of file \ No newline at end of file
...@@ -41,17 +41,17 @@ Page({ ...@@ -41,17 +41,17 @@ Page({
wx.hideLoading() wx.hideLoading()
// 跳转到智能体后添加返回拦截 // 跳转到智能体后添加返回拦截
if (param.needIntercept) { if (param.needIntercept) {
wx.enableAlertBeforeUnload && wx.enableAlertBeforeUnload({ wx.enableAlertBeforeUnload &&
message: '您还没有完成本次短课程学习,是否确定退出?', wx.enableAlertBeforeUnload({
success: (modalRes) => { message: '您还没有完成本次短课程学习,是否确定退出?',
if (modalRes.confirm) { success: modalRes => {
wx.navigateBack() if (modalRes.confirm) {
wx.navigateBack()
}
} }
} })
})
// 没有返回触发事件, 使用定时器轮询学习状态,是否卸载返回拦截弹窗 // 没有返回触发事件, 使用定时器轮询学习状态,是否卸载返回拦截弹窗
this.setTime(param) this.setTime(param)
}
} }
}, },
......
...@@ -364,6 +364,16 @@ Page({ ...@@ -364,6 +364,16 @@ Page({
// 处理subOrderList 商品为空的情况 // 处理subOrderList 商品为空的情况
e.subOrderList = e.subOrderList.filter(item => item.merchantGoodsId) e.subOrderList = e.subOrderList.filter(item => item.merchantGoodsId)
// e.subOrderList = e.subOrderList.filter(item => item.id) // e.subOrderList = e.subOrderList.filter(item => item.id)
const orderTypeMap = { 1: '正常订单', 2: '打折策略', 3: '买赠策略', 4: '冲量活动', 5: '组合付款' }
const approveStatusMap = { 0: '审批中', 1: '审批通过', 2: '审批驳回' }
e.orderTypeText = orderTypeMap[e.orderType] || ''
if (e.approveStatus != null) {
e.approveStatusText = approveStatusMap[e.approveStatus] || ''
}
if (e.oldOrderFinalPrice) {
e.oldOrderFinalPrice = Number(wx.$util.decimal(e.oldOrderFinalPrice, 2)).toFixed(2)
}
// 处理显示订单右上角文字 // 处理显示订单右上角文字
// console.log(status[e.status]) // console.log(status[e.status])
......
...@@ -438,23 +438,23 @@ Page({ ...@@ -438,23 +438,23 @@ Page({
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || ;(userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
showPicker: true, showPicker: true,
pickerType: 'merchant' pickerType: 'merchant'
}) })
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || ;(userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
showPicker: true, showPicker: true,
pickerType: 'staff' pickerType: 'staff'
}) })
}, },
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height let navBarHeight = e.detail.height
...@@ -474,7 +474,7 @@ Page({ ...@@ -474,7 +474,7 @@ Page({
['orderObj.staffUuid']: '', ['orderObj.staffUuid']: '',
['orderObj.staffName']: '', ['orderObj.staffName']: '',
staffCurrent: 0, staffCurrent: 0,
tabIndex: 0, // 重新设置为默认第一个 tabIndex: 0 // 重新设置为默认第一个
// ['orderObj.yqMerchantId']: merchantRange[value].yqMerchantId, // ['orderObj.yqMerchantId']: merchantRange[value].yqMerchantId,
// ['orderObj.yqMerchantName']: merchantRange[value].yqMerchantName // ['orderObj.yqMerchantName']: merchantRange[value].yqMerchantName
}) })
...@@ -580,7 +580,7 @@ Page({ ...@@ -580,7 +580,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -719,7 +719,7 @@ Page({ ...@@ -719,7 +719,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -1442,7 +1442,7 @@ Page({ ...@@ -1442,7 +1442,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => { }) .catch(err => {})
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1651,7 +1651,7 @@ Page({ ...@@ -1651,7 +1651,7 @@ Page({
} }
// } // }
}) })
.catch(err => { }) .catch(err => {})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1773,5 +1773,5 @@ Page({ ...@@ -1773,5 +1773,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { } onReady: function () {}
}) })
...@@ -335,23 +335,23 @@ Page({ ...@@ -335,23 +335,23 @@ Page({
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || ;(userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
showPicker: true, showPicker: true,
pickerType: 'merchant' pickerType: 'merchant'
}) })
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || ;(userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
showPicker: true, showPicker: true,
pickerType: 'staff' pickerType: 'staff'
}) })
}, },
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height let navBarHeight = e.detail.height
...@@ -476,7 +476,7 @@ Page({ ...@@ -476,7 +476,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -617,7 +617,7 @@ Page({ ...@@ -617,7 +617,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
// console.log(object); // console.log(object);
...@@ -1329,7 +1329,7 @@ Page({ ...@@ -1329,7 +1329,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => { }) .catch(err => {})
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1536,7 +1536,7 @@ Page({ ...@@ -1536,7 +1536,7 @@ Page({
} }
// } // }
}) })
.catch(err => { }) .catch(err => {})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1649,5 +1649,5 @@ Page({ ...@@ -1649,5 +1649,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { } onReady: function () {}
}) })
...@@ -61,8 +61,8 @@ const domain_items = { ...@@ -61,8 +61,8 @@ const domain_items = {
// dj: "http://192.168.1.86:8594", //蔡远明 // dj: "http://192.168.1.86:8594", //蔡远明
// dj: 'http://192.168.1.104:8292',//范富荣 // dj: 'http://192.168.1.104:8292',//范富荣
// dj: 'http://192.168.1.89:8292', //周杭 // dj: 'http://192.168.1.89:8292', //周杭
// dj: 'http://192.168.1.76:8292', //璐琦 dj: 'http://192.168.1.76:8292', //璐琦
dj: 'http://192.168.1.122:8292', //庞善天 // dj: 'http://192.168.1.122:8292', //庞善天
// dj: 'http://192.168.1.227:8292',//陈希 // dj: 'http://192.168.1.227:8292',//陈希
// dj: 'http://192.168.1.67:8292',//周立明 // dj: 'http://192.168.1.67:8292',//周立明
// dj: 'http://192.168.148.235:8292',// 熊正顺 // dj: 'http://192.168.148.235:8292',// 熊正顺
......
...@@ -3,16 +3,18 @@ ...@@ -3,16 +3,18 @@
* var weekDay = {week: '',day: ''} * var weekDay = {week: '',day: ''}
* 参数:selectWeek 0为本周,数字代表前几周或者后几周,例如1是下一周 * 参数:selectWeek 0为本周,数字代表前几周或者后几周,例如1是下一周
*/ */
function getWeekDayList(selectWeek, selectDay, customerDisabled,) { function getWeekDayList(selectWeek, selectDay, customerDisabled) {
// 1.获取周一对应得时间 // 1.获取周一对应得时间
// 2.用循环七次添加周一到周日对应得周几和几号 // 2.用循环七次添加周一到周日对应得周几和几号
var selectWeekTime = getCurrentTimeStamp(selectDay) + selectWeek * 7 * 24 * 60 * 60 * 1000 var selectWeekTime =
var mondayTime = selectWeekTime - (getWeekNumber(selectWeekTime) - 1) * 24 * 60 * 60 * 1000 getCurrentTimeStamp(selectDay) + selectWeek * 7 * 24 * 60 * 60 * 1000
var mondayTime =
selectWeekTime - (getWeekNumber(selectWeekTime) - 1) * 24 * 60 * 60 * 1000
// let testDate = new Date(mondayTime) // let testDate = new Date(mondayTime)
console.log(selectWeekTime, 'selectWeekTime'); console.log(selectWeekTime, 'selectWeekTime')
// console.log(getWeekNumber(selectWeekTime), getWeekNumber(selectWeekTime) - 1, 'getWeekNumber(selectWeekTime) - 1') // console.log(getWeekNumber(selectWeekTime), getWeekNumber(selectWeekTime) - 1, 'getWeekNumber(selectWeekTime) - 1')
// console.log(getDataFormat(selectWeekTime), 'selectWeekTime') // console.log(getDataFormat(selectWeekTime), 'selectWeekTime')
console.log(selectWeekTime, 'selectWeekTime'); console.log(selectWeekTime, 'selectWeekTime')
// console.log(getDataFormat(mondayTime), 'mondayTime') // console.log(getDataFormat(mondayTime), 'mondayTime')
var timeBean = { var timeBean = {
selectDay: 0, selectDay: 0,
...@@ -20,7 +22,7 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) { ...@@ -20,7 +22,7 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) {
weekDayList: [] weekDayList: []
} }
timeBean.yearMonth = getYearMonth(selectWeekTime) timeBean.yearMonth = getYearMonth(selectWeekTime)
console.log(timeBean.yearMonth, 'timeBean.yearMonth'); console.log(timeBean.yearMonth, 'timeBean.yearMonth')
const yearLabel = getYearMonth(selectWeekTime, '/') const yearLabel = getYearMonth(selectWeekTime, '/')
// 获取当前时间戳(以毫秒为单位) // 获取当前时间戳(以毫秒为单位)
const currentTimestamp = Date.now() const currentTimestamp = Date.now()
...@@ -35,7 +37,9 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) { ...@@ -35,7 +37,9 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) {
weekDay.week = getWeek(dataStr) weekDay.week = getWeek(dataStr)
weekDay.day = getMyDay(dataStr) weekDay.day = getMyDay(dataStr)
weekDay.date = getDataFormat(dataStr) weekDay.date = getDataFormat(dataStr)
weekDay.disabled = customerDisabled ? dataStr > (currentTimestamp + 24 * 60 * 60 * 1000) : dataStr > currentTimestamp weekDay.disabled = customerDisabled
? dataStr > currentTimestamp + 24 * 60 * 60 * 1000
: dataStr > currentTimestamp
timeBean.weekDayList.push(weekDay) timeBean.weekDayList.push(weekDay)
if (i == 0) { if (i == 0) {
timeBean.starDay = getMyDay(dataStr) timeBean.starDay = getMyDay(dataStr)
...@@ -46,7 +50,10 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) { ...@@ -46,7 +50,10 @@ function getWeekDayList(selectWeek, selectDay, customerDisabled,) {
timeBean.endDayLabel = getYearMonth(dataStr, '/') + '/' + weekDay.day timeBean.endDayLabel = getYearMonth(dataStr, '/') + '/' + weekDay.day
timeBean.reportEndDate = getDataFormat(dataStr) timeBean.reportEndDate = getDataFormat(dataStr)
// console.log(dataStr) // console.log(dataStr)
timeBean.isInCurrentWeek = isTimestampInCurrentWeek(dataStr, customerDisabled) timeBean.isInCurrentWeek = isTimestampInCurrentWeek(
dataStr,
customerDisabled
)
} }
} }
...@@ -110,19 +117,19 @@ function getWeek(res) { ...@@ -110,19 +117,19 @@ function getWeek(res) {
// var m = time.getMonth() + 1 // var m = time.getMonth() + 1
// var d = time.getDate() // var d = time.getDate()
// return '日一二三四五六'.charAt(new Date(y + '-' + m + '-' + d).getDay()) // return '日一二三四五六'.charAt(new Date(y + '-' + m + '-' + d).getDay())
var days = ['日', '一', '二', '三', '四', '五', '六']; var days = ['日', '一', '二', '三', '四', '五', '六']
var time = new Date(res); var time = new Date(res)
var dayIndex = time.getDay(); var dayIndex = time.getDay()
return days[dayIndex]; return days[dayIndex]
} }
//时间戳转周几 0123456 -- //时间戳转周几 0123456 --
function getWeekNumber(res) { function getWeekNumber(res) {
// var days = [6, 0, 1, 2, 3, 4, 5,]; // var days = [6, 0, 1, 2, 3, 4, 5,];
var days = [7, 1, 2, 3, 4, 5, 6]; var days = [7, 1, 2, 3, 4, 5, 6]
var time = new Date(res); var time = new Date(res)
var dayIndex = time.getDay(); var dayIndex = time.getDay()
return days[dayIndex]; return days[dayIndex]
// var time = new Date(res) // var time = new Date(res)
// var y = time.getFullYear() // var y = time.getFullYear()
// var m = time.getMonth() + 1 // var m = time.getMonth() + 1
...@@ -156,25 +163,43 @@ function getDataFormat(res) { ...@@ -156,25 +163,43 @@ function getDataFormat(res) {
// return targetDate >= currentWeekStart && targetDate <= currentWeekEnd // return targetDate >= currentWeekStart && targetDate <= currentWeekEnd
// } // }
function isTimestampInCurrentWeek(timestamp, customerDisabled) { function isTimestampInCurrentWeek(timestamp, customerDisabled) {
const currentDate = new Date(); const currentDate = new Date()
const currentDay = currentDate.getDay(); // 获取当前日期是星期几 const currentDay = currentDate.getDay() // 获取当前日期是星期几
// 计算当前周的起始日期(周一) // 计算当前周的起始日期(周一)
const currentWeekStart = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - currentDay + (currentDay === 0 ? -6 : 1)); const currentWeekStart = new Date(
currentDate.getFullYear(),
currentDate.getMonth(),
currentDate.getDate() - currentDay + (currentDay === 0 ? -6 : 1)
)
// 计算当前周的结束日期(周日) // 计算当前周的结束日期(周日)
const currentWeekEnd = new Date(currentWeekStart.getFullYear(), currentWeekStart.getMonth(), currentWeekStart.getDate() + 6, 23, 59, 59, 999); const currentWeekEnd = new Date(
currentWeekStart.getFullYear(),
currentWeekStart.getMonth(),
currentWeekStart.getDate() + 6,
23,
59,
59,
999
)
const targetDate = new Date(timestamp); const targetDate = new Date(timestamp)
if (customerDisabled) { if (customerDisabled) {
let startOfTargetDate = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate()) let startOfTargetDate = new Date(
let endOfTargetDate = new Date(startOfTargetDate.getTime() + (24 * 60 * 60 * 1000) - 1) targetDate.getFullYear(),
let tomorrow = new Date(new Date().getTime() + (24 * 60 * 60 * 1000)) targetDate.getMonth(),
targetDate.getDate()
)
let endOfTargetDate = new Date(
startOfTargetDate.getTime() + 24 * 60 * 60 * 1000 - 1
)
let tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
return tomorrow <= endOfTargetDate return tomorrow <= endOfTargetDate
} }
return targetDate >= currentWeekStart && targetDate <= currentWeekEnd; return targetDate >= currentWeekStart && targetDate <= currentWeekEnd
} }
function getWeeksDiff(startDate, endDate) { function getWeeksDiff(startDate, endDate) {
...@@ -197,12 +222,15 @@ function getWeeksDiff(startDate, endDate) { ...@@ -197,12 +222,15 @@ function getWeeksDiff(startDate, endDate) {
const daysDiff = (dayOfWeek + 7 - firstDayOfWeek) % 7 const daysDiff = (dayOfWeek + 7 - firstDayOfWeek) % 7
// 计算结束日期距离一周第一天的周数差 // 计算结束日期距离一周第一天的周数差
const weeksDiff = Math.floor((endTimestamp + daysDiff * 24 * 3600 * 1000 - startTimestamp) / (7 * 24 * 3600 * 1000)) const weeksDiff = Math.floor(
(endTimestamp + daysDiff * 24 * 3600 * 1000 - startTimestamp) /
(7 * 24 * 3600 * 1000)
)
return weeksDiff return weeksDiff
} }
function isDateWithin7Days(date) { function isDateWithin7Days(date) {
console.log(date, 'isDateWithin7Daysdate'); console.log(date, 'isDateWithin7Daysdate')
// console.log(date, 'date'); // console.log(date, 'date');
const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数 const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数
const currentDate = new Date() // 当前日期 const currentDate = new Date() // 当前日期
...@@ -246,4 +274,5 @@ module.exports = { ...@@ -246,4 +274,5 @@ module.exports = {
getWeekDayList: getWeekDayList, getWeekDayList: getWeekDayList,
isDateWithin7Days: isDateWithin7Days, isDateWithin7Days: isDateWithin7Days,
isDateWithin60Days: isDateWithin60Days isDateWithin60Days: isDateWithin60Days
// isDateWithin30Days: isDateWithin30Days
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!