Showing
2 changed files
with
944 additions
and
0 deletions
pages/order_list/approve.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <uni-list> | ||
| 5 | + <view class="section"> | ||
| 6 | + <uni-list-item title="订单编号"> | ||
| 7 | + <template v-slot:footer> | ||
| 8 | + <view class="readonly-text">{{ form.orderNo }}</view> | ||
| 9 | + </template> | ||
| 10 | + </uni-list-item> | ||
| 11 | + <uni-list-item title="供货单位"> | ||
| 12 | + <template v-slot:footer> | ||
| 13 | + <view class="readonly-text">{{ getDicName('SUPPLIER', form.supplyUnit, dicOptions.SUPPLIER) }}</view> | ||
| 14 | + </template> | ||
| 15 | + </uni-list-item> | ||
| 16 | + <uni-list-item title="订货单位"> | ||
| 17 | + <template v-slot:footer> | ||
| 18 | + <view class="readonly-text">{{ form.orderingUnitName }}</view> | ||
| 19 | + </template> | ||
| 20 | + </uni-list-item> | ||
| 21 | + <uni-list-item title="订货日期"> | ||
| 22 | + <template v-slot:footer> | ||
| 23 | + <view class="readonly-text">{{ form.orderDate }}</view> | ||
| 24 | + </template> | ||
| 25 | + </uni-list-item> | ||
| 26 | + <uni-list-item title="生产厂"> | ||
| 27 | + <template v-slot:footer> | ||
| 28 | + <view class="readonly-text">{{ form.workshopName }}</view> | ||
| 29 | + </template> | ||
| 30 | + </uni-list-item> | ||
| 31 | + <uni-list-item title="结算方式或期限"> | ||
| 32 | + <template v-slot:footer> | ||
| 33 | + <view class="readonly-text">{{ form.settlementTerms }}</view> | ||
| 34 | + </template> | ||
| 35 | + </uni-list-item> | ||
| 36 | + | ||
| 37 | + <uni-list-item title="交货方式"> | ||
| 38 | + <template v-slot:footer> | ||
| 39 | + <uni-easyinput v-model="form.deliveryMethod" placeholder="请输入交货方式" :inputBorder="false" /> | ||
| 40 | + </template> | ||
| 41 | + </uni-list-item> | ||
| 42 | + </view> | ||
| 43 | + | ||
| 44 | + <!-- 产品 --> | ||
| 45 | + <view class="section2"> | ||
| 46 | + <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" /> | ||
| 47 | + </view> | ||
| 48 | + | ||
| 49 | + <view class="section"> | ||
| 50 | + <uni-list-item title="价格表编号"> | ||
| 51 | + <template v-slot:footer> | ||
| 52 | + <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" /> | ||
| 53 | + </template> | ||
| 54 | + </uni-list-item> | ||
| 55 | + <uni-list-item title="开票情况"> | ||
| 56 | + <template v-slot:footer> | ||
| 57 | + <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票情况" :inputBorder="false" /> | ||
| 58 | + </template> | ||
| 59 | + </uni-list-item> | ||
| 60 | + <uni-list-item class="amount-item"> | ||
| 61 | + <template v-slot:body> | ||
| 62 | + <view class="item-title"><text>运费</text></view> | ||
| 63 | + </template> | ||
| 64 | + <template v-slot:footer> | ||
| 65 | + <view class="amount-row"> | ||
| 66 | + <uni-easyinput type="number" v-model="form.shippingCost" placeholder="0.00" :inputBorder="false" /> | ||
| 67 | + <text class="unit">元</text> | ||
| 68 | + </view> | ||
| 69 | + </template> | ||
| 70 | + </uni-list-item> | ||
| 71 | + <uni-list-item class="amount-item"> | ||
| 72 | + <template v-slot:body> | ||
| 73 | + <view class="item-title"><text>包装费</text></view> | ||
| 74 | + </template> | ||
| 75 | + <template v-slot:footer> | ||
| 76 | + <view class="amount-row"> | ||
| 77 | + <uni-easyinput type="number" v-model="form.packagingFee" placeholder="0.00" :inputBorder="false" /> | ||
| 78 | + <text class="unit">元</text> | ||
| 79 | + </view> | ||
| 80 | + </template> | ||
| 81 | + </uni-list-item> | ||
| 82 | + <uni-list-item class="select-item" :class="form.executionStandardName ? 'is-filled' : 'is-empty'" clickable | ||
| 83 | + @click="openSheet('executionStandard')" :rightText="form.executionStandardName || '请选择'" showArrow> | ||
| 84 | + <template v-slot:body> | ||
| 85 | + <view class="item-title"><text>执行标准</text></view> | ||
| 86 | + </template> | ||
| 87 | + </uni-list-item> | ||
| 88 | + </view> | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + <view class="title-header"> | ||
| 92 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 93 | + <span>具体质量要求</span> | ||
| 94 | + </view> | ||
| 95 | + | ||
| 96 | + <uni-list-item title="件重条头"> | ||
| 97 | + <template v-slot:footer> | ||
| 98 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHeader" placeholder="请输入件重条头" | ||
| 99 | + :inputBorder="false" /> | ||
| 100 | + </template> | ||
| 101 | + </uni-list-item> | ||
| 102 | + <uni-list-item title="表面"> | ||
| 103 | + <template v-slot:footer> | ||
| 104 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入表面" :inputBorder="false" /> | ||
| 105 | + </template> | ||
| 106 | + </uni-list-item> | ||
| 107 | + <uni-list-item title="公差"> | ||
| 108 | + <template v-slot:footer> | ||
| 109 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入公差" :inputBorder="false" /> | ||
| 110 | + </template> | ||
| 111 | + </uni-list-item> | ||
| 112 | + <uni-list-item title="性能"> | ||
| 113 | + <template v-slot:footer> | ||
| 114 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入性能" :inputBorder="false" /> | ||
| 115 | + </template> | ||
| 116 | + </uni-list-item> | ||
| 117 | + <uni-list-item title="成分"> | ||
| 118 | + <template v-slot:footer> | ||
| 119 | + <uni-easyinput type="textarea" v-model="form.element" placeholder="请输入成分" :inputBorder="false" /> | ||
| 120 | + </template> | ||
| 121 | + </uni-list-item> | ||
| 122 | + <uni-list-item title="包装"> | ||
| 123 | + <template v-slot:footer> | ||
| 124 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入包装" :inputBorder="false" /> | ||
| 125 | + </template> | ||
| 126 | + </uni-list-item> | ||
| 127 | + <uni-list-item title="备注"> | ||
| 128 | + <template v-slot:footer> | ||
| 129 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | ||
| 130 | + </template> | ||
| 131 | + </uni-list-item> | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + </uni-list> | ||
| 135 | + </scroll-view> | ||
| 136 | + | ||
| 137 | + <view class="footer"> | ||
| 138 | + <view class="view-total"> | ||
| 139 | + <view class="head">合计</view> | ||
| 140 | + <view class="row"> | ||
| 141 | + <text class="label">总数量</text><text class="value">{{ form.totalQuantity }}</text> | ||
| 142 | + </view> | ||
| 143 | + </view> | ||
| 144 | + <button class="btn submit" type="primary" @click="onSubmit">提交</button> | ||
| 145 | + </view> | ||
| 146 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" | ||
| 147 | + @confirm="onSheetConfirm" /> | ||
| 148 | + </view> | ||
| 149 | +</template> | ||
| 150 | + | ||
| 151 | +<script> | ||
| 152 | +import { getDetailApi, updateApi } from '@/api/order_list.js' | ||
| 153 | +import Product from './product.vue' | ||
| 154 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 155 | +import { getDicName } from '@/utils/dic.js' | ||
| 156 | +import { getDicByCodes } from '@/utils/dic' | ||
| 157 | + | ||
| 158 | +export default { | ||
| 159 | + name: 'OrderListModify', | ||
| 160 | + components: { Product, SingleSelectSheet }, | ||
| 161 | + data() { | ||
| 162 | + return { | ||
| 163 | + id: '', | ||
| 164 | + form: { | ||
| 165 | + code: '', | ||
| 166 | + supplier: '', | ||
| 167 | + buyer: '', | ||
| 168 | + // 默认当前日期 格式为 yyyy-MM-dd | ||
| 169 | + orderDate: new Date().toISOString().substring(0, 10), | ||
| 170 | + unit: '', | ||
| 171 | + totalQuantity: '', | ||
| 172 | + totalAmountExcludingTax: '', | ||
| 173 | + totalAmountIncludingTax: '', | ||
| 174 | + totalAmountCapital: '', | ||
| 175 | + depositInfo: '', | ||
| 176 | + packagingRequirements: '', | ||
| 177 | + paymentTerms: '', | ||
| 178 | + transportMode: '', | ||
| 179 | + destinationId: [], | ||
| 180 | + includesPackagingFee: '', | ||
| 181 | + includesTransportFee: '', | ||
| 182 | + designatedConsignee: '', | ||
| 183 | + specialTerms: '', | ||
| 184 | + executionStandard: '', | ||
| 185 | + executionStandardRemarks: '', | ||
| 186 | + specialInstructions: '', | ||
| 187 | + remarks: '', | ||
| 188 | + pieceWeightHead: '', | ||
| 189 | + surface: '', | ||
| 190 | + tolerance: '', | ||
| 191 | + performance: '', | ||
| 192 | + component: '', | ||
| 193 | + packaging: '', | ||
| 194 | + }, | ||
| 195 | + initPurchaseOrderLineList: [], | ||
| 196 | + dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [], AUDIT_STATUS: [] }, | ||
| 197 | + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' } | ||
| 198 | + } | ||
| 199 | + }, | ||
| 200 | + onLoad(query) { | ||
| 201 | + this.id = (query && (query.id || query.code)) || '' | ||
| 202 | + if (this.id) this.loadDetail(this.id) | ||
| 203 | + this.loadDicOptions() | ||
| 204 | + }, | ||
| 205 | + methods: { | ||
| 206 | + loadDicOptions() { | ||
| 207 | + const dicCodes = ['SUPPLIER', 'APPLICABLE_STANDARD', 'AUDIT_STATUS'] | ||
| 208 | + return getDicByCodes(dicCodes).then(results => { | ||
| 209 | + this.dicOptions.SUPPLIER = results.SUPPLIER && results.SUPPLIER.data ? results.SUPPLIER.data : [] | ||
| 210 | + this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] | ||
| 211 | + this.dicOptions.AUDIT_STATUS = results.AUDIT_STATUS && results.AUDIT_STATUS.data ? results.AUDIT_STATUS.data : [] | ||
| 212 | + this.refreshStandardName() | ||
| 213 | + }).catch(() => { this.dicOptions = { SUPPLIER: [], APPLICABLE_STANDARD: [], AUDIT_STATUS: [] } }) | ||
| 214 | + }, | ||
| 215 | + async loadDetail(id) { | ||
| 216 | + try { | ||
| 217 | + const res = await getDetailApi(id) | ||
| 218 | + const m = res.data || {} | ||
| 219 | + const next = { ...this.form, ...m } | ||
| 220 | + next.id = m.id || m.code || id | ||
| 221 | + next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] | ||
| 222 | + this.form = next; | ||
| 223 | + this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; | ||
| 224 | + this.refreshStandardName() | ||
| 225 | + } catch (e) { | ||
| 226 | + uni.showToast({ title: '加载失败', icon: 'none' }) | ||
| 227 | + } | ||
| 228 | + }, | ||
| 229 | + refreshStandardName() { | ||
| 230 | + const est = (this.dicOptions.APPLICABLE_STANDARD || []).find(o => String(o.code) === String(this.form.executionStandard)) | ||
| 231 | + this.form.executionStandardName = est ? (est.name || '') : (this.form.executionStandardName || '') | ||
| 232 | + }, | ||
| 233 | + openSheet(field) { | ||
| 234 | + if (field === 'executionStandard') { | ||
| 235 | + const options = (this.dicOptions.APPLICABLE_STANDARD || []).map(it => ({ label: it.name || '', value: it.code || '' })) | ||
| 236 | + const current = this.form.executionStandard | ||
| 237 | + const match = options.find(o => String(o.value) === String(current)) | ||
| 238 | + this.sheet = { ...this.sheet, visible: true, title: '执行标准', options, field, value: match ? match.value : '' } | ||
| 239 | + } | ||
| 240 | + }, | ||
| 241 | + onSheetConfirm({ value, label }) { | ||
| 242 | + const field = this.sheet.field | ||
| 243 | + if (field === 'executionStandard') { | ||
| 244 | + this.form.executionStandard = value || '' | ||
| 245 | + this.form.executionStandardName = label || '' | ||
| 246 | + } | ||
| 247 | + this.sheet.visible = false | ||
| 248 | + }, | ||
| 249 | + getDicName: getDicName, | ||
| 250 | + async onSubmit() { | ||
| 251 | + const payload = { ...this.form } | ||
| 252 | + console.log('onSubmit__payload', payload) | ||
| 253 | + try { | ||
| 254 | + await updateApi(payload) | ||
| 255 | + uni.showToast({ title: '保存成功', icon: 'success' }) | ||
| 256 | + setTimeout(() => { uni.redirectTo({ url: '/pages/order_list/index' }) }, 300) | ||
| 257 | + } catch (e) { | ||
| 258 | + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) | ||
| 259 | + } | ||
| 260 | + }, | ||
| 261 | + purchaseOrderLineListChange(data) { | ||
| 262 | + const list = Array.isArray(data) ? data : [] | ||
| 263 | + this.form.purchaseOrderLineList = list; | ||
| 264 | + }, | ||
| 265 | + } | ||
| 266 | +} | ||
| 267 | +</script> | ||
| 268 | + | ||
| 269 | +<style lang="scss" scoped> | ||
| 270 | +.page { | ||
| 271 | + display: flex; | ||
| 272 | + flex-direction: column; | ||
| 273 | + height: 100%; | ||
| 274 | +} | ||
| 275 | + | ||
| 276 | +.scroll { | ||
| 277 | + flex: 1; | ||
| 278 | + padding: 6rpx 0 310rpx; | ||
| 279 | +} | ||
| 280 | + | ||
| 281 | + | ||
| 282 | + | ||
| 283 | +.title-header { | ||
| 284 | + background-color: #fff; | ||
| 285 | + display: flex; | ||
| 286 | + align-items: center; | ||
| 287 | + padding: 32rpx 32rpx 22rpx; | ||
| 288 | + | ||
| 289 | + .title-header_icon { | ||
| 290 | + width: 32rpx; | ||
| 291 | + height: 28rpx; | ||
| 292 | + margin-right: 16rpx; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + span { | ||
| 296 | + color: rgba(0, 0, 0, 0.9); | ||
| 297 | + font-size: 32rpx; | ||
| 298 | + line-height: 44rpx; | ||
| 299 | + font-weight: 600; | ||
| 300 | + } | ||
| 301 | +} | ||
| 302 | + | ||
| 303 | + | ||
| 304 | +.section { | ||
| 305 | + background: #fff; | ||
| 306 | + margin-bottom: 20rpx; | ||
| 307 | +} | ||
| 308 | + | ||
| 309 | +.section2 { | ||
| 310 | + background: #f1f1f1; | ||
| 311 | +} | ||
| 312 | + | ||
| 313 | +::v-deep .uni-list { | ||
| 314 | + background: transparent; | ||
| 315 | + | ||
| 316 | + &-item { | ||
| 317 | + &__extra-text { | ||
| 318 | + font-size: 32rpx; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + &__content-title { | ||
| 322 | + font-size: 32rpx; | ||
| 323 | + color: rgba(0, 0, 0, 0.9); | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + &__container { | ||
| 327 | + padding: 32rpx; | ||
| 328 | + align-items: center; | ||
| 329 | + | ||
| 330 | + .uni-easyinput { | ||
| 331 | + | ||
| 332 | + .is-disabled { | ||
| 333 | + background-color: transparent !important; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + &__placeholder-class { | ||
| 337 | + font-size: 32rpx; | ||
| 338 | + color: rgba(0, 0, 0, 0.4); | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + &__content { | ||
| 342 | + border: none; | ||
| 343 | + | ||
| 344 | + &-input { | ||
| 345 | + padding-left: 0 !important; | ||
| 346 | + height: 48rpx; | ||
| 347 | + line-height: 48rpx; | ||
| 348 | + font-size: 32rpx; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + .content-clear-icon { | ||
| 352 | + font-size: 44rpx !important; | ||
| 353 | + } | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + .amount-row { | ||
| 358 | + flex: 1; | ||
| 359 | + display: flex; | ||
| 360 | + align-items: center; | ||
| 361 | + | ||
| 362 | + .uni-easyinput { | ||
| 363 | + flex: 1; | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + .unit { | ||
| 367 | + margin-left: 16rpx; | ||
| 368 | + color: rgba(0, 0, 0, 0.9); | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + .item-title, | ||
| 373 | + .uni-list-item__content { | ||
| 374 | + flex: none; | ||
| 375 | + min-height: 48rpx; | ||
| 376 | + line-height: 48rpx; | ||
| 377 | + font-size: 32rpx; | ||
| 378 | + position: relative; | ||
| 379 | + width: 162rpx; | ||
| 380 | + margin-right: 32rpx; | ||
| 381 | + color: rgba(0, 0, 0, 0.9); | ||
| 382 | + padding-right: 0; | ||
| 383 | + | ||
| 384 | + | ||
| 385 | + .required { | ||
| 386 | + color: red; | ||
| 387 | + position: absolute; | ||
| 388 | + top: 50%; | ||
| 389 | + transform: translateY(-50%); | ||
| 390 | + left: -16rpx; | ||
| 391 | + } | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + &.select-item { | ||
| 397 | + &.is-empty { | ||
| 398 | + .uni-list-item__extra-text { | ||
| 399 | + color: rgba(0, 0, 0, 0.4) !important; | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + &.is-filled { | ||
| 404 | + .uni-list-item__extra-text { | ||
| 405 | + color: rgba(0, 0, 0, 0.9) !important; | ||
| 406 | + } | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + .serial-number-row { | ||
| 410 | + display: flex; | ||
| 411 | + align-items: center; | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + &.mgb10 { | ||
| 417 | + margin-bottom: 20rpx; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | + .title-header { | ||
| 423 | + background-color: #fff; | ||
| 424 | + display: flex; | ||
| 425 | + align-items: center; | ||
| 426 | + padding: 32rpx 32rpx 22rpx; | ||
| 427 | + | ||
| 428 | + &_icon { | ||
| 429 | + width: 32rpx; | ||
| 430 | + height: 28rpx; | ||
| 431 | + margin-right: 16rpx; | ||
| 432 | + } | ||
| 433 | + | ||
| 434 | + span { | ||
| 435 | + color: rgba(0, 0, 0, 0.9); | ||
| 436 | + font-size: 32rpx; | ||
| 437 | + line-height: 44rpx; | ||
| 438 | + font-weight: 600; | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | +} | ||
| 442 | + | ||
| 443 | +/* 只读 easyinput 根据内容自适应高度 */ | ||
| 444 | +::v-deep .uni-list-item__container { | ||
| 445 | + align-items: flex-start; | ||
| 446 | +} | ||
| 447 | + | ||
| 448 | +/* 只读文本样式 */ | ||
| 449 | +.readonly-text { | ||
| 450 | + color: rgba(0, 0, 0, 0.9); | ||
| 451 | + font-size: 32rpx; | ||
| 452 | + line-height: 44rpx; | ||
| 453 | + text-align: right; | ||
| 454 | + white-space: pre-wrap; | ||
| 455 | + word-break: break-all; | ||
| 456 | +} | ||
| 457 | + | ||
| 458 | + | ||
| 459 | +.footer { | ||
| 460 | + position: fixed; | ||
| 461 | + left: 0; | ||
| 462 | + right: 0; | ||
| 463 | + bottom: 0; | ||
| 464 | + padding: 0 32rpx 32rpx; | ||
| 465 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 466 | + background: #fff; | ||
| 467 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 468 | + | ||
| 469 | + .btn { | ||
| 470 | + height: 80rpx; | ||
| 471 | + line-height: 80rpx; | ||
| 472 | + border-radius: 12rpx; | ||
| 473 | + font-size: 32rpx; | ||
| 474 | + } | ||
| 475 | + | ||
| 476 | + .submit { | ||
| 477 | + background: $theme-primary; | ||
| 478 | + color: #fff; | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + .view-total { | ||
| 482 | + padding: 20rpx 0; | ||
| 483 | + | ||
| 484 | + .head { | ||
| 485 | + font-size: 32rpx; | ||
| 486 | + font-weight: 600; | ||
| 487 | + line-height: 50rpx; | ||
| 488 | + color: rgba(0, 0, 0, 0.9); | ||
| 489 | + padding-bottom: 16rpx; | ||
| 490 | + margin-bottom: 24rpx; | ||
| 491 | + ; | ||
| 492 | + border-bottom: 1px dashed #E7E7E7; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + .row { | ||
| 496 | + display: flex; | ||
| 497 | + margin-bottom: 24rpx; | ||
| 498 | + line-height: 32rpx; | ||
| 499 | + | ||
| 500 | + .label { | ||
| 501 | + width: 180rpx; | ||
| 502 | + margin-right: 14rpx; | ||
| 503 | + color: rgba(0, 0, 0, 0.6); | ||
| 504 | + font-size: 28rpx; | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + .value { | ||
| 508 | + flex: 1; | ||
| 509 | + color: rgba(0, 0, 0, 0.9); | ||
| 510 | + font-size: 28rpx; | ||
| 511 | + white-space: pre-wrap; | ||
| 512 | + word-break: break-all; | ||
| 513 | + } | ||
| 514 | + } | ||
| 515 | + } | ||
| 516 | +} | ||
| 517 | +</style> |
pages/order_list/viewer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <view class="detail-page"> | ||
| 5 | + <view class="section"> | ||
| 6 | + <text class="row company">{{ form.orderNo }}</text> | ||
| 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', | ||
| 11 | + form.supplyUnit, dicOptions.SUPPLIER) }}</text></view> | ||
| 12 | + <view class="row"><text class="label">订货单位</text><text class="value">{{ form.orderingUnitName }}</text> | ||
| 13 | + </view> | ||
| 14 | + <view class="row"><text class="label">订货日期</text><text class="value">{{ form.orderDate }}</text></view> | ||
| 15 | + <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view> | ||
| 16 | + <view class="row"><text class="label">结算方式或期限</text><text class="value">{{ form.settlementTerms }}</text></view> | ||
| 17 | + <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryMethod }}</text></view> | ||
| 18 | + </view> | ||
| 19 | + | ||
| 20 | + <!-- 产品 --> | ||
| 21 | + <view class="mgb10"> | ||
| 22 | + <Product mode="view" :options="genderOptions" :list="form.purchaseOrderLineList" :totalQuantity="form.totalQuantity" /> | ||
| 23 | + </view> | ||
| 24 | + | ||
| 25 | + <view class="section"> | ||
| 26 | + <view class="row"><text class="label">价格表编号</text><text class="value">{{ form.priceListNo }}</text></view> | ||
| 27 | + <view class="row"><text class="label">开票情况</text><text class="value">{{ form.invoicingStatus }}</text></view> | ||
| 28 | + <view class="row"><text class="label">运费</text><text class="value">{{ form.shippingCost }}</text></view> | ||
| 29 | + <view class="row"><text class="label">包装费</text><text class="value">{{ form.packagingFee }}</text></view> | ||
| 30 | + <view class="row"><text class="label">执行标准</text><text class="value">{{ getDicName('APPLICABLE_STANDARD', | ||
| 31 | + form.executionStandard, dicOptions.APPLICABLE_STANDARD) }}</text></view> | ||
| 32 | + </view> | ||
| 33 | + | ||
| 34 | + <view class="title-header"> | ||
| 35 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 36 | + <span>具体质量要求</span> | ||
| 37 | + </view> | ||
| 38 | + <view class="section"> | ||
| 39 | + <view class="row"><text class="label">件重条头</text><text class="value">{{ form.pieceWeightHeader }}</text></view> | ||
| 40 | + <view class="row"><text class="label">表面</text><text class="value">{{ form.surface }}</text></view> | ||
| 41 | + <view class="row"><text class="label">公差</text><text class="value">{{ form.tolerance }}</text></view> | ||
| 42 | + <view class="row"><text class="label">性能</text><text class="value">{{ form.performance }}</text></view> | ||
| 43 | + <view class="row"><text class="label">成分</text><text class="value">{{ form.element }}</text></view> | ||
| 44 | + <view class="row"><text class="label">包装</text><text class="value">{{ form.packaging }}</text></view> | ||
| 45 | + <view class="row"><text class="label">备注</text><text class="value">{{ form.remarks }}</text></view> | ||
| 46 | + </view> | ||
| 47 | + | ||
| 48 | + </view> | ||
| 49 | + </scroll-view> | ||
| 50 | + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> | ||
| 51 | + </view> | ||
| 52 | +</template> | ||
| 53 | + | ||
| 54 | +<script> | ||
| 55 | +import { getDetailApi, cancelApi } from '@/api/order_list.js' | ||
| 56 | +import Product from './product.vue' | ||
| 57 | +import DetailButtons from '@/components/detail-buttons/index.vue' | ||
| 58 | +import { | ||
| 59 | + getDicName | ||
| 60 | +} from '@/utils/dic.js' | ||
| 61 | +import { | ||
| 62 | + getDicByCodes | ||
| 63 | +} from '@/utils/dic' | ||
| 64 | + | ||
| 65 | +export default { | ||
| 66 | + name: 'OrderListDetail', | ||
| 67 | + components: { Product, DetailButtons }, | ||
| 68 | + data() { | ||
| 69 | + return { | ||
| 70 | + form: {}, | ||
| 71 | + enterpriseTypeOptions: [], | ||
| 72 | + genderOptions: [], | ||
| 73 | + categoryOptions: [], | ||
| 74 | + historyList: [], | ||
| 75 | + 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: { | ||
| 84 | + AUDIT_STATUS: [], | ||
| 85 | + SUPPLIER: [], | ||
| 86 | + APPLICABLE_STANDARD: [], | ||
| 87 | + }, | ||
| 88 | + } | ||
| 89 | + }, | ||
| 90 | + 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 | + }, | ||
| 113 | + created() { | ||
| 114 | + this.loadAllDicData() | ||
| 115 | + }, | ||
| 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) | ||
| 121 | + }, | ||
| 122 | + methods: { | ||
| 123 | + async loadDetail(id) { | ||
| 124 | + try { | ||
| 125 | + const res = await getDetailApi(id) | ||
| 126 | + const data = res.data || {} | ||
| 127 | + this.form = { ...data } | ||
| 128 | + } catch (e) { | ||
| 129 | + this.form = {} | ||
| 130 | + } | ||
| 131 | + }, | ||
| 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 | + }, | ||
| 187 | + getCategoryClass(categoryName) { | ||
| 188 | + if (!categoryName) return '' | ||
| 189 | + if (categoryName.includes('A') || categoryName.includes('a')) { | ||
| 190 | + return 'category_A' | ||
| 191 | + } else if (categoryName.includes('B') || categoryName.includes('b')) { | ||
| 192 | + return 'category_B' | ||
| 193 | + } else if (categoryName.includes('C') || categoryName.includes('c')) { | ||
| 194 | + return 'category_C' | ||
| 195 | + } else if (categoryName.includes('D') || categoryName.includes('d')) { | ||
| 196 | + return 'category_D' | ||
| 197 | + } | ||
| 198 | + }, | ||
| 199 | + loadAllDicData() { | ||
| 200 | + const dicCodes = ['AUDIT_STATUS', 'SUPPLIER', 'APPLICABLE_STANDARD'] | ||
| 201 | + return getDicByCodes(dicCodes).then(results => { | ||
| 202 | + this.dicOptions.AUDIT_STATUS = results.AUDIT_STATUS.data || [] | ||
| 203 | + this.dicOptions.SUPPLIER = results.SUPPLIER.data || [] | ||
| 204 | + this.dicOptions.APPLICABLE_STANDARD = results.APPLICABLE_STANDARD.data || [] | ||
| 205 | + }).catch(() => { | ||
| 206 | + this.dicOptions = { | ||
| 207 | + AUDIT_STATUS: [], | ||
| 208 | + SUPPLIER: [], | ||
| 209 | + APPLICABLE_STANDARD: [], | ||
| 210 | + } | ||
| 211 | + }) | ||
| 212 | + }, | ||
| 213 | + getDicName: getDicName, | ||
| 214 | + } | ||
| 215 | +} | ||
| 216 | +</script> | ||
| 217 | + | ||
| 218 | +<style lang="scss" scoped> | ||
| 219 | +.page { | ||
| 220 | + display: flex; | ||
| 221 | + flex-direction: column; | ||
| 222 | + height: 100%; | ||
| 223 | +} | ||
| 224 | + | ||
| 225 | +.scroll { | ||
| 226 | + flex: 1; | ||
| 227 | + padding: 8rpx 0 144rpx 0; | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | +.detail-page { | ||
| 231 | + background: #f3f3f3; | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +.section { | ||
| 235 | + padding: 32rpx; | ||
| 236 | + background: #fff; | ||
| 237 | + margin-bottom: 20rpx; | ||
| 238 | + position: relative; | ||
| 239 | + | ||
| 240 | + .status { | ||
| 241 | + position: absolute; | ||
| 242 | + top: 16rpx; | ||
| 243 | + right: 52rpx; | ||
| 244 | + width: 180rpx; | ||
| 245 | + height: 146rpx; | ||
| 246 | + background-repeat: no-repeat; | ||
| 247 | + background-size: 100% 100%; | ||
| 248 | + background-position: center; | ||
| 249 | + | ||
| 250 | + // 已下发 | ||
| 251 | + &_ISSUED { | ||
| 252 | + background-image: url('~@/static/images/order_list/status_ISSUED.png'); | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + // 待发货 | ||
| 256 | + &_WAIT { | ||
| 257 | + background-image: url('~@/static/images/order_list/status_WAIT.png'); | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + // 部分发货 | ||
| 261 | + &_TRANSIT { | ||
| 262 | + background-image: url('~@/static/images/order_list/status_TRANSIT.png'); | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + // 发货完成 | ||
| 266 | + &_SHIPPED { | ||
| 267 | + background-image: url('~@/static/images/order_list/status_SHIPPED.png'); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + // 已签收 | ||
| 271 | + &_DELIVERED { | ||
| 272 | + background-image: url('~@/static/images/order_list/status_DELIVERED.png'); | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + } | ||
| 276 | +} | ||
| 277 | + | ||
| 278 | +.mgb10 { | ||
| 279 | + margin-bottom: 20rpx; | ||
| 280 | +} | ||
| 281 | + | ||
| 282 | +.row { | ||
| 283 | + display: flex; | ||
| 284 | + margin-bottom: 28rpx; | ||
| 285 | + | ||
| 286 | + &:last-child { | ||
| 287 | + margin-bottom: 0; | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + &.company { | ||
| 291 | + font-size: 36rpx; | ||
| 292 | + font-weight: 600; | ||
| 293 | + color: rgba(0, 0, 0, 0.9); | ||
| 294 | + padding-top: 32rpx; | ||
| 295 | + line-height: 50rpx; | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + .label { | ||
| 299 | + max-width: 420rpx; | ||
| 300 | + line-height: 32rpx; | ||
| 301 | + font-size: 28rpx; | ||
| 302 | + color: rgba(0, 0, 0, 0.6); | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + .value { | ||
| 306 | + flex: 1; | ||
| 307 | + line-height: 32rpx; | ||
| 308 | + font-size: 28rpx; | ||
| 309 | + color: rgba(0, 0, 0, 0.9); | ||
| 310 | + text-align: right; | ||
| 311 | + | ||
| 312 | + &.act { | ||
| 313 | + color: $theme-primary; | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + .category { | ||
| 317 | + display: inline-block; | ||
| 318 | + padding: 4rpx 12rpx; | ||
| 319 | + border-radius: 6rpx; | ||
| 320 | + font-size: 24rpx; | ||
| 321 | + width: auto; | ||
| 322 | + | ||
| 323 | + &.category_A { | ||
| 324 | + background: #FFF0ED; | ||
| 325 | + color: #D54941; | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + &.category_B { | ||
| 329 | + background: #FFF1E9; | ||
| 330 | + color: #E37318; | ||
| 331 | + } | ||
| 332 | + | ||
| 333 | + &.category_C { | ||
| 334 | + background: #F2F3FF; | ||
| 335 | + color: $theme-primary; | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + &.category_D { | ||
| 339 | + background: #E3F9E9; | ||
| 340 | + color: #2BA471; | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | +} | ||
| 345 | + | ||
| 346 | +.card { | ||
| 347 | + padding: 16rpx 0 8rpx; | ||
| 348 | + border-top: 1rpx solid #f0f0f0; | ||
| 349 | +} | ||
| 350 | + | ||
| 351 | +.history-header { | ||
| 352 | + display: flex; | ||
| 353 | + background: #F7F7F7; | ||
| 354 | + padding: 20rpx 52rpx 20rpx 32rpx; | ||
| 355 | + | ||
| 356 | + .col { | ||
| 357 | + font-size: 28rpx; | ||
| 358 | + color: rgba(0, 0, 0, 0.9); | ||
| 359 | + line-height: 40rpx; | ||
| 360 | + } | ||
| 361 | + | ||
| 362 | + .col1 { | ||
| 363 | + width: 20%; | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + .col2 { | ||
| 367 | + width: 50%; | ||
| 368 | + text-align: center; | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + .col3 { | ||
| 372 | + width: 30%; | ||
| 373 | + text-align: right; | ||
| 374 | + } | ||
| 375 | +} | ||
| 376 | + | ||
| 377 | +.history-row { | ||
| 378 | + display: flex; | ||
| 379 | + padding: 20rpx 52rpx 20rpx 32rpx; | ||
| 380 | + border-bottom: 1rpx solid #f7f7f7; | ||
| 381 | + | ||
| 382 | + .col { | ||
| 383 | + font-size: 28rpx; | ||
| 384 | + color: rgba(0, 0, 0, 0.9); | ||
| 385 | + line-height: 40rpx; | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | + .col1 { | ||
| 389 | + width: 20%; | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + .col2 { | ||
| 393 | + width: 50%; | ||
| 394 | + text-align: center; | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + .col3 { | ||
| 398 | + width: 30%; | ||
| 399 | + text-align: right; | ||
| 400 | + } | ||
| 401 | + | ||
| 402 | + .link { | ||
| 403 | + color: $theme-primary; | ||
| 404 | + } | ||
| 405 | +} | ||
| 406 | + | ||
| 407 | +.title-header { | ||
| 408 | + background-color: #fff; | ||
| 409 | + display: flex; | ||
| 410 | + align-items: center; | ||
| 411 | + padding: 32rpx 32rpx 22rpx; | ||
| 412 | + border-bottom: 1rpx dashed #f0f0f0; | ||
| 413 | + | ||
| 414 | + &_icon { | ||
| 415 | + width: 32rpx; | ||
| 416 | + height: 28rpx; | ||
| 417 | + margin-right: 16rpx; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + span { | ||
| 421 | + color: rgba(0, 0, 0, 0.9); | ||
| 422 | + font-size: 32rpx; | ||
| 423 | + line-height: 44rpx; | ||
| 424 | + font-weight: 600; | ||
| 425 | + } | ||
| 426 | +} | ||
| 427 | +</style> |