index.vue 13 KB

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