orderPrintDialog.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <el-dialog
  3. class="common-dialog"
  4. :title="$t('ding-dan-da-yin-yu-lan')"
  5. :visible="showDialog"
  6. width="380px"
  7. @close="cancel"
  8. append-to-body
  9. destroy-on-close
  10. >
  11. <div v-if="orderInfo.id" class="print-area" id="printArea">
  12. <div class="base-info">
  13. <div class="name" v-if="storeInfo">{{ storeInfo.name }}</div>
  14. <div class="table" v-if="orderInfo.tableInfo">
  15. <span>{{ $t('zhuo-ma') }}:</span>
  16. {{ orderInfo.tableInfo.code }}
  17. </div>
  18. <div class="no">
  19. <span>{{ $t('dan-hao') }}:</span>
  20. {{ orderInfo.orderSn }}
  21. </div>
  22. </div>
  23. <div>****************************************</div>
  24. <div class="goods-list" v-if="orderInfo.goods.length > 0">
  25. <div class="goods-item" v-for="(goodsInfo, index) in orderInfo.goods">
  26. <span class="item">{{ index + 1 }}.{{ goodsInfo.name }}</span>
  27. <span class="item">x{{ goodsInfo.num }}</span>
  28. <span class="item">{{ $pinia._s.get('user').getSymbol }}{{ goodsInfo.price }}</span>
  29. </div>
  30. </div>
  31. <div v-if="orderInfo.goods.length > 0">****************************************</div>
  32. <div class="member-info">
  33. <div class="item" v-if="orderInfo.isVisitor == 'N'">
  34. <span class="t">{{ $t('hui-yuan-ming-cheng') }}:</span>
  35. {{ orderInfo.userInfo.name }}
  36. </div>
  37. <div class="item" v-if="orderInfo.isVisitor == 'N'">
  38. <span class="t">{{ $t('hui-yuan-hao-ma') }}:</span>
  39. {{ orderInfo.userInfo.userNo ? orderInfo.userInfo.userNo : '-' }}
  40. </div>
  41. <div class="item" v-if="orderInfo.isVisitor == 'Y'">
  42. <span class="t">{{ $t('hui-yuan-xin-xi') }}:</span>
  43. {{ $t('wu') }}
  44. </div>
  45. </div>
  46. <div v-if="orderInfo.orderMode == 'express' && orderInfo.address">
  47. ****************************************
  48. </div>
  49. <div class="address-info" v-if="orderInfo.orderMode == 'express' && orderInfo.address">
  50. <div class="item">
  51. {{ $t('shou-huo-ren-ming') }}:{{ orderInfo.address.name ? orderInfo.address.name : '-' }}
  52. </div>
  53. <div class="item">
  54. {{ $t('lian-xi-dian-hua') }}:{{
  55. orderInfo.address.mobile ? orderInfo.address.mobile : $t('wu')
  56. }}
  57. </div>
  58. <div class="item">
  59. {{ $t('xiang-xi-di-zhi') }}:{{ orderInfo.address.provinceName
  60. }}{{ orderInfo.address.cityName }}{{ orderInfo.address.regionName
  61. }}{{ orderInfo.address.detail }}
  62. </div>
  63. </div>
  64. <div>****************************************</div>
  65. <div class="total-info">
  66. <div class="item">{{ $t('ding-dan-lei-xing') }}:{{ orderInfo.typeName }}</div>
  67. <div class="item">{{ $t('ding-dan-shi-jian') }}:{{ orderInfo.createTime }}</div>
  68. <div class="item">
  69. {{ $t('you-hui-jin-e') }}:
  70. <span class="discount">
  71. {{ $pinia._s.get('user').getSymbol }}{{ orderInfo.discount.toFixed(2) }}
  72. </span>
  73. </div>
  74. <div class="item">
  75. {{ $t('serviceFee') }}:
  76. <span class="discount">
  77. {{ $pinia._s.get('user').getSymbol }}{{ orderInfo.serviceFee.toFixed(2) }}
  78. </span>
  79. </div>
  80. <div class="item">
  81. {{ $t('ying-shou-jin-e') }}:
  82. <span class="amount">
  83. {{ $pinia._s.get('user').getSymbol }}{{ orderInfo.payAmount.toFixed(2) }}
  84. </span>
  85. </div>
  86. </div>
  87. </div>
  88. <div slot="footer" class="dialog-footer">
  89. <el-button
  90. type="primary"
  91. class="main-button"
  92. @click="handlePrint(printObj)"
  93. v-print="printObj"
  94. >
  95. {{ $t('da-yin') }}
  96. </el-button>
  97. <el-button @click="cancel()">{{ $t('qu-xiao') }}</el-button>
  98. </div>
  99. </el-dialog>
  100. </template>
  101. <script>
  102. export default {
  103. props: {
  104. showDialog: {
  105. type: [Boolean],
  106. default: () => false,
  107. },
  108. orderInfo: {
  109. type: [Object],
  110. default: () => {},
  111. },
  112. storeInfo: {
  113. type: [Object],
  114. default: () => {},
  115. },
  116. },
  117. data() {
  118. return {
  119. printObj: {
  120. id: 'printArea',
  121. popTitle: this.$t('ding-dan-ming-xi'),
  122. extraCss: '',
  123. preview: false,
  124. previewTitle: this.$t('yu-lan-de-biao-ti'),
  125. previewPrintBtnLabel: this.$t('yu-lan-jie-shu-kai-shi-da-yin'),
  126. extraHead: '',
  127. standard: 'loose',
  128. },
  129. }
  130. },
  131. methods: {
  132. handlePrint() {
  133. this.$emit('closeDialog', 'printOrder')
  134. },
  135. cancel() {
  136. this.$emit('closeDialog', 'printOrder')
  137. },
  138. },
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. .print-area {
  143. font-size: 14px;
  144. border: solid 1px #ccc;
  145. padding: 30px 10px 30px 10px;
  146. overflow: scroll;
  147. width: 100%;
  148. .base-info {
  149. margin-bottom: 10px;
  150. .name {
  151. font-weight: bold;
  152. margin-bottom: 5px;
  153. }
  154. }
  155. .goods-list {
  156. margin-top: 10px;
  157. margin-bottom: 15px;
  158. .goods-item {
  159. margin-bottom: 10px;
  160. }
  161. }
  162. .member-info {
  163. margin-top: 10px;
  164. margin-bottom: 20px;
  165. .item {
  166. clear: both;
  167. }
  168. }
  169. .address-info {
  170. margin-top: 10px;
  171. margin-bottom: 20px;
  172. }
  173. .total-info {
  174. .item {
  175. margin-bottom: 2px;
  176. .amount {
  177. font-weight: bold;
  178. font-size: 28px;
  179. }
  180. }
  181. }
  182. }
  183. </style>
  184. <style media="print" lang="scss">
  185. @page {
  186. size: auto;
  187. margin: 0mm;
  188. }
  189. @media print {
  190. html {
  191. height: auto;
  192. width: auto;
  193. margin: 0px;
  194. }
  195. body {
  196. border: solid 1px #ffffff;
  197. }
  198. #printArea {
  199. font-size: 14px;
  200. display: block;
  201. min-width: 320px;
  202. min-height: 420px;
  203. margin-top: 60px;
  204. .base-info {
  205. margin-bottom: 10px;
  206. .name {
  207. font-weight: bold;
  208. margin-bottom: 5px;
  209. }
  210. }
  211. .goods-list {
  212. margin-bottom: 20px;
  213. .goods-item {
  214. margin-bottom: 50px;
  215. .item {
  216. margin-right: 10px;
  217. margin-bottom: 10px;
  218. }
  219. }
  220. }
  221. .member-info {
  222. margin-top: 20px;
  223. margin-bottom: 20px;
  224. margin-top: 10px;
  225. margin-bottom: 20px;
  226. .item {
  227. clear: both;
  228. }
  229. }
  230. .total-info {
  231. margin-top: 20px;
  232. margin-bottom: 60px;
  233. .item {
  234. margin-bottom: 2px;
  235. .amount {
  236. font-weight: bold;
  237. font-size: 28px;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. </style>