|
@@ -0,0 +1,260 @@
|
|
|
+
|
|
|
+Page({
|
|
|
+
|
|
|
+
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ date:'',
|
|
|
+ startDate:'',
|
|
|
+ endDate:'',
|
|
|
+ orders:[
|
|
|
+ {
|
|
|
+ buttonMessage1:'',
|
|
|
+ buttonColor1:'',
|
|
|
+ buttonMessage2:'',
|
|
|
+ buttonColor2:'',
|
|
|
+ order:{
|
|
|
+ oilName:"92#",
|
|
|
+ nozzleNum:'5',
|
|
|
+ volume:'20.0',
|
|
|
+ amount:'46.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'已授权'
|
|
|
+ },
|
|
|
+ statusColor:'#838282',
|
|
|
+ countdown:'60'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ buttonMessage1:'取消订单',
|
|
|
+ buttonColor1:'#838282',
|
|
|
+ buttonMessage2:'重新授权',
|
|
|
+ buttonColor2:'#d17067',
|
|
|
+ order:{
|
|
|
+ oilName:"0#",
|
|
|
+ nozzleNum:'6',
|
|
|
+ volume:'21.0',
|
|
|
+ amount:'42.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'已失效'
|
|
|
+ },
|
|
|
+ statusColor:'#838282',
|
|
|
+ countdown:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ buttonMessage1:'',
|
|
|
+ buttonColor1:'',
|
|
|
+ buttonMessage2:'重新支付',
|
|
|
+ buttonColor2:'#d17067',
|
|
|
+ order:{
|
|
|
+ oilName:"0#",
|
|
|
+ nozzleNum:'6',
|
|
|
+ volume:'21.0',
|
|
|
+ amount:'42.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'支付失败'
|
|
|
+ },
|
|
|
+ statusColor:'#d17067',
|
|
|
+ countdown:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ buttonMessage1:'',
|
|
|
+ buttonColor1:'',
|
|
|
+ buttonMessage2:'重新支付',
|
|
|
+ buttonColor2:'#d17067',
|
|
|
+ order:{
|
|
|
+ oilName:"0#",
|
|
|
+ nozzleNum:'6',
|
|
|
+ volume:'21.0',
|
|
|
+ amount:'42.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'支付失败'
|
|
|
+ },
|
|
|
+ statusColor:'#d17067',
|
|
|
+ countdown:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ buttonMessage1:'',
|
|
|
+ buttonColor1:'',
|
|
|
+ buttonMessage2:'重新支付',
|
|
|
+ buttonColor2:'#d17067',
|
|
|
+ order:{
|
|
|
+ oilName:"0#",
|
|
|
+ nozzleNum:'6',
|
|
|
+ volume:'21.0',
|
|
|
+ amount:'42.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'支付失败'
|
|
|
+ },
|
|
|
+ statusColor:'#d17067',
|
|
|
+ countdown:''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ buttonMessage1:'',
|
|
|
+ buttonColor1:'',
|
|
|
+ buttonMessage2:'重新支付',
|
|
|
+ buttonColor2:'#d17067',
|
|
|
+ order:{
|
|
|
+ oilName:"0#",
|
|
|
+ nozzleNum:'6',
|
|
|
+ volume:'21.0',
|
|
|
+ amount:'42.8',
|
|
|
+ date:'2024-11-24',
|
|
|
+ time:'09:08',
|
|
|
+ status:'支付失败'
|
|
|
+ },
|
|
|
+ statusColor:'#d17067',
|
|
|
+ countdown:''
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ getNowDate(){
|
|
|
+ const date = new Date();
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
+ },
|
|
|
+
|
|
|
+ getLastMouthDate(){
|
|
|
+ const currentDate = new Date();
|
|
|
+ const year = currentDate.getFullYear();
|
|
|
+ const month = currentDate.getMonth();
|
|
|
+ const day = currentDate.getDate();
|
|
|
+
|
|
|
+
|
|
|
+ const oneMonthAgoDate = new Date(year, month - 1, day);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const formattedDate = `${oneMonthAgoDate.getFullYear()}-${String(oneMonthAgoDate.getMonth() + 1).padStart(2, '0')}-${String(oneMonthAgoDate.getDate()).padStart(2, '0')}`;
|
|
|
+
|
|
|
+ return formattedDate;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ startCountdow(){
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ const countDownZeroOrders = []
|
|
|
+ const orders = this.data.orders.map(order => {
|
|
|
+ if(order.countdown && order.countdown != '0') {
|
|
|
+ const currentCountDown = (Number(order.countdown) - 1);
|
|
|
+ order.countdown = currentCountDown.toString();
|
|
|
+ if(currentCountDown <= 0) countDownZeroOrders.push(order)
|
|
|
+ }
|
|
|
+ return order
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ orders:orders
|
|
|
+ })
|
|
|
+ this.toUnAnthorization(countDownZeroOrders)
|
|
|
+ },1000);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ endCountDown(){
|
|
|
+ if(this.timer) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.timer = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ toUnAnthorization(orders) {
|
|
|
+ console.log(orders)
|
|
|
+ },
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad(options) {
|
|
|
+ const today = this.getNowDate();
|
|
|
+ const lastMouthDay = this.getLastMouthDate();
|
|
|
+ this.setData({
|
|
|
+ date:today,
|
|
|
+ startDate:today,
|
|
|
+ endDate:lastMouthDay
|
|
|
+ });
|
|
|
+
|
|
|
+ this.startCountdow();
|
|
|
+ },
|
|
|
+
|
|
|
+ onUnload(){
|
|
|
+ this.endCountDown()
|
|
|
+ },
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ onHide() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 生命周期函数--监听页面卸载
|
|
|
+ */
|
|
|
+ onUnload() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
+ */
|
|
|
+ onPullDownRefresh() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ onReachBottom() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ bindDateChange(date) {
|
|
|
+ this.setData({
|
|
|
+ date: date.detail.value
|
|
|
+ });
|
|
|
+ console.log(date)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ onOrderButtonClick1(event){
|
|
|
+ console.log(event)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ onOrderButtonClick2(event){
|
|
|
+ console.log(event)
|
|
|
+ },
|
|
|
+})
|