Commit 038209af by cen

feat: 完善异常订单处理功能

- 更新 env.js 中的默认环境索引
- 新增异常订单提醒弹窗组件 ErrorOrderPopup,集成到多个页面
- 在 CreateOrder 和其他相关组件中添加异常订单锁单检查逻辑
- 优化订单卡片组件 OrderCard,显示原错误订单信息
- 更新样式以提升用户体验
1 parent c84b5941

3 MB | W: | H:

3 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -3,7 +3,7 @@
<view v-if="show" class="error-order-popup-mask" @click="handleMaskClick">
<view
class="error-order-popup-content"
:style="contentStyle"
@click.stop
>
<!-- 顶部图片 -->
......
......@@ -124,6 +124,20 @@
<ErrorOrderPopup :show.sync="showErrorOrderPopup" title="" :width="848" :height="870"
:topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248"
style="overflow: hidden">
<view>
<view class="error-order-title">异常订单提醒</view>
<view class="error-order-content">存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!</view>
</view>
<template #footer>
<view class="flex justify-between error-order-footer">
<!-- <view class="footer-btn cancel" @click="showErrorOrderPopup=false">
取消
</view> -->
<view class="footer-btn sure flex-1" @click="showErrorOrderPopup=false">
好的
</view>
</view>
</template>
</ErrorOrderPopup>
</view>
</template>
......@@ -238,16 +252,16 @@ export default {
},
lockReason: 0,
errorMsg: '',
showErrorOrderPopup: false
showErrorOrderPopup: false,
abnormalOrderCount: 0,
}
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$logger.local.info('levelStudyPopup 移除监听')
uni.$off('levelStudyPopup')
// uni.$off('showStudyPopup')
},
mounted() {
async mounted() {
uni.$logger.local.info('levelStudyPopup 开始监听mounted')
uni.$on('levelStudyPopup', obj => {
uni.$logger.local.info('接收到学习弹窗事件', obj)
......@@ -256,6 +270,13 @@ export default {
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
// 检查是否锁单
const { abnormalOrderNum } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0) {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
return
}
},
provide() {
return {
......@@ -629,13 +650,6 @@ export default {
this.lockReason = res.lockReason
return
}
// 检查是否锁单
const abnormalOrderLock = await this.getAbnormalOrderLock()
if (abnormalOrderLock) {
this.showErrorOrderPopup = true
// this.lockReason = abnormalOrderLock.lockReason
return
}
}
if (await this.checkDailyReport(sceneType != 7)) return
}
......@@ -697,6 +711,15 @@ export default {
this.$refs.errorRef.open()
}
this.$refs.leftBox.handleActivityCenter()
},
handleErrorOrderPopupSure(){
let pageName = {
0: 'equity',
1: 'boutique',
}[this.sceneType]
uni.navigateTo({
url: `/pages/${pageName}/tool/index?componentName=OrderManagement`
})
}
}
}
......@@ -968,4 +991,48 @@ export default {
z-index: 999999;
position: fixed;
}
.error-order-title {
text-align: center;
color: #333333;
font-size: toRpx(40);
font-weight: 500;
}
.error-order-content {
text-align: center;
color: #666666;
font-size: toRpx(32);
font-weight: 400;
margin-top: toRpx(16);
}
.error-order-footer {
margin-top: toRpx(64);
margin-bottom: toRpx(48);
width: 100%;
.cancel{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: #f0f1f5;
width: toRpx(344);
text-align: center;
color: #1a1a1a;
font-size: toRpx(32);
font-weight: 400;
}
.sure{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
font-size: toRpx(32);
font-weight: 500;
width: 100%;
text-align: center;
margin-left: toRpx(32);
margin-right: toRpx(32);
}
}
</style>
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1
const index = 2
/**
*
0本地
......
......@@ -260,8 +260,7 @@ export default {
const data = await uni.$api.commonApi.getAbnormalOrderLock()
if (data)
console.log(data, '异常订单锁单信息')
const isLock = data.lockOrderFlag == "Y" ? true:false
return Promise.resolve(isLock)
return Promise.resolve(data)
},
}
}
......@@ -39,14 +39,14 @@
</view>
</view>
</view>
<view class="flex errorBox" v-if="orderCardDetail.status == 11">
<view class="flex errorBox" v-if="orderCardDetail.status == 11&&orderCardDetail.associatedOrderCode">
<view class="order-list align-center flex-1">
<text>原错误订单编号</text>
<text>{{ orderCardDetail.associatedOrderCode }}</text>
<text class="priceName">{{ orderCardDetail.associatedOrderCode }}</text>
</view>
<view class="order-list align-center flex-1">
<text>原错误订单总价</text>
<text>¥2560</text>
<text class="priceName">¥{{ orderCardDetail.associatedOrderCodeFinalPrice }}</text>
</view>
</view>
<!-- 支付方式 -->
......@@ -487,7 +487,12 @@ export default {
font-weight: 400;
margin-left: toRpx(16);
}
.priceName {
color: #5a5e66;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(30);
}
.info-box {
display: flex;
flex-wrap: wrap;
......
......@@ -80,6 +80,45 @@ export default {
}
},
methods: {
// 验证价格输入(修改套餐内单个商品单价)
validatePrice(event, goods, goodsIndex, packageIndex) {
let value = event.detail.value
// 如果为空则设置为0
if (!value || value.trim() === '') {
value = '0'
}
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
// 更新商品单价
this.$set(this.list[packageIndex].packageGoods.goodsList[goodsIndex], 'sellPrice', value)
// 价格变动时,清空该商品的折扣/抵扣配置,并按原价重算 finalPrice
this.resetStrategyWhenPriceChange(this.list[packageIndex].packageGoods.goodsList[goodsIndex], this.list[packageIndex])
// 重新计算套餐总价
this.$emit('changeTotalPrice')
},
// 初始化商品数量方法
initProductNumbers() {
if (this.list && this.list.length > 0) {
......@@ -184,6 +223,10 @@ export default {
}
// 更新值
this.$set(this.list[index].packageGoods.goodsList[ind], 'sellPrice', value)
// 价格变动时,清空该商品的折扣/买赠/抵扣配置,并按原价重算 finalPrice
this.resetStrategyWhenPriceChange(this.list[index].packageGoods.goodsList[ind], this.list[index])
this.$emit('changeTotalPrice')
},
// 删除商品
......@@ -339,6 +382,31 @@ export default {
}
this.$emit('changeTotalPrice')
},
// 商品价格变动时,清空当前套餐内单个商品的折扣/抵扣配置,并重算 finalPrice
resetStrategyWhenPriceChange(goods, item) {
if (!goods) return
const strategyConfig = goods.strategyConfig || {}
// 重置策略为无优惠,买赠强制为非赠品
this.$set(goods, 'strategyConfig', {
mode: 'none',
discountRatio: '',
discountAmount: '',
isGift: '0',
deductAmount: ''
})
this.$set(goods, 'discountType', null)
this.$set(goods, 'discountValue', null)
this.$set(goods, 'discountAmount', null)
// 按当前单价和套餐数量,重新计算无优惠时的 finalPrice
const unitPrice = parseFloat(goods.sellPrice || 0)
const number = parseInt(item?.packageGoods?.number || 1)
const totalFinalPrice = Math.round(unitPrice * number * 100) / 100
this.$set(goods, 'finalPricePerUnit', unitPrice)
this.$set(goods, 'finalPrice', totalFinalPrice)
},
// 重新计算套餐内所有商品的 finalPrice(当数量改变时调用)
recalculateFinalPriceForPackage(item) {
const number = parseInt(item.packageGoods.number || 1)
......
......@@ -290,8 +290,11 @@ export default {
value = item.goods.minSellPrice.toString()
}
// 更新值
// this.$set(item.goods, 'sellPrice', value)
this.$set(this.list[index].goods, 'sellPrice', value)
// 商品价格修改时,清空折扣 / 抵扣配置,避免旧的优惠继续生效
this.resetStrategyWhenPriceChange(this.list[index])
// 价格变化时,如果已选择订单类型,触发策略组件重新计算价格
this.$forceUpdate()
this.$emit('changeTotalPrice')
......@@ -327,6 +330,33 @@ export default {
this.recalculateFinalPrice(item)
this.$emit('changeTotalPrice')
},
// 商品价格变动时,清空当前商品的折扣/抵扣配置,并重算 finalPrice
resetStrategyWhenPriceChange(item) {
if (!item || !item.goods) return
const goods = item.goods
// 重置内部 strategyConfig
const strategyConfig = goods.strategyConfig || {}
this.$set(goods, 'strategyConfig', {
mode: 'none',
discountRatio: '',
discountAmount: '',
// 买赠:强制恢复为非赠品
isGift: '0',
deductAmount: ''
})
// 同时清空用于提交/回显的折扣字段
this.$set(goods, 'discountType', null)
this.$set(goods, 'discountValue', null)
this.$set(goods, 'discountAmount', null)
// 按当前单价和数量,重新计算无优惠时的 finalPrice
const unitPrice = parseFloat(goods.sellPrice || 0)
const number = parseInt(goods.number || 1)
const totalFinalPrice = Math.round(unitPrice * number * 100) / 100
this.$set(goods, 'finalPricePerUnit', unitPrice)
this.$set(goods, 'finalPrice', totalFinalPrice)
},
// 减少数量
decreaseNumber(item) {
// 如果商品数量不存在或小于等于1,设置为1
......
......@@ -202,6 +202,48 @@ export default {
}
this.$emit('changeTotalPrice')
},
// 验证价格输入
validatePrice(event, item, index) {
let value = event.detail.value
// 如果为空则设置为0
if (!value || value.trim() === '') {
value = '0'
}
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
// 更新价格到对应商品
if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
this.$set(this.list[index].multipleSpecificationsGoods.goods, 'sellPrice', value)
} else if (item.goods) {
this.$set(this.list[index].goods, 'sellPrice', value)
}
// 商品价格修改时,清空折扣 / 抵扣配置
this.resetStrategyWhenPriceChange(this.list[index])
this.$emit('changeTotalPrice')
},
// 验证数量输入
validateNumber(event, item) {
let value = event.detail.value
......@@ -285,6 +327,42 @@ export default {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
},
// 商品价格变动时,清空当前商品的折扣/抵扣配置,并重算 finalPrice
resetStrategyWhenPriceChange(item) {
if (!item) return
let goods = null
if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
goods = item.multipleSpecificationsGoods.goods
} else if (item.goods) {
goods = item.goods
}
if (!goods) return
const strategyConfig = goods.strategyConfig || {}
this.$set(goods, 'strategyConfig', {
mode: 'none',
discountRatio: '',
discountAmount: '',
// 买赠:强制恢复为非赠品
isGift: '0',
deductAmount: ''
})
this.$set(goods, 'discountType', null)
this.$set(goods, 'discountValue', null)
this.$set(goods, 'discountAmount', null)
// 按当前单价和数量,重新计算无优惠时的 finalPrice
const unitPrice = parseFloat(goods.sellPrice || 0)
let number = 1
if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.number) {
number = parseInt(item.multipleSpecificationsGoods.number || 1)
} else if (item.goods && item.goods.number) {
number = parseInt(item.goods.number || 1)
}
const totalFinalPrice = Math.round(unitPrice * number * 100) / 100
this.$set(goods, 'finalPricePerUnit', unitPrice)
this.$set(goods, 'finalPrice', totalFinalPrice)
},
// 根据订单类型获取策略类型
getStrategyType(item) {
const orderType = String(this.orderTypeCode || '')
......
......@@ -61,10 +61,34 @@
text="当前页面暂未保存,是否确认退出"
type="warning"
></NoticePopup>
<!-- 学习中心权限弹窗 -->
<!-- 学习中心权限弹窗 -->
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
<!-- 异常订单锁单弹窗,样式与车险工具页保持一致 -->
<ErrorOrderPopup
:show.sync="showErrorOrderPopup"
title=""
:width="848"
:height="870"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
style="overflow: hidden"
>
<view>
<view class="error-order-title">异常订单提醒</view>
<view class="error-order-content">存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!</view>
</view>
<template #footer>
<view class="flex justify-between error-order-footer">
<view class="footer-btn sure flex-1" @click="showErrorOrderPopup = false">
好的
</view>
</view>
</template>
</ErrorOrderPopup>
</view>
</template>
......@@ -84,6 +108,7 @@ import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import WageAppeal from '../../common/wageAppeal/index.vue'
import MonthCalendar from '../../common/components/MonthCalendar.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
export default {
mixins: [interceptionMixin],
......@@ -100,7 +125,8 @@ export default {
StudyPopup,
StudyCenterPermissionPopup,
WageAppeal,
MonthCalendar
MonthCalendar,
ErrorOrderPopup
},
data () {
return {
......@@ -112,7 +138,10 @@ export default {
selectedDays: [],
lockReason: '',
showStudyPermissionPopup: false,
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM')
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'),
// 异常订单锁单弹窗
showErrorOrderPopup: false,
abnormalOrderCount: 0
}
},
onLoad (options) {
......@@ -122,6 +151,21 @@ export default {
this.toolComponentName = 'DailyReport'
if (currentDate) this.setCurrentDate(currentDate)
})
// 监听异常订单锁单事件(来自 CreateOrder.vue)
uni.$on('showErrorOrderPopup', payload => {
try {
const abnormalOrderNum = payload && typeof payload === 'object' ? payload.abnormalOrderNum : payload
if (abnormalOrderNum > 0) {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
}
} catch (e) {
console.error('showErrorOrderPopup 事件处理异常:', e)
}
})
},
onUnload () {
uni.$off('showErrorOrderPopup')
},
methods: {
setCurrentDate (currentDate) {
......@@ -255,4 +299,48 @@ export default {
font-size: toRpx(34);
}
}
.error-order-title {
text-align: center;
color: #333333;
font-size: toRpx(40);
font-weight: 500;
}
.error-order-content {
text-align: center;
color: #666666;
font-size: toRpx(32);
font-weight: 400;
margin-top: toRpx(16);
}
.error-order-footer {
margin-top: toRpx(64);
margin-bottom: toRpx(48);
width: 100%;
.cancel{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: #f0f1f5;
width: toRpx(344);
text-align: center;
color: #1a1a1a;
font-size: toRpx(32);
font-weight: 400;
}
.sure{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
font-size: toRpx(32);
font-weight: 500;
width: 100%;
text-align: center;
margin-left: toRpx(32);
margin-right: toRpx(32);
}
}
</style>
......@@ -213,7 +213,7 @@ module.exports = {
5: { text: '已完成', color: '#2CCA74', background: '#EAF9F1' },
'-1': { text: '战败', color: '#F24724', background: '#FDECE9' },
9: { text: '已撤销', color: '#999999', background: 'rgba(153, 153, 153, 0.1)' },
11: { text: '已失效', color: '#F7A431', background: '#FFF5E6' },
11: { text: '错误订单', color: '#F7A431', background: '#FFF5E6' },
6: { text: '已退款', color: '#F7A431', background: '#FFF5E6' },
14: { text: '审批中', color: '#FF9D0A', background: '#FFF5E6' }
},
......
......@@ -18,14 +18,14 @@
{{ currentStatusConfig.text }}
</view>
</view>
<view class="flex errorBox">
<view class="flex errorBox" v-if="orderCardDetail.oldOrderCode">
<view class="order-list align-center flex-1">
<text>原错误订单编号</text>
<text>898495495393839459</text>
<text class="priceName">{{ orderCardDetail.oldOrderCode }}</text>
</view>
<view class="order-list align-center flex-1">
<text>原错误订单总价</text>
<text>¥2560</text>
<text class="priceName">¥{{orderCardDetail.oldOrderFinalPrice }}</text>
</view>
</view>
<view class="order-card-bottom-box">
......@@ -1045,7 +1045,12 @@ export default {
font-size: toRpx(24);
margin-bottom: toRpx(20);
}
.priceName {
color: #5a5e66;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(30);
}
.info-box {
display: flex;
flex-wrap: wrap;
......
......@@ -102,7 +102,7 @@ export default {
if (payId) {
const data = await uni.$api.equityApi.getOrderDetail({ orderCode: payId })
console.log(data, '----')
this.orderInfo.total_price = data.totalPrice
this.orderInfo.total_price = data.finalPrice
let { payOrder, status } = data
if (payOrder?.payStatus == 2 || status == 4) {
this.closePopup()
......
......@@ -157,6 +157,10 @@ export default {
}
// 更新值
this.$set(this.list[index].packageGoods.goodsList[ind], 'sellPrice', value)
// 价格变动时,清空该商品的折扣/买赠/抵扣配置,并按原价重算 finalPrice
this.resetStrategyWhenPriceChange(this.list[index].packageGoods.goodsList[ind], this.list[index])
this.$emit('changeTotalPrice')
},
// 删除商品
......@@ -173,6 +177,31 @@ export default {
})
item.packageGoods.upgradePrice = total
return total.toFixed(2)
},
// 商品价格变动时,清空当前套餐内单个商品的折扣/抵扣配置,并重算 finalPrice
resetStrategyWhenPriceChange(goods, item) {
if (!goods) return
const strategyConfig = goods.strategyConfig || {}
// 重置策略为无优惠,买赠强制为非赠品
this.$set(goods, 'strategyConfig', {
mode: 'none',
discountRatio: '',
discountAmount: '',
isGift: '0',
deductAmount: ''
})
this.$set(goods, 'discountType', null)
this.$set(goods, 'discountValue', null)
this.$set(goods, 'discountAmount', null)
// 按当前单价和套餐数量,重新计算无优惠时的 finalPrice
const unitPrice = parseFloat(goods.sellPrice || 0)
const number = parseInt(item?.packageGoods?.number || 1)
const totalFinalPrice = Math.round(unitPrice * number * 100) / 100
this.$set(goods, 'finalPricePerUnit', unitPrice)
this.$set(goods, 'finalPrice', totalFinalPrice)
}
}
}
......
......@@ -238,6 +238,52 @@ export default {
}
this.$emit('changeTotalPrice')
},
// 验证价格输入
validatePrice(event, item, index, cindex) {
let value = event.detail.value
// 如果为空则设置为0
if (!value || value.trim() === '') {
value = '0'
}
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0 || parseFloat(value) == 0) {
value = '0'
}
// 更新价格到对应商品
if (!item.multipleSpecificationsGoods) {
if (item.goodsFlag == 1) {
this.$set(this.list[index].goods, 'sellPrice', value)
} else {
this.$set(this.list[index].packageGoods.goodsList[cindex], 'sellPrice', value)
}
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
this.$set(this.list[index].multipleSpecificationsGoods.goods, 'sellPrice', value)
}
// 商品价格修改时,清空折扣 / 抵扣配置
this.resetStrategyWhenPriceChange(item, index, cindex)
this.$emit('changeTotalPrice')
},
// 验证数量输入
validateNumber(event, item) {
let value = event.detail.value
......@@ -313,6 +359,65 @@ export default {
this.list.splice(index, 1)
this.$emit('changeTotalPrice')
},
// 商品价格变动时,清空当前商品(含套餐内单个商品)的折扣 / 抵扣配置,并重算 finalPrice
resetStrategyWhenPriceChange(item, index, cindex) {
if (!item) return
let goods = null
// 1)套餐内单个商品(通过 goodsFlag === 3 + cindex 定位)
if (item.goodsFlag === 3 && item.packageGoods && item.packageGoods.goodsList && typeof cindex === 'number') {
goods = item.packageGoods.goodsList[cindex]
}
// 2)直接传进来的就是 goods 对象(无 goodsFlag)
else if (item && item.sellPrice !== undefined && item.goodsFlag === undefined) {
goods = item
}
// 3)多规格商品
else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
goods = item.multipleSpecificationsGoods.goods
}
// 4)普通商品
else if (item.goods) {
goods = item.goods
}
if (!goods) return
// 重置策略配置
this.$set(goods, 'strategyConfig', {
mode: 'none',
discountRatio: '',
discountAmount: '',
// 买赠:强制恢复为非赠品
isGift: '0',
deductAmount: ''
})
// 同步清空老字段,避免 OrderStrategy 里看到旧的折扣金额 / 比例
this.$set(goods, 'discountType', null)
this.$set(goods, 'discountValue', null)
this.$set(goods, 'discountAmount', null)
// 按当前单价和数量,重新计算无优惠时的 finalPrice
const unitPrice = parseFloat(goods.sellPrice || 0)
let number = 1
if (item.goodsFlag === 3 && item.packageGoods && item.packageGoods.number) {
// 套餐:用套餐数量
number = parseInt(item.packageGoods.number || 1)
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.number) {
// 多规格商品
number = parseInt(item.multipleSpecificationsGoods.number || 1)
} else if (item.goods && item.goods.number) {
// 普通商品
number = parseInt(item.goods.number || 1)
}
const totalFinalPrice = Math.round(unitPrice * number * 100) / 100
this.$set(goods, 'finalPricePerUnit', unitPrice)
this.$set(goods, 'finalPrice', totalFinalPrice)
},
replaceItemText(value) {
let reg = getRegExp(';~;', 'g')
return value ? value.replace(reg, '/') : ''
......@@ -501,59 +606,61 @@ export default {
return '¥' + basePrice.toFixed(2)
},
// 价格变化回调(finalPrice 是单件商品优惠后的价格,需要乘以数量得到总价,并转换为分)
// 价格变化回调(finalPricePerUnit 为单件优惠价,需要乘以数量得到总价,单位:元)
onPriceChange(item, finalPricePerUnit, packageItem) {
// 计算总价:单件优惠价 * 数量 * 100(转换为分)
// 如果是套餐内的商品,数量是套餐的数量;否则数量固定为 1
// 计算总价:单件优惠价 * 数量(单位:元)
let number = 1
// 套餐内商品:用套餐数量
if (packageItem && packageItem.packageGoods && packageItem.packageGoods.number) {
number = parseInt(packageItem.packageGoods.number || 1)
} else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.number) {
// 多规格商品
number = parseInt(item.multipleSpecificationsGoods.number || 1)
} else if (item.goods && item.goods.number) {
// 普通商品
number = parseInt(item.goods.number || 1)
}
const totalFinalPrice = Math.round(finalPricePerUnit * number * 100) / 100
const finalPriceInCents = Math.round(totalFinalPrice * 100) // 转换为分
const totalFinalPrice = Math.round(finalPricePerUnit * number * 100) / 100 // 元
// 如果是套餐内的商品(直接是商品对象,有 sellPrice 等属性)
if (item && item.sellPrice !== undefined && !item.goodsFlag) {
// 赠品传 0,无优惠传 null 或原价(单位分)
if (finalPriceInCents === 0) {
if (totalFinalPrice === 0) {
// 赠品
this.$set(item, 'finalPrice', 0)
} else {
const originalPriceInCents = Math.round(parseFloat(item.sellPrice || 0) * 100)
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null
if (finalPriceInCents < originalPriceInCents) {
this.$set(item, 'finalPrice', finalPriceInCents)
const originalTotal = Math.round(parseFloat(item.sellPrice || 0) * number * 100) / 100
// 有优惠且不等于原价,保存优惠后的总价;否则置为 null
if (totalFinalPrice < originalTotal) {
this.$set(item, 'finalPrice', totalFinalPrice)
} else {
this.$set(item, 'finalPrice', null)
}
}
this.$set(item, 'finalPricePerUnit', finalPricePerUnit)
}
// 如果是多规格商品
// 多规格商品
else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
// 赠品传 0,无优惠传 null 或原价(单位分)
if (finalPriceInCents === 0) {
if (totalFinalPrice === 0) {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', 0)
} else {
const originalPriceInCents = Math.round(parseFloat(item.multipleSpecificationsGoods.goods.sellPrice || 0) * 100)
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null
if (finalPriceInCents < originalPriceInCents) {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', finalPriceInCents)
const originalTotal = Math.round(parseFloat(item.multipleSpecificationsGoods.goods.sellPrice || 0) * number * 100) / 100
if (totalFinalPrice < originalTotal) {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', totalFinalPrice)
} else {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', null)
}
}
this.$set(item.multipleSpecificationsGoods.goods, 'finalPricePerUnit', finalPricePerUnit)
}
// 如果是普通商品
// 普通商品
else if (item.goods) {
// 赠品传 0,无优惠传 null 或原价(单位分)
if (finalPriceInCents === 0) {
if (totalFinalPrice === 0) {
this.$set(item.goods, 'finalPrice', 0)
} else {
const originalPriceInCents = Math.round(parseFloat(item.goods.sellPrice || 0) * 100)
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null
if (finalPriceInCents < originalPriceInCents) {
this.$set(item.goods, 'finalPrice', finalPriceInCents)
const originalTotal = Math.round(parseFloat(item.goods.sellPrice || 0) * number * 100) / 100
if (totalFinalPrice < originalTotal) {
this.$set(item.goods, 'finalPrice', totalFinalPrice)
} else {
this.$set(item.goods, 'finalPrice', null)
}
......
......@@ -32,6 +32,30 @@
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
<!-- 异常订单锁单弹窗(与 HomeFrame 逻辑保持一致) -->
<ErrorOrderPopup
:show.sync="showErrorOrderPopup"
title=""
:width="848"
:height="870"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
style="overflow: hidden"
>
<view>
<view class="error-order-title">异常订单提醒</view>
<view class="error-order-content">存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!</view>
</view>
<template #footer>
<view class="flex justify-between error-order-footer">
<view class="footer-btn sure flex-1" @click="showErrorOrderPopup = false">
好的
</view>
</view>
</template>
</ErrorOrderPopup>
</view>
</template>
......@@ -50,12 +74,12 @@ import UpdateOrderInfo from './components/UpdateOrderInfo.vue'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import EquityManagement from './components/EquityManagement.vue'
import CreateEquity from './components/CreateEquity.vue'
import SignName from './components/SignName.vue'
import PreviewList from './components/PreviewList.vue'
import WageAppeal from '../../common/wageAppeal/index.vue'
import MonthCalendar from '../../common/components/MonthCalendar.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
export default {
mixins: [interceptionMixin],
components: {
......@@ -75,7 +99,8 @@ export default {
SignName,
PreviewList,
WageAppeal,
MonthCalendar
MonthCalendar,
ErrorOrderPopup
},
data() {
return {
......@@ -87,7 +112,10 @@ export default {
selectedDays: [],
lockReason: '',
showStudyPermissionPopup: false,
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM')
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'),
// 异常订单锁单弹窗
showErrorOrderPopup: false,
abnormalOrderCount: 0
}
},
onLoad(options) {
......@@ -97,6 +125,21 @@ export default {
this.toolComponentName = 'DailyReport'
if (currentDate) this.setCurrentDate(currentDate)
})
// 监听异常订单锁单事件(来自 CreateOrder.vue)
uni.$on('showErrorOrderPopup', payload => {
try {
const abnormalOrderNum = payload && typeof payload === 'object' ? payload.abnormalOrderNum : payload
if (abnormalOrderNum > 0) {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
}
} catch (e) {
console.error('showErrorOrderPopup 事件处理异常:', e)
}
})
},
onUnload() {
uni.$off('showErrorOrderPopup')
},
methods: {
setCurrentDate(currentDate) {
......@@ -116,12 +159,12 @@ export default {
return
}
// 提示锁单
const abnormalOrderLock = await this.getAbnormalOrderLock()
if (abnormalOrderLock) {
this.showErrorOrderPopup = true
// this.lockReason = abnormalOrderLock.lockReason
return
}
// const { lockOrderFlag, abnormalOrderNum } = await this.getAbnormalOrderLock()
// if (lockOrderFlag == "Y" && abnormalOrderNum > 0) {
// this.showErrorOrderPopup = true
// this.abnormalOrderCount = abnormalOrderNum
// return
// }
// 保存当前选择的组件信息,但不立即切换
const selectedItem = item
if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return
......@@ -233,5 +276,50 @@ export default {
justify-content: space-between;
font-size: toRpx(34);
}
}
.error-order-title {
text-align: center;
color: #333333;
font-size: toRpx(40);
font-weight: 500;
}
.error-order-content {
text-align: center;
color: #666666;
font-size: toRpx(32);
font-weight: 400;
margin-top: toRpx(16);
}
.error-order-footer {
margin-top: toRpx(64);
margin-bottom: toRpx(48);
width: 100%;
.cancel{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: #f0f1f5;
width: toRpx(344);
text-align: center;
color: #1a1a1a;
font-size: toRpx(32);
font-weight: 400;
}
.sure{
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
font-size: toRpx(32);
font-weight: 500;
width: 100%;
text-align: center;
margin-left: toRpx(32);
margin-right: toRpx(32);
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!