|
@@ -8,8 +8,7 @@ const MoneyPlugin = require('naf-framework-mongoose-free/lib/model/type-money-pl
|
|
|
const order = {
|
|
|
customer: { type: String, required: false, zh: '顾客', ref: 'User.Customer' }, //
|
|
|
address: { type: String, required: false, zh: '邮寄地址', ref: 'User.address' }, //
|
|
|
- shop: { type: String, required: false, zh: '店铺', ref: 'Shop.Shop' }, //
|
|
|
- discount: { type: Array, required: false, zh: '优惠' }, // 优惠情况汇总:e.g.:多个可重叠的优惠券
|
|
|
+ total_detail: { type: Array, required: false, zh: '总金额明细' }, // 运费,优惠,活动,商品原费用的和
|
|
|
buy_time: { type: String, required: false, zh: '下单时间' }, //
|
|
|
pay_time: { type: String, required: false, zh: '支付时间' }, //
|
|
|
pay_id: { type: String, required: false, zh: '支付id' }, //
|
|
@@ -20,14 +19,12 @@ const schema = new Schema(order, { toJSON: { getters: true, virtuals: true } });
|
|
|
schema.index({ id: 1 });
|
|
|
schema.index({ 'meta.createdAt': 1 });
|
|
|
schema.index({ customer: 1 });
|
|
|
-schema.index({ shop: 1 });
|
|
|
schema.index({ buy_time: 1 });
|
|
|
schema.index({ pay_id: 1 });
|
|
|
schema.index({ pay_no: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
|
schema.plugin(MoneyPlugin({ zh: '总金额', required: false, key: 'total' }));
|
|
|
-schema.plugin(MoneyPlugin({ zh: '运费', required: false, key: 'freight' }));
|
|
|
|
|
|
module.exports = app => {
|
|
|
const { mongoose } = app;
|