| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- <template>
- <uni-navbar-lite @leftClick="handleBack" :show-right=false title="出库单详情"></uni-navbar-lite>
- <view class="page-container">
- <scroll-view class="page-content" :scroll-y="true">
- <!-- 出库单信息 -->
- <view class="section">
- <view class="info-card">
- <view class="info-row">
- <text class="info-label">出库单号</text>
- <text class="info-value">{{ salseCode }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">状态</text>
- <text class="info-value status-text" :class="'status-' + status">{{ statusText }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">创建人</text>
- <text class="info-value">{{ createBy }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">领用人</text>
- <text class="info-value">{{ receiverUser }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">创建时间</text>
- <text class="info-value">{{ createTime }}</text>
- </view>
- </view>
- </view>
- <!-- 物料明细 -->
- <view class="section">
- <view class="section-header">
- <view class="section-indicator"></view>
- <text class="section-title">物料明细</text>
- </view>
- <view class="material-list">
- <view v-if="lineList.length === 0" class="empty-tip">
- <text class="empty-tip-text">暂无物料</text>
- </view>
- <view
- v-else
- v-for="(item, index) in lineList"
- :key="index"
- class="material-item"
- >
- <view class="material-header">
- <text class="material-name">{{ getItemName(item) }}</text>
- <text class="material-status" :class="getLineStatus(item) === 'Y' ? 'status-received' : 'status-pending'">
- {{ getLineStatusText(item) }}
- </text>
- </view>
- <view class="material-spec" v-if="getSpecification(item)">
- <text class="spec-label">规格:</text>
- <text class="spec-value">{{ getSpecification(item) }}</text>
- </view>
- <view class="material-footer">
- <view class="quantity-info">
- <text class="quantity-label">数量:</text>
- <text class="quantity-value">{{ getQuantity(item) }} {{ getMeasureName(item) }}</text>
- </view>
- <view v-if="status == 'FINISHED' && getLineStatus(item) != 'Y'" class="receive-btn-wrap">
- <button class="receive-btn" @click="handleSignReceive(item)">签收</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script setup lang="uts">
- import { ref, computed } from 'vue'
- import { getProductSalseById, signReceiveLine } from '../../api/out/index'
- import { getUserInfo } from '../../utils/storage'
- const salseId = ref<string>("")
- const salseCode = ref<string>("")
- const status = ref<string>("")
- const createBy = ref<string>("")
- const receiverUser = ref<string>("")
- const createTime = ref<string>("")
- const lineList = ref<UTSJSONObject[]>([])
-
- let currentUserId: string = ''
- const statusText = computed((): string => {
- const s = status.value
- switch (s) {
- case 'PREPARE': return '待确认'
- case 'CONFIRMED': return '已确认'
- case 'EXECUTING': return '执行中'
- case 'FINISHED': return '已完成'
- case 'CANCEL': return '已取消'
- default: return s
- }
- })
- const getItemName = (item: UTSJSONObject): string => {
- if (item == null) return ''
- const val = item['itemName']
- return val != null ? val.toString() : ''
- }
- const getSpecification = (item: UTSJSONObject): string => {
- if (item == null) return ''
- const val = item['specification']
- return val != null ? val.toString() : ''
- }
- const getQuantity = (item: UTSJSONObject): string => {
- if (item == null) return '0'
- const val = item['quantitySalse']
- return val != null ? val.toString() : '0'
- }
- const getMeasureName = (item: UTSJSONObject): string => {
- if (item == null) return ''
- const val = item['measureName']
- return val != null ? val.toString() : ''
- }
- const getLineStatus = (item: UTSJSONObject): string => {
- if (item == null) return ''
- const val = item['receiverStatus']
- return val != null ? val.toString() : ''
- }
- const getLineStatusText = (item: UTSJSONObject): string => {
- const s = getLineStatus(item)
- if (s == 'Y') return '已签收'
- if (s == 'N') return '待签收'
- return s
- }
- const loadDetail = (): void => {
- if (salseId.value.length === 0) return
- getProductSalseById(salseId.value).then((res: any) => {
- const resData = res as UTSJSONObject
- const data = resData["data"] as UTSJSONObject
- salseCode.value = data['salseCode'] != null ? data['salseCode'].toString() : ''
- status.value = data['status'] != null ? data['status'].toString() : ''
- createBy.value = data['createNickName'] != null ? data['createNickName'].toString() : ''
- receiverUser.value = data['receiverUser'] != null ? data['receiverUser'].toString() : ''
- createTime.value = data['createTime'] != null ? data['createTime'].toString() : ''
-
- const lines = data['wmProductSalseLineList']
- if (lines != null) {
- const allLines = lines as UTSJSONObject[]
- // 只显示当前用户的明细
- lineList.value = allLines.filter((line: UTSJSONObject) => {
- const receiverUserId = line['receiverUserId']
- return receiverUserId != null && receiverUserId.toString() === currentUserId
- })
- } else {
- lineList.value = []
- }
- }).catch((e) => {
- const error = e as UTSError
- const errMsg = error?.message
- uni.showToast({ title: errMsg.toString(), icon: 'none' })
- })
- }
- const handleSignReceive = (item: UTSJSONObject): void => {
- const lineId = item['lineId']
- if (lineId == null) {
- uni.showToast({ title: '明细ID不存在', icon: 'none' })
- return
- }
- uni.showModal({
- title: '提示',
- content: '确认签收该物料?',
- success: (res) => {
- if (res.confirm) {
- signReceiveLine(lineId.toString()).then((res: any) => {
- uni.showToast({ title: '签收成功', icon: 'success' })
- loadDetail()
- }).catch((e) => {
- const error = e as UTSError
- const errMsg = error?.message
- uni.showToast({ title: errMsg.toString(), icon: 'none' })
- })
- }
- }
- })
- }
- const handleBack = (): void => {
- uni.navigateBack()
- }
- onLoad((options: any) => {
- const params = options as UTSJSONObject
- if (params != null && params['id'] != null) {
- salseId.value = params['id'].toString()
-
- const userInfo = getUserInfo()
- if (userInfo != null) {
- const userId = userInfo['userId']
- currentUserId = userId != null ? userId.toString() : ''
- }
-
- loadDetail()
- }
- })
- </script>
- <style lang="scss">
- .page-container {
- flex: 1;
- background-color: #e8f0f9;
- }
- .page-content {
- flex: 1;
- padding: 20rpx;
- }
- .section {
- margin-bottom: 20rpx;
- background: #ffffff;
- border-radius: 16rpx;
- padding: 20rpx;
- }
- .section-header {
- flex-direction: row;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .section-indicator {
- width: 6rpx;
- height: 32rpx;
- background-color: #007aff;
- border-radius: 3rpx;
- margin-right: 12rpx;
- }
- .section-title {
- font-size: 32rpx;
- color: #333333;
- font-weight: bold;
- }
- .info-card {
- background-color: #f8f9fa;
- border-radius: 8rpx;
- padding: 20rpx;
- }
- .info-row {
- flex-direction: row;
- justify-content: space-between;
- margin-bottom: 16rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .info-label {
- font-size: 28rpx;
- color: #666666;
- }
- .info-value {
- font-size: 28rpx;
- color: #333333;
- }
- .status-text {
- &.status-PREPARE {
- color: #faad14;
- }
- &.status-CONFIRMED {
- color: #1890ff;
- }
- &.status-EXECUTING {
- color: #722ed1;
- }
- &.status-FINISHED {
- color: #52c41a;
- }
- &.status-CANCEL {
- color: #ff4d4f;
- }
- &.status-received {
- color: #52c41a;
- }
- &.status-pending {
- color: #faad14;
- }
- }
- .material-list {
- background-color: #f8f9fa;
- border-radius: 8rpx;
- padding: 20rpx;
- }
- .empty-tip {
- align-items: center;
- padding: 40rpx;
- }
- .empty-tip-text {
- color: #999999;
- font-size: 28rpx;
- }
- .material-item {
- background-color: #ffffff;
- border-radius: 8rpx;
- padding: 24rpx;
- margin-bottom: 16rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .material-header {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12rpx;
- }
- .material-name {
- font-size: 30rpx;
- color: #333333;
- font-weight: bold;
- flex: 1;
- }
- .material-status {
- font-size: 24rpx;
- padding: 6rpx 16rpx;
- border-radius: 6rpx;
-
- &.status-received {
- background-color: #f6ffed;
- color: #52c41a;
- }
- &.status-pending {
- background-color: #fff7e6;
- color: #fa8c16;
- }
- }
- .material-spec {
- flex-direction: row;
- margin-bottom: 12rpx;
- }
- .spec-label {
- font-size: 24rpx;
- color: #999999;
- }
- .spec-value {
- font-size: 24rpx;
- color: #666666;
- }
- .material-footer {
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- }
- .quantity-info {
- flex-direction: row;
- }
- .quantity-label {
- font-size: 26rpx;
- color: #999999;
- }
- .quantity-value {
- font-size: 26rpx;
- color: #007aff;
- font-weight: bold;
- }
- .receive-btn-wrap {
- margin-left: 20rpx;
- }
- .receive-btn {
- padding: 12rpx 32rpx;
- background-color: #007aff;
- color: #ffffff;
- font-size: 26rpx;
- border-radius: 8rpx;
- border: none;
- }
- .material-detail {
- flex-direction: row;
- justify-content: space-between;
- }
- .detail-row {
- flex-direction: row;
- }
- </style>
|