Commit e8cecdf946026830b76ddd24c73cfe059456549d
1 parent
eb46340f
feat: 外贸未锁规合同-xinz &编辑&查看-产品 是否为试样订单逻辑
Showing
1 changed file
with
39 additions
and
12 deletions
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <view v-if="mode === 'add'" class="add-list"> |
| 17 | 17 | <view v-for="(item, idx) in items" :key="idx" class="block"> |
| 18 | 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 | 20 | <template v-slot:body> |
| 21 | 21 | <view class="item-title"><text>产品名称</text></view> |
| 22 | 22 | </template> |
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | </uni-list-item> |
| 34 | 34 | </uni-list> |
| 35 | 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 | 37 | <template v-slot:body> |
| 38 | 38 | <view class="item-title"><text>产品名称</text></view> |
| 39 | 39 | </template> |
| ... | ... | @@ -137,6 +137,12 @@ |
| 137 | 137 | <uni-datetime-picker :start="minDeliveryDate" type="date" v-model="item.deliveryDate" @change="onDateChange(idx, $event)" /> |
| 138 | 138 | </template> |
| 139 | 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 | 146 | </uni-list> |
| 141 | 147 | <view class="block-ops"> |
| 142 | 148 | <div class="del" @click="onRemove(idx)"> |
| ... | ... | @@ -191,6 +197,7 @@ |
| 191 | 197 | <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount) |
| 192 | 198 | }}</text></view> |
| 193 | 199 | <view class="row"><text class="label">发货日期</text><text class="value">{{ item.deliveryDate }}</text></view> |
| 200 | + <view class="row"><text class="label">是否为试样订单</text><text class="value">{{ item.sampleOrder ? '是' : '否' }}</text></view> | |
| 194 | 201 | </view> |
| 195 | 202 | </view> |
| 196 | 203 | <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> |
| ... | ... | @@ -213,7 +220,7 @@ export default { |
| 213 | 220 | return { |
| 214 | 221 | items: [], |
| 215 | 222 | collapsedView: false, |
| 216 | - sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 } | |
| 223 | + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1, mode: 'product' } | |
| 217 | 224 | } |
| 218 | 225 | }, |
| 219 | 226 | computed: { |
| ... | ... | @@ -262,7 +269,7 @@ export default { |
| 262 | 269 | }, |
| 263 | 270 | methods: { |
| 264 | 271 | defaultItem() { |
| 265 | - return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '' } | |
| 272 | + return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', totalAmount: 0, deliveryDate: '', sampleOrder: '' } | |
| 266 | 273 | }, |
| 267 | 274 | onNonNegativeInput(idx, field) { |
| 268 | 275 | const it = this.items[idx] |
| ... | ... | @@ -382,18 +389,38 @@ export default { |
| 382 | 389 | const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/') |
| 383 | 390 | return [t, w, l].filter(Boolean).join(' × ') |
| 384 | 391 | }, |
| 385 | - openProductSheet(idx) { | |
| 386 | - const opts = this.selectOptions | |
| 387 | - const current = this.items[idx] && this.items[idx].productId | |
| 388 | - const match = opts.find(o => o.value === current) | |
| 389 | - this.sheet = { ...this.sheet, visible: true, title: '请选择产品', options: opts, idx, value: match ? match.value : '' } | |
| 392 | + openProductSheet(idx, mode = 'product') { | |
| 393 | + let opts = [] | |
| 394 | + let title = '' | |
| 395 | + let value = '' | |
| 396 | + const item = this.items[idx] | |
| 397 | + | |
| 398 | + if (mode === 'product') { | |
| 399 | + opts = this.selectOptions | |
| 400 | + const current = item && item.productId | |
| 401 | + const match = opts.find(o => o.value === current) | |
| 402 | + value = match ? match.value : '' | |
| 403 | + title = '请选择产品' | |
| 404 | + } else if (mode === 'sampleOrder') { | |
| 405 | + opts = [{ label: '是', value: true }, { label: '否', value: false }] | |
| 406 | + value = item.sampleOrder | |
| 407 | + title = '是否为试样订单' | |
| 408 | + } | |
| 409 | + | |
| 410 | + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode } | |
| 390 | 411 | }, |
| 391 | 412 | onProductConfirm({ value, label }) { |
| 392 | - const idx = this.sheet.idx | |
| 413 | + const { idx, mode } = this.sheet | |
| 393 | 414 | const it = this.items[idx] |
| 394 | 415 | if (!it) { this.sheet.visible = false; return } |
| 395 | - it.productId = value | |
| 396 | - it.productName = label || '' | |
| 416 | + | |
| 417 | + if (mode === 'product') { | |
| 418 | + it.productId = value | |
| 419 | + it.productName = label || '' | |
| 420 | + } else if (mode === 'sampleOrder') { | |
| 421 | + it.sampleOrder = value | |
| 422 | + } | |
| 423 | + | |
| 397 | 424 | this.$set(this.items, idx, it) |
| 398 | 425 | this.sheet.visible = false |
| 399 | 426 | this.emitChange() | ... | ... |