|
@@ -14,8 +14,12 @@ import { useVbenModal } from '@vben/common-ui';
|
|
|
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
|
-import { getCoupon1ListApi, receiveCouponApi } from '#/api/coupon/coupon1';
|
|
|
|
|
-import { getProductListApi } from '#/api/product';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ getCoupon1DetailApi,
|
|
|
|
|
+ getCoupon1ListApi,
|
|
|
|
|
+ receiveCouponApi,
|
|
|
|
|
+} from '#/api/coupon/coupon1';
|
|
|
|
|
+import { getProductDetailApi, getProductListApi } from '#/api/product';
|
|
|
import { getCustomerListApi } from '#/api/user';
|
|
import { getCustomerListApi } from '#/api/user';
|
|
|
import UploadFile from '#/components/upload-file/index.vue';
|
|
import UploadFile from '#/components/upload-file/index.vue';
|
|
|
|
|
|
|
@@ -245,19 +249,13 @@ async function fetchProductInfo(productId: string) {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
productInfoLoading.value = true;
|
|
productInfoLoading.value = true;
|
|
|
- const response = await getProductListApi({
|
|
|
|
|
|
|
+ const response = await getProductDetailApi({
|
|
|
productsid: productId,
|
|
productsid: productId,
|
|
|
- pageindex: 1,
|
|
|
|
|
- rows: 1,
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- selectedProductInfo.value =
|
|
|
|
|
- response &&
|
|
|
|
|
- response.Data &&
|
|
|
|
|
- Array.isArray(response.Data) &&
|
|
|
|
|
- response.Data.length > 0
|
|
|
|
|
- ? response.Data[0]
|
|
|
|
|
- : null;
|
|
|
|
|
|
|
+ if (response && Object.keys(response).length > 0) {
|
|
|
|
|
+ selectedProductInfo.value = response;
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('获取产品详细信息失败', error);
|
|
console.error('获取产品详细信息失败', error);
|
|
|
ElMessage.error('获取产品详细信息失败');
|
|
ElMessage.error('获取产品详细信息失败');
|
|
@@ -286,19 +284,13 @@ async function fetchCouponInfo(couponId: string) {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
couponInfoLoading.value = true;
|
|
couponInfoLoading.value = true;
|
|
|
- const response = await getCoupon1ListApi({
|
|
|
|
|
|
|
+ const response = await getCoupon1DetailApi({
|
|
|
couponid: couponId,
|
|
couponid: couponId,
|
|
|
- pageindex: 1,
|
|
|
|
|
- rows: 1,
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- selectedCouponInfo.value =
|
|
|
|
|
- response &&
|
|
|
|
|
- response.Data &&
|
|
|
|
|
- Array.isArray(response.Data) &&
|
|
|
|
|
- response.Data.length > 0
|
|
|
|
|
- ? response.Data[0]
|
|
|
|
|
- : null;
|
|
|
|
|
|
|
+ if (response && Object.keys(response).length > 0) {
|
|
|
|
|
+ selectedCouponInfo.value = response;
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('获取优惠券详细信息失败', error);
|
|
console.error('获取优惠券详细信息失败', error);
|
|
|
ElMessage.error('获取优惠券详细信息失败');
|
|
ElMessage.error('获取优惠券详细信息失败');
|
|
@@ -308,6 +300,7 @@ async function fetchCouponInfo(couponId: string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 用户类型切换,重置表单
|
|
|
function handleUserTypeChange() {
|
|
function handleUserTypeChange() {
|
|
|
formData.usersname = '';
|
|
formData.usersname = '';
|
|
|
formData.idNumber = '';
|
|
formData.idNumber = '';
|
|
@@ -320,6 +313,7 @@ function handleUserTypeChange() {
|
|
|
formRef.value?.clearValidate();
|
|
formRef.value?.clearValidate();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 确认
|
|
|
async function handleSubmit(): Promise<boolean> {
|
|
async function handleSubmit(): Promise<boolean> {
|
|
|
if (!formRef.value) return false;
|
|
if (!formRef.value) return false;
|
|
|
try {
|
|
try {
|
|
@@ -428,6 +422,7 @@ const [Modal, modalApi] = useVbenModal({
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 领取优惠劵对外暴露方法,外部调用
|
|
|
function openReceiveCouponModal(data?: {
|
|
function openReceiveCouponModal(data?: {
|
|
|
couponId?: string;
|
|
couponId?: string;
|
|
|
merchantId?: string;
|
|
merchantId?: string;
|