index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <z-paging ref="paging" bgColor="#F7F7F7" safe-area-inset-bottom paging-class="paging-btm-shadow" scroll-with-animation>
  3. <template #top>
  4. <ut-navbar title="农资详情" :fixed="false" border></ut-navbar>
  5. </template>
  6. <template>
  7. <view class="pd-24 d-flex a-c">
  8. <view class="flex1 ov-hd">
  9. <view class="startline-title">库存信息</view>
  10. </view>
  11. <view>
  12. <up-button @click="navigateToInOutRecords" type="primary" :customStyle="formItemBtnStyle">
  13. <image class="w-30 h-30 mr-10" src="@/static/images/plant/storage/ckcrkjl_icon.png" mode="widthFix" />
  14. <span>查看出入库记录</span>
  15. </up-button>
  16. </view>
  17. </view>
  18. <view class="bg-#fff pd3-10-24-24">
  19. <view class="d-flex j-ed a-c mb-16">
  20. <view class="f-s-22 c-#666">{{ form?.instoreBizInfo?.instoreDate }}</view>
  21. </view>
  22. <view class="d-flex flex1 mb-10">
  23. <view class="flex1">
  24. <span class="f-s-34 c-#333 f-w-500 mr-10">{{ form?.materialName }}</span>
  25. <span class="f-s-24 c-#666">{{ selectDictLabel(pt_material_type, form?.materialType) }}</span>
  26. </view>
  27. <view>
  28. <view v-if="form?.examinReport?.length" class="tag-span c-primary bg-#EBF6EE">已检验</view>
  29. <view v-else class="tag-span c-danger bg-#F9ECEA">未检验</view>
  30. </view>
  31. </view>
  32. <view class="pd2-4-0 f-s-28">
  33. <span class="c-#666">入库批号:</span>
  34. <span class="c-#333 f-w-500">{{ form?.batchCode }}</span>
  35. </view>
  36. <view v-if="form?.supplierId" class="pd2-4-0 f-s-28">
  37. <span class="c-#666">供应商:</span>
  38. <span class="c-#333 f-w-500">{{ form?.supplierInfo?.cusName || '-' }}</span>
  39. </view>
  40. <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
  41. <span class="c-#666">存放库房:</span>
  42. <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
  43. </view>
  44. <view class="pd2-4-0 f-s-28">
  45. <span class="c-#666">入库量:</span>
  46. <span class="c-#333 f-w-500">{{ form?.capacity }}{{ form?.unit }}</span>
  47. </view>
  48. <view class="d-flex">
  49. <view v-if="form?.inputAmount" class="pd2-4-0 f-s-28 flex1">
  50. <span class="c-#666">出库量:</span>
  51. <span class="c-#333 f-w-500">{{ form?.inputAmount || '0' }}{{ form?.unit }}</span>
  52. </view>
  53. <view v-if="form?.restAmount" class="pd2-4-0 f-s-28 flex1">
  54. <span class="c-primary">剩余量:</span>
  55. <span class="c-primary f-w-500">{{ form?.restAmount || '0' }}{{ form?.unit }}</span>
  56. </view>
  57. </view>
  58. <view v-if="+form?.restAmount" class="pd3-20-40-0">
  59. <up-button @click="navigateToInventoryLoss" type="warning" plain :customStyle="{ background: '#FFF9EF', borderColor: '#F9D9A3' }">库存有消耗?库存损耗登记{{ '>' }}</up-button>
  60. </view>
  61. </view>
  62. <view class="pd-24">
  63. <view class="startline-title">农资信息</view>
  64. </view>
  65. <view class="bg-#fff pd-24">
  66. <!-- 农资信息详情,对应 info-edit 表单字段顺序 -->
  67. <view class="f-s-30 pd2-16-0 info-border-bottom">
  68. <span class="c-#666">产品名称:</span>
  69. <span class="c-#333 f-w-600">{{ form?.materialName || '-' }}</span>
  70. </view>
  71. <view class="f-s-30 pd2-16-0 info-border-bottom">
  72. <span class="c-#666">农资类别:</span>
  73. <span class="c-#333 f-w-600">{{ selectDictLabel(pt_material_type, form?.materialType) || '-' }}</span>
  74. </view>
  75. <view class="f-s-30 pd2-16-0 info-border-bottom">
  76. <span class="c-#666">入库量:</span>
  77. <span class="c-#333 f-w-600">{{ form?.capacity }}{{ form?.unit }}</span>
  78. </view>
  79. <view class="f-s-30 pd2-16-0 info-border-bottom" v-if="form?.spec">
  80. <span class="c-#666">规格:</span>
  81. <span class="c-#333 f-w-600">
  82. {{ form?.spec }}
  83. <text v-if="form?.specUnit">{{ selectDictLabel(pt_materail_spec_unit, form?.specUnit) }}</text>
  84. <text v-if="form?.unit">/{{ selectDictLabel(pt_materail_unit, form?.unit) }}</text>
  85. </span>
  86. </view>
  87. <view class="f-s-30 pd2-16-0 info-border-bottom">
  88. <span class="c-#666">农资来源:</span>
  89. <span class="c-#333 f-w-600">{{ selectDictLabel(pt_source_type, form?.sourceType) || '-' }}</span>
  90. </view>
  91. <view v-if="form?.supplier" class="f-s-30 pd2-16-0 info-border-bottom">
  92. <span class="c-#666">供应商:</span>
  93. <span class="c-#333 f-w-600">{{ form?.supplier || form?.supplierInfo?.cusName || '-' }}</span>
  94. </view>
  95. <view v-if="form?.sourceType === '1'" class="f-s-30 pd2-16-0 info-border-bottom">
  96. <span class="c-#666">供应商是否是生产商:</span>
  97. <span class="c-#333 f-w-600">{{ selectDictLabel(yes_no, form?.supplierProducerFlag) || '-' }}</span>
  98. </view>
  99. <view v-if="form?.sourceType === '1'" class="f-s-30 pd2-16-0 info-border-bottom">
  100. <span class="c-#666">生产商:</span>
  101. <span class="c-#333 f-w-600">{{ form?.producer || '-' }}</span>
  102. </view>
  103. <view v-if="form?.productCode" class="f-s-30 pd2-16-0 info-border-bottom">
  104. <span class="c-#666">生产批号:</span>
  105. <span class="c-#333 f-w-600">{{ form?.productCode }}</span>
  106. </view>
  107. <view v-if="form?.productDate" class="f-s-30 pd2-16-0 info-border-bottom">
  108. <span class="c-#666">生产日期:</span>
  109. <span class="c-#333 f-w-600">{{ form?.productDate }}</span>
  110. </view>
  111. <view v-if="form?.brand" class="f-s-30 pd2-16-0 info-border-bottom">
  112. <span class="c-#666">品牌:</span>
  113. <span class="c-#333 f-w-600">{{ form?.brand }}</span>
  114. </view>
  115. <view v-if="['1', '2'].includes(form?.materialType as string)" class="f-s-30 pd2-16-0 info-border-bottom">
  116. <span class="c-#666">登记证号:</span>
  117. <span class="c-#333 f-w-600">{{ form?.materialCode || '-' }}</span>
  118. </view>
  119. <view v-if="form?.imgs" class="f-s-30 pd2-16-0 info-border-bottom">
  120. <view class="c-#666 mb-10">农资图片:</view>
  121. <ut-album :urls="form?.imgs"></ut-album>
  122. </view>
  123. <view v-if="form?.vedios" class="f-s-30 pd2-16-0 info-border-bottom">
  124. <view class="c-#666 mb-10">农资视频:</view>
  125. <ut-album :urls="form?.vedios"></ut-album>
  126. </view>
  127. <view v-if="form?.examinReport && form?.examinReport.length" class="f-s-30 pd2-16-0 info-border-bottom">
  128. <view class="c-#666 mb-10">检验报告:</view>
  129. <ut-album :urls="form?.examinReport"></ut-album>
  130. </view>
  131. </view>
  132. <view class="pd-24">
  133. <view class="startline-title">入库信息</view>
  134. </view>
  135. <view class="bg-#fff pd-24">
  136. <view class="f-s-30 pd2-16-0 info-border-bottom">
  137. <span class="c-#666">入库类型:</span>
  138. <span class="c-#333 f-w-600">{{ selectDictLabel(pt_seed_instore_type, form?.instoreType) || '非溯源入库' }}</span>
  139. </view>
  140. <view class="f-s-30 pd2-16-0 info-border-bottom">
  141. <span class="c-#666">入库日期:</span>
  142. <span class="c-#333 f-w-600">{{ form?.instoreBizInfo?.instoreDate || '-' }}</span>
  143. </view>
  144. <view class="f-s-30 pd2-16-0 info-border-bottom">
  145. <span class="c-#666">入库批号:</span>
  146. <span class="c-#333 f-w-600">{{ form?.batchCode || '-' }}</span>
  147. </view>
  148. <view class="f-s-30 pd2-16-0 info-border-bottom">
  149. <span class="c-#666">库房类型:</span>
  150. <span class="c-#333 f-w-600">农资库</span>
  151. </view>
  152. <view v-if="form?.warehouses?.length" class="pd2-4-0 f-s-28">
  153. <span class="c-#666">存放库房:</span>
  154. <span class="c-#333 f-w-500">{{ getStorageRoomNames(form?.warehouses) || '-' }}</span>
  155. </view>
  156. <view class="f-s-30 pd2-16-0 info-border-bottom">
  157. <span class="c-#666">入库人:</span>
  158. <span class="c-#333 f-w-600">{{ form?.instoreBizInfo?.instoreMg || '-' }}</span>
  159. </view>
  160. <view class="f-s-30 pd2-16-0 info-border-bottom">
  161. <span class="c-#666">入库备注:</span>
  162. <span class="c-#333 f-w-600">{{ form?.instoreBizInfo?.remark || '-' }}</span>
  163. </view>
  164. <view class="f-s-30 pd2-16-0 info-border-bottom">
  165. <span class="c-#666">最后修改人:</span>
  166. <span class="c-#333 f-w-600">{{ form?.operatorName || form?.updateByName || form?.createByName || '-' }}</span>
  167. </view>
  168. <view class="f-s-30 pd2-16-0 info-border-bottom">
  169. <span class="c-#666">最后修改时间:</span>
  170. <span class="c-#333 f-w-600">{{ form?.operateTime || form?.updateTime || form?.createTime || '-' }}</span>
  171. </view>
  172. </view>
  173. </template>
  174. <template #bottom>
  175. <view class="pd-24 d-flex a-c">
  176. <up-button type="primary" @click="clickEdit">修改</up-button>
  177. </view>
  178. </template>
  179. </z-paging>
  180. </template>
  181. <script setup lang="ts">
  182. import { formItemBtnStyle } from '@/assets/styles/uview-plus';
  183. import { getStorageRoomNames } from '@/utils/common';
  184. import { useClientRequest } from '@/utils/request';
  185. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  186. // 使用到的字典:入库类型、库房类型、农资类别、来源、单位、规格单位、是否
  187. const { pt_seed_instore_type, pt_warehouse_type, pt_material_type, pt_source_type, pt_materail_unit, pt_materail_spec_unit, yes_no } = toRefs<any>(proxy?.useDict('pt_seed_instore_type', 'pt_warehouse_type', 'pt_material_type', 'pt_source_type', 'pt_materail_unit', 'pt_materail_spec_unit', 'yes_no'));
  188. const paging = ref<any>(null);
  189. const form = ref<any>({});
  190. const did = ref('');
  191. // 获取详情(仓库信息)
  192. const getDetailById = async (id: string) => {
  193. if (!id) return;
  194. const res = await useClientRequest.get(`/plt-api/app/material/getInfo/${id}`);
  195. if (res && res.code === 200) {
  196. form.value = res.data || {};
  197. }
  198. };
  199. const onRefresh = () => {
  200. getDetailById(did.value);
  201. paging.value?.complete();
  202. };
  203. const clickEdit = () => {
  204. uni.$on('seed-agro-detail-refresh', () => {
  205. getDetailById(did.value);
  206. uni.$off('seed-agro-detail-refresh');
  207. });
  208. uni.$u.route({
  209. type: 'navigateTo',
  210. url: '/plant/storage/agro-product/info-update/index',
  211. params: {
  212. id: did.value,
  213. },
  214. });
  215. };
  216. const navigateToInOutRecords = () => {
  217. uni.$u.route({
  218. type: 'navigateTo',
  219. url: '/plant/storage/stock-list/index',
  220. params: {
  221. id: did.value,
  222. stockType: '1'
  223. },
  224. });
  225. };
  226. const navigateToInventoryLoss = () => {
  227. uni.$on('storage-registered', () => {
  228. getDetailById(did.value);
  229. uni.$emit('refreshStorageRoomList');
  230. uni.$off('storage-registered');
  231. });
  232. uni.navigateTo({
  233. url: '/plant/storage/loss-register/index',
  234. success: (res)=> {
  235. res.eventChannel.emit('storage-data', {
  236. stockType: '1',
  237. ...form.value
  238. });
  239. },
  240. });
  241. };
  242. // 页面入参解析并加载
  243. onLoad((options: any) => {
  244. did.value = options?.id || '';
  245. getDetailById(did.value);
  246. });
  247. </script>
  248. <style lang="scss" scoped>
  249. .card-info-block {
  250. border: 1rpx solid #afddbb;
  251. border-radius: 10rpx;
  252. }
  253. .tag-span {
  254. padding: 4rpx 12rpx;
  255. font-size: 20rpx;
  256. border-radius: 18rpx;
  257. }
  258. </style>