Commit 45ba7400 by 张立顺

fix bug

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