Commit 066632a367a6dca3cb0bcd8aa0faa2be498938f4

Authored by gesilong
1 parent 49f7233f

commit: 上传合同附件功能

@@ -93,6 +93,26 @@ export function createContractApi(data) { @@ -93,6 +93,26 @@ export function createContractApi(data) {
93 contentType: ContentTypeEnum.JSON 93 contentType: ContentTypeEnum.JSON
94 }) 94 })
95 } 95 }
  96 +// 上传标准合同
  97 +export function uploadStandardContract(data) {
  98 + return request({
  99 + url: `${baseUrl}/contractDistributorStandard/uploadStandardContract`,
  100 + method: 'post',
  101 + data,
  102 + contentType: ContentTypeEnum.JSON,
  103 + region
  104 + })
  105 +}
  106 +// 上传正式合同
  107 +export function uploadFormalContract(data) {
  108 + return request({
  109 + url: `${baseUrl}/contractDistributorStandard/uploadFormalContract`,
  110 + method: 'post',
  111 + data,
  112 + contentType: ContentTypeEnum.JSON,
  113 + region
  114 + })
  115 +}
96 116
97 // 删除合同 117 // 删除合同
98 export function deleteContractApi(id) { 118 export function deleteContractApi(id) {
@@ -592,10 +592,9 @@ export default { @@ -592,10 +592,9 @@ export default {
592 592
593 .opCollapse { 593 .opCollapse {
594 color: rgba(0, 0, 0, 0.6); 594 color: rgba(0, 0, 0, 0.6);
595 - width: 24rpx;  
596 - height: 24rpx; 595 + width: 32rpx;
  596 + height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -50,12 +50,9 @@ @@ -50,12 +50,9 @@
50 <view class="row"><text class="label">备注</text><text class="value">{{ detail.remarks || '-' 50 <view class="row"><text class="label">备注</text><text class="value">{{ detail.remarks || '-'
51 }}</text></view> 51 }}</text></view>
52 </view> 52 </view>
53 -  
54 - <view class="section">  
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-'  
56 - }}</text></view>  
57 - <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'  
58 - }}</text></view> 53 + <view class="section" v-if="status === 'STANDARD'">
  54 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-' }}</text></view>
  55 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' }}</text></view>
59 </view> 56 </view>
60 57
61 <view class="section"> 58 <view class="section">
@@ -76,20 +73,51 @@ @@ -76,20 +73,51 @@
76 </view> 73 </view>
77 </scroll-view> 74 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 75 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  76 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  77 + <view class="upload-dialog">
  78 + <view class="upload-header">
  79 + <text class="title">上传规范性合同</text>
  80 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  81 + </view>
  82 + <view class="upload-body">
  83 + <text class="section-title">附件上传:</text>
  84 + <view class="upload-row">
  85 + <FileUpload v-model="fileInfo" />
  86 + </view>
  87 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  88 + <view class="row1" @click="openStandardizedSheet">
  89 + <view class="label1">合同是否规范</view>
  90 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  91 + <view class="value" v-else >{{standardStandardizedName}}</view>
  92 + </view>
  93 + </view>
  94 + <view class="upload-footer">
  95 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  96 + </view>
  97 + </view>
  98 + </uni-popup>
  99 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
79 </view> 100 </view>
80 </template> 101 </template>
81 102
82 <script> 103 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 104 +import { getContractApi, deleteContractApi, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 105 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 106 import DetailButtons from '@/components/detail-buttons/index.vue'
86 - 107 +import FileUpload from '@/components/file-upload/index.vue'
  108 +import SingleSelectSheet from '@/components/single-select/index.vue'
87 export default { 109 export default {
88 name: 'ContractForeignStdDetail', 110 name: 'ContractForeignStdDetail',
89 - components: { ProductRel, DetailButtons }, 111 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 112 data() {
91 return { 113 return {
92 id: '', 114 id: '',
  115 + uploadId: '',
  116 + fileInfo: { id: '', name: '' },
  117 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  118 + standardStandardized: '',
  119 + standardStandardizedName: '',
  120 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 121 detail: {
94 code: '', 122 code: '',
95 supplier: '', 123 supplier: '',
@@ -217,13 +245,75 @@ export default { @@ -217,13 +245,75 @@ export default {
217 url: '/pages/contract_foreign_std/modify' + query 245 url: '/pages/contract_foreign_std/modify' + query
218 }) 246 })
219 }, 247 },
  248 + uploadContract(id){
  249 + if (!id) return
  250 + this.uploadId = id
  251 + this.$refs.uploadPopup.open()
  252 + },
  253 + onUploadSubmit() {
  254 + if (!this.fileInfo.id) {
  255 + uni.showToast({
  256 + title: '请上传合同附件',
  257 + icon: 'error'
  258 + })
  259 + return
  260 + }
  261 + if (!this.standardStandardized) {
  262 + uni.showToast({
  263 + title: '请选择合同是否规范',
  264 + icon: 'error'
  265 + })
  266 + return
  267 + }
  268 + const data = {
  269 + id: this.id,
  270 + standardFileId: this.fileInfo.id,
  271 + standardFileName: this.fileInfo.name,
  272 + standardStandardized: this.standardStandardized
  273 + }
  274 + uni.showModal({
  275 + title: '确认提交',
  276 + content: '确定提交标准合同吗?',
  277 + success: (res) => {
  278 + if (res.confirm) {
  279 + uploadStandardContract({...this.detail, ...data}).then(() => {
  280 + uni.showToast({
  281 + title: '上传标准合同成功',
  282 + icon: 'success'
  283 + })
  284 + setTimeout(() => {
  285 + uni.navigateTo({
  286 + url: '/pages/contract_foreign_std/index'
  287 + })
  288 + }, 500)
  289 + }).catch(() => {
  290 + uni.showToast({
  291 + title: '上传失败',
  292 + icon: 'error'
  293 + })
  294 + })
  295 + }
  296 + }
  297 + })
  298 +
  299 + },
  300 + onSheetConfirm({ value, label }) {
  301 + this.standardStandardized = value
  302 + this.standardStandardizedName = label || ''
  303 + },
  304 + openStandardizedSheet() {
  305 + const options = this.yesNoList
  306 + const current = this.standardStandardized
  307 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  308 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  309 + },
220 handleButtonClick(btn) { 310 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 311 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 312 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 313 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 314 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 315 if (e === 'delete') return this.onDelete(btn && btn.params)
226 - // if (e === 'upload') return this.onUpload(btn && btn.params) 316 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
227 // if (e === 'audit') return this.onAudit(btn && btn.params) 317 // if (e === 'audit') return this.onAudit(btn && btn.params)
228 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) 318 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
229 }, 319 },
@@ -307,4 +397,46 @@ export default { @@ -307,4 +397,46 @@ export default {
307 color: rgba(0, 0, 0, 0.9); 397 color: rgba(0, 0, 0, 0.9);
308 padding-bottom: 12rpx; 398 padding-bottom: 12rpx;
309 } 399 }
  400 +.upload-dialog {
  401 + background: #fff;
  402 + border-top-left-radius: 16rpx;
  403 + border-top-right-radius: 16rpx;
  404 +}
  405 +.upload-header {
  406 + display: flex;
  407 + position: relative;
  408 + align-items: center;
  409 + justify-content: center;
  410 + padding: 32rpx 32rpx;
  411 +}
  412 +.upload-header .title {
  413 + font-size: 36rpx;
  414 + color: rgba(0, 0, 0, 0.9);
  415 + font-weight: 600;
  416 +}
  417 +.upload-body {
  418 + padding: 16rpx 32rpx;
  419 + border-bottom: 1rpx solid #E7E7E7;
  420 +}
  421 +.upload-body .section-title {
  422 + font-size: 32rpx;
  423 + color: rgba(0, 0, 0, 0.9);
  424 + font-weight: 600;
  425 + line-height: 48rpx;
  426 +}
  427 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  428 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  429 +.row1 {
  430 + display: flex;
  431 + justify-content: space-between;
  432 + align-items: center;
  433 + color: rgba(0, 0, 0, 0.9);
  434 + margin: 32rpx 0;
  435 +}
  436 +
  437 +.label1 {
  438 + width: 280rpx;
  439 + color: rgba(0, 0, 0, 0.6);
  440 + font-size: 32rpx;
  441 +}
310 </style> 442 </style>
@@ -606,10 +606,9 @@ export default { @@ -606,10 +606,9 @@ export default {
606 606
607 .opCollapse { 607 .opCollapse {
608 color: rgba(0, 0, 0, 0.6); 608 color: rgba(0, 0, 0, 0.6);
609 - width: 24rpx;  
610 - height: 24rpx; 609 + width: 32rpx;
  610 + height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614
@@ -388,13 +388,12 @@ export default { @@ -388,13 +388,12 @@ export default {
388 height: 40rpx; 388 height: 40rpx;
389 } 389 }
390 390
391 -.opCollapse {  
392 - color: rgba(0, 0, 0, 0.6);  
393 - width: 24rpx;  
394 - height: 24rpx;  
395 - margin-right: 16rpx;  
396 - margin-top: 8rpx;  
397 -} 391 + .opCollapse {
  392 + color: rgba(0, 0, 0, 0.6);
  393 + width: 32rpx;
  394 + height: 28rpx;
  395 + margin-right: 16rpx;
  396 + }
398 397
399 398
400 .block { 399 .block {
@@ -592,10 +592,9 @@ export default { @@ -592,10 +592,9 @@ export default {
592 592
593 .opCollapse { 593 .opCollapse {
594 color: rgba(0, 0, 0, 0.6); 594 color: rgba(0, 0, 0, 0.6);
595 - width: 24rpx;  
596 - height: 24rpx; 595 + width: 32rpx;
  596 + height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -51,11 +51,13 @@ @@ -51,11 +51,13 @@
51 }}</text></view> 51 }}</text></view>
52 </view> 52 </view>
53 53
54 - <view class="section">  
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-'  
56 - }}</text></view>  
57 - <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'  
58 - }}</text></view> 54 + <view class="section" v-if="status === 'STANDARD'">
  55 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-' }}</text></view>
  56 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' }}</text></view>
  57 + </view>
  58 + <view class="section" v-if="status === 'FORMAL'">
  59 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.formalFileName || '-' }}</text></view>
  60 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.formalStandardized ? '是' : '否' }}</text></view>
59 </view> 61 </view>
60 62
61 <view class="section"> 63 <view class="section">
@@ -76,20 +78,53 @@ @@ -76,20 +78,53 @@
76 </view> 78 </view>
77 </scroll-view> 79 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 80 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  81 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  82 + <view class="upload-dialog">
  83 + <view class="upload-header">
  84 + <text class="title">上传规范性合同</text>
  85 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  86 + </view>
  87 + <view class="upload-body">
  88 + <text class="section-title">附件上传:</text>
  89 + <view class="upload-row">
  90 + <FileUpload v-model="fileInfo" />
  91 + </view>
  92 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  93 + <view class="row1" @click="openStandardizedSheet">
  94 + <view class="label1">合同是否规范</view>
  95 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  96 + <view class="value" v-else >{{standardStandardizedName}}</view>
  97 + </view>
  98 + </view>
  99 + <view class="upload-footer">
  100 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  101 + </view>
  102 + </view>
  103 + </uni-popup>
  104 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
79 </view> 105 </view>
80 </template> 106 </template>
81 107
82 <script> 108 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 109 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 110 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 111 import DetailButtons from '@/components/detail-buttons/index.vue'
  112 +import FileUpload from '@/components/file-upload/index.vue'
  113 +import SingleSelectSheet from '@/components/single-select/index.vue'
86 114
87 export default { 115 export default {
88 name: 'ContractForeignStockDetail', 116 name: 'ContractForeignStockDetail',
89 - components: { ProductRel, DetailButtons }, 117 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 118 data() {
91 return { 119 return {
92 id: '', 120 id: '',
  121 + uploadId: '',
  122 + uploadType: 'formal',
  123 + fileInfo: { id: '', name: '' },
  124 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  125 + standardStandardized: '',
  126 + standardStandardizedName: '',
  127 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 128 detail: {
94 code: '', 129 code: '',
95 supplier: '', 130 supplier: '',
@@ -144,12 +179,24 @@ export default { @@ -144,12 +179,24 @@ export default {
144 } 179 }
145 }, 180 },
146 { 181 {
147 - text: '上传合同附件', 182 + text: '上传正式合同附件',
148 visible: true, 183 visible: true,
149 variant: 'outline', 184 variant: 'outline',
150 event: 'upload' 185 event: 'upload'
151 }, 186 },
152 { 187 {
  188 + text: '上传正式合同附件',
  189 + visible: true,
  190 + variant: 'outline',
  191 + event: 'uploadParent'
  192 + },
  193 + {
  194 + text: '上传标准合同附件',
  195 + visible: true,
  196 + variant: 'outline',
  197 + event: 'uploadStandard'
  198 + },
  199 + {
153 text: '审核', 200 text: '审核',
154 visible: true, 201 visible: true,
155 variant: 'primary', 202 variant: 'primary',
@@ -172,9 +219,9 @@ export default { @@ -172,9 +219,9 @@ export default {
172 { ...this.buttons[0]}, 219 { ...this.buttons[0]},
173 // { ...this.buttons[0], visible: (s === 'DRAFT') }, 220 // { ...this.buttons[0], visible: (s === 'DRAFT') },
174 { ...this.buttons[1], visible: (s === 'DRAFT') }, 221 { ...this.buttons[1], visible: (s === 'DRAFT') },
175 - { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS') },  
176 - { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') },  
177 - { ...this.buttons[4], visible: (s === 'STANDARD') } 222 + { ...this.buttons[2], visible: ((s === 'DRAFT' || s === 'FORMAL') && t !== 'AUDIT' && t !== 'PASS') },
  223 + { ...this.buttons[3], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
  224 + { ...this.buttons[4], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
178 ] 225 ]
179 } 226 }
180 }, 227 },
@@ -217,13 +264,84 @@ export default { @@ -217,13 +264,84 @@ export default {
217 url: '/pages/contract_foreign_stock/modify' + query 264 url: '/pages/contract_foreign_stock/modify' + query
218 }) 265 })
219 }, 266 },
  267 + uploadContract(id, type = 'formal'){
  268 + if (!id) return
  269 + this.uploadId = id
  270 + this.uploadType = type
  271 + this.$refs.uploadPopup.open()
  272 + },
  273 + onUploadSubmit() {
  274 + if (!this.fileInfo.id) {
  275 + uni.showToast({
  276 + title: '请上传合同附件',
  277 + icon: 'error'
  278 + })
  279 + return
  280 + }
  281 + if (!this.standardStandardized) {
  282 + uni.showToast({
  283 + title: '请选择合同是否规范',
  284 + icon: 'error'
  285 + })
  286 + return
  287 + }
  288 + const data = this.uploadType === 'formal' ? {
  289 + id: this.id,
  290 + formalFileId: this.fileInfo.id,
  291 + formalFileName: this.fileInfo.name,
  292 + formalStandardized: this.standardStandardized
  293 + } : {
  294 + id: this.id,
  295 + standardFileId: this.fileInfo.id,
  296 + standardFileName: this.fileInfo.name,
  297 + standardStandardized: this.standardStandardized
  298 + }
  299 + const api = this.uploadType === 'formal' ? uploadFormalContract : uploadStandardContract
  300 + uni.showModal({
  301 + title: '确认提交',
  302 + content: this.uploadType === 'formal' ? '确定提交正式合同吗?' : '确定提交标准合同吗?',
  303 + success: (res) => {
  304 + if (res.confirm) {
  305 + api({...this.detail, ...data}).then(() => {
  306 + uni.showToast({
  307 + title: this.uploadType === 'formal' ? '上传正式合同成功' : '上传标准合同成功',
  308 + icon: 'success'
  309 + })
  310 + setTimeout(() => {
  311 + uni.navigateTo({
  312 + url: '/pages/contract_foreign_stock/index'
  313 + })
  314 + }, 500)
  315 + }).catch(() => {
  316 + uni.showToast({
  317 + title: '上传失败',
  318 + icon: 'error'
  319 + })
  320 + })
  321 + }
  322 + }
  323 + })
  324 +
  325 + },
  326 + onSheetConfirm({ value, label }) {
  327 + this.standardStandardized = value
  328 + this.standardStandardizedName = label || ''
  329 + },
  330 + openStandardizedSheet() {
  331 + const options = this.yesNoList
  332 + const current = this.standardStandardized
  333 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  334 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  335 + },
220 handleButtonClick(btn) { 336 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 337 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 338 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 339 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 340 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 341 if (e === 'delete') return this.onDelete(btn && btn.params)
226 - // if (e === 'upload') return this.onUpload(btn && btn.params) 342 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
  343 + if (e === 'uploadParent') return this.uploadContract(this.detail.parentId || '')
  344 + if (e === 'uploadStandard') return this.uploadContract(this.detail.id || '', 'standard')
227 // if (e === 'audit') return this.onAudit(btn && btn.params) 345 // if (e === 'audit') return this.onAudit(btn && btn.params)
228 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) 346 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
229 }, 347 },
@@ -307,4 +425,46 @@ export default { @@ -307,4 +425,46 @@ export default {
307 color: rgba(0, 0, 0, 0.9); 425 color: rgba(0, 0, 0, 0.9);
308 padding-bottom: 12rpx; 426 padding-bottom: 12rpx;
309 } 427 }
  428 +.upload-dialog {
  429 + background: #fff;
  430 + border-top-left-radius: 16rpx;
  431 + border-top-right-radius: 16rpx;
  432 +}
  433 +.upload-header {
  434 + display: flex;
  435 + position: relative;
  436 + align-items: center;
  437 + justify-content: center;
  438 + padding: 32rpx 32rpx;
  439 +}
  440 +.upload-header .title {
  441 + font-size: 36rpx;
  442 + color: rgba(0, 0, 0, 0.9);
  443 + font-weight: 600;
  444 +}
  445 +.upload-body {
  446 + padding: 16rpx 32rpx;
  447 + border-bottom: 1rpx solid #E7E7E7;
  448 +}
  449 +.upload-body .section-title {
  450 + font-size: 32rpx;
  451 + color: rgba(0, 0, 0, 0.9);
  452 + font-weight: 600;
  453 + line-height: 48rpx;
  454 +}
  455 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  456 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  457 +.row1 {
  458 + display: flex;
  459 + justify-content: space-between;
  460 + align-items: center;
  461 + color: rgba(0, 0, 0, 0.9);
  462 + margin: 32rpx 0;
  463 +}
  464 +
  465 +.label1 {
  466 + width: 280rpx;
  467 + color: rgba(0, 0, 0, 0.6);
  468 + font-size: 32rpx;
  469 +}
310 </style> 470 </style>
@@ -159,7 +159,7 @@ export default { @@ -159,7 +159,7 @@ export default {
159 }, 159 },
160 methods: { 160 methods: {
161 goDetail(item) { 161 goDetail(item) {
162 - uni.navigateTo({ url: '/pages/contract_foreign_stock/detail?id=' + item.id }) 162 + uni.navigateTo({ url: '/pages/contract_foreign_stock/detail?id=' + item.id + '&status=' + item.status })
163 }, 163 },
164 onCardLoaded({ items }) { 164 onCardLoaded({ items }) {
165 this.currentItems = items 165 this.currentItems = items
@@ -606,10 +606,9 @@ export default { @@ -606,10 +606,9 @@ export default {
606 606
607 .opCollapse { 607 .opCollapse {
608 color: rgba(0, 0, 0, 0.6); 608 color: rgba(0, 0, 0, 0.6);
609 - width: 24rpx;  
610 - height: 24rpx; 609 + width: 32rpx;
  610 + height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614
@@ -592,10 +592,9 @@ export default { @@ -592,10 +592,9 @@ export default {
592 592
593 .opCollapse { 593 .opCollapse {
594 color: rgba(0, 0, 0, 0.6); 594 color: rgba(0, 0, 0, 0.6);
595 - width: 24rpx;  
596 - height: 24rpx; 595 + width: 32rpx;
  596 + height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -52,12 +52,15 @@ @@ -52,12 +52,15 @@
52 </view> 52 </view>
53 53
54 <view class="section"> 54 <view class="section">
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-' 55 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-'
56 }}</text></view> 56 }}</text></view>
57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' 57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'
58 }}</text></view> 58 }}</text></view>
59 </view> 59 </view>
60 - 60 + <view class="section" v-if="status === 'FORMAL'">
  61 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.formalFileName || '-' }}</text></view>
  62 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.formalStandardized ? '是' : '否' }}</text></view>
  63 + </view>
61 <view class="section"> 64 <view class="section">
62 <text class="row customer">具体质量要求</text> 65 <text class="row customer">具体质量要求</text>
63 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead || 66 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead ||
@@ -76,20 +79,53 @@ @@ -76,20 +79,53 @@
76 </view> 79 </view>
77 </scroll-view> 80 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 81 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  82 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  83 + <view class="upload-dialog">
  84 + <view class="upload-header">
  85 + <text class="title">上传规范性合同</text>
  86 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  87 + </view>
  88 + <view class="upload-body">
  89 + <text class="section-title">附件上传:</text>
  90 + <view class="upload-row">
  91 + <FileUpload v-model="fileInfo" />
  92 + </view>
  93 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  94 + <view class="row1" @click="openStandardizedSheet">
  95 + <view class="label1">合同是否规范</view>
  96 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  97 + <view class="value" v-else >{{standardStandardizedName}}</view>
  98 + </view>
  99 + </view>
  100 + <view class="upload-footer">
  101 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  102 + </view>
  103 + </view>
  104 + </uni-popup>
  105 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
79 </view> 106 </view>
80 </template> 107 </template>
81 108
82 <script> 109 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 110 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 111 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 112 import DetailButtons from '@/components/detail-buttons/index.vue'
  113 +import FileUpload from '@/components/file-upload/index.vue'
  114 +import SingleSelectSheet from '@/components/single-select/index.vue'
86 115
87 export default { 116 export default {
88 name: 'ContractForeignUnplanDetail', 117 name: 'ContractForeignUnplanDetail',
89 - components: { ProductRel, DetailButtons }, 118 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 119 data() {
91 return { 120 return {
92 id: '', 121 id: '',
  122 + uploadId: '',
  123 + uploadType: 'formal',
  124 + fileInfo: { id: '', name: '' },
  125 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  126 + standardStandardized: '',
  127 + standardStandardizedName: '',
  128 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 129 detail: {
94 code: '', 130 code: '',
95 supplier: '', 131 supplier: '',
@@ -143,6 +179,24 @@ export default { @@ -143,6 +179,24 @@ export default {
143 border: '1px solid #D54941' 179 border: '1px solid #D54941'
144 } 180 }
145 }, 181 },
  182 + {
  183 + text: '上传正式合同附件',
  184 + visible: true,
  185 + variant: 'outline',
  186 + event: 'upload'
  187 + },
  188 + {
  189 + text: '上传正式合同附件',
  190 + visible: true,
  191 + variant: 'outline',
  192 + event: 'uploadParent'
  193 + },
  194 + {
  195 + text: '上传标准合同附件',
  196 + visible: true,
  197 + variant: 'outline',
  198 + event: 'uploadStandard'
  199 + },
146 // { 200 // {
147 // text: '上传合同附件', 201 // text: '上传合同附件',
148 // visible: true, 202 // visible: true,
@@ -172,7 +226,9 @@ export default { @@ -172,7 +226,9 @@ export default {
172 { ...this.buttons[0]}, 226 { ...this.buttons[0]},
173 // { ...this.buttons[0], visible: (s === 'DRAFT') }, 227 // { ...this.buttons[0], visible: (s === 'DRAFT') },
174 { ...this.buttons[1], visible: (s === 'DRAFT') }, 228 { ...this.buttons[1], visible: (s === 'DRAFT') },
175 - { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS') }, 229 + { ...this.buttons[2], visible: ((s === 'DRAFT' || s === 'FORMAL') && t !== 'AUDIT' && t !== 'PASS') },
  230 + { ...this.buttons[3], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
  231 + { ...this.buttons[4], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
176 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') }, 232 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') },
177 // { ...this.buttons[4], visible: (s === 'STANDARD') } 233 // { ...this.buttons[4], visible: (s === 'STANDARD') }
178 ] 234 ]
@@ -217,12 +273,84 @@ export default { @@ -217,12 +273,84 @@ export default {
217 url: '/pages/contract_foreign_unplan/modify' + query 273 url: '/pages/contract_foreign_unplan/modify' + query
218 }) 274 })
219 }, 275 },
  276 + uploadContract(id, type = 'formal'){
  277 + if (!id) return
  278 + this.uploadId = id
  279 + this.uploadType = type
  280 + this.$refs.uploadPopup.open()
  281 + },
  282 + onUploadSubmit() {
  283 + if (!this.fileInfo.id) {
  284 + uni.showToast({
  285 + title: '请上传合同附件',
  286 + icon: 'error'
  287 + })
  288 + return
  289 + }
  290 + if (!this.standardStandardized) {
  291 + uni.showToast({
  292 + title: '请选择合同是否规范',
  293 + icon: 'error'
  294 + })
  295 + return
  296 + }
  297 + const data = this.uploadType === 'formal' ? {
  298 + id: this.id,
  299 + formalFileId: this.fileInfo.id,
  300 + formalFileName: this.fileInfo.name,
  301 + formalStandardized: this.standardStandardized
  302 + } : {
  303 + id: this.id,
  304 + standardFileId: this.fileInfo.id,
  305 + standardFileName: this.fileInfo.name,
  306 + standardStandardized: this.standardStandardized
  307 + }
  308 + const api = this.uploadType === 'formal' ? uploadFormalContract : uploadStandardContract
  309 + uni.showModal({
  310 + title: '确认提交',
  311 + content: this.uploadType === 'formal' ? '确定提交正式合同吗?' : '确定提交标准合同吗?',
  312 + success: (res) => {
  313 + if (res.confirm) {
  314 + api({...this.detail, ...data}).then(() => {
  315 + uni.showToast({
  316 + title: this.uploadType === 'formal' ? '上传正式合同成功' : '上传标准合同成功',
  317 + icon: 'success'
  318 + })
  319 + setTimeout(() => {
  320 + uni.navigateTo({
  321 + url: '/pages/contract_foreign_unplan/index'
  322 + })
  323 + }, 500)
  324 + }).catch(() => {
  325 + uni.showToast({
  326 + title: '上传失败',
  327 + icon: 'error'
  328 + })
  329 + })
  330 + }
  331 + }
  332 + })
  333 +
  334 + },
  335 + onSheetConfirm({ value, label }) {
  336 + this.standardStandardized = value
  337 + this.standardStandardizedName = label || ''
  338 + },
  339 + openStandardizedSheet() {
  340 + const options = this.yesNoList
  341 + const current = this.standardStandardized
  342 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  343 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  344 + },
220 handleButtonClick(btn) { 345 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 346 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 347 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 348 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 349 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 350 if (e === 'delete') return this.onDelete(btn && btn.params)
  351 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
  352 + if (e === 'uploadParent') return this.uploadContract(this.detail.parentId || '')
  353 + if (e === 'uploadStandard') return this.uploadContract(this.detail.id || '', 'standard')
226 }, 354 },
227 async loadDetail() { 355 async loadDetail() {
228 if (!this.id) return 356 if (!this.id) return
@@ -304,4 +432,46 @@ export default { @@ -304,4 +432,46 @@ export default {
304 color: rgba(0, 0, 0, 0.9); 432 color: rgba(0, 0, 0, 0.9);
305 padding-bottom: 12rpx; 433 padding-bottom: 12rpx;
306 } 434 }
  435 +.upload-dialog {
  436 + background: #fff;
  437 + border-top-left-radius: 16rpx;
  438 + border-top-right-radius: 16rpx;
  439 +}
  440 +.upload-header {
  441 + display: flex;
  442 + position: relative;
  443 + align-items: center;
  444 + justify-content: center;
  445 + padding: 32rpx 32rpx;
  446 +}
  447 +.upload-header .title {
  448 + font-size: 36rpx;
  449 + color: rgba(0, 0, 0, 0.9);
  450 + font-weight: 600;
  451 +}
  452 +.upload-body {
  453 + padding: 16rpx 32rpx;
  454 + border-bottom: 1rpx solid #E7E7E7;
  455 +}
  456 +.upload-body .section-title {
  457 + font-size: 32rpx;
  458 + color: rgba(0, 0, 0, 0.9);
  459 + font-weight: 600;
  460 + line-height: 48rpx;
  461 +}
  462 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  463 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  464 +.row1 {
  465 + display: flex;
  466 + justify-content: space-between;
  467 + align-items: center;
  468 + color: rgba(0, 0, 0, 0.9);
  469 + margin: 32rpx 0;
  470 +}
  471 +
  472 +.label1 {
  473 + width: 280rpx;
  474 + color: rgba(0, 0, 0, 0.6);
  475 + font-size: 32rpx;
  476 +}
307 </style> 477 </style>
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 @error="onCardError" 46 @error="onCardError"
47 > 47 >
48 <template v-slot="{ item }"> 48 <template v-slot="{ item }">
49 - <view class="card"> 49 + <view class="card" @click="goDetail(item)">
50 <view class="card-header"> 50 <view class="card-header">
51 <text class="title omit2">{{ item.buyerName }}</text> 51 <text class="title omit2">{{ item.buyerName }}</text>
52 <text v-if="item.status === 'STANDARD'" :class="['status']" :style="{ background: statusMap[item.shippingStatusName] }">{{ item.shippingStatusName }}</text> 52 <text v-if="item.status === 'STANDARD'" :class="['status']" :style="{ background: statusMap[item.shippingStatusName] }">{{ item.shippingStatusName }}</text>
@@ -158,6 +158,9 @@ export default { @@ -158,6 +158,9 @@ export default {
158 } 158 }
159 }, 159 },
160 methods: { 160 methods: {
  161 + goDetail(item) {
  162 + uni.navigateTo({ url: '/pages/contract_foreign_unplan/detail?id=' + item.id + '&status=' + item.status })
  163 + },
161 onCardLoaded({ items }) { 164 onCardLoaded({ items }) {
162 this.currentItems = items 165 this.currentItems = items
163 }, 166 },
@@ -606,10 +606,9 @@ export default { @@ -606,10 +606,9 @@ export default {
606 606
607 .opCollapse { 607 .opCollapse {
608 color: rgba(0, 0, 0, 0.6); 608 color: rgba(0, 0, 0, 0.6);
609 - width: 24rpx;  
610 - height: 24rpx; 609 + width: 32rpx;
  610 + height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614
@@ -596,10 +596,9 @@ export default { @@ -596,10 +596,9 @@ export default {
596 596
597 .opCollapse { 597 .opCollapse {
598 color: rgba(0, 0, 0, 0.6); 598 color: rgba(0, 0, 0, 0.6);
599 - width: 24rpx;  
600 - height: 24rpx; 599 + width: 32rpx;
  600 + height: 28rpx;
601 margin-right: 16rpx; 601 margin-right: 16rpx;
602 - margin-top: 8rpx;  
603 } 602 }
604 } 603 }
605 604
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 </view> 52 </view>
53 53
54 <view class="section"> 54 <view class="section">
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-' 55 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-'
56 }}</text></view> 56 }}</text></view>
57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' 57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'
58 }}</text></view> 58 }}</text></view>
@@ -76,20 +76,53 @@ @@ -76,20 +76,53 @@
76 </view> 76 </view>
77 </scroll-view> 77 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  79 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  80 + <view class="upload-dialog">
  81 + <view class="upload-header">
  82 + <text class="title">上传规范性合同</text>
  83 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  84 + </view>
  85 + <view class="upload-body">
  86 + <text class="section-title">附件上传:</text>
  87 + <view class="upload-row">
  88 + <FileUpload v-model="fileInfo" />
  89 + </view>
  90 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  91 + <view class="row1" @click="openStandardizedSheet">
  92 + <view class="label1">合同是否规范</view>
  93 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  94 + <view class="value" v-else >{{standardStandardizedName}}</view>
  95 + </view>
  96 + </view>
  97 + <view class="upload-footer">
  98 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  99 + </view>
  100 + </view>
  101 + </uni-popup>
  102 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
