|
...
|
...
|
@@ -5,8 +5,6 @@ |
|
5
|
5
|
<view class="section">
|
|
6
|
6
|
<text class="row company">{{ form.orderNo }}</text>
|
|
7
|
7
|
<view :class="['status', `status_${form.status}`]" />
|
|
8
|
|
- <view class="row"><text class="label">审核状态</text><text class="value act">{{ getDicName('AUDIT_STATUS',
|
|
9
|
|
- form.examineStatus, dicOptions.AUDIT_STATUS) }}</text></view>
|
|
10
|
8
|
<view class="row"><text class="label">供货单位</text><text class="value">{{ getDicName('SUPPLIER',
|
|
11
|
9
|
form.supplyUnit, dicOptions.SUPPLIER) }}</text></view>
|
|
12
|
10
|
<view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text>
|
|
...
|
...
|
@@ -47,14 +45,13 @@ |
|
47
|
45
|
|
|
48
|
46
|
</view>
|
|
49
|
47
|
</scroll-view>
|
|
50
|
|
- <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
|
|
|
48
|
+
|
|
51
|
49
|
</view>
|
|
52
|
50
|
</template>
|
|
53
|
51
|
|
|
54
|
52
|
<script>
|
|
55
|
|
-import { getDetailApi, cancelApi } from '@/api/order_list.js'
|
|
|
53
|
+import { getDetailApi } from '@/api/order_list.js'
|
|
56
|
54
|
import Product from './product.vue'
|
|
57
|
|
-import DetailButtons from '@/components/detail-buttons/index.vue'
|
|
58
|
55
|
import {
|
|
59
|
56
|
getDicName
|
|
60
|
57
|
} from '@/utils/dic.js'
|
|
...
|
...
|
@@ -63,8 +60,9 @@ import { |
|
63
|
60
|
} from '@/utils/dic'
|
|
64
|
61
|
|
|
65
|
62
|
export default {
|
|
66
|
|
- name: 'OrderListDetail',
|
|
67
|
|
- components: { Product, DetailButtons },
|
|
|
63
|
+ name: 'OrderListViewer',
|
|
|
64
|
+ props: { id: { type: [String, Number], default: '' } },
|
|
|
65
|
+ components: { Product },
|
|
68
|
66
|
data() {
|
|
69
|
67
|
return {
|
|
70
|
68
|
form: {},
|
|
...
|
...
|
@@ -73,51 +71,25 @@ export default { |
|
73
|
71
|
categoryOptions: [],
|
|
74
|
72
|
historyList: [],
|
|
75
|
73
|
showExamine: false,
|
|
76
|
|
- buttons: [
|
|
77
|
|
- { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
|
|
78
|
|
- { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
|
|
79
|
|
- { text: '审核', visible: true, variant: 'primary', event: 'audit' },
|
|
80
|
|
- { text: '申请发货', visible: true, variant: 'outline', event: 'shipmentApply' },
|
|
81
|
|
- { text: '取消', visible: true, variant: 'outline', event: 'cancel', style: { color: 'rgba(0,0,0,0.9)', border: '1px solid #DCDCDC' } },
|
|
82
|
|
- ],
|
|
83
|
74
|
dicOptions: {
|
|
84
|
|
- AUDIT_STATUS: [],
|
|
85
|
75
|
SUPPLIER: [],
|
|
86
|
76
|
APPLICABLE_STANDARD: [],
|
|
87
|
77
|
},
|
|
88
|
78
|
}
|
|
89
|
79
|
},
|
|
90
|
80
|
computed: {
|
|
91
|
|
- statusFlags() {
|
|
92
|
|
- const s = String((this.form && this.form.status) || '')
|
|
93
|
|
- const e = String((this.form && this.form.examineStatus) || '')
|
|
94
|
|
- return {
|
|
95
|
|
- isRefuse: e === 'REFUSE',
|
|
96
|
|
- isAudit: e === 'AUDIT',
|
|
97
|
|
- canExamine: !!this.showExamine,
|
|
98
|
|
- canDeliveryApply: s === 'ISSUED',
|
|
99
|
|
- contractCreateBy: this.form.contractCreateBy
|
|
100
|
|
- }
|
|
101
|
|
- },
|
|
102
|
|
- displayButtons() {
|
|
103
|
|
- const f = this.statusFlags;
|
|
104
|
|
- return [
|
|
105
|
|
- { ...this.buttons[0], visible: f.isRefuse && f.contractCreateBy },
|
|
106
|
|
- { ...this.buttons[1], visible: true },
|
|
107
|
|
- { ...this.buttons[2], visible: f.isAudit && f.canExamine },
|
|
108
|
|
- { ...this.buttons[3], visible: f.canDeliveryApply },
|
|
109
|
|
- { ...this.buttons[4], visible: f.isRefuse },
|
|
110
|
|
- ]
|
|
111
|
|
- }
|
|
112
|
81
|
},
|
|
113
|
82
|
created() {
|
|
114
|
83
|
this.loadAllDicData()
|
|
115
|
84
|
},
|
|
116
|
|
- onLoad(query) {
|
|
117
|
|
- const id = (query && (query.id || query.code)) || ''
|
|
118
|
|
- const se = (query && (query.todoType === 'WAIT' || query.showExamine === '1' || query.showExamine === true)) || false
|
|
119
|
|
- this.showExamine = !!se
|
|
120
|
|
- if (id) this.loadDetail(id)
|
|
|
85
|
+ watch: {
|
|
|
86
|
+ id: {
|
|
|
87
|
+ immediate: true,
|
|
|
88
|
+ handler(val) {
|
|
|
89
|
+ const v = (val !== undefined && val !== null) ? String(val) : ''
|
|
|
90
|
+ if (v) this.loadDetail(v)
|
|
|
91
|
+ }
|
|
|
92
|
+ }
|
|
121
|
93
|
},
|
|
122
|
94
|
methods: {
|
|
123
|
95
|
async loadDetail(id) {
|
|
...
|
...
|
@@ -129,61 +101,7 @@ export default { |
|
129
|
101
|
this.form = {}
|
|
130
|
102
|
}
|
|
131
|
103
|
},
|
|
132
|
|
- handleButtonClick(btn) {
|
|
133
|
|
- if (!btn || btn.disabled) return
|
|
134
|
|
- const map = {
|
|
135
|
|
- edit: () => this.onEdit(),
|
|
136
|
|
- auditDetail: () => this.onAuditDetail(),
|
|
137
|
|
- audit: () => this.onAudit(),
|
|
138
|
|
- shipmentApply: () => this.onShipmentApply(),
|
|
139
|
|
- cancel: () => this.onCancel(),
|
|
140
|
|
- }
|
|
141
|
|
- const fn = map[btn.event]
|
|
142
|
|
- if (typeof fn === 'function') fn()
|
|
143
|
|
- },
|
|
144
|
|
- getBusinessId() {
|
|
145
|
|
- return (this.form && (this.form.id || this.form.code)) || ''
|
|
146
|
|
- },
|
|
147
|
|
- onEdit() {
|
|
148
|
|
- const id = this.getBusinessId()
|
|
149
|
|
- const query = id ? ('?id=' + encodeURIComponent(id)) : ''
|
|
150
|
|
- uni.navigateTo({ url: '/pages/order_list/modify' + query })
|
|
151
|
|
- },
|
|
152
|
|
- onAuditDetail() {
|
|
153
|
|
- const CACHE_KEY = 'sourceBusinessId'
|
|
154
|
|
- uni.setStorageSync(CACHE_KEY, this.getBusinessId())
|
|
155
|
|
- uni.navigateTo({ url: '/pages/flow/audit_detail' })
|
|
156
|
|
- },
|
|
157
|
|
- onAudit() {
|
|
158
|
|
- const CACHE_KEY = 'sourceBusinessId'
|
|
159
|
|
- uni.setStorageSync(CACHE_KEY, this.getBusinessId())
|
|
160
|
|
- uni.navigateTo({ url: '/pages/flow/audit' })
|
|
161
|
|
- },
|
|
162
|
|
- onShipmentApply() {
|
|
163
|
|
- const id = this.getBusinessId()
|
|
164
|
|
- const query = id ? ('?id=' + encodeURIComponent(id)) : ''
|
|
165
|
|
- uni.navigateTo({ url: '/pages/order_list/shipment_apply' + query })
|
|
166
|
|
- },
|
|
167
|
|
- onCancel() {
|
|
168
|
|
- const id = this.getBusinessId()
|
|
169
|
|
- if (!id) return
|
|
170
|
|
- uni.showModal({
|
|
171
|
|
- title: '系统提示',
|
|
172
|
|
- content: '是否确定取消该流程?',
|
|
173
|
|
- confirmText: '确定',
|
|
174
|
|
- cancelText: '取消',
|
|
175
|
|
- success: (res) => {
|
|
176
|
|
- if (res && res.confirm) {
|
|
177
|
|
- cancelApi(id).then(() => {
|
|
178
|
|
- uni.showToast({ title: '已取消', icon: 'none' })
|
|
179
|
|
- setTimeout(() => { uni.redirectTo({ url: '/pages/order_list/index' }) }, 300)
|
|
180
|
|
- }).catch(() => {
|
|
181
|
|
- uni.showToast({ title: '取消失败', icon: 'none' })
|
|
182
|
|
- })
|
|
183
|
|
- }
|
|
184
|
|
- }
|
|
185
|
|
- })
|
|
186
|
|
- },
|
|
|
104
|
+
|
|
187
|
105
|
getCategoryClass(categoryName) {
|
|
188
|
106
|
if (!categoryName) return ''
|
|
189
|
107
|
if (categoryName.includes('A') || categoryName.includes('a')) {
|
|
...
|
...
|
@@ -197,14 +115,12 @@ export default { |
|
197
|
115
|
}
|
|
198
|
116
|
},
|
|
199
|
117
|
loadAllDicData() {
|
|
200
|
|
- const dicCodes = ['AUDIT_STATUS', 'SUPPLIER', 'APPLICABLE_STANDARD']
|
|
|
118
|
+ const dicCodes = ['SUPPLIER', 'APPLICABLE_STANDARD']
|
|
201
|
119
|
return getDicByCodes(dicCodes).then(results => {
|
|
202
|
|
- this.dicOptions.AUDIT_STATUS = results.AUDIT_STATUS.data || []
|
|
203
|
120
|
this.dicOptions.SUPPLIER = results.SUPPLIER.data || []
|
|
204
|
121
|
this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD.data || []
|
|
205
|
122
|
}).catch(() => {
|
|
206
|
123
|
this.dicOptions = {
|
|
207
|
|
- AUDIT_STATUS: [],
|
|
208
|
124
|
SUPPLIER: [],
|
|
209
|
125
|
APPLICABLE_STANDARD: [],
|
|
210
|
126
|
}
|
|
...
|
...
|
@@ -224,7 +140,6 @@ export default { |
|
224
|
140
|
|
|
225
|
141
|
.scroll {
|
|
226
|
142
|
flex: 1;
|
|
227
|
|
- padding: 8rpx 0 144rpx 0;
|
|
228
|
143
|
}
|
|
229
|
144
|
|
|
230
|
145
|
.detail-page {
|
...
|
...
|
|