demandDetails.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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:34rpx;"
  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="panel-row">
  26. <text>物料编码</text>
  27. <text>{{ item.materialNo }}</text>
  28. </view>
  29. <view class="panel-row">
  30. <text>物料名称</text>
  31. <text>{{ item.materialName }}</text>
  32. </view>
  33. <view class="panel-row">
  34. <text>需求数量</text>
  35. <text>{{ ~~item.needQty }}</text>
  36. </view>
  37. <view class="panel-row">
  38. <text>已发数量</text>
  39. <text>{{ ~~item.totalSendCount }}</text>
  40. </view>
  41. <view class="panel-row">
  42. <text>待发数量</text>
  43. <text>{{ ~~item.overplusSendCount }}</text>
  44. </view>
  45. <view class="panel-row">
  46. <text>本次发料</text>
  47. <text>{{ ~~item.currentSendCount }}</text>
  48. </view>
  49. <view class="panel-row-operation">
  50. <text class="tag-skyblue" @click="handleNavigateTo(item)">发料扫描</text>
  51. </view>
  52. <Modal
  53. v-model:modalState="modalState"
  54. v-model:title="modalTitle"
  55. v-model:content="modalContent"
  56. @complate="complate"
  57. />
  58. </view>
  59. </view>
  60. <view v-else>
  61. <view class="bg-image">
  62. <image src="@/static/empty.png" mode="heightFix" />
  63. <text>这里什么都没有...</text>
  64. </view>
  65. </view>
  66. </view>
  67. <gui-right-menus>
  68. <!-- 扩展按钮 -->
  69. <template #menus-more>
  70. <view
  71. hover-class="gui-tap"
  72. class="menu-items gui-bg-green gui-flex gui-columns gui-justify-content-center"
  73. @click="modalState = true"
  74. >
  75. <text class="menu-text gui-block gui-text-center gui-color-white">完成发料</text>
  76. </view>
  77. </template>
  78. <!-- 核心按钮 -->
  79. <template #menus-primary>
  80. <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
  81. <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons">&#xe614;</text>
  82. <text class="menu-text gui-color-white gui-block gui-text-center">功能</text>
  83. </view>
  84. </template>
  85. </gui-right-menus>
  86. </template>
  87. </gui-page>
  88. </template>
  89. <script>
  90. import {
  91. ref,
  92. defineComponent
  93. } from 'vue'
  94. import Modal from '@/components/modal.vue'
  95. import {
  96. onReachBottom
  97. } from '@dcloudio/uni-app'
  98. export default defineComponent({
  99. name: 'DemanDetails',
  100. components: {
  101. Modal
  102. },
  103. setup(options) {
  104. const issueId = options.issueId ?? ''
  105. const modalState = ref(false)
  106. const modalTitle = ref('警告')
  107. const modalContent = ref('确定要完成发料吗?')
  108. // 传入模态对话框当中的索引,用于列表的索引查找
  109. const cardList = ref([])
  110. const queryParams = ref({
  111. pageSize: 10,
  112. pageNo: 1
  113. })
  114. // 需求明细
  115. uni.$reqGet('demandDetail', {
  116. masterId: issueId,
  117. ...queryParams.value
  118. })
  119. .then(({
  120. data
  121. }) => {
  122. cardList.value = data.list ?? []
  123. })
  124. const goBack = function() {
  125. uni.$goBack('/pages/workbranch/warehouse/productionIssue/productionIssue')
  126. }
  127. const handleNavigateTo = function(item) {
  128. uni.navigateTo({
  129. url: `/pages/workbranch/warehouse/productionIssue/issuePage?id=${item?.id}`
  130. })
  131. }
  132. const complate = function() {
  133. uni.$reqPut('demandDetailFinishIssue', {
  134. masterId: issueId
  135. })
  136. .then(({
  137. code,
  138. msg
  139. }) => {
  140. if (code === 0) {
  141. uni.$grace.msg('已完成发料')
  142. } else {
  143. uni.$grace.msg(msg)
  144. }
  145. })
  146. }
  147. // uniapp移动端触底事件
  148. onReachBottom(() => {
  149. queryParams.value.pageNo += 1
  150. // 生产发料主列表
  151. uni.$reqGet('demandDetail', {
  152. masterId: issueId,
  153. ...queryParams.value
  154. })
  155. .then(({
  156. data
  157. }) => {
  158. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  159. })
  160. })
  161. return {
  162. goBack,
  163. modalState,
  164. modalTitle,
  165. modalContent,
  166. cardList,
  167. handleNavigateTo,
  168. complate
  169. }
  170. }
  171. })
  172. </script>
  173. <style lang="scss" scoped>
  174. .gui-header-leader-btns {
  175. color: black;
  176. font-size: 24px !important;
  177. margin-left: 24rpx;
  178. }
  179. .list-content {
  180. margin-top: 80px;
  181. background-color: #edeeee;
  182. }
  183. .tag-limegreen,
  184. .tag-skyblue {
  185. padding: 0 8px;
  186. margin: 4px;
  187. border-radius: 5px;
  188. font-size: 12px;
  189. color: white;
  190. }
  191. .tag-limegreen {
  192. background-color: #2fb657;
  193. }
  194. .tag-skyblue {
  195. background-color: #00a0e9;
  196. }
  197. </style>