Commit 3e08a79477354475e5fc72fae330b930c45d8799
1 parent
bb240e75
feat: 外贸标准合同-新增&编辑&查看-产品 是否为试样订单 逻辑
Showing
1 changed file
with
39 additions
and
12 deletions
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | <view v-if="mode === 'add'" class="add-list"> | 16 | <view v-if="mode === 'add'" class="add-list"> |
| 17 | <view v-for="(item, idx) in items" :key="idx" class="block"> | 17 | <view v-for="(item, idx) in items" :key="idx" class="block"> |
| 18 | <uni-list v-show="item.collapsed"> | 18 | <uni-list v-show="item.collapsed"> |
| 19 | - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> | 19 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 20 | <template v-slot:body> | 20 | <template v-slot:body> |
| 21 | <view class="item-title"><text>产品名称</text></view> | 21 | <view class="item-title"><text>产品名称</text></view> |
| 22 | </template> | 22 | </template> |
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | </uni-list-item> | 33 | </uni-list-item> |
| 34 | </uni-list> | 34 | </uni-list> |
| 35 | <uni-list v-show="!item.collapsed"> | 35 | <uni-list v-show="!item.collapsed"> |
| 36 | - <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx)" :rightText="item.productName || '请选择产品名称'" showArrow> | 36 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 37 | <template v-slot:body> | 37 | <template v-slot:body> |
| 38 | <view class="item-title"><text>产品名称</text></view> | 38 | <view class="item-title"><text>产品名称</text></view> |
| 39 | </template> | 39 | </template> |
| @@ -137,6 +137,12 @@ | @@ -137,6 +137,12 @@ | ||
| 137 | <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> | 137 | <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> |
| 138 | </template> | 138 | </template> |
| 139 | </uni-list-item> | 139 | </uni-list-item> |
| 140 | + <uni-list-item class="select-item" :class="typeof item.sampleOrder === 'boolean' ? 'is-filled' : 'is-empty'" clickable | ||
| 141 | + @click="openProductSheet(idx, 'sampleOrder')" :rightText="typeof item.sampleOrder === 'boolean' ? (item.sampleOrder ? '是' : '否') : '请选择'" showArrow> | ||
| 142 | + <template v-slot:body> | ||
| 143 | + <view class="item-title"><text>是否为试样订单</text></view> | ||
| 144 | + </template> | ||
| 145 | + </uni-list-item> | ||
| 140 | </uni-list> | 146 | </uni-list> |
| 141 | <view class="block-ops"> | 147 | <view class="block-ops"> |
| 142 | <div class="del" @click="onRemove(idx)"> | 148 | <div class="del" @click="onRemove(idx)"> |
| @@ -195,6 +201,7 @@ | @@ -195,6 +201,7 @@ | ||
| 195 | <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) | 201 | <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) |
| 196 | }}</text></view> | 202 | }}</text></view> |
| 197 | <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> | 203 | <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> |
| 204 | + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view> | ||
| 198 | </view> | 205 | </view> |
| 199 | </view> | 206 | </view> |
| 200 | <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> | 207 | <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> |
| @@ -217,7 +224,7 @@ export default { | @@ -217,7 +224,7 @@ export default { | ||
| 217 | return { | 224 | return { |
| 218 | items: [], | 225 | items: [], |
| 219 | collapsedView: false, | 226 | collapsedView: false, |
| 220 | - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } | 227 | + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' } |
| 221 | } | 228 | } |
| 222 | }, | 229 | }, |
| 223 | computed: { | 230 | computed: { |
| @@ -266,7 +273,7 @@ export default { | @@ -266,7 +273,7 @@ export default { | ||
| 266 | }, | 273 | }, |
| 267 | methods: { | 274 | methods: { |
| 268 | defaultItem() { | 275 | defaultItem() { |
| 269 | - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '',processingFee: undefined, status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '' } | 276 | + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '',processingFee: undefined, status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '', sampleOrder: '' } |
| 270 | }, | 277 | }, |
| 271 | onNonNegativeInput(idx, field) { | 278 | onNonNegativeInput(idx, field) { |
| 272 | const it = this.items[idx] | 279 | const it = this.items[idx] |
| @@ -375,18 +382,38 @@ export default { | @@ -375,18 +382,38 @@ export default { | ||
| 375 | const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') | 382 | const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') |
| 376 | return [t, w, l].filter(Boolean).join(' × ') | 383 | return [t, w, l].filter(Boolean).join(' × ') |
| 377 | }, | 384 | }, |
| 378 | - openProductSheet(idx) { | ||
| 379 | - const opts = this.selectOptions | ||
| 380 | - const current = this.items[idx] && this.items[idx].productId | ||
| 381 | - const match = opts.find(o => o.value === current) | ||
| 382 | - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } | 385 | + openProductSheet(idx, mode = 'product') { |
| 386 | + let opts = [] | ||
| 387 | + let title = '' | ||
| 388 | + let value = '' | ||
| 389 | + const item = this.items[idx] | ||
| 390 | + | ||
| 391 | + if (mode === 'product') { | ||
| 392 | + opts = this.selectOptions | ||
| 393 | + const current = item && item.productId | ||
| 394 | + const match = opts.find(o => o.value === current) | ||
| 395 | + value = match ? match.value : '' | ||
| 396 | + title = '请选择产品' | ||
| 397 | + } else if (mode === 'sampleOrder') { | ||
| 398 | + opts = [{ label: '是', value: true }, { label: '否', value: false }] | ||
| 399 | + value = item.sampleOrder | ||
| 400 | + title = '是否为试样订单' | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode } | ||
| 383 | }, | 404 | }, |
| 384 | onProductConfirm({ value, label }) { | 405 | onProductConfirm({ value, label }) { |
| 385 | - const idx = this.sheet.idx | 406 | + const { idx, mode } = this.sheet |
| 386 | const it = this.items[idx] | 407 | const it = this.items[idx] |
| 387 | if (!it) { this.sheet.visible = false; return } | 408 | if (!it) { this.sheet.visible = false; return } |
| 388 | - it.productId = value | ||
| 389 | - it.productName = label || '' | 409 | + |
| 410 | + if (mode === 'product') { | ||
| 411 | + it.productId = value | ||
| 412 | + it.productName = label || '' | ||
| 413 | + } else if (mode === 'sampleOrder') { | ||
| 414 | + it.sampleOrder = value | ||
| 415 | + } | ||
| 416 | + | ||
| 390 | this.$set(this.items, idx, it) | 417 | this.$set(this.items, idx, it) |
| 391 | this.sheet.visible = false | 418 | this.sheet.visible = false |
| 392 | this.emitChange() | 419 | this.emitChange() |