Blame view

美国版/Food Labeling Management App UniApp/src/pages/more/print-detail.vue 6.11 KB
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  <template>
    <view class="page">
      <view class="header-hero" :style="{ paddingTop: statusBarHeight + 'px' }">
        <view class="top-bar">
          <view class="top-left" @click="goBack">
            <AppIcon name="chevronLeft" size="sm" color="white" />
          </view>
          <view class="top-center">
            <text class="page-title">Print Detail</text>
            <LocationPicker />
          </view>
          <view class="top-right" @click="isMenuOpen = true">
            <AppIcon name="menu" size="sm" color="white" />
          </view>
        </view>
      </view>
  
      <scroll-view v-if="record" class="content" scroll-y>
        <view class="detail-label-section">
          <text class="detail-section-title">Label Content</text>
          <view class="detail-label-wrap">
            <image :src="labelImage" class="detail-label-img" mode="widthFix" />
          </view>
        </view>
  
        <view class="detail-info-section">
          <text class="detail-section-title">Print Info</text>
          <view class="info-card">
            <view class="info-row">
a0aeefab   “wangming”   好了,设计现在需要给美国那边看,估...
30
31
32
33
              <text class="info-label">Label ID</text>
              <text class="info-value">{{ record.labelId }}</text>
            </view>
            <view class="info-row">
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
              <text class="info-label">Print Time</text>
              <text class="info-value">{{ record.dateFull }} {{ record.time }}</text>
            </view>
            <view class="info-row">
              <text class="info-label">Product</text>
              <text class="info-value">{{ displayProductName }}</text>
            </view>
            <view class="info-row">
              <text class="info-label">Quantity</text>
              <text class="info-value">{{ record.qty }} label{{ record.qty > 1 ? 's' : '' }}</text>
            </view>
            <view v-if="record.labelType" class="info-row">
              <text class="info-label">Label Type</text>
              <text class="info-value">{{ record.labelType }}</text>
            </view>
            <view class="info-row">
              <text class="info-label">Template</text>
              <text class="info-value">{{ record.templateSize }} {{ record.templateName }}</text>
            </view>
            <view class="info-row">
              <text class="info-label">Printed By</text>
              <text class="info-value">{{ record.userName }}</text>
            </view>
            <view class="info-row">
              <text class="info-label">Printer</text>
              <text class="info-value">{{ record.printer }}</text>
            </view>
          </view>
        </view>
      </scroll-view>
  
      <view v-else class="empty-wrap">
        <AppIcon name="alert" size="lg" color="gray" />
        <text class="empty-text">Record not found</text>
      </view>
  
      <SideMenu v-model="isMenuOpen" />
    </view>
  </template>
  
  <script setup lang="ts">
  import { ref, computed } from 'vue'
  import { onLoad } from '@dcloudio/uni-app'
  import AppIcon from '../../components/AppIcon.vue'
  import SideMenu from '../../components/SideMenu.vue'
  import LocationPicker from '../../components/LocationPicker.vue'
  import { getStatusBarHeight } from '../../utils/statusBar'
a0aeefab   “wangming”   好了,设计现在需要给美国那边看,估...
81
82
  import { getRecordByLabelId } from '../../utils/printLog'
  import chickenLabelImg from '../../static/chicken-lable.png'
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
83
84
85
86
87
88
89
90
  
  const statusBarHeight = getStatusBarHeight()
  const isMenuOpen = ref(false)
  const record = ref<any>(null)
  
  const labelImage = computed(() => {
    const r = record.value
    if (!r) return '/static/lable1.png'
a0aeefab   “wangming”   好了,设计现在需要给美国那边看,估...
91
92
93
    if (r.productName === 'Chicken') {
      return chickenLabelImg
    }
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
94
95
96
97
98
99
100
    const size = r.templateSize || ''
    if (size.indexOf('2"x6"') >= 0 || size.indexOf('2"x4"') >= 0) {
      return '/static/lable2.png'
    }
    return '/static/lable1.png'
  })
  
a0aeefab   “wangming”   好了,设计现在需要给美国那边看,估...
101
102
103
104
105
106
107
108
109
  // 与产品列表、详情一致:按标签图 Chicken/Syrup/Cheese Burger Deluxe
  const displayProductName = computed(() => {
    const r = record.value
    if (!r) return ''
    if (r.productName === 'Chicken') return 'Chicken'
    const size = r.templateSize || ''
    if (size.indexOf('2"x6"') >= 0 || size.indexOf('2"x4"') >= 0) return 'Cheese Burger Deluxe'
    return 'Syrup'
  })
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
110
111
  
  onLoad((opts: any) => {
a0aeefab   “wangming”   好了,设计现在需要给美国那边看,估...
112
113
114
    const labelId = opts && opts.labelId
    if (labelId) {
      record.value = getRecordByLabelId(labelId)
940fb6ea   “wangming”   又改了一个版本,这泰额太纠结了,一...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
    }
  })
  
  const goBack = () => uni.navigateBack()
  </script>
  
  <style scoped>
  .page {
    min-height: 100vh;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }
  
  .header-hero {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-dark));
    padding: 16rpx 32rpx 24rpx;
  }
  
  .top-bar {
    height: 96rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .top-left,
  .top-right {
    width: 64rpx;
    height: 64rpx;
    border-radius: 999rpx;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .top-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .page-title {
    font-size: 34rpx;
    font-weight: 600;
    color: #fff;
  }
  
  .content {
    flex: 1;
    padding: 32rpx;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  .detail-label-section {
    margin-bottom: 32rpx;
  }
  
  .detail-section-title {
    font-size: 28rpx;
    font-weight: 600;
    color: #111827;
    display: block;
    margin-bottom: 20rpx;
  }
  
  .detail-label-wrap {
    width: 100%;
    padding: 24rpx 0;
    background: #fff;
    border-radius: 16rpx;
    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
    overflow: hidden;
    box-sizing: border-box;
  }
  
  .detail-label-img {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 12rpx;
    box-sizing: border-box;
  }
  
  .detail-info-section {
    padding-top: 0;
  }
  
  .info-card {
    background: #fff;
    border-radius: 16rpx;
    padding: 28rpx 32rpx;
    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  }
  
  .info-row {
    padding: 20rpx 0;
    border-bottom: 1rpx solid #f3f4f6;
  }
  
  .info-row:last-child {
    border-bottom: none;
  }
  
  .info-label {
    font-size: 24rpx;
    color: #6b7280;
    display: block;
    margin-bottom: 8rpx;
  }
  
  .info-value {
    font-size: 30rpx;
    font-weight: 500;
    color: #111827;
    display: block;
  }
  
  .empty-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48rpx;
  }
  
  .empty-text {
    font-size: 28rpx;
    color: #6b7280;
    margin-top: 24rpx;
  }
  </style>