79 </view> 103 </view>
80 </template> 104 </template>
81 105
82 <script> 106 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 107 +import { getContractApi, deleteContractApi, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 108 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 109 import DetailButtons from '@/components/detail-buttons/index.vue'
  110 +import FileUpload from '@/components/file-upload/index.vue'
  111 +import SingleSelectSheet from '@/components/single-select/index.vue'
  112 +
86 113
87 export default { 114 export default {
88 name: 'ContractProcessDetail', 115 name: 'ContractProcessDetail',
89 - components: { ProductRel, DetailButtons }, 116 + components: { ProductRel, DetailButtons, SingleSelectSheet, FileUpload },
90 data() { 117 data() {
91 return { 118 return {
92 id: '', 119 id: '',
  120 + uploadId: '',
  121 + fileInfo: { id: '', name: '' },
  122 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  123 + standardStandardized: '',
  124 + standardStandardizedName: '',
  125 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 126 detail: {
94 code: '', 127 code: '',
95 supplier: '', 128 supplier: '',
@@ -217,13 +250,75 @@ export default { @@ -217,13 +250,75 @@ export default {
217 url: '/pages/contract_process/modify' + query 250 url: '/pages/contract_process/modify' + query
218 }) 251 })
219 }, 252 },
  253 + uploadContract(id){
  254 + if (!id) return
  255 + this.uploadId = id
  256 + this.$refs.uploadPopup.open()
  257 + },
  258 + onUploadSubmit() {
  259 + if (!this.fileInfo.id) {
  260 + uni.showToast({
  261 + title: '请上传合同附件',
  262 + icon: 'error'
  263 + })
  264 + return
  265 + }
  266 + if (!this.standardStandardized) {
  267 + uni.showToast({
  268 + title: '请选择合同是否规范',
  269 + icon: 'error'
  270 + })
  271 + return
  272 + }
  273 + const data = {
  274 + id: this.id,
  275 + standardFileId: this.fileInfo.id,
  276 + standardFileName: this.fileInfo.name,
  277 + standardStandardized: this.standardStandardized
  278 + }
  279 + uni.showModal({
  280 + title: '确认提交',
  281 + content: '确定提交标准合同吗?',
  282 + success: (res) => {
  283 + if (res.confirm) {
  284 + uploadStandardContract({...this.detail, ...data}).then(() => {
  285 + uni.showToast({
  286 + title: '上传标准合同成功',
  287 + icon: 'success'
  288 + })
  289 + setTimeout(() => {
  290 + uni.navigateTo({
  291 + url: '/pages/contract_process/index'
  292 + })
  293 + }, 500)
  294 + }).catch(() => {
  295 + uni.showToast({
  296 + title: '上传失败',
  297 + icon: 'error'
  298 + })
  299 + })
  300 + }
  301 + }
  302 + })
  303 +
  304 + },
  305 + onSheetConfirm({ value, label }) {
  306 + this.standardStandardized = value
  307 + this.standardStandardizedName = label || ''
  308 + },
  309 + openStandardizedSheet() {
  310 + const options = this.yesNoList
  311 + const current = this.standardStandardized
  312 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  313 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  314 + },
220 handleButtonClick(btn) { 315 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 316 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 317 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 318 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 319 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 320 if (e === 'delete') return this.onDelete(btn && btn.params)
226 - // if (e === 'upload') return this.onUpload(btn && btn.params) 321 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
227 // if (e === 'audit') return this.onAudit(btn && btn.params) 322 // if (e === 'audit') return this.onAudit(btn && btn.params)
228 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) 323 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
229 }, 324 },
@@ -307,4 +402,46 @@ export default { @@ -307,4 +402,46 @@ export default {
307 color: rgba(0, 0, 0, 0.9); 402 color: rgba(0, 0, 0, 0.9);
308 padding-bottom: 12rpx; 403 padding-bottom: 12rpx;
309 } 404 }
  405 +.upload-dialog {
  406 + background: #fff;
  407 + border-top-left-radius: 16rpx;
  408 + border-top-right-radius: 16rpx;
  409 +}
  410 +.upload-header {
  411 + display: flex;
  412 + position: relative;
  413 + align-items: center;
  414 + justify-content: center;
  415 + padding: 32rpx 32rpx;
  416 +}
  417 +.upload-header .title {
  418 + font-size: 36rpx;
  419 + color: rgba(0, 0, 0, 0.9);
  420 + font-weight: 600;
  421 +}
  422 +.upload-body {
  423 + padding: 16rpx 32rpx;
  424 + border-bottom: 1rpx solid #E7E7E7;
  425 +}
  426 +.upload-body .section-title {
  427 + font-size: 32rpx;
  428 + color: rgba(0, 0, 0, 0.9);
  429 + font-weight: 600;
  430 + line-height: 48rpx;
  431 +}
  432 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  433 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  434 +.row1 {
  435 + display: flex;
  436 + justify-content: space-between;
  437 + align-items: center;
  438 + color: rgba(0, 0, 0, 0.9);
  439 + margin: 32rpx 0;
  440 +}
  441 +
  442 +.label1 {
  443 + width: 280rpx;
  444 + color: rgba(0, 0, 0, 0.6);
  445 + font-size: 32rpx;
  446 +}
310 </style> 447 </style>
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 @error="onCardError" 46 @error="onCardError"
47 > 47 >
48 <template v-slot="{ item }"> 48 <template v-slot="{ item }">
49 - <view class="card"> 49 + <view class="card" @click="goDetail(item)">
50 <view class="card-header"> 50 <view class="card-header">
51 <text class="title omit2">{{ item.buyerName }}</text> 51 <text class="title omit2">{{ item.buyerName }}</text>
52 <text v-if="item.status === 'STANDARD'" :class="['status']" :style="{ background: statusMap[item.shippingStatusName] }">{{ item.shippingStatusName }}</text> 52 <text v-if="item.status === 'STANDARD'" :class="['status']" :style="{ background: statusMap[item.shippingStatusName] }">{{ item.shippingStatusName }}</text>
@@ -157,6 +157,11 @@ export default { @@ -157,6 +157,11 @@ export default {
157 } 157 }
158 }, 158 },
159 methods: { 159 methods: {
  160 + goDetail(item) {
  161 + const id = item && (item.id || item.contractId)
  162 + if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' })
  163 + uni.navigateTo({ url: `/pages/contract_process/detail?id=${id}&status=${this.status}` })
  164 + },
160 onCardLoaded({ items }) { 165 onCardLoaded({ items }) {
161 this.currentItems = items 166 this.currentItems = items
162 }, 167 },
@@ -610,10 +610,9 @@ export default { @@ -610,10 +610,9 @@ export default {
610 610
611 .opCollapse { 611 .opCollapse {
612 color: rgba(0, 0, 0, 0.6); 612 color: rgba(0, 0, 0, 0.6);
613 - width: 24rpx;  
614 - height: 24rpx; 613 + width: 32rpx;
  614 + height: 28rpx;
615 margin-right: 16rpx; 615 margin-right: 16rpx;
616 - margin-top: 8rpx;  
617 } 616 }
618 } 617 }
619 618
@@ -595,7 +595,6 @@ export default { @@ -595,7 +595,6 @@ export default {
595 width: 32rpx; 595 width: 32rpx;
596 height: 28rpx; 596 height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -4,15 +4,13 @@ @@ -4,15 +4,13 @@
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 - <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'  
8 - }}</text></view>  
9 - <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'  
10 - }}</text></view> 7 + <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核状态</text><text class="value">{{ detail.standardApprovedName || '-'}}</text></view>
  8 + <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'}}</text></view>
  9 + <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'}}</text></view>
