浏览代码

[Fix] Add time in order

Ark 4 年之前
父节点
当前提交
2e69632e56
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/api/controller/order.js

+ 4 - 3
src/api/controller/order.js

@@ -7,7 +7,7 @@ module.exports = class extends Base {
    * @return {Promise} []
    */
   async listAction() {
-    const orderList = await this.model('order').where({ user_id: this.getLoginUserId() }).page(1, 10).countSelect();
+    const orderList = await this.model('order').where({ user_id: this.getLoginUserId() }).page(1, 20).countSelect();
     const newOrderList = [];
     for (const item of orderList.data) {
       // 订单的商品
@@ -50,7 +50,8 @@ module.exports = class extends Base {
 
     // 订单状态的处理
     orderInfo.order_status_text = await this.model('order').getOrderStatusText(orderId);
-    orderInfo.add_time = moment.unix(orderInfo.add_time).format('YYYY-MM-DD HH:mm:ss'); // windows下会出错
+    orderInfo.add_time = new Date(orderInfo.add_time * 1000000)
+      .toLocaleString('zh-cn', { hour12: false });
     orderInfo.final_pay_time = moment('001234', 'Hmmss').format('mm:ss');
     // 订单最后支付时间
     if (orderInfo.order_status === 0) {
@@ -262,7 +263,7 @@ module.exports = class extends Base {
       goods_id: checkedGoodsId,
       goods_sn: checkedGoods.goods_sn,
       product_id: checkedGoods.product_id,
-      goods_name: checkedGoods.goods_name,
+      goods_name: checkedGoods.name,
       list_pic_url: checkedGoods.list_pic_url,
       market_price: checkedGoods.market_price,
       retail_price: checkedGoods.retail_price,