From fed83ad116c0e3362292f6ebed3cbaed33ce4e41 Mon Sep 17 00:00:00 2001
From: BigBoss <2280520255@qq.com>
Date: Tue, 9 Jun 2020 23:11:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/BottomSheet/BottomSheet.vue | 113 +++++++++++++++++++++++++++++
src/pages.json | 14 +++-
src/pages/addOpticsData/addOpticsData.vue | 17 ++++-
src/pages/cart/cart.vue | 1 +
src/pages/myOrder/myOrder.vue | 2 +-
src/pages/newOpticsData/newOpticsData.vue | 72 ++++++++++++++++--
6 files changed, 211 insertions(+), 8 deletions(-)
diff --git a/src/components/BottomSheet/BottomSheet.vue b/src/components/BottomSheet/BottomSheet.vue
index dae83cd..4dfd7e2 100644
--- a/src/components/BottomSheet/BottomSheet.vue
+++ b/src/components/BottomSheet/BottomSheet.vue
@@ -178,6 +178,21 @@
+
+
+ 镜片宽度
+
+
+
+ 鼻梁宽度
+
+
+
+ 镜腿长度
+
+
+
+
确认以上输入信息来源于我的验光数据!
@@ -334,6 +349,11 @@ import store from '@/store'
day: 0,
},
},
+ glassInfo:{
+ norseWidth:Number,//鼻宽
+ glassWidth:Number,//镜片宽度
+ legWidth:Number//镜腿长度
+ },
pd: '', // 瞳距
oldpd: '', // 用于判断用户是否改变瞳距
kinds: 1, // kinds=1,提交为新增验光,2为修改
@@ -458,6 +478,65 @@ import store from '@/store'
},
name : "bottomSheet",
methods: {
+ checkGlassInfo(){
+ const glassInfoArr = Object.values(this.glassInfo)
+ // console.log(glassInfoArr)
+ if(glassInfoArr.find(item => item == '0') !=='undefind'){
+ uni.showToast({
+ title:'请完善镜框数据~'
+ })
+ }
+ },
+ updateMylove(){
+ const loveItem = this.loveList[this.loveCurrent]
+ const glassWidth = this.glassInfo.glassWidth
+ const norseWidth = this.glassInfo.norseWidth
+ const legWidth = this.glassInfo.legWidth
+ console.log(loveItem.glassWidth)
+ console.log(glassWidth)
+ if(loveItem.glassWidth !== glassWidth){
+ store.dispatch('myLoveList/updateMylove', {
+ uid: this.$store.state.user.userInfo.uid,
+ openid: this.$store.state.user.userInfo.openid,
+ mp_id: this.mp_id,
+ keyname: 'glassWidth',
+ keyvalue: glassWidth
+ });
+ }
+ if(loveItem.norseWidth !== norseWidth){
+ store.dispatch('myLoveList/updateMylove', {
+ uid: this.$store.state.user.userInfo.uid,
+ openid: this.$store.state.user.userInfo.openid,
+ mp_id: this.mp_id,
+ keyname: 'norseWidth',
+ keyvalue: norseWidth
+ });
+ }
+ if(loveItem.legWidth !== legWidth){
+ store.dispatch('myLoveList/updateMylove', {
+ uid: this.$store.state.user.userInfo.uid,
+ openid: this.$store.state.user.userInfo.openid,
+ mp_id: this.mp_id,
+ keyname: 'legWidth',
+ keyvalue: legWidth
+ });
+ }
+ },
+ glassInfoInput(e,type){
+ switch(type){
+ case 0:
+ this.glassInfo.glassWidth = e.detail.value
+ break;
+ case 1:
+ this.glassInfo.norseWidth = e.detail.value
+ break;
+ case 2:
+ this.glassInfo.legWidth = e.detail.value
+ break;
+ default:
+ break;
+ }
+ },
//参数点击事件==》改变对应图片
cartOnClickItem(index, i,aid) {
//根据aid拼接skuValue
@@ -473,11 +552,15 @@ import store from '@/store'
this.$forceUpdate()
},
comfirmChoose(){
+ this.checkGlassInfo()
+ this.updateMylove()
const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price
this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车
this.$emit("closeBottom")
},
addCart(){
+ this.checkGlassInfo()
+ this.updateMylove()
const that = this
const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name]
const checkedSKU = []
@@ -501,6 +584,9 @@ import store from '@/store'
},
onClickLoveItem(index,name){
const loveList = this.loveList
+ this.glassInfo.glassWidth = loveList[index].glassWidth
+ this.glassInfo.norseWidth = loveList[index].norseWidth
+ this.glassInfo.legWidth = loveList[index].legWidth
for (let index = 0; index < loveList.length; index++) {
if (name === loveList[index].name && name!==this.name) {
this.isDataName = true
@@ -658,6 +744,8 @@ import store from '@/store'
}
},
toComfirmOrder() {
+
+ this.updateMylove()
// 先处理验光部分的逻辑,如果ok在跳转
let flag = 0
if (this.name === '') {
@@ -1138,6 +1226,30 @@ import store from '@/store'
}
}
+
+ .ipts{
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-start;
+ // padding: 20rpx 36rpx;
+ box-sizing: border-box;
+ .inputItem{
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ margin-bottom: 36rpx;
+ .text{
+ margin-right: 100rpx;
+ }
+ .input{
+ border-bottom: 1px solid #CFCFCF;
+ }
+ }
+
+ }
}
}
}
@@ -1208,6 +1320,7 @@ import store from '@/store'
position: sticky;
bottom: 0rpx;
left: 0rpx;
+ z-index: 9999;
}
}
/* sheet弹窗 */
diff --git a/src/pages.json b/src/pages.json
index 8bc07a1..7d9d772 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -252,7 +252,19 @@
"name": "我的",
"path": "pages/user/user",
"query": ""
- }
+ },
+
+ {
+ "name": "验光数据",
+ "path": "pages/addOpticsData/addOpticsData",
+ "query": ""
+ },
+
+ {
+ "name": "新建验光数据",
+ "path": "pages/newOpticsData/newOpticsData",
+ "query": ""
+ }
]
}
}
\ No newline at end of file
diff --git a/src/pages/addOpticsData/addOpticsData.vue b/src/pages/addOpticsData/addOpticsData.vue
index 9b55e27..8ace84b 100644
--- a/src/pages/addOpticsData/addOpticsData.vue
+++ b/src/pages/addOpticsData/addOpticsData.vue
@@ -41,6 +41,15 @@
瞳距(PD):{{loveItem.pd}}
+
+ 镜片宽度:{{loveItem.glassWidth!=='0'?loveItem.glassWidth:'暂无数据'}}
+
+
+ 鼻梁宽度:{{loveItem.norseWidth!=='0'?loveItem.norseWidth:'暂无数据'}}
+
+
+ 镜腿长度:{{loveItem.legWidth!=='0'?loveItem.legWidth:'暂无数据'}}
+
@@ -64,12 +73,18 @@
whichTap:0
};
},
- onLoad: function(option) {
+ onShow() {
//获取关心的人列表
store.dispatch('myLoveList/getLoveList', {
uid: this.$store.state.user.userInfo.uid,
});
},
+ onLoad: function(option) {
+ // //获取关心的人列表
+ // store.dispatch('myLoveList/getLoveList', {
+ // uid: this.$store.state.user.userInfo.uid,
+ // });
+ },
computed:{
loveList() {
console.log(this.$store.state.myLoveList.loveList)
diff --git a/src/pages/cart/cart.vue b/src/pages/cart/cart.vue
index 21f4b19..7b65575 100644
--- a/src/pages/cart/cart.vue
+++ b/src/pages/cart/cart.vue
@@ -218,6 +218,7 @@ export default {
toComfirmOrder(){
this.$store.state.cart.checkedCartLst = this.cartList.filter(item => item.isChecked)
if(this.$store.state.cart.checkedCartLst.length>0){
+ // this.delCart()
uni.navigateTo({
url:`../confirmOrder/confirmOrder?isCart=true`,
})
diff --git a/src/pages/myOrder/myOrder.vue b/src/pages/myOrder/myOrder.vue
index f66e37c..086738f 100644
--- a/src/pages/myOrder/myOrder.vue
+++ b/src/pages/myOrder/myOrder.vue
@@ -72,7 +72,7 @@ onShow() {
},
computed: {
orderList() {
- // console.log('orderList', this.$store.state.myOrder.orderList);
+ console.log('orderList', this.$store.state.myOrder.orderList);
return this.$store.state.myOrder.orderList;
}
},
diff --git a/src/pages/newOpticsData/newOpticsData.vue b/src/pages/newOpticsData/newOpticsData.vue
index 48d352a..3e7e9d5 100644
--- a/src/pages/newOpticsData/newOpticsData.vue
+++ b/src/pages/newOpticsData/newOpticsData.vue
@@ -130,6 +130,21 @@
+
+
+ 镜片宽度
+
+
+
+ 鼻梁宽度
+
+
+
+ 镜腿长度
+
+
+
+
确认以上输入信息来源于我的验光数据!
@@ -160,7 +175,7 @@
],
confirm: false, // 用户是否确认
tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'],
- name: '夏小花',
+ name: '请输入W姓名',
oldname:'',// 用于判读用户是否改变名字
pickerInfoChioce:{
"leftSph": '',
@@ -175,6 +190,11 @@
"day":0 ,
}
},
+ glassInfo:{
+ norseWidth:0,//鼻宽
+ glassWidth:0,//镜片宽度
+ legWidth:0//镜腿长度
+ },
pd: '',// 瞳距
oldpd: '',// 用于判断用户是否改变瞳距
kinds:Number, // kinds=1,提交为新增验光,2为修改
@@ -251,6 +271,21 @@
}
},
methods:{
+ glassInfoInput(e,type){
+ switch(type){
+ case 0:
+ this.glassInfo.glassWidth = e.detail.value
+ break;
+ case 1:
+ this.glassInfo.norseWidth = e.detail.value
+ break;
+ case 2:
+ this.glassInfo.legWidth = e.detail.value
+ break;
+ default:
+ break;
+ }
+ },
handleInput(e){
this.name=e.target.value
},
@@ -303,7 +338,6 @@
}else{
if(this.confirm){
store.dispatch('myLoveList/addMylove', {
-
uid: this.$store.state.user.userInfo.uid,
openid: this.$store.state.user.userInfo.openid,
// mp_name: this.$store.state.user.userInfo.mp_name,
@@ -315,12 +349,15 @@
rightAxi: this.pickerInfoChioce.rightAxi,
pd: this.pd,// 瞳距
mp_name:this.name,
+ glassWidth:this.glassInfo.glassWidth,
+ norseWidth:this.glassInfo.norseWidth,
+ legWidth:this.glassInfo.legWidth
// time: this.pickerInfoChioce.time,
// img_url2: "http://localhost:8087/images/shop_1/1/",
});
- store.dispatch('myLoveList/getLoveList', {
- uid: this.$store.state.user.userInfo.uid,
- });
+ // store.dispatch('myLoveList/getLoveList', {
+ // uid: this.$store.state.user.userInfo.uid,
+ // });
uni.navigateBack({
delta:1,
animationDuration:2000
@@ -345,6 +382,8 @@
const leftList = ["leftSph","leftCyl","leftAxi"];
const rightList = ["rightSph", "rightCyl", "rightAxi"];
let flag=0;
+
+
if(this.name!=this.oldname){
store.dispatch('myLoveList/updateMylove', {
uid: this.$store.state.user.userInfo.uid,
@@ -628,6 +667,29 @@
}
}
+ .ipts{
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-start;
+ padding: 20rpx 36rpx;
+ box-sizing: border-box;
+ .inputItem{
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ margin-bottom: 36rpx;
+ .text{
+ margin-right: 100rpx;
+ }
+ .input{
+ border-bottom: 1px solid #CFCFCF;
+ }
+ }
+
+ }
}
.footer{
--
2.0.0