11 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 10 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
12 </view> 11 </view>
13 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 12 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
14 - <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'  
15 - }}</text></view> 13 + <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'}}</text></view>
16 </view> 14 </view>
17 15
18 <view class="section1"> 16 <view class="section1">
@@ -20,16 +18,11 @@ @@ -20,16 +18,11 @@
20 </view> 18 </view>
21 19
22 <view class="section"> 20 <view class="section">
23 - <view class="row"><text class="label">合计人民币金额(大写)</text><text class="value">{{  
24 - detail.totalAmountCapital || '-' }}</text></view>  
25 - <view class="row"><text class="label">交付定金、数额、时间</text><text class="value">{{ detail.depositInfo ||  
26 - '-' }}</text></view>  
27 - <view class="row"><text class="label">包装要求</text><text class="value">{{ detail.packagingRequirements  
28 - || '-' }}</text></view>  
29 - <view class="row"><text class="label">付款方式、付款期限</text><text class="value">{{ detail.paymentTerms ||  
30 - '-' }}</text></view>  
31 - <view class="row"><text class="label">运输方式</text><text class="value">{{ detail.transportMode || '-'  
32 - }}</text></view> 21 + <view class="row"><text class="label">合计人民币金额(大写)</text><text class="value">{{detail.totalAmountCapital || '-' }}</text></view>
  22 + <view class="row"><text class="label">交付定金、数额、时间</text><text class="value">{{ detail.depositInfo ||'-' }}</text></view>
  23 + <view class="row"><text class="label">包装要求</text><text class="value">{{ detail.packagingRequirements || '-' }}</text></view>
  24 + <view class="row"><text class="label">付款方式、付款期限</text><text class="value">{{ detail.paymentTerms ||'-' }}</text></view>
  25 + <view class="row"><text class="label">运输方式</text><text class="value">{{ detail.transportMode || '-'}}</text></view>
