infoDetailsLayout.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="container">
  3. <hwk :baseInfo="hwkInfo" v-if="currentTab == 0"></hwk>
  4. <crk :caId="caId" v-if="currentTab == 1"></crk>
  5. <zj :caId="caId" v-if="currentTab == 2"></zj>
  6. <lqjc :baseInfo="lqjcInfo" v-if="currentTab == 3"></lqjc>
  7. <sy :baseInfo="syInfo" v-if="currentTab == 4"></sy>
  8. <!-- 底部导航栏 -->
  9. <view class="tab-bar">
  10. <view
  11. class="tab-item"
  12. :class="{ active: currentTab == 0 }"
  13. @click="switchTab(0)"
  14. >
  15. <text
  16. class="iconfont icon-huoweika"
  17. :style="{ color: currentTab === 0 ? '#1d5fdf' : '748498' }"
  18. ></text>
  19. <text>货位卡</text>
  20. </view>
  21. <view
  22. class="tab-item"
  23. :class="{ active: currentTab == 1 }"
  24. @click="switchTab(1)"
  25. >
  26. <text
  27. class="iconfont icon-churuku"
  28. :style="{ color: currentTab === 1 ? '#1d5fdf' : '748498' }"
  29. ></text>
  30. <text>出入库</text>
  31. </view>
  32. <view
  33. class="tab-item"
  34. :class="{ active: currentTab == 2 }"
  35. @click="switchTab(2)"
  36. >
  37. <text
  38. class="iconfont icon-zhijiandaibanrenwu"
  39. :style="{ color: currentTab === 2 ? '#1d5fdf' : '748498' }"
  40. ></text>
  41. <text>质检</text>
  42. </view>
  43. <view
  44. class="tab-item"
  45. :class="{ active: currentTab == 3 }"
  46. @click="switchTab(3)"
  47. >
  48. <text
  49. class="iconfont icon-liangqingjiance"
  50. :style="{ color: currentTab === 3 ? '#1d5fdf' : '748498' }"
  51. ></text>
  52. <text>粮情检测</text>
  53. </view>
  54. <view
  55. class="tab-item"
  56. :class="{ active: currentTab == 4 }"
  57. @click="switchTab(4)"
  58. >
  59. <text
  60. class="iconfont icon-sunyi"
  61. :style="{ color: currentTab === 4 ? '#1d5fdf' : '748498' }"
  62. ></text>
  63. <text>损益</text>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script setup>
  69. import hwk from "./hwk/index.vue";
  70. import crk from "./crk/index.vue";
  71. import zj from "./zj/index.vue";
  72. import lqjc from "./lqjc/index.vue";
  73. import sy from "./sy/index.vue";
  74. import { ref, reactive, onMounted } from "vue";
  75. import { onLoad } from "@dcloudio/uni-app";
  76. import { getDictOptions, DICT_TYPE, getDictLabelSync } from "@/utils/dict.js";
  77. import {
  78. getInfoByCfId,
  79. getSyxxByCfId,
  80. getLqjcxxByCfId,
  81. getCrkxxByCfId,
  82. getZjxxByCfId,
  83. } from "@/api/grainDepositor";
  84. const currentTab = ref(0);
  85. const caId = ref("");
  86. const hwkInfo = ref({});
  87. const syInfo = ref({});
  88. const lqjcInfo = ref({});
  89. const ckList = ref([]);
  90. const rkList = ref([]);
  91. // const zjxxList = ref({});
  92. const switchTab = (index) => {
  93. currentTab.value = index;
  94. if (index === 0) {
  95. uni.setNavigationBarTitle({
  96. title: "货位卡",
  97. });
  98. } else if (index === 1) {
  99. uni.setNavigationBarTitle({
  100. title: "出入库",
  101. });
  102. } else if (index === 2) {
  103. uni.setNavigationBarTitle({
  104. title: "质检",
  105. });
  106. } else if (index === 3) {
  107. uni.setNavigationBarTitle({
  108. title: "粮情检测",
  109. });
  110. } else if (index === 4) {
  111. uni.setNavigationBarTitle({
  112. title: "损益",
  113. });
  114. }
  115. };
  116. onLoad(async (options) => {
  117. if (options && options.caId) {
  118. caId.value = options.caId;
  119. const getHwkData = await getInfoByCfId(caId.value);
  120. if (getHwkData.code === 0 && getHwkData.data !== null) {
  121. hwkInfo.value = getHwkData.data;
  122. }
  123. const getSyData = await getSyxxByCfId(caId.value);
  124. if (getSyData.code === 0 && getSyData.data !== null) {
  125. syInfo.value = getSyData.data;
  126. }
  127. const getLqjcData = await getLqjcxxByCfId(caId.value);
  128. // 12992 // 维护好的数据
  129. if (getLqjcData.code === 0 && getLqjcData.data !== null) {
  130. lqjcInfo.value = getLqjcData.data;
  131. }
  132. //"出入库类型crklx(0:出库,1:入库)")
  133. const ckPostData = {
  134. caId: caId.value,
  135. // caId: 645228342333509, // 维护好的数据
  136. crklx: 0,
  137. };
  138. const getCkData = await getCrkxxByCfId(ckPostData);
  139. if (getCkData.code === 0 && getCkData.data !== null) {
  140. ckList.value = getCkData.data.records;
  141. // console.log(JSON.parse(newVal), newVal, newVal[0], "tiemNEwv");
  142. }
  143. const rkPostData = {
  144. caId: caId.value,
  145. // caId: 645228342333509, // 维护好的数据
  146. crklx: 1,
  147. };
  148. const getRkData = await getCrkxxByCfId(rkPostData);
  149. if (getRkData.code === 0 && getRkData.data !== null) {
  150. rkList.value = getRkData.data.records;
  151. }
  152. // const zjxxPostData = {
  153. // caId: caId.value,
  154. // caId: 645228342333509, // 维护好的数据
  155. // };
  156. // const getZjxxData = await getZjxxByCfId(zjxxPostData);
  157. // zjxxList.value = getZjxxData.data.records;
  158. }
  159. });
  160. onMounted(async () => {
  161. await getDictOptions(DICT_TYPE.SYSTEM_LSDJ);
  162. await getDictOptions(DICT_TYPE.SYSTEM_LSPZ);
  163. });
  164. </script>
  165. <style lang="scss" scoped>
  166. .container {
  167. display: flex;
  168. flex-direction: column;
  169. height: 100vh;
  170. box-sizing: border-box;
  171. background: linear-gradient(180deg, #cfddfc 0%, #eff2f5 30%);
  172. position: relative;
  173. padding-bottom: 100rpx;
  174. }
  175. .tab-bar {
  176. height: 100rpx;
  177. display: flex;
  178. background-color: #ffffff;
  179. border-top: 1rpx solid #bdc1c4;
  180. position: fixed;
  181. bottom: 0;
  182. left: 0;
  183. right: 0;
  184. z-index: 999;
  185. .tab-item {
  186. flex: 1;
  187. display: flex;
  188. flex-direction: column;
  189. align-items: center;
  190. justify-content: center;
  191. font-size: 24rpx;
  192. color: #738598;
  193. .iconfont {
  194. font-size: 44rpx;
  195. }
  196. &.active {
  197. color: #1e60dc;
  198. }
  199. text {
  200. margin-top: 4rpx;
  201. }
  202. }
  203. }
  204. </style>