index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. <!-- <pending v-if='pendingShow'/>
  9. <turnover v-if='turnoverShow'/> -->
  10. <!-- 待周转页面 -->
  11. <view class="padding-container" v-if='pendingShow'>
  12. <scroll-view class="scroll-container" scroll-y>
  13. <view v-for="(item, index) in listData" :key="index"
  14. :class="{'list-item':true,'selected':isSelected(item)}" @click="handleSelection(item,index)">
  15. <view class="title-container uni-row">
  16. <view class="title uni-row">
  17. <text class="label">{{ item['door'] }}</text>
  18. <text class="label code">{{ item['process'] }}</text>
  19. <text class="label code" style="margin-left: 16rpx;">→</text>
  20. <text class="label code" style="margin-left: 16rpx;">{{ item['car'] }}</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['batch'] }}</text>
  28. </view>
  29. <view class="item-info uni-row"> <text class="label">箱数</text>
  30. <text class="label right ">{{ item['cases'] }}</text>
  31. </view>
  32. <view class="item-info uni-row">
  33. <text class="label">数量</text>
  34. <text class="label right">{{ item['amount'] }}</text>
  35. </view>
  36. <view class="item-info uni-row">
  37. <text class="label">箱号</text>
  38. <text class="label right">{{ item['caseNumber']}}</text>
  39. </view>
  40. <view class="item-info uni-row">
  41. <text class="label">申请时间</text>
  42. <text class="label right">{{ item['applyTime']}}</text>
  43. </view>
  44. <view class="item-info uni-row">
  45. <text class="label">申请人</text>
  46. <text class="label right">{{ item['applier']}}</text>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. <view class="bottom-btn-container uni-row">
  51. <button class="bottom-btn" @click="handleStartTurnover">开始周转</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 class="turnover-title uni-row">
  60. <view class="uni-row">
  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' v-for="(item,index) in products" :key='index'>
  67. <view class="list-container-item product-description uni-row">
  68. <text class="label left-value">产品描述</text>
  69. <text class="label right-value">{{item['description']}}</text>
  70. </view>
  71. <view class="list-container-item uni-row">
  72. <text class="label left-value">批次</text>
  73. <text class="label right-value">{{item['batch']}}</text>
  74. </view>
  75. <view class="list-container-item uni-row">
  76. <text class="label left-value">箱数</text>
  77. <text class="label right-value">{{item['cases']}}</text>
  78. </view>
  79. <view class="list-container-item uni-row">
  80. <text class="label left-value">箱号</text>
  81. <text class="label right-value">{{item['boxno']}}</text>
  82. </view>
  83. </view>
  84. </view>
  85. <view class='item-container'>
  86. <view class="turnover-title uni-row">
  87. <view class="uni-row">
  88. <view><text class='title-color'>{{turnoverContentTitle}}</text></view>
  89. <view><text class="second-info">{{turnoverSecondTitle}}</text></view>
  90. </view>
  91. <view><text class="label">周转中</text></view>
  92. </view>
  93. <view class='list-container' v-for="(item,index) in products" :key='index'>
  94. <view class="list-container-item product-description uni-row">
  95. <text class="label left-value">产品描述</text>
  96. <text class="label right-value">{{item['description']}}</text>
  97. </view>
  98. <view class="list-container-item uni-row">
  99. <text class="label left-value">批次</text>
  100. <text class="label right-value">{{item['batch']}}</text>
  101. </view>
  102. <view class="list-container-item uni-row">
  103. <text class="label left-value">箱数</text>
  104. <text class="label right-value">{{item['cases']}}</text>
  105. </view>
  106. <view class="list-container-item uni-row">
  107. <text class="label left-value">箱号</text>
  108. <text class="label right-value">{{item['boxno']}}</text>
  109. </view>
  110. </view>
  111. </view>
  112. </scroll-view>
  113. <view class='bottom-btn-container uni-row'>
  114. <button type='primary' class='bottom-btn'>开始周转</button>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script setup>
  120. import {
  121. ref
  122. } from 'vue'
  123. import {
  124. onLoad,
  125. onReady
  126. } from '@dcloudio/uni-app'
  127. // import pending from './pending';
  128. // import turnover from './turnover';
  129. const pendingTitle = ref('待周转')
  130. const turnoverTitle = ref('周转中')
  131. const turnoverContentTitle = ref('')
  132. const turnoverSecondTitle = ref('')
  133. const sum = ref(0)
  134. const pendingClass = ref({
  135. selecter: true
  136. })
  137. const turnoverClass = ref({
  138. selecter: false
  139. })
  140. const isSelected = (item) => {
  141. return selection.value.includes(item);
  142. }
  143. const handleSelection = (item, index) => {
  144. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  145. if (buttonIndex > -1) {
  146. selection.value.splice(buttonIndex, 1); // 取消选中
  147. } else {
  148. selection.value.push(item); // 选中
  149. }
  150. console.log(selection.value, "selection");
  151. }
  152. const selection = ref([])
  153. const pendingShow = ref(true)
  154. const turnoverShow = ref(false)
  155. const listData = ref([{
  156. door: "A门",
  157. process: "粗磨",
  158. car: "NC车",
  159. batch: "MBA5444002",
  160. cases: 6,
  161. amount: 780,
  162. caseNumber: "X12522、X55222、X15522、J5211、J5211",
  163. applyTime: "2023-06-15 15:52:12",
  164. applier: "王伟"
  165. },
  166. {
  167. door: "B门",
  168. process: "手工校直",
  169. car: "粗磨Ⅱ",
  170. batch: "MBA5444002",
  171. cases: 6,
  172. amount: 780,
  173. caseNumber: "X12522、X55222、X15522、J5211、J5211",
  174. applyTime: "2023-06-15 15:52:12",
  175. applier: "王伟"
  176. },
  177. {
  178. door: "B门",
  179. process: "手工校直",
  180. car: "粗磨Ⅱ",
  181. batch: "MBA5444002",
  182. cases: 6,
  183. amount: 780,
  184. caseNumber: "X12522、X55222、X15522、J5211、J5211",
  185. applyTime: "2023-06-15 15:52:12",
  186. applier: "王伟"
  187. }
  188. ])
  189. const products = ref([{
  190. description: '博士_0395614149_15*110.1',
  191. batch: 'DC23727410070',
  192. cases: 5,
  193. boxno: 'X12522、X552222、X15522、J5211、J5112'
  194. },
  195. {
  196. description: '博士_0395614149_15*110.1',
  197. batch: 'DC23727410070',
  198. cases: 5,
  199. boxno: 'X12522、X552222、X15522、J5211、J5112'
  200. },
  201. {
  202. description: '博士_0395614149_15*110.1',
  203. batch: 'DC23727410070',
  204. cases: 5,
  205. boxno: 'X12522、X552222、X15522、J5211、J5112'
  206. }
  207. ])
  208. function handleStartTurnover() {
  209. uni.navigateTo({
  210. url: "/pages/startTurnover/index?turnoverList=" + JSON.stringify(selection.value)
  211. })
  212. }
  213. onReady(() => {
  214. init()
  215. })
  216. const init = () => {
  217. for (let i = 0; i < products.value.length; i++) {
  218. sum.value += parseInt(products.value[i]['cases'].toString());
  219. }
  220. // this.title = '热处理' + this.sum + '箱'
  221. turnoverContentTitle.value = sum.value + '箱';
  222. turnoverSecondTitle.value = listData.value[0]['process'].toString() + ' → ' + listData.value[0]['car']
  223. .toString();
  224. }
  225. const selectPending = () => {
  226. pendingClass.value['selecter'] = true;
  227. turnoverClass.value['selecter'] = false;
  228. pendingShow.value = true;
  229. turnoverShow.value = false;
  230. }
  231. const 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: 100%;
  243. background-color: #f5f5f5;
  244. }
  245. .selected {
  246. border: 1px solid #1684fc;
  247. }
  248. .nav {
  249. justify-content: space-around;
  250. width: 100%;
  251. height: $navHeight;
  252. border-bottom: 3rpx solid rgba(228, 231, 237, 1);
  253. background-color: rgba(255, 255, 255, 1);
  254. .img {
  255. width: 24rpx;
  256. height: 24rpx;
  257. position: fixed;
  258. right: 10rpx;
  259. top: 0;
  260. }
  261. }
  262. .selecter {
  263. height: 48rpx;
  264. color: rgba(25, 137, 250, 1);
  265. border-bottom: 3rpx solid rgba(25, 137, 250, 1);
  266. }
  267. /* 待周转样式 */
  268. .padding-container,
  269. .turnover-container {
  270. position: absolute;
  271. top: 56rpx;
  272. right: 0;
  273. bottom: 0rpx;
  274. left: 0;
  275. background-color: #f5f5f5;
  276. .scroll-container {
  277. position: absolute;
  278. top: 24rpx;
  279. right: 0;
  280. bottom: 136rpx;
  281. left: 0;
  282. }
  283. .bottom-btn-container {
  284. height: 10%;
  285. position: absolute;
  286. right: 0;
  287. bottom: 0;
  288. left: 0;
  289. height: 80rpx;
  290. border-top: 1px solid #999999;
  291. padding: 16rpx 32rpx;
  292. align-items: center;
  293. background-color: #fff;
  294. .bottom-btn {
  295. // padding-left: 0;
  296. // padding-top: 4rpx;
  297. flex: 1;
  298. font-size: 28rpx;
  299. color: #FFFFFF;
  300. background-color: #1684fc;
  301. }
  302. }
  303. }
  304. .padding-container {
  305. .scroll-container {
  306. .list-item {
  307. background-color: #fff;
  308. padding: 0 24rpx;
  309. padding-bottom: 24rpx;
  310. margin: 0 24rpx;
  311. margin-bottom: 24rpx;
  312. border-radius: 8rpx;
  313. .title-container {
  314. justify-content: space-between;
  315. margin-top: 8rpx;
  316. margin-bottom: 16rpx;
  317. .title {
  318. height: 48rpx;
  319. align-items: center;
  320. .label {
  321. color: #1684fc;
  322. font-size: 32rpx;
  323. font-weight: bold;
  324. &.code {
  325. color: #000000;
  326. margin-left: 32rpx;
  327. }
  328. }
  329. }
  330. }
  331. .item-info {
  332. margin-bottom: 16rpx;
  333. .label {
  334. font-size: 28rpx;
  335. width: 160rpx;
  336. color: #808080;
  337. &.right {
  338. flex: 1;
  339. color: #000000;
  340. }
  341. }
  342. }
  343. .right-info {
  344. justify-content: flex-end;
  345. margin-top: 2rpx;
  346. .label {
  347. font-size: 28rpx;
  348. color: #808080;
  349. }
  350. }
  351. }
  352. }
  353. }
  354. /* 周转中样式 */
  355. .turnover-container {
  356. .scroll-container {
  357. .item-container {
  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: 32rpx;
  398. font-weight: bold;
  399. }
  400. .second-info {
  401. font-size: 32rpx;
  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>