|
@@ -69,6 +69,18 @@ module.exports = class OrdersController extends ManagerController {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 确认收货验证器
|
|
|
+ * @date:2024/7/8
|
|
|
+ */
|
|
|
+ get receiveValidate() {
|
|
|
+ const that = this;
|
|
|
+ return {
|
|
|
+ order_status: that.ctx.rules.default(3)
|
|
|
+ .number(),
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* [logsValidate 订单操作日志验证器]
|
|
|
* @return {[type]} [description]
|
|
@@ -201,6 +213,34 @@ module.exports = class OrdersController extends ManagerController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * [orderDeliver 订单确认收货操作]
|
|
|
+ * @return {[type]} [description]
|
|
|
+ */
|
|
|
+ async orderReceive() {
|
|
|
+ const that = this;
|
|
|
+ let transaction;
|
|
|
+ try {
|
|
|
+ const data = await that.ctx.validate(that.receiveValidate, await that.ctx.anyParse());
|
|
|
+ transaction = await that.app.model.transaction();
|
|
|
+ const updateBean = await that.app.comoBean.instance({
|
|
|
+ order_status: 3,
|
|
|
+ }, { where: { order_id: data.order_id }, transaction });
|
|
|
+ const result = await that.service.base.update(updateBean, that.useModel, '订单确认收货失败,请稍候重试');
|
|
|
+ // 记录订单操作日志
|
|
|
+ await that.service.order.orderAction({
|
|
|
+ admin_id: data.admin_id,
|
|
|
+ order_id: data.order_id,
|
|
|
+ action_desc: '订单确认收货',
|
|
|
+ });
|
|
|
+ await transaction.commit();
|
|
|
+ return that.ctx.appJson(that.app.szjcomo.appResult('SUCCESS', result, false));
|
|
|
+ } catch (err) {
|
|
|
+ if (transaction) await transaction.rollback();
|
|
|
+ return that.ctx.appJson(that.app.szjcomo.appResult(err.message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* [orderLogs 查看订单操作日志]
|
|
|
* @return {[type]} [description]
|