Commit 45ba7400 by 张立顺

fix bug

1 parent 1135e51a
// components/orderPromptPop/orderPromptPop.js // components/orderPromptPop/orderPromptPop.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -46,21 +45,26 @@ Component({ ...@@ -46,21 +45,26 @@ Component({
*/ */
data: { data: {
infoData: {}, infoData: {},
payTypeList: [{ payTypeList: [
label: '收款方为门店收款', {
value: '3' label: '收款方为门店收款',
}, { value: '3'
label: '收款方为嘀加且属于对公转账收款', },
value: '4' {
}, { label: '收款方为嘀加且属于对公转账收款',
label: '收款方为嘀加二维码收款', value: '4'
value: '5', },
tips: '适用于已有交易收款流水需补录订单时' {
}, { label: '收款方为嘀加二维码收款',
label: '特殊收款', value: '5',
value: '6', tips: '适用于已有交易收款流水需补录订单时'
tips: '仅用于无法关联流水或混合支付场景,请谨慎选择。' },
}] {
label: '特殊收款',
value: '6',
tips: '仅用于无法关联流水或混合支付场景,请谨慎选择。'
}
]
}, },
/** /**
...@@ -91,4 +95,4 @@ Component({ ...@@ -91,4 +95,4 @@ Component({
this.triggerEvent('confirm', infoData) this.triggerEvent('confirm', infoData)
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -400,8 +400,8 @@ Component({ ...@@ -400,8 +400,8 @@ Component({
value = integerPart + '.' + decimalPart value = integerPart + '.' + decimalPart
} }
if (parseFloat(value) > parseFloat(basePrice)) { if (NP.times(parseFloat(value), 100) > parseFloat(basePrice)) {
value = basePrice.toString() value = NP.divide(parseFloat(basePrice), 100).toString()
} }
} }
} }
......
...@@ -579,7 +579,9 @@ Page({ ...@@ -579,7 +579,9 @@ Page({
let currentTotal = Number(orderInfo.total || 0) let currentTotal = Number(orderInfo.total || 0)
if (NP.plus(originalPrice, transactionPrice) != currentTotal) { if (NP.plus(originalPrice, transactionPrice) != currentTotal) {
return wx.$util.showToast('原错误订单总价+关联交易流水必须等于订单总价') return wx.$util.showToast(
'【原错误订单总价+关联交易流水】必须等于【商品总价】'
)
} }
} else { } else {
// 正常订单校验总价不能小于0.01 // 正常订单校验总价不能小于0.01
......
This diff could not be displayed because it is too large.
...@@ -287,9 +287,10 @@ Page({ ...@@ -287,9 +287,10 @@ Page({
if (g.discountType == 4) { if (g.discountType == 4) {
g.displayPrice = '0' g.displayPrice = '0'
} else { } else {
g.displayPrice = g.finalPrice g.displayPrice =
? Number(g.finalPrice) / Number(g.number) g.finalPrice || g.finalPrice === 0
: g.upgradePrice ? Number(g.finalPrice) / Number(g.number)
: g.upgradePrice
} }
}) })
item.goodsList = item.packageGoodsOrderList item.goodsList = item.packageGoodsOrderList
...@@ -397,9 +398,10 @@ Page({ ...@@ -397,9 +398,10 @@ Page({
if (g.discountType == 4) { if (g.discountType == 4) {
g.displayPrice = '0' g.displayPrice = '0'
} else { } else {
g.displayPrice = g.finalPrice g.displayPrice =
? Number(g.finalPrice) / Number(g.number) g.finalPrice || g.finalPrice === 0
: g.upgradePrice ? Number(g.finalPrice) / Number(g.number)
: g.upgradePrice
} }
}) })
item.goodsList = item.packageGoodsOrderList item.goodsList = item.packageGoodsOrderList
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<view class="meal-bd-head"> <view class="meal-bd-head">
<view class="dot"></view> <view class="dot"></view>
<view class="name">{{g.upgradeGoodsAlias||g.upgradeGoodsName}}</view> <view class="name">{{g.upgradeGoodsAlias||g.upgradeGoodsName}}</view>
<view class="price">¥{{g.displayPrice || g.price}}</view> <view class="price">¥{{g.displayPrice }}</view>
</view> </view>
<view class="meal-bd-bottom"> <view class="meal-bd-bottom">
{{g.upgradeGoodsType===1?g.positionStr: g.upgradeGoodsTypeName}} {{g.upgradeGoodsType===1?g.positionStr: g.upgradeGoodsTypeName}}
......
...@@ -356,12 +356,12 @@ Page({ ...@@ -356,12 +356,12 @@ Page({
}, },
async navigator(e) { async navigator(e) {
let { selectOutTradeNoArr } = e.detail let { selectOutTradeNoArr } = e.detail
let { paymentMethod, isErrorOrder } = this.data let { paymentMethod, isErrorOrder, orderCreateType } = this.data
this.closeSwitchPopup() this.closeSwitchPopup()
selectOutTradeNoArr?.length && selectOutTradeNoArr?.length &&
this.onRoute({ this.onRoute({
selectOutTradeNoArr, selectOutTradeNoArr,
orderCreateType: 'additionRecordOrder', orderCreateType: isErrorOrder ? orderCreateType : 'additionRecordOrder',
paymentMethod paymentMethod
}) })
...@@ -719,7 +719,7 @@ Page({ ...@@ -719,7 +719,7 @@ Page({
} }
strategy.setBasePrice(number) strategy.setBasePrice(number)
} else { } else {
strategy.setPrice(number) strategy.setBasePrice(number)
} }
this.setGoodsTotal(goodsList) this.setGoodsTotal(goodsList)
} }
...@@ -856,7 +856,7 @@ Page({ ...@@ -856,7 +856,7 @@ Page({
djOrderType: orderObj.djOrderType djOrderType: orderObj.djOrderType
} }
if ( if (
e.goods.price < e.goods.shopMinPrice && e.goods.sellPrice < e.goods.shopMinPrice &&
orderObj.selectPayType != 0 orderObj.selectPayType != 0
) )
priceDisabled = false priceDisabled = false
...@@ -880,7 +880,7 @@ Page({ ...@@ -880,7 +880,7 @@ Page({
// goodsInfo:e.goodsInfo, // goodsInfo:e.goodsInfo,
packageCode: e.packageGoods.packageCode, packageCode: e.packageGoods.packageCode,
packageName: e.packageGoods.packageName, packageName: e.packageGoods.packageName,
totalPrice: g.price, totalPrice: g.sellPrice,
number: e.count, number: e.count,
merchantGoodsId: g.merchantGoodsId, merchantGoodsId: g.merchantGoodsId,
upgradePrice: g.sellPrice, upgradePrice: g.sellPrice,
...@@ -890,7 +890,10 @@ Page({ ...@@ -890,7 +890,10 @@ Page({
finalPrice: finalPrice:
discountType == 4 discountType == 4
? 0 ? 0
: NP.minus(NP.times(g.price, e.count || 1), discountAmount), : NP.minus(
NP.times(g.sellPrice, e.count || 1),
discountAmount
),
djOrderType: orderObj.djOrderType djOrderType: orderObj.djOrderType
}) })
}) })
...@@ -1096,6 +1099,15 @@ Page({ ...@@ -1096,6 +1099,15 @@ Page({
} }
}) })
// 兼容处理 orderType 赋值给 djOrderType
if (orderObj.djOrderType === undefined || orderObj.djOrderType === null) {
if (orderObj.orderType !== undefined && orderObj.orderType !== null) {
orderObj.djOrderType = orderObj.orderType
} else {
orderObj.djOrderType = 0
}
}
// 兼容再次编辑(onLoad options)进来的数据类型可能是字符串的问题 // 兼容再次编辑(onLoad options)进来的数据类型可能是字符串的问题
const numberFields = [ const numberFields = [
'selectPayType', 'selectPayType',
...@@ -1181,10 +1193,21 @@ Page({ ...@@ -1181,10 +1193,21 @@ Page({
orderObj.sellerMerchantId = options.yqMerchantId orderObj.sellerMerchantId = options.yqMerchantId
} }
if (!orderObj.customer.salesType) orderObj.customer.salesType = 0 if (!orderObj.customer.salesType) orderObj.customer.salesType = 0
// 回显订单类型名称
let { orderTypeName, orderTypeList } = this.data
if (orderObj.djOrderType !== undefined && orderObj.djOrderType !== null) {
const typeItem = orderTypeList.find(
item => item.value == orderObj.djOrderType
)
if (typeItem) {
orderTypeName = typeItem.text
}
}
console.log(JSON.parse(JSON.stringify(orderObj))) console.log(JSON.parse(JSON.stringify(orderObj)))
this.setData({ this.setData({
currentWordNumber: orderObj?.remark?.length || 0, currentWordNumber: orderObj?.remark?.length || 0,
orderObj, orderObj,
orderTypeName,
first: true, first: true,
flag: true, flag: true,
isErrorOrder, isErrorOrder,
...@@ -1720,16 +1743,25 @@ Page({ ...@@ -1720,16 +1743,25 @@ Page({
} else { } else {
// 修复: 再次编辑时优先使用单价初始化 // 修复: 再次编辑时优先使用单价初始化
const count = Number(g.number) || 1 const count = Number(g.number) || 1
g.price = g.totalPrice g.price =
? Number(g.totalPrice) / count g.totalPrice || g.totalPrice === 0
: g.sellPrice ? Number(g.totalPrice) / count
: g.sellPrice
g.sellPrice = g.price g.sellPrice = g.price
} }
} else { } else {
g.sellPrice = g.sellPrice || g.upgradePrice || g.totalPrice const priceFromTotal =
g.price = g.totalPrice g.totalPrice || g.totalPrice === 0
? Number(g.totalPrice) / Number(g.number) ? Number(g.totalPrice) / Number(g.number)
: g.sellPrice : undefined
g.sellPrice =
g.sellPrice || g.sellPrice === 0
? g.sellPrice
: priceFromTotal !== undefined
? priceFromTotal
: g.upgradePrice
g.price =
priceFromTotal !== undefined ? priceFromTotal : g.sellPrice
} }
if (!g.minSellPrice) g.minSellPrice = g.upgradeShopMinPrice if (!g.minSellPrice) g.minSellPrice = g.upgradeShopMinPrice
if ( if (
......
...@@ -349,6 +349,12 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) { ...@@ -349,6 +349,12 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
const type = subItem.discountType const type = subItem.discountType
const value = subItem.discountValue const value = subItem.discountValue
if (Number(basePrice) === 0) {
subItem.finalPrice = 0
subItem.discountAmount = 0
return
}
if (type == DISCOUNT_TYPE.RATIO && value) { if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) { if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10)) finalPrice = NP.times(basePrice, NP.divide(value, 10))
......
...@@ -27,7 +27,10 @@ RouteContext.prototype.execute = async function (res) { ...@@ -27,7 +27,10 @@ RouteContext.prototype.execute = async function (res) {
strategy = new ScanCodeStrategy(this.page) strategy = new ScanCodeStrategy(this.page)
} else if (res.orderCode && res.page) { } else if (res.orderCode && res.page) {
strategy = new EditOrderStrategy(this.page) strategy = new EditOrderStrategy(this.page)
} else if (res && res.orderCreateType === 'additionRecordOrder') { } else if (
(res && res.orderCreateType === 'additionRecordOrder') ||
(res && res.selectOutTradeNoArr && res.selectOutTradeNoArr.length)
) {
strategy = new AdditionRecordStrategy(this.page) strategy = new AdditionRecordStrategy(this.page)
} else if (res.merchantId) { } else if (res.merchantId) {
strategy = new MerchantStrategy(this.page) strategy = new MerchantStrategy(this.page)
......
...@@ -171,7 +171,7 @@ ErrorOrderPriceStrategy.prototype.validate = async function () { ...@@ -171,7 +171,7 @@ ErrorOrderPriceStrategy.prototype.validate = async function () {
if (NP.minus(NP.plus(originalPrice, associatedPrice), currentTotal) !== 0) { if (NP.minus(NP.plus(originalPrice, associatedPrice), currentTotal) !== 0) {
return ValidationResult.failure( return ValidationResult.failure(
'原错误订单总价+关联交易流水必须等于商品总价' '【原错误订单总价+关联交易流水】必须等于【商品总价】'
) )
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!