diff --git a/package1/order/orderList.vue b/package1/order/orderList.vue
index 5c553b0..d5c3162 100644
--- a/package1/order/orderList.vue
+++ b/package1/order/orderList.vue
@@ -166,19 +166,19 @@
-
- 待支付 {{ formatTime(item.timeLeft) }}
-
实付(含包装/配送费) ¥24
+ style="color: red;">¥{{item.totalAmount}}
-
+
取消订单
-
+ 申请售后
+
+
去支付
@@ -193,6 +193,49 @@
-->
+
+
+
+
@@ -207,7 +250,7 @@
tab2Checked: 'quanbu',
totalPages: 1,
pageNum:1,
- timer: null,
+ payData:{},
orderList:[],
searchForm:{
pageNum:1,
@@ -227,72 +270,11 @@
},
onLoad(option) {
this.getOrderList()
- this.startGlobalTimer()
- },
- onUnload() {
- // 页面卸载清除定时器
- if (this.timer) clearInterval(this.timer)
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
methods: {
- // 1. 开启全局定时器
- startGlobalTimer() {
- // 立即执行一次,避免等待1秒才显示
- this.updateCountdown()
-
- this.timer = setInterval(() => {
- this.updateCountdown()
- }, 1000)
- },
-
- // 2. 核心逻辑:计算每条数据的剩余时间
- updateCountdown() {
- const now = new Date().getTime()
-
- this.orderList.forEach(item => {
- const reg = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/
- const match = item.createTime.match(reg)
-
- if (match) {
- // 2. 手动构造时间 (注意:月份要减 1,因为 JS 月份是 0-11)
- // 这种写法在 iOS 上绝对不会报错
- let targetTime = new Date(
- parseInt(match[1]), // 年
- parseInt(match[2]) - 1, // 月 (记得减1)
- parseInt(match[3]), // 日
- parseInt(match[4]), // 时
- parseInt(match[5]), // 分
- parseInt(match[6]) // 秒
- ).getTime()
-
- // 3. 加上 1 小时
- targetTime = targetTime + (60 * 60 * 1000)
-
- // 4. 计算差值
- const diff = targetTime - new Date().getTime()
-
- // 如果时间已过期,设为0
- item.timeLeft = diff > 0 ? diff : 0
- }
- })
- },
-
- // 3. 格式化时间 (毫秒 -> 天时分秒)
- formatTime(ms) {
- const second = Math.floor(ms / 1000)
- const day = Math.floor(second / 86400)
- const hour = Math.floor((second % 86400) / 3600)
- const minute = Math.floor((second % 3600) / 60)
- const sec = second % 60
-
- // 补零操作
- const pad = (n) => n < 10 ? '0' + n : n
-
- // 根据需要返回格式,例如:1天 02时 05分 10秒
- return `${day > 0 ? day + '天' : ''}${pad(hour)}时${pad(minute)}分${pad(sec)}秒`
- },
checkTab1(type) {
this.tab1Checked = type
if(type == 'quanbu'){
@@ -307,9 +289,19 @@
this.searchForm.pageNum = 1
this.getOrderList()
},
+ orderStatus(item){
+ if(item.status == 0 || item.status == 10 || item.status == 2 || (item.status == 3 && item.deliveryType == 1) || (item.status == 3 && item.deliveryType == 2) || item.status == 4){
+ return true;
+ }
+ return false;
+ },
checkTabs2(type) {
this.tab2Checked = type
},
+ payAgain(item){
+ this.payData = item;
+ this.$refs.payPopup.open('bottom');
+ },
getOrderList(){
this.loadStatus = 'loading'
let that = this
@@ -331,6 +323,21 @@
uni.hideLoading();
}).catch((res) => {});
},
+ returnOrder(item){
+ let that = this
+ that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
+ if (res.code == 200) {
+ that.tui.toast("取消订单成功");
+ that.searchForm.pageNum = 1
+ that.getOrderList()
+ that.$forceUpdate();
+ } else {
+ that.tui.toast(res.message);
+ return;
+ }
+ uni.hideLoading();
+ }).catch((res) => {});
+ },
back() {
uni.navigateBack()
}