BatchDetail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <!-- 批次明细 -->
  3. <view class="main-wrap" :class="{ info: isInfo }">
  4. <uni-search-bar class="uni-search-bar" @confirm="search" v-model="searchForm.batchNum" @input="search"
  5. cancelButton="none" placeholder="批次号">
  6. </uni-search-bar>
  7. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  8. <view class="order-list">
  9. <view class="item" v-for="(item, index) in listData" :key="index">
  10. <view class="title">
  11. <view class="s1"> 批次号 {{ item.batchNum }} </view>
  12. <view class="s2" v-if="baseInfo.assetType == 3" @click="_getAnalysisCertificate(item)">质检单</view>
  13. </view>
  14. <view class="main">
  15. <view class="row">
  16. <view class="row-item">
  17. <text class="t1">库存数量</text>
  18. <text class="t2">{{ item.realInventoryNum }}</text>
  19. </view>
  20. <view class="row-item">
  21. <text class="t1">计量单位</text>
  22. <text class="t2">{{ item.unit }}</text>
  23. </view>
  24. </view>
  25. <view class="row">
  26. <view class="row-item">
  27. <text class="t1">包装数量</text>
  28. <text class="t2">{{ item.measurementUnit }}</text>
  29. </view>
  30. <view class="row-item">
  31. <text class="t1">包装单位</text>
  32. <text class="t2">{{ item.minPackUnit }}</text>
  33. </view>
  34. </view>
  35. <view class="row">
  36. <view class="row-item">
  37. <text class="t1">首次入库时间</text>
  38. <text class="t2">{{ item.firstTime }}</text>
  39. </view>
  40. </view>
  41. <view class="row">
  42. <view class="row-item">
  43. <text class="t1">最近出库时间</text>
  44. <text class="t2">{{ item.lastTime }}</text>
  45. </view>
  46. </view>
  47. <!-- <view class="row">
  48. <view class="row-item">
  49. <text class="t1">质检单</text>
  50. <text
  51. class="t2 text-success"
  52. @click="_getAnalysisCertificate(item)"
  53. >查看</text
  54. >
  55. </view>
  56. </view> -->
  57. <!-- <view class="ckmx" @click="goDetails(item)"> 查看明细 </view> -->
  58. </view>
  59. </view>
  60. </view>
  61. <u-loadmore :status="status" style="margin: 20rpx 0" />
  62. </scroll-view>
  63. <uni-popup ref="popup" type="center">
  64. <img class="popImg" :src="apiUrl+itemUrl" alt="" @click="clickImg()">
  65. </uni-popup>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. post,
  71. get
  72. } from '@/utils/api.js'
  73. let [page, size, isEnd] = [1, 10, true]
  74. export default {
  75. props: ['batchNum', 'inventoryCode', 'isInfo', 'dimension', 'baseInfo'],
  76. data() {
  77. return {
  78. listData: [],
  79. searchForm: {
  80. batchNum: '',
  81. isZero: ''
  82. },
  83. itemUrl: '',
  84. status: 'loading',
  85. searchValue: '',
  86. dictObj: {
  87. bizScene: {
  88. 1: '生产入库',
  89. 2: '采购入库',
  90. 3: '赠送入库',
  91. 4: '借用入库',
  92. 5: '退还入库',
  93. 6: '其他入库'
  94. }
  95. },
  96. certificate: '',
  97. certificateVisible: false
  98. }
  99. },
  100. created() {
  101. this.getData()
  102. },
  103. methods: {
  104. // 查看图片
  105. clickImg() {
  106. wx.previewImage({
  107. urls: [this.apiUrl + this.itemUrl], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  108. current: this.itemUrl, // 当前显示图片的http链接,默认是第一个
  109. success: function(res) {},
  110. fail: function(res) {
  111. },
  112. complete: function(res) {
  113. }
  114. })
  115. },
  116. // 触底
  117. lower() {
  118. console.log('触底')
  119. if (isEnd) {
  120. return
  121. }
  122. this.getMoreLists()
  123. },
  124. getData() {
  125. let par = {
  126. batchNum: this.searchForm.batchNum,
  127. bizStatus: 1,
  128. inventoryCode: this.inventoryCode,
  129. isZero: this.searchForm.isZero,
  130. dimension: +this.dimension
  131. }
  132. if (this.searchValue !== '') {
  133. par.key = this.searchValue
  134. }
  135. post(
  136. this.apiUrl +
  137. `/InventoryBook/select/getDetail?size=${size}&page=${page}`,
  138. par
  139. ).then(res => {
  140. if (res.success) {
  141. this.listData = [...this.listData, ...res.data.records]
  142. let pages = res.data.pages
  143. if (page < pages) {
  144. isEnd = false
  145. } else {
  146. isEnd = true
  147. this.status = 'nomore'
  148. }
  149. }
  150. })
  151. },
  152. //质检单 资产类型、资产编码以及批次号获取质检单
  153. async _getAnalysisCertificate(row) {
  154. if (row.certificate) {
  155. this.certificate = row.certificate
  156. this.$refs.popup.open()
  157. return
  158. }
  159. const res = await get(
  160. this.apiUrl + `/InventoryBook/select/getAnalysisCertificate`, {
  161. code: this.baseInfo.assetType,
  162. inventoryCode: this.inventoryCode,
  163. batchNum: row.batchNum
  164. }
  165. )
  166. if (res?.success) {
  167. if (res.data?.length) {
  168. this.itemUrl = res.data[0].accessUrl
  169. this.clickImg()
  170. // this.itemUrl = res.data[0].accessUrl
  171. // this.$refs.popup.open()
  172. } else {
  173. uni.showToast({
  174. title: '未上传质检单!',
  175. icon: 'none'
  176. })
  177. }
  178. }
  179. },
  180. getMoreLists() {
  181. page++
  182. this.getData()
  183. },
  184. search() {
  185. this.page = 1
  186. this.listData = []
  187. this.status = 'loading'
  188. this.getData()
  189. },
  190. goDetails(item) {
  191. console.log(item)
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .popImg {
  198. width: 400rpx;
  199. height: 400rpx;
  200. }
  201. .main-wrap {
  202. height: calc(100% - 170rpx);
  203. &.info {
  204. height: calc(100% - 236rpx);
  205. }
  206. }
  207. .scroll-Y {
  208. height: calc(100vh - 112rpx);
  209. //height: 100%;
  210. background-color: #fafafa;
  211. }
  212. .order-list {
  213. .item {
  214. background-color: #fff;
  215. margin-bottom: 30rpx;
  216. margin-bottom: 30rpx;
  217. .title {
  218. display: flex;
  219. padding: 20rpx;
  220. justify-content: space-between;
  221. align-items: center;
  222. border-bottom: 1px solid #dedede;
  223. .s1 {
  224. color: #333333;
  225. font-size: 28rpx;
  226. font-weight: bold;
  227. }
  228. .s2 {
  229. font-size: 28rpx;
  230. font-weight: bold;
  231. color: #70b603;
  232. }
  233. }
  234. .main {
  235. padding: 0 30rpx;
  236. .row {
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. padding: 20rpx 0;
  241. border-bottom: 1px dashed #dedede;
  242. .row-item {
  243. .t1 {
  244. font-weight: bold;
  245. font-size: 28rpx;
  246. color: #333333;
  247. margin-right: 20rpx;
  248. }
  249. .t2 {
  250. font-size: 28rpx;
  251. color: #333333;
  252. }
  253. }
  254. }
  255. .ckmx {
  256. color: #70b603;
  257. font-size: 28rpx;
  258. font-weight: bold;
  259. padding: 20rpx;
  260. display: flex;
  261. justify-content: flex-end;
  262. }
  263. }
  264. }
  265. }
  266. </style>