Przeglądaj źródła

修改购物车

zs 1 rok temu
rodzic
commit
25dbf840e9
1 zmienionych plików z 10 dodań i 7 usunięć
  1. 10 7
      src/service/Cart.service.ts

+ 10 - 7
src/service/Cart.service.ts

@@ -164,13 +164,16 @@ export class CartService extends BaseService<modelType> {
             res = await this.offModel.findById(result.community).lean();
           } else res = await this.offModel.findById(result.street).lean();
         } else assert(result.street, '缺少街道信息!');
-        if (res) obj.address = res.address;
-        if (!ShopSetting) obj.status = '4';
-        if (!Collection) obj.status = '8';
-        obj.s_accounting = ShopSetting.accounting;
-        obj.s_leader = ShopSetting.leader;
-        obj.c_accounting = Collection.accounting;
-        obj.c_leader = Collection.leader;
+        if (res.address) obj.address = res.address;
+        else assert(res.address, '缺少收货地址信息!');
+        if (ShopSetting) {
+          obj.s_accounting = ShopSetting.accounting;
+          obj.s_leader = ShopSetting.leader;
+        } else obj.status = '4';
+        if (Collection) {
+          obj.c_accounting = Collection.accounting;
+          obj.c_leader = Collection.leader;
+        } else assert(Collection, '缺少回款审批信息!');
         obj.total_money = data.totalMoney;
         obj.buy_time = moment().format('YYYY-MM-DD HH:mm:ss');
         order = await this.orderModel.create(obj);