issueDetails.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text
  7. style="font-size:44rpx;"
  8. class="gui-header-leader-btns gui-color-white font-icons"
  9. @tap="goBack"
  10. >&#xe6c5;</text>
  11. <!-- 导航文本此处也可以是其他自定义内容 -->
  12. <text
  13. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text"
  14. >发料明细</text>
  15. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  16. <!-- 实际宽度请根据自己情况设置 -->
  17. <view style="width:40px;" />
  18. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  19. </view>
  20. </template>
  21. <template #gBody>
  22. <view class="list-content">
  23. <view v-if="cardList.length > 0" class="list-panel">
  24. <view v-for="(item, key) in cardList" :key="key" class="panel">
  25. <view class="flex-row">
  26. <view class="panel-row">
  27. <text>物料编码</text>
  28. <text>{{ item.erpMaterialId }}</text>
  29. </view>
  30. <view class="panel-row">
  31. <text>物料批次</text>
  32. <text>{{ item.wmsLabelMasterId }}</text>
  33. </view>
  34. <view class="panel-row">
  35. <text>物料名称</text>
  36. <text>{{ item.materialName }}</text>
  37. </view>
  38. <view class="panel-row">
  39. <text>批次数量</text>
  40. <text>{{ item.batchQty }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view v-else>
  46. <view class="bg-image">
  47. <image src="@/static/empty.png" mode="heightFix" />
  48. <text>这里什么都没有...</text>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. </gui-page>
  54. </template>
  55. <script>
  56. import {
  57. ref,
  58. defineComponent,
  59. computed
  60. } from 'vue'
  61. import {
  62. onReachBottom
  63. } from '@dcloudio/uni-app'
  64. export default defineComponent({
  65. setup(options) {
  66. const issueId = options.issueId ?? ''
  67. const cardList = ref([])
  68. const stateToText = ref('')
  69. const queryParams = ref({
  70. pageSize: 10,
  71. pageNo: 1
  72. })
  73. const stateComputed = computed(() => {
  74. return (state) => {
  75. switch (state) {
  76. case 0:
  77. stateToText.value = '待发料'
  78. break
  79. case 1:
  80. stateToText.value = '已发料-部分'
  81. break
  82. case 2:
  83. stateToText.value = '已发料-全部'
  84. break
  85. case 3:
  86. stateToText.value = '发料成功-部分'
  87. break
  88. case 4:
  89. stateToText.value = '发料成功-全部'
  90. break
  91. }
  92. return stateToText.value
  93. }
  94. })
  95. // 发料明细
  96. uni.$reqGet('issueDetail', {
  97. id: issueId,
  98. ...queryParams.value
  99. })
  100. .then(({
  101. data
  102. }) => {
  103. cardList.value = data.list ?? []
  104. })
  105. const goBack = function() {
  106. uni.navigateBack({
  107. delta: 1
  108. })
  109. }
  110. const handleNavigateTo = function() {
  111. uni.navigateTo({
  112. url: '/pages/workbranch/warehouse/productionIssue/demandDetails'
  113. })
  114. }
  115. // uniapp移动端触底事件
  116. onReachBottom(() => {
  117. queryParams.value.pageNo += 1
  118. // 生产发料主列表
  119. uni.$reqGet('issueDetail', {
  120. id: issueId,
  121. ...queryParams.value
  122. })
  123. .then(({
  124. data
  125. }) => {
  126. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  127. })
  128. })
  129. return {
  130. goBack,
  131. cardList,
  132. stateComputed,
  133. handleNavigateTo
  134. }
  135. }
  136. })
  137. </script>
  138. <style lang="scss" scoped>
  139. .gui-header-leader-btns {
  140. color: black;
  141. font-size: 24px !important;
  142. margin-left: 24rpx;
  143. }
  144. .list-content {
  145. margin-top: 80px;
  146. background-color: #edeeee;
  147. }
  148. </style>