Showing
1 changed file
with
125 additions
and
9 deletions
| ... | ... | @@ -15,8 +15,7 @@ |
| 15 | 15 | |
| 16 | 16 | <!-- 产品 --> |
| 17 | 17 | <view class="section2"> |
| 18 | - <Product mode="view" :list="form.detailList" | |
| 19 | - /> | |
| 18 | + <Product mode="view" :list="form.detailList" /> | |
| 20 | 19 | </view> |
| 21 | 20 | <view class="section"> |
| 22 | 21 | <view class="row"><text class="label">签收单据</text><text class="value act">{{ form.fileName }}</text></view> |
| ... | ... | @@ -24,17 +23,35 @@ |
| 24 | 23 | </view> |
| 25 | 24 | </scroll-view> |
| 26 | 25 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> |
| 26 | + <uni-popup ref="uploadPopup" type="bottom" :mask-click="false"> | |
| 27 | + <view class="dialog"> | |
| 28 | + <view class="dialog_header"> | |
| 29 | + <text>上传签收单据</text> | |
| 30 | + <view class="dialog_close" @click="closeUploadInfo">×</view> | |
| 31 | + </view> | |
| 32 | + <view class="dialog_body"> | |
| 33 | + <view class="dialog_row"> | |
| 34 | + <text class="dialog_label">签收单据</text> | |
| 35 | + <FileUpload v-model="uploadFile" /> | |
| 36 | + </view> | |
| 37 | + </view> | |
| 38 | + <view class="dialog_footer"> | |
| 39 | + <button class="btn confirm" type="primary" @click="onUploadSave">保存</button> | |
| 40 | + </view> | |
| 41 | + </view> | |
| 42 | + </uni-popup> | |
| 27 | 43 | </view> |
| 28 | 44 | </template> |
| 29 | 45 | |
| 30 | 46 | <script> |
| 31 | -import { getDetailApi } from '@/api/invoice.js' | |
| 47 | +import { getDetailApi, saveSignInTicket } from '@/api/invoice.js' | |
| 32 | 48 | import Product from './product.vue' |
| 33 | 49 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 50 | +import FileUpload from '@/components/file-upload/index.vue' | |
| 34 | 51 | |
| 35 | 52 | export default { |
| 36 | 53 | name: 'InvoiceDetail', |
| 37 | - components: { Product, DetailButtons }, | |
| 54 | + components: { Product, DetailButtons, FileUpload }, | |
| 38 | 55 | data() { |
| 39 | 56 | return { |
| 40 | 57 | form: {}, |
| ... | ... | @@ -42,7 +59,8 @@ export default { |
| 42 | 59 | { text: '编辑', visible: true, variant: 'outline', event: 'edit' }, |
| 43 | 60 | { text: '填写实发数', visible: true, variant: 'outline', event: 'fill' }, |
| 44 | 61 | { text: '上传签收单据', visible: true, variant: 'primary', event: 'upload' }, |
| 45 | - ] | |
| 62 | + ], | |
| 63 | + uploadFile: { id: '', name: '' }, | |
| 46 | 64 | } |
| 47 | 65 | }, |
| 48 | 66 | computed: { |
| ... | ... | @@ -88,17 +106,42 @@ export default { |
| 88 | 106 | if (typeof fn === 'function') fn() |
| 89 | 107 | }, |
| 90 | 108 | onEdit() { |
| 91 | - const id = this.form.id || this.form.code | |
| 92 | - if (id) uni.navigateTo({ url: `/pages/invoice/modify?id=${id}` }) | |
| 109 | + // const id = this.form.id || this.form.code | |
| 110 | + // if (id) uni.navigateTo({ url: `/pages/invoice/modify?id=${id}` }) | |
| 93 | 111 | }, |
| 94 | 112 | onFill() { |
| 95 | 113 | const id = this.form.id || this.form.code |
| 96 | 114 | if (id) uni.navigateTo({ url: `/pages/invoice/fill?id=${id}` }) |
| 97 | 115 | }, |
| 98 | 116 | onUpload() { |
| 99 | - const id = this.form.id || this.form.code | |
| 100 | - if (id) uni.navigateTo({ url: `/pages/invoice/upload?id=${id}` }) | |
| 117 | + this.$refs.uploadPopup && this.$refs.uploadPopup.open() | |
| 101 | 118 | }, |
| 119 | + closeUploadInfo() { | |
| 120 | + this.uploadFile = { id: '', name: '' }; | |
| 121 | + this.$refs.uploadPopup && this.$refs.uploadPopup.close() | |
| 122 | + }, | |
| 123 | + async onUploadSave() { | |
| 124 | + console.log('onUploadSave__this.uploadFile', this.uploadFile) | |
| 125 | + if (!this.uploadFile.id) { | |
| 126 | + uni.showToast({ | |
| 127 | + title: '请上传签收单据', | |
| 128 | + icon: 'none' | |
| 129 | + }) | |
| 130 | + return | |
| 131 | + } | |
| 132 | + const params = { | |
| 133 | + fileId: this.uploadFile.id, | |
| 134 | + fileName: this.uploadFile.name, | |
| 135 | + shipmentsOrderId: this.form.id | |
| 136 | + } | |
| 137 | + try { | |
| 138 | + await saveSignInTicket(params) | |
| 139 | + uni.showToast({ title: '保存成功', icon: 'success' }) | |
| 140 | + setTimeout(() => { uni.redirectTo({ url: '/pages/invoice/index' }) }, 300) | |
| 141 | + } catch (e) { | |
| 142 | + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) | |
| 143 | + } | |
| 144 | + } | |
| 102 | 145 | } |
| 103 | 146 | } |
| 104 | 147 | </script> |
| ... | ... | @@ -212,4 +255,77 @@ export default { |
| 212 | 255 | font-weight: 600; |
| 213 | 256 | } |
| 214 | 257 | } |
| 258 | + | |
| 259 | + | |
| 260 | +.dialog { | |
| 261 | + width: 100%; | |
| 262 | + max-height: 70vh; | |
| 263 | + overflow-y: auto; | |
| 264 | + padding: 32rpx 28rpx calc(20rpx + env(safe-area-inset-bottom)); | |
| 265 | + background: #fff; | |
| 266 | + border-radius: 20rpx 20rpx 0 0; | |
| 267 | + | |
| 268 | + &_header { | |
| 269 | + position: relative; | |
| 270 | + text-align: center; | |
| 271 | + font-size: 34rpx; | |
| 272 | + font-weight: 600; | |
| 273 | + margin-bottom: 12rpx; | |
| 274 | + color: rgba(0, 0, 0, 0.9); | |
| 275 | + } | |
| 276 | + | |
| 277 | + &_body { | |
| 278 | + padding: 12rpx 4rpx 24rpx; | |
| 279 | + } | |
| 280 | + | |
| 281 | + &_footer { | |
| 282 | + padding-top: 12rpx; | |
| 283 | + display: flex; | |
| 284 | + justify-content: center; | |
| 285 | + | |
| 286 | + .btn { | |
| 287 | + width: 100%; | |
| 288 | + height: 80rpx; | |
| 289 | + line-height: 80rpx; | |
| 290 | + border-radius: 12rpx; | |
| 291 | + font-size: 32rpx; | |
| 292 | + background: $theme-primary; | |
| 293 | + color: #fff; | |
| 294 | + | |
| 295 | + &::after { | |
| 296 | + border: none; | |
| 297 | + } | |
| 298 | + } | |
| 299 | + } | |
| 300 | +} | |
| 301 | + | |
| 302 | +.dialog_close { | |
| 303 | + position: absolute; | |
| 304 | + right: 16rpx; | |
| 305 | + top: -14rpx; | |
| 306 | + width: 64rpx; | |
| 307 | + height: 64rpx; | |
| 308 | + line-height: 64rpx; | |
| 309 | + text-align: center; | |
| 310 | + font-size: 36rpx; | |
| 311 | + color: rgba(0, 0, 0, 0.6); | |
| 312 | +} | |
| 313 | + | |
| 314 | +.dialog_row { | |
| 315 | + margin-bottom: 24rpx; | |
| 316 | +} | |
| 317 | + | |
| 318 | +.dialog_label { | |
| 319 | + display: block; | |
| 320 | + margin-bottom: 12rpx; | |
| 321 | + font-size: 28rpx; | |
| 322 | + color: rgba(0, 0, 0, 0.9); | |
| 323 | +} | |
| 324 | + | |
| 325 | +.upload-show { | |
| 326 | + margin-top: 8rpx; | |
| 327 | + font-size: 26rpx; | |
| 328 | + color: rgba(0, 0, 0, 0.6); | |
| 329 | +} | |
| 330 | + | |
| 215 | 331 | </style> | ... | ... |