| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- import type { Coupon2Entity, PageConfig } from '@vben/types';
- import dayjs from 'dayjs';
- import { requestClient } from '#/api/request';
- interface Coupon2PartialEntity
- extends Partial<Omit<Coupon2Entity, 'coupon2code'>> {
- coupon2code?: string;
- }
- interface Coupon2QueryParams
- extends Omit<Coupon2PartialEntity, 'coupon2adddatetime'>,
- PageConfig {
- couponmc?: string;
- coupon2code?: string;
- usersname?: string;
- usersphone?: string;
- productsname?: string;
- productsmodel?: string;
- productsjjlx?: string;
- coupon2adddatetime?: string[];
- }
- /**
- * 我的优惠券信息_列表
- */
- export async function getCoupon2ListApi(data: Coupon2QueryParams) {
- return requestClient.post<any>('/api/query/list?pagevalue=101', {
- pageindex: data.pageindex,
- rows: data.rows,
- });
- }
- /**
- * 我的优惠券信息_详情
- */
- export async function getCoupon2DetailApi(data: { coupon2sid: string }) {
- return requestClient.post<any>(
- '/api/query/view?pagevalue=102',
- {
- 'coupon2sid.value': data.coupon2sid,
- },
- { formatData: true }, // 格式化返回数据
- );
- }
- /**
- * 我的优惠券信息_新增
- */
- export async function addCoupon2Api(data: Coupon2Entity) {
- return requestClient.post<any>('/api/add?pagevalue=40', { ...data });
- }
- /**
- * 我的优惠券信息_编辑
- */
- export async function editCoupon2Api(data: Coupon2Entity) {
- return requestClient.post<any>('/api/up?pagevalue=41', { ...data });
- }
- /**
- * 我的优惠券_审核_列表(用于admin)
- */
- export async function getCoupon2AuditListApi(data: Coupon2QueryParams) {
- const {
- pageindex,
- rows,
- couponmc,
- coupon2code,
- usersname,
- usersphone,
- coupon2sype,
- productsname,
- productsmodel,
- productsjjlx,
- coupon2adddatetime,
- } = data;
- const queryParams: Record<string, any> = {
- pageindex,
- rows,
- };
- if (couponmc) {
- queryParams['coupon2mc.like'] = couponmc;
- }
- if (coupon2code) {
- queryParams['coupon2code.like'] = coupon2code;
- }
- if (usersname) {
- queryParams['usersname.like'] = usersname;
- }
- if (usersphone) {
- queryParams['usersphone.like'] = usersphone;
- }
- if (coupon2sype !== undefined && coupon2sype !== null) {
- queryParams['coupon2sype.value'] = coupon2sype;
- }
- if (productsname) {
- queryParams['productsname.like'] = productsname;
- }
- if (productsmodel) {
- queryParams['productsmodel.like'] = productsmodel;
- }
- if (productsjjlx) {
- queryParams['productsjjlx.like'] = productsjjlx;
- }
- if (coupon2adddatetime && coupon2adddatetime.length > 0) {
- queryParams['coupon2adddatetime.start'] = dayjs(coupon2adddatetime[0])
- .startOf('day')
- .format('YYYY-MM-DD HH:mm:ss');
- queryParams['coupon2adddatetime.end'] = dayjs(coupon2adddatetime[1])
- .endOf('day')
- .format('YYYY-MM-DD HH:mm:ss');
- }
- queryParams['coupon2adddatetime.sort'] = 1;
- return requestClient.post<any>('/api/query/list?pagevalue=117', queryParams);
- }
- /**
- * 我的优惠券_编辑_列表(用于经销商查询优惠劵列表)
- */
- export async function getCoupon2EditListApi(data: Coupon2QueryParams) {
- const {
- pageindex,
- rows,
- couponmc,
- coupon2code,
- usersname,
- usersphone,
- coupon2sype,
- productsname,
- productsmodel,
- productsjjlx,
- coupon2adddatetime,
- } = data;
- const queryParams: Record<string, any> = {
- pageindex,
- rows,
- };
- if (couponmc) {
- queryParams['coupon2mc.like'] = couponmc;
- }
- if (coupon2code) {
- queryParams['coupon2code.like'] = coupon2code;
- }
- if (usersname) {
- queryParams['usersname.like'] = usersname;
- }
- if (usersphone) {
- queryParams['usersphone.like'] = usersphone;
- }
- if (coupon2sype !== undefined && coupon2sype !== null) {
- queryParams['coupon2sype.value'] = coupon2sype;
- }
- if (productsname) {
- queryParams['productsname.like'] = productsname;
- }
- if (productsmodel) {
- queryParams['productsmodel.like'] = productsmodel;
- }
- if (productsjjlx) {
- queryParams['productsjjlx.like'] = productsjjlx;
- }
- if (coupon2adddatetime && coupon2adddatetime.length > 0) {
- queryParams['coupon2adddatetime.start'] = dayjs(coupon2adddatetime[0])
- .startOf('day')
- .format('YYYY-MM-DD HH:mm:ss');
- queryParams['coupon2adddatetime.end'] = dayjs(coupon2adddatetime[1])
- .endOf('day')
- .format('YYYY-MM-DD HH:mm:ss');
- }
- queryParams['coupon2adddatetime.sort'] = 1;
- return requestClient.post<any>('/api/query/list?pagevalue=120', queryParams);
- }
- /**
- * 我的优惠券_审核_详情
- */
- export async function getCoupon2AuditDetailApi(data: { coupon2sid: string }) {
- return requestClient.post<any>(
- '/api/query/view?pagevalue=118',
- {
- 'coupon2sid.value': data.coupon2sid,
- },
- { formatData: true },
- );
- }
- /**
- * 更新购机者信息
- */
- export async function updateCoupon2UserInfoApi(data: any) {
- return requestClient.post<any>('/api/nlua/call?pagevalue=119', {
- ...data,
- });
- }
- /**
- * 我的优惠券信息_审核
- */
- export async function auditCoupon2Api(data: Coupon2Entity) {
- return requestClient.post<any>('/api/up?pagevalue=104', { ...data });
- }
|