33 <view class="row"><text class="label">目的地</text><text class="value">{{ detail.destinationLabel || '-' 26 <view class="row"><text class="label">目的地</text><text class="value">{{ detail.destinationLabel || '-'
34 }}</text></view> 27 }}</text></view>
35 <view class="row"><text class="label">单价中是否已包含包装费</text><text class="value">{{ 28 <view class="row"><text class="label">单价中是否已包含包装费</text><text class="value">{{
@@ -51,11 +44,9 @@ @@ -51,11 +44,9 @@
51 }}</text></view> 44 }}</text></view>
52 </view> 45 </view>
53 46
54 - <view class="section">  
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-'  
56 - }}</text></view>  
57 - <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'  
58 - }}</text></view> 47 + <view class="section" v-if="status === 'STANDARD'">
  48 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-' }}</text></view>
  49 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' }}</text></view>
59 </view> 50 </view>
60 51
61 <view class="section"> 52 <view class="section">
@@ -76,17 +67,44 @@ @@ -76,17 +67,44 @@
76 </view> 67 </view>
77 </scroll-view> 68 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 69 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  70 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  71 + <view class="upload-dialog">
  72 + <view class="upload-header">
  73 + <text class="title">上传规范性合同</text>
  74 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  75 + </view>
  76 + <view class="upload-body">
  77 + <text class="section-title">附件上传:</text>
  78 + <view class="upload-row">
  79 + <FileUpload v-model="fileInfo" />
  80 + </view>
  81 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  82 + <view class="row1" @click="openStandardizedSheet">
  83 + <view class="label1">合同是否规范</view>
  84 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  85 + <view class="value" v-else >{{standardStandardizedName}}</view>
  86 + </view>
  87 + </view>
  88 + <view class="upload-footer">
  89 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  90 + </view>
  91 + </view>
  92 + </uni-popup>
  93 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
  94 +
