diff --git a/App.vue b/App.vue
index 6b41c6c..1cdc5c0 100644
--- a/App.vue
+++ b/App.vue
@@ -1,5 +1,4 @@
-
diff --git a/framework/11-api.js b/framework/11-api.js
index 489545c..e3ffbba 100644
--- a/framework/11-api.js
+++ b/framework/11-api.js
@@ -104,19 +104,18 @@ async function request(options) {
if (res.code != 0) {
console.log(options)
if (res.code == -4) {
- // uni.showToast({
- // title: '',
- // // title: res.message || res.msg,
- // icon: "none",
- // success: () => {
- // setTimeout(res => {
- // store.dispatch("loginEvent"); //获取shapid
- // }, 1000)
- // }
- // })
- setTimeout(res => {
- store.dispatch("loginEvent"); //获取shapid
- }, 1000)
+ uni.showToast({
+ title: res.message || res.msg,
+ icon: "none",
+ success: () => {
+ // setTimeout(res => {
+ // store.dispatch("loginEvent"); //获取shapid
+ // }, 1000)
+ }
+ })
+ // setTimeout(res => {
+ // store.dispatch("loginEvent"); //获取shapid
+ // }, 1000)
} else if (res.code == 482) {
let nowTime = new Date() / 1000 | 0
let offset = parseInt(res.data.message) - parseInt(nowTime);
diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue
index d294b50..6766b67 100644
--- a/pages/order_food/order_food.vue
+++ b/pages/order_food/order_food.vue
@@ -110,10 +110,11 @@
-
-
TOP{{index1+1}}
@@ -277,7 +278,7 @@
{{item.name}}
-
+
@@ -389,15 +390,6 @@
this.$store.getters.is_BarHeight.customBar)
}
},
- onReady() {
- // setTimeout(() => {
- // uni.getSystemInfo({
- // success: (data) => {
- // this.scrollHeight = data.windowHeight
- // }
- // })
- // }, 100);
- },
onLoad(e) {
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
@@ -442,7 +434,7 @@
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.$on('message', this.getMessage)
-
+
_this.getLocation()
}
},
@@ -476,36 +468,40 @@
"type": "connect",
})
},
-
+
/**
* 获取定位
*/
- getLocation () {
- uni.getLocation({
- type: 'wgs84',
- success: async (res) => {
- let successres = await this.api.geocodelocation({
- lng: res.longitude,
- lat: res.latitude,
- })
- if (successres.code == 0) {
- let datastorage = {
- country: successres.data.addressComponent.country, // "中国"
- province: successres.data.addressComponent.province, //province: "陕西省"
- address: successres.data.addressComponent.city, //district: "西安市"
- district: successres.data.addressComponent.district, //district: "未央区"
+ getLocation() {
+ try {
+ uni.getLocation({
+ type: 'wgs84',
+ success: async (res) => {
+ let successres = await this.api.geocodelocation({
lng: res.longitude,
lat: res.latitude,
+ })
+ if (successres.code == 0) {
+ let datastorage = {
+ country: successres.data.addressComponent.country, // "中国"
+ province: successres.data.addressComponent.province, //province: "陕西省"
+ address: successres.data.addressComponent.city, //district: "西安市"
+ district: successres.data.addressComponent.district, //district: "未央区"
+ lng: res.longitude,
+ lat: res.latitude,
+ }
+ uni.cache.set('getLocationstorage', datastorage);
+ this.productqueryShop();
}
- uni.cache.set('getLocationstorage', datastorage);
+ },
+ fail: async (err) => {
this.productqueryShop();
}
- },
- fail: async (err) => {
- console.log(err, '获取错误') //测试用于app
- this.productqueryShop();
- }
- });
+ });
+ } catch (e) {
+ this.productqueryShop();
+ //TODO handle the exception
+ }
},
/**
@@ -514,8 +510,10 @@
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
- lng: uni.cache.get('getLocationstorage').lng?uni.cache.get('getLocationstorage').lng:'',
- lat: uni.cache.get('getLocationstorage').lat? uni.cache.get('getLocationstorage').lat:'',
+ lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
+ '',
+ lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
+ '',
})
if (res.code == 0) {
uni.cache.set('shopUser', res.data.storeInfo.id)
@@ -529,18 +527,18 @@
}
},
-
+
/**
* 图片加载
*/
- imageLoaded (item,index,index1) {
+ imageLoaded(item, index, index1) {
console.log(index)
console.log(index1)
console.log(this.shopProductList.productInfo[index])
this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
// e.currentTarget.src
},
-
+
/**
* 商品数量增加/减少
* @param {Object} item
@@ -735,7 +733,7 @@
start: -1,
children: []
}
- item.value.split(",").forEach((v,e)=>{
+ item.value.split(",").forEach((v, e) => {
res.children.push({
name: v,
isGrounding: false
@@ -743,7 +741,7 @@
})
return res
})
-
+
//初始化第一列规格可编辑
let filteredJson;
let isSkuidname = [];
@@ -756,14 +754,14 @@
console.log(filteredJson);
for (let i = 0; i < filteredJson.length; i++) {
console.log(filteredJson[i].isGrounding)
- if ( filteredJson[i].isGrounding ) {
+ if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[0].children[o].isGrounding = true
break; // 终止循环
}
}
-
+
}
-
+
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}哦`
// this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
@@ -787,7 +785,7 @@
* @param {Object} item
*/
async morloe(e, index, index1, item) {
- if ( !e.isGrounding ) {
+ if (!e.isGrounding) {
return;
}
@@ -801,18 +799,18 @@
}
this.skuidname = [];
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个
- if ( i > index ) {
- val.children.forEach(( v1,e1)=>{
+ if (i > index) {
+ val.children.forEach((v1, e1) => {
v1.isGrounding = false;
})
val.start = -1;
}
- if ( val.start >= 0 ) {
+ if (val.start >= 0) {
this.skuidname.push(val.children[val.start].name)
}
})
// this.skuidname.splice(index, 1, e.info); //替换skuidname的数据
-
+
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
@@ -820,36 +818,36 @@
break; // 终止循环
}
}
-
-
+
+
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
- if ( this.specifications.tagSnap[index+1] ) {
- for (let o = 0; o < this.specifications.tagSnap[index+1].children.length; o++) {
+ if (this.specifications.tagSnap[index + 1]) {
+ for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
- isSkuidname.push(this.specifications.tagSnap[index+1].children[o].name)
+ isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
//筛选符合条件的规格列表
console.log(isSkuidname);
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
console.log(filteredJson);
for (let i = 0; i < filteredJson.length; i++) {
console.log(filteredJson[i].isGrounding)
- if ( filteredJson[i].isGrounding ) {
- this.specifications.tagSnap[index+1].children[o].isGrounding = true
+ if (filteredJson[i].isGrounding) {
+ this.specifications.tagSnap[index + 1].children[o].isGrounding = true
break; // 终止循环
}
}
-
+
}
}
-
-
+
+
// res.data.forEach((v,e)=>{
// // this.$set(this.specifications.tagSnap[e], 'children', v.value)
// })
console.log(this.specifications.tagSnap)
-
+
this.$forceUpdate();
this.hodgepodge(item, 2)
},