|
@@ -18,6 +18,7 @@ import { showMessage, showNotify } from '@/views/create-order/hooks/toast'
|
|
|
import { add, sub, calcDiscountRate } from '@/utils/number'
|
|
|
import { productKeyMap } from '@/views/create-order/data'
|
|
|
import { defaultPageFormValue, OrderProductCardItem } from '@/views/create-order/data/interface'
|
|
|
+import { findUserInDeptTree } from "@/views/create-order/hooks/utils"
|
|
|
|
|
|
const defaultOrderInfo = {
|
|
|
disabled: false, // 禁用
|
|
@@ -53,6 +54,9 @@ export default {
|
|
|
orderInfo: cloneDeep(defaultOrderInfo),
|
|
|
},
|
|
|
getters: {
|
|
|
+ currentUserInfo(state) {
|
|
|
+ return findUserInDeptTree(u => u.id === state.conf.currentUserEntId)
|
|
|
+ },
|
|
|
requestLoading(state) {
|
|
|
const loading = state.loading
|
|
|
let s = false
|
|
@@ -149,10 +153,18 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ // 标准售价只要有一个<0(无法计算标注售价,就置为-1)
|
|
|
+ const standardMoneyArr = getters.userProductInfoList.map(u => Number(u.contractAmount?.standardMoney) < 0)
|
|
|
+ if (standardMoneyArr.includes(true)) {
|
|
|
+ standard = -1
|
|
|
+ }
|
|
|
+
|
|
|
if (standard === 0) {
|
|
|
rate = 0
|
|
|
- } else {
|
|
|
+ } else if (standard > 0) {
|
|
|
rate = `${(calcDiscountRate(contract, standard))}%`
|
|
|
+ } else {
|
|
|
+ rate = -1
|
|
|
}
|
|
|
return {
|
|
|
hasContract,
|
|
@@ -434,10 +446,29 @@ export default {
|
|
|
async restorePageInfo({ commit, dispatch }, order) {
|
|
|
const { pageFormValue, productArr } = sortOrderInfo(order)
|
|
|
await dispatch('resetPageInfo')
|
|
|
+ // 延迟更新列表
|
|
|
+ const delayRestoreList = [
|
|
|
+ 'paymentAccountName',
|
|
|
+ 'paybackTableData',
|
|
|
+ 'paybackTimes',
|
|
|
+ 'salePerson',
|
|
|
+ 'salePersonTableList',
|
|
|
+ 'saleWay',
|
|
|
+ ]
|
|
|
+
|
|
|
if (pageFormValue) {
|
|
|
for (const key in pageFormValue) {
|
|
|
+ if (delayRestoreList.includes(key)) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
commit('setPageForm', { key, data: pageFormValue[key] })
|
|
|
}
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ delayRestoreList.forEach(key => {
|
|
|
+ commit('setPageForm', { key, data: pageFormValue[key] })
|
|
|
+ })
|
|
|
+ }, 10)
|
|
|
}
|
|
|
if (Array.isArray(productArr) && productArr.length > 0) {
|
|
|
commit('setOrderProductInfoList', productArr)
|