123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- import { Rule, RuleType } from '@midwayjs/validate';
- import { ApiProperty } from '@midwayjs/swagger';
- import _ = require('lodash');
- import { FrameworkErrorEnum, SearchBase, ServiceError } from 'free-midway-component';
- import { getDataFromTarget } from '../util/util';
- export class FetchVO_groupAfterSale {
- constructor(data: object) {
- for (const key of Object.keys(this)) {
- this[key] = _.get(data, key);
- }
- }
- @ApiProperty({ description: '数据id' })
- _id: string = undefined;
- @ApiProperty({ description: '订单' })
- 'order': string = undefined;
- @ApiProperty({ description: '顾客' })
- 'customer': string = undefined;
- @ApiProperty({ description: '售后类型' })
- 'type': string = undefined;
- @ApiProperty({ description: '申请理由' })
- 'reason': string = undefined;
- @ApiProperty({ description: '申请售后描述' })
- 'desc': string = undefined;
- @ApiProperty({ description: '凭证图片' })
- 'file': Array<any> = undefined;
- @ApiProperty({ description: '快递信息' })
- 'transport': object = undefined;
- @ApiProperty({ description: '售后申请时间' })
- 'apply_time': string = undefined;
- @ApiProperty({ description: '售后结束时间' })
- 'end_time': string = undefined;
- @ApiProperty({ description: '售后状态' })
- 'status': string = undefined;
- @ApiProperty({ description: '退款金额' })
- 'money': number = undefined;
- @ApiProperty({ description: '处理人' })
- 'deal_person': string = undefined;
- }
- export class QueryDTO_groupAfterSale extends SearchBase {
- constructor() {
- const like_prop = [];
- const props = ['order', 'customer', 'type', 'apply_time', 'end_time', 'deal_person', 'status'];
- super({ like_prop, props });
- }
- @ApiProperty({ description: '订单' })
- 'order': string = undefined;
- @ApiProperty({ description: '顾客' })
- 'customer': string = undefined;
- @ApiProperty({ description: '售后类型' })
- 'type': string = undefined;
- @ApiProperty({ description: '售后申请时间' })
- 'apply_time': string = undefined;
- @ApiProperty({ description: '售后结束时间' })
- 'end_time': string = undefined;
- @ApiProperty({ description: '处理人' })
- 'deal_person': string = undefined;
- @ApiProperty({ description: '状态' })
- 'status': string = undefined;
- }
- export class QueryVO_groupAfterSale extends FetchVO_groupAfterSale {}
- export class CreateDTO_groupAfterSale {
- @ApiProperty({ description: '订单' })
- @Rule(RuleType['string']().required().error(new ServiceError('缺少订单信息', FrameworkErrorEnum.NEED_BODY)))
- 'order': string = undefined;
- @ApiProperty({ description: '顾客' })
- @Rule(RuleType['string']().required().error(new ServiceError('缺少订单信息', FrameworkErrorEnum.NEED_BODY)))
- 'customer': string = undefined;
- @ApiProperty({ description: '售后类型' })
- @Rule(RuleType['string']().required().error(new ServiceError('缺少订单信息', FrameworkErrorEnum.NEED_BODY)))
- 'type': string = undefined;
- @ApiProperty({ description: '申请理由' })
- @Rule(RuleType['string']().empty())
- 'reason': string = undefined;
- @ApiProperty({ description: '申请售后描述' })
- @Rule(RuleType['string']().empty())
- 'desc': string = undefined;
- @ApiProperty({ description: '凭证图片' })
- @Rule(RuleType['array']().empty())
- 'file': Array<any> = undefined;
- @ApiProperty({ description: '快递信息' })
- @Rule(RuleType['object']().empty())
- 'transport': object = undefined;
- @ApiProperty({ description: '售后申请时间' })
- @Rule(RuleType['string']().empty())
- 'apply_time': string = undefined;
- @ApiProperty({ description: '售后结束时间' })
- @Rule(RuleType['string']().empty())
- 'end_time': string = undefined;
- @ApiProperty({ description: '售后状态' })
- @Rule(RuleType['string']().empty())
- 'status': string = undefined;
- @ApiProperty({ description: '退款金额' })
- @Rule(RuleType['number']().empty())
- 'money': number = undefined;
- @ApiProperty({ description: '处理人' })
- @Rule(RuleType['string']().empty())
- 'deal_person': string = undefined;
- }
- export class CreateVO_groupAfterSale extends FetchVO_groupAfterSale {}
- export class UpdateDTO_groupAfterSale extends CreateDTO_groupAfterSale {
- @ApiProperty({ description: '数据id' })
- @Rule(RuleType['string']().empty())
- '_id': string = undefined;
- @ApiProperty({ description: '团长建议' })
- @Rule(RuleType['string']().empty())
- leader_suggest: boolean = undefined;
- }
- export class UpdateVO_groupAfterSale extends FetchVO_groupAfterSale {}
- export class AdminView {
- constructor(data) {
- const dl = ['_id', 'apply_time', 'end_time', 'type', 'reason', 'desc', 'file', 'status', 'transport', 'money', 'leader_suggest'];
- for (const i of dl) this[i] = _.get(data, i);
- this.customer = getDataFromTarget(data, 'customer', ['_id', 'name', 'phone']);
- this.address = getDataFromTarget(data, 'order.address', ['_id', 'name', 'phone', 'province', 'city', 'area', 'address']);
- this.shop = getDataFromTarget(data, 'order.shop', ['_id', 'name']);
- this.goods = getDataFromTarget(data, 'order.goods', ['_id', 'name', 'file']);
- this.goodsSpec = getDataFromTarget(data, 'order.goodsSpec', ['_id', 'name', 'file']);
- let price = 0;
- // const is_leader = _.get(data, 'customer.is_leader', '1');
- // if (is_leader === '0') price = _.get(data, 'order.config.leader_price');
- // else
- price = _.get(data, 'order.config.price');
- this.goodsSpec.price = price;
- this.goodsSpec.freight = _.get(data, 'order.config.freight');
- this.goodsSpec.num = _.get(data, 'order.num');
- this.pay = _.get(data, 'order.pay.pay_money');
- this.deal_person = getDataFromTarget(data, 'deal_person', ['_id', 'name']);
- }
- customer: {
- _id: string;
- name: string;
- phone: string;
- };
- address: {
- _id: string;
- name: string;
- phone: string;
- province: string;
- city: string;
- area: string;
- address: string;
- };
- shop: {
- _id: string;
- name: string;
- };
- goods: {
- _id: string;
- name: string;
- file: Array<any>;
- };
- goodsSpec: {
- _id: string;
- name: string;
- file: Array<any>;
- num: number;
- price: number;
- freight: number;
- };
- total_detail: Array<any>;
- apply_time: string;
- end_time: string;
- type: string;
- reason: string;
- desc: string;
- deal_person: string;
- file: Array<any>;
- status: string;
- transport: object;
- money: number;
- pay: number; // 订单支付总额
- leader_suggest: boolean;
- }
- export class UserListView {
- constructor(data) {
- const dl = ['_id', 'apply_time', 'type', 'status', 'money', 'leader_suggest'];
- for (const i of dl) this[i] = _.get(data, i);
- this.shop = getDataFromTarget(data, 'order.shop', ['_id', 'name']);
- this.goods = getDataFromTarget(data, 'order.goods', ['_id', 'name', 'file']);
- this.spec = getDataFromTarget(data, 'order.goodsSpec', ['_id', 'name', 'file']);
- }
- _id: string;
- apply_time: string;
- shop: {
- _id: string;
- name: string;
- };
- type: string;
- status: string;
- money: number;
- goods: {
- _id: string;
- name: string;
- file: Array<any>;
- };
- spec: {
- _id: string;
- name: string;
- file: Array<any>;
- };
- leader_suggest: boolean;
- }
|