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 @@ ...@@ -3,7 +3,7 @@
<view v-if="show" class="error-order-popup-mask" @click="handleMaskClick"> <view v-if="show" class="error-order-popup-mask" @click="handleMaskClick">
<view <view
class="error-order-popup-content" class="error-order-popup-content"
:style="contentStyle"
@click.stop @click.stop
> >
<!-- 顶部图片 --> <!-- 顶部图片 -->
......
...@@ -124,6 +124,20 @@ ...@@ -124,6 +124,20 @@
<ErrorOrderPopup :show.sync="showErrorOrderPopup" title="" :width="848" :height="870" <ErrorOrderPopup :show.sync="showErrorOrderPopup" title="" :width="848" :height="870"
:topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248"
style="overflow: hidden"> 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> </ErrorOrderPopup>
</view> </view>
</template> </template>
...@@ -238,16 +252,16 @@ export default { ...@@ -238,16 +252,16 @@ export default {
}, },
lockReason: 0, lockReason: 0,
errorMsg: '', errorMsg: '',
showErrorOrderPopup: false showErrorOrderPopup: false,
abnormalOrderCount: 0,
} }
}, },
beforeDestroy() { beforeDestroy() {
// 组件销毁前移除监听 // 组件销毁前移除监听
uni.$logger.local.info('levelStudyPopup 移除监听') uni.$logger.local.info('levelStudyPopup 移除监听')
uni.$off('levelStudyPopup') uni.$off('levelStudyPopup')
// uni.$off('showStudyPopup')
}, },
mounted() { async mounted() {
uni.$logger.local.info('levelStudyPopup 开始监听mounted') uni.$logger.local.info('levelStudyPopup 开始监听mounted')
uni.$on('levelStudyPopup', obj => { uni.$on('levelStudyPopup', obj => {
uni.$logger.local.info('接收到学习弹窗事件', obj) uni.$logger.local.info('接收到学习弹窗事件', obj)
...@@ -256,6 +270,13 @@ export default { ...@@ -256,6 +270,13 @@ export default {
const userInfo = uni.$storage.get('userInfo') || {} const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo this.userInfo = userInfo
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限 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() { provide() {
return { return {
...@@ -629,13 +650,6 @@ export default { ...@@ -629,13 +650,6 @@ export default {
this.lockReason = res.lockReason this.lockReason = res.lockReason
return return
} }
// 检查是否锁单
const abnormalOrderLock = await this.getAbnormalOrderLock()
if (abnormalOrderLock) {
this.showErrorOrderPopup = true
// this.lockReason = abnormalOrderLock.lockReason
return
}
} }
if (await this.checkDailyReport(sceneType != 7)) return if (await this.checkDailyReport(sceneType != 7)) return
} }
...@@ -697,6 +711,15 @@ export default { ...@@ -697,6 +711,15 @@ export default {
this.$refs.errorRef.open() this.$refs.errorRef.open()
} }
this.$refs.leftBox.handleActivityCenter() 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 { ...@@ -968,4 +991,48 @@ export default {
z-index: 999999; z-index: 999999;
position: fixed; 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> </style>
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
...@@ -260,8 +260,7 @@ export default { ...@@ -260,8 +260,7 @@ export default {
const data = await uni.$api.commonApi.getAbnormalOrderLock() const data = await uni.$api.commonApi.getAbnormalOrderLock()
if (data) if (data)
console.log(data, '异常订单锁单信息') console.log(data, '异常订单锁单信息')
const isLock = data.lockOrderFlag == "Y" ? true:false return Promise.resolve(data)
return Promise.resolve(isLock)
}, },
} }
} }
...@@ -39,14 +39,14 @@ ...@@ -39,14 +39,14 @@
</view> </view>
</view> </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"> <view class="order-list align-center flex-1">
<text>原错误订单编号</text> <text>原错误订单编号</text>
<text>{{ orderCardDetail.associatedOrderCode }}</text> <text class="priceName">{{ orderCardDetail.associatedOrderCode }}</text>
</view> </view>
<view class="order-list align-center flex-1"> <view class="order-list align-center flex-1">
<text>原错误订单总价</text> <text>原错误订单总价</text>
<text>¥2560</text> <text class="priceName">¥{{ orderCardDetail.associatedOrderCodeFinalPrice }}</text>
</view> </view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
...@@ -487,7 +487,12 @@ export default { ...@@ -487,7 +487,12 @@ export default {
font-weight: 400; font-weight: 400;
margin-left: toRpx(16); margin-left: toRpx(16);
} }
.priceName {
color: #5a5e66;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(30);
}
.info-box { .info-box {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
......
...@@ -4,27 +4,41 @@ ...@@ -4,27 +4,41 @@
<view class="box"> <view class="box">
<scroll-view class="scroll-view" scroll-y="true"> <scroll-view class="scroll-view" scroll-y="true">
<view class="box-content"> <view class="box-content">
<GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" @handleCell="handleCell"> <GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur"
@handleCell="handleCell">
<template slot="frontGear"> <template slot="frontGear">
<Product v-if="orderObj.frontGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontGear" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></Product> <Product v-if="orderObj.frontGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontGear"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></Product>
</template> </template>
<template slot="frontWindow"> <template slot="frontWindow">
<Product v-if="orderObj.frontWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontWindow" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></Product> <Product v-if="orderObj.frontWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontWindow"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></Product>
</template> </template>
<template slot="rearWindow"> <template slot="rearWindow">
<Product v-if="orderObj.rearWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearWindow" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></Product> <Product v-if="orderObj.rearWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearWindow"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></Product>
</template> </template>
<template slot="rearGear"> <template slot="rearGear">
<Product v-if="orderObj.rearGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearGear" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></Product> <Product v-if="orderObj.rearGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearGear"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></Product>
</template> </template>
<template slot="sunRoof"> <template slot="sunRoof">
<Product v-if="orderObj.sunRoof" @changeTotalPrice="changeTotalPrice" :list="orderObj.sunRoof" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></Product> <Product v-if="orderObj.sunRoof" @changeTotalPrice="changeTotalPrice" :list="orderObj.sunRoof"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></Product>
</template> </template>
<template slot="package"> <template slot="package">
<Package v-if="orderObj.package" @changeTotalPrice="changeTotalPrice" :list="orderObj.package" :positionTypeList="positionTypeList" :orderTypeCode="orderObj.orderTypeCode"></Package> <Package v-if="orderObj.package" @changeTotalPrice="changeTotalPrice" :list="orderObj.package"
:positionTypeList="positionTypeList" :orderTypeCode="orderObj.orderTypeCode"></Package>
</template> </template>
<template slot="skuGoods"> <template slot="skuGoods">
<SkuGoods v-if="orderObj.skuGoods" :list="orderObj.skuGoods" @changeTotalPrice="changeTotalPrice" :positionTypeList="positionTypeList" :baseConfigData="baseConfigData" :orderTypeCode="orderObj.orderTypeCode"></SkuGoods> <SkuGoods v-if="orderObj.skuGoods" :list="orderObj.skuGoods" @changeTotalPrice="changeTotalPrice"
:positionTypeList="positionTypeList" :baseConfigData="baseConfigData"
:orderTypeCode="orderObj.orderTypeCode"></SkuGoods>
<view class="total" v-if="totalPrice > 0"> <view class="total" v-if="totalPrice > 0">
<view class="total-left">总价</view> <view class="total-left">总价</view>
<view class="total-right">¥{{ totalPrice }}</view> <view class="total-right">¥{{ totalPrice }}</view>
...@@ -39,7 +53,8 @@ ...@@ -39,7 +53,8 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 弹窗 --> <!-- 弹窗 -->
<order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" /> <order-popup ref="orderPopup" :data="orderObj" :dataKey="valueKey" @onConfirm="onConfirm"
:externalData="externalData" :popupType="popupType" />
</view> </view>
</template> </template>
...@@ -493,7 +508,7 @@ export default { ...@@ -493,7 +508,7 @@ export default {
} }
this.getShopMerchantPointConfig(this.orderObj.merchantId) this.getShopMerchantPointConfig(this.orderObj.merchantId)
this.getSubShopMerchantList(this.orderObj.merchantId)
this.getSetting() this.getSetting()
// 补录订单默认为嘀加收款,不需要获取园区店支付方式 // 补录订单默认为嘀加收款,不需要获取园区店支付方式
if (this.orderCreateType == 'supplementOrder') { if (this.orderCreateType == 'supplementOrder') {
...@@ -522,8 +537,11 @@ export default { ...@@ -522,8 +537,11 @@ export default {
} }
cell.radioList[1].disabled = false cell.radioList[1].disabled = false
} }
// 兼容:如果方法不存在则不调用,避免运行时报错
if (typeof this.getConfig === 'function') {
this.getConfig() this.getConfig()
} }
}
// this.getEmployeeList() // this.getEmployeeList()
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
this.getPositionList() this.getPositionList()
...@@ -898,7 +916,17 @@ export default { ...@@ -898,7 +916,17 @@ export default {
return return
} }
if (!(await this.checkDailyReport()) &&!(await this.getAbnormalOrderLock())) { // 日报 / 异常订单锁单校验
const hasInterception = await this.checkDailyReport()
if(hasInterception) {
return
}
const { abnormalOrderNum, lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0 && lockOrderFlag === 'Y') {
uni.$emit('showErrorOrderPopup', { abnormalOrderNum })
return
}
const { orderCreateType } = this const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj) const obj = utils.deepClone(this.orderObj)
const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType'] const otherCustomer = ['standNo', 'plateNumber', 'customerSex', 'experienceFlag', 'salesType']
...@@ -1014,7 +1042,6 @@ export default { ...@@ -1014,7 +1042,6 @@ export default {
} }
this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res) this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res)
} }
}
}, },
// 计算所有产品的总价 // 计算所有产品的总价
changeTotalPrice() { changeTotalPrice() {
...@@ -1125,7 +1152,7 @@ export default { ...@@ -1125,7 +1152,7 @@ export default {
notUpgradeExperience: 'foEfRequiredFlag', notUpgradeExperience: 'foEfRequiredFlag',
notUpgradeRejectionReason: 'foRrRequiredFlag' notUpgradeRejectionReason: 'foRrRequiredFlag'
} }
;(data.orderFieldSettingList || []).forEach(e => { ; (data.orderFieldSettingList || []).forEach(e => {
const key = keyMap[e.fieldKey] || e.fieldKey const key = keyMap[e.fieldKey] || e.fieldKey
YQorderSetting[key] = e.isRequired ? 'Y' : 'N' YQorderSetting[key] = e.isRequired ? 'Y' : 'N'
}) })
......
...@@ -80,6 +80,45 @@ export default { ...@@ -80,6 +80,45 @@ export default {
} }
}, },
methods: { 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() { initProductNumbers() {
if (this.list && this.list.length > 0) { if (this.list && this.list.length > 0) {
...@@ -184,6 +223,10 @@ export default { ...@@ -184,6 +223,10 @@ export default {
} }
// 更新值 // 更新值
this.$set(this.list[index].packageGoods.goodsList[ind], 'sellPrice', value) 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') this.$emit('changeTotalPrice')
}, },
// 删除商品 // 删除商品
...@@ -339,6 +382,31 @@ export default { ...@@ -339,6 +382,31 @@ export default {
} }
this.$emit('changeTotalPrice') 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(当数量改变时调用) // 重新计算套餐内所有商品的 finalPrice(当数量改变时调用)
recalculateFinalPriceForPackage(item) { recalculateFinalPriceForPackage(item) {
const number = parseInt(item.packageGoods.number || 1) const number = parseInt(item.packageGoods.number || 1)
......
...@@ -290,8 +290,11 @@ export default { ...@@ -290,8 +290,11 @@ export default {
value = item.goods.minSellPrice.toString() value = item.goods.minSellPrice.toString()
} }
// 更新值 // 更新值
// this.$set(item.goods, 'sellPrice', value)
this.$set(this.list[index].goods, 'sellPrice', value) this.$set(this.list[index].goods, 'sellPrice', value)
// 商品价格修改时,清空折扣 / 抵扣配置,避免旧的优惠继续生效
this.resetStrategyWhenPriceChange(this.list[index])
// 价格变化时,如果已选择订单类型,触发策略组件重新计算价格 // 价格变化时,如果已选择订单类型,触发策略组件重新计算价格
this.$forceUpdate() this.$forceUpdate()
this.$emit('changeTotalPrice') this.$emit('changeTotalPrice')
...@@ -327,6 +330,33 @@ export default { ...@@ -327,6 +330,33 @@ export default {
this.recalculateFinalPrice(item) this.recalculateFinalPrice(item)
this.$emit('changeTotalPrice') 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) { decreaseNumber(item) {
// 如果商品数量不存在或小于等于1,设置为1 // 如果商品数量不存在或小于等于1,设置为1
......
...@@ -202,6 +202,48 @@ export default { ...@@ -202,6 +202,48 @@ export default {
} }
this.$emit('changeTotalPrice') 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) { validateNumber(event, item) {
let value = event.detail.value let value = event.detail.value
...@@ -285,6 +327,42 @@ export default { ...@@ -285,6 +327,42 @@ export default {
this.list.splice(index, 1) this.list.splice(index, 1)
this.$emit('changeTotalPrice') 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) { getStrategyType(item) {
const orderType = String(this.orderTypeCode || '') const orderType = String(this.orderTypeCode || '')
......
...@@ -65,6 +65,30 @@ ...@@ -65,6 +65,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"> <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" /> <StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup> </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> </view>
</template> </template>
...@@ -84,6 +108,7 @@ import StudyPopup from '@/components/StudyPopup.vue' ...@@ -84,6 +108,7 @@ import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue' import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import WageAppeal from '../../common/wageAppeal/index.vue' import WageAppeal from '../../common/wageAppeal/index.vue'
import MonthCalendar from '../../common/components/MonthCalendar.vue' import MonthCalendar from '../../common/components/MonthCalendar.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -100,7 +125,8 @@ export default { ...@@ -100,7 +125,8 @@ export default {
StudyPopup, StudyPopup,
StudyCenterPermissionPopup, StudyCenterPermissionPopup,
WageAppeal, WageAppeal,
MonthCalendar MonthCalendar,
ErrorOrderPopup
}, },
data () { data () {
return { return {
...@@ -112,7 +138,10 @@ export default { ...@@ -112,7 +138,10 @@ export default {
selectedDays: [], selectedDays: [],
lockReason: '', lockReason: '',
showStudyPermissionPopup: false, showStudyPermissionPopup: false,
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM') lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'),
// 异常订单锁单弹窗
showErrorOrderPopup: false,
abnormalOrderCount: 0
} }
}, },
onLoad (options) { onLoad (options) {
...@@ -122,6 +151,21 @@ export default { ...@@ -122,6 +151,21 @@ export default {
this.toolComponentName = 'DailyReport' this.toolComponentName = 'DailyReport'
if (currentDate) this.setCurrentDate(currentDate) 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: { methods: {
setCurrentDate (currentDate) { setCurrentDate (currentDate) {
...@@ -255,4 +299,48 @@ export default { ...@@ -255,4 +299,48 @@ export default {
font-size: toRpx(34); 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> </style>
...@@ -213,7 +213,7 @@ module.exports = { ...@@ -213,7 +213,7 @@ module.exports = {
5: { text: '已完成', color: '#2CCA74', background: '#EAF9F1' }, 5: { text: '已完成', color: '#2CCA74', background: '#EAF9F1' },
'-1': { text: '战败', color: '#F24724', background: '#FDECE9' }, '-1': { text: '战败', color: '#F24724', background: '#FDECE9' },
9: { text: '已撤销', color: '#999999', background: 'rgba(153, 153, 153, 0.1)' }, 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' }, 6: { text: '已退款', color: '#F7A431', background: '#FFF5E6' },
14: { text: '审批中', color: '#FF9D0A', background: '#FFF5E6' } 14: { text: '审批中', color: '#FF9D0A', background: '#FFF5E6' }
}, },
......
...@@ -417,7 +417,9 @@ export default { ...@@ -417,7 +417,9 @@ export default {
const { paramsData } = this const { paramsData } = this
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
if (!paramsData.id) this.getConfig() if (!paramsData.id) this.getConfig()
this.getShopMerchantPointConfig() this.getShopMerchantPointConfig()
this.orderSettingList() this.orderSettingList()
}, },
async orderSettingList() { async orderSettingList() {
...@@ -793,6 +795,14 @@ export default { ...@@ -793,6 +795,14 @@ export default {
}, },
async submit() { async submit() {
if (!this.checkRequired() || (await this.checkDailyReport())) return if (!this.checkRequired() || (await this.checkDailyReport())) return
// 检查是否锁单:如果有异常订单锁单,触发 HomeFrame 的错误订单弹窗
const { abnormalOrderNum,lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0&&lockOrderFlag == 'Y') {
uni.$emit('showErrorOrderPopup', { abnormalOrderNum })
return
}
if (!this.checkOrderStrategyAndTotal()) return if (!this.checkOrderStrategyAndTotal()) return
this.handleSecondConfirmCheck(true) this.handleSecondConfirmCheck(true)
}, },
...@@ -972,10 +982,10 @@ export default { ...@@ -972,10 +982,10 @@ export default {
item = item.goods item = item.goods
const sellPrice = parseFloat(item.sellPrice || 0) const sellPrice = parseFloat(item.sellPrice || 0)
const number = parseInt(item.number || 1) const number = parseInt(item.number || 1)
// finalPrice 存在时为“分”,但可能为 null(表示无优惠) // finalPrice 存在时为“元”,表示该 SKU 按当前策略计算后的总价
// 仅当 finalPrice 不为 null 且是有效数字时才使用它,否则重新根据策略计算 // 仅当 finalPrice 不为 null 且是有效数字时才使用它,否则重新根据策略计算
const hasValidFinalPrice = item.finalPrice !== undefined && item.finalPrice !== null && !isNaN(parseFloat(item.finalPrice)) const hasValidFinalPrice = item.finalPrice !== undefined && item.finalPrice !== null && !isNaN(parseFloat(item.finalPrice))
const finalPrice = hasValidFinalPrice ? parseFloat(item.finalPrice) / 100 : this.calculateFinalPrice(item, sellPrice, number, orderInfo.orderTypeCode) const finalPrice = hasValidFinalPrice ? parseFloat(item.finalPrice) : this.calculateFinalPrice(item, sellPrice, number, orderInfo.orderTypeCode)
const discountFields = this.calculateDiscountFields(item, sellPrice, number, orderInfo.orderTypeCode) const discountFields = this.calculateDiscountFields(item, sellPrice, number, orderInfo.orderTypeCode)
const obj = { const obj = {
goodsId: item.merchantGoodsId, goodsId: item.merchantGoodsId,
...@@ -984,6 +994,7 @@ export default { ...@@ -984,6 +994,7 @@ export default {
specificationsName: item.specificationNameSequence, specificationsName: item.specificationNameSequence,
specificationsValue: item.specificationData ? item.specificationData.replace(/;~;/g, '/') : '', specificationsValue: item.specificationData ? item.specificationData.replace(/;~;/g, '/') : '',
goodsPrice: this.multipliedByHundred(item.sellPrice), goodsPrice: this.multipliedByHundred(item.sellPrice),
// 后端使用“分”单位,这里将元转为分
finalPrice: this.multipliedByHundred(finalPrice), finalPrice: this.multipliedByHundred(finalPrice),
discountType: discountFields.discountType, discountType: discountFields.discountType,
discountValue: discountFields.discountValue discountValue: discountFields.discountValue
...@@ -997,7 +1008,7 @@ export default { ...@@ -997,7 +1008,7 @@ export default {
const sellPrice = parseFloat(ele.sellPrice || 0) const sellPrice = parseFloat(ele.sellPrice || 0)
const number = parseInt(item.number || 1) const number = parseInt(item.number || 1)
const hasValidFinalPrice = ele.finalPrice !== undefined && ele.finalPrice !== null && !isNaN(parseFloat(ele.finalPrice)) const hasValidFinalPrice = ele.finalPrice !== undefined && ele.finalPrice !== null && !isNaN(parseFloat(ele.finalPrice))
const finalPrice = hasValidFinalPrice ? parseFloat(ele.finalPrice) / 100 : this.calculateFinalPrice(ele, sellPrice, number, orderInfo.orderTypeCode) const finalPrice = hasValidFinalPrice ? parseFloat(ele.finalPrice) : this.calculateFinalPrice(ele, sellPrice, number, orderInfo.orderTypeCode)
const discountFields = this.calculateDiscountFields(ele, sellPrice, number, orderInfo.orderTypeCode) const discountFields = this.calculateDiscountFields(ele, sellPrice, number, orderInfo.orderTypeCode)
let obj = { let obj = {
packageId: item.packageCode, packageId: item.packageCode,
...@@ -1023,7 +1034,7 @@ export default { ...@@ -1023,7 +1034,7 @@ export default {
const sellPrice = parseFloat(goods.sellPrice || 0) const sellPrice = parseFloat(goods.sellPrice || 0)
const number = parseInt(multipleSpecGoods.number || 1) const number = parseInt(multipleSpecGoods.number || 1)
const hasValidFinalPrice = goods.finalPrice !== undefined && goods.finalPrice !== null && !isNaN(parseFloat(goods.finalPrice)) const hasValidFinalPrice = goods.finalPrice !== undefined && goods.finalPrice !== null && !isNaN(parseFloat(goods.finalPrice))
const finalPrice = hasValidFinalPrice ? parseFloat(goods.finalPrice) / 100 : this.calculateFinalPrice(goods, sellPrice, number, orderInfo.orderTypeCode) const finalPrice = hasValidFinalPrice ? parseFloat(goods.finalPrice) : this.calculateFinalPrice(goods, sellPrice, number, orderInfo.orderTypeCode)
const discountFields = this.calculateDiscountFields(goods, sellPrice, number, orderInfo.orderTypeCode) const discountFields = this.calculateDiscountFields(goods, sellPrice, number, orderInfo.orderTypeCode)
const obj = { const obj = {
goodsId: goods.merchantGoodsId, goodsId: goods.merchantGoodsId,
...@@ -1074,7 +1085,7 @@ export default { ...@@ -1074,7 +1085,7 @@ export default {
changeTotalPrice() { changeTotalPrice() {
let total = 0 let total = 0
const orderType = String(this.orderObj.orderTypeCode || '') const orderType = String(this.orderObj.orderTypeCode || '')
// 判断是否使用优惠后的价格:'2' 打折策略、'3' 买赠策略、'5' 组合付款使用优惠后的价格 // 打折(2)/ 买赠(3)/ 组合付款(5)使用优惠后的价格,否则使用原价
const useFinalPrice = orderType === '2' || orderType === '3' || orderType === '5' const useFinalPrice = orderType === '2' || orderType === '3' || orderType === '5'
// 遍历所有商品 // 遍历所有商品
...@@ -1086,26 +1097,26 @@ export default { ...@@ -1086,26 +1097,26 @@ export default {
productList.forEach(item => { productList.forEach(item => {
// 单个商品(goodsFlag == 1) // 单个商品(goodsFlag == 1)
if (item.goods && item.goods.sellPrice && item.goods.number) { if (item.goods && item.goods.sellPrice && item.goods.number) {
console.log(item.goods, '---单商品') const goods = item.goods
if (useFinalPrice && item.goods.finalPrice !== undefined && item.goods.finalPrice !== null) { console.log(goods, '---单商品')
// 使用优惠后的价格(单位是分,需要转换为元) if (useFinalPrice && goods.finalPrice !== undefined && goods.finalPrice !== null) {
total = NP.plus(total, item.goods.finalPrice / 100) // 使用优惠后的总价(单位:元)
total = NP.plus(total, parseFloat(goods.finalPrice || 0))
} else { } else {
// 使用原始价格 // 使用原始价格(单价 * 数量,单位:元)
total = NP.plus(total, NP.times(item.goods.sellPrice, item.goods.number)) total = NP.plus(total, NP.times(goods.sellPrice, goods.number))
} }
} }
// 套餐商品(goodsFlag == 3) // 奷餐商品(goodsFlag == 3)
else if (item.packageGoods && item.packageGoods.goodsList) { else if (item.packageGoods && item.packageGoods.goodsList) {
console.log(item.packageGoods, '套餐') console.log(item.packageGoods, '套餐')
const packageNumber = parseInt(item.packageGoods.number || 1) const packageNumber = parseInt(item.packageGoods.number || 1)
item.packageGoods.goodsList.forEach(goods => { item.packageGoods.goodsList.forEach(goods => {
if (useFinalPrice && goods.finalPrice !== undefined && goods.finalPrice !== null) { if (useFinalPrice && goods.finalPrice !== undefined && goods.finalPrice !== null) {
// 使用优惠后的价格(单位是分,需要转换为元) // 使用优惠后的总价(finalPrice 已经是按数量计算后的总价,单位:元)
// finalPrice 已经是单价优惠后 × 套餐数量,所以直接使用 total = NP.plus(total, parseFloat(goods.finalPrice || 0))
total = NP.plus(total, goods.finalPrice / 100)
} else { } else {
// 使用原始价格 // 使用原始价格(单价 * 套餐数量)
total = NP.plus(total, NP.times(goods.sellPrice, packageNumber)) total = NP.plus(total, NP.times(goods.sellPrice, packageNumber))
} }
}) })
...@@ -1114,20 +1125,21 @@ export default { ...@@ -1114,20 +1125,21 @@ export default {
else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods && item.multipleSpecificationsGoods.goods.sellPrice) { else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods && item.multipleSpecificationsGoods.goods.sellPrice) {
console.log(item.multipleSpecificationsGoods, '多规格') console.log(item.multipleSpecificationsGoods, '多规格')
const goods = item.multipleSpecificationsGoods.goods const goods = item.multipleSpecificationsGoods.goods
const number = parseInt(item.multipleSpecificationsGoods.number || 1)
if (useFinalPrice && goods.finalPrice !== undefined && goods.finalPrice !== null) { if (useFinalPrice && goods.finalPrice !== undefined && goods.finalPrice !== null) {
// 使用优惠后的价格(单位是分,需要转换为元) // 使用优惠后的总价(单位:元)
total = NP.plus(total, goods.finalPrice / 100) total = NP.plus(total, parseFloat(goods.finalPrice || 0))
} else { } else {
// 使用原始价格 // 使用原始价格(单价 * 数量)
total = NP.plus(total, NP.times(goods.sellPrice, item.multipleSpecificationsGoods.number || 1)) total = NP.plus(total, NP.times(goods.sellPrice, number))
} }
} }
}) })
} }
}) })
console.log(total, 'total') console.log(total, 'total')
// 更新总价 // 更新总价(单位:元,保留两位小数)
this.orderObj.total = total.toFixed(2) this.orderObj.total = (Math.round(total * 100) / 100).toFixed(2)
}, },
// 获取园区店支付方式 // 获取园区店支付方式
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
{{ currentStatusConfig.text }} {{ currentStatusConfig.text }}
</view> </view>
</view> </view>
<view class="flex errorBox"> <view class="flex errorBox" v-if="orderCardDetail.oldOrderCode">
<view class="order-list align-center flex-1"> <view class="order-list align-center flex-1">
<text>原错误订单编号</text> <text>原错误订单编号</text>
<text>898495495393839459</text> <text class="priceName">{{ orderCardDetail.oldOrderCode }}</text>
</view> </view>
<view class="order-list align-center flex-1"> <view class="order-list align-center flex-1">
<text>原错误订单总价</text> <text>原错误订单总价</text>
<text>¥2560</text> <text class="priceName">¥{{orderCardDetail.oldOrderFinalPrice }}</text>
</view> </view>
</view> </view>
<view class="order-card-bottom-box"> <view class="order-card-bottom-box">
...@@ -1045,7 +1045,12 @@ export default { ...@@ -1045,7 +1045,12 @@ export default {
font-size: toRpx(24); font-size: toRpx(24);
margin-bottom: toRpx(20); margin-bottom: toRpx(20);
} }
.priceName {
color: #5a5e66;
font-size: toRpx(24);
font-weight: 400;
margin-left: toRpx(30);
}
.info-box { .info-box {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
if (payId) { if (payId) {
const data = await uni.$api.equityApi.getOrderDetail({ orderCode: payId }) const data = await uni.$api.equityApi.getOrderDetail({ orderCode: payId })
console.log(data, '----') console.log(data, '----')
this.orderInfo.total_price = data.totalPrice this.orderInfo.total_price = data.finalPrice
let { payOrder, status } = data let { payOrder, status } = data
if (payOrder?.payStatus == 2 || status == 4) { if (payOrder?.payStatus == 2 || status == 4) {
this.closePopup() this.closePopup()
......
...@@ -157,6 +157,10 @@ export default { ...@@ -157,6 +157,10 @@ export default {
} }
// 更新值 // 更新值
this.$set(this.list[index].packageGoods.goodsList[ind], 'sellPrice', value) 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') this.$emit('changeTotalPrice')
}, },
// 删除商品 // 删除商品
...@@ -173,6 +177,31 @@ export default { ...@@ -173,6 +177,31 @@ export default {
}) })
item.packageGoods.upgradePrice = total item.packageGoods.upgradePrice = total
return total.toFixed(2) 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 { ...@@ -238,6 +238,52 @@ export default {
} }
this.$emit('changeTotalPrice') 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) { validateNumber(event, item) {
let value = event.detail.value let value = event.detail.value
...@@ -313,6 +359,65 @@ export default { ...@@ -313,6 +359,65 @@ export default {
this.list.splice(index, 1) this.list.splice(index, 1)
this.$emit('changeTotalPrice') 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) { replaceItemText(value) {
let reg = getRegExp(';~;', 'g') let reg = getRegExp(';~;', 'g')
return value ? value.replace(reg, '/') : '' return value ? value.replace(reg, '/') : ''
...@@ -501,59 +606,61 @@ export default { ...@@ -501,59 +606,61 @@ export default {
return '¥' + basePrice.toFixed(2) return '¥' + basePrice.toFixed(2)
}, },
// 价格变化回调(finalPrice 是单件商品优惠后的价格,需要乘以数量得到总价,并转换为分) // 价格变化回调(finalPricePerUnit 为单件优惠价,需要乘以数量得到总价,单位:元)
onPriceChange(item, finalPricePerUnit, packageItem) { onPriceChange(item, finalPricePerUnit, packageItem) {
// 计算总价:单件优惠价 * 数量 * 100(转换为分) // 计算总价:单件优惠价 * 数量(单位:元)
// 如果是套餐内的商品,数量是套餐的数量;否则数量固定为 1
let number = 1 let number = 1
// 套餐内商品:用套餐数量
if (packageItem && packageItem.packageGoods && packageItem.packageGoods.number) { if (packageItem && packageItem.packageGoods && packageItem.packageGoods.number) {
number = parseInt(packageItem.packageGoods.number || 1) 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 等属性) // 如果是套餐内的商品(直接是商品对象,有 sellPrice 等属性)
if (item && item.sellPrice !== undefined && !item.goodsFlag) { if (item && item.sellPrice !== undefined && !item.goodsFlag) {
// 赠品传 0,无优惠传 null 或原价(单位分) if (totalFinalPrice === 0) {
if (finalPriceInCents === 0) { // 赠品
this.$set(item, 'finalPrice', 0) this.$set(item, 'finalPrice', 0)
} else { } else {
const originalPriceInCents = Math.round(parseFloat(item.sellPrice || 0) * 100) const originalTotal = Math.round(parseFloat(item.sellPrice || 0) * number * 100) / 100
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null // 有优惠且不等于原价,保存优惠后的总价;否则置为 null
if (finalPriceInCents < originalPriceInCents) { if (totalFinalPrice < originalTotal) {
this.$set(item, 'finalPrice', finalPriceInCents) this.$set(item, 'finalPrice', totalFinalPrice)
} else { } else {
this.$set(item, 'finalPrice', null) this.$set(item, 'finalPrice', null)
} }
} }
this.$set(item, 'finalPricePerUnit', finalPricePerUnit) this.$set(item, 'finalPricePerUnit', finalPricePerUnit)
} }
// 如果是多规格商品 // 多规格商品
else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) { else if (item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) {
// 赠品传 0,无优惠传 null 或原价(单位分) if (totalFinalPrice === 0) {
if (finalPriceInCents === 0) {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', 0) this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', 0)
} else { } else {
const originalPriceInCents = Math.round(parseFloat(item.multipleSpecificationsGoods.goods.sellPrice || 0) * 100) const originalTotal = Math.round(parseFloat(item.multipleSpecificationsGoods.goods.sellPrice || 0) * number * 100) / 100
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null if (totalFinalPrice < originalTotal) {
if (finalPriceInCents < originalPriceInCents) { this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', totalFinalPrice)
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', finalPriceInCents)
} else { } else {
this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', null) this.$set(item.multipleSpecificationsGoods.goods, 'finalPrice', null)
} }
} }
this.$set(item.multipleSpecificationsGoods.goods, 'finalPricePerUnit', finalPricePerUnit) this.$set(item.multipleSpecificationsGoods.goods, 'finalPricePerUnit', finalPricePerUnit)
} }
// 如果是普通商品 // 普通商品
else if (item.goods) { else if (item.goods) {
// 赠品传 0,无优惠传 null 或原价(单位分) if (totalFinalPrice === 0) {
if (finalPriceInCents === 0) {
this.$set(item.goods, 'finalPrice', 0) this.$set(item.goods, 'finalPrice', 0)
} else { } else {
const originalPriceInCents = Math.round(parseFloat(item.goods.sellPrice || 0) * 100) const originalTotal = Math.round(parseFloat(item.goods.sellPrice || 0) * number * 100) / 100
// 如果有优惠且不等于原价,传优惠后的价格;否则传 null if (totalFinalPrice < originalTotal) {
if (finalPriceInCents < originalPriceInCents) { this.$set(item.goods, 'finalPrice', totalFinalPrice)
this.$set(item.goods, 'finalPrice', finalPriceInCents)
} else { } else {
this.$set(item.goods, 'finalPrice', null) this.$set(item.goods, 'finalPrice', null)
} }
......
...@@ -32,6 +32,30 @@ ...@@ -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"> <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" /> <StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup> </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> </view>
</template> </template>
...@@ -50,12 +74,12 @@ import UpdateOrderInfo from './components/UpdateOrderInfo.vue' ...@@ -50,12 +74,12 @@ import UpdateOrderInfo from './components/UpdateOrderInfo.vue'
import StudyPopup from '@/components/StudyPopup.vue' import StudyPopup from '@/components/StudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue' import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import EquityManagement from './components/EquityManagement.vue' import EquityManagement from './components/EquityManagement.vue'
import CreateEquity from './components/CreateEquity.vue' import CreateEquity from './components/CreateEquity.vue'
import SignName from './components/SignName.vue' import SignName from './components/SignName.vue'
import PreviewList from './components/PreviewList.vue' import PreviewList from './components/PreviewList.vue'
import WageAppeal from '../../common/wageAppeal/index.vue' import WageAppeal from '../../common/wageAppeal/index.vue'
import MonthCalendar from '../../common/components/MonthCalendar.vue' import MonthCalendar from '../../common/components/MonthCalendar.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
components: { components: {
...@@ -75,7 +99,8 @@ export default { ...@@ -75,7 +99,8 @@ export default {
SignName, SignName,
PreviewList, PreviewList,
WageAppeal, WageAppeal,
MonthCalendar MonthCalendar,
ErrorOrderPopup
}, },
data() { data() {
return { return {
...@@ -87,7 +112,10 @@ export default { ...@@ -87,7 +112,10 @@ export default {
selectedDays: [], selectedDays: [],
lockReason: '', lockReason: '',
showStudyPermissionPopup: false, showStudyPermissionPopup: false,
lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM') lastMonth: dayjs().subtract(1, 'month').format('YYYY-MM'),
// 异常订单锁单弹窗
showErrorOrderPopup: false,
abnormalOrderCount: 0
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -97,6 +125,21 @@ export default { ...@@ -97,6 +125,21 @@ export default {
this.toolComponentName = 'DailyReport' this.toolComponentName = 'DailyReport'
if (currentDate) this.setCurrentDate(currentDate) 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: { methods: {
setCurrentDate(currentDate) { setCurrentDate(currentDate) {
...@@ -116,12 +159,12 @@ export default { ...@@ -116,12 +159,12 @@ export default {
return return
} }
// 提示锁单 // 提示锁单
const abnormalOrderLock = await this.getAbnormalOrderLock() // const { lockOrderFlag, abnormalOrderNum } = await this.getAbnormalOrderLock()
if (abnormalOrderLock) { // if (lockOrderFlag == "Y" && abnormalOrderNum > 0) {
this.showErrorOrderPopup = true // this.showErrorOrderPopup = true
// this.lockReason = abnormalOrderLock.lockReason // this.abnormalOrderCount = abnormalOrderNum
return // return
} // }
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
const selectedItem = item const selectedItem = item
if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return if (this.toolComponentName === selectedItem.name && (!this.transmissionOfData || this.transmissionOfData.type !== 'supplementOrder')) return
...@@ -233,5 +276,50 @@ export default { ...@@ -233,5 +276,50 @@ export default {
justify-content: space-between; justify-content: space-between;
font-size: toRpx(34); 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> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!