Title1

Title2

Title3

2-7 flex

flex 樣版(訂單完成畫面)


    //---------------------------------- flex(訂單完成)
    let messages = [{
      "type": "flex",
      "altText": "訂單完成",//訊息副標題
      "contents": flexTemplate()
    }];

 

flexTemplate()


/*============================================
  flexTemplate
  https://developers.line.biz/flex-simulator/  
============================================*/
function flexTemplate() {
  // let order = {
  //   sn: '',
  //   date: '',
  //   userId: 'userId',
  //   group: 'group',
  //   name: 'xxx',
  //   prod_sn: 'prod_sn',
  //   title: 'Brown Cafe',
  //   unit: '個',
  //   price: 200,
  //   amount: 3,
  //   total: 600,
  //   pic: 'https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png'
  // }

  let content = 'xxx 您好,您的訂購資料:' + '\n';
  content += '商品單位: ' + '個' + '\n';
  content += '商品單價: ' + '200' + ' 元\n';
  content += '訂購數量: ' + '3' + '\n';
  content += '合計金額: ' + '600' + ' 元\n';
  let messages = {
    "type": "bubble",
    "hero": {
      "type": "image",
      "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",//圖片
      "size": "full",
      "aspectRatio": "20:13",
      "aspectMode": "cover"
    },
    "body": {
      "type": "box",
      "layout": "vertical",
      "contents": [
        {
          "type": "text",
          "text": "Brown Cafe",//標題
          "weight": "bold",
          "size": "xl"
        },
        {
          "type": "text",
          "text": content,//內容
          "wrap": true,
          "color": "#666666",
          "size": "sm",
        }
      ]
    }
  }
  return messages;
}