diff --git a/src/components/BottomSheet/BottomSheet.vue b/src/components/BottomSheet/BottomSheet.vue
index a1a9695..60df2fc 100644
--- a/src/components/BottomSheet/BottomSheet.vue
+++ b/src/components/BottomSheet/BottomSheet.vue
@@ -181,22 +181,22 @@
镜片宽度
-
+
鼻梁宽度
-
+
镜腿长度
-
+
-
+
@@ -332,8 +332,8 @@ import store from '@/store'
{ nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 },
{ nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 },
],
- confirm: false, // 用户是否确认
- tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'],
+ // confirm: false, // 用户是否确认
+ // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'],
name: '',
oldname: '', // 用于判读用户是否改变名字
pickerInfoChioce: {
@@ -350,8 +350,8 @@ import store from '@/store'
},
},
glassInfo:{
- norseWidth:Number,//鼻宽
glassWidth:Number,//镜片宽度
+ norseWidth:Number,//鼻宽
legWidth:Number//镜腿长度
},
pd: '', // 瞳距
@@ -420,7 +420,18 @@ import store from '@/store'
return this.$store.state.myLoveList.loveList
},
+ glassInfoRight(){
+ const glassInfoArr = Object.values(this.glassInfo)
+ // console.log('glassInfoArr',glassInfoArr.find(item => item == '0'))
+ return glassInfoArr.find(item => item == '0') ==undefined
+ }
},
+ // beforeDestroy() {
+ // //获取关心的人列表
+ // store.dispatch('myLoveList/getLoveList', {
+ // uid: this.$store.state.user.userInfo.uid,
+ // });
+ // },
created() {
this.skuValueArray = this.skuList[0].sku_value.split("_")
// console.log(this.sk_id)
@@ -439,13 +450,10 @@ import store from '@/store'
}else{
this.skId = this.sk_id
}
-
//获取关心的人列表
store.dispatch('myLoveList/getLoveList', {
uid: this.$store.state.user.userInfo.uid,
});
-
-
// 初始化SPL、CYL、AXI的值
for (let j = 0; j < 3; j++) {
for (let i = -12; i < 6; i++) {
@@ -478,11 +486,14 @@ import store from '@/store'
},
name : "bottomSheet",
methods: {
+ //判断眼镜数据是否为0
checkGlassInfo(){
- const glassInfoArr = Object.values(this.glassInfo)
- if(glassInfoArr.find(item => item == '0') !=='undefind'){
- uni.showModal({
- title:'请完善镜框数据~'
+ // const glassInfoArr = Object.values(this.glassInfo)
+ // console.log(this.glassInfoRight)
+ if(!this.glassInfoRight){
+ uni.showToast({
+ title:'请完善镜框数据~',
+ icon:'none'
})
}
},
@@ -491,8 +502,6 @@ import store from '@/store'
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,
@@ -552,34 +561,38 @@ import store from '@/store'
},
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")
+ if(this.glassInfoRight){
+ 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 = []
- let j;
- for (let i = 0;iitem.sk_id == this.skuList[j].sk_id)[0].real_price
+ let sk_id = this.skuList[j].sk_id
+ // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU)
+ // console.log('mp_id',this.mp_id,'数量',this.count)
+ this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车
+ this.$emit("closeBottom")//关闭弹窗
}
- const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price
- let sk_id = this.skuList[j].sk_id
- // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU)
- // console.log('mp_id',this.mp_id,'数量',this.count)
- this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车
- this.$emit("closeBottom")//关闭弹窗
},
onClickLoveItem(index,name){
const loveList = this.loveList
@@ -689,9 +702,9 @@ import store from '@/store'
this.pd = ''
}
},
- changeConfirm() {
- this.confirm = !this.confirm
- },
+ // changeConfirm() {
+ // this.confirm = !this.confirm
+ // },
bindPickerChange01: function(e) {
this.pickerInfoList[0].nameIndex1 = e.target.value
this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value]
@@ -763,9 +776,6 @@ import store from '@/store'
} else {
if (this.kinds === 1) {
// 添加用户验光单
- console.log('kinds====>', this.pickerInfoChioce.leftSph)
- console.log('kinds====>', this.pickerInfoChioce.leftSph === Number)
- console.log('kinds====>', this.pickerInfoChioce.rightSph === Number)
if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' ||
this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' ||
this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === ''
@@ -776,7 +786,7 @@ import store from '@/store'
duration: 2000,
})
} else {
- if (this.confirm) {
+ // if (this.confirm) {
store.dispatch('myLoveList/addMylove', {
uid: this.$store.state.user.userInfo.uid,
openid: this.$store.state.user.userInfo.openid,
@@ -795,17 +805,10 @@ import store from '@/store'
this.mp_id = mpId
})
flag = 1
- } else {
- uni.showToast({
- title: '请确认您的验光数据',
- icon: 'none',
- duration: 3000,
- })
- }
}
}
if (this.kinds === 2) {
- if (this.confirm) {
+ // if (this.confirm) {
const leftList = ['leftSph', 'leftCyl', 'leftAxi']
const rightList = ['rightSph', 'rightCyl', 'rightAxi']
// let flag=0;
@@ -865,18 +868,14 @@ import store from '@/store'
duration: 2000,
})
}
- if (flag !== 0) {
- store.dispatch('myLoveList/getLoveList', {
- uid: this.$store.state.user.userInfo.uid,
- })
- }
- } else {
- uni.showToast({
- title: '请确认您的验光数据',
- icon: 'none',
- duration: 3000,
- })
- }
+
+ // } else {
+ // uni.showToast({
+ // title: '请确认您的验光数据',
+ // icon: 'none',
+ // duration: 3000,
+ // })
+ // }
}
}
}
diff --git a/src/pages/addOpticsData/addOpticsData.vue b/src/pages/addOpticsData/addOpticsData.vue
index 8ace84b..847c476 100644
--- a/src/pages/addOpticsData/addOpticsData.vue
+++ b/src/pages/addOpticsData/addOpticsData.vue
@@ -42,13 +42,13 @@
瞳距(PD):{{loveItem.pd}}
- 镜片宽度:{{loveItem.glassWidth!=='0'?loveItem.glassWidth:'暂无数据'}}
+ 镜片宽度:{{loveItem.glassWidth!=''?loveItem.glassWidth:'暂无数据'}}
- 鼻梁宽度:{{loveItem.norseWidth!=='0'?loveItem.norseWidth:'暂无数据'}}
+ 鼻梁宽度:{{loveItem.norseWidth!=''?loveItem.norseWidth:'暂无数据'}}
- 镜腿长度:{{loveItem.legWidth!=='0'?loveItem.legWidth:'暂无数据'}}
+ 镜腿长度:{{loveItem.legWidth!=''?loveItem.legWidth:'暂无数据'}}
@@ -87,7 +87,7 @@
},
computed:{
loveList() {
- console.log(this.$store.state.myLoveList.loveList)
+ // console.log(this.$store.state.myLoveList.loveList)
return this.$store.state.myLoveList.loveList || []
},
},
@@ -96,7 +96,7 @@
this.whichTap = item
this.$refs.popup.open()
},
- //给时间搞一个nice的格式
+ //给时间搞一个的格式
getRightTime(time){
//如果小于10 则返回'0'+m
// function add(m){return m<10?'0'+m:m}
diff --git a/src/pages/confirmOrder/confirmOrder.vue b/src/pages/confirmOrder/confirmOrder.vue
index bfc6901..16a5906 100644
--- a/src/pages/confirmOrder/confirmOrder.vue
+++ b/src/pages/confirmOrder/confirmOrder.vue
@@ -280,9 +280,9 @@ export default {
onLoad({ pid, addressId, isCart, count, name }) {
if (isCart == 'false') {
this.pid = pid
- store.dispatch('read/fetch', {
- pid,
- })
+ // store.dispatch('read/fetch', {
+ // pid,
+ // })
}
this.count = count
this.name = name
@@ -586,6 +586,9 @@ export default {
.price {
color: #ff6b4a;
font-size: 28rpx;
+ text{
+ margin-left: 10rpx;
+ }
}
.originCost {
text-decoration: line-through;
diff --git a/src/pages/newOpticsData/newOpticsData.vue b/src/pages/newOpticsData/newOpticsData.vue
index 3e7e9d5..6139626 100644
--- a/src/pages/newOpticsData/newOpticsData.vue
+++ b/src/pages/newOpticsData/newOpticsData.vue
@@ -133,15 +133,15 @@
镜片宽度
-
+
鼻梁宽度
-
+
镜腿长度
-
+
@@ -198,7 +198,8 @@
pd: '',// 瞳距
oldpd: '',// 用于判断用户是否改变瞳距
kinds:Number, // kinds=1,提交为新增验光,2为修改
- mp_id: Number
+ mp_id: Number,
+ loveItem:Object
};
},
onLoad: function (option) {
@@ -240,10 +241,10 @@
} else{
console.log('args===>',option.index)
const loveList=Object.assign({},this.$store.state.myLoveList.loveList)
- console.log('args===>',loveList[option.index].in_time)
- console.log('args===>',loveList[option.index].in_time.toString().slice(0,4))
- console.log('args===>',loveList[option.index].in_time.toString().slice(5,6)==0)
- console.log('args===>',loveList[option.index].in_time.toString().slice(8,10))
+ // console.log('args===>',loveList[option.index].in_time)
+ // console.log('args===>',loveList[option.index].in_time.toString().slice(0,4))
+ // console.log('args===>',loveList[option.index].in_time.toString().slice(5,6)==0)
+ // console.log('args===>',loveList[option.index].in_time.toString().slice(8,10))
this.name=loveList[option.index].name
this.pd=loveList[option.index].pd
this.mp_id=loveList[option.index].mp_id
@@ -268,6 +269,17 @@
} else{
this.pickerInfoList[3].nameArray3.unshift(loveList[option.index].in_time.toString().slice(8,10))
}
+ this.glassInfo.glassWidth = loveList[option.index].glassWidth
+ this.glassInfo.norseWidth = loveList[option.index].norseWidth
+ this.glassInfo.legWidth = loveList[option.index].legWidth
+ this.loveItem = loveList[option.index]
+ }
+ },
+ computed:{
+ //判断当前眼镜信息是否有0
+ glassInfoRight(){
+ const glassInfoArr = Object.values(this.glassInfo)
+ return glassInfoArr.find(item => item == '0') ==undefined
}
},
methods:{
@@ -303,6 +315,41 @@
}
},
+ updateMylove(){
+ const loveItem = this.loveItem
+ 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
+ });
+ }
+ },
// 用户提交
handleSubmit(){
if(this.name==''){
@@ -323,15 +370,12 @@
if(this.kinds==1){
// 添加用户验光单
- console.log('kinds====>',this.pickerInfoChioce.leftSph)
- console.log('kinds====>',this.pickerInfoChioce.leftSph==Number)
- console.log('kinds====>',this.pickerInfoChioce.rightSph==Number)
if(this.pickerInfoChioce.rightSph==''||this.pickerInfoChioce.leftSph==''||
this.pickerInfoChioce.leftCyl==''||this.pickerInfoChioce.rightCyl==''||
- this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi==''
+ this.pickerInfoChioce.leftAxi==''||this.pickerInfoChioce.rightAxi=='' ||!this.glassInfoRight
){
uni.showToast({
- title:"请输入您的验光数据",
+ title:"请完善您的数据~",
icon: "none",
duration: 2000,
})
@@ -355,14 +399,10 @@
// time: this.pickerInfoChioce.time,
// img_url2: "http://localhost:8087/images/shop_1/1/",
});
- // store.dispatch('myLoveList/getLoveList', {
- // uid: this.$store.state.user.userInfo.uid,
- // });
uni.navigateBack({
delta:1,
animationDuration:2000
})
-
} else{
uni.showToast({
title:"请确认您的验光数据",
@@ -370,20 +410,13 @@
duration: 3000,
})
}
-
}
-
}
if(this.kinds==2){
- // console.log('kinds====>',this.kinds)
- // console.log('pickerindex=====>',this.pickerInfoList[0].nameIndex1)
- // console.log('this.pickerInfoChioce====>',type(this.pickerInfoChioce))
if(this.confirm){
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,
@@ -440,16 +473,14 @@
}
}
+ this.updateMylove()
+ flag=1
if(flag!=0){
- store.dispatch('myLoveList/getLoveList', {
- uid: this.$store.state.user.userInfo.uid,
- });
uni.navigateBack({
delta:1,
animationDuration:2000
})
}
-
} else{
uni.showToast({
title:"请确认您的验光数据",
@@ -457,14 +488,9 @@
duration: 3000,
})
}
-
}
-
-
}
-
}
-
},
changeConfirm() {
this.confirm = !this.confirm