Commit 540e9a1fe83d4cb4dce8d9e930e243319928d67b

Authored by 史婷婷
1 parent da1d7311

feat: 订货单-审核详情

@@ -5,8 +5,6 @@ @@ -5,8 +5,6 @@
5 <view class="section"> 5 <view class="section">
6 <text class="row company">{{ form.orderNo }}</text> 6 <text class="row company">{{ form.orderNo }}</text>
7 <view :class="['status', `status_${form.status}`]" /> 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 <view class="row"><text class="label">供货单位</text><text class="value">{{ getDicName('SUPPLIER', 8 <view class="row"><text class="label">供货单位</text><text class="value">{{ getDicName('SUPPLIER',
11 form.supplyUnit, dicOptions.SUPPLIER) }}</text></view> 9 form.supplyUnit, dicOptions.SUPPLIER) }}</text></view>
12 <view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text> 10 <view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text>
@@ -47,14 +45,13 @@ @@ -47,14 +45,13 @@
47 45
48 </view> 46 </view>
49 </scroll-view> 47 </scroll-view>
50 - <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 48 +
51 </view> 49 </view>
52 </template> 50 </template>
53 51
54 <script> 52 <script>
55 -import { getDetailApi, cancelApi } from '@/api/order_list.js' 53 +import { getDetailApi } from '@/api/order_list.js'
56 import Product from './product.vue' 54 import Product from './product.vue'
57 -import DetailButtons from '@/components/detail-buttons/index.vue'  
58 import { 55 import {
59 getDicName 56 getDicName
60 } from '@/utils/dic.js' 57 } from '@/utils/dic.js'
@@ -63,8 +60,9 @@ import { @@ -63,8 +60,9 @@ import {
63 } from '@/utils/dic' 60 } from '@/utils/dic'
64 61
65 export default { 62 export default {
66 - name: 'OrderListDetail',  
67 - components: { Product, DetailButtons }, 63 + name: 'OrderListViewer',
  64 + props: { id: { type: [String, Number], default: '' } },
  65 + components: { Product },
68 data() { 66 data() {
69 return { 67 return {
70 form: {}, 68 form: {},
@@ -73,51 +71,25 @@ export default { @@ -73,51 +71,25 @@ export default {
73 categoryOptions: [], 71 categoryOptions: [],
74 historyList: [], 72 historyList: [],
75 showExamine: false, 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 dicOptions: { 74 dicOptions: {
84 - AUDIT_STATUS: [],  
85 SUPPLIER: [], 75 SUPPLIER: [],
86 APPLICABLE_STANDARD: [], 76 APPLICABLE_STANDARD: [],
87 }, 77 },
88 } 78 }
89 }, 79 },
90 computed: { 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 created() { 82 created() {
114 this.loadAllDicData() 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 methods: { 94 methods: {
123 async loadDetail(id) { 95 async loadDetail(id) {
@@ -129,61 +101,7 @@ export default { @@ -129,61 +101,7 @@ export default {
129 this.form = {} 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 getCategoryClass(categoryName) { 105 getCategoryClass(categoryName) {
188 if (!categoryName) return '' 106 if (!categoryName) return ''
189 if (categoryName.includes('A') || categoryName.includes('a')) { 107 if (categoryName.includes('A') || categoryName.includes('a')) {
@@ -197,14 +115,12 @@ export default { @@ -197,14 +115,12 @@ export default {
197 } 115 }
198 }, 116 },
199 loadAllDicData() { 117 loadAllDicData() {
200 - const dicCodes = ['AUDIT_STATUS', 'SUPPLIER', 'APPLICABLE_STANDARD'] 118 + const dicCodes = ['SUPPLIER', 'APPLICABLE_STANDARD']
201 return getDicByCodes(dicCodes).then(results => { 119 return getDicByCodes(dicCodes).then(results => {
202 - this.dicOptions.AUDIT_STATUS = results.AUDIT_STATUS.data || []  
203 this.dicOptions.SUPPLIER = results.SUPPLIER.data || [] 120 this.dicOptions.SUPPLIER = results.SUPPLIER.data || []
204 this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD.data || [] 121 this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD.data || []
205 }).catch(() => { 122 }).catch(() => {
206 this.dicOptions = { 123 this.dicOptions = {
207 - AUDIT_STATUS: [],  
208 SUPPLIER: [], 124 SUPPLIER: [],
209 APPLICABLE_STANDARD: [], 125 APPLICABLE_STANDARD: [],
210 } 126 }
@@ -224,7 +140,6 @@ export default { @@ -224,7 +140,6 @@ export default {
224 140
225 .scroll { 141 .scroll {
226 flex: 1; 142 flex: 1;
227 - padding: 8rpx 0 144rpx 0;  
228 } 143 }
229 144
230 .detail-page { 145 .detail-page {
@@ -3,6 +3,8 @@ import CustomerCreditViewer from '@/pages/credit_manage/viewer.vue' @@ -3,6 +3,8 @@ import CustomerCreditViewer from '@/pages/credit_manage/viewer.vue'
3 import StandardContractViewer from '@/components/contract-view/standardContractViewer.vue' 3 import StandardContractViewer from '@/components/contract-view/standardContractViewer.vue'
4 import FormalContractViewer from '@/components/contract-view/formalContractViewer.vue' 4 import FormalContractViewer from '@/components/contract-view/formalContractViewer.vue'
5 import ProcessStdAgmtViewer from '@/pages/contract_process/processStdAgmtViewer.vue' 5 import ProcessStdAgmtViewer from '@/pages/contract_process/processStdAgmtViewer.vue'
  6 +import OrderListApprove from '@/pages/order_list/approve.vue'
  7 +import OrderListViewer from '@/pages/order_list/viewer.vue'
6 8
7 export default function registerComponents(Vue) { 9 export default function registerComponents(Vue) {
8 Vue.component('CustomerDevelopViewer', CustomerDevelopViewer) 10 Vue.component('CustomerDevelopViewer', CustomerDevelopViewer)
@@ -10,4 +12,6 @@ export default function registerComponents(Vue) { @@ -10,4 +12,6 @@ export default function registerComponents(Vue) {
10 Vue.component('StandardContractViewer', StandardContractViewer) 12 Vue.component('StandardContractViewer', StandardContractViewer)
11 Vue.component('FormalContractViewer', FormalContractViewer) 13 Vue.component('FormalContractViewer', FormalContractViewer)
12 Vue.component('ProcessStdAgmtViewer', ProcessStdAgmtViewer) 14 Vue.component('ProcessStdAgmtViewer', ProcessStdAgmtViewer)
  15 + Vue.component('OrderListApprove', OrderListApprove)
  16 + Vue.component('OrderListViewer', OrderListViewer)
13 } 17 }
@@ -38,6 +38,12 @@ export const getSysFlowComponentPath = (bizFlag) => { @@ -38,6 +38,12 @@ export const getSysFlowComponentPath = (bizFlag) => {
38 case 'SPEC_LOCK_DELAY_EDIT': // 特殊锁单延迟 38 case 'SPEC_LOCK_DELAY_EDIT': // 特殊锁单延迟
39 componentPath = 'SpecLockDelayApprove'; // 特殊锁单延迟-审批 39 componentPath = 'SpecLockDelayApprove'; // 特殊锁单延迟-审批
40 break; 40 break;
  41 + case 'PURCHASE_ORDER_EDIT': // 订货单
  42 + componentPath = 'OrderListApprove'; // 订货单-审批
  43 + break;
  44 + case 'PURCHASE_ORDER': // 订货单
  45 + componentPath = 'OrderListViewer'; // 订货单-审批详情
  46 + break;
41 } 47 }
42 return componentPath; 48 return componentPath;
43 }; 49 };