print-info-page.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <z-paging ref="paging" bgcolor="#F7F7F7" v-model="list" @query="query" safe-area-inset-bottom scroll-with-animation>
  3. <template #top>
  4. <ut-navbar title="包装任务详情" :fixed="false" border></ut-navbar>
  5. </template>
  6. <view class="d-flex a-c pd3-30-24-0 f-s-30 f-w-5">
  7. <view class="pd2-20-36 card-item-box mr-10 active">{{ form?.refType == '2' ? '打印详情' : '关联详情' }}</view>
  8. <view @click="changeTebs" class="pd2-20-36 card-item-box">包装任务信息</view>
  9. </view>
  10. <view class="bg-fff pd-24">
  11. <view class="detail-info-card p-rtv mb-40">
  12. <pack-card :item="form" :dict="dict">
  13. <view class="pd-20"></view>
  14. </pack-card>
  15. <view class="btn-card-wrapper d-flex a-c j-sb">
  16. <view class="btn-bottom-bt ls-style" @click.stop="goPrint({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount }, '/plant/print/print-self/index')">
  17. <image class="w-32 h-32 mr-8" src="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/print-codes/btn_zxdy_icon.png" mode="widthFix" />
  18. <span>自行打印</span>
  19. </view>
  20. <view class="btn-bottom-bt ss-style" @click="goPrint({ packId: form?.id, autoRelationId: form?.autoRelationId, unit: form?.unit, printedCount: form?.actualCount - form?.printCount }, '/plant/export-print/export/index')">
  21. <image class="w-32 h-32 mr-8" src="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/print-codes/dczsm_icon.png" mode="widthFix" />
  22. <span>导出追溯码</span>
  23. </view>
  24. <view class="btn-bottom-bt fs-style" @click="showFeatureUnavailable()">
  25. <image class="w-32 h-32 mr-8" src="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/print-codes/btn_zrdd_icon.png" mode="widthFix" />
  26. <span>找人代打</span>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="d-flex a-c pd2-10-0 j-ed" @click="$u.route({ url: '/tools/view-html/index', params: { url: 'https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/template/pack_print_type.html', title: '打印方式的区别' } })">
  31. <up-icon size="28rpx" name="question-circle" color="#999"></up-icon>
  32. <span class="c-#999 f-s-24">三种打印方式的区别?怎么选择?</span>
  33. </view>
  34. <view class="mb-20">
  35. <ut-tabs v-model="printType" :tabs="tabs" @change="onRefresh"></ut-tabs>
  36. </view>
  37. <view>
  38. <template v-for="(item, index) in list" :key="index">
  39. <template v-if="item?.printType == '1'">
  40. <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
  41. <view class="f-s-28 pd2-4-0">
  42. <span class="c-#666">打印数量:</span>
  43. <span class="c-#333 f-w-5">{{ item?.printCount }}</span>
  44. </view>
  45. <view class="f-s-28 pd2-4-0 d-flex">
  46. <span class="c-#666">打印码值:</span>
  47. <view class="flex1 ov-hd c-#333 f-w-5">
  48. <view>{{ item?.traceCodeStart }} 至</view>
  49. <view>{{ item?.traceCodeEnd }}</view>
  50. </view>
  51. </view>
  52. <view class="d-flex f-s-24 c-#666">
  53. <view class="flex1 ov-hd">打印人:{{ item?.createByName || '-' }}</view>
  54. <view class="pr-100">打印时间:{{ item?.createTime || '-' }}</view>
  55. </view>
  56. <view class="pt-20 d-flex">
  57. <view class="flex1"></view>
  58. <view class="d-flex a-c">
  59. <up-button @click="clickAllPrint(item)" :customStyle="formItemBtnListStyle" class="ml-20" color="#18BECA">全部打印</up-button>
  60. <up-button @click="$u.route({ url: '/plant/print/print-range/index', params: item })" :customStyle="formItemBtnListStyle" class="ml-20" color="#37A954">区间打印</up-button>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <template v-if="item?.printType == '2'">
  66. <view class="mb-20 pd-20 bg-#F7F7F7 b-radius">
  67. <view class="f-s-24 c-#333 f-w-5">{{ selectDictLabel(pt_code_export_type, item?.extraInfo?.fileType) }}</view>
  68. <view class="f-s-28 pd2-4-0">
  69. <span class="c-#666">导出数量:</span>
  70. <span class="c-#333 f-w-5">{{ item?.printCount }}</span>
  71. </view>
  72. <view class="f-s-28 pd2-4-0 d-flex">
  73. <span class="c-#666">导出码值:</span>
  74. <view class="flex1 ov-hd c-#333 f-w-5">
  75. <view>{{ item?.traceCodeStart }} 至</view>
  76. <view>{{ item?.traceCodeEnd }}</view>
  77. </view>
  78. </view>
  79. <view class="d-flex f-s-24 c-#666">
  80. <view class="flex1 ov-hd">导出人:{{ item?.createByName || '-' }}</view>
  81. <view class="pr-100">导出时间:{{ item?.createTime || '-' }}</view>
  82. </view>
  83. <view class="pt-20 d-flex">
  84. <view class="flex1"></view>
  85. <view class="d-flex a-c">
  86. <up-button @click="$u.route({ url: '/plant/export-print/export/index', params: item })" :customStyle="formItemBtnListStyle" color="#18BECA">重新导出</up-button>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. <template></template>
  92. </template>
  93. </view>
  94. </view>
  95. </z-paging>
  96. </template>
  97. <script setup lang="ts">
  98. import { useClientRequest } from '@/utils/request';
  99. import PackCard from '@/plant/models/pack-card.vue';
  100. import { formItemBtnListStyle } from '@/assets/styles/uview-plus';
  101. import { showFeatureUnavailable } from '@/utils/common';
  102. const paging = ref<any>(null);
  103. const props = defineProps({
  104. packId: {
  105. type: String,
  106. default: '',
  107. },
  108. form: {
  109. type: Object,
  110. default: () => null,
  111. },
  112. dict: {
  113. type: Object,
  114. default: () => null,
  115. },
  116. });
  117. const printType = ref('1');
  118. const { pt_pack_ref_type, pt_code_export_type } = toRefs(props?.dict);
  119. const emit = defineEmits(['changeTebs']);
  120. const tabs = reactive([
  121. { label: '打印记录', value: '1' },
  122. { label: '导出记录', value: '2' },
  123. { label: '找人代打记录', value: '3' },
  124. ]);
  125. const changeTebs = () => {
  126. emit('changeTebs', 'pack');
  127. };
  128. const list = ref([]);
  129. const query = async (pageNum: number, pageSize: number) => {
  130. const params = {
  131. pageNum,
  132. pageSize,
  133. packId: props.packId,
  134. printType: printType.value,
  135. };
  136. const res = await useClientRequest.get('/plt-api/app/printLog/list', params);
  137. if (res && res?.rows) {
  138. const { rows } = res;
  139. paging.value?.complete(rows);
  140. }
  141. };
  142. const onRefresh = () => {
  143. try {
  144. paging.value?.reload();
  145. } catch (error) {
  146. console.error('刷新列表失败:', error);
  147. }
  148. };
  149. const clickAllPrint = async (item: any) => {
  150. try {
  151. const res = await uni.showModal({
  152. title: '全部打印提示',
  153. content: '您确认需要再次打印该条记录的全部追溯码吗?',
  154. confirmColor: '#37A954',
  155. });
  156. if (res.confirm) {
  157. uni.$u.route({ type: 'navigateTo', url: '/plant/print/print-all/index', params: item });
  158. }
  159. } catch (error) {
  160. console.error('全部打印失败:', error);
  161. }
  162. };
  163. const goPrint = async (params: any, url: string) => {
  164. if (!params?.printedCount) {
  165. uni.showModal({
  166. title: '提示',
  167. content: '没有可打印的追溯码了哦~',
  168. showCancel: false,
  169. confirmColor: '#37A954',
  170. });
  171. return;
  172. }
  173. try {
  174. uni.$u.route({ type: 'navigateTo', url: url || '/plant/print/print-self/index', params });
  175. } catch (error) {
  176. console.error('跳转打印页面失败:', error);
  177. }
  178. };
  179. onMounted(() => {
  180. uni.$on('refreshPackTaskDetail', () => {
  181. onRefresh();
  182. });
  183. });
  184. </script>
  185. <style lang="scss" scoped>
  186. .card-item-box {
  187. color: #999;
  188. border-radius: 10rpx 10rpx 0 0;
  189. &.active {
  190. color: $u-primary;
  191. background-color: #fff;
  192. }
  193. }
  194. .detail-info-card {
  195. border-radius: 16rpx;
  196. border: 1rpx solid #9dd5ab;
  197. }
  198. .btn-bottom-bt {
  199. width: 208rpx;
  200. height: 74rpx;
  201. border-radius: 8rpx;
  202. border: 1px solid #000;
  203. font-size: 26rpx;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .btn-card-wrapper {
  209. position: absolute;
  210. left: 20rpx;
  211. bottom: -37rpx;
  212. right: 20rpx;
  213. z-index: 10;
  214. }
  215. .ls-style {
  216. background-color: #e3fbea;
  217. box-shadow: inset 0 0 10px #d2f3da;
  218. border-color: #9bd4a9;
  219. color: #37a954;
  220. }
  221. .ss-style {
  222. background-color: #e5fdff;
  223. box-shadow: inset 0 0 10px #c7f5f8;
  224. border-color: #93e8ee;
  225. color: #18beca;
  226. }
  227. .fs-style {
  228. background-color: #fffaf3;
  229. box-shadow: inset 0 0 10px #ffeed7;
  230. border-color: #ffd499;
  231. color: #fc8834;
  232. }
  233. </style>