index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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"
  20. style="margin-left: 16rpx;">{{ item['deptName'] }}</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. </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. <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. </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. uni.$once('confirmDelivery',function(){
  135. init();
  136. })
  137. init()
  138. })
  139. function init() {
  140. getDayWorkItemList({
  141. status: 4
  142. }).then(res => {
  143. if (res.code == 200) {
  144. listData.value = res.rows;
  145. // 设置箱数
  146. for (var i = 0; i < listData.value.length; i++) {
  147. listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
  148. }
  149. console.log(res)
  150. }
  151. })
  152. getDayWorkItemList({
  153. status: 5
  154. }).then(res => {
  155. if (res.code == 200) {
  156. products.value = res.rows;
  157. // 设置箱数
  158. for (let i = 0; i < products.value.length; i++) {
  159. products.value[i].carriers = products.value[i].carrierName.split('、').length;
  160. turnoverContentTitle.value += products.value[i].carriers;
  161. turnoverSecondTitle.value = 'A' + " → " + products.value[i].deptName;
  162. }
  163. // 设置总数和目标
  164. console.log(res)
  165. }
  166. })
  167. }
  168. function reflush() {
  169. init();
  170. }
  171. function handleConfirmUnbind() {
  172. handleDoTurn();
  173. }
  174. function handleStartTurn() {
  175. // if(selection.value.length > 0){
  176. // let msg = '是否确认周转?';
  177. // confirm.value.open(msg);
  178. // }
  179. // turnoverTask.value.open(selection.value);
  180. uni.navigateTo({
  181. url: "/pages/startTurnover/index"
  182. })
  183. }
  184. function handleConfirmDelivery() {
  185. if(products.value.length > 0){
  186. let msg = '是否确认送达?';
  187. confirm.value.open(msg);
  188. }
  189. }
  190. function handleDoTurn() {
  191. // 设置周转状态
  192. for (var i = 0; i < products.value.length; i++) {
  193. products.value[i].status = '6';
  194. }
  195. updateDayWorkItemBatch(products.value).then(res => {
  196. if (res.code === 200) {
  197. uni.showToast({
  198. icon: 'success',
  199. title: '操作成功',
  200. duration: 2000
  201. });
  202. init();
  203. } else {
  204. uni.showToast({
  205. icon: 'error',
  206. title: '操作失败',
  207. duration: 2000
  208. });
  209. }
  210. })
  211. // 清空选中数组
  212. selection.value = [];
  213. }
  214. function isSelected(item) {
  215. return selection.value.includes(item);
  216. }
  217. function handleSelection(item) {
  218. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  219. if (buttonIndex > -1) {
  220. selection.value.splice(buttonIndex, 1); // 取消选中
  221. } else {
  222. selection.value.push(item); // 选中
  223. }
  224. console.log(selection.value, "selection");
  225. }
  226. function selectPending() {
  227. pendingClass.value['selecter'] = true;
  228. turnoverClass.value['selecter'] = false;
  229. pendingShow.value = true;
  230. turnoverShow.value = false;
  231. }
  232. function selectTurnover() {
  233. pendingClass.value['selecter'] = false;
  234. turnoverClass.value['selecter'] = true;
  235. pendingShow.value = false;
  236. turnoverShow.value = true;
  237. }
  238. </script>
  239. <style lang="scss">
  240. $navHeight: 48rpx;
  241. /* 导航栏样式 */
  242. .container {
  243. height: calc(100% - $navHeight);
  244. position: relative;
  245. top: $navHeight;
  246. background-color: #f5f5f5;
  247. }
  248. .selected {
  249. border: 1px solid #1684fc;
  250. }
  251. .nav {
  252. justify-content: space-around;
  253. // position: fixed;
  254. // top:0;
  255. width: 100%;
  256. height: $navHeight;
  257. border-bottom: 3rpx solid rgba(228, 231, 237, 1);
  258. background-color: rgba(255, 255, 255, 1);
  259. .img {
  260. width: 24rpx;
  261. height: 24rpx;
  262. position: fixed;
  263. right: 10rpx;
  264. top: 0;
  265. }
  266. }
  267. .selecter {
  268. height: 48rpx;
  269. color: rgba(25, 137, 250, 1);
  270. border-bottom: 3rpx solid rgba(25, 137, 250, 1);
  271. }
  272. /* 待周转样式 */
  273. .padding-container,
  274. .turnover-container {
  275. position: absolute;
  276. top: 56rpx;
  277. right: 0;
  278. bottom: 0rpx;
  279. left: 0;
  280. background-color: #f5f5f5;
  281. .scroll-container {
  282. position: absolute;
  283. top: 24rpx;
  284. right: 0;
  285. bottom: 136rpx;
  286. left: 0;
  287. }
  288. .bottom-btn-container {
  289. height: 10%;
  290. position: fixed;
  291. right: 0;
  292. bottom: 0;
  293. left: 0;
  294. height: 80rpx;
  295. border-top: 1px solid #999999;
  296. padding: 16rpx 32rpx;
  297. align-items: center;
  298. background-color: #fff;
  299. .bottom-btn {
  300. // padding-left: 0;
  301. // padding-top: 4rpx;
  302. flex: 1;
  303. font-size: 28rpx;
  304. color: #FFFFFF;
  305. background-color: #1684fc;
  306. }
  307. }
  308. }
  309. .padding-container {
  310. .scroll-container {
  311. .list-item {
  312. background-color: #fff;
  313. padding: 0 24rpx;
  314. padding-bottom: 24rpx;
  315. margin: 0 24rpx;
  316. margin-bottom: 24rpx;
  317. border-radius: 8rpx;
  318. .title-container {
  319. justify-content: space-between;
  320. margin-top: 8rpx;
  321. margin-bottom: 16rpx;
  322. .title {
  323. height: 48rpx;
  324. align-items: center;
  325. .label {
  326. color: #1684fc;
  327. font-size: 32rpx;
  328. font-weight: bold;
  329. &.code {
  330. color: #000000;
  331. margin-left: 32rpx;
  332. }
  333. }
  334. }
  335. }
  336. .item-info {
  337. margin-bottom: 16rpx;
  338. .label {
  339. font-size: 28rpx;
  340. width: 160rpx;
  341. color: #808080;
  342. &.right {
  343. flex: 1;
  344. color: #000000;
  345. }
  346. }
  347. }
  348. .right-info {
  349. justify-content: flex-end;
  350. margin-top: 2rpx;
  351. .label {
  352. font-size: 28rpx;
  353. color: #808080;
  354. }
  355. }
  356. }
  357. }
  358. }
  359. /* 周转中样式 */
  360. .turnover-container {
  361. .scroll-container {
  362. .item-container {
  363. // height: 90%;
  364. // padding: 8rpx 0 32rpx 0;
  365. margin: 0 24rpx;
  366. margin-bottom: 24rpx;
  367. background-color: rgba(255, 255, 255, 1);
  368. border-radius: 8rpx;
  369. .turnover-title {
  370. width: auto;
  371. justify-content: space-between;
  372. margin: 16rpx;
  373. font-weight: bold;
  374. .label {
  375. font-size: 28rpx;
  376. color: #808080;
  377. }
  378. }
  379. .list-container {
  380. margin: 0 24rpx 16rpx 24rpx;
  381. .list-container-item {
  382. border-bottom: 1px solid #999999;
  383. padding: 12rpx 8rpx;
  384. background-color: #EEF0F5;
  385. &.product-description {
  386. background-color: #ECF5FF;
  387. }
  388. .label {
  389. font-size: 28rpx;
  390. color: #999999;
  391. &.left-value {
  392. width: 152rpx;
  393. }
  394. &.right-value {
  395. flex: 1;
  396. color: #000000;
  397. }
  398. }
  399. }
  400. }
  401. .title-color {
  402. color: rgba(22, 132, 252, 1);
  403. font-size: 36rpx;
  404. font-weight: bold;
  405. }
  406. .second-info {
  407. font-size: 36rpx;
  408. font-weight: bold;
  409. margin-left: 32rpx;
  410. }
  411. .turnover-info {
  412. color: rgba(128, 128, 128, 1);
  413. position: absolute;
  414. top: 10rpx;
  415. right: 40rpx;
  416. font-size: 30rpx;
  417. }
  418. }
  419. }
  420. }
  421. </style>