details.vue 7.4 KB

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