|
@@ -2,19 +2,19 @@
|
|
|
const Schema = require('mongoose').Schema;
|
|
|
const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
|
|
-const MoneyPlugin = require('naf-framework-mongoose-free/lib/model/type-money-plugin');
|
|
|
-
|
|
|
// 订单详情
|
|
|
const orderDetail = {
|
|
|
order: { type: String, required: false, zh: '总订单', ref: 'Trade.order' }, //
|
|
|
shop: { type: String, required: false, zh: '店铺', ref: 'Shop.Shop' }, //
|
|
|
- customer: { type: String, required: false, zh: '顾客', ref: 'User.User' }, //
|
|
|
- address: { type: String, required: false, zh: '邮寄地址', ref: 'User.address' }, //
|
|
|
+ customer: { type: String, required: false, zh: '顾客', ref: 'User.Customer' }, //
|
|
|
+ address: { type: Object, required: false, zh: '邮寄地址' }, //
|
|
|
+ no: { type: String, required: false, zh: '订单号' }, //
|
|
|
+ transport: { type: Object, required: false, zh: '快递' }, //
|
|
|
goods: { type: Array, required: false, zh: '商品快照清单' }, // 下单时,商品的属性设置
|
|
|
- freight: { type: String, required: false, zh: '运费' }, //
|
|
|
+ total_detail: { type: Object, required: false, zh: '金额明细' }, //
|
|
|
buy_time: { type: String, required: false, zh: '下单时间' }, //
|
|
|
pay_time: { type: String, required: false, zh: '支付时间' }, //
|
|
|
- discount: { type: Array, required: false, zh: '优惠' }, // 优惠情况汇总:e.g.:多个可重叠的优惠券
|
|
|
+ discount: { type: Array, required: false, zh: '优惠' }, //
|
|
|
status: { type: String, required: false, zh: '订单状态' }, // 字典:order_process
|
|
|
};
|
|
|
const schema = new Schema(orderDetail, { toJSON: { getters: true, virtuals: true } });
|
|
@@ -24,12 +24,12 @@ schema.index({ order: 1 });
|
|
|
schema.index({ shop: 1 });
|
|
|
schema.index({ customer: 1 });
|
|
|
schema.index({ address: 1 });
|
|
|
+schema.index({ no: 1 });
|
|
|
schema.index({ buy_time: 1 });
|
|
|
schema.index({ pay_time: 1 });
|
|
|
schema.index({ status: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
|
-schema.plugin(MoneyPlugin({ zh: '总金额', required: false, key: 'total' }));
|
|
|
|
|
|
module.exports = app => {
|
|
|
const { mongoose } = app;
|