Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CFFP-HB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chao Sun
CFFP-HB
Commits
5580cc3d
Commit
5580cc3d
authored
Apr 08, 2026
by
yuzhenWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改月份对应的天数,各种情景的支付方式
parent
f9c23c43
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
192 additions
and
150 deletions
+192
-150
components/commonTimePicker/commonTimePicker.vue
+177
-148
pages/orderConfirm/orderConfirm.vue
+14
-2
pages/pointsExchange/customDatePop.vue
+1
-0
No files found.
components/commonTimePicker/commonTimePicker.vue
View file @
5580cc3d
...
...
@@ -3,43 +3,39 @@
<view
class=
"timeTitle"
>
<view
class=
""
v-if=
"initDate"
>
<text
style=
"font-size: 30rpx;"
>
{{
initDate
}}
</text>
<text
v-if=
"iconDirection== 'down'"
class=
"iconfont icon-xiajiantou iconStyle"
:style=
"
{color:iconColor?iconColor:
''}">
</text>
<text
v-if=
"iconDirection
== 'right'"
class=
"iconfont icon-youjiantou iconStyle"
></text>
<text
v-if=
"iconDirection == 'down'"
class=
"iconfont icon-xiajiantou iconStyle"
:style=
"
{color: iconColor ||
''}">
</text>
<text
v-if=
"iconDirection
== 'right'"
class=
"iconfont icon-youjiantou iconStyle"
></text>
</view>
<view
class=
"emptyTxt"
v-else
>
<text
v-if=
"startTxt"
:style=
"
{fontSize:
placeholderSize}">
{{
startTxt
}}
</text>
<text
v-if=
"endTxt"
:style=
"
{fontSize:
placeholderSize}">
{{
endTxt
}}
</text>
<text
v-if=
"iconDirection
== 'down'"
class=
"iconfont icon-xiajiantou iconStyle"
></text>
<text
v-if=
"iconDirection
== 'right'"
class=
"iconfont icon-youjiantou iconStyle"
></text>
<text
v-if=
"startTxt"
:style=
"
{fontSize:
placeholderSize}">
{{
startTxt
}}
</text>
<text
v-if=
"endTxt"
:style=
"
{fontSize:
placeholderSize}">
{{
endTxt
}}
</text>
<text
v-if=
"iconDirection
== 'down'"
class=
"iconfont icon-xiajiantou iconStyle"
></text>
<text
v-if=
"iconDirection
== 'right'"
class=
"iconfont icon-youjiantou iconStyle"
></text>
</view>
</view>
<uni-popup
ref=
"timePopup"
type=
"bottom"
:maskClick=
"false"
>
<view
class=
"timeBox"
>
<view
class=
"titleBox"
>
<view
@
click=
"cancle"
style=
"color:#333;"
>
取消
</view>
<view
style=
"color:#20279b;"
@
click=
"confirm"
>
确定
</view>
<view
@
click=
"cancel"
style=
"color:#333;"
>
取消
</view>
<view
style=
"color:#20279b;"
@
click=
"confirm"
>
确定
</view>
</view>
<picker-view
:indicator-style=
"indicatorStyle"
:value=
"value"
@
change=
"bindChange"
class=
"picker-view"
>
<picker-view-column
v-if=
"showYear"
>
<view
class=
"item"
v-for=
"(item,index) in years"
:key=
"index"
>
<view
class=
"item"
v-for=
"(item,
index) in years"
:key=
"index"
>
<view
class=
"myItem"
:class=
"
{ 'selected': currentValue[0] === index }">
{{
item
}}
年
</view>
</view>
</picker-view-column>
<picker-view-column
v-if=
"showMonth"
>
<view
class=
"item"
v-for=
"(item,index) in months"
:key=
"index"
>
<view
class=
"item"
v-for=
"(item,
index) in months"
:key=
"index"
>
<view
class=
"myItem"
:class=
"
{ 'selected': currentValue[1] === index }">
{{
item
}}
月
</view>
</view>
</picker-view-column>
<picker-view-column
v-if=
"showDay"
>
<view
class=
"item"
v-for=
"(item,index) in days"
:key=
"index"
>
<view
class=
"item"
v-for=
"(item,
index) in days"
:key=
"index"
>
<view
class=
"myItem"
:class=
"
{ 'selected': currentValue[2] === index }">
{{
item
}}
日
</view>
...
...
@@ -50,125 +46,131 @@
</uni-popup>
</view>
</
template
>
<
script
>
import
dataHandling
from
"@/util/dataHandling"
;
import
dayjs
from
'dayjs'
;
export
default
{
name
:
'CommonTimePicker'
,
import
dataHandling
from
"@/util/dataHandling"
;
import
dayjs
from
'dayjs'
;
export
default
{
name
:
'CommonTimePicker'
,
props
:
{
timeData
:
{
//方便组件回显日期
timeData
:
{
type
:
Object
,
default
:
()
=>
({})
},
iconDirection
:
{
//箭头的方向
iconDirection
:
{
type
:
String
,
default
:
'down'
},
iconColor
:
{
iconColor
:
{
type
:
String
,
default
:
'#000'
},
visible
:
{
//显示组件
visible
:
{
type
:
Boolean
,
default
:
false
},
showYear
:
{
//展示年份
showYear
:
{
type
:
Boolean
,
default
:
true
},
showMonth
:
{
//展示月份
showMonth
:
{
type
:
Boolean
,
default
:
true
},
showDay
:
{
//展示日子
showDay
:
{
type
:
Boolean
,
default
:
false
},
birthDay
:{
//是否是出生日期组件 影响到组件时间范围
birthDay
:
{
type
:
Boolean
,
default
:
false
},
startTxt
:
{
//开始的文字
startTxt
:
{
type
:
String
,
default
:
''
},
endTxt
:
{
//结束的文字的文字
endTxt
:
{
type
:
String
,
default
:
''
},
placeholderSize
:
{
//结束的文字的文字
placeholderSize
:
{
type
:
String
,
default
:
'30rpx'
},
yearStart
:
{
//限制开始年份
yearStart
:
{
type
:
Number
,
default
:
2025
default
:
2025
},
yearEnd
:
{
//限制结束年份
yearEnd
:
{
type
:
Number
,
},
},
data
:
function
()
{
const
date
=
new
Date
()
const
years
=
[]
const
months
=
[]
const
days
=
[]
const
day
=
this
.
timeData
.
day
||
dataHandling
.
getDateParts
().
day
const
currentYear
=
this
.
yearEnd
||
date
.
getFullYear
()
data
()
{
const
date
=
new
Date
();
const
currentYear
=
this
.
yearEnd
||
date
.
getFullYear
();
const
startYear
=
this
.
yearStart
;
// 初始值优先使用传入的timeData,没有则使用当前日期
const
initialYear
=
this
.
timeData
.
year
||
dataHandling
.
getDateParts
().
year
const
initialMonth
=
this
.
timeData
.
month
||
dataHandling
.
getDateParts
().
month
const
startYear
=
this
.
yearStart
// 年份数组
const
years
=
[];
for
(
let
i
=
startYear
;
i
<=
currentYear
;
i
++
)
{
years
.
push
(
i
)
years
.
push
(
i
);
}
// 月份数组
const
months
=
[];
for
(
let
i
=
1
;
i
<=
12
;
i
++
)
{
months
.
push
(
i
)
months
.
push
(
i
);
}
// 内部默认值:使用当前日期(仅用于弹窗初始显示,不影响外部展示)
let
defaultYear
=
date
.
getFullYear
();
let
defaultMonth
=
date
.
getMonth
()
+
1
;
let
defaultDay
=
date
.
getDate
();
// 如果传入了 timeData 且有效,则使用传入值作为内部默认值
if
(
this
.
timeData
&&
(
this
.
timeData
.
year
||
this
.
timeData
.
month
||
this
.
timeData
.
day
))
{
if
(
this
.
timeData
.
year
)
defaultYear
=
this
.
timeData
.
year
;
if
(
this
.
timeData
.
month
)
defaultMonth
=
this
.
timeData
.
month
;
if
(
this
.
timeData
.
day
)
defaultDay
=
this
.
timeData
.
day
;
}
for
(
let
i
=
1
;
i
<=
31
;
i
++
)
{
days
.
push
(
i
)
// 保证年份在范围内
if
(
defaultYear
<
startYear
)
defaultYear
=
startYear
;
if
(
defaultYear
>
currentYear
)
defaultYear
=
currentYear
;
if
(
defaultMonth
<
1
)
defaultMonth
=
1
;
if
(
defaultMonth
>
12
)
defaultMonth
=
12
;
// 根据年月计算正确天数
const
maxDay
=
this
.
getDaysInMonth
(
defaultYear
,
defaultMonth
);
if
(
defaultDay
>
maxDay
)
defaultDay
=
maxDay
;
const
days
=
[];
for
(
let
i
=
1
;
i
<=
maxDay
;
i
++
)
{
days
.
push
(
i
);
}
const
yearIndex
=
Math
.
max
(
0
,
years
.
indexOf
(
defaultYear
));
const
monthIndex
=
Math
.
max
(
0
,
defaultMonth
-
1
);
const
dayIndex
=
Math
.
max
(
0
,
defaultDay
-
1
);
return
{
title
:
'picker-view'
,
years
,
months
,
year
:
initialYear
,
month
:
initialMonth
,
day
:
this
.
timeData
.
day
||
day
,
value
:
[
Math
.
max
(
0
,
years
.
indexOf
(
initialYear
)),
Math
.
max
(
0
,
initialMonth
-
1
),
Math
.
max
(
0
,
(
this
.
timeData
.
day
||
day
)
-
1
)
],
days
,
year
:
defaultYear
,
month
:
defaultMonth
,
day
:
defaultDay
,
value
:
[
yearIndex
,
monthIndex
,
dayIndex
],
currentValue
:
[
yearIndex
,
monthIndex
,
dayIndex
],
indicatorStyle
:
`height: 50px;`
,
initDate
:
this
.
generateDateString
({
year
:
this
.
timeData
.
year
,
month
:
this
.
timeData
.
month
,
day
:
this
.
timeData
.
day
}),
currentValue
:
[
Math
.
max
(
0
,
years
.
indexOf
(
initialYear
)),
Math
.
max
(
0
,
initialMonth
-
1
),
Math
.
max
(
0
,
(
this
.
timeData
.
day
||
day
)
-
1
)
]
}
initDate
:
''
,
// 初始不显示任何日期,占位符优先
};
},
watch
:
{
visible
:
{
deep
:
true
,
handler
(
newVal
)
{
if
(
newVal
)
this
.
$refs
.
timePopup
.
open
()
}
},
birthDay
:
{
immediate
:
true
,
handler
(
newVal
)
{
this
.
updateYears
(
newVal
)
if
(
newVal
)
this
.
$refs
.
timePopup
.
open
();
}
},
timeData
:
{
...
...
@@ -176,17 +178,42 @@
immediate
:
true
,
handler
(
newVal
)
{
if
(
newVal
&&
(
newVal
.
year
||
newVal
.
month
||
newVal
.
day
))
{
this
.
updateSelectedDate
(
newVal
)
this
.
updateSelectedDate
(
newVal
);
}
else
{
// 没有传入有效日期时,清空显示
this
.
initDate
=
''
;
}
}
},
year
()
{
if
(
this
.
showDay
)
this
.
updateDaysAndAdjust
();
},
month
()
{
if
(
this
.
showDay
)
this
.
updateDaysAndAdjust
();
}
},
methods
:
{
getDaysInMonth
(
year
,
month
)
{
return
new
Date
(
year
,
month
,
0
).
getDate
();
},
updateDaysAndAdjust
()
{
const
maxDay
=
this
.
getDaysInMonth
(
this
.
year
,
this
.
month
);
const
newDays
=
[];
for
(
let
i
=
1
;
i
<=
maxDay
;
i
++
)
{
newDays
.
push
(
i
);
}
this
.
days
=
newDays
;
if
(
this
.
day
>
maxDay
)
{
this
.
day
=
maxDay
;
}
const
dayIndex
=
Math
.
max
(
0
,
this
.
day
-
1
);
if
(
this
.
currentValue
.
length
>=
3
)
this
.
currentValue
[
2
]
=
dayIndex
;
if
(
this
.
value
.
length
>=
3
)
this
.
value
[
2
]
=
dayIndex
;
},
generateDateString
(
dateObj
)
{
const
parts
=
[];
if
(
this
.
showYear
&&
dateObj
.
year
)
{
parts
.
push
(
dateObj
.
year
);
}
if
(
this
.
showYear
&&
dateObj
.
year
)
parts
.
push
(
dateObj
.
year
);
if
(
this
.
showMonth
&&
dateObj
.
month
)
{
const
month
=
dateObj
.
month
<
10
?
'0'
+
dateObj
.
month
:
dateObj
.
month
;
parts
.
push
(
month
);
...
...
@@ -197,109 +224,111 @@
}
return
parts
.
join
(
'-'
);
},
updateYears
(
isBirthDay
)
{
// 更新年份范围
const
date
=
new
Date
()
const
currentYear
=
this
.
yearEnd
||
date
.
getFullYear
()
const
startYear
=
this
.
yearStart
this
.
years
=
[]
for
(
let
i
=
startYear
;
i
<=
currentYear
;
i
++
)
{
this
.
years
.
push
(
i
)
}
// 确保当前选中的年份在新范围内
const
yearIndex
=
this
.
years
.
indexOf
(
this
.
year
)
if
(
yearIndex
>=
0
)
{
this
.
currentValue
[
0
]
=
yearIndex
this
.
value
[
0
]
=
yearIndex
}
else
{
// 如果当前年份不在新范围内,选择最近的年份
const
newYearIndex
=
Math
.
max
(
0
,
this
.
years
.
length
-
1
)
this
.
year
=
this
.
years
[
newYearIndex
]
this
.
currentValue
[
0
]
=
newYearIndex
this
.
value
[
0
]
=
newYearIndex
}
},
updateSelectedDate
(
dateObj
)
{
// 更新选中的日期
if
(
dateObj
.
year
)
{
this
.
year
=
dateObj
.
year
const
yearIndex
=
this
.
years
.
indexOf
(
dateObj
.
year
)
if
(
!
dateObj
)
return
;
let
needUpdateDays
=
false
;
if
(
dateObj
.
year
&&
this
.
years
.
includes
(
dateObj
.
year
))
{
this
.
year
=
dateObj
.
year
;
const
yearIndex
=
this
.
years
.
indexOf
(
dateObj
.
year
);
if
(
yearIndex
>=
0
)
{
this
.
currentValue
[
0
]
=
yearIndex
this
.
value
[
0
]
=
yearIndex
this
.
currentValue
[
0
]
=
yearIndex
;
this
.
value
[
0
]
=
yearIndex
;
}
needUpdateDays
=
true
;
}
if
(
dateObj
.
month
)
{
this
.
month
=
dateObj
.
month
const
monthIndex
=
Math
.
max
(
0
,
dateObj
.
month
-
1
)
this
.
currentValue
[
1
]
=
monthIndex
this
.
value
[
1
]
=
monthIndex
if
(
dateObj
.
month
&&
dateObj
.
month
>=
1
&&
dateObj
.
month
<=
12
)
{
this
.
month
=
dateObj
.
month
;
const
monthIndex
=
dateObj
.
month
-
1
;
this
.
currentValue
[
1
]
=
monthIndex
;
this
.
value
[
1
]
=
monthIndex
;
needUpdateDays
=
true
;
}
if
(
dateObj
.
day
)
{
this
.
day
=
dateObj
.
day
const
dayIndex
=
Math
.
max
(
0
,
dateObj
.
day
-
1
)
this
.
currentValue
[
2
]
=
dayIndex
this
.
value
[
2
]
=
dayIndex
if
(
dateObj
.
day
&&
this
.
showDay
)
{
this
.
day
=
dateObj
.
day
;
}
// 更新显示的日期文本
if
(
needUpdateDays
&&
this
.
showDay
)
{
this
.
updateDaysAndAdjust
();
}
else
if
(
dateObj
.
day
&&
this
.
showDay
)
{
const
maxDay
=
this
.
getDaysInMonth
(
this
.
year
,
this
.
month
);
if
(
this
.
day
>
maxDay
)
this
.
day
=
maxDay
;
const
dayIndex
=
this
.
day
-
1
;
this
.
currentValue
[
2
]
=
dayIndex
;
this
.
value
[
2
]
=
dayIndex
;
}
// 更新显示文本
this
.
initDate
=
this
.
generateDateString
({
year
:
this
.
year
,
month
:
this
.
month
,
day
:
this
.
day
})
});
},
bindChange
:
dataHandling
.
debounce
(
function
(
e
)
{
bindChange
:
dataHandling
.
debounce
(
function
(
e
)
{
const
val
=
e
.
detail
.
value
;
if
(
this
.
showYear
&&
val
[
0
]
!==
undefined
)
this
.
year
=
this
.
years
[
val
[
0
]];
if
(
this
.
showMonth
&&
val
[
1
]
!==
undefined
)
this
.
month
=
this
.
months
[
val
[
1
]];
if
(
this
.
showDay
)
{
const
maxDay
=
this
.
getDaysInMonth
(
this
.
year
,
this
.
month
);
const
newDays
=
[];
for
(
let
i
=
1
;
i
<=
maxDay
;
i
++
)
newDays
.
push
(
i
);
this
.
days
=
newDays
;
let
dayIndex
=
val
[
2
]
||
0
;
if
(
dayIndex
>=
this
.
days
.
length
)
dayIndex
=
this
.
days
.
length
-
1
;
this
.
day
=
this
.
days
[
dayIndex
];
this
.
currentValue
=
[
val
[
0
],
val
[
1
],
dayIndex
];
this
.
value
=
[
val
[
0
],
val
[
1
],
dayIndex
];
}
else
{
this
.
currentValue
=
val
;
this
.
year
=
this
.
years
[
val
[
0
]];
this
.
month
=
this
.
months
[
val
[
1
]];
this
.
day
=
this
.
days
[
val
[
2
]];
this
.
value
=
val
;
}
},
50
),
cancle
()
{
this
.
$emit
(
'closeTime'
,
false
)
this
.
$refs
.
timePopup
.
close
()
cancel
()
{
this
.
$emit
(
'closeTime'
,
false
);
this
.
$refs
.
timePopup
.
close
();
},
confirm
(){
console
.
log
(
'currentValue'
,
this
.
currentValue
);
confirm
()
{
if
(
this
.
showDay
)
{
const
maxDay
=
this
.
getDaysInMonth
(
this
.
year
,
this
.
month
);
if
(
this
.
day
>
maxDay
)
{
this
.
day
=
maxDay
;
this
.
currentValue
[
2
]
=
maxDay
-
1
;
this
.
value
[
2
]
=
maxDay
-
1
;
}
}
this
.
initDate
=
this
.
generateDateString
({
year
:
this
.
year
,
month
:
this
.
month
,
day
:
this
.
day
})
this
.
$refs
.
timePopup
.
close
()
});
this
.
$refs
.
timePopup
.
close
();
this
.
$emit
(
'confirmDate'
,
{
year
:
this
.
year
,
month
:
this
.
month
,
day
:
this
.
day
})
}
});
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
::v-deep
.uni-popup
.uni-popup__wrapper
{
::v-deep
.uni-popup
.uni-popup__wrapper
{
margin
:
0
!important
;
}
.timeTitle
{
}
.timeTitle
{
font-size
:
35
rpx
;
.emptyTxt
{
.emptyTxt
{
color
:
gray
;
font-size
:
31
rpx
;
display
:
flex
;
align-items
:
center
;
}
}
.timeBox
{
}
.timeBox
{
width
:
100%
;
background-color
:
#fff
;
border-radius
:
10
rpx
10
rpx
0
0
;
.titleBox
{
.titleBox
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
...
...
@@ -328,6 +357,5 @@
}
}
}
}
}
</
style
>
\ No newline at end of file
pages/orderConfirm/orderConfirm.vue
View file @
5580cc3d
...
...
@@ -36,7 +36,8 @@
<!-- 支付方式 -->
<view
class=
"paymentMethodContent"
>
<h4>
选择支付方式
</h4>
<view
class=
"paymentItem"
@
click=
"selectPaymentMethod(2)"
>
<view
@
click=
"selectPaymentMethod(2)"
>
<view
class=
"paymentItem"
v-if=
"runEnv!=='wechat-miniprogram'"
>
<view>
<i
class=
"iconfont icon-zhifubao"
></i>
<text
class=
"txtFont"
>
支付宝支付
</text>
...
...
@@ -45,6 +46,8 @@
<i
class=
"iconfont icon-duihao txtFont"
></i>
</view>
</view>
</view>
<view
class=
"paymentItem"
@
click=
"selectPaymentMethod(1)"
v-if=
"deviceType==3"
>
<view>
<i
class=
"iconfont icon-py_weixinzhifu txtFont"
></i>
...
...
@@ -210,7 +213,8 @@
calculatedPrice
:
0
,
dataToken
:
''
,
oldToken
:
''
,
//原始用户token
pollTimer
:
''
pollTimer
:
''
,
runEnv
:
dataHandling
.
h5RuntimeEnv
()
}
},
computed
:
{
...
...
@@ -256,6 +260,7 @@
fileId
:
this
.
fileId
,
companyType
:
companyInfo
.
companyType
,
}
if
(
this
.
paymentMethod
==
1
)
{
// APP:微信app支付
// #ifdef APP-PLUS
...
...
@@ -324,8 +329,14 @@
}
let
_this
=
this
param
.
isPayOrAuth
=
1
;
uni
.
showToast
({
title
:
JSON
.
stringify
(
param
),
duration
:
10000
,
icon
:
'none'
})
api
.
wxAuthorize
(
param
).
then
((
res
)
=>
{
_this
.
paymentBtnDisabled
=
false
;
if
(
res
[
'success'
])
{
if
(
param
.
amount
==
'0.00'
)
{
uni
.
navigateTo
({
...
...
@@ -418,6 +429,7 @@
},
getunifiedPay
(
param
){
api
.
unifiedPay
(
param
).
then
((
res
)
=>
{
const
data
=
res
[
'data'
];
this
.
paymentBtnDisabled
=
false
;
...
...
pages/pointsExchange/customDatePop.vue
View file @
5580cc3d
...
...
@@ -400,6 +400,7 @@
this
.
$emit
(
'comfirm'
,{
year
:
this
.
year
,
month
:
this
.
month
,
current
:
this
.
current
,
timeType
:
'8'
})
}
if
(
this
.
current
==
'2'
){
console
.
log
(
'this.currentDate'
,
this
.
currentDate
);
if
(
!
this
.
currentDate
.
length
){
uni
.
showToast
({
title
:
`请选择时间`
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment