diff --git a/src/views/system/giftcoupon/batch.vue b/src/views/system/giftcoupon/batch.vue index a25aa76..9a3324a 100644 --- a/src/views/system/giftcoupon/batch.vue +++ b/src/views/system/giftcoupon/batch.vue @@ -60,8 +60,8 @@ @@ -88,14 +88,14 @@ @@ -126,8 +126,8 @@ @@ -413,9 +413,8 @@ export default { this.form.selectedProduct = product this.form.queryResult = product this.form.skuName = product.skuName || product.title || product.productName || product.cleanSkuName || '' - const ownerValue = product.owner || 'g' - // owner: 'g'/'G' = 自营, 'p'/'pop' = POP - this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop' + const ownerValue = product.owner || (product.popId ? 'pop' : 'g') || 'g' + this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g') this.$modal.msgSuccess('已选择商品:' + this.form.skuName + '(' + (this.form.owner === 'g' ? '自营' : 'POP') + ')') }, @@ -492,9 +491,8 @@ export default { this.form.selectedProduct = selectedProduct this.form.queryResult = selectedProduct this.form.skuName = selectedProduct.skuName || selectedProduct.title || selectedProduct.productName || selectedProduct.cleanSkuName || '' - const ownerValue = selectedProduct.owner || 'g' - // owner: 'g'/'G' = 自营, 'p'/'pop' = POP - this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop' + const ownerValue = selectedProduct.owner || (selectedProduct.popId ? 'pop' : 'g') || 'g' + this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g') // 调用批量创建和替换 await this.handleReplace() @@ -511,10 +509,8 @@ export default { return Number(price).toFixed(2) }, - /** 格式化佣金金额(已废弃:commission字段本身就是佣金金额,不需要计算) */ + /** 格式化佣金金额 */ formatCommissionAmount(commission, price) { - // 已废弃:commission 字段已经是佣金金额(如 86.67),不是百分比 - // 直接使用 formatPrice(scope.row.commission) 即可 if (!commission || !price) return '0.00' // commission可能是百分比字符串或数值 let commissionPercent = 0 diff --git a/src/views/system/jdorder/components/TencentDocPushMonitor.vue b/src/views/system/jdorder/components/TencentDocPushMonitor.vue index 66af16b..9d226ce 100644 --- a/src/views/system/jdorder/components/TencentDocPushMonitor.vue +++ b/src/views/system/jdorder/components/TencentDocPushMonitor.vue @@ -253,9 +253,16 @@ export default { console.log('isScheduled:', res.data.isScheduled) console.log('remainingSeconds:', res.data.remainingSeconds) console.log('scheduledTime:', res.data.scheduledTime) - this.pushStatus = res.data + + // 重要:使用解构赋值,确保 remainingSeconds 被正确赋值 + this.pushStatus = { + ...res.data, + remainingSeconds: parseInt(res.data.remainingSeconds) || 0 + } + this.updateCountdownDisplay() console.log('倒计时显示:', this.countdownDisplay) + console.log('pushStatus.remainingSeconds 已更新为:', this.pushStatus.remainingSeconds) } else { console.error('API返回错误:', res) } @@ -334,6 +341,10 @@ export default { startCountdown() { this.stopCountdown() + + // 立即更新一次显示 + this.updateCountdownDisplay() + this.countdownTimer = setInterval(() => { if (this.pushStatus.remainingSeconds > 0) { this.pushStatus.remainingSeconds-- @@ -382,7 +393,23 @@ export default { formatDateTime(dateTime) { if (!dateTime) return '-' - return this.$moment(dateTime).format('YYYY-MM-DD HH:mm:ss') + try { + // 处理多种时间格式 + const date = new Date(dateTime) + if (isNaN(date.getTime())) return dateTime + + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + const seconds = String(date.getSeconds()).padStart(2, '0') + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + } catch (e) { + console.error('格式化时间失败:', e, dateTime) + return dateTime + } }, formatDuration(ms) {