订单列表:列表重构: 完善订单发货、修改地址、订单调价、订单备注
(cherry picked from commit be143ea21b
)
This commit is contained in:
parent
70b1161ec1
commit
99ef6f83ba
@ -109,3 +109,13 @@ export const delivery = async (data: DeliveryVO) => {
|
||||
export const remark = async (data) => {
|
||||
return await request.post({ url: `/trade/order/remark`, data })
|
||||
}
|
||||
|
||||
// 订单调价
|
||||
export const adjustPrice = async (data) => {
|
||||
return await request.post({ url: `/trade/order/adjust-price`, data })
|
||||
}
|
||||
|
||||
// 修改订单地址
|
||||
export const adjustAddress = async (data) => {
|
||||
return await request.post({ url: `/trade/order/adjust-address`, data })
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
children: [
|
||||
{
|
||||
path: 'detail/:orderId(\\d+)',
|
||||
component: () => import('@/views/mall/trade/order/detail/index.vue'),
|
||||
component: () => import('@/views/mall/trade/order/components/OrderDetailForm.vue'),
|
||||
name: 'TradeOrderDetailForm',
|
||||
meta: { title: '订单详情', icon: '', activeMenu: '/trade/trade/order' }
|
||||
}
|
||||
|
@ -165,5 +165,8 @@ export enum DICT_TYPE {
|
||||
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
|
||||
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
|
||||
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
|
||||
PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举
|
||||
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
|
||||
|
||||
// ========== MALL - 物流模块 ==========
|
||||
DELIVERY_TYPE = 'delivery_type' // 配送方式
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="修改订单收货地址" width="35%">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="120px">
|
||||
<el-form-item label="收件人名称">
|
||||
<el-input v-model="formData.receiverName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收件人手机">
|
||||
<el-input v-model="formData.receiverMobile" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收件人地区编号">
|
||||
<el-input v-model="formData.receiverAreaId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收件人详细地址">
|
||||
<el-input v-model="formData.receiverDetailAddress" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { copyValueToTarget } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'OrderAdjustAddressForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = ref({
|
||||
id: 0, // 订单编号
|
||||
receiverName: '', // 收件人名称
|
||||
receiverMobile: '', // 收件人手机
|
||||
receiverAreaId: null, //收件人地区编号
|
||||
receiverDetailAddress: '' //收件人详细地址
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (row: TradeOrderApi.OrderVO) => {
|
||||
resetForm()
|
||||
// 设置数据
|
||||
copyValueToTarget(formData.value, row)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = unref(formData)
|
||||
await TradeOrderApi.adjustAddress(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success', true)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: 0, // 订单编号
|
||||
receiverName: '', // 收件人名称
|
||||
receiverMobile: '', // 收件人手机
|
||||
receiverAreaId: null, //收件人地区编号
|
||||
receiverDetailAddress: '' //收件人详细地址
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="订单调价" width="25%">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="100px">
|
||||
<el-form-item label="应付金额(总)">
|
||||
<el-input v-model="formData.payPrice" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单调价">
|
||||
<el-input-number v-model="formData.adjustPrice" :precision="2" :step="0.1" class="w-100%" />
|
||||
<el-tag class="mt-10px" type="warning">订单调价。 正数,加价;负数,减价</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="调价后">
|
||||
<el-input v-model="formData.newPayPrice" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { convertToInteger, formatToFraction } from '@/utils'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
defineOptions({ name: 'OrderAdjustPriceForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = ref({
|
||||
id: 0, // 订单编号
|
||||
adjustPrice: 0, // 订单调价
|
||||
payPrice: '', // 应付金额(总)
|
||||
newPayPrice: '' // 调价后应付金额(总)
|
||||
})
|
||||
watch(
|
||||
() => formData.value.adjustPrice,
|
||||
(data: number) => {
|
||||
formData.value.newPayPrice = formData.value.payPrice.replace('元', '') * 1 + data + '元'
|
||||
}
|
||||
)
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (row: TradeOrderApi.OrderVO) => {
|
||||
resetForm()
|
||||
formData.value.id = row.id
|
||||
// 设置数据
|
||||
formData.value.adjustPrice = formatToFraction(row.adjustPrice)
|
||||
formData.value.payPrice = formatToFraction(row.payPrice) + '元'
|
||||
dialogVisible.value = true
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = cloneDeep(unref(formData))
|
||||
data.adjustPrice = convertToInteger(data.adjustPrice)
|
||||
delete data.payPrice
|
||||
delete data.newPayPrice
|
||||
await TradeOrderApi.adjustPrice(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success', true)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: 0, // 订单编号
|
||||
adjustPrice: 0, // 订单调价
|
||||
payPrice: '', // 应付金额(总)
|
||||
newPayPrice: '' // 调价后应付金额(总)
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@ -3,10 +3,11 @@
|
||||
<!-- 订单信息 -->
|
||||
<el-descriptions title="订单信息">
|
||||
<el-descriptions-item label="订单号: ">{{ orderInfo.no }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="配送方式: ">
|
||||
<dict-tag :type="DICT_TYPE.DELIVERY_TYPE" :value="orderInfo.deliveryType" />
|
||||
</el-descriptions-item>
|
||||
<!-- TODO 营销活动待实现 -->
|
||||
<el-descriptions-item label="营销活动: ">秒杀活动</el-descriptions-item>
|
||||
<el-descriptions-item label="订单类型: ">
|
||||
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="orderInfo.type" />
|
||||
</el-descriptions-item>
|
||||
@ -37,22 +38,17 @@
|
||||
<!-- 订单状态 -->
|
||||
<el-descriptions :column="1" title="订单状态">
|
||||
<el-descriptions-item label="订单状态: ">
|
||||
<!-- TODO xiaobai:status 一定有值哈,不用判断 -->
|
||||
<dict-tag
|
||||
v-if="orderInfo.status !== ''"
|
||||
:type="DICT_TYPE.TRADE_ORDER_STATUS"
|
||||
:value="orderInfo.status"
|
||||
/>
|
||||
<dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="orderInfo.status" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-class-name="no-colon">
|
||||
<el-button size="small" type="primary">调整价格</el-button>
|
||||
<el-button size="small" type="primary" @click="openForm('adjustPrice')">调整价格</el-button>
|
||||
<el-button size="small" type="primary" @click="openForm('remark')">备注</el-button>
|
||||
<el-button size="small" type="primary" @click="openForm('delivery')">发货</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-button size="small" type="primary">修改地址</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-button size="small" type="primary" @click="openForm('adjustAddress')">
|
||||
修改地址
|
||||
</el-button>
|
||||
<!-- TODO 后台商家也需要收货功能吗? -->
|
||||
<el-button size="small" type="primary">确认收货</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">提醒: </span></template>
|
||||
@ -62,8 +58,6 @@
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 物流信息 TODO -->
|
||||
|
||||
<!-- 商品信息 -->
|
||||
<el-descriptions title="商品信息">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
@ -98,8 +92,6 @@
|
||||
<el-col :span="10" />
|
||||
</el-row>
|
||||
</el-descriptions-item>
|
||||
<!-- 占位 -->
|
||||
<!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="6">
|
||||
<el-descriptions-item label="商品总额: ">
|
||||
@ -114,8 +106,7 @@
|
||||
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">商品优惠: </span></template>
|
||||
<!-- 没理解TODO orderInfo.totalPrice - orderInfo.totalPrice -->
|
||||
{{ formatToFraction(orderInfo.totalPrice - orderInfo.totalPrice) }}元
|
||||
{{ formatToFraction(orderInfo.couponPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">订单优惠: </span></template>
|
||||
@ -149,7 +140,7 @@
|
||||
</el-timeline>
|
||||
</el-descriptions-item>
|
||||
|
||||
<!-- 物流信息 -->
|
||||
<!-- 物流信息 TODO 等物流接口搞定重构一下 -->
|
||||
<!-- TODO @xiaobai:改成一个包裹哈;目前只允许发货一次 -->
|
||||
<el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
|
||||
<!-- 循环包裹物流信息 -->
|
||||
@ -210,15 +201,19 @@
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
<DeliveryOrderForm ref="deliveryOrderFormRef" @success="getDetail" />
|
||||
<OrderRemarksForm ref="orderRemarksFormRef" @success="getDetail" />
|
||||
<DeliveryOrderForm ref="deliveryFormRef" @success="getDetail" />
|
||||
<OrderRemarksForm ref="remarksFormRef" @success="getDetail" />
|
||||
<OrderAdjustAddressForm ref="adjustAddressFormRef" @success="getDetail" />
|
||||
<OrderAdjustPriceForm ref="adjustPriceFormRef" @success="getDetail" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { formatToFraction } from '@/utils'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import OrderRemarksForm from '@/views/mall/trade/order/OrderRemarksForm.vue'
|
||||
import DeliveryOrderForm from '@/views/mall/trade/order/DeliveryOrderForm.vue'
|
||||
import OrderRemarksForm from '@/views/mall/trade/order/components/OrderRemarksForm.vue'
|
||||
import DeliveryOrderForm from '@/views/mall/trade/order/components/DeliveryOrderForm.vue'
|
||||
import OrderAdjustAddressForm from '@/views/mall/trade/order/components/OrderAdjustAddressForm.vue'
|
||||
import OrderAdjustPriceForm from '@/views/mall/trade/order/components/OrderAdjustPriceForm.vue'
|
||||
|
||||
defineOptions({ name: 'TradeOrderDetailForm' })
|
||||
|
||||
@ -287,9 +282,8 @@ const detailGroups = ref([
|
||||
])
|
||||
|
||||
const detailInfo = ref({
|
||||
expressInfo:
|
||||
// 物流信息
|
||||
{
|
||||
expressInfo: {
|
||||
label: '包裹1',
|
||||
name: 'bg1',
|
||||
fhsj: '2022-11-03 16:50:45',
|
||||
@ -333,16 +327,23 @@ const detailInfo = ref({
|
||||
goodsInfo: [] // 商品详情tableData
|
||||
})
|
||||
|
||||
const deliveryOrderFormRef = ref() // 发货表单 Ref
|
||||
const orderRemarksFormRef = ref() // 订单备注表单 Ref
|
||||
|
||||
const deliveryFormRef = ref() // 发货表单 Ref
|
||||
const remarksFormRef = ref() // 订单备注表单 Ref
|
||||
const adjustAddressFormRef = ref() // 收货地址表单 Ref
|
||||
const adjustPriceFormRef = ref() // 订单调价表单 Ref
|
||||
const openForm = (type: string) => {
|
||||
switch (type) {
|
||||
case 'remark':
|
||||
orderRemarksFormRef.value?.open(orderInfo)
|
||||
remarksFormRef.value?.open(orderInfo.value)
|
||||
break
|
||||
case 'delivery':
|
||||
deliveryOrderFormRef.value?.open(orderInfo.id)
|
||||
deliveryFormRef.value?.open(orderInfo.value.id)
|
||||
break
|
||||
case 'adjustAddress':
|
||||
adjustAddressFormRef.value?.open(orderInfo.value)
|
||||
break
|
||||
case 'adjustPrice':
|
||||
adjustPriceFormRef.value?.open(orderInfo.value)
|
||||
break
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="订单备注" width="25%">
|
||||
<Dialog v-model="dialogVisible" title="商家备注" width="25%">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="80px">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="formData.remark" />
|
||||
@ -44,6 +44,7 @@ const submitForm = async () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = unref(formData)
|
||||
console.log(data)
|
||||
await TradeOrderApi.remark(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
@ -58,8 +59,7 @@ const submitForm = async () => {
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: 0, // 订单编号
|
||||
logisticsId: null, // 物流公司编号
|
||||
logisticsNo: '' // 物流编号
|
||||
remark: '' // 订单备注
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
@ -130,10 +130,11 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品原价" prop="price" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(row.price) }}元</template>
|
||||
<el-table-column label="商品原价*数量" prop="price" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ formatToFraction(row.price) }}元 * {{ row.count }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count" width="100" />
|
||||
<el-table-column label="合计" prop="payPrice" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(row.payPrice) }}元</template>
|
||||
</el-table-column>
|
||||
@ -150,7 +151,7 @@
|
||||
{{ formatToFraction(scope.row.payPrice) + '元' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="买家/收货人" min-width="120">
|
||||
<el-table-column label="买家/收货人" min-width="160">
|
||||
<template #default>
|
||||
<div class="flex flex-col">
|
||||
<span>买家:{{ scope.row.user.nickname }}</span>
|
||||
@ -161,8 +162,10 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="配送方式" prop="deliveryType" width="120">
|
||||
<template #default> 快递</template>
|
||||
<el-table-column align="center" label="配送方式" width="120">
|
||||
<template #default>
|
||||
<span>{{ scope.row.deliveryType || '快递' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default>
|
||||
@ -259,8 +262,8 @@
|
||||
|
||||
<script lang="ts" name="Order" setup>
|
||||
import type { FormInstance, TableColumnCtx } from 'element-plus'
|
||||
import DeliveryOrderForm from './DeliveryOrderForm.vue'
|
||||
import OrderRemarksForm from './OrderRemarksForm.vue'
|
||||
import DeliveryOrderForm from './components/DeliveryOrderForm.vue'
|
||||
import OrderRemarksForm from './components/OrderRemarksForm.vue'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { OrderItemRespVO, OrderVO } from '@/api/mall/trade/order'
|
||||
@ -293,7 +296,7 @@ interface SpanMethodProps {
|
||||
}
|
||||
|
||||
const spanMethod = ({ rowIndex, columnIndex }: SpanMethodProps) => {
|
||||
const colIndex = [5, 6, 7, 8]
|
||||
const colIndex = [4, 5, 6, 7]
|
||||
// 处理列
|
||||
if (colIndex.includes(columnIndex)) {
|
||||
// 处理被合并的行
|
||||
|
Loading…
Reference in New Issue
Block a user