Invoice.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="invoice">
  3. <div class="gap10 invoice-title">
  4. <div class="line_vertical"></div>
  5. <div class="">{{ $t('personalCenter.myInvoice') }}</div>
  6. </div>
  7. <div class="invoice-list">
  8. <div v-for="(item, index) in list" :key="index" class="li">
  9. <div class="">
  10. <div class="btn" :class="{'btn-active':item.invoiceStatus == 2}">{{ item.invoiceStatusName }}</div>
  11. </div>
  12. <div class="invoice-list-t flex-center-between">
  13. <div class="">{{ item.content.name }}</div>
  14. <div class="">¥{{ item.content.price }}</div>
  15. </div>
  16. <div class="flex-center-between invoice-list-c">
  17. <div class="">{{ $t('personalCenter.orderNumber') }}:</div>
  18. <div class="">{{ item.orderNo }}</div>
  19. </div>
  20. <div class="flex-center-between invoice-list-time">
  21. <div class="">{{ $t('common.orderCreateTime') }}:</div>
  22. <div class="">{{ item.createTime }}</div>
  23. </div>
  24. <div v-if="item.invoiceStatus == 2" class="flex-center-between invoice-list-b">
  25. <div class=""></div>
  26. <div class="" @click="lookItem(item)">
  27. <img src="/src/assets/imgs/my/jilu@2x.png" alt="">
  28. <span>{{ $t('common.viewDetails') }}</span>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <template v-if="list.length">
  34. <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
  35. @page-change="handlePageChange" />
  36. </template>
  37. <el-empty v-else :description="$t('common.empty')" />
  38. <el-dialog v-model="dialogVisible" :title="$t('common.Detail')" width="700">
  39. <el-form :model="invoiceData" label-position="top">
  40. <el-row :gutter="16">
  41. <el-col :span="12">
  42. <el-form-item :label="$t('personalCenter.gfmc')">
  43. <el-input v-model="invoiceData.invoiceTitle" disabled />
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12" v-if="invoiceData.invoiceType">
  47. <el-form-item :label="$t('personalCenter.code')">
  48. <el-input v-model="invoiceData.taxNumber" disabled />
  49. </el-form-item>
  50. </el-col>
  51. </el-row>
  52. <template v-if="invoiceData.invoiceType">
  53. <el-row :gutter="16">
  54. <el-col :span="12">
  55. <el-form-item :label="$t('personalCenter.companyAddress')">
  56. <el-input v-model="invoiceData.otherInfo.address" disabled />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item :label="$t('personalCenter.companyPhone')">
  61. <el-input v-model="invoiceData.otherInfo.mobile" disabled />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row :gutter="16">
  66. <el-col :span="12">
  67. <el-form-item :label="$t('personalCenter.companyBank')">
  68. <el-input v-model="invoiceData.otherInfo.bank" disabled />
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="12">
  72. <el-form-item :label="$t('personalCenter.bankAccount')">
  73. <el-input v-model="invoiceData.otherInfo.account" disabled />
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. </template>
  78. </el-form>
  79. <template #footer>
  80. <div class="dialog-footer">
  81. <!-- <el-button @click="dialogVisible = false">Cancel</el-button> -->
  82. <el-button type="primary" @click="handleClick">{{ $t('personalCenter.downloadInvoice') }}</el-button>
  83. </div>
  84. </template>
  85. </el-dialog>
  86. </div>
  87. </template>
  88. <script setup lang="ts">
  89. import Pagination from '@/components/Pagination.vue'
  90. import { invoiceList } from '@/api/my.js'
  91. import { ref, onMounted } from 'vue'
  92. const list = ref([])
  93. const form = ref({
  94. pageNum: 1,
  95. pageSize: 10,
  96. total: 0,
  97. orderByColumn: 'id',
  98. isAsc: 'desc'
  99. })
  100. const dialogVisible = ref(false);
  101. const invoiceData = ref({})
  102. const lookItem = (item) => {
  103. invoiceData.value = item;
  104. dialogVisible.value = true;
  105. }
  106. // 查看发票
  107. const handleClick = () => {
  108. location.href = invoiceData.value.invoiceUrl;
  109. }
  110. // 获取列表
  111. const getList = async () => {
  112. let res = await invoiceList(form.value)
  113. res.rows.forEach(element => {
  114. element.content = JSON.parse(element.content)
  115. element.otherInfo = JSON.parse(element.otherInfo)
  116. });
  117. list.value = res.rows || [];
  118. form.value.total = res.total;
  119. }
  120. const handlePageChange = (page) => {
  121. list.value = []
  122. form.value.pageNum = page;
  123. getList()
  124. }
  125. onMounted(() => {
  126. getList()
  127. })
  128. </script>
  129. <style scoped lang="scss">
  130. .invoice {
  131. padding-bottom: 20px;
  132. .invoice-title {
  133. height: 60px;
  134. font-size: 20px;
  135. font-weight: bold;
  136. color: #333333;
  137. }
  138. .invoice-list {
  139. .li {
  140. padding: 16px;
  141. margin-bottom: 16px;
  142. background: #F5F7FA;
  143. border-radius: 16px;
  144. .btn {
  145. color: #FFFFFF;
  146. width: 66px;
  147. line-height: 30px;
  148. font-size: 14px;
  149. text-align: center;
  150. background: #2D71FF;
  151. border-radius: 4px;
  152. margin-bottom: 8px;
  153. }
  154. .btn-active {
  155. background: #1FB362;
  156. }
  157. &:last-child {
  158. margin-bottom: 0;
  159. }
  160. .invoice-list-t {
  161. div {
  162. font-size: 18px;
  163. font-weight: bold;
  164. color: #3D3D3D;
  165. &:last-child {
  166. color: #FD5F3C;
  167. }
  168. }
  169. }
  170. .invoice-list-c,
  171. .invoice-list-time,
  172. .invoice-list-b {
  173. margin-top: 8px;
  174. div {
  175. font-size: 16px;
  176. &:first-child {
  177. color: #666666;
  178. }
  179. }
  180. }
  181. .invoice-list-b {
  182. div:last-child {
  183. display: flex;
  184. align-items: center;
  185. cursor: pointer;
  186. justify-content: center;
  187. width: 106px;
  188. height: 32px;
  189. background: #FFFFFF;
  190. border-radius: 4px;
  191. color: #2D71FF;
  192. font-size: 14px;
  193. img {
  194. width: 14px;
  195. height: 14px;
  196. margin-right: 4px;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. </style>