detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view :style="themeColor()">
  3. <view class="bg-[var(--page-bg-color)] min-h-screen overflow-hidden" v-if="!loading" >
  4. <view class="px-[30rpx] bg-linear h-[150rpx] flex items-center">
  5. <view class="w-[110rpx] h-[110rpx] flex items-center justify-center">
  6. <text class="iconfont iconfapiao text-[80rpx] text-[#fff]"></text>
  7. </view>
  8. <view class="ml-[20rpx]">
  9. <view class="text-[30rpx] text-[#fff] mb-[6rpx] font-700 leading-[40rpx]">{{ detail.is_invoice_name }}</view>
  10. <view class="text-[24rpx] text-[#fff] leading-[32rpx] opacity-80">{{ t('applyTime') }}{{ detail.create_time }}</view>
  11. </view>
  12. </view>
  13. <view class="mx-[var(--sidebar-m)] mt-[var(--top-m)]">
  14. <view class="card-template mb-[var(--top-m)]">
  15. <view class="justify-between card-template-item text-[28rpx]">
  16. <view class="flex-shrink-0 mr-[20rpx]">{{ t('invoiceType') }}</view>
  17. <view>{{ detail.type_name }}</view>
  18. </view>
  19. <view class="justify-between card-template-item text-[28rpx]">
  20. <view class="flex-shrink-0 mr-[20rpx]">{{ t('headerType') }}</view>
  21. <view>{{ detail.header_type_name }}</view>
  22. </view>
  23. <view class="justify-between card-template-item text-[28rpx]">
  24. <view class="flex-shrink-0 mr-[20rpx]">{{ t('headerName') }}</view>
  25. <view class="break-all">{{ detail.header_name }}</view>
  26. </view>
  27. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.name">
  28. <view class="flex-shrink-0 mr-[20rpx]">{{ t('name') }}</view>
  29. <view>{{ detail.name }}</view>
  30. </view>
  31. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.email">
  32. <view class="flex-shrink-0 mr-[20rpx]">{{ t('email') }}</view>
  33. <view>{{detail.email}}</view>
  34. </view>
  35. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.invoice_number">
  36. <view class="flex-shrink-0 mr-[20rpx]">{{ t('invoiceNumber') }}</view>
  37. <view>{{detail.invoice_number}}</view>
  38. </view>
  39. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.money">
  40. <view class="flex-shrink-0 mr-[20rpx]">{{ t('money') }}</view>
  41. <view>{{detail.money}}</view>
  42. </view>
  43. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.invoice_time">
  44. <view class="flex-shrink-0 mr-[20rpx]">{{ t('invoiceTime') }}</view>
  45. <view>{{detail.invoice_time}}</view>
  46. </view>
  47. <template v-if="detail.header_type == 2">
  48. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.tax_number">
  49. <view class="flex-shrink-0 mr-[20rpx]">{{ t('taxNumber') }}</view>
  50. <view class="break-all">{{detail.tax_number}}</view>
  51. </view>
  52. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.bank_name">
  53. <view class="flex-shrink-0 mr-[20rpx]">{{ t('bankTame') }}</view>
  54. <view>{{detail.bank_name}}</view>
  55. </view>
  56. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.bank_card_number">
  57. <view class="flex-shrink-0 mr-[20rpx]">{{ t('bankCardNumber') }}</view>
  58. <view>{{detail.bank_card_number}}</view>
  59. </view>
  60. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.telephone">
  61. <view class="flex-shrink-0 mr-[20rpx]">{{ t('telephone') }}</view>
  62. <view>{{detail.telephone}}</view>
  63. </view>
  64. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.address">
  65. <view class="flex-shrink-0 mr-[20rpx]">{{ t('address') }}</view>
  66. <view>{{detail.address}}</view>
  67. </view>
  68. </template>
  69. <view class="justify-between card-template-item text-[28rpx]">
  70. <view class="flex-shrink-0 mr-[20rpx]">{{ t('applyCreateTime') }}</view>
  71. <view>{{detail.create_time}}</view>
  72. </view>
  73. <view class="justify-between card-template-item text-[28rpx]" v-if="detail.invoice_voucher">
  74. <view class="flex-shrink-0 mr-[20rpx]">{{ t('invoiceVoucher') }}</view>
  75. <view @click="previewImage(detail.invoice_voucher)">
  76. <image :src="img(detail.invoice_voucher)" model="aspectFill" class="w-[80rpx] h-[80rpx] overflow-hidden" />
  77. </view>
  78. </view>
  79. </view>
  80. <view class="card-template mb-[var(--top-m)]">
  81. <block v-for="(item, index) in detail.orderData.orderGoods">
  82. <view class="order-goods-item flex justify-between flex-wrap mt-[30rpx]">
  83. <view class="w-[150rpx] h-[150rpx] rounded-[var(--goods-rounded-big)] overflow-hidden">
  84. <u--image class="overflow-hidden" radius="var(--goods-rounded-big)" width="150rpx" height="150rpx" :src="img(item.sku_image)" model="aspectFill">
  85. <template #error>
  86. <image
  87. class="w-[150rpx] h-[150rpx] rounded-[var(--goods-rounded-big)] overflow-hidden"
  88. :src="img('static/resource/images/diy/shop_default.jpg')" mode="aspectFill">
  89. </image>
  90. </template>
  91. </u--image>
  92. </view>
  93. <view class="ml-[20rpx] flex flex-1 flex-col justify-between">
  94. <view>
  95. <view class="text-[28rpx] max-w-[490rpx] truncate leading-[40rpx] text-[#333]">{{ item.goods_name }}</view>
  96. <view v-if="item.sku_name">
  97. <view class="text-[22rpx] mt-[14rpx] text-[var(--text-color-light9)] truncate max-w-[490rpx] leading-[28rpx]">{{ item.sku_name }}</view>
  98. </view>
  99. </view>
  100. <view class="flex justify-between items-baseline leading-[28rpx] text-[#333]">
  101. <view class="price-font">
  102. <text class="text-[24rpx]">¥</text>
  103. <text class="text-[40rpx] font-500">{{ parseFloat(item.price).toFixed(2).split('.')[0] }}</text>
  104. <text class="text-[24rpx] font-500">.{{ parseFloat(item.price).toFixed(2).split('.')[1] }}</text>
  105. </view>
  106. <text class="text-right text-[26rpx]">x{{ item.num }}</text>
  107. </view>
  108. </view>
  109. </view>
  110. </block>
  111. </view>
  112. <view class="card-template mb-[40rpx]">
  113. <view class="justify-between card-template-item text-[28rpx]">
  114. <view>{{ t('orderNo') }}</view>
  115. <view class="flex items-center">
  116. <text>{{ detail.orderData.order_no }}</text>
  117. <text class="w-[2rpx] h-[20rpx] bg-[#999] mx-[10rpx]"></text>
  118. <text class="text-[#EF900A]" @click="copy(detail.orderData.order_no)">{{ t('copy') }}</text>
  119. </view>
  120. </view>
  121. <view class="justify-between card-template-item text-[28rpx]">
  122. <view>{{ t('orderTime') }}</view>
  123. <view>{{ detail.orderData.create_time }}</view>
  124. </view>
  125. <view v-if="detail.orderData.pay" class="justify-between card-template-item text-[28rpx]">
  126. <view>{{ t('payTypeName') }}</view>
  127. <view>{{ detail.orderData.pay.type_name }}</view>
  128. </view>
  129. <view v-if="detail.orderData.pay" class="justify-between card-template-item text-[28rpx]">
  130. <view>{{ t('payTime') }}</view>
  131. <view>{{ detail.orderData.pay.pay_time }}</view>
  132. </view>
  133. <view class="justify-between card-template-item text-[28rpx]">
  134. <view>{{ t('goodsMoney') }}</view>
  135. <view class="price-font font-500">
  136. <text class="text-[28rpx]">¥</text>
  137. <text class="text-[28rpx]">{{ parseFloat(detail.orderData.goods_money).toFixed(2).split('.')[0] }}</text>
  138. <text class="text-[28rpx]">.{{ parseFloat(detail.orderData.goods_money).toFixed(2).split('.')[1] }}</text>
  139. </view>
  140. </view>
  141. <view class="justify-between card-template-item text-[28rpx]">
  142. <view>{{ t('orderMoney') }}</view>
  143. <view class="price-font font-500">
  144. <text class="text-[28rpx]">¥</text>
  145. <text class="text-[28rpx]">{{ parseFloat(detail.orderData.order_money).toFixed(2).split('.')[0] }}</text>
  146. <text class="text-[28rpx]">.{{ parseFloat(detail.orderData.order_money).toFixed(2).split('.')[1] }}</text>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <!-- #ifdef MP-WEIXIN -->
  153. <!-- 小程序隐私协议 -->
  154. <wx-privacy-popup ref="wxPrivacyPopupRef"></wx-privacy-popup>
  155. <!-- #endif -->
  156. </view>
  157. </template>
  158. <script setup lang="ts">
  159. import { ref } from 'vue';
  160. import { t } from '@/locale'
  161. import { img, copy } from '@/utils/common';
  162. import { onLoad,onPageScroll, onReachBottom } from '@dcloudio/uni-app'
  163. import { getMallInvoiceDetail } from '@/addon/mall/api/invoice';
  164. let loading = ref<boolean>(true);
  165. let detail = ref<any>({});
  166. let id = ref('')
  167. onLoad((option) => {
  168. id.value = option.id;
  169. getMallInvoiceDetailFn(id.value);
  170. });
  171. const getMallInvoiceDetailFn = (id: any) =>{
  172. loading.value = true;
  173. getMallInvoiceDetail(id).then(res =>{
  174. detail.value = res.data
  175. loading.value = false;
  176. })
  177. }
  178. // 预览图片
  179. const previewImage = (data:any)=>{
  180. if (data === '') return false
  181. let urlList = []
  182. urlList.push(img(data))
  183. uni.previewImage({
  184. indicator: "number",
  185. loop: true,
  186. urls: urlList
  187. })
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .bg-linear {
  192. background: linear-gradient( 94deg, #E73835 15%, #FE8448 87%);
  193. }
  194. .text-item {
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. display: -webkit-box;
  198. -webkit-line-clamp: 2;
  199. -webkit-box-orient: vertical;
  200. }
  201. .order-goods-item:nth-child(1) {
  202. margin-top: 0rpx;
  203. }
  204. </style>