Commit 8a15f552 by 张立顺

feat 3月中版本功能开发

1 parent b22061de
......@@ -43,7 +43,7 @@ Component({
},
{
labelName: '实际支付',
orderType: 'success',
// orderType: 'success',
key: 'finalPrice'
},
{
......
......@@ -91,7 +91,8 @@ Component({
confirmName: '下一步(1/4)',
cancelName: '存草稿'
},
vinValid:true
vinValid: true,
createAllGoodsFlag: 1
},
lifetimes: {
......@@ -109,17 +110,20 @@ Component({
* 组件的方法列表
*/
methods: {
getShopMerchantPointConfig(){
console.log(1111111111)
let { userInfo } = this.data;
let oParams = {};
oParams.merchantId = userInfo.shopMerchantId;
commonApi.getShopMerchantPointConfig(oParams).then(res=>{
// if(res.data.pointsMultiRole=='Y'){
// toastList.userId='销售顾问/录单员不能为空'
// }
getShopMerchantPointConfig() {
console.log(1111111111)
let { userInfo } = this.data
let oParams = {}
oParams.merchantId = userInfo.shopMerchantId
commonApi.getShopMerchantPointConfig(oParams).then(res => {
const { pointsMultiRole, createAllGoodsFlag } = res.data
this.setData({
pointsMultiRole:res.data.pointsMultiRole
pointsMultiRole,
createAllGoodsFlag
})
// 触发事件通知父页面更新配置
this.triggerEvent('updateConfig', {
createAllGoodsFlag
})
})
},
......
......@@ -79,6 +79,10 @@ Component({
totalFee: {
type: Number,
value: 0
},
createAllGoodsFlag: {
type: Number,
value: 1
}
},
observers: {
......@@ -229,6 +233,7 @@ Component({
},
// 打开订单类型选择
openOrderType() {
if (this.data.createAllGoodsFlag == 0) return
this.setData({
orderTypeBox: true
})
......
......@@ -16,10 +16,10 @@
<gl-cell
border
valueAlign="right"
class="goodsCom"
class="goodsCom {{ createAllGoodsFlag == 0 ? 'item-disabled' : '' }}"
label="订单类型"
labelWidth="var(--fontSize140)"
haveArrow
haveArrow="{{ createAllGoodsFlag != 0 }}"
requiredAfter
required
value="{{ orderTypeName }}"
......
......@@ -125,8 +125,29 @@ Page({
tempVin: "",
showZyPopup: false, // 上传合同协议弹窗
paymentMethod: 1,
},
tipsEvent() {
createAllGoodsFlag: 1
},
handleUpdateConfig(e) {
const { createAllGoodsFlag } = e.detail
// let updateData = { createAllGoodsFlag }
console.log(createAllGoodsFlag, 'createAllGoodsFlag')
if (createAllGoodsFlag == 0) {
const { orderInfo } = this.data
// 如果是历史订单(有ID)且类型不是正常订单,则不强制重置
const isExistingOrder = orderInfo && !!orderInfo.id
const isNonNormal = orderInfo && orderInfo.orderType && orderInfo.orderType != 1
if (isExistingOrder && isNonNormal) {
// do nothing
} else {
// updateData['orderInfo.orderType'] = 1 // 强制正常订单
this.setData({ 'orderInfo.orderType': 1 })
}
}
this.setData({ createAllGoodsFlag })
},
tipsEvent() {
this.setData({
showOrderpop: true,
});
......@@ -778,6 +799,7 @@ Page({
: "",
goodsPrice: item.price,
finalPrice: price,
singleProductFinalPrice: price,
discountType: item.discountType,
discountValue: item.discountValue,
discountAmount: item.discountAmount || 0,
......@@ -812,6 +834,7 @@ Page({
// specificationsValue: item.specificationData ? item.specificationData.replace(reg, ' ') : '',
goodsPrice: ele.price,
finalPrice: price,
singleProductFinalPrice: price,
discountType: ele.discountType,
discountValue: ele.discountValue,
discountAmount: ele.discountAmount || 0,
......@@ -840,6 +863,7 @@ Page({
: "",
goodsPrice: item.price,
finalPrice: price,
singleProductFinalPrice: price,
discountType: item.discountType,
discountValue: item.discountValue,
discountAmount: item.discountAmount || 0,
......
......@@ -18,9 +18,11 @@
orderInfo="{{ orderInfo }}"
subBtnShow="{{ false }}"
mode="{{ mode }}"
bind:updateConfig="handleUpdateConfig"
/>
<second-step
id="SecondStep"
createAllGoodsFlag="{{ createAllGoodsFlag }}"
orderInfo="{{ orderInfo }}"
quotationGoodsList="{{ quotationGoodsList }}"
bindconfirm="handleSecondConfirm"
......
......@@ -140,7 +140,8 @@ ProductStrategy.prototype.applyDiscount = function () {
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice)
// 折扣比例计算:向上取整到“分”(两位小数)
finalPrice = Math.ceil(finalPrice)
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, NP.times(value, 100))
......@@ -390,7 +391,8 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice)
// 折扣比例计算:向上取整到“分”(两位小数)
finalPrice = Math.ceil(finalPrice)
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, NP.times(value, 100))
......
......@@ -1321,70 +1321,17 @@ Component({
orderCode: item.payId
})
if (refundStep?.data == 'Y') return _this.showRefundAlert('error')
wx.$modal(this, {
show: true,
title: '工单标记',
tabTitleShow: false,
success: res => {
this.showErrorType(item)
},
error: () => {}
})
}
)
},
selectType(e) {
let { type } = e.currentTarget.dataset
this.setData({
selectType: type
})
},
// 确定是否要显示
showErrorType(item) {
wx.$modal(
this,
{
show: true,
title: '请选择录单入口',
tabTitleShow: false,
success: async res => {
// 再次校验 防止二次确认弹窗弹起后长时间未操作,导致订单状态变更异常
let canRefundStep = await commonApi.getOrderRefundStep({
orderCode: item.payId
})
if (canRefundStep?.data == 'Y') return this.showRefundAlert()
// 跳转新增订单页面 并带特定参数
let { selectType } = this.data
if (selectType == 1) {
wx.$router.go(
item.mode != 0
? 'createOrderCarQuotationSimple'
: 'createOrderCarQuotation',
{
id: item.id,
resetOrder: true
}
)
} else {
// 无需补录
errorOrderById({
oldQuotationId: item.id,
needCreateNewOrder: false
})
.then(res => {
let { code, message } = res
if (code == 0) {
this.search()
} else {
wx.$util.showToast(message)
}
})
.catch(() => {})
// 跳转新增订单页面 并带特定参数
wx.$router.go(
item.mode != 0
? 'createOrderCarQuotationSimple'
: 'createOrderCarQuotation',
{
id: item.id,
resetOrder: true
}
},
error: () => {}
},
'#modal2'
)
}
)
},
jumpReception(e) {
......
......@@ -171,7 +171,8 @@ Page({
configPayTypeList: [], // 园区店配置支持的支付方式
recordOrderFlag: true, // 补录订单入口标识
skuGoodsData: {}, //多规格商品数据
vinValid: true
vinValid: true,
createAllGoodsFlag: 1 // 当前门店是否能创建全部类型订单 0-否 1-是
},
onCloseOrderType() {
this.setData({ orderTypeBox: false })
......@@ -466,10 +467,12 @@ Page({
copyGoodsData,
packageList,
orderObj: { selectPayType },
baseConfigData
baseConfigData,
createAllGoodsFlag
} = this.data
let { showName, positionnnum: positionNum } =
e.currentTarget.dataset || e.detail
if (showName == 'orderTypeBox' && createAllGoodsFlag == 0) return
console.log(positionNum, 'positionNum')
console.log(copyGoodsData, 'copyGoodsData')
let obj = {
......@@ -869,6 +872,13 @@ Page({
e.goods.discountAmount || 0,
e.count || 1
)
const finalPrice =
discountType == 4
? 0
: NP.minus(
NP.times(Number(e.goods.sellPrice), e.count || 1),
discountAmount
)
let obj = {
baseGoodsId: e.goods.baseGoodsId,
totalPrice: Number(e.goods.sellPrice),
......@@ -877,13 +887,8 @@ Page({
discountType: discountType,
discountValue: e.goods.discountValue,
discountAmount: discountAmount,
finalPrice:
discountType == 4
? 0
: NP.minus(
NP.times(Number(e.goods.sellPrice), e.count || 1),
discountAmount
),
finalPrice,
singleProductFinalPrice: finalPrice,
djOrderType: orderObj.djOrderType
}
if (
......@@ -904,6 +909,13 @@ Page({
discountType = 5
}
let discountAmount = NP.times(g.discountAmount || 0, e.count || 1)
const finalPrice =
discountType == 4
? 0
: NP.minus(
NP.times(g.sellPrice, e.count || 1),
discountAmount
)
// console.log(e)
// console.log(g)
// console.log(2222)
......@@ -918,13 +930,8 @@ Page({
discountType: discountType,
discountValue: g.discountValue,
discountAmount: discountAmount,
finalPrice:
discountType == 4
? 0
: NP.minus(
NP.times(g.sellPrice, e.count || 1),
discountAmount
),
finalPrice,
singleProductFinalPrice: finalPrice,
djOrderType: orderObj.djOrderType
})
})
......@@ -943,6 +950,16 @@ Page({
e.multipleSpecificationsGoods.goods.discountAmount || 0,
e.count || 1
)
const finalPrice =
discountType == 4
? 0
: NP.minus(
NP.times(
Number(e.multipleSpecificationsGoods.goods.sellPrice),
e.count || 1
),
discountAmount
)
let obj = {
baseGoodsId: e.multipleSpecificationsGoods.goods.baseGoodsId,
totalPrice: Number(e.multipleSpecificationsGoods.goods.sellPrice),
......@@ -953,16 +970,8 @@ Page({
discountType: discountType,
discountValue: e.multipleSpecificationsGoods.goods.discountValue,
discountAmount: discountAmount,
finalPrice:
discountType == 4
? 0
: NP.minus(
NP.times(
Number(e.multipleSpecificationsGoods.goods.sellPrice),
e.count || 1
),
discountAmount
),
finalPrice,
singleProductFinalPrice: finalPrice,
djOrderType: orderObj.djOrderType
}
subOrderList.push(obj)
......@@ -1700,7 +1709,8 @@ Page({
if (discountType == 1 && discountValue) {
if (discountValue > 0 && discountValue <= 10) {
finalPrice = NP.times(basePrice, NP.divide(discountValue, 10))
finalPrice = Math.round(finalPrice * 100) / 100
// 折扣比例: 结果向上取整到分
finalPrice = Math.ceil(finalPrice * 100) / 100
}
} else if (discountType == 2 && discountValue) {
finalPrice = NP.minus(basePrice, discountValue)
......@@ -1812,7 +1822,8 @@ Page({
if (discountType == 1 && discountValue) {
if (discountValue > 0 && discountValue <= 10) {
finalPrice = NP.times(basePrice, NP.divide(discountValue, 10))
finalPrice = Math.round(finalPrice * 100) / 100
// 折扣比例: 结果向上取整到分
finalPrice = Math.ceil(finalPrice * 100) / 100
}
} else if (discountType == 2 && discountValue) {
finalPrice = NP.minus(basePrice, discountValue)
......@@ -1958,7 +1969,8 @@ Page({
if (discountType == 1 && discountValue) {
if (discountValue > 0 && discountValue <= 10) {
finalPrice = NP.times(basePrice, NP.divide(discountValue, 10))
finalPrice = Math.round(finalPrice * 100) / 100
// 折扣比例: 结果向上取整到分
finalPrice = Math.ceil(finalPrice * 100) / 100
}
} else if (discountType == 2 && discountValue) {
finalPrice = NP.minus(basePrice, discountValue)
......@@ -1992,12 +2004,13 @@ Page({
console.log(skuArr)
return skuArr
},
// 金额展示:分转元,保留两位小数(包括末尾 0)
divideByHundred: str => {
let floatVal = parseFloat(str)
if (isNaN(floatVal)) {
return 0
return '0.00'
}
floatVal = Math.round(str * 100) / 10000
floatVal = Math.round(floatVal) / 100
let strVal = floatVal.toString()
let searchVal = strVal.indexOf('.')
if (searchVal < 0) {
......@@ -2007,7 +2020,7 @@ Page({
while (strVal.length <= searchVal + 2) {
strVal += '0'
}
return parseFloat(strVal)
return strVal
},
getSetting() {
// 动态获取 车型 车架 车牌 是否必填
......@@ -2176,12 +2189,42 @@ Page({
let oParams = {}
oParams.merchantId = userInfo.shopMerchantId
api.getShopMerchantPointConfig(oParams).then(res => {
if (res.data.pointsMultiRole == 'Y') {
let { pointsMultiRole, createAllGoodsFlag } = res.data
console.log(res.data,'getShopMerchantPointConfig')
// createAllGoodsFlag = 0
if (pointsMultiRole == 'Y') {
toastList.userId = '销售顾问/录单员不能为空'
}
this.setData({
pointsMultiRole: res.data.pointsMultiRole
})
// let updateData = {
// pointsMultiRole,
// createAllGoodsFlag
// }
// 如果不可以创建全部类型订单,强制设置为正常订单
if (createAllGoodsFlag == 0) {
// updateData['orderObj.djOrderType'] = ORDER_TYPE.NORMAL
// updateData.orderTypeName = '正常订单'
const { orderObj } = this.data
// 如果是历史订单(有ID)且类型不是正常订单,则不强制重置
const isExistingOrder = orderObj && !!orderObj.id
const isNonNormal = orderObj && orderObj.djOrderType && orderObj.djOrderType != ORDER_TYPE.NORMAL
if (isExistingOrder && isNonNormal) {
// do nothing, keep history type
} else {
this.setData({
orderTypeName: '正常订单',
['orderObj.djOrderType']: ORDER_TYPE.NORMAL
})
}
}
// this.setData(updateData)
this.setData({
createAllGoodsFlag,
pointsMultiRole
})
})
},
/**
......
......@@ -275,13 +275,14 @@ value="{{ orderObj.remark }}"
valueAlign="right"
label="订单类型"
labelWidth="var(--fontSize140)"
haveArrow
haveArrow="{{ createAllGoodsFlag != 0 }}"
requiredAfter
required
value="{{ orderTypeName }}"
placeholder="点击选择"
bindclick="showPopup"
data-show-name="orderTypeBox"
disabled="{{ createAllGoodsFlag == 0 }}"
/>
<block wx:if="{{ isErrorOrder }}">
<gl-cell
......
......@@ -130,7 +130,8 @@ ProductStrategy.prototype.applyDiscount = function () {
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
// 折扣比例:结果向上取整到分(两位小数)
finalPrice = Math.ceil(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
......@@ -375,7 +376,8 @@ PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
// 折扣比例:结果向上取整到分(两位小数)
finalPrice = Math.ceil(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
......
......@@ -103,60 +103,19 @@ Page({
// constructionVisible: false
// })
},
// 确定是否要显示
showErrorType() {
console.log('showErrorType')
wx.$modal(
this,
{
show: true,
title: '请选择录单入口',
tabTitleShow: false,
success: async res => {
// 再次校验 防止二次确认弹窗弹起后长时间未操作,导致订单状态变更异常
let { orderInfo, selectType } = this.data
let canRefundStep = await commonApi.getOrderRefundStep({
orderCode: orderInfo.orderCode
})
if (canRefundStep?.data == 'Y') return this.showRefundAlert()
// 跳转新增订单页面 并带特定参数
console.log(orderInfo)
if (selectType == 1) {
orderInfo.associateOrderCode = orderInfo.orderCode
delete orderInfo.orderCode
if (orderInfo.technicianList) {
delete orderInfo.technicianList
}
orderInfo.selectPayType = 2
let urlName = 'createOrder'
wx.$router.redirectTo(urlName, orderInfo)
} else {
// 无需补录
api
.noNeedSupplementOrder({ oldOrderCode: orderInfo.orderCode })
.then(res => {
console.log(res)
if (res.code == 0) {
wx.$util.refreshPageData()
wx.$router.go('pages.index')
this.setData({
modalShow: false
})
wx.$modal(this, { show: false }, '#modal2')
} else {
wx.$util.showToast(res.message)
}
})
.catch(err => {
console.log(err)
})
}
},
error: () => {}
},
'#modal2'
)
// 跳转新增订单页面
goToCreateOrder() {
let { orderInfo } = this.data
// 跳转新增订单页面 并带特定参数
console.log(orderInfo)
orderInfo.associateOrderCode = orderInfo.orderCode
delete orderInfo.orderCode
if (orderInfo.technicianList) {
delete orderInfo.technicianList
}
orderInfo.selectPayType = 2
let urlName = 'createOrder'
wx.$router.redirectTo(urlName, orderInfo)
},
// 确定是否要显示
async targetError() {
......@@ -193,28 +152,16 @@ Page({
tabTitleShow: false,
success: res => {
console.log(res, 'res')
this.showTarget()
this.goToCreateOrder()
},
error: () => {}
},
'#modal5'
)
} else {
this.showTarget()
this.goToCreateOrder()
}
},
showTarget() {
wx.$modal(this, {
show: true,
title: '工单标记',
tabTitleShow: false,
success: res => {
console.log(res, 'res')
this.showErrorType()
},
error: () => {}
})
},
targetOperate() {
let { showTip } = this.data
this.setData({
......
......@@ -1133,7 +1133,7 @@ Page({
if (item.firstBrandId == carBandId) {
hmPresent = true
}
if (item.brandId == 3574 || item.brandName == '尚界') {
if (item.brandId == 3574 || (item.brandName && item.brandName.indexOf('界') > -1 && item.brandName.indexOf('问界') == -1)) {
containsShangJie = true
}
if (item.brandType == 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!