BatchDetail.vue 6.4 KB

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