index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class='container uni-column'>
  3. <view class='nav uni-row'>
  4. <text :class='pendingClass' @click='selectPending'>{{pendingTitle}}</text>
  5. <text :class='turnoverClass' @click='selectTurnover'>{{turnoverTitle}}</text>
  6. <image class='img' src="../../static/screen.png"></image>
  7. </view>
  8. <!-- 待周转页面 -->
  9. <view class="padding-container" v-if='pendingShow'>
  10. <scroll-view class="scroll-container" scroll-y>
  11. <view v-for="(item, index) in listData" :key="index"
  12. :class="{'list-item':true,'selected':isSelected(item)}">
  13. <!-- @click="handleSelection(item)" -->
  14. <view class="title-container uni-row">
  15. <view class="title uni-row">
  16. <text class="label">{{ item['dictDataLabel'] }}</text>
  17. <text class="label code">{{ item['process'].processAlias }}</text>
  18. <text class="label code" style="margin-left: 16rpx;">→</text>
  19. <text class="label code"
  20. style="margin-left: 16rpx;">{{ item['nextProcess'].processAlias }}</text>
  21. </view>
  22. <view class="right-info uni-row">
  23. <view class="uni-row"><text class="label right">待周转</text></view>
  24. </view>
  25. </view>
  26. <view class="item-info uni-row"> <text class="label ">批次</text>
  27. <text class="label right">{{ item['lotCode'] }}</text>
  28. </view>
  29. <view class="item-info uni-row"> <text class="label">箱数</text>
  30. <text class="label right ">{{ item['qualifiedNum'] }}</text>
  31. </view>
  32. <view class="item-info uni-row">
  33. <text class="label">数量</text>
  34. <text class="label right">{{ item['carriers'] }}</text>
  35. </view>
  36. <view class="item-info uni-row">
  37. <text class="label">箱号</text>
  38. <text class="label right">{{ item['carrierName']}}</text>
  39. </view>
  40. <view class="item-info uni-row">
  41. <text class="label">申请时间</text>
  42. <text class="label right">{{ item['startTime']}}</text>
  43. </view>
  44. <view class="item-info uni-row">
  45. <text class="label">申请人</text>
  46. <text class="label right">{{ item['nickName']}}</text>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. <view class="bottom-btn-container uni-row">
  51. <button class="bottom-btn" @click="handleStartTurn">开始周转</button>
  52. </view>
  53. </view>
  54. <!-- 周转中页面 -->
  55. <view class='turnover-container' v-if='turnoverShow'>
  56. <scroll-view class="scroll-container" scroll-y>
  57. <!-- 循环周转中的数据 -->
  58. <view class='item-container'>
  59. <view v-if="products.length > 0" class="turnover-title uni-row">
  60. <view class="uni-row" style="align-items: center;">
  61. <view><text class='title-color'>{{turnoverContentTitle}}箱</text></view>
  62. <view><text class="second-info">{{turnoverSecondTitle}}</text></view>
  63. </view>
  64. <view><text class="label">周转中</text></view>
  65. </view>
  66. <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in products"
  67. :key='index'>
  68. <!-- @click="handleSelection(item)" -->
  69. <view class="list-container-item product-description uni-row">
  70. <text class="label left-value">产品描述</text>
  71. <text class="label right-value">{{item['productDescription']}}</text>
  72. </view>
  73. <view class="list-container-item uni-row">
  74. <text class="label left-value">批次</text>
  75. <text class="label right-value">{{item['lotCode']}}</text>
  76. </view>
  77. <view class="list-container-item uni-row">
  78. <text class="label left-value">箱数</text>
  79. <text class="label right-value">{{item['carriers']}}</text>
  80. </view>
  81. <view class="list-container-item uni-row">
  82. <text class="label left-value">箱号</text>
  83. <text class="label right-value">{{item['carrierName']}}</text>
  84. </view>
  85. </view>
  86. </view>
  87. </scroll-view>
  88. <view class='bottom-btn-container uni-row'>
  89. <button type='primary' class='bottom-btn' @click="handleConfirmDelivery">确认送达</button>
  90. </view>
  91. </view>
  92. </view>
  93. <dialog-confirm ref="confirm" @submit="handleConfirmUnbind" @reflush="reflush"></dialog-confirm>
  94. <dialog-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
  95. </template>
  96. <script setup>
  97. import {
  98. ref
  99. } from 'vue'
  100. import {
  101. onLoad
  102. } from '@dcloudio/uni-app'
  103. // import pending from './pending';
  104. // import turnover from './turnover';
  105. import {
  106. getDayWorkItemList
  107. } from '@/api/business/dayWorkItem.js'
  108. import {
  109. updateDayWorkItem,
  110. updateDayWorkItemBatch
  111. } from '@/api/business/dayWorkItem.js'
  112. import {
  113. getDictInfoByType
  114. } from '@/api/dict/dict.js'
  115. const pendingTitle = ref('待周转')
  116. const turnoverTitle = ref('周转中')
  117. const turnoverContentTitle = ref(0)
  118. const turnoverSecondTitle = ref('')
  119. const sum = ref(0)
  120. const pendingClass = ref({
  121. selecter: true
  122. })
  123. const turnoverClass = ref({
  124. selecter: false
  125. })
  126. const selection = ref([])
  127. const pendingShow = ref(true)
  128. const turnoverShow = ref(false)
  129. const listData = ref([])
  130. const products = ref([])
  131. const confirm = ref(null) // 弹窗组件
  132. const turnoverTask = ref(null) // 弹窗组件
  133. onLoad(() => {
  134. init()
  135. })
  136. function init() {
  137. getDayWorkItemList({
  138. status: 4
  139. }).then(res => {
  140. if (res.code == 200) {
  141. listData.value = res.rows;
  142. // 设置箱数
  143. for (var i = 0; i < listData.value.length; i++) {
  144. listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
  145. }
  146. console.log(res)
  147. }
  148. })
  149. getDayWorkItemList({
  150. status: 5
  151. }).then(res => {
  152. if (res.code == 200) {
  153. products.value = res.rows;
  154. // 设置箱数
  155. for (let i = 0; i < products.value.length; i++) {
  156. products.value[i].carriers = products.value[i].carrierName.split('、').length;
  157. turnoverContentTitle.value += products.value[i].carriers;
  158. }
  159. // 设置总数和目标
  160. turnoverSecondTitle.value = products.value[0].process.processAlias + " → " + products.value[0]
  161. .nextProcess.processAlias
  162. console.log(res)
  163. }
  164. })
  165. }
  166. function reflush() {
  167. init();
  168. }
  169. function handleConfirmUnbind() {
  170. handleDoTurn();
  171. }
  172. function handleStartTurn() {
  173. // if(selection.value.length > 0){
  174. // let msg = '是否确认周转?';
  175. // confirm.value.open(msg);
  176. // }
  177. // turnoverTask.value.open(selection.value);
  178. uni.navigateTo({
  179. url: "/pages/startTurnover/index"
  180. })
  181. }
  182. function handleConfirmDelivery() {
  183. if(products.value.length > 0){
  184. let msg = '是否确认送达?';
  185. confirm.value.open(msg);
  186. }
  187. }
  188. function handleDoTurn() {
  189. // 设置周转状态
  190. for (var i = 0; i < products.value.length; i++) {
  191. products.value[i].status = '6';
  192. }
  193. updateDayWorkItemBatch(products.value).then(res => {
  194. if (res.code === 200) {
  195. uni.showToast({
  196. icon: 'success',
  197. title: '操作成功',
  198. duration: 2000
  199. });
  200. init();
  201. } else {
  202. uni.showToast({
  203. icon: 'error',
  204. title: '操作失败',
  205. duration: 2000
  206. });
  207. }
  208. })
  209. // 清空选中数组
  210. selection.value = [];
  211. }
  212. function isSelected(item) {
  213. return selection.value.includes(item);
  214. }
  215. function handleSelection(item) {
  216. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  217. if (buttonIndex > -1) {
  218. selection.value.splice(buttonIndex, 1); // 取消选中
  219. } else {
  220. selection.value.push(item); // 选中
  221. }
  222. console.log(selection.value, "selection");
  223. }
  224. function selectPending() {
  225. pendingClass.value['selecter'] = true;
  226. turnoverClass.value['selecter'] = false;
  227. pendingShow.value = true;
  228. turnoverShow.value = false;
  229. }
  230. function selectTurnover() {
  231. pendingClass.value['selecter'] = false;
  232. turnoverClass.value['selecter'] = true;
  233. pendingShow.value = false;
  234. turnoverShow.value = true;
  235. }
  236. </script>
  237. <style lang="scss">
  238. $navHeight: 48rpx;
  239. /* 导航栏样式 */
  240. .container {
  241. height: 1600rpx;
  242. background-color: #f5f5f5;
  243. }
  244. .selected {
  245. border: 1px solid #1684fc;
  246. }
  247. .nav {
  248. justify-content: space-around;
  249. width: 100%;
  250. height: $navHeight;
  251. border-bottom: 3rpx solid rgba(228, 231, 237, 1);
  252. background-color: rgba(255, 255, 255, 1);
  253. .img {
  254. width: 24rpx;
  255. height: 24rpx;
  256. position: fixed;
  257. right: 10rpx;
  258. top: 0;
  259. }
  260. }
  261. .selecter {
  262. height: 48rpx;
  263. color: rgba(25, 137, 250, 1);
  264. border-bottom: 3rpx solid rgba(25, 137, 250, 1);
  265. }
  266. /* 待周转样式 */
  267. .padding-container,
  268. .turnover-container {
  269. position: absolute;
  270. top: 56rpx;
  271. right: 0;
  272. bottom: 0rpx;
  273. left: 0;
  274. background-color: #f5f5f5;
  275. .scroll-container {
  276. position: absolute;
  277. top: 24rpx;
  278. right: 0;
  279. bottom: 136rpx;
  280. left: 0;
  281. }
  282. .bottom-btn-container {
  283. height: 10%;
  284. position: fixed;
  285. right: 0;
  286. bottom: 0;
  287. left: 0;
  288. height: 80rpx;
  289. border-top: 1px solid #999999;
  290. padding: 16rpx 32rpx;
  291. align-items: center;
  292. background-color: #fff;
  293. .bottom-btn {
  294. // padding-left: 0;
  295. // padding-top: 4rpx;
  296. flex: 1;
  297. font-size: 28rpx;
  298. color: #FFFFFF;
  299. background-color: #1684fc;
  300. }
  301. }
  302. }
  303. .padding-container {
  304. .scroll-container {
  305. .list-item {
  306. background-color: #fff;
  307. padding: 0 24rpx;
  308. padding-bottom: 24rpx;
  309. margin: 0 24rpx;
  310. margin-bottom: 24rpx;
  311. border-radius: 8rpx;
  312. .title-container {
  313. justify-content: space-between;
  314. margin-top: 8rpx;
  315. margin-bottom: 16rpx;
  316. .title {
  317. height: 48rpx;
  318. align-items: center;
  319. .label {
  320. color: #1684fc;
  321. font-size: 32rpx;
  322. font-weight: bold;
  323. &.code {
  324. color: #000000;
  325. margin-left: 32rpx;
  326. }
  327. }
  328. }
  329. }
  330. .item-info {
  331. margin-bottom: 16rpx;
  332. .label {
  333. font-size: 28rpx;
  334. width: 160rpx;
  335. color: #808080;
  336. &.right {
  337. flex: 1;
  338. color: #000000;
  339. }
  340. }
  341. }
  342. .right-info {
  343. justify-content: flex-end;
  344. margin-top: 2rpx;
  345. .label {
  346. font-size: 28rpx;
  347. color: #808080;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. /* 周转中样式 */
  354. .turnover-container {
  355. .scroll-container {
  356. .item-container {
  357. // height: 90%;
  358. // padding: 8rpx 0 32rpx 0;
  359. margin: 0 24rpx;
  360. margin-bottom: 24rpx;
  361. background-color: rgba(255, 255, 255, 1);
  362. border-radius: 8rpx;
  363. .turnover-title {
  364. width: auto;
  365. justify-content: space-between;
  366. margin: 16rpx;
  367. font-weight: bold;
  368. .label {
  369. font-size: 28rpx;
  370. color: #808080;
  371. }
  372. }
  373. .list-container {
  374. margin: 0 24rpx 16rpx 24rpx;
  375. .list-container-item {
  376. border-bottom: 1px solid #999999;
  377. padding: 12rpx 8rpx;
  378. background-color: #EEF0F5;
  379. &.product-description {
  380. background-color: #ECF5FF;
  381. }
  382. .label {
  383. font-size: 28rpx;
  384. color: #999999;
  385. &.left-value {
  386. width: 152rpx;
  387. }
  388. &.right-value {
  389. flex: 1;
  390. color: #000000;
  391. }
  392. }
  393. }
  394. }
  395. .title-color {
  396. color: rgba(22, 132, 252, 1);
  397. font-size: 36rpx;
  398. font-weight: bold;
  399. }
  400. .second-info {
  401. font-size: 36rpx;
  402. font-weight: bold;
  403. margin-left: 32rpx;
  404. }
  405. .turnover-info {
  406. color: rgba(128, 128, 128, 1);
  407. position: absolute;
  408. top: 10rpx;
  409. right: 40rpx;
  410. font-size: 30rpx;
  411. }
  412. }
  413. }
  414. }
  415. </style>