diff --git a/src/api/order/index.ts b/src/api/order/index.ts index b45b3c5..1fb2706 100644 --- a/src/api/order/index.ts +++ b/src/api/order/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import type { ApiResult, PageResult } from '@/api'; -import type { Order, OrderParam } from './model'; +import type {Order, OrderParam, OrderPay} from './model'; import { App } from '@/api/app/model'; /** @@ -58,6 +58,15 @@ export async function pageOrderPay(params?: OrderParam) { return Promise.reject(new Error(res.data.message)); } +//续租订单 +export async function addOrderPay(data: OrderPay) { + const res = await request.post>('/shop/order-pay/renew', data); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + /** * 根据id查询订单 */ diff --git a/src/api/order/model/index.ts b/src/api/order/model/index.ts index efe4077..42b7ec3 100644 --- a/src/api/order/model/index.ts +++ b/src/api/order/model/index.ts @@ -94,6 +94,8 @@ export interface OrderPay { // 来源记录的参数 (json格式) orderSourceData?: string; rentOrderId?: number; + //订单金额 + orderPriceInt?:number;//服务端用BigDecimal无法接受,另起一个字段 // 订单编号 orderNo?: string; // 创建时间 diff --git a/src/views/yunxinwei/order/components/order-info.vue b/src/views/yunxinwei/order/components/order-info.vue index 6cd1f29..599be11 100644 --- a/src/views/yunxinwei/order/components/order-info.vue +++ b/src/views/yunxinwei/order/components/order-info.vue @@ -309,9 +309,8 @@ 退租 + >续费该设备 @@ -414,9 +413,10 @@ - @@ -431,7 +431,7 @@ import {formatNumber} from 'ele-admin-pro/es'; import {storeToRefs} from 'pinia'; import {copyText} from '@/utils/common'; import {Order} from '@/api/order/model'; -import OrderOnline from '../components/order-online.vue'; +import OrderXufei from '../components/order-xufei.vue'; import {listEquipmentOrderGoods} from '@/api/apps/equipment/order/goods'; import {EquipmentOrderGoods} from '@/api/apps/equipment/order/goods/model'; import * as EquipmentApi from '@/api/apps/equipment'; @@ -440,14 +440,12 @@ import {ColumnItem, DatasourceFunction} from 'ele-admin-pro/es/ele-pro-table/typ import {listOrder, listOrderPay} from '@/api/order'; import {CopyOutlined} from '@ant-design/icons-vue'; import {EquipmentRecord} from '@/api/apps/equipment/record/model'; -import OrderRefund from "@/views/yunxinwei/order/components/order-refund.vue"; const useForm = Form.useForm; // 是否开启响应式布局 const themeStore = useThemeStore(); const {styleResponsive} = storeToRefs(themeStore); - -const showOrderOnline = ref(false); +const showOrderXufei = ref(false); // 当前编辑数据 const current = ref(null); @@ -736,7 +734,7 @@ const getEquipmentOrderGoods = () => { /* 线下缴费 */ const openOrderOnline = (row?: Order) => { current.value = row ?? null; - showOrderOnline.value = true; + showOrderXufei.value = true; }; const getEquipment = () => { diff --git a/src/views/yunxinwei/order/components/order-online.vue b/src/views/yunxinwei/order/components/order-xufei.vue similarity index 53% rename from src/views/yunxinwei/order/components/order-online.vue rename to src/views/yunxinwei/order/components/order-xufei.vue index e0b7684..4f576dd 100644 --- a/src/views/yunxinwei/order/components/order-online.vue +++ b/src/views/yunxinwei/order/components/order-xufei.vue @@ -13,42 +13,32 @@ > - + + + + + + {{props.data.realName}} + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -69,11 +59,10 @@ import {ref, reactive, watch, computed} from 'vue'; import { FILE_SERVER } from '@/config/setting'; import { useUserStore } from '@/store/modules/user'; import { Equipment } from "@/api/apps/equipment/model"; -import { Order } from "@/api/order/model"; +import {Order, OrderPay} from "@/api/order/model"; +import {addOrderPay} from "@/api/order"; const userStore = useUserStore(); - // 当前用户信息 - const loginUser = computed(() => userStore.info ?? {}); // 是否是修改 const isUpdate = ref(false); const useForm = Form.useForm; @@ -81,7 +70,7 @@ import { Order } from "@/api/order/model"; // 弹窗是否打开 visible: boolean; // 修改回显的数据 - data?: Order | null; + data?: OrderPay | null; }>(); const emit = defineEmits<{ @@ -95,10 +84,19 @@ import { Order } from "@/api/order/model"; const maxable = ref(true); // 表单数据 - const form = reactive({ + const form = reactive({ + rentOrderId:undefined, + orderNo:undefined, equipmentCode: '', - orderId: undefined + orderId: undefined, + startTime:undefined, + expirationTime:undefined, + //订单金额 + orderPriceInt:undefined, + payStatus:20, }); + // 日期范围选择 + const dateRange = ref<[string, string]>(['', '']); // 已上传数据, 可赋初始值用于回显 const images = ref([]); @@ -108,33 +106,26 @@ import { Order } from "@/api/order/model"; emit('update:visible', value); }; - // 表单验证规则 - const rules = reactive({ - equipmentCode: [ - { - required: true, - type: 'string', - message: '请输入设备编码', - trigger: 'blur' - } - ] - }); - - const { resetFields, validate, validateInfos } = useForm(form, rules); + const { resetFields, validate, validateInfos } = useForm(form); /* 保存编辑 */ const save = () => { + const [d1, d2] = dateRange.value ?? []; + + if (dateRange.value[0] === '' || dateRange.value[1] === "" ){ + message.warn("请选择续期时间"); + return; + } + form.startTime =d1 + ' 00:00:00'; + form.expirationTime = d2 + ' 23:59:59'; + form.orderNo=props.data?.orderNo; + form.rentOrderId=props.data?.rentOrderId; + validate() .then(() => { loading.value = true; - // 去除空格 - const data = { - ...form, - orderId: props.data?.orderId, - userId: props.data?.userId - }; // 转字符串 - bindEquipment(data) + addOrderPay(form) .then((msg) => { loading.value = false; message.success(msg); @@ -149,32 +140,15 @@ import { Order } from "@/api/order/model"; .catch(() => {}); }; - const onUpload = (d: ItemType) => { - uploadFile(d.file) - .then((result) => { - form.customerAvatar = result.path; - message.success('上传成功'); - }) - .catch((e) => { - message.error(e.message); - }); - }; - watch( () => props.visible, (visible) => { if (visible) { if (props.data) { loading.value = false; - // 头像赋值 - images.value = []; - if(props.data.customerAvatar){ - images.value.push({ uid:1, url: FILE_SERVER + props.data.customerAvatar, status: '' }); - } assignObject(form, props.data); isUpdate.value = true; } else { - form.customerCode = createCode(); isUpdate.value = false; } } else {