Commit f3bc89a33d701d61ef9741348d5962d5d99f0417
1 parent
f555383d95
Exists in
master
验光填充
Showing
1 changed file
with
706 additions
and
142 deletions
Show diff stats
src/pages/purchaseLenses/purchaseLenses.vue
| ... | ... | @@ -36,7 +36,140 @@ |
| 36 | 36 | <view class="opCollapse"> |
| 37 | 37 | <view class="body"> |
| 38 | 38 | <template v-if="opIsOpen"> |
| 39 | - <view class="goods-form"> | |
| 39 | + <view class="goods-form"> | |
| 40 | + <view class="p1"> | |
| 41 | + <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image> | |
| 42 | + 填写验光数据 | |
| 43 | + </view> | |
| 44 | + <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> | |
| 45 | + <view class="picker"> | |
| 46 | + <view class="picker-choice"> | |
| 47 | + <view class="choice-left"> | |
| 48 | + <text class="pd">验光单取名:</text> | |
| 49 | + </view> | |
| 50 | + <input type="text" @blur="handleInput" class="input" | |
| 51 | + placeholder="请输入名称" maxlength="20" :value="name" /> | |
| 52 | + </view> | |
| 53 | + </view> | |
| 54 | + <view class="picker" > | |
| 55 | + <view class="picker-choice"> | |
| 56 | + <view class="choice-left"> | |
| 57 | + <text class="p11">{{pickerInfoList[0].nameC}}</text> | |
| 58 | + <text class="p12">{{pickerInfoList[0].nameE}}</text> | |
| 59 | + </view> | |
| 60 | + <text class="p13">左 (OD)</text> | |
| 61 | + <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> --> | |
| 62 | + <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> | |
| 63 | + <view class="p14"> | |
| 64 | + {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}} | |
| 65 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 66 | + </view> | |
| 67 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 68 | + </picker> | |
| 69 | + <text class="p13">右 (OS)</text> | |
| 70 | + <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> --> | |
| 71 | + <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> | |
| 72 | + <view class="p14"> | |
| 73 | + {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}} | |
| 74 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 75 | + </view> | |
| 76 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 77 | + </picker> | |
| 78 | + </view> | |
| 79 | + </view> | |
| 80 | + <view class="picker" > | |
| 81 | + <view class="picker-choice"> | |
| 82 | + <view class="choice-left"> | |
| 83 | + <text class="p11">{{pickerInfoList[1].nameC}}</text> | |
| 84 | + <text class="p12">{{pickerInfoList[1].nameE}}</text> | |
| 85 | + </view> | |
| 86 | + <text class="p13">左 (OD)</text> | |
| 87 | + <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> --> | |
| 88 | + <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> | |
| 89 | + <view class="p14"> | |
| 90 | + {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}} | |
| 91 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 92 | + </view> | |
| 93 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 94 | + </picker> | |
| 95 | + <text class="p13">右 (OS)</text> | |
| 96 | + <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> --> | |
| 97 | + <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> | |
| 98 | + <view class="p14"> | |
| 99 | + {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}} | |
| 100 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 101 | + </view> | |
| 102 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 103 | + </picker> | |
| 104 | + </view> | |
| 105 | + </view> | |
| 106 | + <view class="picker" > | |
| 107 | + <view class="picker-choice"> | |
| 108 | + <view class="choice-left"> | |
| 109 | + <text class="p11">{{pickerInfoList[2].nameC}}</text> | |
| 110 | + <text class="p12">{{pickerInfoList[2].nameE}}</text> | |
| 111 | + </view> | |
| 112 | + <text class="p13">左 (OD)</text> | |
| 113 | + <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> | |
| 114 | + <view class="p14"> | |
| 115 | + {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}} | |
| 116 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 117 | + </view> | |
| 118 | + </picker> | |
| 119 | + <text class="p13">右 (OS)</text> | |
| 120 | + <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> --> | |
| 121 | + <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> | |
| 122 | + <view class="p14"> | |
| 123 | + {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}} | |
| 124 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 125 | + </view> | |
| 126 | + <!-- <image src="../../static/detail-tabicon.png" ></image> --> | |
| 127 | + </picker> | |
| 128 | + </view> | |
| 129 | + </view> | |
| 130 | + <view class="picker"> | |
| 131 | + <view class="picker-choice"> | |
| 132 | + <view class="choice-left"> | |
| 133 | + <text class="pd">瞳距:</text> | |
| 134 | + </view> | |
| 135 | + <input type="digit" @change="handleInputPd" class="input" | |
| 136 | + placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> | |
| 137 | + </view> | |
| 138 | + </view> | |
| 139 | + <view class="picker" > | |
| 140 | + <view class="picker-choice"> | |
| 141 | + <view class="choice-left"> | |
| 142 | + <text class="p11">{{pickerInfoList[3].nameC}}</text> | |
| 143 | + </view> | |
| 144 | + <text class="p13-date">年 (Y)</text> | |
| 145 | + <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> | |
| 146 | + <view class="p14" style="width: 30px;"> | |
| 147 | + {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}} | |
| 148 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 149 | + </view> | |
| 150 | + </picker> | |
| 151 | + <text class="p13-date">月 (M)</text> | |
| 152 | + <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> | |
| 153 | + <view class="p14" style="width: 30px;"> | |
| 154 | + {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}} | |
| 155 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 156 | + </view> | |
| 157 | + </picker> | |
| 158 | + <text class="p13-date">日 (D)</text> | |
| 159 | + <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> | |
| 160 | + <view class="p14" style="width: 30px;"> | |
| 161 | + {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}} | |
| 162 | + <image src="../../static/detail-tabicon.png" ></image> | |
| 163 | + </view> | |
| 164 | + </picker> | |
| 165 | + </view> | |
| 166 | + </view> | |
| 167 | + <view class="confirm"> | |
| 168 | + <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> | |
| 169 | + <text>确认以上输入信息来源于我的验光数据!</text> | |
| 170 | + </view> | |
| 171 | + </view> | |
| 172 | + <!-- <view class="goods-form"> | |
| 40 | 173 | <view class="data-title"> |
| 41 | 174 | <image src="../../static/icon-data.png"></image> |
| 42 | 175 | <text class="p1">填写验光数据</text> |
| ... | ... | @@ -209,7 +342,7 @@ |
| 209 | 342 | ></image> |
| 210 | 343 | <text>确认以上输入信息来源于我的验光数据!</text> |
| 211 | 344 | </view> |
| 212 | - </view> | |
| 345 | + </view> --> | |
| 213 | 346 | |
| 214 | 347 | </template> |
| 215 | 348 | <template v-else> |
| ... | ... | @@ -417,13 +550,33 @@ export default { |
| 417 | 550 | ], |
| 418 | 551 | chooseItem3: [0, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 470, 500, 525, 550, 575, 600, 1000], |
| 419 | 552 | // 度数相关数据 |
| 420 | - pickerInfoList: [ | |
| 421 | - { nameC: '度数', nameE: '(SPH)', nameArray1: [1.5, 2.5, 3.5, 4.5], nameIndex1: 0, nameArray2: [1.5, 2.5, 3.5, 4.5], nameIndex2: 0, key: 0 }, | |
| 422 | - { nameC: '散光', nameE: '(CYL)', nameArray1: [1.5, 2.5, 3.5, 4.5], nameIndex1: 0, nameArray2: [1.5, 2.5, 3.5, 4.5], nameIndex2: 0, key: 1 }, | |
| 423 | - { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [1.5, 2.5, 3.5, 4.5], nameIndex1: 0, nameArray2: [1.5, 2.5, 3.5, 4.5], nameIndex2: 0, key: 2 }, | |
| 424 | - { nameC: '双眼瞳距', nameE: '(PD)', nameArray1: [1.5, 2.5, 3.5, 4.5], nameIndex1: 0, nameArray2: [1.5, 2.5, 3.5, 4.5], nameIndex2: 0, key: 3 }, | |
| 425 | - { nameC: '验光日期', nameE: '', nameArray1: [2017, 2018, 2019, 2020, 2021], nameIndex1: 0, nameArray2: [1, 2, 3, 4, 5, 6, 7], nameIndex2: 0, nameArray3: [1, 2, 3, 4, 5, 6], nameIndex3: 0 } | |
| 426 | - ] | |
| 553 | + pickerInfoList:[ | |
| 554 | + {nameC:"度数",nameE:"(SPH)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:0}, | |
| 555 | + {nameC:"散光",nameE:"(CYL)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:1}, | |
| 556 | + {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[''],nameIndex1:0,nameArray2:[''],nameIndex2:0,key:2}, | |
| 557 | + {nameC:"验光日期",nameE:'',nameArray1:[''],nameIndex1:0,nameArray2:['',1,2,3,4,5,6,7,8,9,10,11,12],nameIndex2:0,nameArray3:[''],nameIndex3:0} | |
| 558 | + ], | |
| 559 | + confirm: false, // 用户是否确认 | |
| 560 | + tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], | |
| 561 | + name: '夏小花', | |
| 562 | + oldname:'',// 用于判读用户是否改变名字 | |
| 563 | + pickerInfoChioce:{ | |
| 564 | + "leftSph": '', | |
| 565 | + "rightSph": '', | |
| 566 | + "leftCyl": '', | |
| 567 | + "rightCyl": '', | |
| 568 | + "leftAxi": '', | |
| 569 | + "rightAxi": '', | |
| 570 | + "time":{ | |
| 571 | + "year":0, | |
| 572 | + "month": 0, | |
| 573 | + "day":0 , | |
| 574 | + } | |
| 575 | + }, | |
| 576 | + pd: '',// 瞳距 | |
| 577 | + oldpd: '',// 用于判断用户是否改变瞳距 | |
| 578 | + kinds:1, // kinds=1,提交为新增验光,2为修改 | |
| 579 | + mp_id: Number | |
| 427 | 580 | } |
| 428 | 581 | }, |
| 429 | 582 | computed: { |
| ... | ... | @@ -452,30 +605,168 @@ export default { |
| 452 | 605 | this.show = show |
| 453 | 606 | }) |
| 454 | 607 | store.dispatch('myLoveList/getLoveList') |
| 608 | + | |
| 609 | + // 初始化SPL、CYL、AXI的值 | |
| 610 | + for (let j = 0; j < 3; j++) { | |
| 611 | + for(let i=-12;i<6;i++){ | |
| 612 | + this.pickerInfoList[j].nameArray1.push(i) | |
| 613 | + this.pickerInfoList[j].nameArray1.push(i+0.5) | |
| 614 | + this.pickerInfoList[j].nameArray2.push(i) | |
| 615 | + this.pickerInfoList[j].nameArray2.push(i+0.5) | |
| 616 | + if(i>=-6){ | |
| 617 | + this.pickerInfoList[j].nameArray1.push(i+0.25) | |
| 618 | + this.pickerInfoList[j].nameArray1.push(i+0.75) | |
| 619 | + this.pickerInfoList[j].nameArray2.push(i+0.25) | |
| 620 | + this.pickerInfoList[j].nameArray2.push(i+0.75) | |
| 621 | + } | |
| 622 | + if(i==5){ | |
| 623 | + this.pickerInfoList[j].nameArray1.push(i+1) | |
| 624 | + this.pickerInfoList[j].nameArray2.push(i+1) | |
| 625 | + } | |
| 626 | + } | |
| 627 | + } | |
| 628 | + // 初始化日期值 | |
| 629 | + for (let i = 1; i < 32; i++){ | |
| 630 | + this.pickerInfoList[3].nameArray3.push(i) | |
| 631 | + } | |
| 632 | + // 初始化年份前后五年 | |
| 633 | + let myDate = new Date(); | |
| 634 | + let nowYear = myDate.getFullYear(); | |
| 635 | + for(let i=0;i<5;i++){ | |
| 636 | + this.pickerInfoList[3].nameArray1.push(nowYear-i) | |
| 637 | + } | |
| 455 | 638 | }, |
| 456 | 639 | methods: { |
| 640 | + // picker相关功能 | |
| 641 | + handleInput(e){ | |
| 642 | + this.name=e.target.value | |
| 643 | + this.isDataName = false | |
| 644 | + console.log('e---->', e) | |
| 645 | + const mpList = this.mpList | |
| 646 | + console.log('mpList===>',mpList) | |
| 647 | + for (let index = 0; index < mpList.length; index++) { | |
| 648 | + if (e.detail.value === mpList[index].name) { | |
| 649 | + this.isDataName = true | |
| 650 | + uni.showModal({ | |
| 651 | + title: '提示', | |
| 652 | + content: `是否填充已有的"${e.detail.value}"的数据`, | |
| 653 | + success: ({ confirm }) => { | |
| 654 | + if (confirm) { | |
| 655 | + this.kinds=2 | |
| 656 | + console.log('args===>',index) | |
| 657 | + // const mpList=Object.assign({},this.$store.state.mympList.mpList) | |
| 658 | + console.log('mpList===>',mpList) | |
| 659 | + this.name=mpList[index].name | |
| 660 | + this.pd=mpList[index].pd | |
| 661 | + this.mp_id=mpList[index].mp_id | |
| 662 | + this.oldname=mpList[index].name | |
| 663 | + this.oldpd=mpList[index].pd | |
| 664 | + // 将kinds =2时的值传到该页面 | |
| 665 | + this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph) | |
| 666 | + this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph) | |
| 667 | + this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl) | |
| 668 | + this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl) | |
| 669 | + this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi) | |
| 670 | + this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi) | |
| 671 | + | |
| 672 | + this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0,4)) | |
| 673 | + if(mpList[index].in_time.toString().slice(5,6)==0){ | |
| 674 | + this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6,7)) | |
| 675 | + } else{ | |
| 676 | + this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5,7)) | |
| 677 | + } | |
| 678 | + if(mpList[index].in_time.toString().slice(8,9)==0){ | |
| 679 | + this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9,10)) | |
| 680 | + } else{ | |
| 681 | + this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8,10)) | |
| 682 | + } | |
| 683 | + // this.checkedData = mpList[index] | |
| 684 | + // console.log('checkedData', this.checkedData) | |
| 685 | + } | |
| 686 | + } | |
| 687 | + }) | |
| 688 | + } | |
| 689 | + } | |
| 690 | + }, | |
| 691 | + handleInputPd(e){ | |
| 692 | + // 只能输入正浮点数或正数 | |
| 693 | + if(/^\d+(\.\d+)?$/.test(e.target.value)){ | |
| 694 | + this.pd=e.target.value | |
| 695 | + } else { | |
| 696 | + uni.showToast({ | |
| 697 | + title:"请输入有效数据;示例:89", | |
| 698 | + icon: "none", | |
| 699 | + duration: 2000, | |
| 700 | + }) | |
| 701 | + this.pd = '' | |
| 702 | + } | |
| 703 | + | |
| 704 | + }, | |
| 705 | + changeConfirm() { | |
| 706 | + this.confirm = !this.confirm | |
| 707 | + }, | |
| 708 | + bindPickerChange01: function(e) { | |
| 709 | + this.pickerInfoList[0].nameIndex1 = e.target.value | |
| 710 | + this.pickerInfoChioce.leftSph=this.pickerInfoList[0].nameArray1[e.target.value] | |
| 711 | + }, | |
| 712 | + bindPickerChange02: function(e) { | |
| 713 | + this.pickerInfoList[0].nameIndex2 = e.target.value | |
| 714 | + this.pickerInfoChioce.rightSph=this.pickerInfoList[0].nameArray2[e.target.value] | |
| 715 | + }, | |
| 716 | + | |
| 717 | + bindPickerChange11: function(e) { | |
| 718 | + this.pickerInfoList[1].nameIndex1 = e.target.value | |
| 719 | + this.pickerInfoChioce.leftCyl=this.pickerInfoList[1].nameArray1[e.target.value] | |
| 720 | + }, | |
| 721 | + bindPickerChange12: function(e) { | |
| 722 | + this.pickerInfoList[1].nameIndex2 = e.target.value | |
| 723 | + this.pickerInfoChioce.rightCyl=this.pickerInfoList[1].nameArray2[e.target.value] | |
| 724 | + }, | |
| 725 | + | |
| 726 | + bindPickerChange21: function(e) { | |
| 727 | + this.pickerInfoList[2].nameIndex1 = e.target.value | |
| 728 | + this.pickerInfoChioce.leftAxi=this.pickerInfoList[2].nameArray1[e.target.value] | |
| 729 | + }, | |
| 730 | + bindPickerChange22: function(e) { | |
| 731 | + this.pickerInfoList[2].nameIndex2 = e.target.value | |
| 732 | + this.pickerInfoChioce.rightAxi=this.pickerInfoList[2].nameArray2[e.target.value] | |
| 733 | + }, | |
| 734 | + | |
| 735 | + bindPickerChange41: function(e) { | |
| 736 | + this.pickerInfoList[3].nameIndex1 = e.target.value | |
| 737 | + this.pickerInfoChioce.time.year=this.pickerInfoList[3].nameArray1[e.target.value] | |
| 738 | + }, | |
| 739 | + bindPickerChange42: function(e) { | |
| 740 | + this.pickerInfoList[3].nameIndex2 = e.target.value | |
| 741 | + this.pickerInfoChioce.time.month=this.pickerInfoList[3].nameArray2[e.target.value] | |
| 742 | + }, | |
| 743 | + bindPickerChange43: function(e) { | |
| 744 | + this.pickerInfoList[3].nameIndex3 = e.target.value | |
| 745 | + this.pickerInfoChioce.time.day=this.pickerInfoList[3].nameArray3[e.target.value] | |
| 746 | + }, | |
| 747 | + | |
| 457 | 748 | // 是否填充人员数据 |
| 458 | - fillData(e) { | |
| 459 | - this.isDataName = false | |
| 460 | - console.log('e---->', e) | |
| 461 | - const mpList = this.mpList | |
| 749 | + // fillData(e) { | |
| 750 | + // this.isDataName = false | |
| 751 | + // console.log('e---->', e) | |
| 752 | + // const mpList = this.mpList | |
| 462 | 753 | |
| 463 | - for (let index = 0; index < mpList.length; index++) { | |
| 464 | - if (e.detail.value === mpList[index].name) { | |
| 465 | - this.isDataName = true | |
| 466 | - uni.showModal({ | |
| 467 | - title: '提示', | |
| 468 | - content: `是否填充已有的${e.detail.value}的数据`, | |
| 469 | - success: ({ confirm }) => { | |
| 470 | - if (confirm) { | |
| 471 | - this.checkedData = mpList[index] | |
| 472 | - console.log('checkedData', this.checkedData) | |
| 473 | - } | |
| 474 | - } | |
| 475 | - }) | |
| 476 | - } | |
| 477 | - } | |
| 478 | - }, | |
| 754 | + // for (let index = 0; index < mpList.length; index++) { | |
| 755 | + // if (e.detail.value === mpList[index].name) { | |
| 756 | + // this.isDataName = true | |
| 757 | + // uni.showModal({ | |
| 758 | + // title: '提示', | |
| 759 | + // content: `是否填充已有的${e.detail.value}的数据`, | |
| 760 | + // success: ({ confirm }) => { | |
| 761 | + // if (confirm) { | |
| 762 | + // this.checkedData = mpList[index] | |
| 763 | + // console.log('checkedData', this.checkedData) | |
| 764 | + // } | |
| 765 | + // } | |
| 766 | + // }) | |
| 767 | + // } | |
| 768 | + // } | |
| 769 | + // }, | |
| 479 | 770 | change(num) { |
| 480 | 771 | this.show[num] = !this.show[num] |
| 481 | 772 | this.$forceUpdate() |
| ... | ... | @@ -512,28 +803,176 @@ export default { |
| 512 | 803 | } |
| 513 | 804 | }, |
| 514 | 805 | toComfirmOrder() { |
| 515 | - let i = 0 | |
| 516 | - // 判断出是哪一个sku被选中 | |
| 517 | - for (let index = 0; index < this.current.length; index++) { | |
| 518 | - console.log('index', index, i, index !== this.current.length - 1) | |
| 519 | - if (index !== this.current.length - 1) { | |
| 520 | - console.log('----', this.current[index], this.attrList[1].attr.length, this.attrList) | |
| 521 | - i = this.current[index] * this.attrList[1].attr.length | |
| 522 | - } else { | |
| 523 | - i += this.current[index] | |
| 524 | - } | |
| 525 | - console.log('i', i) | |
| 526 | - } | |
| 527 | - console.log('i------>', i) | |
| 528 | - // 判断是否其输入的人员数据是否已存在 | |
| 529 | - store.dispatch('order/saveParams', { | |
| 530 | - sk_id_arr: this.skuList[i], | |
| 531 | - current: this.current | |
| 532 | - }) | |
| 806 | + // 先处理验光部分的逻辑,如果ok在跳转 | |
| 807 | + let flag=0; | |
| 808 | + if(this.name==''){ | |
| 809 | + uni.showToast({ | |
| 810 | + title:"请输入验光单取名", | |
| 811 | + icon: "none", | |
| 812 | + duration: 2000, | |
| 813 | + }) | |
| 814 | + }else{ | |
| 815 | + | |
| 816 | + if(this.pd==''){ | |
| 817 | + uni.showToast({ | |
| 818 | + title:"请输入瞳距", | |
| 819 | + icon: "none", | |
| 820 | + duration: 2000, | |
| 821 | + }) | |
| 822 | + }else{ | |
| 823 | + | |
| 824 | + if(this.kinds==1){ | |
| 825 | + // 添加用户验光单 | |
| 826 | + console.log('kinds====>',this.pickerInfoChioce.leftSph) | |
| 827 | + console.log('kinds====>',this.pickerInfoChioce.leftSph==Number) | |
| 828 | + console.log('kinds====>',this.pickerInfoChioce.rightSph==Number) | |
| 829 | + if(this.pickerInfoChioce.rightSph==''||this.pickerInfoChioce.leftSph==''|| | |
| 830 | + this.pickerInfoChioce.leftCyl==''||this.pickerInfoChioce.rightCyl==''|| | |
| 831 | + this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi=='' | |
| 832 | + ){ | |
| 833 | + uni.showToast({ | |
| 834 | + title:"请输入您的验光数据", | |
| 835 | + icon: "none", | |
| 836 | + duration: 2000, | |
| 837 | + }) | |
| 838 | + }else{ | |
| 839 | + if(this.confirm){ | |
| 840 | + store.dispatch('myLoveList/addMylove', { | |
| 841 | + uid: this.$store.state.user.userInfo.uid, | |
| 842 | + openid: this.$store.state.user.userInfo.openid, | |
| 843 | + // mp_name: this.$store.state.user.userInfo.mp_name, | |
| 844 | + leftSph: this.pickerInfoChioce.leftSph, | |
| 845 | + rightSph: this.pickerInfoChioce.rightSph, | |
| 846 | + leftCyl: this.pickerInfoChioce.leftCyl, | |
| 847 | + rightCyl: this.pickerInfoChioce.rightCyl, | |
| 848 | + leftAxi: this.pickerInfoChioce.leftAxi, | |
| 849 | + rightAxi: this.pickerInfoChioce.rightAxi, | |
| 850 | + pd: this.pd,// 瞳距 | |
| 851 | + mp_name:this.name, | |
| 852 | + // time: this.pickerInfoChioce.time, | |
| 853 | + // img_url2: "http://localhost:8087/images/shop_1/1/", | |
| 854 | + }); | |
| 855 | + store.dispatch('myLoveList/getLoveList', { | |
| 856 | + uid: this.$store.state.user.userInfo.uid, | |
| 857 | + }); | |
| 858 | + flag=1 | |
| 859 | + } else{ | |
| 860 | + uni.showToast({ | |
| 861 | + title:"请确认您的验光数据", | |
| 862 | + icon: "none", | |
| 863 | + duration: 3000, | |
| 864 | + }) | |
| 865 | + } | |
| 866 | + } | |
| 867 | + } | |
| 868 | + if(this.kinds==2){ | |
| 869 | + // console.log('kinds====>',this.kinds) | |
| 870 | + // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1) | |
| 871 | + // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce)) | |
| 872 | + if(this.confirm){ | |
| 873 | + const leftList = ["leftSph","leftCyl","leftAxi"]; | |
| 874 | + const rightList = ["rightSph", "rightCyl", "rightAxi"]; | |
| 875 | + // let flag=0; | |
| 876 | + if(this.name!=this.oldname){ | |
| 877 | + store.dispatch('myLoveList/updateMylove', { | |
| 878 | + uid: this.$store.state.user.userInfo.uid, | |
| 879 | + openid: this.$store.state.user.userInfo.openid, | |
| 880 | + mp_id: this.mp_id, | |
| 881 | + keyname: 'name', | |
| 882 | + keyvalue: this.name, | |
| 883 | + }); | |
| 884 | + flag=1 | |
| 885 | + } | |
| 886 | + if(this.pd!=this.oldpd){ | |
| 887 | + store.dispatch('myLoveList/updateMylove', { | |
| 888 | + uid: this.$store.state.user.userInfo.uid, | |
| 889 | + openid: this.$store.state.user.userInfo.openid, | |
| 890 | + mp_id: this.mp_id, | |
| 891 | + keyname: 'pd', | |
| 892 | + keyvalue: this.pd, | |
| 893 | + }); | |
| 894 | + flag=1 | |
| 895 | + } | |
| 896 | + // 先验证是否输入有无空 | |
| 897 | + let q= true; | |
| 898 | + for(let k=0; k<3;k++){ | |
| 899 | + q=q&&(this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1]!=''&& | |
| 900 | + this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2]!='') | |
| 901 | + } | |
| 902 | + if(q){ | |
| 903 | + | |
| 904 | + for (let j=0; j<3; j++) { | |
| 905 | + if(this.pickerInfoList[j].nameIndex1!=0){ | |
| 906 | + store.dispatch('myLoveList/updateMylove', { | |
| 907 | + uid: this.$store.state.user.userInfo.uid, | |
| 908 | + openid: this.$store.state.user.userInfo.openid, | |
| 909 | + mp_id: this.mp_id, | |
| 910 | + keyname: leftList[j], | |
| 911 | + keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], | |
| 912 | + }); | |
| 913 | + } | |
| 914 | + if(this.pickerInfoList[j].nameIndex2!=0){ | |
| 915 | + store.dispatch('myLoveList/updateMylove', { | |
| 916 | + uid: this.$store.state.user.userInfo.uid, | |
| 917 | + openid: this.$store.state.user.userInfo.openid, | |
| 918 | + mp_id: this.mp_id, | |
| 919 | + keyname: rightList[j], | |
| 920 | + keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2] | |
| 921 | + }); | |
| 922 | + } | |
| 923 | + flag=1; | |
| 924 | + } | |
| 925 | + }else{ | |
| 926 | + flag=0; | |
| 927 | + uni.showToast({ | |
| 928 | + title:"请输入您的验光数据", | |
| 929 | + icon: "none", | |
| 930 | + duration: 2000, | |
| 931 | + }) | |
| 932 | + | |
| 933 | + } | |
| 934 | + if(flag!=0){ | |
| 935 | + store.dispatch('myLoveList/getLoveList', { | |
| 936 | + uid: this.$store.state.user.userInfo.uid, | |
| 937 | + }); | |
| 938 | + } | |
| 939 | + | |
| 940 | + } else{ | |
| 941 | + uni.showToast({ | |
| 942 | + title:"请确认您的验光数据", | |
| 943 | + icon: "none", | |
| 944 | + duration: 3000, | |
| 945 | + }) | |
| 946 | + } | |
| 947 | + } | |
| 948 | + } | |
| 949 | + | |
| 950 | + } | |
| 951 | + if(flag!=0){ | |
| 952 | + let i = 0 | |
| 953 | + // 判断出是哪一个sku被选中 | |
| 954 | + for (let index = 0; index < this.current.length; index++) { | |
| 955 | + console.log('index', index, i, index !== this.current.length - 1) | |
| 956 | + if (index !== this.current.length - 1) { | |
| 957 | + console.log('----', this.current[index], this.attrList[1].attr.length, this.attrList) | |
| 958 | + i = this.current[index] * this.attrList[1].attr.length | |
| 959 | + } else { | |
| 960 | + i += this.current[index] | |
| 961 | + } | |
| 962 | + console.log('i', i) | |
| 963 | + } | |
| 964 | + console.log('i------>', i) | |
| 965 | + // 判断是否其输入的人员数据是否已存在 | |
| 966 | + store.dispatch('order/saveParams', { | |
| 967 | + sk_id_arr: this.skuList[i], | |
| 968 | + current: this.current | |
| 969 | + }) | |
| 970 | + | |
| 971 | + uni.navigateTo({ | |
| 972 | + url: `../confirmOrder/confirmOrder?pid=${this.pid}` | |
| 973 | + }) | |
| 974 | + } | |
| 533 | 975 | |
| 534 | - uni.navigateTo({ | |
| 535 | - url: `../confirmOrder/confirmOrder?pid=${this.pid}` | |
| 536 | - }) | |
| 537 | 976 | } |
| 538 | 977 | } |
| 539 | 978 | } |
| ... | ... | @@ -681,98 +1120,223 @@ export default { |
| 681 | 1120 | } |
| 682 | 1121 | } |
| 683 | 1122 | } |
| 684 | - .goods-form { | |
| 685 | - display: flex; | |
| 686 | - flex-direction: column; | |
| 687 | - align-items: center; | |
| 688 | - justify-content: center; | |
| 689 | - background-color: #fff; | |
| 690 | - width: 100%; | |
| 691 | - .p1 { | |
| 692 | - font-size: 16px; | |
| 693 | - color: #333333; | |
| 694 | - letter-spacing: -0.3px; | |
| 695 | - text-align: justify; | |
| 696 | - line-height: 24px; | |
| 697 | - margin: 4px 0; | |
| 698 | - } | |
| 699 | - .p2 { | |
| 700 | - font-size: 12px; | |
| 701 | - color: #999999; | |
| 702 | - letter-spacing: -0.23px; | |
| 703 | - margin-bottom: 18rpx; | |
| 704 | - } | |
| 705 | - image { | |
| 706 | - width: 28rpx; | |
| 707 | - height: 26rpx; | |
| 708 | - } | |
| 709 | - .confirm { | |
| 710 | - display: flex; | |
| 711 | - align-items: center; | |
| 712 | - font-size: 12px; | |
| 713 | - color: #666666; | |
| 714 | - letter-spacing: -0.23px; | |
| 715 | - width: 684rpx; | |
| 716 | - image { | |
| 717 | - margin-right: 25rpx; | |
| 718 | - } | |
| 719 | - } | |
| 720 | - .picker { | |
| 721 | - display: flex; | |
| 722 | - flex-direction: column; | |
| 723 | - justify-content: center; | |
| 724 | - align-items: center; | |
| 725 | - width: 100%; | |
| 726 | - image { | |
| 727 | - width: 10px; | |
| 728 | - height: 10px; | |
| 729 | - margin-right: 5px; | |
| 730 | - } | |
| 731 | - .picker-choice { | |
| 732 | - display: flex; | |
| 733 | - width: 684rpx; | |
| 734 | - align-items: center; | |
| 735 | - margin-bottom: 40rpx; | |
| 736 | - .choice-left { | |
| 737 | - width: 210rpx; | |
| 738 | - .p11 { | |
| 739 | - font-size: 14px; | |
| 740 | - color: #333333; | |
| 741 | - letter-spacing: -0.26px; | |
| 742 | - text-align: justify; | |
| 743 | - line-height: 24px; | |
| 744 | - } | |
| 745 | - .p12 { | |
| 746 | - font-size: 10px; | |
| 747 | - color: #3f3f3f; | |
| 748 | - letter-spacing: -0.19px; | |
| 749 | - text-align: justify; | |
| 750 | - line-height: 24px; | |
| 751 | - } | |
| 752 | - } | |
| 753 | - .p13 { | |
| 754 | - font-size: 10px; | |
| 755 | - color: #999999; | |
| 756 | - letter-spacing: -0.19px; | |
| 757 | - margin-right: 10px; | |
| 758 | - } | |
| 759 | - .p13-date { | |
| 760 | - font-size: 10px; | |
| 761 | - color: #999999; | |
| 762 | - letter-spacing: -0.19px; | |
| 763 | - margin-right: 5px; | |
| 764 | - } | |
| 765 | - .p14 { | |
| 766 | - font-size: 14px; | |
| 767 | - color: #666666; | |
| 768 | - letter-spacing: -0.26px; | |
| 769 | - text-align: center; | |
| 770 | - width: 124rpx; | |
| 771 | - border-bottom: 1px solid #cfcfcf; | |
| 772 | - } | |
| 773 | - } | |
| 774 | - } | |
| 775 | - } | |
| 1123 | + | |
| 1124 | + // .goods-form { | |
| 1125 | + // display: flex; | |
| 1126 | + // flex-direction: column; | |
| 1127 | + // align-items: center; | |
| 1128 | + // justify-content: center; | |
| 1129 | + // background-color: #fff; | |
| 1130 | + // width: 100%; | |
| 1131 | + // .p1 { | |
| 1132 | + // font-size: 16px; | |
| 1133 | + // color: #333333; | |
| 1134 | + // letter-spacing: -0.3px; | |
| 1135 | + // text-align: justify; | |
| 1136 | + // line-height: 24px; | |
| 1137 | + // margin: 4px 0; | |
| 1138 | + // } | |
| 1139 | + // .p2 { | |
| 1140 | + // font-size: 12px; | |
| 1141 | + // color: #999999; | |
| 1142 | + // letter-spacing: -0.23px; | |
| 1143 | + // margin-bottom: 18rpx; | |
| 1144 | + // } | |
| 1145 | + // image { | |
| 1146 | + // width: 28rpx; | |
| 1147 | + // height: 26rpx; | |
| 1148 | + // } | |
| 1149 | + // .confirm { | |
| 1150 | + // display: flex; | |
| 1151 | + // align-items: center; | |
| 1152 | + // font-size: 12px; | |
| 1153 | + // color: #666666; | |
| 1154 | + // letter-spacing: -0.23px; | |
| 1155 | + // width: 684rpx; | |
| 1156 | + // image { | |
| 1157 | + // margin-right: 25rpx; | |
| 1158 | + // } | |
| 1159 | + // } | |
| 1160 | + // .picker { | |
| 1161 | + // display: flex; | |
| 1162 | + // flex-direction: column; | |
| 1163 | + // justify-content: center; | |
| 1164 | + // align-items: center; | |
| 1165 | + // width: 100%; | |
| 1166 | + // image { | |
| 1167 | + // width: 10px; | |
| 1168 | + // height: 10px; | |
| 1169 | + // margin-right: 5px; | |
| 1170 | + // } | |
| 1171 | + // .picker-choice { | |
| 1172 | + // display: flex; | |
| 1173 | + // width: 684rpx; | |
| 1174 | + // align-items: center; | |
| 1175 | + // margin-bottom: 40rpx; | |
| 1176 | + // .choice-left { | |
| 1177 | + // width: 210rpx; | |
| 1178 | + // .p11 { | |
| 1179 | + // font-size: 14px; | |
| 1180 | + // color: #333333; | |
| 1181 | + // letter-spacing: -0.26px; | |
| 1182 | + // text-align: justify; | |
| 1183 | + // line-height: 24px; | |
| 1184 | + // } | |
| 1185 | + // .p12 { | |
| 1186 | + // font-size: 10px; | |
| 1187 | + // color: #3f3f3f; | |
| 1188 | + // letter-spacing: -0.19px; | |
| 1189 | + // text-align: justify; | |
| 1190 | + // line-height: 24px; | |
| 1191 | + // } | |
| 1192 | + // } | |
| 1193 | + // .p13 { | |
| 1194 | + // font-size: 10px; | |
| 1195 | + // color: #999999; | |
| 1196 | + // letter-spacing: -0.19px; | |
| 1197 | + // margin-right: 10px; | |
| 1198 | + // } | |
| 1199 | + // .p13-date { | |
| 1200 | + // font-size: 10px; | |
| 1201 | + // color: #999999; | |
| 1202 | + // letter-spacing: -0.19px; | |
| 1203 | + // margin-right: 5px; | |
| 1204 | + // } | |
| 1205 | + // .p14 { | |
| 1206 | + // font-size: 14px; | |
| 1207 | + // color: #666666; | |
| 1208 | + // letter-spacing: -0.26px; | |
| 1209 | + // text-align: center; | |
| 1210 | + // width: 124rpx; | |
| 1211 | + // border-bottom: 1px solid #cfcfcf; | |
| 1212 | + // } | |
| 1213 | + // } | |
| 1214 | + // } | |
| 1215 | + // } | |
| 1216 | + .goods-form { | |
| 1217 | + display: flex; | |
| 1218 | + flex-direction: column; | |
| 1219 | + align-items: center; | |
| 1220 | + justify-content: center; | |
| 1221 | + background-color: #fff; | |
| 1222 | + width: 100%; | |
| 1223 | + padding: 40rpx 0; | |
| 1224 | + .p1 { | |
| 1225 | + font-size: 16px; | |
| 1226 | + color: #333333; | |
| 1227 | + letter-spacing: -0.3px; | |
| 1228 | + text-align: justify; | |
| 1229 | + line-height: 24px; | |
| 1230 | + margin: 4px 0; | |
| 1231 | + | |
| 1232 | + } | |
| 1233 | + .p2 { | |
| 1234 | + font-size: 12px; | |
| 1235 | + color: #999999; | |
| 1236 | + letter-spacing: -0.23px; | |
| 1237 | + margin-bottom: 32rpx; | |
| 1238 | + } | |
| 1239 | + .image2{ | |
| 1240 | + width: 42rpx; | |
| 1241 | + height: 34rpx; | |
| 1242 | + margin-right: 12rpx; | |
| 1243 | + } | |
| 1244 | + .confirm { | |
| 1245 | + display: flex; | |
| 1246 | + align-items: center; | |
| 1247 | + font-size: 12px; | |
| 1248 | + color: #666666; | |
| 1249 | + letter-spacing: -0.23px; | |
| 1250 | + width: 684rpx; | |
| 1251 | + .image1{ | |
| 1252 | + margin-right:25rpx; | |
| 1253 | + width: 42rpx; | |
| 1254 | + height: 38rpx; | |
| 1255 | + } | |
| 1256 | + } | |
| 1257 | + .picker{ | |
| 1258 | + display: flex; | |
| 1259 | + flex-direction: column; | |
| 1260 | + justify-content: center; | |
| 1261 | + align-items: center; | |
| 1262 | + width: 100%; | |
| 1263 | + | |
| 1264 | + .picker-choice{ | |
| 1265 | + display: flex; | |
| 1266 | + width: 684rpx; | |
| 1267 | + align-items: center; | |
| 1268 | + margin-bottom: 40rpx; | |
| 1269 | + .input{ | |
| 1270 | + border-bottom: 1px solid #CFCFCF; | |
| 1271 | + height: 40rpx; | |
| 1272 | + } | |
| 1273 | + .choice-left{ | |
| 1274 | + width: 210rpx; | |
| 1275 | + .pd{ | |
| 1276 | + font-size: 14px; | |
| 1277 | + color: #333333; | |
| 1278 | + letter-spacing: -0.26px; | |
| 1279 | + text-align: justify; | |
| 1280 | + line-height: 24px; | |
| 1281 | + margin-right: 44rpx; | |
| 1282 | + } | |
| 1283 | + .p11 { | |
| 1284 | + font-size: 14px; | |
| 1285 | + color: #333333; | |
| 1286 | + letter-spacing: -0.26px; | |
| 1287 | + text-align: justify; | |
| 1288 | + line-height: 24px; | |
| 1289 | + // margin-right: 10px; | |
| 1290 | + } | |
| 1291 | + .p12 { | |
| 1292 | + font-size: 10px; | |
| 1293 | + color: #3F3F3F; | |
| 1294 | + letter-spacing: -0.19px; | |
| 1295 | + text-align: justify; | |
| 1296 | + line-height: 24px; | |
| 1297 | + } | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + } | |
| 1301 | + .p13 { | |
| 1302 | + font-size: 10px; | |
| 1303 | + color: #999999; | |
| 1304 | + letter-spacing: -0.19px; | |
| 1305 | + margin-right: 10px; | |
| 1306 | + } | |
| 1307 | + .p13-date { | |
| 1308 | + font-size: 10px; | |
| 1309 | + color: #999999; | |
| 1310 | + letter-spacing: -0.19px; | |
| 1311 | + margin-right: 5px; | |
| 1312 | + } | |
| 1313 | + picker{ | |
| 1314 | + width: 144rpx; | |
| 1315 | + height: 40rpx; | |
| 1316 | + display: flex; | |
| 1317 | + position: relative; | |
| 1318 | + .p14 { | |
| 1319 | + font-size: 14px; | |
| 1320 | + color: #666666; | |
| 1321 | + letter-spacing: -0.26px; | |
| 1322 | + text-align: center; | |
| 1323 | + width: 124rpx; | |
| 1324 | + border-bottom: 1px solid #CFCFCF; | |
| 1325 | + height: 38rpx; | |
| 1326 | + } | |
| 1327 | + image{ | |
| 1328 | + width: 20rpx; | |
| 1329 | + height: 20rpx; | |
| 1330 | + position: absolute; | |
| 1331 | + right: 20rpx; | |
| 1332 | + top: 8rpx; | |
| 1333 | + } | |
| 1334 | + } | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + } | |
| 1338 | + } | |
| 1339 | + } | |
| 776 | 1340 | } |
| 777 | 1341 | } |
| 778 | 1342 | .choose { | ... | ... |