details.vue 6.6 KB

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