|
|
1
|
+<template>
|
|
|
2
|
+ <view class="page">
|
|
|
3
|
+ <scroll-view class="scroll" scroll-y>
|
|
|
4
|
+ <view class="detail-page">
|
|
|
5
|
+ <view class="section">
|
|
|
6
|
+ <text class="row company">{{ form.orderingUnitName }}</text>
|
|
|
7
|
+ <view :class="['status', `status_${form.status}`]" />
|
|
|
8
|
+ <view class="row"><text class="label">订单编号</text><text class="value">{{ form.orderNo }}</text></view>
|
|
|
9
|
+ <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view>
|
|
|
10
|
+ <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view>
|
|
|
11
|
+ <view class="row"><text class="label">计划吨位(kg)</text><text class="value">{{ form.quantity }}</text></view>
|
|
|
12
|
+ <view class="row"><text class="label">计划装货日期</text><text class="value">{{ form.deliveryDate }}</text></view>
|
|
|
13
|
+ <view class="row"><text class="label">卸货地点</text><text class="value">{{ form.destination }}</text></view>
|
|
|
14
|
+ <view class="row"><text class="label">接货人/联络人</text><text class="value">{{ form.consignee }}</text></view>
|
|
|
15
|
+ <view class="row"><text class="label">联系电话</text><text class="value">{{ form.phone }}</text></view>
|
|
|
16
|
+ <view class="row"><text class="label">回货计划安排</text><text class="value">{{ form.returnPlanArrangement }}</text></view>
|
|
|
17
|
+ <view class="row"><text class="label">特殊需求、其他等</text><text class="value">{{ form.other }}</text></view>
|
|
|
18
|
+ <view class="row"><text class="label">装货特别要求/需求</text><text class="value">{{ form.specialLoadingRequirement }}</text></view>
|
|
|
19
|
+ </view>
|
|
|
20
|
+ </view>
|
|
|
21
|
+ </scroll-view>
|
|
|
22
|
+ <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
|
|
|
23
|
+ </view>
|
|
|
24
|
+</template>
|
|
|
25
|
+
|
|
|
26
|
+<script>
|
|
|
27
|
+import { getDetailApi, cancelApi } from '@/api/draft_order.js'
|
|
|
28
|
+import DetailButtons from '@/components/detail-buttons/index.vue'
|
|
|
29
|
+
|
|
|
30
|
+export default {
|
|
|
31
|
+ name: 'DraftOrderDetail',
|
|
|
32
|
+ components: { DetailButtons },
|
|
|
33
|
+ data() {
|
|
|
34
|
+ return {
|
|
|
35
|
+ form: {},
|
|
|
36
|
+ buttons: [
|
|
|
37
|
+ { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
|
|
|
38
|
+ { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
|
|
|
39
|
+ { text: '审核', visible: true, variant: 'primary', event: 'audit' },
|
|
|
40
|
+ { text: '取消', visible: true, variant: 'outline', event: 'cancel', style: { color: 'rgba(0,0,0,0.9)', border: '1px solid #DCDCDC' } },
|
|
|
41
|
+ ]
|
|
|
42
|
+ }
|
|
|
43
|
+ },
|
|
|
44
|
+ computed: {
|
|
|
45
|
+ statusFlags() {
|
|
|
46
|
+ const m = this.form || {}
|
|
|
47
|
+ const e = String(m.status || '')
|
|
|
48
|
+ return {
|
|
|
49
|
+ canEdit: (e === 'REFUSE' || e === '' || !e) && m.draftCreateBy || false,
|
|
|
50
|
+ canAudit: e === 'AUDIT' && m.showExamine || false,
|
|
|
51
|
+ canCancel: e === 'REFUSE' && m.draftCreateBy || false,
|
|
|
52
|
+ }
|
|
|
53
|
+ },
|
|
|
54
|
+ displayButtons() {
|
|
|
55
|
+ const f = this.statusFlags
|
|
|
56
|
+ return [
|
|
|
57
|
+ { ...this.buttons[0], visible: f.canEdit && this.$auth.hasPermi('shipping-plan-manage:draft-order:modify') },
|
|
|
58
|
+ { ...this.buttons[1], visible: this.$auth.hasPermi('shipping-plan-manage:draft-order:review') },
|
|
|
59
|
+ { ...this.buttons[2], visible: f.canAudit && this.$auth.hasPermi('shipping-plan-manage:draft-order:approve') },
|
|
|
60
|
+ { ...this.buttons[3], visible: f.canCancel && this.$auth.hasPermi('shipping-plan-manage:draft-order:cancel') },
|
|
|
61
|
+ ]
|
|
|
62
|
+ }
|
|
|
63
|
+ },
|
|
|
64
|
+ onLoad(query) {
|
|
|
65
|
+ const id = (query && (query.id || query.code)) || ''
|
|
|
66
|
+ if (id) this.loadDetail(id)
|
|
|
67
|
+ },
|
|
|
68
|
+ methods: {
|
|
|
69
|
+ async loadDetail(id) {
|
|
|
70
|
+ try {
|
|
|
71
|
+ const res = await getDetailApi(id)
|
|
|
72
|
+ this.form = res.data || {}
|
|
|
73
|
+ } catch (e) {
|
|
|
74
|
+ this.form = {}
|
|
|
75
|
+ }
|
|
|
76
|
+ },
|
|
|
77
|
+ handleButtonClick(btn) {
|
|
|
78
|
+ if (!btn || btn.disabled) return
|
|
|
79
|
+ const map = {
|
|
|
80
|
+ edit: () => this.onEdit(),
|
|
|
81
|
+ auditDetail: () => this.onAuditDetail(),
|
|
|
82
|
+ audit: () => this.onAudit(),
|
|
|
83
|
+ cancel: () => this.onCancel(),
|
|
|
84
|
+ }
|
|
|
85
|
+ const fn = map[btn.event]
|
|
|
86
|
+ if (typeof fn === 'function') fn()
|
|
|
87
|
+ },
|
|
|
88
|
+ onEdit() {
|
|
|
89
|
+ const id = this.form.id || this.form.code
|
|
|
90
|
+ if (id) uni.navigateTo({ url: `/pages/draft_order/modify?id=${id}` })
|
|
|
91
|
+ },
|
|
|
92
|
+ onAuditDetail() {
|
|
|
93
|
+ uni.setStorageSync('sourceBusinessId', this.form.id)
|
|
|
94
|
+ uni.navigateTo({ url: '/pages/flow/audit_detail' })
|
|
|
95
|
+ },
|
|
|
96
|
+ onAudit() {
|
|
|
97
|
+ uni.setStorageSync('sourceBusinessId', this.form.id)
|
|
|
98
|
+ uni.navigateTo({ url: '/pages/flow/audit' })
|
|
|
99
|
+ },
|
|
|
100
|
+ onCancel() {
|
|
|
101
|
+ const id = this.form.id || this.form.code
|
|
|
102
|
+ if (!id) return
|
|
|
103
|
+ uni.showModal({
|
|
|
104
|
+ title: '提示',
|
|
|
105
|
+ content: '确定要取消该草稿要车单吗?',
|
|
|
106
|
+ success: async (res) => {
|
|
|
107
|
+ if (res.confirm) {
|
|
|
108
|
+ try {
|
|
|
109
|
+ await cancelApi(id)
|
|
|
110
|
+ uni.showToast({ title: '取消成功', icon: 'success' })
|
|
|
111
|
+ setTimeout(() => { uni.redirectTo({ url: '/pages/draft_order/index' }) }, 300)
|
|
|
112
|
+ } catch (e) {
|
|
|
113
|
+ uni.showToast({ title: (e && e.msg) || '取消失败', icon: 'none' })
|
|
|
114
|
+ }
|
|
|
115
|
+ }
|
|
|
116
|
+ }
|
|
|
117
|
+ })
|
|
|
118
|
+ },
|
|
|
119
|
+ }
|
|
|
120
|
+}
|
|
|
121
|
+</script>
|
|
|
122
|
+
|
|
|
123
|
+<style lang="scss" scoped>
|
|
|
124
|
+.page {
|
|
|
125
|
+ display: flex;
|
|
|
126
|
+ flex-direction: column;
|
|
|
127
|
+ height: 100vh;
|
|
|
128
|
+}
|
|
|
129
|
+
|
|
|
130
|
+.scroll {
|
|
|
131
|
+ flex: 1;
|
|
|
132
|
+ background: #f3f3f3;
|
|
|
133
|
+}
|
|
|
134
|
+
|
|
|
135
|
+.detail-page {
|
|
|
136
|
+ padding-bottom: 144rpx;
|
|
|
137
|
+}
|
|
|
138
|
+
|
|
|
139
|
+.section {
|
|
|
140
|
+ padding: 32rpx;
|
|
|
141
|
+ background: #fff;
|
|
|
142
|
+ margin-bottom: 20rpx;
|
|
|
143
|
+ position: relative;
|
|
|
144
|
+
|
|
|
145
|
+ .status {
|
|
|
146
|
+ position: absolute;
|
|
|
147
|
+ top: 16rpx;
|
|
|
148
|
+ right: 52rpx;
|
|
|
149
|
+ width: 180rpx;
|
|
|
150
|
+ height: 146rpx;
|
|
|
151
|
+ background-repeat: no-repeat;
|
|
|
152
|
+ background-size: 100% 100%;
|
|
|
153
|
+ background-position: center;
|
|
|
154
|
+
|
|
|
155
|
+ &_AUDIT {
|
|
|
156
|
+ background-image: url('~@/static/images/dev_manage/status_1.png');
|
|
|
157
|
+ }
|
|
|
158
|
+
|
|
|
159
|
+ &_PASS {
|
|
|
160
|
+ background-image: url('~@/static/images/dev_manage/status_2.png');
|
|
|
161
|
+ }
|
|
|
162
|
+
|
|
|
163
|
+ &_REFUSE {
|
|
|
164
|
+ background-image: url('~@/static/images/dev_manage/status_3.png');
|
|
|
165
|
+ }
|
|
|
166
|
+
|
|
|
167
|
+ &_CANCEL {
|
|
|
168
|
+ background-image: url('~@/static/images/dev_manage/status_4.png');
|
|
|
169
|
+ }
|
|
|
170
|
+
|
|
|
171
|
+ }
|
|
|
172
|
+}
|
|
|
173
|
+
|
|
|
174
|
+.row {
|
|
|
175
|
+ display: flex;
|
|
|
176
|
+ margin-bottom: 28rpx;
|
|
|
177
|
+
|
|
|
178
|
+ &:last-child {
|
|
|
179
|
+ margin-bottom: 0;
|
|
|
180
|
+ }
|
|
|
181
|
+
|
|
|
182
|
+ &.company {
|
|
|
183
|
+ font-size: 36rpx;
|
|
|
184
|
+ font-weight: 600;
|
|
|
185
|
+ color: rgba(0, 0, 0, 0.9);
|
|
|
186
|
+ padding-top: 10rpx;
|
|
|
187
|
+ margin-bottom: 32rpx;
|
|
|
188
|
+ line-height: 50rpx;
|
|
|
189
|
+ }
|
|
|
190
|
+
|
|
|
191
|
+ .label {
|
|
|
192
|
+ width: 240rpx;
|
|
|
193
|
+ line-height: 32rpx;
|
|
|
194
|
+ font-size: 28rpx;
|
|
|
195
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
196
|
+ }
|
|
|
197
|
+
|
|
|
198
|
+ .value {
|
|
|
199
|
+ flex: 1;
|
|
|
200
|
+ line-height: 32rpx;
|
|
|
201
|
+ font-size: 28rpx;
|
|
|
202
|
+ color: rgba(0, 0, 0, 0.9);
|
|
|
203
|
+ text-align: right;
|
|
|
204
|
+ word-break: break-all;
|
|
|
205
|
+ }
|
|
|
206
|
+}
|
|
|
207
|
+
|
|
|
208
|
+.title-header {
|
|
|
209
|
+ background-color: #fff;
|
|
|
210
|
+ display: flex;
|
|
|
211
|
+ align-items: center;
|
|
|
212
|
+ padding: 32rpx 32rpx 22rpx;
|
|
|
213
|
+ border-bottom: 1rpx dashed #f0f0f0;
|
|
|
214
|
+
|
|
|
215
|
+ &_icon {
|
|
|
216
|
+ width: 32rpx;
|
|
|
217
|
+ height: 28rpx;
|
|
|
218
|
+ margin-right: 16rpx;
|
|
|
219
|
+ }
|
|
|
220
|
+
|
|
|
221
|
+ span {
|
|
|
222
|
+ color: rgba(0, 0, 0, 0.9);
|
|
|
223
|
+ font-size: 32rpx;
|
|
|
224
|
+ line-height: 44rpx;
|
|
|
225
|
+ font-weight: 600;
|
|
|
226
|
+ }
|
|
|
227
|
+}
|
|
|
228
|
+</style> |
...
|
...
|
|