index.vue 8.7 KB

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