index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <view v-if="isMaskShow" class="mask">
  3. </view>
  4. <view class="uni-column"
  5. style="height: 100%; background-color: #f5f5f5;padding: 8px;position: fixed;left: 0;right: 0;">
  6. <view class="box-bg uni-row">
  7. <view class="input-view uni-row">
  8. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  9. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入搜索关键词" />
  10. </view>
  11. <view class="search" @click="handleSearch">
  12. 搜索
  13. </view>
  14. </view>
  15. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  16. <text>暂无批次</text>
  17. </view>
  18. <view v-else class="scroll-container" style="padding-bottom: 150rpx">
  19. <view v-for="(item, index) in listData" :key="index" class="list-item"
  20. @click="handleToreportingForWork(item)">
  21. <view class="item-info uni-row">
  22. <text class="label">外协单:</text>
  23. <text class="label right">{{ item.formCode }}</text>
  24. </view>
  25. <view class="item-info uni-row">
  26. <text class="label">外协商:</text>
  27. <text class="label right">{{ item.supplierName }}</text>
  28. </view>
  29. <view class="item-info uni-row">
  30. <text class="label">带箱方式:</text>
  31. <text class="label right">{{ item.packagingMethod == '0' ? '原箱' : '新箱' }}</text>
  32. </view>
  33. <view class="item-info uni-row">
  34. <text class="label">箱子数量:</text>
  35. <text class="label right">{{ item.carrierCount }}</text>
  36. </view>
  37. <view class="status-btn uni-row">
  38. <view class=" uni-row">
  39. <button class="reporting-tag" size="mini" @click.stop="handleCarriers(item)">箱号详情</button>
  40. </view>
  41. </view>
  42. </view>
  43. <uni-load-more v-if="total > 0" iconType="auto" :content-text="contentText" :status="status"
  44. @clickLoadMore="clickLoadMore" />
  45. </view>
  46. <!-- <uni-section title="外协单列表" type="line">
  47. <uni-list border-full>
  48. <uni-list-item v-for="(item, index) in listData" :key="index" class="list-item"
  49. @click="handleToreportingForWork(item)">
  50. </uni-list-item>
  51. </uni-list>
  52. </uni-section> -->
  53. </view>
  54. </template>
  55. <script setup>
  56. import {
  57. normalizeProps,
  58. reactive,
  59. onMounted,
  60. ref
  61. } from 'vue'
  62. import {
  63. onLoad,
  64. onReady,
  65. onUnload,
  66. onShow
  67. } from '@dcloudio/uni-app'
  68. import {
  69. getOutsourceOrderList
  70. } from '@/api/business/outsource.js'
  71. import {
  72. store
  73. } from '@/store/index.js'
  74. import {
  75. toHHmmss
  76. } from '@/utils/common.js'
  77. import {
  78. onPullDownRefresh
  79. } from "@dcloudio/uni-app"
  80. const turnoverApplicationDialog = ref(null)
  81. const selectProduction = ref(null)
  82. const lotDialog = ref(null)
  83. const listData = ref([])
  84. const curPlan = ref(null)
  85. const bizDayworkObj = ref({})
  86. const bottomStatus = ref(false) // 底部按钮显示
  87. const paging = ref();
  88. const reqParam = ref(null);
  89. const total = ref(0)
  90. const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态
  91. const keywords = ref(null)
  92. const contentText = ref({
  93. contentdown: '查看更多',
  94. contentrefresh: '加载中',
  95. contentnomore: '没有更多'
  96. })
  97. const status = ref("more")
  98. // 在数据中定义一个变量来控制遮罩层的显示
  99. const isMaskShow = ref(false);
  100. const queryParams = ref({
  101. orderByColumn: 'createTime',
  102. isAsc: 'descending',
  103. pageNum: 1,
  104. pageSize: 10,
  105. })
  106. onLoad(() => {
  107. })
  108. // 页面下拉刷新操作
  109. onPullDownRefresh(() => {
  110. uni.stopPullDownRefresh();
  111. reflush();
  112. })
  113. onShow(() => {
  114. reflush();
  115. });
  116. function reflush() {
  117. getList()
  118. }
  119. function handleCarriers(item) {
  120. uni.navigateTo({
  121. url: "/pages/outsourcedReturnCheck/carriers",
  122. success: (res) => {
  123. // 通过eventChannel向被打开页面传送数据
  124. res.eventChannel.emit('acceptDataFromOpenerPage', {
  125. data: item
  126. })
  127. }
  128. })
  129. }
  130. function clickLoadMore() {
  131. console.log('clickLoadMore')
  132. loadMore()
  133. }
  134. function loadMore() {
  135. console.log('loadMore')
  136. if (keywords.value != null && keywords.value != '') {
  137. queryParams.value.keywords = keywords.value
  138. } else {
  139. queryParams.value.keywords = null;
  140. }
  141. if ((queryParams.value.pageNum * queryParams.value.pageSize) >= total.value) {
  142. status.value = 'no-more'
  143. return
  144. }
  145. queryParams.value.pageNum = queryParams.value.pageNum + 1
  146. getOutsourceOrderList(queryParams.value).then(res => {
  147. if (res.code === 200) {
  148. // console.log(res)
  149. listData.value.push(...res.rows)
  150. total.value = res.total
  151. console.log(res.rows.length)
  152. if (res.rows.length === 0) {
  153. status.value = 'no-more'
  154. queryParams.value.pageNum = queryParams.value.pageNum - 1
  155. }
  156. console.log(queryParams.value.pageNum)
  157. } else {
  158. total.value = 0
  159. uni.showToast({
  160. title: res.message,
  161. icon: 'none'
  162. })
  163. }
  164. }).catch(err => {
  165. console.log(err)
  166. })
  167. }
  168. function getList() {
  169. if (keywords.value != null && keywords.value != '') {
  170. queryParams.value.keywords = keywords.value
  171. } else {
  172. queryParams.value.keywords = null;
  173. }
  174. queryParams.value.pageNum = 1;
  175. getOutsourceOrderList(queryParams.value).then(res => {
  176. // console.log(res)
  177. if (res.code === 200) {
  178. listData.value = res.rows
  179. total.value = res.total
  180. if (total.value > listData.value.length) {
  181. status.value = 'more'
  182. }
  183. } else {
  184. total.value = 0
  185. uni.showToast({
  186. title: res.message,
  187. icon: 'none'
  188. })
  189. }
  190. }).catch(err => {
  191. console.log(err)
  192. })
  193. }
  194. function handleSearch() {
  195. getList()
  196. }
  197. </script>
  198. <style lang="scss">
  199. $nav-height: 60rpx;
  200. /* 遮罩层样式 */
  201. .mask {
  202. position: fixed;
  203. /* 固定定位,覆盖整个屏幕 */
  204. top: 0;
  205. left: 0;
  206. right: 0;
  207. bottom: 0;
  208. background-color: rgba(0, 0, 0, 0.3);
  209. /* 黑色背景,透明度30% */
  210. display: flex;
  211. justify-content: center;
  212. /* 水平居中 */
  213. align-items: center;
  214. /* 垂直居中 */
  215. z-index: 1000;
  216. /* 确保遮罩层在其他元素之上 */
  217. }
  218. .box-bg {
  219. width: 94%;
  220. background-color: #F5F5F5;
  221. padding: 5rpx 16rpx;
  222. justify-content: space-around;
  223. align-items: center;
  224. margin: 24rpx auto 0;
  225. .input-view {
  226. width: 100%;
  227. flex: 4;
  228. background-color: #f8f8f8;
  229. height: $nav-height;
  230. border: 1rpx solid #999;
  231. border-radius: 15rpx;
  232. padding: 0 15rpx;
  233. flex-wrap: nowrap;
  234. margin: 0 10rpx 0;
  235. line-height: $nav-height;
  236. .input-uni-icon {
  237. line-height: $nav-height;
  238. }
  239. .nav-bar-input {
  240. width: 80%;
  241. height: $nav-height;
  242. line-height: $nav-height;
  243. padding: 0 5rpx;
  244. background-color: #f8f8f8;
  245. }
  246. }
  247. .search {
  248. width: 20%;
  249. text-align: center;
  250. color: #808080;
  251. }
  252. }
  253. .list-title {
  254. width: 100%;
  255. margin-top: 16rpx;
  256. height: 64rpx;
  257. line-height: 64rpx;
  258. align-items: center;
  259. margin-left: 32rpx;
  260. .label {
  261. font-size: 32rpx;
  262. margin-right: 24rpx;
  263. }
  264. .icon-gear {
  265. font-size: 56rpx;
  266. }
  267. }
  268. .switch {
  269. margin-top: -8rpx;
  270. transform: scale(0.7);
  271. }
  272. .scroll-container {
  273. width: 92%;
  274. margin: 24rpx auto 0 auto;
  275. height: calc(90% - 100rpx);
  276. overflow: auto;
  277. }
  278. .list-item {
  279. background-color: #fff;
  280. position: relative;
  281. padding: 16rpx;
  282. padding-bottom: 24rpx;
  283. margin-bottom: 24rpx;
  284. border-radius: 24rpx;
  285. .title-container {
  286. margin-top: 8rpx;
  287. margin-bottom: 16rpx;
  288. .title {
  289. height: 48rpx;
  290. align-items: center;
  291. .label {
  292. font-size: 32rpx;
  293. font-weight: bold;
  294. &.code {
  295. margin-left: 8rpx;
  296. }
  297. }
  298. }
  299. .tag {
  300. border: 1px solid #1CE5B0;
  301. background-color: #F6FFFD;
  302. padding: 8rpx;
  303. border-radius: 8rpx;
  304. .label {
  305. color: #1CE5B0;
  306. font-size: 24rpx;
  307. }
  308. &.finished {
  309. border: 1px solid #BBBBBB;
  310. background-color: #F5F5F5;
  311. .label {
  312. color: #BBBBBB;
  313. }
  314. }
  315. &.turnover {
  316. border: 1px solid #FF7901;
  317. background-color: #F6FFFD;
  318. .label {
  319. color: #FF7901;
  320. }
  321. }
  322. }
  323. }
  324. .item-info {
  325. margin-bottom: 8rpx;
  326. .label {
  327. font-size: 28rpx;
  328. width: 220rpx;
  329. color: #808080;
  330. &.right {
  331. flex: 1;
  332. color: #000000;
  333. }
  334. }
  335. }
  336. .status-btn {
  337. justify-content: flex-end;
  338. align-items: center;
  339. .turnover-tag {
  340. padding-right: 12rpx;
  341. padding-left: 12rpx;
  342. border-radius: 8rpx;
  343. border: 1rpx solid #FF7901;
  344. background-color: #FF7901;
  345. font-size: 28rpx;
  346. color: #FFFFFF;
  347. }
  348. .reporting-tag {
  349. padding-right: 12rpx;
  350. padding-left: 12rpx;
  351. border-radius: 8rpx;
  352. margin-left: 16rpx;
  353. border: 1rpx solid #1684fc;
  354. background-color: #1684fc;
  355. font-size: 28rpx;
  356. color: #FFFFFF;
  357. }
  358. }
  359. }
  360. .bottom {
  361. height: 10%;
  362. position: fixed;
  363. right: 0;
  364. bottom: 0;
  365. left: 0;
  366. height: 100rpx;
  367. border-top: 1px solid #999999;
  368. padding: 16rpx 32rpx;
  369. align-items: center;
  370. background-color: #fff;
  371. justify-content: space-evenly;
  372. .start-batch-btn {
  373. flex: 1;
  374. height: 80rpx;
  375. line-height: 80rpx;
  376. border-radius: 8rpx;
  377. color: #FFFFFF;
  378. font-size: 28rpx;
  379. }
  380. }
  381. </style>