79 </view> 95 </view>
80 </template> 96 </template>
81 97
82 <script> 98 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 99 +import { getContractApi, deleteContractApi, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 100 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 101 import DetailButtons from '@/components/detail-buttons/index.vue'
  102 +import FileUpload from '@/components/file-upload/index.vue'
  103 +import SingleSelectSheet from '@/components/single-select/index.vue'
86 104
87 export default { 105 export default {
88 name: 'ContractRetailDetail', 106 name: 'ContractRetailDetail',
89 - components: { ProductRel, DetailButtons }, 107 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 108 data() {
91 return { 109 return {
92 id: '', 110 id: '',
@@ -127,6 +145,11 @@ export default { @@ -127,6 +145,11 @@ export default {
127 packaging: '' 145 packaging: ''
128 }, 146 },
129 productList: [], 147 productList: [],
  148 + fileInfo: { id: '', name: '' },
  149 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  150 + standardStandardized: '',
  151 + standardStandardizedName: '',
  152 + sheet: { visible: false, title: '请选择', options: [], value: '' },
130 buttons: [{ 153 buttons: [{
131 text: '编辑', 154 text: '编辑',
132 visible: true, 155 visible: true,
@@ -180,10 +203,69 @@ export default { @@ -180,10 +203,69 @@ export default {
180 }, 203 },
181 onLoad(options) { 204 onLoad(options) {
182 const id = options && options.id ? options.id : '' 205 const id = options && options.id ? options.id : ''
  206 + const status = options && options.status ? options.status : ''
183 this.id = id 207 this.id = id
  208 + this.status = status
184 this.loadDetail() 209 this.loadDetail()
185 }, 210 },
186 methods: { 211 methods: {
  212 + onUploadSubmit() {
  213 + if (!this.fileInfo.id) {
  214 + uni.showToast({
  215 + title: '请上传合同附件',
  216 + icon: 'error'
  217 + })
  218 + return
  219 + }
  220 + if (!this.standardStandardized) {
  221 + uni.showToast({
  222 + title: '请选择合同是否规范',
  223 + icon: 'error'
  224 + })
  225 + return
  226 + }
  227 + const data = {
  228 + id: this.id,
  229 + standardFileId: this.fileInfo.id,
  230 + standardFileName: this.fileInfo.name,
  231 + standardStandardized: this.standardStandardized
  232 + }
  233 + uni.showModal({
  234 + title: '确认提交',
  235 + content: '确定提交标准合同吗?',
  236 + success: (res) => {
  237 + if (res.confirm) {
  238 + uploadStandardContract({...this.detail, ...data}).then(() => {
  239 + uni.showToast({
  240 + title: '上传标准合同成功',
  241 + icon: 'success'
  242 + })
  243 + setTimeout(() => {
  244 + uni.navigateTo({
  245 + url: '/pages/contract_retail/index'
  246 + })
  247 + }, 500)
  248 + }).catch(() => {
  249 + uni.showToast({
  250 + title: '上传失败',
  251 + icon: 'error'
  252 + })
  253 + })
  254 + }
  255 + }
  256 + })
  257 +
  258 + },
  259 + onSheetConfirm({ value, label }) {
  260 + this.standardStandardized = value
  261 + this.standardStandardizedName = label || ''
  262 + },
  263 + openStandardizedSheet() {
  264 + const options = this.yesNoList
  265 + const current = this.standardStandardized
  266 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  267 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  268 + },
187 onDelete() { 269 onDelete() {
188 uni.showModal({ 270 uni.showModal({
189 title: '确认删除', 271 title: '确认删除',
@@ -217,13 +299,16 @@ export default { @@ -217,13 +299,16 @@ export default {
217 url: '/pages/contract_retail/modify' + query 299 url: '/pages/contract_retail/modify' + query
218 }) 300 })
219 }, 301 },
  302 + onUpload() {
  303 + this.$refs.uploadPopup.open()
  304 + },
220 handleButtonClick(btn) { 305 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 306 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 307 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 308 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 309 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 310 if (e === 'delete') return this.onDelete(btn && btn.params)
226 - // if (e === 'upload') return this.onUpload(btn && btn.params) 311 + if (e === 'upload') return this.onUpload(btn && btn.params)
227 // if (e === 'audit') return this.onAudit(btn && btn.params) 312 // if (e === 'audit') return this.onAudit(btn && btn.params)
228 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) 313 // if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
229 }, 314 },
@@ -277,7 +362,6 @@ export default { @@ -277,7 +362,6 @@ export default {
277 background: #fff; 362 background: #fff;
278 margin-bottom: 20rpx; 363 margin-bottom: 20rpx;
279 } 364 }
280 -  
281 .row { 365 .row {
282 display: flex; 366 display: flex;
283 margin-bottom: 20rpx; 367 margin-bottom: 20rpx;
@@ -294,6 +378,20 @@ export default { @@ -294,6 +378,20 @@ export default {
294 font-size: 28rpx; 378 font-size: 28rpx;
295 } 379 }
296 380
  381 +.row1 {
  382 + display: flex;
  383 + justify-content: space-between;
  384 + align-items: center;
  385 + color: rgba(0, 0, 0, 0.9);
  386 + margin: 32rpx 0;
  387 +}
  388 +
  389 +.label1 {
  390 + width: 280rpx;
  391 + color: rgba(0, 0, 0, 0.6);
  392 + font-size: 32rpx;
  393 +}
  394 +
297 .value { 395 .value {
298 flex: 1; 396 flex: 1;
299 text-align: right; 397 text-align: right;
@@ -307,4 +405,33 @@ export default { @@ -307,4 +405,33 @@ export default {
307 color: rgba(0, 0, 0, 0.9); 405 color: rgba(0, 0, 0, 0.9);
308 padding-bottom: 12rpx; 406 padding-bottom: 12rpx;
309 } 407 }
310 -</style>  
  408 +.upload-dialog {
  409 + background: #fff;
  410 + border-top-left-radius: 16rpx;
  411 + border-top-right-radius: 16rpx;
  412 +}
  413 +.upload-header {
  414 + display: flex;
  415 + position: relative;
  416 + align-items: center;
  417 + justify-content: center;
  418 + padding: 32rpx 32rpx;
  419 +}
  420 +.upload-header .title {
  421 + font-size: 36rpx;
  422 + color: rgba(0, 0, 0, 0.9);
  423 + font-weight: 600;
  424 +}
  425 +.upload-body {
  426 + padding: 16rpx 32rpx;
  427 + border-bottom: 1rpx solid #E7E7E7;
  428 +}
  429 +.upload-body .section-title {
  430 + font-size: 32rpx;
  431 + color: rgba(0, 0, 0, 0.9);
  432 + font-weight: 600;
  433 + line-height: 48rpx;
  434 +}
  435 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  436 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  437 +</style>
@@ -206,7 +206,7 @@ export default { @@ -206,7 +206,7 @@ export default {
206 goDetail(item) { 206 goDetail(item) {
207 const id = item && (item.id || item.contractId) 207 const id = item && (item.id || item.contractId)
208 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' }) 208 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' })
209 - uni.navigateTo({ url: `/pages/contract_retail/detail?id=${id}` }) 209 + uni.navigateTo({ url: `/pages/contract_retail/detail?id=${id}&status=${this.status}` })
210 }, 210 },
211 fetchList({ pageIndex, pageSize, query, extra }) { 211 fetchList({ pageIndex, pageSize, query, extra }) {
212 console.log('fetchList', pageIndex, pageSize, query, extra) 212 console.log('fetchList', pageIndex, pageSize, query, extra)
@@ -609,7 +609,6 @@ export default { @@ -609,7 +609,6 @@ export default {
609 width: 32rpx; 609 width: 32rpx;
610 height: 28rpx; 610 height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614
@@ -592,10 +592,9 @@ export default { @@ -592,10 +592,9 @@ export default {
592 592
593 .opCollapse { 593 .opCollapse {
594 color: rgba(0, 0, 0, 0.6); 594 color: rgba(0, 0, 0, 0.6);
595 - width: 24rpx;  
596 - height: 24rpx; 595 + width: 32rpx;
  596 + height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -52,12 +52,15 @@ @@ -52,12 +52,15 @@
52 </view> 52 </view>
53 53
54 <view class="section"> 54 <view class="section">
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-' 55 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-'
56 }}</text></view> 56 }}</text></view>
57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' 57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'
58 }}</text></view> 58 }}</text></view>
59 </view> 59 </view>
60 - 60 + <view class="section" v-if="status === 'FORMAL'">
  61 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.formalFileName || '-' }}</text></view>
  62 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.formalStandardized ? '是' : '否' }}</text></view>
  63 + </view>
61 <view class="section"> 64 <view class="section">
62 <text class="row customer">具体质量要求</text> 65 <text class="row customer">具体质量要求</text>
63 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead || 66 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead ||
@@ -76,20 +79,51 @@ @@ -76,20 +79,51 @@
76 </view> 79 </view>
77 </scroll-view> 80 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 81 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  82 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  83 + <view class="upload-dialog">
  84 + <view class="upload-header">
  85 + <text class="title">上传规范性合同</text>
  86 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  87 + </view>
  88 + <view class="upload-body">
  89 + <text class="section-title">附件上传:</text>
  90 + <view class="upload-row">
  91 + <FileUpload v-model="fileInfo" />
  92 + </view>
  93 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  94 + <view class="row1" @click="openStandardizedSheet">
  95 + <view class="label1">合同是否规范</view>
  96 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  97 + <view class="value" v-else >{{standardStandardizedName}}</view>
  98 + </view>
  99 + </view>
  100 + <view class="upload-footer">
  101 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  102 + </view>
  103 + </view>
  104 + </uni-popup>
  105 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
  106 +
79 </view> 107 </view>
80 </template> 108 </template>
81 109
82 <script> 110 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 111 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 112 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 113 import DetailButtons from '@/components/detail-buttons/index.vue'
86 - 114 +import FileUpload from '@/components/file-upload/index.vue'
  115 +import SingleSelectSheet from '@/components/single-select/index.vue'
87 export default { 116 export default {
88 name: 'ContractStockDetail', 117 name: 'ContractStockDetail',
89 - components: { ProductRel, DetailButtons }, 118 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 119 data() {
91 return { 120 return {
92 id: '', 121 id: '',
  122 + fileInfo: { id: '', name: '' },
  123 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  124 + standardStandardized: '',
  125 + standardStandardizedName: '',
  126 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 127 detail: {
94 code: '', 128 code: '',
95 supplier: '', 129 supplier: '',
@@ -143,12 +177,24 @@ export default { @@ -143,12 +177,24 @@ export default {
143 border: '1px solid #D54941' 177 border: '1px solid #D54941'
144 } 178 }
145 }, 179 },
146 - // {  
147 - // text: '上传合同附件',  
148 - // visible: true,  
149 - // variant: 'outline',  
150 - // event: 'upload'  
151 - // }, 180 + {
  181 + text: '上传正式合同附件',
  182 + visible: true,
  183 + variant: 'outline',
  184 + event: 'upload'
  185 + },
  186 + {
  187 + text: '上传正式合同附件',
  188 + visible: true,
  189 + variant: 'outline',
  190 + event: 'uploadParent'
  191 + },
  192 + {
  193 + text: '上传标准合同附件',
  194 + visible: true,
  195 + variant: 'outline',
  196 + event: 'uploadStandard'
  197 + },
152 // { 198 // {
153 // text: '审核', 199 // text: '审核',
154 // visible: true, 200 // visible: true,
@@ -162,17 +208,21 @@ export default { @@ -162,17 +208,21 @@ export default {
162 // event: 'auditDetail' 208 // event: 'auditDetail'
163 // }, 209 // },
164 ], 210 ],
  211 + uploadId: '',
  212 + uploadType: 'formal',
165 } 213 }
166 }, 214 },
167 computed: { 215 computed: {
168 displayButtons() { 216 displayButtons() {
169 const s = this.detail && this.detail.status || '' 217 const s = this.detail && this.detail.status || ''
170 - const t = this.detail.standardApproved || '' 218 + const t = this.detail.formalApproved || ''
171 return [ 219 return [
172 { ...this.buttons[0]}, 220 { ...this.buttons[0]},
173 // { ...this.buttons[0], visible: (s === 'DRAFT') }, 221 // { ...this.buttons[0], visible: (s === 'DRAFT') },
174 { ...this.buttons[1], visible: (s === 'DRAFT') }, 222 { ...this.buttons[1], visible: (s === 'DRAFT') },
175 - { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS') }, 223 + { ...this.buttons[2], visible: ((s === 'DRAFT' || s === 'FORMAL') && t !== 'AUDIT' && t !== 'PASS') },
  224 + { ...this.buttons[3], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
  225 + { ...this.buttons[4], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
176 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') }, 226 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') },
177 // { ...this.buttons[4], visible: (s === 'STANDARD') } 227 // { ...this.buttons[4], visible: (s === 'STANDARD') }
178 ] 228 ]
@@ -217,12 +267,84 @@ export default { @@ -217,12 +267,84 @@ export default {
217 url: '/pages/contract_stock/modify' + query 267 url: '/pages/contract_stock/modify' + query
218 }) 268 })
219 }, 269 },
  270 + uploadContract(id, type = 'formal'){
  271 + if (!id) return
  272 + this.uploadId = id
  273 + this.uploadType = type
  274 + this.$refs.uploadPopup.open()
  275 + },
  276 + onUploadSubmit() {
  277 + if (!this.fileInfo.id) {
  278 + uni.showToast({
  279 + title: '请上传合同附件',
  280 + icon: 'error'
  281 + })
  282 + return
  283 + }
  284 + if (!this.standardStandardized) {
  285 + uni.showToast({
  286 + title: '请选择合同是否规范',
  287 + icon: 'error'
  288 + })
  289 + return
  290 + }
  291 + const data = this.uploadType === 'formal' ? {
  292 + id: this.id,
  293 + formalFileId: this.fileInfo.id,
  294 + formalFileName: this.fileInfo.name,
  295 + formalStandardized: this.standardStandardized
  296 + } : {
  297 + id: this.id,
  298 + standardFileId: this.fileInfo.id,
  299 + standardFileName: this.fileInfo.name,
  300 + standardStandardized: this.standardStandardized
  301 + }
  302 + const api = this.uploadType === 'formal' ? uploadFormalContract : uploadStandardContract
  303 + uni.showModal({
  304 + title: '确认提交',
  305 + content: this.uploadType === 'formal' ? '确定提交正式合同吗?' : '确定提交标准合同吗?',
  306 + success: (res) => {
  307 + if (res.confirm) {
  308 + api({...this.detail, ...data}).then(() => {
  309 + uni.showToast({
  310 + title: this.uploadType === 'formal' ? '上传正式合同成功' : '上传标准合同成功',
  311 + icon: 'success'
  312 + })
  313 + setTimeout(() => {
  314 + uni.navigateTo({
  315 + url: '/pages/contract_stock/index'
  316 + })
  317 + }, 500)
  318 + }).catch(() => {
  319 + uni.showToast({
  320 + title: '上传失败',
  321 + icon: 'error'
  322 + })
  323 + })
  324 + }
  325 + }
  326 + })
  327 +
  328 + },
  329 + onSheetConfirm({ value, label }) {
  330 + this.standardStandardized = value
  331 + this.standardStandardizedName = label || ''
  332 + },
  333 + openStandardizedSheet() {
  334 + const options = this.yesNoList
  335 + const current = this.standardStandardized
  336 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  337 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  338 + },
220 handleButtonClick(btn) { 339 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 340 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 341 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 342 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 343 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 344 if (e === 'delete') return this.onDelete(btn && btn.params)
  345 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
  346 + if (e === 'uploadParent') return this.uploadContract(this.detail.parentId || '')
  347 + if (e === 'uploadStandard') return this.uploadContract(this.detail.id || '', 'standard')
226 }, 348 },
227 async loadDetail() { 349 async loadDetail() {
228 if (!this.id) return 350 if (!this.id) return
@@ -304,4 +426,46 @@ export default { @@ -304,4 +426,46 @@ export default {
304 color: rgba(0, 0, 0, 0.9); 426 color: rgba(0, 0, 0, 0.9);
305 padding-bottom: 12rpx; 427 padding-bottom: 12rpx;
306 } 428 }
  429 +.upload-dialog {
  430 + background: #fff;
  431 + border-top-left-radius: 16rpx;
  432 + border-top-right-radius: 16rpx;
  433 +}
  434 +.upload-header {
  435 + display: flex;
  436 + position: relative;
  437 + align-items: center;
  438 + justify-content: center;
  439 + padding: 32rpx 32rpx;
  440 +}
  441 +.upload-header .title {
  442 + font-size: 36rpx;
  443 + color: rgba(0, 0, 0, 0.9);
  444 + font-weight: 600;
  445 +}
  446 +.upload-body {
  447 + padding: 16rpx 32rpx;
  448 + border-bottom: 1rpx solid #E7E7E7;
  449 +}
  450 +.upload-body .section-title {
  451 + font-size: 32rpx;
  452 + color: rgba(0, 0, 0, 0.9);
  453 + font-weight: 600;
  454 + line-height: 48rpx;
  455 +}
  456 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  457 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  458 +.row1 {
  459 + display: flex;
  460 + justify-content: space-between;
  461 + align-items: center;
  462 + color: rgba(0, 0, 0, 0.9);
  463 + margin: 32rpx 0;
  464 +}
  465 +
  466 +.label1 {
  467 + width: 280rpx;
  468 + color: rgba(0, 0, 0, 0.6);
  469 + font-size: 32rpx;
  470 +}
307 </style> 471 </style>
@@ -161,7 +161,7 @@ export default { @@ -161,7 +161,7 @@ export default {
161 goDetail(item) { 161 goDetail(item) {
162 const id = item && (item.id || item.contractId) 162 const id = item && (item.id || item.contractId)
163 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' }) 163 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' })
164 - uni.navigateTo({ url: `/pages/contract_stock/detail?id=${id}` }) 164 + uni.navigateTo({ url: `/pages/contract_stock/detail?id=${id}&status=${this.status}` })
165 }, 165 },
166 onAdd() { 166 onAdd() {
167 uni.navigateTo({ url: '/pages/contract_stock/add' }) 167 uni.navigateTo({ url: '/pages/contract_stock/add' })
@@ -606,10 +606,9 @@ export default { @@ -606,10 +606,9 @@ export default {
606 606
607 .opCollapse { 607 .opCollapse {
608 color: rgba(0, 0, 0, 0.6); 608 color: rgba(0, 0, 0, 0.6);
609 - width: 24rpx;  
610 - height: 24rpx; 609 + width: 32rpx;
  610 + height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614
@@ -592,10 +592,9 @@ export default { @@ -592,10 +592,9 @@ export default {
592 592
593 .opCollapse { 593 .opCollapse {
594 color: rgba(0, 0, 0, 0.6); 594 color: rgba(0, 0, 0, 0.6);
595 - width: 24rpx;  
596 - height: 24rpx; 595 + width: 32rpx;
  596 + height: 28rpx;
597 margin-right: 16rpx; 597 margin-right: 16rpx;
598 - margin-top: 8rpx;  
599 } 598 }
600 } 599 }
601 600
@@ -52,12 +52,15 @@ @@ -52,12 +52,15 @@
52 </view> 52 </view>
53 53
54 <view class="section"> 54 <view class="section">
55 - <view class="row"><text class="label">规范性合同</text><text class="value">{{ detail.standardFileName || '-' 55 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.standardFileName || '-'
56 }}</text></view> 56 }}</text></view>
57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否' 57 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.standardStandardized ? '是' : '否'
58 }}</text></view> 58 }}</text></view>
59 </view> 59 </view>
60 - 60 + <view class="section" v-if="status === 'FORMAL'">
  61 + <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ detail.formalFileName || '-' }}</text></view>
  62 + <view class="row"><text class="label">合同是否规范</text><text class="value">{{ detail.formalStandardized ? '是' : '否' }}</text></view>
  63 + </view>
61 <view class="section"> 64 <view class="section">
62 <text class="row customer">具体质量要求</text> 65 <text class="row customer">具体质量要求</text>
63 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead || 66 <view class="row"><text class="label">件重条头</text><text class="value">{{ detail.pieceWeightHead ||
@@ -76,20 +79,53 @@ @@ -76,20 +79,53 @@
76 </view> 79 </view>
77 </scroll-view> 80 </scroll-view>
78 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 81 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  82 + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false" :safe-area="true">
  83 + <view class="upload-dialog">
  84 + <view class="upload-header">
  85 + <text class="title">上传规范性合同</text>
  86 + <uni-icons type="closeempty" style="position: absolute; right: 16px;" size="22" @click="$refs.uploadPopup.close()" />
  87 + </view>
  88 + <view class="upload-body">
  89 + <text class="section-title">附件上传:</text>
  90 + <view class="upload-row">
  91 + <FileUpload v-model="fileInfo" />
  92 + </view>
  93 + <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
  94 + <view class="row1" @click="openStandardizedSheet">
  95 + <view class="label1">合同是否规范</view>
  96 + <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
  97 + <view class="value" v-else >{{standardStandardizedName}}</view>
  98 + </view>
  99 + </view>
  100 + <view class="upload-footer">
  101 + <button class="btn submit" type="primary" @click="onUploadSubmit">提交</button>
  102 + </view>
  103 + </view>
  104 + </uni-popup>
  105 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" />
79 </view> 106 </view>
80 </template> 107 </template>
81 108
82 <script> 109 <script>
83 -import { getContractApi, deleteContractApi } from '@/api/contract' 110 +import { getContractApi, deleteContractApi,uploadFormalContract } from '@/api/contract'
84 import ProductRel from './productRel.vue' 111 import ProductRel from './productRel.vue'
85 import DetailButtons from '@/components/detail-buttons/index.vue' 112 import DetailButtons from '@/components/detail-buttons/index.vue'
  113 +import FileUpload from '@/components/file-upload/index.vue'
  114 +import SingleSelectSheet from '@/components/single-select/index.vue'
86 115
87 export default { 116 export default {
88 name: 'ContractUnplanDetail', 117 name: 'ContractUnplanDetail',
89 - components: { ProductRel, DetailButtons }, 118 + components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
90 data() { 119 data() {
91 return { 120 return {
92 id: '', 121 id: '',
  122 + uploadId: '',
  123 + uploadType: 'formal',
  124 + fileInfo: { id: '', name: '' },
  125 + yesNoList: [{ label: '是', value: true }, { label: '否', value: false }],
  126 + standardStandardized: '',
  127 + standardStandardizedName: '',
  128 + sheet: { visible: false, title: '请选择', options: [], value: '' },
93 detail: { 129 detail: {
94 code: '', 130 code: '',
95 supplier: '', 131 supplier: '',
@@ -143,12 +179,30 @@ export default { @@ -143,12 +179,30 @@ export default {
143 border: '1px solid #D54941' 179 border: '1px solid #D54941'
144 } 180 }
145 }, 181 },
146 - // {  
147 - // text: '上传合同附件',  
148 - // visible: true,  
149 - // variant: 'outline',  
150 - // event: 'upload'  
151 - // }, 182 + {
  183 + text: '上传合同附件',
  184 + visible: true,
  185 + variant: 'outline',
  186 + event: 'upload'
  187 + },
  188 + {
  189 + text: '上传正式合同附件',
  190 + visible: true,
  191 + variant: 'outline',
  192 + event: 'upload'
  193 + },
  194 + {
  195 + text: '上传正式合同附件',
  196 + visible: true,
  197 + variant: 'outline',
  198 + event: 'uploadParent'
  199 + },
  200 + {
  201 + text: '上传标准合同附件',
  202 + visible: true,
  203 + variant: 'outline',
  204 + event: 'uploadStandard'
  205 + },
152 // { 206 // {
153 // text: '审核', 207 // text: '审核',
154 // visible: true, 208 // visible: true,
@@ -172,7 +226,9 @@ export default { @@ -172,7 +226,9 @@ export default {
172 { ...this.buttons[0]}, 226 { ...this.buttons[0]},
173 // { ...this.buttons[0], visible: (s === 'DRAFT') }, 227 // { ...this.buttons[0], visible: (s === 'DRAFT') },
174 { ...this.buttons[1], visible: (s === 'DRAFT') }, 228 { ...this.buttons[1], visible: (s === 'DRAFT') },
175 - { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS') }, 229 + { ...this.buttons[2], visible: ((s === 'DRAFT' || s === 'FORMAL') && t !== 'AUDIT' && t !== 'PASS') },
  230 + { ...this.buttons[3], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
  231 + { ...this.buttons[4], visible: (s === 'STANDARD' && t !== 'AUDIT' && t !== 'PASS') },
176 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') }, 232 // { ...this.buttons[3], visible: (s === 'STANDARD' && t === 'AUDIT') },
177 // { ...this.buttons[4], visible: (s === 'STANDARD') } 233 // { ...this.buttons[4], visible: (s === 'STANDARD') }
178 ] 234 ]
@@ -217,12 +273,84 @@ export default { @@ -217,12 +273,84 @@ export default {
217 url: '/pages/contract_unplan/modify' + query 273 url: '/pages/contract_unplan/modify' + query
218 }) 274 })
219 }, 275 },
  276 + uploadContract(id, type = 'formal'){
  277 + if (!id) return
  278 + this.uploadId = id
  279 + this.uploadType = type
  280 + this.$refs.uploadPopup.open()
  281 + },
  282 + onUploadSubmit() {
  283 + if (!this.fileInfo.id) {
  284 + uni.showToast({
  285 + title: '请上传合同附件',
  286 + icon: 'error'
  287 + })
  288 + return
  289 + }
  290 + if (!this.standardStandardized) {
  291 + uni.showToast({
  292 + title: '请选择合同是否规范',
  293 + icon: 'error'
  294 + })
  295 + return
  296 + }
  297 + const data = this.uploadType === 'formal' ? {
  298 + id: this.id,
  299 + formalFileId: this.fileInfo.id,
  300 + formalFileName: this.fileInfo.name,
  301 + formalStandardized: this.standardStandardized
  302 + } : {
  303 + id: this.id,
  304 + standardFileId: this.fileInfo.id,
  305 + standardFileName: this.fileInfo.name,
  306 + standardStandardized: this.standardStandardized
  307 + }
  308 + const api = this.uploadType === 'formal' ? uploadFormalContract : uploadStandardContract
  309 + uni.showModal({
  310 + title: '确认提交',
  311 + content: this.uploadType === 'formal' ? '确定提交正式合同吗?' : '确定提交标准合同吗?',
  312 + success: (res) => {
  313 + if (res.confirm) {
  314 + api({...this.detail, ...data}).then(() => {
  315 + uni.showToast({
  316 + title: this.uploadType === 'formal' ? '上传正式合同成功' : '上传标准合同成功',
  317 + icon: 'success'
  318 + })
  319 + setTimeout(() => {
  320 + uni.navigateTo({
  321 + url: '/pages/contract_unplan/index'
  322 + })
  323 + }, 500)
  324 + }).catch(() => {
  325 + uni.showToast({
  326 + title: '上传失败',
  327 + icon: 'error'
  328 + })
  329 + })
  330 + }
  331 + }
  332 + })
  333 +
  334 + },
  335 + onSheetConfirm({ value, label }) {
  336 + this.standardStandardized = value
  337 + this.standardStandardizedName = label || ''
  338 + },
  339 + openStandardizedSheet() {
  340 + const options = this.yesNoList
  341 + const current = this.standardStandardized
  342 + const match = (options || []).find(o => String(o.value) === String(current) || String(o.label) === String(current))
  343 + this.sheet = { ...this.sheet, visible: true, title: '合同是否规范', options, value: match ? match.value : '' }
  344 + },
220 handleButtonClick(btn) { 345 handleButtonClick(btn) {
221 if (!btn || btn.disabled) return 346 if (!btn || btn.disabled) return
222 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 347 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
223 const e = btn.event || '' 348 const e = btn.event || ''
224 if (e === 'edit') return this.onEdit(btn && btn.params) 349 if (e === 'edit') return this.onEdit(btn && btn.params)
225 if (e === 'delete') return this.onDelete(btn && btn.params) 350 if (e === 'delete') return this.onDelete(btn && btn.params)
  351 + if (e === 'upload') return this.uploadContract(this.detail.id || '')
  352 + if (e === 'uploadParent') return this.uploadContract(this.detail.parentId || '')
  353 + if (e === 'uploadStandard') return this.uploadContract(this.detail.id || '', 'standard')
226 }, 354 },
227 async loadDetail() { 355 async loadDetail() {
228 if (!this.id) return 356 if (!this.id) return
@@ -304,4 +432,46 @@ export default { @@ -304,4 +432,46 @@ export default {
304 color: rgba(0, 0, 0, 0.9); 432 color: rgba(0, 0, 0, 0.9);
305 padding-bottom: 12rpx; 433 padding-bottom: 12rpx;
306 } 434 }
  435 +.upload-dialog {
  436 + background: #fff;
  437 + border-top-left-radius: 16rpx;
  438 + border-top-right-radius: 16rpx;
  439 +}
  440 +.upload-header {
  441 + display: flex;
  442 + position: relative;
  443 + align-items: center;
  444 + justify-content: center;
  445 + padding: 32rpx 32rpx;
  446 +}
  447 +.upload-header .title {
  448 + font-size: 36rpx;
  449 + color: rgba(0, 0, 0, 0.9);
  450 + font-weight: 600;
  451 +}
  452 +.upload-body {
  453 + padding: 16rpx 32rpx;
  454 + border-bottom: 1rpx solid #E7E7E7;
  455 +}
  456 +.upload-body .section-title {
  457 + font-size: 32rpx;
  458 + color: rgba(0, 0, 0, 0.9);
  459 + font-weight: 600;
  460 + line-height: 48rpx;
  461 +}
  462 +.upload-footer { padding: 24rpx 32rpx 48rpx; }
  463 +.upload-footer .submit { background: $theme-primary; color: #fff; }
  464 +.row1 {
  465 + display: flex;
  466 + justify-content: space-between;
  467 + align-items: center;
  468 + color: rgba(0, 0, 0, 0.9);
  469 + margin: 32rpx 0;
  470 +}
  471 +
  472 +.label1 {
  473 + width: 280rpx;
  474 + color: rgba(0, 0, 0, 0.6);
  475 + font-size: 32rpx;
  476 +}
307 </style> 477 </style>
@@ -166,7 +166,7 @@ export default { @@ -166,7 +166,7 @@ export default {
166 goDetail(item) { 166 goDetail(item) {
167 const id = item && (item.id || item.contractId) 167 const id = item && (item.id || item.contractId)
168 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' }) 168 if (!id) return uni.showToast({ title: '缺少ID,无法查看详情', icon: 'none' })
169 - uni.navigateTo({ url: `/pages/contract_unplan/detail?id=${id}` }) 169 + uni.navigateTo({ url: `/pages/contract_unplan/detail?id=${id}&status=${this.status}` })
170 }, 170 },
171 onCardLoaded({ items }) { 171 onCardLoaded({ items }) {
172 this.currentItems = items 172 this.currentItems = items
@@ -606,10 +606,9 @@ export default { @@ -606,10 +606,9 @@ export default {
606 606
607 .opCollapse { 607 .opCollapse {
608 color: rgba(0, 0, 0, 0.6); 608 color: rgba(0, 0, 0, 0.6);
609 - width: 24rpx;  
610 - height: 24rpx; 609 + width: 32rpx;
  610 + height: 28rpx;
611 margin-right: 16rpx; 611 margin-right: 16rpx;
612 - margin-top: 8rpx;  
613 } 612 }
614 } 613 }
615 614