<template>
  <v-app>
    <v-main>
      <!-- <snt-navbar :api-url="apiUrl" /> -->
      <snt-bubble />

      <!-- <SntBubble /> -->
      <SntNavbar active="contact" />
      <v-container>
        <SntPrinter
          :items="canvas"
          :headers="qr"
          :footers="qr"
          :callback="printerCallback"
          :height="1122"
          :width="794"
          :inner-height="1122"
          :inner-width="794" />
        <SntDataSpreadsheet
          :headers="headers"
          name="test">
          <template #header>
            <SntDataSpreadsheetTabs
              :items="[
                {
                  label: 'สร้างลูกค้า'
                },
                {
                  label: 'แก้ไขสินค้าในหมวดหมู่ลูกค้า'
                }
              ]" />
          </template>
          Test
        </SntDataSpreadsheet>
      </v-container>
    </v-main>
  </v-app>
</template>

<script>
import { VApp, VMain, VContainer } from 'vuetify/lib'
import gql from 'graphql-tag'
import { SntPrinter } from '@/components/SntPrinter'
 import { SntDataSpreadsheet, SntDataSpreadsheetTabs } from '@/components/SntDataSpreadsheet'
import SntBubble from './components/SntBubble/SntBubble.vue'
// import { SntBubble } from '@/components/SntBubble'
import { SntNavbar } from '@/components/SntNavbar'

const GET_ORDER_LIST_PRINT = gql`
  query (
    $perPage: Int
    $page: Int
    $ids: [ID!]
    $orderStatus: OrderFilterEnum
    $dateType: OrderQueryDateTypeEnum
    $startDate: Time
    $endDate: Time
    $startTime: Time
    $endTime: Time
  ) {
    orderList(
      perPage: $perPage
      page: $page
      ids: $ids
      orderStatus: $orderStatus
      dateType: $dateType
      startDate: $startDate
      endDate: $endDate
      startTime: $startTime
      endTime: $endTime
    ) {
      pagesCount
      nodesCount
      nodes {
        id
        name
        price
        quantity
        barcode
        orderBank
        address
        tel
        taxInvoice
        storefrontChangeMoney
        storefrontReceiveMoney
        marketplaceDiscount
        marketplaceId
        promoCodeDiscount
        shipFromName
        shipFromAddress
        taxId
        tag
        annotation
        contactMethod
        invoiceNumber
        closedNote
        shippopTrackingCode
        shippingSortingCode
        shippingType
        printerName
        paymentByName
        customer {
          id
          tagList
        }
        stock {
          id
          name
          tel
          taxId
          address
          orderNumberPrefix
        }
        shop {
          id
          taxId
          tel
        }
        reseller {
          id
          tel
          rewardValue
          resellerAddress
        }
        promoCode {
          id
          code
        }
        orderDiscount
        shippingFee
        purchases {
          id
          name
          price
          quantity
          discount
          pictureUrl
        }
        setPurchases {
          id
          name
          price
          quantity
          pictureUrl
        }
        shop {
          id
          shopurl
          facebookPageId
          facebookPages
        }
        createdAt
        transferredAt
        taxInvoiceDate
        printedAt
        markTransferredAt
        closedAt
      }
    }
  }
`

