Commit dd7c365b6b58a5518a977c3b46913051809ac8bd

Authored by 史婷婷
1 parent 82ed78cf

feat: 变更单&资信管理&撤销单-代码优化

@@ -574,6 +574,7 @@ export default { @@ -574,6 +574,7 @@ export default {
574 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 574 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
575 background: #fff; 575 background: #fff;
576 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 576 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  577 + z-index: 10;
577 578
578 .btn { 579 .btn {
579 height: 80rpx; 580 height: 80rpx;
@@ -494,6 +494,7 @@ export default { @@ -494,6 +494,7 @@ export default {
494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
495 background: #fff; 495 background: #fff;
496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  497 + z-index: 10;
497 498
498 .btn { 499 .btn {
499 height: 80rpx; 500 height: 80rpx;
@@ -186,24 +186,15 @@ export default { @@ -186,24 +186,15 @@ export default {
186 mode: { type: String, default: 'add' }, 186 mode: { type: String, default: 'add' },
187 list: { type: Array, default: () => [] }, 187 list: { type: Array, default: () => [] },
188 max: { type: Number, default: 8 }, 188 max: { type: Number, default: 8 },
189 - options: { type: Array, default: () => [] },  
190 totalQuantity: { type: Number, default: 0 } 189 totalQuantity: { type: Number, default: 0 }
191 }, 190 },
192 data() { 191 data() {
193 return { 192 return {
194 items: [], 193 items: [],
195 collapsedView: false, 194 collapsedView: false,
196 - sheet: { visible: false, title: '请选择性别', options: [], value: '', idx: -1 }  
197 } 195 }
198 }, 196 },
199 computed: { 197 computed: {
200 - selectOptions() {  
201 - const list = Array.isArray(this.options) ? this.options : []  
202 - return list.map(o => ({  
203 - label: o.label != null ? o.label : (o.text != null ? o.text : (o.name != null ? o.name : '')),  
204 - value: o.value != null ? o.value : (o.code != null ? o.code : (o.id != null ? o.id : o.productId))  
205 - }))  
206 - }  
207 }, 198 },
208 watch: { 199 watch: {
209 items: { 200 items: {
@@ -213,19 +204,13 @@ export default { @@ -213,19 +204,13 @@ export default {
213 list: { 204 list: {
214 handler(v) { 205 handler(v) {
215 const arr = Array.isArray(v) ? v : [] 206 const arr = Array.isArray(v) ? v : []
216 - const opts = this.selectOptions  
217 this.items = arr.map(x => { 207 this.items = arr.map(x => {
218 const it = { ...this.defaultItem(), ...x, collapsed: true } 208 const it = { ...this.defaultItem(), ...x, collapsed: true }
219 - const m = opts.find(o => String(o.value) === String(it.sex))  
220 - it.sexName = m ? (m.label || '') : it.sexName  
221 return it 209 return it
222 }) 210 })
223 }, 211 },
224 deep: true 212 deep: true
225 }, 213 },
226 - options: {  
227 - handler() { this.refreshSexNames() }  
228 - }  
229 }, 214 },
230 created() { 215 created() {
231 const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }] 216 const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }]
@@ -257,35 +242,7 @@ export default { @@ -257,35 +242,7 @@ export default {
257 assessmentExceedsAgreement: '' 242 assessmentExceedsAgreement: ''
258 } 243 }
259 }, 244 },
260 - getSexName(item) {  
261 - const opts = this.selectOptions  
262 - const v = item && item.sex  
263 - const m = opts.find(o => String(o.value) === String(v))  
264 - return m ? (m.label || '') : ((item && item.sexName) || '')  
265 - },  
266 - refreshSexNames() {  
267 - const opts = this.selectOptions  
268 - this.items = (this.items || []).map(it => {  
269 - const m = opts.find(o => String(o.value) === String(it.sex))  
270 - return { ...it, sexName: m ? (m.label || '') : it.sexName }  
271 - })  
272 - },  
273 - openProductSheet(idx) {  
274 - const opts = this.selectOptions  
275 - const current = this.items[idx] && this.items[idx].sex  
276 - const match = opts.find(o => o.value === current)  
277 - this.sheet = { ...this.sheet, visible: true, title: '请选择性别', options: opts, idx, value: match ? match.value : '' }  
278 - },  
279 - onProductConfirm({ value, label }) {  
280 - const idx = this.sheet.idx  
281 - const it = this.items[idx]  
282 - if (!it) { this.sheet.visible = false; return }  
283 - it.sex = value  
284 - it.sexName = label || ''  
285 - this.$set(this.items, idx, it)  
286 - this.sheet.visible = false  
287 - this.emitChange()  
288 - }, 245 +
289 onAdd() { 246 onAdd() {
290 if (this.items.length >= this.max) return uni.showToast({ title: `最多添加${this.max}个`, icon: 'none' }) 247 if (this.items.length >= this.max) return uni.showToast({ title: `最多添加${this.max}个`, icon: 'none' })
291 const obj = this.defaultItem() 248 const obj = this.defaultItem()
@@ -588,6 +588,7 @@ export default { @@ -588,6 +588,7 @@ export default {
588 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 588 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
589 background: #fff; 589 background: #fff;
590 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 590 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  591 + z-index: 10;
591 592
592 .btn { 593 .btn {
593 height: 80rpx; 594 height: 80rpx;
@@ -134,7 +134,6 @@ export default { @@ -134,7 +134,6 @@ export default {
134 title: { type: String, default: '' }, 134 title: { type: String, default: '' },
135 mode: { type: String, default: 'add' }, 135 mode: { type: String, default: 'add' },
136 list: { type: Array, default: () => [] }, 136 list: { type: Array, default: () => [] },
137 - max: { type: Number, default: 8 },  
138 options: { type: Array, default: () => [] } 137 options: { type: Array, default: () => [] }
139 }, 138 },
140 components: { SingleSelectSheet }, 139 components: { SingleSelectSheet },
@@ -214,7 +213,6 @@ export default { @@ -214,7 +213,6 @@ export default {
214 this.emitChange() 213 this.emitChange()
215 }, 214 },
216 onAdd() { 215 onAdd() {
217 - if (this.items.length >= this.max) return uni.showToast({ title: `最多添加${this.max}个`, icon: 'none' })  
218 const obj = this.defaultItem() 216 const obj = this.defaultItem()
219 obj.collapsed = true 217 obj.collapsed = true
220 this.items.push(obj) 218 this.items.push(obj)
@@ -595,6 +595,7 @@ export default { @@ -595,6 +595,7 @@ export default {
595 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 595 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
596 background: #fff; 596 background: #fff;
597 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 597 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  598 + z-index: 10;
598 599
599 .btn { 600 .btn {
600 height: 80rpx; 601 height: 80rpx;
@@ -455,6 +455,7 @@ @@ -455,6 +455,7 @@
455 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 455 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
456 background: #fff; 456 background: #fff;
457 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 457 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  458 + z-index: 10;
458 459
459 .btn { 460 .btn {
460 height: 80rpx; 461 height: 80rpx;
@@ -508,6 +508,7 @@ @@ -508,6 +508,7 @@
508 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 508 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
509 background: #fff; 509 background: #fff;
510 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 510 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  511 + z-index: 10;
511 512
512 .btn { 513 .btn {
513 height: 80rpx; 514 height: 80rpx;
@@ -474,6 +474,7 @@ export default { @@ -474,6 +474,7 @@ export default {
474 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 474 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
475 display: flex; 475 display: flex;
476 gap: 32rpx; 476 gap: 32rpx;
  477 + z-index: 10;
477 478
478 .btn { 479 .btn {
479 height: 80rpx; 480 height: 80rpx;
@@ -477,6 +477,7 @@ export default { @@ -477,6 +477,7 @@ export default {
477 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 477 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
478 background: #fff; 478 background: #fff;
479 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 479 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  480 + z-index: 10;
480 481
481 .btn { 482 .btn {
482 height: 80rpx; 483 height: 80rpx;
@@ -494,6 +494,7 @@ export default { @@ -494,6 +494,7 @@ export default {
494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
495 background: #fff; 495 background: #fff;
496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  497 + z-index: 10;
497 498
498 .btn { 499 .btn {
499 height: 80rpx; 500 height: 80rpx;
@@ -494,6 +494,7 @@ export default { @@ -494,6 +494,7 @@ export default {
494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); 494 padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
495 background: #fff; 495 background: #fff;
496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); 496 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  497 + z-index: 10;
497 498
498 .btn { 499 .btn {
499 height: 80rpx; 500 height: 80rpx;
@@ -127,14 +127,12 @@ @@ -127,14 +127,12 @@
127 </view> 127 </view>
128 </template> 128 </template>
129 <script> 129 <script>
130 -import { uuid } from '@/utils/uuid.js'  
131 export default { 130 export default {
132 name: 'Product', 131 name: 'Product',
133 props: { 132 props: {
134 title: { type: String, default: '' }, 133 title: { type: String, default: '' },
135 mode: { type: String, default: 'add' }, 134 mode: { type: String, default: 'add' },
136 list: { type: Array, default: () => [] }, 135 list: { type: Array, default: () => [] },
137 - max: { type: Number, default: 8 },  
138 totalQuantity: { type: Number, default: 0 }, 136 totalQuantity: { type: Number, default: 0 },
139 totalRevokeQuantity: { type: Number, default: 0 } 137 totalRevokeQuantity: { type: Number, default: 0 }
140 }, 138 },