detail.vue 5.45 KB
<template>
	<view>
		<view class="content">
			<view class="top">
				<view class="common u-f plr-10">
					<view class="u-f1">
						物料名称
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.materialName}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						物料编号
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.materialCode}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						物料类型
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.materialType}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						规格型号
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.materialSpec}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						单位
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.materialUnit}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						重量
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.weight}}
					</view>
				</view>
			</view>
			<view class="center">
				<view class="common i-c u-f plr-10">
					<view class="u-f1">
						总库存
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.qty}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						库存状态
					</view>
					<view class="u-f3 ta-r">
						<view class="u-f u-t u-f-aic u-f-jce">
							<uni-tag :text="statusFormat(detailInfo.inventorySts)" type="success" size="small"
								v-if="detailInfo.inventorySts == 'good'"></uni-tag>
							<uni-tag :text="statusFormat(detailInfo.inventorySts)" type="warning" size="small"
								v-if="detailInfo.inventorySts == 'defective'"></uni-tag>
							<uni-tag :text="statusFormat(detailInfo.inventorySts)" type="error" size="small"
								v-if="detailInfo.inventorySts == 'scrap'"></uni-tag>
							<uni-tag :text="statusFormat(detailInfo.inventorySts)" type="default" size="small"
								v-if="detailInfo.inventorySts == 'discussed'"></uni-tag>
						</view>
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						库位号
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.locationCode}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						容器号
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.containerCode}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						仓库
					</view>
					<view class="u-f3 ta-r">
						{{warehouseCodeFormat(detailInfo.warehouseCode)}}
					</view>
				</view>
				<view class="common u-f u-f-jcsb plr-10">
					<view class="">
						货主
					</view>
					<view class="u-f3 ta-r">
						{{companyCodeFormat(detailInfo.companyCode)}}

					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="common u-f plr-10">
					<view class="u-f1">
						创建时间
					</view>
					<view class="u-f3 ta-r">
						{{formatTime(detailInfo.created)}}
					</view>
				</view>
				<view class="common u-f plr-10">
					<view class="u-f1">
						创建人
					</view>
					<view class="u-f3 ta-r">
						{{detailInfo.createdBy}}
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				detailInfo: {},
				companyArr: [],
				warehouseArr: [],
				materialTypeArr: [],
				inventoryStsArr: []
			}
		},
		onLoad() {
			this.getDicts("inventorySts").then(res => {

				this.inventoryStsArr = res.data.data;
			});
			try {
				const value = uni.getStorageSync('inventory_data');

				if (value) {
					this.detailInfo = value;
					this.$api.material.listAlarmtype().then(res => {

						res.data.rows.forEach(item => {
							if (this.detailInfo.alarmType == item.type) {
								this.alarmType = item.remark
							}
						})
					})
				}
			} catch (e) {
				// error
			}
			this.$api.dict.getCompaniesByToken().then(res => {

				this.companyArr = res.data
			});

			this.$api.material.getMaterialType().then(res => {

				this.materialTypeArr = res.data.data
			});
			try {
				const value = uni.getStorageSync('historyUser').username;
				if (value) {
					this.$api.dict.getWarehouseByUserCode(value).then(res => {
						this.warehouseArr = res.data.data
					});
				}
			} catch (e) {
				// error
			};
		},
		methods: {
			// 货主字典翻译
			companyCodeFormat(companyCode) {
				return this.selectCommonLabel(this.companyArr, companyCode);
			},
			// 仓库字典翻译
			warehouseCodeFormat(warehouseCode) {
				return this.selectCommonLabel(this.warehouseArr, warehouseCode);
			},

			// 物料类型字典翻译
			materialTypeFormat(type) {
				return this.selectCommonLabel(this.materialTypeArr, type);
			},
			// 库存状态字典翻译
			statusFormat(inventorySts) {
				return this.selectDictLabel(this.inventoryStsArr, inventorySts);
			},

		}

	}
</script>

<style lang="scss" scoped>
	.content {
		overflow-y: auto;

		.top,
		.center,
		.bottom {
			background-color: $uni-bg-color;

			.common {
				height: 90rpx;
				line-height: 90rpx;
				font-size: $uni-font-size-lg;
				border-bottom: 2rpx solid $uni-border-color;

				.ta-r {
					text-align: right;

					.u-t {
						height: 90rpx;
					}
				}

				.qty {
					margin-right: $uni-spacing-row-base;
				}
			}

			.i-c {
				color: $uni-color-primary;
			}

		}

		.center {
			margin: $uni-spacing-col-base 0;
		}
	}
</style>