export default {
  name: 'App',
  components: {
    VApp,
    VMain,
    VContainer,
    SntPrinter,
    SntBubble,
    SntNavbar,
    SntDataSpreadsheet,
    SntDataSpreadsheetTabs
  },
  data () {
    return {
      apiUrl: process.env.VUE_APP_API,
      canvas: [
  {
    id: '683d619f-3947-40f9-bd0b-4d0ec9ce6482',
    type: 'date',
    tag: 'div',
    data: 'order.created_at',
    fx: {
      dateFormat: {
        name: 'dateFormat',
        value: '%d/%m/%Y'
      },
      dateDisplayType: {
        name: 'dateDisplayType',
        value: 'date'
      }
    },
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '10px',
        width: '200px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: 'aba992e9-36c8-4ccf-b1a5-c6ecbae4e19c',
    type: 'recipient',
    data: 'order.name',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '70px',
        width: '120px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: '01f7bbcb-4ce1-47c4-8f17-4d85677e7a33',
    type: 'text',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '40px',
        width: '40px',
        height: '30px',
        fontSize: '14px',
        textAlign: 'left',
        overflow: 'hidden',
        whiteSpace: 'pre-wrap',
        fontWeight: 'bold'
      }
    },
    children: [
      'ผู้รับ'
    ]
  },
  {
    id: 'dda2a0a3-2cea-48da-bf1d-e0915415dc42',
    type: 'address',
    data: 'order.reseller_address',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '100px',
        width: '200px',
        height: '70px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: '9df8490f-e7b0-4539-b843-5c0647d7ce12',
    type: 'line',
    tag: 'div',
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '180px',
        width: '280px',
        height: '2px',
        borderColor: '#E5E5E5FF',
        borderTopWidth: '2px',
        borderRightWidth: '0px',
        borderLeftWidth: '0px',
        borderBottomWidth: '0px',
        borderStyle: 'solid'
      }
    },
    children: []
  },
  {
    id: '1da42c99-535c-4203-b6d1-ae1500b70e6f',
    type: 'parcelNumber',
    data: 'order.closed_note',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '120px',
        top: '200px',
        width: '140px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: '4f621b71-5d90-4c6d-8933-c1cad84bbc92',
    type: 'text',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '200px',
        width: '100px',
        height: '30px',
        fontSize: '14px',
        textAlign: 'left',
        overflow: 'hidden',
        whiteSpace: 'pre-wrap'
      }
    },
    children: [
      'เลขที่ใบส่งของ:'
    ]
  },
  {
    id: 'df72a247-ec85-4d3b-b22e-bbaf3f7c1be5',
    type: 'text',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '230px',
        width: '60px',
        height: '30px',
        fontSize: '14px',
        textAlign: 'left',
        overflow: 'hidden',
        whiteSpace: 'pre-wrap'
      }
    },
    children: [
      'วันที่ออก:'
    ]
  },
  {
    id: '8f6fc996-c85d-477b-b110-b9bb81932e19',
    type: 'date',
    tag: 'div',
    data: 'order.tax_invoice_date',
    fx: {
      dateFormat: {
        name: 'dateFormat',
        value: '%d/%m/%Y %H:%M'
      },
      timeDisplayType: {
        name: 'timeDisplayType',
        value: 'time'
      }
    },
    properties: {
      style: {
        position: 'absolute',
        left: '80px',
        top: '230px',
        width: '200px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: 'f312cad7-025b-41f9-90bd-82b7031c48d7',
    type: 'text',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '260px',
        width: '110px',
        height: '30px',
        fontSize: '14px',
        textAlign: 'left',
        overflow: 'hidden',
        whiteSpace: 'pre-wrap'
      }
    },
    children: [
      'รูปแบบการจัดส่ง:'
    ]
  },
  {
    id: '327f1635-b347-4dcf-a20a-50103d98dfa2',
    type: 'shipping',
    data: 'order.shipping_type',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '130px',
        top: '260px',
        width: '120px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  },
  {
    id: '3713fbf8-eaab-4fbe-b2fb-bb9423ac11dc',
    type: 'line',
    tag: 'div',
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '300px',
        width: '280px',
        height: '2px',
        borderColor: '#E5E5E5FF',
        borderTopWidth: '2px',
        borderRightWidth: '0px',
        borderLeftWidth: '0px',
        borderBottomWidth: '0px',
        borderStyle: 'solid'
      }
    },
    children: []
  },
  {
    id: '07b7e357-02cc-412e-abcf-3b5112f37ecb',
    type: 'products',
    tag: 'div',
    data: null,
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '10px',
        top: '320px',
        width: '280px',
        height: '180px',
        overflow: 'hidden'
      }
    },
    children: [
      {
        tag: 'table',
        data: null,
        fx: {},
        properties: {
          style: {
            width: '100%',
            borderCollapse: 'collapse'
          }
        },
        children: [
          {
            tag: 'thead',
            data: null,
            fx: {},
            properties: {},
            children: [
              {
                tag: 'tr',
                data: null,
                fx: {},
                properties: {
                  style: {
                    fontSize: '14px',
                    height: '36px',
                    fontWeight: 'bold',
                    fontStyle: 'normal',
                    color: '#000000'
                  }
                },
                children: [
                  {
                    tag: 'td',
                    data: null,
                    fx: {},
                    properties: {
                      style: {
                        textAlign: 'left',
                        padding: '0 4px'
                      }
                    },
                    children: [
                      'ชื่อสินค้า'
                    ]
                  },
                  {
                    tag: 'td',
                    data: null,
                    fx: {},
                    properties: {
                      style: {
                        textAlign: 'right',
                        padding: '0 4px'
                      }
                    },
                    children: [
                      'จำนวนที่ซื้อ'
                    ]
                  }
                ]
              }
            ]
          },
          {
            tag: 'tbody',
            data: null,
            fx: {},
            properties: {},
            children: [
              {
                tag: 'tr',
                data: 'purchases',
                fx: {},
                properties: {
                  style: {
                    fontSize: '14px',
                    height: '32px',
                    fontWeight: 'normal',
                    fontStyle: 'normal',
                    color: '#000000'
                  }
                },
                children: [
                  {
                    tag: 'td',
                    data: 'name',
                    fx: {},
                    properties: {
                      style: {
                        textAlign: 'left',
                        borderTop: '1px solid #ddd',
                        borderBottom: '1px solid #ddd',
                        padding: '0 4px'
                      }
                    },
                    children: []
                  },
                  {
                    tag: 'td',
                    data: 'quantity',
                    fx: {},
                    properties: {
                      style: {
                        textAlign: 'right',
                        borderTop: '1px solid #ddd',
                        borderBottom: '1px solid #ddd',
                        padding: '0 4px'
                      }
                    },
                    children: []
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    id: 'ac85e3fa-9d8f-45e6-9b0c-7f449f79c8b7',
    type: 'tag',
    data: 'order.tags_list',
    tag: 'div',
    fx: {},
    properties: {
      style: {
        position: 'absolute',
        left: '150px',
        top: '70px',
        width: '120px',
        height: '20px',
        fontSize: '14px',
        overflow: 'hidden'
      }
    },
    children: []
  }
      ],
      qr: [
        {
          id: '11eb21a4-e6e6-429a-9512-59e395c205e1',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '110px',
              width: '790px',
              height: '30px',
              fontSize: '20px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap',
              fontWeight: 'normal'
            }
          },
          children: [
            'QR Code'
          ]
        },
        {
          id: 'b3e7d33e-2b23-42c5-90bd-83b89e428e1e',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '150px',
              width: '790px',
              height: '30px',
              fontSize: '20px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap',
              fontWeight: 'normal'
            }
          },
          children: [
            'ใบเตรียมสินค้า'
          ]
        },
        {
          id: 'bd596a8f-0685-4dc4-9a88-328b7ccbcc53',
          type: 'image',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '230px',
              top: '210px',
              width: '350px',
              height: '280px',
              fontSize: '14px',
              overflow: 'hidden',
              backgroundSize: 'contain',
              backgroundPosition: 'center center',
              backgroundRepeat: 'no-repeat',
              backgroundImage: ''
            }
          },
          children: []
        },
        {
          id: '495fcdf8-a279-4e71-bbb9-9bfc966f85e0',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '500px',
              width: '790px',
              height: '30px',
              fontSize: '18px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'รายละเอียดการพิมพ์'
          ]
        },
        {
          id: '9392692f-63f5-42d5-ba4c-9566875ff7bf',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '530px',
              width: '790px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'พิมพ์ ใบเตรียมสินค้า'
          ]
        },
        {
          id: '26b54cae-533f-42f7-a022-a7170ed9fb11',
          type: 'fx',
          data: 'set_order.quantity',
          tag: 'div',
          fx: {
            numberDisplayType: {
              name: 'numberDisplayType',
              value: 'number'
            },
            digit: {
              name: 'digit',
              value: 4
            },
            decimal: {
              name: 'decimal',
              value: 2
            }
          },
          properties: {
            style: {
              position: 'absolute',
              left: '370px',
              top: '560px',
              width: '110px',
              height: '20px',
              fontSize: '14px',
              overflow: 'hidden',
              textAlign: 'right'
            }
          },
          children: []
        },
        {
          id: '200a404a-b0d7-4e80-91cd-61f8f837b852',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '280px',
              top: '560px',
              width: '120px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'รายการพิมพ์'
          ]
        },
        {
          id: '3a90c040-483c-4bab-8179-76fa2e3086a0',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '490px',
              top: '560px',
              width: '50px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'ออเดอร์'
          ]
        },
        {
          id: '7e448198-78c9-41cb-95bd-58a12ae1788e',
          type: 'numberProductInOrder',
          tag: 'div',
          data: 'order.quantity',
          fx: {
            numberDisplayType: {
              name: 'numberDisplayType',
              value: 'number'
            }
          },
          properties: {
            style: {
              position: 'absolute',
              left: '370px',
              top: '590px',
              width: '100px',
              height: '20px',
              fontSize: '14px',
              overflow: 'hidden',
              textAlign: 'right'
            }
          },
          children: []
        },
        {
          id: 'cac68ea2-51c9-46d6-afd7-e7972ef20815',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '280px',
              top: '590px',
              width: '80px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'จำนวนสินค้า'
          ]
        },
        {
          id: '2da10a1f-496a-4c0e-860f-c00b4d33a5db',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '490px',
              top: '590px',
              width: '120px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'รายการ'
          ]
        },
        {
          id: 'c485afef-c9f0-4d7a-a847-8b072f0933f9',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '280px',
              top: '620px',
              width: '60px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'พิมพ์เมื่อ'
          ]
        },
        {
          id: '4ac750e1-d16b-4bd9-b217-2ce6b68591bd',
          type: 'date',
          tag: 'div',
          data: 'order.printed_at',
          fx: {
            dateFormat: {
              name: 'dateFormat',
              value: '%d/%m/%Y %H:%M'
            },
            timeDisplayType: {
              name: 'timeDisplayType',
              value: 'word'
            }
          },
          properties: {
            style: {
              position: 'absolute',
              left: '380px',
              top: '620px',
              width: '150px',
              height: '20px',
              fontSize: '14px',
              overflow: 'hidden',
              textAlign: 'right'
            }
          },
          children: []
        },
        {
          id: '6eaef695-8e10-4bb7-8a3c-d6be89f97c18',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '280px',
              top: '650px',
              width: '30px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'left',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'โดย'
          ]
        },
        {
          id: '8f6f7e87-2186-44dc-a987-f395eb19faf4',
          type: 'publisher',
          data: 'current_user_name',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '380px',
              top: '650px',
              width: '150px',
              height: '20px',
              fontSize: '14px',
              overflow: 'hidden',
              textAlign: 'right'
            }
          },
          children: []
        },
        {
          id: '2273b4ba-7c97-49da-8516-ef9c18477812',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '720px',
              width: '790px',
              height: '30px',
              fontSize: '16px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap',
              fontWeight: 'bold'
            }
          },
          children: [
            'วิธีใช้งาน'
          ]
        },
        {
          id: '0d93f6b5-ff1f-4157-ba45-fed6b61e689d',
          type: 'text',
          tag: 'div',
          fx: {},
          properties: {
            style: {
              position: 'absolute',
              left: '0px',
              top: '780px',
              width: '790px',
              height: '30px',
              fontSize: '14px',
              textAlign: 'center',
              overflow: 'hidden',
              whiteSpace: 'pre-wrap'
            }
          },
          children: [
            'สแกน QR Code ผ่านช่อง ”ค้นหา” ในหน้าออเดอร์ของ Shipnity'
          ]
        }
      ],
      headers: [
        {
          ordering: 11,
          text: 'tags',
          textTh: 'แท็ก',
          value: 'tags',
          style: 0,
          bodyStyle: 2,
          width: 140,
          placeholder: ['Tag, Tag', ''],
          suggestItems: ['AAA', 'BBB'],
          suggestIcon: `data:image/svg+xml;base64, ${ btoa(`
            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="16" height="16" viewBox="0 0 24 24" fill="#de6b4f">
              <path d="
                M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,
                0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,
                1 12,20Z" />
            </svg>`)}`,
          default: true
        },
        {
          ordering: 11,
          text: 'xxx',
          textTh: 'แท็ก',
          value: 'xxx',
          style: 0,
          bodyStyle: 2,
          width: 140,
          placeholder: ['Tag, Tag', ''],
          suggestItems: ['AAA', 'BBB'],
          default: true
        }
      ]
    }
  },
  methods: {
    printerCallback ({ page, perPage }) {
      return this.$apollo.query({
        query: GET_ORDER_LIST_PRINT,
        variables: this.$_.defaults({
          page,
          perPage
        }, {
          ids: ['u7tuMNF', 'ARVmsUY']
        })
      }).then(({ data: { orderList } }) => {
        const raws = orderList.nodes.map(this.mapData)
        return {
          nodesCount: orderList.nodesCount,
          pagesCount: orderList.pagesCount,
          nodes: raws
        }
      })
    },
    mapData (order) {
      const purchases = this.$_.concat(order.purchases, order.setPurchases)
      const tax = ((order.price * 7) / 107)
      return {
        // วันที่
        currentTime: new Date(),
        // คนพิมพ์
        currentUserName: '',
        currentShop: {
          // เบอร์โทรศัพท์
          tel: order.shop?.tel,
          // เลขประจำตัวผู้เสียภาษี
          taxId: order.shop?.taxId
        },
        order: {
          // ชื่อผู้รับ
          name: order.name,
          // จำนวนสินค้า
          quantity: order.quantity,
          // จำนวนรายการ
          purchasesSize: purchases.length,
          // ยอดรวม
          price: order.price,
          // ภาษี 7%
          tax,
          // บาร์โค้ด
          barcode: order.barcode,
          shippingBarcode: '',
          // ที่อยู่
          address: order.address,
          addressWithoutZipcode: '',
          zipcode: '',
          shipFromAddress: order.shipFromAddress,
          shipFromAddresssWithoutZipcode: '',
          shipFromZipcode: '',
          resellerAddress: order.reseller?.resellerAddress,
          resellerAddressWithoutZipcode: '',
          resellerZipcode: '',
          // Tags
          tagsList: order.customer?.tagList,
          //  ชื่อใน Social
          tag: order.tag,
          //  ธนาคารโอนเข้า
          orderBank: order.orderBank,
          // ช่องทางการติดต่อ
          contactMethod: order.contactMethod,
          // เบอร์โทรศัพท์
          tel: order.tel,
          stockTel: order.stock?.tel,
          resellerTel: order.reseller?.tel,
          // เลขประจำตัวผู้เสียภาษี
          taxId: order.taxId,
          stockTaxId: order.stock?.taxId,
          // เลขที่กำกับ
          invoiceNumber: order.invoiceNumber,
          taxInvoice: order.taxInvoice,
          // วันที่
          createdAt: order.createdAt,
          transferredAt: order.transferredAt,
          taxInvoiceDate: order.taxInvoiceDate,
          printedAt: order.printedAt,
          markTransferredAt: order.markTransferredAt,
          closedAt: order.closedAt,
          // การจัดส่ง
          shippingType: order.shippingType,
          // ค่าส่ง
          shippingFee: order.shippingFee,
          // ชื่อผู้ส่ง
          shipFromName: order.shipFromName,
          // ส่วนลดท้ายบิล
          orderDiscount: order.orderDiscount,
          // โค้ดส่วนลด
          promoCode: order.promoCode?.code,
          // ส่วนลดจาก Promo
          promoCodeDiscount: order.promoCodeDiscount,
          //  หมายเหตุออเดอร์
          annotation: order.annotation,
          // ชื่อคลังสินค้า
          stockName: order.stock?.name,
          // ที่อยู่คลัง
          stockAddress: order.stock?.address,
          // Prefix คลัง
          stockPrefix: order.stock?.orderNumberPrefix,
          //  เลขพัสดุ
          closedNote: order.closedNote,
          // เลข Sorting ขนส่ง
          shippingSortingCode: order.shippingSortingCode,
          // เลขพัสดุขนส่ง
          shippingTrackingCode: order.shippopTrackingCode,
          // จำนวนเงินที่ได้รับ
          storefrontReceiveMoney: order.storefrontReceiveMoney,
          // จำนวนเงินทอน
          storefrontChangeMoney: order.storefrontChangeMoney,
          //  เลขที่ออเดอร์บน Marketplace
          marketplaceId: order.marketplaceId,
          //  ส่วนลดจาก Marketplace
          marketplaceDiscount: order.marketplaceDiscount,
          // รายการสินค้า
          purchases,
          // คนสร้างออเดอร์
          seller: ''
        },
        reseller: {
          rewardValue: order.reseller?.rewardValue || 0
        }
      }
    }
  }
}

</script>

<style lang="scss">
  @import '~@/assets/scss/styles.scss';
  @import '~@/assets/scss/vuetify.scss';
</style>
