lrf пре 2 година
родитељ
комит
a84c8213b7

+ 0 - 2
app/model/trade/order.js

@@ -17,7 +17,6 @@ const order = {
   status: { type: String, required: false, zh: '订单状态' }, // 字典:order_process
   pay: { type: Object, required: false, zh: '支付数据' }, // 有关支付时间,支付方式,支付订单号内容全都写在这里面
   type: { type: String, required: false, default: '0', zh: '订单类型' }, // 字典:order_type
-  group: { type: String, required: false, zh: '所属团', ref: 'Group.Group' }, //
   inviter: { type: String, required: false, zh: '推荐商品人', ref: 'User.User' }, // 返现部分
 };
 const schema = new Schema(order, { toJSON: { getters: true, virtuals: true } });
@@ -27,7 +26,6 @@ schema.index({ customer: 1 });
 schema.index({ buy_time: 1 });
 schema.index({ no: 1 });
 schema.index({ type: 1 });
-schema.index({ group: 1 });
 schema.index({ inviter: 1 });
 
 schema.plugin(metaPlugin);

+ 0 - 2
app/model/trade/orderDetail.js

@@ -46,7 +46,6 @@ const orderDetail = {
   status: { type: String, required: false, zh: '订单状态' }, // 字典:order_process
   remarks: { type: String, required: false, zh: '订单备注' }, //
   type: { type: String, required: false, default: '0', zh: '订单类型' }, // 字典:order_type
-  group: { type: String, required: false, zh: '所属团', ref: 'Group.Group' }, //
   out_bill: { type: String, required: false, default: '1', zh: '是否出账' }, // 字典:tf
   inviter: { type: String, required: false, zh: '推荐商品人', ref: 'User.User' }, // 返现部分
   transport_type: { type: String, required: false, zh: '快递类型' }, // 字典:transport_type
@@ -63,7 +62,6 @@ schema.index({ buy_time: 1 });
 schema.index({ pay_time: 1 });
 schema.index({ status: 1 });
 schema.index({ type: 1 });
-schema.index({ group: 1 });
 schema.index({ out_bill: 1 });
 schema.index({ inviter: 1 });
 schema.index({ transport_type: 1 });

+ 0 - 16
app/service/trade/afterSale.js

@@ -129,8 +129,6 @@ class AfterSaleService extends CrudService {
         if (uStatus === '4') {
           refundInfo = await this.returnOrder(entity, this.tran);
           update.status = '-4';
-          // 检查是否是团购
-          await this.exitGroup(entity, this.tran);
         }
         update.end_time = moment().format('YYYY-MM-DD HH:mm:ss');
       } else if (type === '5') {
@@ -357,20 +355,6 @@ class AfterSaleService extends CrudService {
 
     return refundInfo;
   }
-  /**
-   * 售后 取消订单 & 拒收处理完成
-   * @param {Object} data 售后修改前的数据
-   * @param {Transaction} tran 数据库事务
-   */
-  async exitGroup(data, tran) {
-    const { order_detail } = data;
-    const orderDetail = await this.orderDetailModel.findById(order_detail);
-    if (!orderDetail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单数据');
-    const { type, group, customer } = orderDetail;
-    if (type !== '1' || !group) return;
-    await this.ctx.service.group.group.refund({ group, customer }, tran);
-  }
-
   /**
    * 判断是否全额退的商品
    * @param {Object} data 售后数据

+ 0 - 2
app/service/trade/orderDetail.js

@@ -218,7 +218,6 @@ class OrderDetailService extends CrudService {
         pay_time: 1,
         status: 1,
         no: 1,
-        group: 1,
         address: 1,
         goods: {
           _id: 1,
@@ -226,7 +225,6 @@ class OrderDetailService extends CrudService {
           freight: 1,
           name: 1,
           buy_num: 1,
-          group_config: 1,
           goods: { name: 1, file: 1 },
           file: 1,
           act: 1,

+ 1 - 7
app/service/trade/pay.js

@@ -17,7 +17,6 @@ class PayService extends CrudService {
     this.payOrderReturnUrl = this.app.config.payReturn.order;
     this.wxDomain = _.get(this.app, 'config.httpPrefix.wechat');
     this.tran = new Transaction();
-    this.joinErrorRefundCode = _.get(this.app, 'config.errcode.groupJoinRefund');
   }
 
   /**
@@ -145,12 +144,7 @@ class PayService extends CrudService {
     } catch (error) {
       console.error(error);
       await this.tran.rollback();
-      let reason = '服务处理发生错误,原路退款!';
-      if (error.errcode === this.joinErrorRefundCode) {
-        reason = '您未能成功参与拼团:拼团人数已满';
-        // 需要删除订单
-        await this.ctx.service.trade.order.cancel({ order_id: _.get(orderData, '_id') });
-      }
+      const reason = '服务处理发生错误,原路退款!';
       // 先退款,所有回调发生错误的单子都需要退掉
       const str = this.ctx.service.util.trade.createNonceStr();
       const obj = {