details.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;position: absolute;
  3. left: 0;
  4. right: 0;">
  5. <view class="scroll-container" style="padding-bottom: 150rpx">
  6. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  7. <text>暂无批次</text>
  8. </view>
  9. <!-- 批次列表 -->
  10. <view v-else v-for="(item, index) in listData" :key="index" class="list-item">
  11. <view class="title-container uni-row" style="justify-content: flex-start;">
  12. <view class="title uni-row">
  13. <text class="label">批次号:</text>
  14. <text class="label code">{{ item['lotCode'] }}</text>
  15. </view>
  16. <view class=" uni-row" style="margin-left: 16rpx;">
  17. <view v-if="item['isTaksStock'] == 0" class="tag finished"><text class="label">未盘点</text></view>
  18. <view v-else type="default finished" class="tag turnover"><text class="label">已盘点</text></view>
  19. </view>
  20. </view>
  21. <view class="item-info uni-row">
  22. <text class="label">产品描述</text>
  23. <text class="label right">{{ item['productDescription'] }}</text>
  24. </view>
  25. <view class="item-info uni-row">
  26. <text class="label">投产数</text>
  27. <text class="label right">{{ item['prodNum']}}</text>
  28. </view>
  29. <view class="item-info uni-row">
  30. <text class="label">盘点数量</text>
  31. <input v-if="item.flag" class="number" type="number" v-model="item.taksStockNum" placeholder="" />
  32. <view v-else class="value">{{ item.taksStockNum }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="bottom uni-row">
  37. <button class="start-batch-btn" style="margin-right: 10rpx; " type="primary" @click="handleSave">确定</button>
  38. <button class="start-batch-btn" style="background-color:#fe5555;" @click="handleCancel">取消</button>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup>
  43. import {
  44. normalizeProps,
  45. reactive,
  46. onMounted,
  47. ref
  48. } from 'vue'
  49. import {
  50. onLoad,
  51. onReady,
  52. onUnload,
  53. onShow
  54. } from '@dcloudio/uni-app'
  55. import {
  56. updateTakesStock
  57. } from '@/api/business/taksStackLot.js'
  58. import {
  59. store
  60. } from '@/store/index.js'
  61. import {
  62. toHHmmss
  63. } from '@/utils/common.js'
  64. import {
  65. onPullDownRefresh
  66. } from "@dcloudio/uni-app"
  67. const listData = ref([])
  68. onShow(() => {
  69. reflush();
  70. })
  71. ;
  72. function reflush() {
  73. init();
  74. }
  75. function init(id) {
  76. let temperList = store.takeStockDetails
  77. console.log(store.takeStockDetails)
  78. console.log(store.userInfo.userId)
  79. temperList.forEach(item => {
  80. item.flag = true
  81. if (item.isTaksStock == 0) {
  82. item.taksStockNum = item.prodNum
  83. }
  84. if (item.firstUpdateId != 0 && store.userInfo.userId != item.firstUpdateId) {
  85. item.flag = false
  86. uni.showToast({
  87. icon: "none",
  88. title: '该批次已被其他人盘点'
  89. });
  90. }
  91. })
  92. listData.value = temperList
  93. }
  94. function handleSave() {
  95. console.log(Number(listData.value[0].taksStockNum) < 0)
  96. for (let i = 0; i < listData.value.length; i++) {
  97. if (Number(listData.value[i].taksStockNum) < 0) {
  98. uni.showToast({
  99. icon: 'none',
  100. title: listData.value[i].lotCode + '批次盘点数量不能小于0'
  101. })
  102. return
  103. }
  104. }
  105. update()
  106. }
  107. function handleCancel() {
  108. let pages = getCurrentPages();
  109. let index = 0;
  110. for (let i = 0; i < pages.length; i++) {
  111. if (pages[i].$page.fullPath == "/pages/takeStock/index") {
  112. index = pages.length - i - 1;
  113. }
  114. }
  115. uni.navigateBack({
  116. delta: index
  117. });
  118. }
  119. function update() {
  120. updateTakesStock(listData.value).then(res => {
  121. uni.showToast({
  122. icon: 'none',
  123. title: '盘点成功'
  124. })
  125. // uni.navigateTo({
  126. // url: '/pages/takeStock/index'
  127. // })
  128. let pages = getCurrentPages();
  129. let index = 0;
  130. for (let i = 0; i < pages.length; i++) {
  131. if (pages[i].$page.fullPath == "/pages/takeStock/index") {
  132. index = pages.length - i - 1;
  133. }
  134. }
  135. uni.navigateBack({
  136. delta: index
  137. });
  138. })
  139. console.log(listData.value)
  140. }
  141. </script>
  142. <style lang="scss">
  143. $nav-height: 60rpx;
  144. /* 遮罩层样式 */
  145. .mask {
  146. position: fixed;
  147. /* 固定定位,覆盖整个屏幕 */
  148. top: 0;
  149. left: 0;
  150. right: 0;
  151. bottom: 0;
  152. background-color: rgba(0, 0, 0, 0.3);
  153. /* 黑色背景,透明度30% */
  154. display: flex;
  155. justify-content: center;
  156. /* 水平居中 */
  157. align-items: center;
  158. /* 垂直居中 */
  159. z-index: 1000;
  160. /* 确保遮罩层在其他元素之上 */
  161. }
  162. .box-bg {
  163. width: 94%;
  164. background-color: #F5F5F5;
  165. padding: 5rpx 16rpx;
  166. justify-content: space-around;
  167. align-items: center;
  168. margin: 24rpx auto 0;
  169. .input-view {
  170. width: 100%;
  171. flex: 4;
  172. background-color: #f8f8f8;
  173. height: $nav-height;
  174. border: 1rpx solid #999;
  175. border-radius: 15rpx;
  176. padding: 0 15rpx;
  177. flex-wrap: nowrap;
  178. margin: 0 10rpx 0;
  179. line-height: $nav-height;
  180. .input-uni-icon {
  181. line-height: $nav-height;
  182. }
  183. .nav-bar-input {
  184. width: 80%;
  185. height: $nav-height;
  186. line-height: $nav-height;
  187. padding: 0 5rpx;
  188. background-color: #f8f8f8;
  189. }
  190. }
  191. .search {
  192. width: 20%;
  193. text-align: center;
  194. color: #808080;
  195. }
  196. }
  197. .list-title {
  198. width: 100%;
  199. margin-top: 16rpx;
  200. height: 64rpx;
  201. line-height: 64rpx;
  202. align-items: center;
  203. margin-left: 32rpx;
  204. .label {
  205. font-size: 32rpx;
  206. margin-right: 24rpx;
  207. }
  208. .icon-gear {
  209. font-size: 56rpx;
  210. }
  211. }
  212. .switch {
  213. margin-top: -8rpx;
  214. transform: scale(0.7);
  215. }
  216. .scroll-container {
  217. width: 92%;
  218. margin: 24rpx auto 0 auto;
  219. height: calc(90% - 100rpx);
  220. overflow: auto;
  221. }
  222. .list-item {
  223. background-color: #fff;
  224. position: relative;
  225. padding: 16rpx;
  226. padding-bottom: 24rpx;
  227. margin-bottom: 24rpx;
  228. border-radius: 24rpx;
  229. .title-container {
  230. margin-top: 8rpx;
  231. margin-bottom: 16rpx;
  232. .title {
  233. height: 48rpx;
  234. align-items: center;
  235. .label {
  236. font-size: 32rpx;
  237. font-weight: bold;
  238. &.code {
  239. margin-left: 8rpx;
  240. }
  241. }
  242. }
  243. .tag {
  244. border: 1px solid #1CE5B0;
  245. background-color: #F6FFFD;
  246. padding: 8rpx;
  247. border-radius: 8rpx;
  248. .label {
  249. color: #1CE5B0;
  250. font-size: 24rpx;
  251. }
  252. &.finished {
  253. border: 1px solid #BBBBBB;
  254. background-color: #F5F5F5;
  255. .label {
  256. color: #BBBBBB;
  257. }
  258. }
  259. &.turnover {
  260. border: 1px solid #FF7901;
  261. background-color: #F6FFFD;
  262. .label {
  263. color: #FF7901;
  264. }
  265. }
  266. }
  267. }
  268. .item-info {
  269. margin-bottom: 8rpx;
  270. .label {
  271. font-size: 28rpx;
  272. width: 220rpx;
  273. color: #808080;
  274. &.right {
  275. flex: 1;
  276. color: #000000;
  277. }
  278. }
  279. input {
  280. width: 280rpx;
  281. height: 56rpx;
  282. border: 1px solid #9f9f9f;
  283. font-size: 28rpx;
  284. &.number {
  285. width: 220rpx;
  286. text-align: left;
  287. }
  288. }
  289. }
  290. .status-btn {
  291. justify-content: flex-end;
  292. align-items: center;
  293. .turnover-tag {
  294. padding-right: 12rpx;
  295. padding-left: 12rpx;
  296. border-radius: 8rpx;
  297. border: 1rpx solid #FF7901;
  298. background-color: #FF7901;
  299. font-size: 28rpx;
  300. color: #FFFFFF;
  301. }
  302. .reporting-tag {
  303. padding-right: 12rpx;
  304. padding-left: 12rpx;
  305. border-radius: 8rpx;
  306. margin-left: 16rpx;
  307. border: 1rpx solid #1684fc;
  308. background-color: #1684fc;
  309. font-size: 28rpx;
  310. color: #FFFFFF;
  311. }
  312. }
  313. }
  314. .bottom {
  315. height: 10%;
  316. position: fixed;
  317. right: 0;
  318. bottom: 0;
  319. left: 0;
  320. height: 100rpx;
  321. border-top: 1px solid #999999;
  322. padding: 16rpx 32rpx;
  323. align-items: center;
  324. background-color: #fff;
  325. justify-content: space-evenly;
  326. .start-batch-btn {
  327. flex: 1;
  328. height: 80rpx;
  329. line-height: 80rpx;
  330. border-radius: 8rpx;
  331. color: #FFFFFF;
  332. font-size: 28rpx;
  333. }
  334. }
  335. </style>