Skip to content

Commit 6c417c8

Browse files
committed
update
1 parent 138769b commit 6c417c8

9 files changed

Lines changed: 503 additions & 438 deletions

File tree

‎src/components/common/shoplist.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ export default {
113113
//数据的定位加20位
114114
this.offset += 20;
115115
let res = await shopList(this.latitude, this.longitude, this.offset, this.restaurantCategoryId);
116-
this.preventRepeatReuqest = false;
117116
this.hideLoading();
118117
this.shopListArr = [...this.shopListArr, ...res];
119118
//当获取数据小于20,说明没有更多数据,不需要再次请求数据
120119
if (res.length < 20) {
121120
return
122121
}
122+
this.preventRepeatReuqest = false;
123123
},
124124
//返回顶部
125125
backTop(){

‎src/page/order/children/orderDetail.vue‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</ul>
3131
<div class="deliver_fee">
3232
<span>配送费</span>
33-
<span>{{orderDetail.basket.deliver_fee.price}}</span>
33+
<span>{{orderDetail.basket.deliver_fee&&orderDetail.basket.deliver_fee.price || 0}}</span>
3434
</div>
3535
<div class="pay_ment">实付{{orderDetail.total_amount.toFixed(2)}}</div>
3636
</section>
@@ -118,18 +118,26 @@
118118
},
119119
methods: {
120120
async initData(){
121-
// this.orderData = await getOrderDetail(this.userInfo.user_id, this.orderDetail.id);
122-
this.orderData = await getOrderDetail(1, 1);
123-
this.showLoading = false;
124-
this.$nextTick(() => {
125-
new BScroll('#scroll_section', {
126-
deceleration: 0.001,
127-
bounce: true,
128-
swipeTime: 1800,
129-
click: true,
130-
});
131-
})
121+
if (this.userInfo && this.userInfo.user_id) {
122+
this.orderData = await getOrderDetail(this.userInfo.user_id, this.orderDetail.unique_id);
123+
this.showLoading = false;
124+
this.$nextTick(() => {
125+
new BScroll('#scroll_section', {
126+
deceleration: 0.001,
127+
bounce: true,
128+
swipeTime: 1800,
129+
click: true,
130+
});
131+
})
132+
}
132133
},
134+
},
135+
watch: {
136+
userInfo: function (value) {
137+
if (value && value.user_id) {
138+
this.initData();
139+
}
140+
}
133141
}
134142
}
135143
</script>

‎src/page/order/order.vue‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
},
6262
mounted(){
6363
this.initData();
64-
6564
},
6665
mixins: [loadMore],
6766
components: {
@@ -79,8 +78,11 @@
7978
'SAVE_ORDER'
8079
]),
8180
async initData(){
82-
this.orderList = await getOrderList(111, this.offset);
83-
this.hideLoading();
81+
if (this.userInfo && this.userInfo.user_id) {
82+
let res = await getOrderList(this.userInfo.user_id, this.offset);
83+
this.orderList = [...res];
84+
this.hideLoading();
85+
}
8486
},
8587
async loaderMore(){
8688
if (this.preventRepeat) {
@@ -89,13 +91,17 @@
8991
this.preventRepeat = true;
9092
this.showLoading = true;
9193
this.offset += 10;
92-
let res = await getOrderList(111, this.offset);
93-
this.orderList = this.orderList.concat(this.orderList, res);
94-
this.preventRepeat = false;
94+
let res = await getOrderList(this.userInfo.user_id, this.offset);
95+
this.orderList = [...this.orderList, ...res];
9596
this.hideLoading();
97+
if (res.length < 10) {
98+
return
99+
}
100+
this.preventRepeat = false;
96101
},
97102
showDetail(item){
98103
this.SAVE_ORDER(item);
104+
this.preventRepeat = false;
99105
this.$router.push('/order/orderDetail');
100106
},
101107
hideLoading(){
@@ -109,6 +115,13 @@
109115
this.showLoading = false;
110116
}
111117
},
118+
},
119+
watch: {
120+
userInfo: function (value) {
121+
if (value && value.user_id && !this.orderList) {
122+
this.initData();
123+
}
124+
}
112125
}
113126
}
114127
</script>

‎src/page/profile/children/children/address.vue‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,15 @@
4646
adressList:[],
4747
}
4848
},
49-
created(){
50-
//console.log(this.userInfo.user_id)
51-
this.saveAddress()
52-
49+
mounted(){
50+
this.initData();
5351
},
5452
mixins: [getImgPath],
5553
mounted(){
5654
5755
},
5856
components: {
5957
headTop,
60-
6158
},
6259
computed:{
6360
...mapState([
@@ -70,7 +67,11 @@
7067
...mapActions([
7168
'saveAddress'
7269
]),
73-
70+
initData(){
71+
if (this.userInfo && this.userInfo.user_id) {
72+
this.saveAddress();
73+
}
74+
},
7475
editThing(){
7576
if(this.editText == '编辑'){
7677
this.editText='完成';
@@ -83,6 +84,13 @@
8384
deleteSite(index){
8485
this.removeAddress.splice(index, 1);
8586
}
87+
},
88+
watch: {
89+
userInfo: function (value) {
90+
if (value && value.user_id) {
91+
this.initData();
92+
}
93+
}
8694
}
8795
}
8896
</script>

‎src/page/profile/children/children/children/add.vue‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import headTop from 'src/components/header/head'
4040
import {getImgPath} from 'src/components/common/mixin'
4141
import {mapState, mapMutations} from 'vuex'
42+
import {postAddAddress} from 'src/service/getData'
4243
export default {
4344
data(){
4445
return{
@@ -69,7 +70,7 @@
6970
},
7071
computed:{
7172
...mapState([
72-
'addAddress','removeAddress','newAddress',
73+
'userInfo', 'addAddress','removeAddress','newAddress', 'geohash'
7374
]),
7475
7576
},
@@ -122,7 +123,8 @@
122123
this.butpart=false;
123124
}
124125
},
125-
submitThing(){
126+
async submitThing(){
127+
let res = await postAddAddress(this.userInfo.user_id, this.mesthree, this.addAddress, this.geohash, this.message, this.telenum, this.standbytelenum, 0, 1, '公司', 4);
126128
if(this.butpart){
127129
this.ADD_ADDRESS({
128130
name: this.message,

0 commit comments

Comments
 (0)