Commit fed83ad116c0e3362292f6ebed3cbaed33ce4e41
1 parent
e79b721339
Exists in
master
新增数据
Showing
6 changed files
with
211 additions
and
8 deletions
Show diff stats
src/components/BottomSheet/BottomSheet.vue
... | ... | @@ -178,6 +178,21 @@ |
178 | 178 | </picker> |
179 | 179 | </view> |
180 | 180 | </view> |
181 | + <view class="ipts"> | |
182 | + <view class="inputItem"> | |
183 | + <text class="text">镜片宽度</text> | |
184 | + <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth" placeholder="请输入镜片宽度"/> | |
185 | + </view> | |
186 | + <view class="inputItem"> | |
187 | + <text class="text">鼻梁宽度</text> | |
188 | + <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth" placeholder="请输入鼻梁宽度"/> | |
189 | + </view> | |
190 | + <view class="inputItem"> | |
191 | + <text class="text">镜腿长度</text> | |
192 | + <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth" placeholder="请输入镜腿长度"/> | |
193 | + </view> | |
194 | + | |
195 | + </view> | |
181 | 196 | <view class="confirm"> |
182 | 197 | <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> |
183 | 198 | <text>确认以上输入信息来源于我的验光数据!</text> |
... | ... | @@ -334,6 +349,11 @@ import store from '@/store' |
334 | 349 | day: 0, |
335 | 350 | }, |
336 | 351 | }, |
352 | + glassInfo:{ | |
353 | + norseWidth:Number,//鼻宽 | |
354 | + glassWidth:Number,//镜片宽度 | |
355 | + legWidth:Number//镜腿长度 | |
356 | + }, | |
337 | 357 | pd: '', // 瞳距 |
338 | 358 | oldpd: '', // 用于判断用户是否改变瞳距 |
339 | 359 | kinds: 1, // kinds=1,提交为新增验光,2为修改 |
... | ... | @@ -458,6 +478,65 @@ import store from '@/store' |
458 | 478 | }, |
459 | 479 | name : "bottomSheet", |
460 | 480 | methods: { |
481 | + checkGlassInfo(){ | |
482 | + const glassInfoArr = Object.values(this.glassInfo) | |
483 | + // console.log(glassInfoArr) | |
484 | + if(glassInfoArr.find(item => item == '0') !=='undefind'){ | |
485 | + uni.showToast({ | |
486 | + title:'请完善镜框数据~' | |
487 | + }) | |
488 | + } | |
489 | + }, | |
490 | + updateMylove(){ | |
491 | + const loveItem = this.loveList[this.loveCurrent] | |
492 | + const glassWidth = this.glassInfo.glassWidth | |
493 | + const norseWidth = this.glassInfo.norseWidth | |
494 | + const legWidth = this.glassInfo.legWidth | |
495 | + console.log(loveItem.glassWidth) | |
496 | + console.log(glassWidth) | |
497 | + if(loveItem.glassWidth !== glassWidth){ | |
498 | + store.dispatch('myLoveList/updateMylove', { | |
499 | + uid: this.$store.state.user.userInfo.uid, | |
500 | + openid: this.$store.state.user.userInfo.openid, | |
501 | + mp_id: this.mp_id, | |
502 | + keyname: 'glassWidth', | |
503 | + keyvalue: glassWidth | |
504 | + }); | |
505 | + } | |
506 | + if(loveItem.norseWidth !== norseWidth){ | |
507 | + store.dispatch('myLoveList/updateMylove', { | |
508 | + uid: this.$store.state.user.userInfo.uid, | |
509 | + openid: this.$store.state.user.userInfo.openid, | |
510 | + mp_id: this.mp_id, | |
511 | + keyname: 'norseWidth', | |
512 | + keyvalue: norseWidth | |
513 | + }); | |
514 | + } | |
515 | + if(loveItem.legWidth !== legWidth){ | |
516 | + store.dispatch('myLoveList/updateMylove', { | |
517 | + uid: this.$store.state.user.userInfo.uid, | |
518 | + openid: this.$store.state.user.userInfo.openid, | |
519 | + mp_id: this.mp_id, | |
520 | + keyname: 'legWidth', | |
521 | + keyvalue: legWidth | |
522 | + }); | |
523 | + } | |
524 | + }, | |
525 | + glassInfoInput(e,type){ | |
526 | + switch(type){ | |
527 | + case 0: | |
528 | + this.glassInfo.glassWidth = e.detail.value | |
529 | + break; | |
530 | + case 1: | |
531 | + this.glassInfo.norseWidth = e.detail.value | |
532 | + break; | |
533 | + case 2: | |
534 | + this.glassInfo.legWidth = e.detail.value | |
535 | + break; | |
536 | + default: | |
537 | + break; | |
538 | + } | |
539 | + }, | |
461 | 540 | //参数点击事件==》改变对应图片 |
462 | 541 | cartOnClickItem(index, i,aid) { |
463 | 542 | //根据aid拼接skuValue |
... | ... | @@ -473,11 +552,15 @@ import store from '@/store' |
473 | 552 | this.$forceUpdate() |
474 | 553 | }, |
475 | 554 | comfirmChoose(){ |
555 | + this.checkGlassInfo() | |
556 | + this.updateMylove() | |
476 | 557 | const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price |
477 | 558 | this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车 |
478 | 559 | this.$emit("closeBottom") |
479 | 560 | }, |
480 | 561 | addCart(){ |
562 | + this.checkGlassInfo() | |
563 | + this.updateMylove() | |
481 | 564 | const that = this |
482 | 565 | const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] |
483 | 566 | const checkedSKU = [] |
... | ... | @@ -501,6 +584,9 @@ import store from '@/store' |
501 | 584 | }, |
502 | 585 | onClickLoveItem(index,name){ |
503 | 586 | const loveList = this.loveList |
587 | + this.glassInfo.glassWidth = loveList[index].glassWidth | |
588 | + this.glassInfo.norseWidth = loveList[index].norseWidth | |
589 | + this.glassInfo.legWidth = loveList[index].legWidth | |
504 | 590 | for (let index = 0; index < loveList.length; index++) { |
505 | 591 | if (name === loveList[index].name && name!==this.name) { |
506 | 592 | this.isDataName = true |
... | ... | @@ -658,6 +744,8 @@ import store from '@/store' |
658 | 744 | } |
659 | 745 | }, |
660 | 746 | toComfirmOrder() { |
747 | + | |
748 | + this.updateMylove() | |
661 | 749 | // 先处理验光部分的逻辑,如果ok在跳转 |
662 | 750 | let flag = 0 |
663 | 751 | if (this.name === '') { |
... | ... | @@ -1138,6 +1226,30 @@ import store from '@/store' |
1138 | 1226 | |
1139 | 1227 | } |
1140 | 1228 | } |
1229 | + | |
1230 | + .ipts{ | |
1231 | + width: 100%; | |
1232 | + display: flex; | |
1233 | + flex-direction: column; | |
1234 | + justify-content: center; | |
1235 | + align-items: flex-start; | |
1236 | + // padding: 20rpx 36rpx; | |
1237 | + box-sizing: border-box; | |
1238 | + .inputItem{ | |
1239 | + display: flex; | |
1240 | + flex-direction: row; | |
1241 | + justify-content: center; | |
1242 | + align-items: center; | |
1243 | + margin-bottom: 36rpx; | |
1244 | + .text{ | |
1245 | + margin-right: 100rpx; | |
1246 | + } | |
1247 | + .input{ | |
1248 | + border-bottom: 1px solid #CFCFCF; | |
1249 | + } | |
1250 | + } | |
1251 | + | |
1252 | + } | |
1141 | 1253 | } |
1142 | 1254 | } |
1143 | 1255 | } |
... | ... | @@ -1208,6 +1320,7 @@ import store from '@/store' |
1208 | 1320 | position: sticky; |
1209 | 1321 | bottom: 0rpx; |
1210 | 1322 | left: 0rpx; |
1323 | + z-index: 9999; | |
1211 | 1324 | } |
1212 | 1325 | } |
1213 | 1326 | /* sheet弹窗 */ | ... | ... |
src/pages.json
... | ... | @@ -252,7 +252,19 @@ |
252 | 252 | "name": "我的", |
253 | 253 | "path": "pages/user/user", |
254 | 254 | "query": "" |
255 | - } | |
255 | + }, | |
256 | + | |
257 | + { | |
258 | + "name": "验光数据", | |
259 | + "path": "pages/addOpticsData/addOpticsData", | |
260 | + "query": "" | |
261 | + }, | |
262 | + | |
263 | + { | |
264 | + "name": "新建验光数据", | |
265 | + "path": "pages/newOpticsData/newOpticsData", | |
266 | + "query": "" | |
267 | + } | |
256 | 268 | ] |
257 | 269 | } |
258 | 270 | } |
259 | 271 | \ No newline at end of file | ... | ... |
src/pages/addOpticsData/addOpticsData.vue
... | ... | @@ -41,6 +41,15 @@ |
41 | 41 | <view class="dataInfoItem"> |
42 | 42 | <text>瞳距(PD):</text><text>{{loveItem.pd}}</text> |
43 | 43 | </view> |
44 | + <view class="dataInfoItem"> | |
45 | + <text>镜片宽度:</text><text>{{loveItem.glassWidth!=='0'?loveItem.glassWidth:'暂无数据'}}</text> | |
46 | + </view> | |
47 | + <view class="dataInfoItem"> | |
48 | + <text>鼻梁宽度:</text><text>{{loveItem.norseWidth!=='0'?loveItem.norseWidth:'暂无数据'}}</text> | |
49 | + </view> | |
50 | + <view class="dataInfoItem"> | |
51 | + <text>镜腿长度:</text><text>{{loveItem.legWidth!=='0'?loveItem.legWidth:'暂无数据'}}</text> | |
52 | + </view> | |
44 | 53 | </view> |
45 | 54 | </uni-collapse-item> |
46 | 55 | </view> |
... | ... | @@ -64,12 +73,18 @@ |
64 | 73 | whichTap:0 |
65 | 74 | }; |
66 | 75 | }, |
67 | - onLoad: function(option) { | |
76 | + onShow() { | |
68 | 77 | //获取关心的人列表 |
69 | 78 | store.dispatch('myLoveList/getLoveList', { |
70 | 79 | uid: this.$store.state.user.userInfo.uid, |
71 | 80 | }); |
72 | 81 | }, |
82 | + onLoad: function(option) { | |
83 | + // //获取关心的人列表 | |
84 | + // store.dispatch('myLoveList/getLoveList', { | |
85 | + // uid: this.$store.state.user.userInfo.uid, | |
86 | + // }); | |
87 | + }, | |
73 | 88 | computed:{ |
74 | 89 | loveList() { |
75 | 90 | console.log(this.$store.state.myLoveList.loveList) | ... | ... |
src/pages/cart/cart.vue
... | ... | @@ -218,6 +218,7 @@ export default { |
218 | 218 | toComfirmOrder(){ |
219 | 219 | this.$store.state.cart.checkedCartLst = this.cartList.filter(item => item.isChecked) |
220 | 220 | if(this.$store.state.cart.checkedCartLst.length>0){ |
221 | + // this.delCart() | |
221 | 222 | uni.navigateTo({ |
222 | 223 | url:`../confirmOrder/confirmOrder?isCart=true`, |
223 | 224 | }) | ... | ... |
src/pages/myOrder/myOrder.vue
src/pages/newOpticsData/newOpticsData.vue
... | ... | @@ -130,6 +130,21 @@ |
130 | 130 | </picker> |
131 | 131 | </view> |
132 | 132 | </view> |
133 | + <view class="ipts"> | |
134 | + <view class="inputItem"> | |
135 | + <text class="text">镜片宽度</text> | |
136 | + <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth" placeholder="请输入镜片宽度"/> | |
137 | + </view> | |
138 | + <view class="inputItem"> | |
139 | + <text class="text">鼻梁宽度</text> | |
140 | + <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth" placeholder="请输入鼻梁宽度"/> | |
141 | + </view> | |
142 | + <view class="inputItem"> | |
143 | + <text class="text">镜腿长度</text> | |
144 | + <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth" placeholder="请输入镜腿长度"/> | |
145 | + </view> | |
146 | + | |
147 | + </view> | |
133 | 148 | <view class="confirm"> |
134 | 149 | <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> |
135 | 150 | <text>确认以上输入信息来源于我的验光数据!</text> |
... | ... | @@ -160,7 +175,7 @@ |
160 | 175 | ], |
161 | 176 | confirm: false, // 用户是否确认 |
162 | 177 | tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], |
163 | - name: '夏小花', | |
178 | + name: '请输入W姓名', | |
164 | 179 | oldname:'',// 用于判读用户是否改变名字 |
165 | 180 | pickerInfoChioce:{ |
166 | 181 | "leftSph": '', |
... | ... | @@ -175,6 +190,11 @@ |
175 | 190 | "day":0 , |
176 | 191 | } |
177 | 192 | }, |
193 | + glassInfo:{ | |
194 | + norseWidth:0,//鼻宽 | |
195 | + glassWidth:0,//镜片宽度 | |
196 | + legWidth:0//镜腿长度 | |
197 | + }, | |
178 | 198 | pd: '',// 瞳距 |
179 | 199 | oldpd: '',// 用于判断用户是否改变瞳距 |
180 | 200 | kinds:Number, // kinds=1,提交为新增验光,2为修改 |
... | ... | @@ -251,6 +271,21 @@ |
251 | 271 | } |
252 | 272 | }, |
253 | 273 | methods:{ |
274 | + glassInfoInput(e,type){ | |
275 | + switch(type){ | |
276 | + case 0: | |
277 | + this.glassInfo.glassWidth = e.detail.value | |
278 | + break; | |
279 | + case 1: | |
280 | + this.glassInfo.norseWidth = e.detail.value | |
281 | + break; | |
282 | + case 2: | |
283 | + this.glassInfo.legWidth = e.detail.value | |
284 | + break; | |
285 | + default: | |
286 | + break; | |
287 | + } | |
288 | + }, | |
254 | 289 | handleInput(e){ |
255 | 290 | this.name=e.target.value |
256 | 291 | }, |
... | ... | @@ -303,7 +338,6 @@ |
303 | 338 | }else{ |
304 | 339 | if(this.confirm){ |
305 | 340 | store.dispatch('myLoveList/addMylove', { |
306 | - | |
307 | 341 | uid: this.$store.state.user.userInfo.uid, |
308 | 342 | openid: this.$store.state.user.userInfo.openid, |
309 | 343 | // mp_name: this.$store.state.user.userInfo.mp_name, |
... | ... | @@ -315,12 +349,15 @@ |
315 | 349 | rightAxi: this.pickerInfoChioce.rightAxi, |
316 | 350 | pd: this.pd,// 瞳距 |
317 | 351 | mp_name:this.name, |
352 | + glassWidth:this.glassInfo.glassWidth, | |
353 | + norseWidth:this.glassInfo.norseWidth, | |
354 | + legWidth:this.glassInfo.legWidth | |
318 | 355 | // time: this.pickerInfoChioce.time, |
319 | 356 | // img_url2: "http://localhost:8087/images/shop_1/1/", |
320 | 357 | }); |
321 | - store.dispatch('myLoveList/getLoveList', { | |
322 | - uid: this.$store.state.user.userInfo.uid, | |
323 | - }); | |
358 | + // store.dispatch('myLoveList/getLoveList', { | |
359 | + // uid: this.$store.state.user.userInfo.uid, | |
360 | + // }); | |
324 | 361 | uni.navigateBack({ |
325 | 362 | delta:1, |
326 | 363 | animationDuration:2000 |
... | ... | @@ -345,6 +382,8 @@ |
345 | 382 | const leftList = ["leftSph","leftCyl","leftAxi"]; |
346 | 383 | const rightList = ["rightSph", "rightCyl", "rightAxi"]; |
347 | 384 | let flag=0; |
385 | + | |
386 | + | |
348 | 387 | if(this.name!=this.oldname){ |
349 | 388 | store.dispatch('myLoveList/updateMylove', { |
350 | 389 | uid: this.$store.state.user.userInfo.uid, |
... | ... | @@ -628,6 +667,29 @@ |
628 | 667 | |
629 | 668 | } |
630 | 669 | } |
670 | + .ipts{ | |
671 | + width: 100%; | |
672 | + display: flex; | |
673 | + flex-direction: column; | |
674 | + justify-content: center; | |
675 | + align-items: flex-start; | |
676 | + padding: 20rpx 36rpx; | |
677 | + box-sizing: border-box; | |
678 | + .inputItem{ | |
679 | + display: flex; | |
680 | + flex-direction: row; | |
681 | + justify-content: center; | |
682 | + align-items: center; | |
683 | + margin-bottom: 36rpx; | |
684 | + .text{ | |
685 | + margin-right: 100rpx; | |
686 | + } | |
687 | + .input{ | |
688 | + border-bottom: 1px solid #CFCFCF; | |
689 | + } | |
690 | + } | |
691 | + | |
692 | + } | |
631 | 693 | } |
632 | 694 | |
633 | 695 | .footer{ | ... | ... |