Jelajahi Sumber

1、订单商品信息补充货号;2、打印信息内容补充;

Lawsun_M 1 tahun lalu
induk
melakukan
3ff02caa56

+ 1 - 0
app/controller/home/order.js

@@ -655,6 +655,7 @@ module.exports = class OrderController extends shopController {
         [ seq.col('products.product_id'), 'product_id' ],
         [ seq.col('products.category_id'), 'category_id' ],
         [ seq.col('products.product_name'), 'product_name' ],
+        [ seq.col('products.product_sn'), 'product_sn' ],
         [ seq.col('products.product_image'), 'product_image' ],
         [ seq.col('products.shop_price'), 'shop_price' ],
         [ seq.col('products.dinning_coin_amount'), 'dinning_coin_amount' ],

+ 4 - 0
app/models/mysql/orders_products.js

@@ -27,6 +27,10 @@ module.exports = app => {
       type: DataTypes.STRING(255),
       allowNull: true,
     },
+    product_sn: {
+      type: DataTypes.STRING(255),
+      allowNull: true,
+    },
     product_image: {
       type: DataTypes.STRING(255),
       allowNull: true,

+ 5 - 2
app/service/order.js

@@ -129,6 +129,7 @@ class OrderService extends ShopService {
       include: [
         { model: that.app.model.PaysConfig, attributes: [], as: 'pays_config' },
         { model: that.app.model.Users, as: 'users', attributes: [] },
+        { model: that.app.model.Users, as: 'inviter', attributes: [] },
         { model: that.app.model.Payments, as: 'payments', attributes: [] },
         {
           model: that.app.model.OrdersProducts, as: 'orders_products', attributes: {
@@ -138,7 +139,8 @@ class OrderService extends ShopService {
       ],
       attributes: [
         [ seq.col('pays_config.pay_name'), 'pay_name' ],
-        [ seq.col('users.nickname'), 'nickname' ],
+        [ seq.col('users.nickname'), 'userName' ],
+        [ seq.col('inviter.nickname'), 'inviterName' ],
         [ seq.col('payments.total_fee'), 'total_fee' ],
         'order_status', 'pay_sn', 'consignee', 'mobile', 'address',
         'create_time', 'order_sn', 'order_amount', 'surplus_amout', 'user_remarks',
@@ -156,9 +158,10 @@ class OrderService extends ShopService {
       .toString() : '0.00';
     const goods = [];
     result2.orders_products.forEach(item => {
-      goods.push(`${item.product_name}${item.volume > 0 ? item.volume + 'ml' : ''}\tx\t${item.product_count}`);
+      goods.push(`${item.product_name}${'【' + item.product_sn + '】'}${item.volume > 0 ? item.volume + 'ml' : ''}\tx\t${item.product_count}`);
     });
     result2.goods = goods.join('\n');
+    result2.nickname = result2.inviterName ? result2.userName + '【邀请人:' + result2.inviterName + '】' : result2.userName;
     return result2;
   }