outSourceList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. style="font-size: 1rem;"
  15. >备料单列表</text>
  16. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  17. <!-- 实际宽度请根据自己情况设置 -->
  18. <view style="width:40px;" />
  19. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  20. </view>
  21. </template>
  22. <template #gBody>
  23. <view class="list-content">
  24. <view v-if="cardList?.length > 0" class="list-panel">
  25. <div
  26. v-for="(item, key) in cardList"
  27. :key="key"
  28. class="panel"
  29. @click="handleToOutSourceMaterials(item)"
  30. >
  31. <div class="panel-row">
  32. <span>{{ item.prepareOrderNo }}</span>
  33. <span class="font-icons">前往备料&#xe66b;</span>
  34. </div>
  35. <div class="panel-row">
  36. <span>备料状态</span>
  37. <span>{{ computedState(item.syntheticalStatus) }}</span>
  38. </div>
  39. </div>
  40. </view>
  41. <view v-else>
  42. <view class="bg-image">
  43. <image src="@/static/empty.png" mode="heightFix" />
  44. <text>这里什么都没有...</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. </gui-page>
  50. </template>
  51. <script>
  52. import {
  53. onReachBottom
  54. } from '@dcloudio/uni-app'
  55. import {
  56. ref,
  57. defineComponent,
  58. computed,
  59. onMounted
  60. } from 'vue'
  61. export default defineComponent({
  62. setup() {
  63. const queryParams = ref({
  64. pageSize: 10,
  65. pageNo: 1,
  66. prepareType: '1'
  67. })
  68. const scanBatchNumber = ref('')
  69. const cardList = ref([])
  70. const computedState = computed(() => {
  71. return item => {
  72. switch (item) {
  73. case 0:
  74. return '待备料'
  75. case 1:
  76. return '已备料'
  77. case 2:
  78. return '已发料'
  79. }
  80. }
  81. })
  82. const search = function() {
  83. uni.$reqGet('getPrepareMatersList', {
  84. ...queryParams.value
  85. })
  86. .then(({
  87. code,
  88. data,
  89. msg
  90. }) => {
  91. if (code === 0) {
  92. cardList.value = data?.list
  93. } else {
  94. uni.showToast({
  95. title: msg,
  96. icon: 'none',
  97. duration: 2000
  98. })
  99. }
  100. })
  101. }
  102. onMounted(() => {
  103. search()
  104. })
  105. const goBack = function() {
  106. uni.removeStorageSync('masterId')
  107. uni.$goHome()
  108. }
  109. const handleToOutSourceMaterials = function(params) {
  110. uni.setStorageSync('masterId', JSON.stringify({
  111. id: params?.id
  112. }))
  113. uni.navigateTo({
  114. url: `/pages/workbranch/warehouse/outSourceMaterial/outSourceMaterials`
  115. })
  116. }
  117. // uniapp移动端触底事件
  118. onReachBottom(() => {
  119. queryParams.value.pageNo += 1
  120. uni.$reqGet('getPrepareMatersList', queryParams.value)
  121. .then(({
  122. code,
  123. data,
  124. msg
  125. }) => {
  126. if (code === 0) {
  127. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  128. } else {
  129. uni.showToast({
  130. title: msg,
  131. icon: 'none',
  132. duration: 2000
  133. })
  134. }
  135. })
  136. })
  137. return {
  138. goBack,
  139. cardList,
  140. search,
  141. computedState,
  142. queryParams,
  143. scanBatchNumber,
  144. handleToOutSourceMaterials
  145. }
  146. }
  147. })
  148. </script>
  149. <style lang="scss" scoped>
  150. .gui-header-leader-btns {
  151. color: black;
  152. font-size: 24px !important;
  153. margin-left: 24rpx;
  154. }
  155. .list-content {
  156. margin-top: 80px;
  157. min-height: calc(100vh - 80px);
  158. background-color: #edeeee;
  159. }
  160. span,
  161. text {
  162. font-size: 12px;
  163. }
  164. .card-list-flexbox {
  165. display: flex;
  166. flex-direction: row;
  167. align-items: center;
  168. flex-wrap: wrap;
  169. margin: 3px 2px;
  170. .card-list-item {
  171. width: 750rpx;
  172. min-height: 40px;
  173. margin: 2rpx 0;
  174. display: flex;
  175. flex-direction: row;
  176. align-items: center;
  177. justify-content: space-between;
  178. background-color: #fff;
  179. uni-text {
  180. font-size: 14px;
  181. min-height: 40px;
  182. text-align: left;
  183. padding: 0 12px;
  184. display: flex;
  185. flex-direction: row;
  186. align-items: center;
  187. }
  188. .text-1 {
  189. flex: 1;
  190. min-height: 40px;
  191. justify-content: flex-start;
  192. }
  193. .text-2 {
  194. flex: 3;
  195. min-height: 40px;
  196. justify-content: flex-end;
  197. margin-right: 4px;
  198. padding: 2px 6px;
  199. }
  200. }
  201. .card-list-item:nth-of-type(1) {
  202. .text-1 {
  203. flex: 9;
  204. font-weight: bold;
  205. color: black !important;
  206. }
  207. .text-2 {
  208. flex: 4;
  209. display: flex;
  210. flex-direction: row;
  211. justify-content: flex-end;
  212. align-items: center;
  213. color: limegreen !important;
  214. }
  215. }
  216. }
  217. </style>