warehouseDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <view class="container">
  3. <!-- Tab栏 -->
  4. <view class="tab-bar">
  5. <view
  6. class="tab-item"
  7. :class="{ active: currentTab === 0 }"
  8. @click="switchTab(0)"
  9. >
  10. 仓房基本信息
  11. </view>
  12. <view
  13. class="tab-item"
  14. :class="{ active: currentTab === 1 }"
  15. @click="switchTab(1)"
  16. >
  17. 库区基本信息
  18. </view>
  19. </view>
  20. <!-- 内容区域 -->
  21. <swiper class="content-swiper" :current="currentTab" @change="swiperChange">
  22. <!-- 仓房基本信息 -->
  23. <swiper-item>
  24. <view class="warehouse-content">
  25. <!-- 搜索框固定在顶部 -->
  26. <view class="search-box">
  27. <input
  28. type="text"
  29. v-model="searchValue"
  30. placeholder="请输入仓房名称"
  31. />
  32. <button class="search-btn" @click="search">搜索</button>
  33. </view>
  34. <view v-if="warhouseList.length === 0" class="empty-container">
  35. <image src="" mode="aspectFit" class="empty-image"></image>
  36. <text class="empty-text">暂无数据</text>
  37. </view>
  38. <!-- 列表部分可滚动 -->
  39. <scroll-view scroll-y class="scroll-content">
  40. <view class="info-list">
  41. <view
  42. class="info-card"
  43. v-for="(item, index) in warhouseList"
  44. :key="index"
  45. >
  46. <view class="info-item info-item-name">
  47. <image
  48. src="../../static/icons/warehouse-ico.png"
  49. mode="widthFix"
  50. ></image>
  51. <text class="label">
  52. <!-- <text class="iconfont icon-cangfangmingcheng"></text> -->
  53. <!-- <image src="/static/icons/warehouse-ico.png" alt="" /> -->
  54. 仓房名称:</text
  55. >
  56. <text class="value">{{ item.cfmc }}</text>
  57. </view>
  58. <view class="info-row info-item-row">
  59. <view class="info-item">
  60. <text class="label">仓房类型:</text>
  61. <text class="value">{{ filterLX(item.cflx) || "-" }}</text>
  62. </view>
  63. <view class="info-item">
  64. <text class="label">仓房状态:</text>
  65. <text class="value">{{ filterZT(item.cazt) || "-" }}</text>
  66. </view>
  67. </view>
  68. <view class="info-row info-item-row">
  69. <view class="info-item">
  70. <text class="label">设计仓容:</text>
  71. <text class="value">{{ item.sjcr + "吨" }}</text>
  72. </view>
  73. <view class="info-item">
  74. <text class="label">是否空仓:</text>
  75. <text class="value">{{
  76. item.sfkc === 1 ? "是" : "否"
  77. }}</text>
  78. </view>
  79. </view>
  80. <view class="info-row info-item-row">
  81. <view class="info-item">
  82. <text class="label">租仓参考价:</text>
  83. <text class="value">{{ item.zcckj || "-" }} 元/月</text>
  84. </view>
  85. </view>
  86. <view class="info-row info-item-row">
  87. <view class="info-item">
  88. <text class="label">委托保管参考价:</text>
  89. <text class="value">{{ item.wbgcj || "-" }} 元/吨/月</text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </scroll-view>
  95. </view>
  96. </swiper-item>
  97. <!-- 库区基本信息 -->
  98. <swiper-item>
  99. <view class="warehouse-content">
  100. <scroll-view scroll-y class="scroll-content">
  101. <view class="warehouse-info">
  102. <view class="info-row-cang">
  103. <text class="label">库区名称</text>
  104. <text class="value">{{ kqxx.kqmc || "-" }}</text>
  105. </view>
  106. <view class="info-row-cang">
  107. <text class="label">所属企业</text>
  108. <text class="value">{{ kqxx.dwmc || "-" }}</text>
  109. </view>
  110. <view class="info-row-cang">
  111. <text class="label">统一社会信用代码</text>
  112. <text class="value">{{ kqxx.tyxydm || "-" }}</text>
  113. </view>
  114. <view class="info-row-cang">
  115. <text class="label">企业性质</text>
  116. <text class="value">{{ filterXZ(kqxx.qyxz) || "-" }}</text>
  117. </view>
  118. <view class="info-row-cang">
  119. <text class="label">库区地址</text>
  120. <text class="value">{{ kqxx.jtdz || "-" }}</text>
  121. </view>
  122. <view class="info-row-cang">
  123. <text class="label">库区负责人</text>
  124. <text class="value">{{ kqxx.kqfzr || "-" }}</text>
  125. </view>
  126. <view class="info-row-cang">
  127. <text class="label">库区联系方式</text>
  128. <text class="value">{{ kqxx.lxdh || "-" }}</text>
  129. </view>
  130. <view class="info-row-cang">
  131. <text class="label">占地面积</text>
  132. <text class="value">{{ kqxx.zdmj || "-" }}</text>
  133. </view>
  134. <view class="info-row-cang">
  135. <text class="label">经度</text>
  136. <text class="value">{{ kqxx.jd || "-" }}</text>
  137. </view>
  138. <view class="info-row-cang">
  139. <text class="label">纬度</text>
  140. <text class="value">{{ kqxx.wd || "-" }}</text>
  141. </view>
  142. <view class="info-row-cang">
  143. <text class="label">附件</text>
  144. <image
  145. @click="previewImage(kqxx.resid)"
  146. class="storage-image"
  147. :src="kqxx.resid"
  148. mode="aspectFit"
  149. />
  150. </view>
  151. </view>
  152. </scroll-view>
  153. </view>
  154. </swiper-item>
  155. </swiper>
  156. <!-- 底部按钮 -->
  157. <view class="footer">
  158. <button class="submit-btn" @click="handleSubmit">领取</button>
  159. </view>
  160. </view>
  161. </template>
  162. <script>
  163. import { getCaxxByKqId, getKqxxByKqId, getTasks } from "@/api/task";
  164. import { dictData } from "@/api/user";
  165. import { getDictOptions, DICT_TYPE } from "@/utils/dict.js";
  166. export default {
  167. data() {
  168. return {
  169. currentTab: 0,
  170. taskInfo: {},
  171. qyxzList: [],
  172. cflxList: [],
  173. ztlxList: [],
  174. warhouseList: [],
  175. kqxx: {},
  176. };
  177. },
  178. onLoad(options) {
  179. const eventChannel = this.getOpenerEventChannel();
  180. eventChannel.on("acceptData", (data) => {
  181. const taskInfo = JSON.parse(data.taskInfo);
  182. uni.setNavigationBarTitle({
  183. title: taskInfo.kqmc || "库区信息",
  184. });
  185. this.taskInfo = taskInfo;
  186. uni.showLoading({
  187. title: "加载中...",
  188. });
  189. getCaxxByKqId({
  190. kqId: taskInfo.kqId,
  191. listType: 1,
  192. })
  193. .then((res) => {
  194. if (res.code === 0) {
  195. this.warhouseList = res.data;
  196. } else {
  197. uni.showToast({
  198. title: res.msg || "获取任务列表失败",
  199. icon: "none",
  200. });
  201. }
  202. })
  203. .finally(() => {
  204. uni.hideLoading();
  205. });
  206. getKqxxByKqId({
  207. kqId: taskInfo.kqId,
  208. listType: 1,
  209. }).then((res) => {
  210. this.kqxx = res.data;
  211. });
  212. });
  213. },
  214. async mounted() {
  215. // dictData("system_qyxz").then((res) => {
  216. // this.qyxzList = res.data;
  217. // });
  218. this.qyxzList = await getDictOptions(DICT_TYPE.SYSTEM_QYXZ);
  219. this.cflxList = await getDictOptions(DICT_TYPE.SYSTEM_CFLX);
  220. this.ztlxList = await getDictOptions(DICT_TYPE.SYSTEM_CAZT);
  221. },
  222. methods: {
  223. filterXZ(value) {
  224. return this.qyxzList.find((item) => item.value == value)?.label;
  225. },
  226. filterLX(value) {
  227. return this.cflxList.find((item) => item.value == value)?.label;
  228. },
  229. filterZT(value) {
  230. return this.ztlxList.find((item) => item.value == value)?.label;
  231. },
  232. previewImage(url) {
  233. if (!url) {
  234. uni.showToast({
  235. title: "暂无附件",
  236. icon: "none",
  237. });
  238. return;
  239. }
  240. uni.previewImage({
  241. urls: [url],
  242. });
  243. },
  244. search() {
  245. // 加载
  246. uni.showLoading({
  247. title: "加载中...",
  248. });
  249. getCaxxByKqId({
  250. cfmc: this.searchValue,
  251. listType: 1,
  252. kqId: this.taskInfo.kqId,
  253. })
  254. .then((res) => {
  255. if (res.code === 0) {
  256. this.warhouseList = res.data;
  257. } else {
  258. uni.showToast({
  259. title: res.msg || "获取任务列表失败",
  260. icon: "none",
  261. });
  262. }
  263. })
  264. .finally(() => {
  265. uni.hideLoading();
  266. });
  267. },
  268. switchTab(index) {
  269. this.currentTab = index;
  270. },
  271. swiperChange(e) {
  272. this.currentTab = e.detail.current;
  273. },
  274. handleSubmit() {
  275. // 加载
  276. uni.showLoading({
  277. title: "领取中...",
  278. });
  279. // 处理领取逻辑
  280. getTasks({
  281. kqIds: [this.taskInfo.kqId],
  282. hyState: 3,
  283. listType: 1,
  284. })
  285. .then((res) => {
  286. if (res.code === 0) {
  287. uni.showToast({
  288. title: "领取成功",
  289. icon: "success",
  290. });
  291. // 获取上一页面的事件通道
  292. const eventChannel = this.getOpenerEventChannel();
  293. // 发送刷新事件
  294. eventChannel.emit("refreshList", { refresh: true });
  295. uni.navigateBack();
  296. } else {
  297. uni.hideLoading();
  298. uni.showToast({
  299. title: res.msg || "领取失败",
  300. icon: "none",
  301. });
  302. }
  303. })
  304. .catch(() => {
  305. uni.hideLoading();
  306. uni.showToast({
  307. title: "领取失败",
  308. icon: "none",
  309. });
  310. })
  311. .finally(() => {
  312. uni.hideLoading();
  313. });
  314. },
  315. },
  316. };
  317. </script>
  318. <style lang="scss" scoped>
  319. .container {
  320. display: flex;
  321. flex-direction: column;
  322. height: 100vh;
  323. }
  324. .page-title {
  325. padding: 20rpx;
  326. text-align: center;
  327. font-size: 32rpx;
  328. font-weight: bold;
  329. background-color: #fff;
  330. }
  331. .tab-bar {
  332. display: flex;
  333. background-color: #cfddfc;
  334. // border-bottom: 1rpx solid #eee;
  335. .tab-item {
  336. flex: 1;
  337. text-align: center;
  338. padding: 20rpx 0;
  339. font-size: 35rpx;
  340. color: #333;
  341. font-weight: 400;
  342. &.active {
  343. color: #000;
  344. position: relative;
  345. font-weight: 500;
  346. &::after {
  347. content: "";
  348. position: absolute;
  349. bottom: 0;
  350. left: 50%;
  351. transform: translateX(-50%);
  352. width: 190rpx;
  353. height: 10rpx;
  354. background-color: #4185fa;
  355. }
  356. }
  357. }
  358. }
  359. .content-swiper {
  360. flex: 1;
  361. height: 0;
  362. background: linear-gradient(#cfddfc 0%, #e6eeff 10%, #fff 100%);
  363. }
  364. .warehouse-content {
  365. height: 100%;
  366. display: flex;
  367. flex-direction: column;
  368. background-color: rgba(255, 255, 255, 0);
  369. }
  370. .search-box {
  371. padding: 20rpx;
  372. background-color: rgba(255, 255, 255, 0);
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. input {
  377. background-color: #fff;
  378. padding: 10rpx 20rpx;
  379. border-radius: 8rpx;
  380. font-size: 28rpx;
  381. width: 72%;
  382. }
  383. .search-btn {
  384. width: 20%;
  385. background-color: #2979ff;
  386. color: #fff;
  387. border-radius: 8rpx;
  388. font-size: 28rpx;
  389. margin: 0;
  390. }
  391. }
  392. .scroll-content {
  393. flex: 1;
  394. height: 0;
  395. }
  396. .info-list {
  397. padding: 20rpx;
  398. }
  399. .info-card {
  400. background-color: #fff;
  401. padding: 20rpx;
  402. border-radius: 8rpx;
  403. margin-bottom: 20rpx;
  404. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
  405. }
  406. .info-row {
  407. display: flex;
  408. justify-content: space-between;
  409. margin-top: 20rpx;
  410. }
  411. .info-item {
  412. flex: 1;
  413. display: flex;
  414. align-items: center;
  415. // 文字不换行
  416. // white-space: nowrap;
  417. // overflow: hidden;
  418. // text-overflow: ellipsis;
  419. image {
  420. width: 50rpx;
  421. height: 50rpx;
  422. margin-right: 10rpx;
  423. }
  424. .label {
  425. white-space: nowrap;
  426. color: #666;
  427. font-size: 30rpx;
  428. margin-right: 10rpx;
  429. }
  430. .value {
  431. color: #666;
  432. font-size: 30rpx;
  433. }
  434. }
  435. .info-item-row {
  436. display: flex;
  437. align-items: start;
  438. .info-item {
  439. display: flex;
  440. align-items: start;
  441. padding-right: 10rpx;
  442. box-sizing: border-box;
  443. }
  444. }
  445. .info-item-name {
  446. color: #000 !important;
  447. font-weight: 500 !important;
  448. .label {
  449. color: #000 !important;
  450. }
  451. .value {
  452. color: #000 !important;
  453. }
  454. }
  455. .warehouse-info {
  456. background-color: #fff;
  457. padding: 0 20rpx;
  458. margin: 20rpx;
  459. border-radius: 8rpx;
  460. .info-row-cang {
  461. display: flex;
  462. padding: 30rpx 0;
  463. border-bottom: 1rpx solid #eee;
  464. align-items: center;
  465. justify-content: space-between;
  466. &:last-child {
  467. border-bottom: 1rpx solid #fff;
  468. }
  469. .label {
  470. color: #666;
  471. font-size: 28rpx;
  472. }
  473. .value {
  474. color: #000;
  475. font-size: 28rpx;
  476. }
  477. .storage-image {
  478. width: 400rpx !important;
  479. height: 200rpx !important;
  480. border: 1px solid rgba(0, 0, 0, 0.1);
  481. }
  482. }
  483. }
  484. .footer {
  485. padding: 20rpx;
  486. background-color: #fff;
  487. border-top: 1rpx solid #eee;
  488. }
  489. .submit-btn {
  490. background-color: #2979ff;
  491. color: #fff;
  492. border-radius: 8rpx;
  493. font-size: 32rpx;
  494. }
  495. .empty-container {
  496. display: flex;
  497. flex-direction: column;
  498. align-items: center;
  499. justify-content: center;
  500. // padding: 100rpx 0;
  501. .empty-image {
  502. width: 200rpx;
  503. height: 200rpx;
  504. margin-bottom: 20rpx;
  505. }
  506. .empty-text {
  507. color: #999;
  508. font-size: 28rpx;
  509. }
  510. }
  511. </style>