Showing
5 changed files
with
168 additions
and
8 deletions
| @@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
| 76 | </uni-list-item> | 76 | </uni-list-item> |
| 77 | <uni-list-item title="物料编码"> | 77 | <uni-list-item title="物料编码"> |
| 78 | <template v-slot:footer> | 78 | <template v-slot:footer> |
| 79 | - <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" disabled /> | 79 | + <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" /> |
| 80 | </template> | 80 | </template> |
| 81 | </uni-list-item> | 81 | </uni-list-item> |
| 82 | <uni-list-item title="状态"> | 82 | <uni-list-item title="状态"> |
| @@ -136,6 +136,26 @@ | @@ -136,6 +136,26 @@ | ||
| 136 | </uni-list-item> | 136 | </uni-list-item> |
| 137 | 137 | ||
| 138 | </uni-list> | 138 | </uni-list> |
| 139 | + | ||
| 140 | + </view> | ||
| 141 | + <view style="margin-top: 20rpx;"> | ||
| 142 | + <uni-list> | ||
| 143 | + <uni-list-item | ||
| 144 | + class="select-item" | ||
| 145 | + :class="form.changeReason ? 'is-filled' : 'is-empty'" | ||
| 146 | + clickable | ||
| 147 | + @click="openSheet('changeReason')" | ||
| 148 | + :rightText="form.changeReasonName || '请选择'" | ||
| 149 | + showArrow | ||
| 150 | + > | ||
| 151 | + <template v-slot:body> | ||
| 152 | + <view class="item-title"> | ||
| 153 | + <text v-if="isChangeReasonRequired" class="required">*</text> | ||
| 154 | + <text>变更原因</text> | ||
| 155 | + </view> | ||
| 156 | + </template> | ||
| 157 | + </uni-list-item> | ||
| 158 | + </uni-list> | ||
| 139 | </view> | 159 | </view> |
| 140 | <view class="footer"> | 160 | <view class="footer"> |
| 141 | <div class="total"> | 161 | <div class="total"> |
| @@ -172,21 +192,34 @@ | @@ -172,21 +192,34 @@ | ||
| 172 | </view> | 192 | </view> |
| 173 | </scroll-view> | 193 | </scroll-view> |
| 174 | 194 | ||
| 175 | - | 195 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" /> |
| 176 | </view> | 196 | </view> |
| 177 | </template> | 197 | </template> |
| 178 | 198 | ||
| 179 | <script> | 199 | <script> |
| 180 | import { getContractApi, priceLock } from '@/api/contract' | 200 | import { getContractApi, priceLock } from '@/api/contract' |
| 181 | import { formatCurrencyToChinese } from '@/utils/common' | 201 | import { formatCurrencyToChinese } from '@/utils/common' |
| 202 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 182 | 203 | ||
| 183 | export default { | 204 | export default { |
| 184 | name: 'ContractUnplanLock', | 205 | name: 'ContractUnplanLock', |
| 206 | + components: { SingleSelectSheet }, | ||
| 185 | data() { | 207 | data() { |
| 186 | return { | 208 | return { |
| 187 | id: '', | 209 | id: '', |
| 188 | items: [], | 210 | items: [], |
| 189 | planQty: 30, | 211 | planQty: 30, |
| 212 | + form: { | ||
| 213 | + changeReason: '', | ||
| 214 | + changeReasonName: '', | ||
| 215 | + }, | ||
| 216 | + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, | ||
| 217 | + changeReasonOptions: [ | ||
| 218 | + { label: '客户要求', value: '客户要求' }, | ||
| 219 | + { label: '订单调整', value: '订单调整' }, | ||
| 220 | + { label: '生产计划调整', value: '生产计划调整' }, | ||
| 221 | + { label: '其他', value: '其他' } | ||
| 222 | + ] | ||
| 190 | } | 223 | } |
| 191 | }, | 224 | }, |
| 192 | computed: { | 225 | computed: { |
| @@ -222,6 +255,9 @@ export default { | @@ -222,6 +255,9 @@ export default { | ||
| 222 | totalQtyDisplay() { | 255 | totalQtyDisplay() { |
| 223 | const qty = this.round(this.items.reduce((p, c) => p + this.toNumber(c.quantity), 0), 3) | 256 | const qty = this.round(this.items.reduce((p, c) => p + this.toNumber(c.quantity), 0), 3) |
| 224 | return `${qty}t/${this.planQty}t` | 257 | return `${qty}t/${this.planQty}t` |
| 258 | + }, | ||
| 259 | + isChangeReasonRequired() { | ||
| 260 | + return this.items.some(it => it && it.locked && this.normalizeDate(it.deliveryDate) !== this.normalizeDate(it.originalDeliveryDate)) | ||
| 225 | } | 261 | } |
| 226 | }, | 262 | }, |
| 227 | onLoad(options) { | 263 | onLoad(options) { |
| @@ -280,6 +316,7 @@ export default { | @@ -280,6 +316,7 @@ export default { | ||
| 280 | // amountExcludingTax: v.amountExcludingTax || 0, | 316 | // amountExcludingTax: v.amountExcludingTax || 0, |
| 281 | totalAmount: v.totalAmount || 0, | 317 | totalAmount: v.totalAmount || 0, |
| 282 | deliveryDate: this.normalizeDate(v.deliveryDate), | 318 | deliveryDate: this.normalizeDate(v.deliveryDate), |
| 319 | + originalDeliveryDate: this.normalizeDate(v.deliveryDate), | ||
| 283 | specDisplay: '' | 320 | specDisplay: '' |
| 284 | })) | 321 | })) |
| 285 | this.items = init.map(it => ({ ...it, specDisplay: this.specOf(it) })) | 322 | this.items = init.map(it => ({ ...it, specDisplay: this.specOf(it) })) |
| @@ -359,6 +396,23 @@ export default { | @@ -359,6 +396,23 @@ export default { | ||
| 359 | // amountExcludingTax: 0 | 396 | // amountExcludingTax: 0 |
| 360 | })) | 397 | })) |
| 361 | }, | 398 | }, |
| 399 | + openSheet(field) { | ||
| 400 | + if (field === 'changeReason') { | ||
| 401 | + const options = this.changeReasonOptions || [] | ||
| 402 | + const current = this.form.changeReason | ||
| 403 | + const match = options.find(o => String(o.value) === String(current)) | ||
| 404 | + this.sheet = { ...this.sheet, visible: true, title: '变更原因', options, field, value: match ? match.value : '' } | ||
| 405 | + } | ||
| 406 | + }, | ||
| 407 | + onSheetConfirm(e) { | ||
| 408 | + const field = this.sheet.field | ||
| 409 | + if (field === 'changeReason') { | ||
| 410 | + const val = e && e.value != null ? e.value : '' | ||
| 411 | + const label = e && e.label != null ? e.label : '' | ||
| 412 | + this.form.changeReason = val | ||
| 413 | + this.form.changeReasonName = label | ||
| 414 | + } | ||
| 415 | + }, | ||
| 362 | async onSubmit() { | 416 | async onSubmit() { |
| 363 | const selected = this.items.filter(it => it.locked).map(it => { | 417 | const selected = this.items.filter(it => it.locked).map(it => { |
| 364 | const raw = { ...(it.raw || {}) } | 418 | const raw = { ...(it.raw || {}) } |
| @@ -371,6 +425,7 @@ export default { | @@ -371,6 +425,7 @@ export default { | ||
| 371 | raw.unitPrice = price | 425 | raw.unitPrice = price |
| 372 | raw.totalAmount = total | 426 | raw.totalAmount = total |
| 373 | raw.deliveryDate = it.deliveryDate | 427 | raw.deliveryDate = it.deliveryDate |
| 428 | + raw.materialCode = it.materialCode | ||
| 374 | // raw.amountExcludingTax = excl | 429 | // raw.amountExcludingTax = excl |
| 375 | return raw | 430 | return raw |
| 376 | }) | 431 | }) |
| @@ -391,6 +446,10 @@ export default { | @@ -391,6 +446,10 @@ export default { | ||
| 391 | uni.showToast({ title: '发货日期不得早于今日', icon: 'none' }) | 446 | uni.showToast({ title: '发货日期不得早于今日', icon: 'none' }) |
| 392 | return | 447 | return |
| 393 | } | 448 | } |
| 449 | + if (this.isChangeReasonRequired && !this.form.changeReason) { | ||
| 450 | + uni.showToast({ title: '发货日期已变更,请选择变更原因', icon: 'none' }) | ||
| 451 | + return | ||
| 452 | + } | ||
| 394 | this.selectedItems = selected | 453 | this.selectedItems = selected |
| 395 | const payload = { | 454 | const payload = { |
| 396 | id: this.id, | 455 | id: this.id, |
| @@ -399,6 +458,7 @@ export default { | @@ -399,6 +458,7 @@ export default { | ||
| 399 | totalAmountIncludingTax: this.totalAmountIncludingTax, | 458 | totalAmountIncludingTax: this.totalAmountIncludingTax, |
| 400 | totalQuantity: this.totalQuantity, | 459 | totalQuantity: this.totalQuantity, |
| 401 | type: 'INTL_INVENTORY_AGMT', | 460 | type: 'INTL_INVENTORY_AGMT', |
| 461 | + changeReason: this.form.changeReason, | ||
| 402 | contractDistributorLineList: selected | 462 | contractDistributorLineList: selected |
| 403 | } | 463 | } |
| 404 | 464 | ||
| @@ -676,7 +736,9 @@ export default { | @@ -676,7 +736,9 @@ export default { | ||
| 676 | padding: 24rpx; | 736 | padding: 24rpx; |
| 677 | margin: 0 32rpx 20rpx; | 737 | margin: 0 32rpx 20rpx; |
| 678 | } | 738 | } |
| 679 | - | 739 | +::v-deep .uni-list--border-top { |
| 740 | + display: none; | ||
| 741 | +} | ||
| 680 | .row { | 742 | .row { |
| 681 | display: flex; | 743 | display: flex; |
| 682 | margin-bottom: 16rpx; | 744 | margin-bottom: 16rpx; |
| @@ -205,6 +205,14 @@ | @@ -205,6 +205,14 @@ | ||
| 205 | ¥{{ (totalAmountIncludingTax || 0).toFixed(2) }} | 205 | ¥{{ (totalAmountIncludingTax || 0).toFixed(2) }} |
| 206 | </div> | 206 | </div> |
| 207 | </div> | 207 | </div> |
| 208 | + <div class="total-item"> | ||
| 209 | + <div class="total-item-text"> | ||
| 210 | + 剩余锁规数量 | ||
| 211 | + </div> | ||
| 212 | + <div class="total-item-price text-red"> | ||
| 213 | + {{ (remainingQuantity || 0).toFixed(2) }} | ||
| 214 | + </div> | ||
| 215 | + </div> | ||
| 208 | </div> | 216 | </div> |
| 209 | <button class="btn submit" type="primary" @click="onSubmit">提交</button> | 217 | <button class="btn submit" type="primary" @click="onSubmit">提交</button> |
| 210 | </view> | 218 | </view> |
| @@ -228,6 +236,7 @@ export default { | @@ -228,6 +236,7 @@ export default { | ||
| 228 | id: '', | 236 | id: '', |
| 229 | items: [], | 237 | items: [], |
| 230 | planQty: 30, | 238 | planQty: 30, |
| 239 | + remainingQuantity: 0, | ||
| 231 | sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, | 240 | sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, |
| 232 | options: [], | 241 | options: [], |
| 233 | qualityForm: { | 242 | qualityForm: { |
| @@ -325,6 +334,7 @@ export default { | @@ -325,6 +334,7 @@ export default { | ||
| 325 | try { | 334 | try { |
| 326 | const res = await getContractApi(this.id) | 335 | const res = await getContractApi(this.id) |
| 327 | const data = res && res.data ? res.data : {} | 336 | const data = res && res.data ? res.data : {} |
| 337 | + this.remainingQuantity = this.toNumber(data.remainingQuantity) | ||
| 328 | this.qualityForm = { | 338 | this.qualityForm = { |
| 329 | pieceWeightHead: data.pieceWeightHead || '', | 339 | pieceWeightHead: data.pieceWeightHead || '', |
| 330 | surface: data.surface || '', | 340 | surface: data.surface || '', |
| @@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
| 71 | </uni-list-item> | 71 | </uni-list-item> |
| 72 | <uni-list-item title="物料编码"> | 72 | <uni-list-item title="物料编码"> |
| 73 | <template v-slot:footer> | 73 | <template v-slot:footer> |
| 74 | - <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" disabled /> | 74 | + <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" /> |
| 75 | </template> | 75 | </template> |
| 76 | </uni-list-item> | 76 | </uni-list-item> |
| 77 | <uni-list-item title="状态"> | 77 | <uni-list-item title="状态"> |
| @@ -122,7 +122,26 @@ | @@ -122,7 +122,26 @@ | ||
| 122 | <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> | 122 | <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> |
| 123 | </template> | 123 | </template> |
| 124 | </uni-list-item> | 124 | </uni-list-item> |
| 125 | - | 125 | + </uni-list> |
| 126 | + | ||
| 127 | + </view> | ||
| 128 | + <view style="margin-top: 20rpx;"> | ||
| 129 | + <uni-list> | ||
| 130 | + <uni-list-item | ||
| 131 | + class="select-item" | ||
| 132 | + :class="form.changeReason ? 'is-filled' : 'is-empty'" | ||
| 133 | + clickable | ||
| 134 | + @click="openSheet('changeReason')" | ||
| 135 | + :rightText="form.changeReasonName || '请选择'" | ||
| 136 | + showArrow | ||
| 137 | + > | ||
| 138 | + <template v-slot:body> | ||
| 139 | + <view class="item-title"> | ||
| 140 | + <text v-if="isChangeReasonRequired" class="required">*</text> | ||
| 141 | + <text>变更原因</text> | ||
| 142 | + </view> | ||
| 143 | + </template> | ||
| 144 | + </uni-list-item> | ||
| 126 | </uni-list> | 145 | </uni-list> |
| 127 | </view> | 146 | </view> |
| 128 | <view class="footer"> | 147 | <view class="footer"> |
| @@ -160,20 +179,34 @@ | @@ -160,20 +179,34 @@ | ||
| 160 | </view> | 179 | </view> |
| 161 | </scroll-view> | 180 | </scroll-view> |
| 162 | 181 | ||
| 182 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onSheetConfirm" /> | ||
| 163 | </view> | 183 | </view> |
| 164 | </template> | 184 | </template> |
| 165 | 185 | ||
| 166 | <script> | 186 | <script> |
| 167 | import { getContractApi, priceLock } from '@/api/contract' | 187 | import { getContractApi, priceLock } from '@/api/contract' |
| 168 | import { formatCurrencyToChinese } from '@/utils/common' | 188 | import { formatCurrencyToChinese } from '@/utils/common' |
| 189 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 169 | 190 | ||
| 170 | export default { | 191 | export default { |
| 171 | name: 'ContractUnplanLock', | 192 | name: 'ContractUnplanLock', |
| 193 | + components: { SingleSelectSheet }, | ||
| 172 | data() { | 194 | data() { |
| 173 | return { | 195 | return { |
| 174 | id: '', | 196 | id: '', |
| 175 | items: [], | 197 | items: [], |
| 176 | planQty: 30, | 198 | planQty: 30, |
| 199 | + form: { | ||
| 200 | + changeReason: '', | ||
| 201 | + changeReasonName: '', | ||
| 202 | + }, | ||
| 203 | + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, | ||
| 204 | + changeReasonOptions: [ | ||
| 205 | + { label: '客户要求', value: '客户要求' }, | ||
| 206 | + { label: '订单调整', value: '订单调整' }, | ||
| 207 | + { label: '生产计划调整', value: '生产计划调整' }, | ||
| 208 | + { label: '其他', value: '其他' } | ||
| 209 | + ] | ||
| 177 | } | 210 | } |
| 178 | }, | 211 | }, |
| 179 | computed: { | 212 | computed: { |
| @@ -209,6 +242,9 @@ export default { | @@ -209,6 +242,9 @@ export default { | ||
| 209 | totalQtyDisplay() { | 242 | totalQtyDisplay() { |
| 210 | const qty = this.round(this.items.reduce((p, c) => p + this.toNumber(c.quantity), 0), 3) | 243 | const qty = this.round(this.items.reduce((p, c) => p + this.toNumber(c.quantity), 0), 3) |
| 211 | return `${qty}t/${this.planQty}t` | 244 | return `${qty}t/${this.planQty}t` |
| 245 | + }, | ||
| 246 | + isChangeReasonRequired() { | ||
| 247 | + return this.items.some(it => it && it.locked && this.normalizeDate(it.deliveryDate) !== this.normalizeDate(it.originalDeliveryDate)) | ||
| 212 | } | 248 | } |
| 213 | }, | 249 | }, |
| 214 | onLoad(options) { | 250 | onLoad(options) { |
| @@ -267,6 +303,7 @@ export default { | @@ -267,6 +303,7 @@ export default { | ||
| 267 | amountExcludingTax: v.amountExcludingTax || 0, | 303 | amountExcludingTax: v.amountExcludingTax || 0, |
| 268 | totalAmount: v.totalAmount || 0, | 304 | totalAmount: v.totalAmount || 0, |
| 269 | deliveryDate: this.normalizeDate(v.deliveryDate), | 305 | deliveryDate: this.normalizeDate(v.deliveryDate), |
| 306 | + originalDeliveryDate: this.normalizeDate(v.deliveryDate), | ||
| 270 | specDisplay: '' | 307 | specDisplay: '' |
| 271 | })) | 308 | })) |
| 272 | this.items = init.map(it => ({ ...it, specDisplay: this.specOf(it) })) | 309 | this.items = init.map(it => ({ ...it, specDisplay: this.specOf(it) })) |
| @@ -346,6 +383,23 @@ export default { | @@ -346,6 +383,23 @@ export default { | ||
| 346 | amountExcludingTax: 0 | 383 | amountExcludingTax: 0 |
| 347 | })) | 384 | })) |
| 348 | }, | 385 | }, |
| 386 | + openSheet(field) { | ||
| 387 | + if (field === 'changeReason') { | ||
| 388 | + const options = this.changeReasonOptions || [] | ||
| 389 | + const current = this.form.changeReason | ||
| 390 | + const match = options.find(o => String(o.value) === String(current)) | ||
| 391 | + this.sheet = { ...this.sheet, visible: true, title: '变更原因', options, field, value: match ? match.value : '' } | ||
| 392 | + } | ||
| 393 | + }, | ||
| 394 | + onSheetConfirm(e) { | ||
| 395 | + const field = this.sheet.field | ||
| 396 | + if (field === 'changeReason') { | ||
| 397 | + const val = e && e.value != null ? e.value : '' | ||
| 398 | + const label = e && e.label != null ? e.label : '' | ||
| 399 | + this.form.changeReason = val | ||
| 400 | + this.form.changeReasonName = label | ||
| 401 | + } | ||
| 402 | + }, | ||
| 349 | async onSubmit() { | 403 | async onSubmit() { |
| 350 | const selected = this.items.filter(it => it.locked).map(it => { | 404 | const selected = this.items.filter(it => it.locked).map(it => { |
| 351 | const raw = { ...(it.raw || {}) } | 405 | const raw = { ...(it.raw || {}) } |
| @@ -359,6 +413,7 @@ export default { | @@ -359,6 +413,7 @@ export default { | ||
| 359 | raw.totalAmount = total | 413 | raw.totalAmount = total |
| 360 | raw.amountExcludingTax = excl | 414 | raw.amountExcludingTax = excl |
| 361 | raw.deliveryDate = it.deliveryDate | 415 | raw.deliveryDate = it.deliveryDate |
| 416 | + raw.materialCode = it.materialCode | ||
| 362 | return raw | 417 | return raw |
| 363 | }) | 418 | }) |
| 364 | if (!selected.length) { | 419 | if (!selected.length) { |
| @@ -378,6 +433,10 @@ export default { | @@ -378,6 +433,10 @@ export default { | ||
| 378 | uni.showToast({ title: '发货日期不得早于今日', icon: 'none' }) | 433 | uni.showToast({ title: '发货日期不得早于今日', icon: 'none' }) |
| 379 | return | 434 | return |
| 380 | } | 435 | } |
| 436 | + if (this.isChangeReasonRequired && !this.form.changeReason) { | ||
| 437 | + uni.showToast({ title: '发货日期已变更,请选择变更原因', icon: 'none' }) | ||
| 438 | + return | ||
| 439 | + } | ||
| 381 | this.selectedItems = selected | 440 | this.selectedItems = selected |
| 382 | const payload = { | 441 | const payload = { |
| 383 | id: this.id, | 442 | id: this.id, |
| @@ -386,6 +445,7 @@ export default { | @@ -386,6 +445,7 @@ export default { | ||
| 386 | totalAmountIncludingTax: this.totalAmountIncludingTax, | 445 | totalAmountIncludingTax: this.totalAmountIncludingTax, |
| 387 | totalQuantity: this.totalQuantity, | 446 | totalQuantity: this.totalQuantity, |
| 388 | type:'DIST_STOCK_CONTRACT', | 447 | type:'DIST_STOCK_CONTRACT', |
| 448 | + changeReason: this.form.changeReason, | ||
| 389 | contractDistributorLineList: selected | 449 | contractDistributorLineList: selected |
| 390 | } | 450 | } |
| 391 | 451 | ||
| @@ -599,7 +659,9 @@ export default { | @@ -599,7 +659,9 @@ export default { | ||
| 599 | // ::v-deep .uni-list-item__extra-text { | 659 | // ::v-deep .uni-list-item__extra-text { |
| 600 | // font-size: 32rpx; | 660 | // font-size: 32rpx; |
| 601 | // } | 661 | // } |
| 602 | - | 662 | +::v-deep .uni-list--border-top { |
| 663 | + display: none; | ||
| 664 | +} | ||
| 603 | ::v-deep .uni-easyinput { | 665 | ::v-deep .uni-easyinput { |
| 604 | width: 100%; | 666 | width: 100%; |
| 605 | } | 667 | } |
| @@ -205,6 +205,14 @@ | @@ -205,6 +205,14 @@ | ||
| 205 | ¥{{ (totalAmountIncludingTax || 0).toFixed(2) }} | 205 | ¥{{ (totalAmountIncludingTax || 0).toFixed(2) }} |
| 206 | </div> | 206 | </div> |
| 207 | </div> | 207 | </div> |
| 208 | + <div class="total-item"> | ||
| 209 | + <div class="total-item-text"> | ||
| 210 | + 剩余锁规数量 | ||
| 211 | + </div> | ||
| 212 | + <div class="total-item-price text-red"> | ||
| 213 | + {{ (remainingQuantity || 0).toFixed(2) }} | ||
| 214 | + </div> | ||
| 215 | + </div> | ||
| 208 | </div> | 216 | </div> |
| 209 | <button class="btn submit" type="primary" @click="onSubmit">提交</button> | 217 | <button class="btn submit" type="primary" @click="onSubmit">提交</button> |
| 210 | </view> | 218 | </view> |
| @@ -228,6 +236,7 @@ export default { | @@ -228,6 +236,7 @@ export default { | ||
| 228 | id: '', | 236 | id: '', |
| 229 | items: [], | 237 | items: [], |
| 230 | planQty: 30, | 238 | planQty: 30, |
| 239 | + remainingQuantity: 0, | ||
| 231 | sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, | 240 | sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, |
| 232 | options: [], | 241 | options: [], |
| 233 | qualityForm: { | 242 | qualityForm: { |
| @@ -341,6 +350,7 @@ export default { | @@ -341,6 +350,7 @@ export default { | ||
| 341 | try { | 350 | try { |
| 342 | const res = await getContractApi(this.id) | 351 | const res = await getContractApi(this.id) |
| 343 | const data = res && res.data ? res.data : {} | 352 | const data = res && res.data ? res.data : {} |
| 353 | + this.remainingQuantity = this.toNumber(data.remainingQuantity) | ||
| 344 | this.qualityForm = { | 354 | this.qualityForm = { |
| 345 | pieceWeightHead: data.pieceWeightHead || '', | 355 | pieceWeightHead: data.pieceWeightHead || '', |
| 346 | surface: data.surface || '', | 356 | surface: data.surface || '', |
| @@ -57,7 +57,8 @@ | @@ -57,7 +57,8 @@ | ||
| 57 | </uni-list-item> | 57 | </uni-list-item> |
| 58 | <uni-list-item title="职务"> | 58 | <uni-list-item title="职务"> |
| 59 | <template v-slot:footer> | 59 | <template v-slot:footer> |
| 60 | - <uni-easyinput v-model="item.position" :inputBorder="false" placeholder="请输入职务" /> | 60 | + <uni-easyinput v-model="item.position" :disabled="idx === 0" :inputBorder="false" |
| 61 | + placeholder="请输入职务" /> | ||
| 61 | </template> | 62 | </template> |
| 62 | </uni-list-item> | 63 | </uni-list-item> |
| 63 | <uni-list-item title="手机"> | 64 | <uni-list-item title="手机"> |
| @@ -128,6 +129,7 @@ | @@ -128,6 +129,7 @@ | ||
| 128 | <script> | 129 | <script> |
| 129 | import SingleSelectSheet from '@/components/single-select/index.vue' | 130 | import SingleSelectSheet from '@/components/single-select/index.vue' |
| 130 | import { uuid } from '@/utils/uuid.js' | 131 | import { uuid } from '@/utils/uuid.js' |
| 132 | +const LEGAL_POSITION = '法定代表人' | ||
| 131 | export default { | 133 | export default { |
| 132 | name: 'CorePersonnel', | 134 | name: 'CorePersonnel', |
| 133 | props: { | 135 | props: { |
| @@ -168,6 +170,7 @@ export default { | @@ -168,6 +170,7 @@ export default { | ||
| 168 | it.sexName = m ? (m.label || '') : it.sexName | 170 | it.sexName = m ? (m.label || '') : it.sexName |
| 169 | return it | 171 | return it |
| 170 | }) | 172 | }) |
| 173 | + this.enforceFirstPosition() | ||
| 171 | }, | 174 | }, |
| 172 | deep: true | 175 | deep: true |
| 173 | }, | 176 | }, |
| @@ -178,8 +181,17 @@ export default { | @@ -178,8 +181,17 @@ export default { | ||
| 178 | created() { | 181 | created() { |
| 179 | const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }] | 182 | const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }] |
| 180 | this.items = init | 183 | this.items = init |
| 184 | + this.enforceFirstPosition() | ||
| 181 | }, | 185 | }, |
| 182 | methods: { | 186 | methods: { |
| 187 | + enforceFirstPosition() { | ||
| 188 | + if (this.mode === 'history') return | ||
| 189 | + if (!Array.isArray(this.items) || this.items.length === 0) return | ||
| 190 | + const first = this.items[0] | ||
| 191 | + if (!first) return | ||
| 192 | + if (first.position === LEGAL_POSITION) return | ||
| 193 | + this.$set(this.items, 0, { ...first, position: LEGAL_POSITION }) | ||
| 194 | + }, | ||
| 183 | defaultItem() { | 195 | defaultItem() { |
| 184 | return { personId: uuid(), name: '', sex: '', sexName: '', nativePlace: '', age: '', position: '', mobile: '', phone: '', email: '', address: '', collapsed: false } | 196 | return { personId: uuid(), name: '', sex: '', sexName: '', nativePlace: '', age: '', position: '', mobile: '', phone: '', email: '', address: '', collapsed: false } |
| 185 | }, | 197 | }, |
| @@ -216,6 +228,7 @@ export default { | @@ -216,6 +228,7 @@ export default { | ||
| 216 | const obj = this.defaultItem() | 228 | const obj = this.defaultItem() |
| 217 | obj.collapsed = true | 229 | obj.collapsed = true |
| 218 | this.items.push(obj) | 230 | this.items.push(obj) |
| 231 | + this.enforceFirstPosition() | ||
| 219 | this.emitChange() | 232 | this.emitChange() |
| 220 | }, | 233 | }, |
| 221 | onRemove(id) { | 234 | onRemove(id) { |
| @@ -230,6 +243,7 @@ export default { | @@ -230,6 +243,7 @@ export default { | ||
| 230 | const i = this.items.findIndex(it => String(it.personId) === String(id)) | 243 | const i = this.items.findIndex(it => String(it.personId) === String(id)) |
| 231 | if (i >= 0) { | 244 | if (i >= 0) { |
| 232 | this.items.splice(i, 1) | 245 | this.items.splice(i, 1) |
| 246 | + this.enforceFirstPosition() | ||
| 233 | this.emitChange() | 247 | this.emitChange() |
| 234 | } | 248 | } |
| 235 | } | 249 | } |
| @@ -333,7 +347,9 @@ export default { | @@ -333,7 +347,9 @@ export default { | ||
| 333 | 347 | ||
| 334 | ::v-deep .uni-list { | 348 | ::v-deep .uni-list { |
| 335 | background: transparent; | 349 | background: transparent; |
| 336 | - | 350 | + .uni-input-input:disabled { |
| 351 | + color: rgb(51, 51, 51) !important; | ||
| 352 | + } | ||
| 337 | &-item { | 353 | &-item { |
| 338 | &__container { | 354 | &__container { |
| 339 | padding: 32rpx; | 355 | padding: 32rpx; |