|
@@ -76,18 +76,56 @@
|
|
|
<a-modal v-model:open="orderRefund" title="发起退款" @ok="handleRefund" :confirmLoading="RefundLoading">
|
|
<a-modal v-model:open="orderRefund" title="发起退款" @ok="handleRefund" :confirmLoading="RefundLoading">
|
|
|
<BasicForm :showActionButtonGroup="false" @register="refundFrom" required style="margin: 50px 50px 0 50px" />
|
|
<BasicForm :showActionButtonGroup="false" @register="refundFrom" required style="margin: 50px 50px 0 50px" />
|
|
|
</a-modal>
|
|
</a-modal>
|
|
|
|
|
+ <a-modal v-model:open="orderPriceEdit" title="价格修改" width="80%" @ok="handleOrderPriceEdit" :confirmLoading="PriceEditLoading">
|
|
|
|
|
+ <BasicTable
|
|
|
|
|
+ title="订单信息"
|
|
|
|
|
+ @register="registerTableEdit"
|
|
|
|
|
+ @edit-end="handleEditEnd"
|
|
|
|
|
+ @edit-cancel="handleEditCancel"
|
|
|
|
|
+ :beforeEditSubmit="beforeEditSubmit"
|
|
|
|
|
+ />
|
|
|
|
|
+ <Divider></Divider>
|
|
|
|
|
+ <div class="pa4">
|
|
|
|
|
+ <TypographyTitle :level="5">费用信息</TypographyTitle>
|
|
|
|
|
+ <div class="mt3 border border-solid pa3 rounded-md">
|
|
|
|
|
+ <div class="flex items-center justify-between font-semibold">
|
|
|
|
|
+ <div>费用类型</div>
|
|
|
|
|
+ <div>金额/元</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <Divider></Divider>
|
|
|
|
|
+ <div class="flex items-center justify-between">
|
|
|
|
|
+ <div>商品总额</div>
|
|
|
|
|
+ <div v-if="editOrderInfo && editOrderInfo.orderProInfoList && editOrderInfo.orderProInfoList.length > 0">
|
|
|
|
|
+ <a-tag color="purple">{{ editOrderInfo?.orderProInfoList[0].originalPrice }}</a-tag>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex items-center justify-between pt2">
|
|
|
|
|
+ <div>团购优惠</div>
|
|
|
|
|
+ <div v-if="editOrderInfo && editOrderInfo.orderProInfoList && editOrderInfo.orderProInfoList.length > 0">
|
|
|
|
|
+ <a-tag color="green">-{{ editOrderInfo?.orderProInfoList[0].originalPrice - editOrderInfo?.orderProInfoList[0].price }} </a-tag>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="mt3"></div>
|
|
|
|
|
+ <a-descriptions bordered>
|
|
|
|
|
+ <a-descriptions-item label="需付款">
|
|
|
|
|
+ <a-tag color="orange">{{ calculateTotalPrice() }}</a-tag>
|
|
|
|
|
+ </a-descriptions-item>
|
|
|
|
|
+ </a-descriptions>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </a-modal>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import orderModelView from './components/orderModelView.vue';
|
|
import orderModelView from './components/orderModelView.vue';
|
|
|
- import { Image, message, Modal, QRCode } from 'ant-design-vue';
|
|
|
|
|
- import { ref, reactive, computed, unref } from 'vue';
|
|
|
|
|
|
|
+ import { Divider, Image, message, Modal, QRCode, TypographyTitle } from 'ant-design-vue';
|
|
|
|
|
+ import { ref, reactive, computed, nextTick } from 'vue';
|
|
|
import { BasicTable, TableAction } from '/@/components/Table';
|
|
import { BasicTable, TableAction } from '/@/components/Table';
|
|
|
import { useForm, BasicForm, FormSchema } from '/@/components/Form';
|
|
import { useForm, BasicForm, FormSchema } from '/@/components/Form';
|
|
|
import { useModal } from '/@/components/Modal';
|
|
import { useModal } from '/@/components/Modal';
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
- import { columns, searchFormSchema, afterSaleStatus, orderStatus } from './order.data';
|
|
|
|
|
- import { list, exportData, queryEvents, queryProject, putProfitSharing, putQueryProfitSharing, submitOrderRefund } from './order.api';
|
|
|
|
|
|
|
+ import { columns, searchFormSchema, afterSaleStatus, orderStatus, editColumns } from './order.data';
|
|
|
|
|
+ import { list, exportData, queryEvents, queryProject, putProfitSharing, putQueryProfitSharing, submitOrderRefund, changeOrder } from './order.api';
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
|
|
|
@@ -120,6 +158,17 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const [registerTable, { reload }, { selectedRowKeys }] = tableContext;
|
|
const [registerTable, { reload }, { selectedRowKeys }] = tableContext;
|
|
|
|
|
+
|
|
|
|
|
+ // 编辑价格表格注册
|
|
|
|
|
+ const { tableContext: editTableContext } = useListPage({
|
|
|
|
|
+ tableProps: {
|
|
|
|
|
+ // api: '',
|
|
|
|
|
+ columns: editColumns,
|
|
|
|
|
+ pagination: false,
|
|
|
|
|
+ actionColumn: null,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ const [registerTableEdit, { reload: reloadEdit, setProps }] = editTableContext;
|
|
|
//自定义表单字段
|
|
//自定义表单字段
|
|
|
const formSchemas: FormSchema[] = [
|
|
const formSchemas: FormSchema[] = [
|
|
|
{
|
|
{
|
|
@@ -190,6 +239,49 @@
|
|
|
actionColOptions: { span: 17 },
|
|
actionColOptions: { span: 17 },
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ function calculateTotalPrice() {
|
|
|
|
|
+ if (!editOrderInfo.value || !editOrderInfo.value.orderProInfoList) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ return editOrderInfo.value.orderProInfoList
|
|
|
|
|
+ .reduce((total, item) => {
|
|
|
|
|
+ const price = item.modifiedPrice !== undefined ? item.modifiedPrice : '0.00';
|
|
|
|
|
+ return total + parseFloat(price || 0);
|
|
|
|
|
+ }, 0)
|
|
|
|
|
+ .toFixed(2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 改价1提交
|
|
|
|
|
+ const PriceEditLoading = ref(false);
|
|
|
|
|
+ const totalPrice = ref(0);
|
|
|
|
|
+
|
|
|
|
|
+ async function handleOrderPriceEdit() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ PriceEditLoading.value = true;
|
|
|
|
|
+ // 组织请求参数
|
|
|
|
|
+ const orderItemList = editOrderInfo.value.orderProInfoList.map((item) => ({
|
|
|
|
|
+ productId: item.productId,
|
|
|
|
|
+ originalPrice: item.modifiedPrice !== undefined ? item.modifiedPrice : item.originalPrice,
|
|
|
|
|
+ }));
|
|
|
|
|
+ // 计算总价
|
|
|
|
|
+ totalPrice.value = orderItemList.reduce((sum, item) => sum + parseFloat(item.originalPrice || 0), 0).toFixed(2);
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ orderId: editOrderInfo.value.id,
|
|
|
|
|
+ price: totalPrice.value,
|
|
|
|
|
+ orderItemList: orderItemList,
|
|
|
|
|
+ };
|
|
|
|
|
+ await changeOrder(params);
|
|
|
|
|
+ message.success('价格修改成功');
|
|
|
|
|
+ orderPriceEdit.value = false;
|
|
|
|
|
+ reload();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('价格修改失败:', error);
|
|
|
|
|
+ // message.error('价格修改失败,请稍后重试');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ PriceEditLoading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 编辑事件
|
|
* 编辑事件
|
|
|
*/
|
|
*/
|
|
@@ -251,6 +343,9 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const orderPriceEdit = ref(false);
|
|
|
|
|
+ const editOrderInfo = ref({});
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 操作栏
|
|
* 操作栏
|
|
|
*/
|
|
*/
|
|
@@ -280,6 +375,17 @@
|
|
|
onClick: submitRefund.bind(null, record),
|
|
onClick: submitRefund.bind(null, record),
|
|
|
ifShow: (record.orderType == 3 || record.orderType == 4) && (record.orderStatus == 1 || record.orderStatus == 2),
|
|
ifShow: (record.orderType == 3 || record.orderType == 4) && (record.orderStatus == 1 || record.orderStatus == 2),
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '改价',
|
|
|
|
|
+ ifShow: record.orderStatus==0,
|
|
|
|
|
+ onClick: async () => {
|
|
|
|
|
+ console.log(record, '选中数据');
|
|
|
|
|
+ orderPriceEdit.value = true;
|
|
|
|
|
+ await nextTick();
|
|
|
|
|
+ editOrderInfo.value = record;
|
|
|
|
|
+ setProps({ dataSource: record.orderProInfoList });
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|