index.vue 11 KB

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