feat:增加换货单的逻辑,已发货短信模板更改

This commit is contained in:
一休哥哥6666
2026-06-15 13:42:52 +08:00
parent dfef98814b
commit 2991dd88bb
28 changed files with 575 additions and 628 deletions

View File

@@ -3,21 +3,6 @@ import store from '@/store'
import DataDict from '@/utils/dict'
import { getDicts as getDicts } from '@/api/system/dict/data'
function searchDictByKey(dict, key) {
if (key == null && key == "") {
return null
}
try {
for (let i = 0; i < dict.length; i++) {
if (dict[i].key == key) {
return dict[i].value
}
}
} catch (e) {
return null
}
}
function install() {
Vue.use(DataDict, {
metas: {
@@ -25,19 +10,14 @@ function install() {
labelField: 'dictLabel',
valueField: 'dictValue',
request(dictMeta) {
const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
if (storeDict) {
return new Promise(resolve => { resolve(storeDict) })
} else {
return new Promise((resolve, reject) => {
getDicts(dictMeta.type).then(res => {
store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data })
resolve(res.data)
}).catch(error => {
reject(error)
})
return new Promise((resolve, reject) => {
getDicts(dictMeta.type).then(res => {
store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data })
resolve(res.data)
}).catch(error => {
reject(error)
})
}
})
},
},
},

View File

@@ -1,7 +1,7 @@
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<template v-if="values.includes(String(item.value))">
<span
v-if="(item.raw.listClass == 'default' || item.raw.listClass == '') && (item.raw.cssClass == '' || item.raw.cssClass == null)"
:key="item.value"
@@ -63,7 +63,7 @@ export default {
// 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => {
if (!this.options.some(v => v.value === item)) {
if (!this.options.some(v => String(v.value) === String(item))) {
this.unmatchArray.push(item)
unmatch = true // 如果有未匹配项将标志设置为true
}

View File

@@ -4,10 +4,15 @@ const state = {
const mutations = {
SET_DICT: (state, { key, value }) => {
if (key !== null && key !== "") {
state.dict.push({
key: key,
value: value
})
const index = state.dict.findIndex(item => item.key === key)
if (index >= 0) {
state.dict.splice(index, 1, { key: key, value: value })
} else {
state.dict.push({
key: key,
value: value
})
}
}
},
REMOVE_DICT: (state, key) => {

View File

@@ -30,7 +30,16 @@
<span>{{ formatLens(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="C价格" align="center" prop="priceC" width="80" />
<el-table-column label="C价格" align="center" width="80">
<template slot-scope="scope">
<span>{{ formatPriceAmount(formatPriceC(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="物流费用" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatPriceAmount(formatLogisticsFee(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="渐进多焦点价格" align="center" min-width="100">
<template slot-scope="scope">
<span>{{ formatProgressiveMultifocalPrice(scope.row) }}</span>
@@ -187,11 +196,11 @@
</div>
<div class="section-body">
<el-descriptions :column="2" border size="small" class="detail-descriptions detail-descriptions--price">
<el-descriptions-item label="C价格">{{ formatPriceAmount(detail.priceC) }}</el-descriptions-item>
<el-descriptions-item label="C价格">{{ formatPriceAmount(formatPriceC(detail)) }}</el-descriptions-item>
<el-descriptions-item label="物流费用">{{ formatPriceAmount(formatDetailLogisticsFee(detail)) }}</el-descriptions-item>
<el-descriptions-item label="渐进多焦点价格">{{ formatPriceAmount(formatProgressiveMultifocalPrice(detail)) }}</el-descriptions-item>
<el-descriptions-item label="合计">
<span class="price-total-value">{{ formatPriceAmount(formatPriceTotal(detail, 'priceC')) }}</span>
<span class="price-total-value">{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')) }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="detail-logistics-fee-block">
@@ -203,26 +212,6 @@
<span>{{ formatPriceAmount(formatLogisticsLogFee(scope.row, detail)) }}</span>
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="发货日期" align="center" width="120">
<template slot-scope="scope">
<span>{{ formatShipDate(scope.row.operateTime) }}</span>
@@ -311,26 +300,6 @@
<dict-tag :options="dict.type.jy_order_status" :value="scope.row.orderStatus" />
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="160" show-overflow-tooltip />
<el-table-column label="操作人" align="center" prop="operator" width="100" />
<el-table-column label="操作时间" align="center" prop="operateTime" width="160" />
@@ -574,7 +543,10 @@ export default {
ORDER_STATUS_PRODUCING: '7',
ORDER_STATUS_SHIPPED: '8',
ORDER_STATUS_COMPLETED: '9',
ORDER_STATUS_EXCHANGE_APPLY: '12',
ORDER_STATUS_EXCHANGE_AGREED: '13',
ORDER_STATUS_EXCHANGE_LOGISTICS: '15',
ORDER_STATUS_EXCHANGE_COMPLETED: '17',
ORDER_STATUS_WITHDRAWN: '20',
ORDER_STATUS_SUPPLEMENTED: '19',
logisticsDialogVisible: false,
@@ -703,8 +675,32 @@ export default {
},
formatProgressiveMultifocalPrice(row) {
if (!row) return '-'
if (this.isExchangeOrder(row)) return '-'
return row.progressiveMultifocalPrice != null ? row.progressiveMultifocalPrice : '-'
},
isExchangeOrder(row) {
if (!row) return false
if (row.orderNo && String(row.orderNo).startsWith('HH')) return true
const status = row.orderStatus != null ? String(row.orderStatus) : ''
return status === this.ORDER_STATUS_EXCHANGE_APPLY || status === this.ORDER_STATUS_EXCHANGE_AGREED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED
},
formatLogisticsFee(row) {
if (!row) return '-'
if (!this.isExchangeOrder(row)) return '-'
const fee = this.parseLogisticsFeeValue(row.logisticsFee)
return fee != null ? fee : '-'
},
formatPriceC(row) {
if (!row) return '-'
if (this.isExchangeOrder(row)) return '-'
return row.priceC != null ? row.priceC : '-'
},
formatDetailPriceTotal(detail, priceKey) {
if (this.isExchangeOrder(detail)) return this.formatDetailLogisticsFee(detail)
return this.formatPriceTotal(detail, priceKey)
},
formatPriceAmount(value) {
if (value == null || value === '' || value === '-') return '-'
if (value === '未核算') return '未核算'
@@ -750,7 +746,7 @@ export default {
hasFee = true
}
})
if (!hasFee && logs.length > 0 && detail.logisticsFee != null) {
if (!hasFee && detail.logisticsFee != null) {
const legacyFee = this.parseLogisticsFeeValue(detail.logisticsFee)
if (legacyFee != null) return legacyFee
}
@@ -760,24 +756,6 @@ export default {
formatDetailLogisticsFee(detail) {
return this.sumDetailLogisticsFee(detail)
},
formatLogSaleSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null
}
if (log.saleSettleStatus != null && log.saleSettleStatus !== '') {
return log.saleSettleStatus
}
return '0'
},
formatLogPurchaseSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null
}
if (log.purchaseSettleStatus != null && log.purchaseSettleStatus !== '') {
return log.purchaseSettleStatus
}
return '0'
},
formatShipDate(time) {
if (!time) {
return '-'
@@ -915,12 +893,17 @@ export default {
},
canCompleteOrder(row) {
if (!row || row.orderStatus == null) return false
return String(row.orderStatus) === this.ORDER_STATUS_SHIPPED
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
},
canViewLogistics(row) {
if (!row || row.orderStatus == null) return false
const status = Number(row.orderStatus)
return status === Number(this.ORDER_STATUS_SHIPPED) || status === 9
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_COMPLETED
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED
},
handleViewLogistics(row) {
if (!row || !row.id) return

View File

@@ -73,6 +73,11 @@
<span v-else>{{ formatPriceB(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="物流费用" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatPriceAmount(formatLogisticsFee(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="渐进多焦点价格" align="center" min-width="100">
<template slot-scope="scope">
<el-tag
@@ -671,12 +676,12 @@
</el-descriptions-item>
<el-descriptions-item label="合计">
<el-tag
v-if="isPendingTagText(formatPriceAmount(formatPriceTotal(detail, 'priceB')))"
v-if="isPendingTagText(formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')))"
type="danger"
size="small"
:disable-transitions="true"
>{{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }}</span>
>{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="detail-logistics-fee-block">
@@ -688,26 +693,6 @@
<span>{{ formatPriceAmount(formatLogisticsLogFee(scope.row, detail)) }}</span>
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="发货日期" align="center" width="120">
<template slot-scope="scope">
<span>{{ formatShipDate(scope.row.operateTime) }}</span>
@@ -796,26 +781,6 @@
<dict-tag :options="dict.type.jy_order_status" :value="scope.row.orderStatus" />
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="160" show-overflow-tooltip />
<el-table-column label="操作人" align="center" prop="operator" width="100" />
<el-table-column label="操作时间" align="center" prop="operateTime" width="160" />
@@ -890,7 +855,7 @@
<span class="section-index">01</span>
<div class="section-text">
<h4>换货申请说明</h4>
<p>填写换货申请原因订单将进入换货申请状态</p>
<p>填写换货申请原因系统将复制当前订单生成新换货申请单原订单状态不变</p>
</div>
</div>
<div class="section-body">
@@ -1053,6 +1018,9 @@ export default {
ORDER_STATUS_SHIPPED: '8',
ORDER_STATUS_COMPLETED: '9',
ORDER_STATUS_EXCHANGE_APPLY: '12',
ORDER_STATUS_EXCHANGE_AGREED: '13',
ORDER_STATUS_EXCHANGE_LOGISTICS: '15',
ORDER_STATUS_EXCHANGE_COMPLETED: '17',
ORDER_STATUS_EXCHANGE_REJECTED: '21',
logisticsDialogVisible: false,
logisticsBasic: null,
@@ -1162,7 +1130,7 @@ export default {
},
exchangeApplyDialogSubtitle() {
if (this.exchangeApplyForm && this.exchangeApplyForm.orderNo) {
return `订单编号 ${this.exchangeApplyForm.orderNo} · 填写原因后提交换货申请`
return `订单编号 ${this.exchangeApplyForm.orderNo} · 提交后将生成 HH 前缀的新换货申请`
}
return '填写原因后提交换货申请'
},
@@ -1315,14 +1283,35 @@ export default {
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_DRAFT || status === this.ORDER_STATUS_REJECTED
},
isExchangeOrder(row) {
if (!row) return false
if (row.orderNo && String(row.orderNo).startsWith('HH')) return true
const status = row.orderStatus != null ? String(row.orderStatus) : ''
return status === this.ORDER_STATUS_EXCHANGE_APPLY
|| status === this.ORDER_STATUS_EXCHANGE_AGREED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED
},
formatDetailPriceTotal(detail, priceKey) {
if (this.isExchangeOrder(detail)) return this.formatDetailLogisticsFee(detail)
return this.formatPriceTotal(detail, priceKey)
},
formatLogisticsFee(row) {
if (!row) return '-'
if (!this.isExchangeOrder(row)) return '-'
const fee = this.parseLogisticsFeeValue(row.logisticsFee)
return fee != null ? fee : '-'
},
formatPriceB(row) {
if (!row) return '-'
if (this.isExchangeOrder(row)) return '-'
if (this.isUnsetPriceStatus(row)) return '-'
if (String(row.orderStatus) === this.ORDER_STATUS_SUBMIT) return '未核算'
return row.priceB != null ? row.priceB : '-'
},
formatProgressiveMultifocalPrice(row) {
if (!row) return '-'
if (this.isExchangeOrder(row)) return '-'
if (Number(row.progressiveMultifocal) !== 1) return '-'
if (this.isUnsetPriceStatus(row)) return '-'
if (String(row.orderStatus) === this.ORDER_STATUS_SUBMIT) return '未核算'
@@ -1373,7 +1362,7 @@ export default {
hasFee = true
}
})
if (!hasFee && logs.length > 0 && detail.logisticsFee != null) {
if (!hasFee && detail.logisticsFee != null) {
const legacyFee = this.parseLogisticsFeeValue(detail.logisticsFee)
if (legacyFee != null) return legacyFee
}
@@ -1383,24 +1372,6 @@ export default {
formatDetailLogisticsFee(detail) {
return this.sumDetailLogisticsFee(detail)
},
formatLogSaleSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null
}
if (log.saleSettleStatus != null && log.saleSettleStatus !== '') {
return log.saleSettleStatus
}
return '0'
},
formatLogPurchaseSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null
}
if (log.purchaseSettleStatus != null && log.purchaseSettleStatus !== '') {
return log.purchaseSettleStatus
}
return '0'
},
formatShipDate(time) {
if (!time) {
return '-'
@@ -1932,17 +1903,24 @@ export default {
},
canViewLogistics(row) {
if (!row || row.orderStatus == null) return false
const status = Number(row.orderStatus)
return status === Number(this.ORDER_STATUS_SHIPPED) || status === 9
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_COMPLETED
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED
},
canCompleteOrder(row) {
if (!row || row.orderStatus == null) return false
return String(row.orderStatus) === this.ORDER_STATUS_SHIPPED
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
},
canExchangeApplyOrder(row) {
if (!row || row.orderStatus == null) return false
const status = String(row.orderStatus)
return status === this.ORDER_STATUS_COMPLETED || status === this.ORDER_STATUS_EXCHANGE_REJECTED
return status === this.ORDER_STATUS_COMPLETED
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED
|| status === this.ORDER_STATUS_EXCHANGE_REJECTED
},
canReceiveOrder(row) {
if (!row || row.orderStatus == null) return false
@@ -2037,7 +2015,7 @@ export default {
},
handleExchangeApply(row) {
if (!row || !row.id || !this.canExchangeApplyOrder(row)) {
this.$message.warning('仅已完成或拒绝换货申请状态订单可申请换货')
this.$message.warning('仅已完成、换货完成或拒绝换货申请状态订单可申请换货')
return
}
this.exchangeApplyForm = {
@@ -2061,8 +2039,10 @@ export default {
exchangeApplyPortalOrder({
orderId: this.exchangeApplyForm.orderId,
reason: this.exchangeApplyForm.reason
}).then(() => {
this.$modal.msgSuccess('换货申请已提交')
}).then((res) => {
const newOrder = res && res.data
const newOrderNo = newOrder && newOrder.orderNo ? newOrder.orderNo : ''
this.$modal.msgSuccess(newOrderNo ? `换货申请已提交,新订单号:${newOrderNo}` : '换货申请已提交')
this.exchangeApplyOpen = false
this.getList()
if (this.detailOpen && this.detail.id === this.exchangeApplyForm.orderId) {