detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view class="detail-page">
  3. <u-navbar
  4. height="40px"
  5. :title="navTitle"
  6. bgColor="#0256FF"
  7. :titleStyle="{ color: '#fff' }"
  8. leftIconColor="#fff"
  9. autoBack
  10. placeholder
  11. >
  12. </u-navbar>
  13. <view class="container_main">
  14. <view class="info-box">
  15. <view class="info-line">
  16. <view class="info-line-label">
  17. <text>货物名称</text>
  18. </view>
  19. <view class="info-line-value">
  20. {{ goodsInfo.materialName }}
  21. </view>
  22. </view>
  23. <view class="info-line">
  24. <view class="info-line-label">
  25. <text>货物条码</text>
  26. </view>
  27. <view class="info-line-value">
  28. {{ goodsInfo.sku }}
  29. </view>
  30. </view>
  31. <view class="info-line">
  32. <view class="info-line-label">
  33. <text>货物图片</text>
  34. </view>
  35. <view class="info-line-value ss-p-y-24">
  36. <u-image
  37. :src="
  38. goodsInfo.imgNameArr && goodsInfo.imgNameArr.length > 0
  39. ? goodsInfo.imgNameArr[0]
  40. : ''
  41. "
  42. width="120rpx"
  43. height="120rpx"
  44. ></u-image>
  45. </view>
  46. </view>
  47. <view class="info-line">
  48. <view class="info-line-label">
  49. <text>规格</text>
  50. </view>
  51. <view class="info-line-value">
  52. {{ goodsInfo.materialStandard || "-" }}
  53. </view>
  54. </view>
  55. <view class="info-line">
  56. <view class="info-line-label">
  57. <text>批次号</text>
  58. </view>
  59. <view class="info-line-value">
  60. {{ goodsInfo.batchNumber || "-" }}
  61. </view>
  62. </view>
  63. <view class="info-line">
  64. <view class="info-line-label">
  65. <text>生产日期</text>
  66. </view>
  67. <view class="info-line-value">
  68. {{ goodsInfo.productionDate || "-" }}
  69. </view>
  70. </view>
  71. <view class="info-line">
  72. <view class="info-line-label">
  73. <text>库存</text>
  74. </view>
  75. <view class="info-line-value">
  76. {{ goodsInfo.inventory ? (goodsInfo.inventory * 1).toFixed(0) : "0"
  77. }}{{ goodsInfo.commodityUnit || "" }}
  78. </view>
  79. </view>
  80. <view class="info-line">
  81. <view class="info-line-label">
  82. <text>库位</text>
  83. </view>
  84. <view class="info-line-value">
  85. {{ goodsInfo.position || "-" }}
  86. </view>
  87. </view>
  88. <view class="info-line">
  89. <view class="info-line-label">
  90. <text>创建时间</text>
  91. </view>
  92. <view class="info-line-value">
  93. {{ goodsInfo.createTime }}
  94. </view>
  95. </view>
  96. </view>
  97. <view class="crk-box" @click="getMaterialDepotDetail(), (crkShow = true)">
  98. <u-image
  99. src="@/static/image/cgrk-icon.png"
  100. width="48rpx"
  101. height="48rpx"
  102. ></u-image>
  103. <view class="crk-msg">
  104. <view class="crk-msg-name">出入库明细</view>
  105. <view>查看最近的出入库记录</view>
  106. </view>
  107. <u-icon
  108. name="arrow-right"
  109. color="rgba(173, 181, 189, 0.50)"
  110. size="14"
  111. ></u-icon>
  112. </view>
  113. </view>
  114. <!-- 出入库明细 -->
  115. <u-popup
  116. :show="crkShow"
  117. @close="crkShow = false"
  118. round="18"
  119. closeable
  120. :closeOnClickOverlay="false"
  121. >
  122. <view class="crk-cont">
  123. <view class="crk-cont-title">出入库明细</view>
  124. <view class="crk-cont-tab">
  125. <view
  126. class="tab-item"
  127. :class="currentCrkId == item.id ? 'tab-item-active' : ''"
  128. v-for="(item, i) in crkList"
  129. :key="i"
  130. @click="tabClick(item)"
  131. >
  132. {{ item.name }}
  133. </view>
  134. </view>
  135. <scroll-view scroll-y class="scroll-y">
  136. <view class="crk-item" v-for="(item, i) in cukList" :key="item.id">
  137. <view class="crk-item-title">{{ item.materialName }}</view>
  138. <!-- <view class="crk-item-line">出库仓库:我的仓库-暂无</view> -->
  139. <view class="crk-item-line"
  140. >货物规格:{{ item.materialStandard }}</view
  141. >
  142. <view class="crk-item-line"
  143. >{{ currentCrkId == "out" ? "出库" : "入库" }}时间:{{
  144. item.warehousingTime || "-"
  145. }}</view
  146. >
  147. <view class="crk-item-line"
  148. >{{ currentCrkId == "out" ? "出库" : "入库" }}数量:{{
  149. (item.actualQuantityInStorage * 1).toFixed(0) || 0
  150. }}{{ item.commodityUnit || "" }}</view
  151. >
  152. <view class="img-box">
  153. <image
  154. v-if="currentCrkId == 'out'"
  155. src="@/static/image/yck-img.png"
  156. width="132rpx"
  157. height="132rpx"
  158. ></image>
  159. <image
  160. v-if="currentCrkId == 'in'"
  161. src="@/static/image/yrk-img.png"
  162. width="132rpx"
  163. height="132rpx"
  164. ></image>
  165. </view>
  166. </view>
  167. <u-empty
  168. mode="data"
  169. text="暂无内容"
  170. marginTop="60"
  171. icon="https://xiangli-erp.oss-cn-hangzhou.aliyuncs.com/APP/no-notifcations.png"
  172. v-if="cukList.length == 0"
  173. ></u-empty>
  174. <u-divider
  175. text="仅展示最近10条记录"
  176. v-if="cukList.length > 0"
  177. :dashed="true"
  178. ></u-divider>
  179. <view style="height: 40rpx"></view>
  180. </scroll-view>
  181. </view>
  182. </u-popup>
  183. </view>
  184. </template>
  185. <script>
  186. import {
  187. materialDetail,
  188. materialDepotDetail,
  189. } from "@/common/request/apis/purchase";
  190. import { mapGetters } from "vuex";
  191. export default {
  192. data() {
  193. return {
  194. navTitle: "",
  195. goodsId: 0, //单据id
  196. // materialId:0,//商品id
  197. crkShow: false,
  198. currentCrkId: "out",
  199. crkList: [
  200. {
  201. name: "出库",
  202. id: "out",
  203. },
  204. {
  205. name: "入库",
  206. id: "in",
  207. },
  208. ],
  209. goodsInfo: {},
  210. cukList: [],
  211. };
  212. },
  213. computed: {
  214. ...mapGetters(["depotInfo"]),
  215. curDepotId() {
  216. return this.depotInfo ? this.depotInfo.id : "";
  217. },
  218. curDepotName() {
  219. return this.depotInfo ? this.depotInfo.depotName : "";
  220. },
  221. },
  222. onLoad(e) {
  223. this.navTitle = e.name ? decodeURIComponent(e.name) : "";
  224. this.goodsId = e.id;
  225. // this.materialId = e.materialId
  226. this.getMaterialDetail();
  227. },
  228. methods: {
  229. tabClick(item) {
  230. console.log("tabClick=====", item);
  231. this.currentCrkId = item.id;
  232. this.getMaterialDepotDetail();
  233. },
  234. getMaterialDetail() {
  235. materialDetail(`${this.goodsId}/${this.curDepotId}`).then((res) => {
  236. if (res.code == 200) {
  237. console.log("data---------", res.data);
  238. if (res.data.imgName && res.data.imgName.length > 0) {
  239. res.data.imgNameArr = res.data.imgName.split(",");
  240. } else {
  241. res.data.imgNameArr = [];
  242. }
  243. this.goodsInfo = res.data;
  244. }
  245. });
  246. },
  247. getMaterialDepotDetail() {
  248. uni.showLoading();
  249. let urlParams = {
  250. type: this.currentCrkId,
  251. materialId: this.goodsInfo.materialId,
  252. depotId: this.curDepotId,
  253. };
  254. let data = { pageNum: 1, pageSize: 10 };
  255. materialDepotDetail(urlParams, data)
  256. .then((res) => {
  257. if (res.code == 200) {
  258. this.cukList = res.data.rows;
  259. }
  260. console.log("res====", res);
  261. uni.hideLoading();
  262. })
  263. .catch((err) => {
  264. uni.hideLoading();
  265. });
  266. },
  267. },
  268. };
  269. </script>
  270. <style lang="scss" scoped>
  271. .detail-page {
  272. min-height: 100vh;
  273. background-color: #f0f6fb;
  274. padding: 24rpx;
  275. .container_main {
  276. .info-box {
  277. background-color: #fff;
  278. border-radius: 16rpx 16rpx 0 0;
  279. padding: 24rpx;
  280. .info-line {
  281. border-bottom: 1px solid #f4f4f4;
  282. padding: 24rpx 0;
  283. color: #333;
  284. font-family: "PingFang SC";
  285. font-size: 28rpx;
  286. line-height: 1.5;
  287. font-weight: 400;
  288. display: flex;
  289. align-items: center;
  290. &-label {
  291. flex: 0 0 162rpx;
  292. width: 162rpx;
  293. }
  294. &-value {
  295. word-break: break-all;
  296. }
  297. .must-box {
  298. color: #ff3b1d;
  299. }
  300. }
  301. }
  302. .crk-box {
  303. border-radius: 16rpx;
  304. background: #fff;
  305. padding: 32rpx 24rpx;
  306. margin-top: 24rpx;
  307. display: flex;
  308. align-items: center;
  309. .crk-msg {
  310. flex: 1;
  311. margin-left: 24rpx;
  312. color: #666;
  313. font-size: 28rpx;
  314. font-weight: 400;
  315. .crk-msg-name {
  316. color: #333;
  317. font-size: 32rpx;
  318. font-weight: bold;
  319. }
  320. }
  321. }
  322. }
  323. .crk-cont {
  324. height: 75vh;
  325. &-title {
  326. height: 80rpx;
  327. line-height: 80rpx;
  328. text-align: center;
  329. color: #1f1f39;
  330. font-size: 36rpx;
  331. font-weight: bold;
  332. }
  333. &-tab {
  334. height: 100rpx;
  335. display: flex;
  336. align-items: center;
  337. justify-content: center;
  338. .tab-item {
  339. width: 160rpx;
  340. height: 56rpx;
  341. border-radius: 40rpx;
  342. border: 1px solid rgba(173, 181, 189, 0.5);
  343. color: #666;
  344. text-align: center;
  345. font-size: 28rpx;
  346. font-weight: 500;
  347. line-height: 56rpx;
  348. margin-right: 24rpx;
  349. }
  350. .tab-item-active {
  351. background: #0256ff;
  352. border: 1px solid #0256ff;
  353. color: #fff;
  354. }
  355. }
  356. .scroll-y {
  357. height: calc(75vh - 80rpx - 100rpx);
  358. padding: 0 24rpx;
  359. .crk-item {
  360. border-radius: 16rpx;
  361. background: #f6f8fa;
  362. padding: 24rpx;
  363. font-family: "PingFang SC";
  364. margin-bottom: 24rpx;
  365. position: relative;
  366. &-title {
  367. color: #000;
  368. font-size: 28rpx;
  369. font-weight: 500;
  370. margin-bottom: 16rpx;
  371. }
  372. &-line {
  373. color: #666;
  374. font-size: 28rpx;
  375. font-weight: 400;
  376. margin-bottom: 8rpx;
  377. }
  378. .img-box {
  379. position: absolute;
  380. top: 24rpx;
  381. right: 24rpx;
  382. image {
  383. width: 132rpx;
  384. height: 132rpx;
  385. }
  386. }
  387. }
  388. }
  389. }
  390. }
  391. </style>