pointsMyCollection.vue
7.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<template>
<div class="records_back">
<!-- 占位 -->
<div class="title_box_lh" :style="'padding-top: ' + (($parent.top.value)+8) + 'px'">
</div>
<!--返回按钮-->
<div class="title_box" :style="'padding-top: ' + (($parent.top.value)+8) + 'px'" >
<div class="title"> <!--返回按钮-->
<img @click="goback"
class="goback" src="static/img/icon_back.png" />
<div class="text">我的收藏</div>
</div>
</div>
<div class="com_box"
v-infinite-scroll="loadMore"
infinite-scroll-disabled="loading"
:infinite-scroll-distance="list.length">
<div @click="jumpOrderDes(item)" class="item_box" v-for="(item, index) in list" :key="index">
<img v-lazy="item.simg" src="item" alt=""/>
<div class="right">
<div class="name">
{{item.title}}
</div>
<div v-if="item.ads" class="exchange_time">
{{item.ads}}
</div>
<div class="exchange_type">
<span >{{item.num}}积分</span>
<span v-show="item.price>0"> + {{item.price}}元</span>
</div>
</div>
</div>
</div>
<!-- 暂无记录展示 -->
<div v-show="list.length == 0 && isCall" class="no_gift_tip">
<img src="static/img/no_gift_tip.png" alt=""/>
<div class="text">暂无收藏商品</div>
</div>
<div v-show="list.length>0 && isMore ==0" class="is_more">
没有更多了
</div>
<!-- 地址信息组件 -->
<!-- <app-address-toast ref="itemsInfo" @toUpdate="updateAddressInfo" v-show="pointsToast_control"></app-address-toast> -->
</div>
</template>
<script>
// 引入组件
import { Toast, Indicator } from "mint-ui";
// import appAddressToast from "@/components/appAddressToast/appAddressToast";
export default {
data () {
return {
list: [], // 中奖记录列表
page: 0,
isMore: 1, // 0没有更多1有更多
addressInfo: null, // 暂存已选商品发货地址信息
isCall: false, // 是否调用接口
// pointsToast_control: this.$route.query.pointsToast_control,
}
},
//部件
components: {
// appAddressToast
},
//静态
props: [
],
//对象内部的属性监听,也叫深度监听
watch: {
},
//属性的结果会被缓存,除非依赖的响应式属性变化才会重新计算。主要当作属性来使用;
computed: {
},
//方法表示一个具体的操作,主要书写业务逻辑;
methods: {
// 跳转原生商品详情页
jumpOrderDes (item) {
/**
* 跳转商品详情
* @param {Object} item [数据对象]
*/
if (this.isCNLive.value) {
// 校验登录
if (this.$parent.checkLogin()) {
// 通用跳转跳转到商品详情页新打开webview
if (typeof this.$parent.gotoDetail === 'function') {
// 设置跳转参数
let params = {
type: '5',
to: window.location.origin + '/html/select_good/1/#/goodDetails?goodsId=' + item.id,
shop_type: ''
};
// 页面跳转
this.$parent.gotoDetail(params);
}
}
} else {
this.$parent.callApp();
}
},
// 填写地址
// addAddressInfo (item) {
// // 如果是实物弹起填写地址弹窗
// this.pointsToast_control = true;
// // 礼品兑换弹框派发
// this.$refs.itemsInfo.getItemInfo(item, item.id);
// },
// 填写完地址回调
// updateAddressInfo (orderInfo, addressInfo) {
// console.log(orderInfo);
// this.list.forEach(item => {
// let obj = item;
// for (let key in obj) {
// if (item.id == orderInfo.id) {
// this.$set(item, "address_name", addressInfo.name);
// this.$set(item, "address_phone", addressInfo.phone);
// this.$set(item, "address_address", addressInfo.address);
// }
// }
// });
// },
// 下拉刷新
loadMore () {
this.loading = true;
this.page++;
this.getCellGoodsList(this.page);
},
// 积分商城收藏列表
/**
* 获取活动详情页信息
* @param {string} id [活动id]
* * @param {string} uid [用户id]
*/
getCellGoodsList (page) {
if (this.isMore == 1) {
// 加载中提示
Indicator.open("加载中...");
// 请求接口
this.http(
"/Api/" + this.getApiVersion().LuckDraw + "/cellGoodsList",
{
uid: this.getStore("uid"),
page: page
},
this.getCellGoodsListCallback,
{
method: "POST"
}
);
}
},
/**
* 获取积分商城收藏列表信息回调
* @param {object} res [服务器返回数据]
* @param {object} ext [扩展参数]
*/
getCellGoodsListCallback (res, ext) {
this.loading = false;
// 加载完成
Indicator.close();
this.isCall = true;
// 返回处理
if (res.code == 200) {
// 解构数据
let { data: datas } = res;
if (datas.length == 0) {
this.isMore = 0;
} else {
/* 获取活动详情页数据 开始 */
for (let i = 1; i <= datas.length; i++) {
this.list.push(datas[i - 1]);
}
}
/* 获取积分商城收藏列表 结束 */
} else if (res.code == 400) {
// 获取积分商城收藏列表失败
Toast(res.message);
} else {
// 获取积分商城收藏列表失败
Toast("获取积分商城收藏列表失败");
}
},
/**
* 后退
*/
goback () {
// 判断是否有处理函数
if (typeof this.$parent.back === 'function') {
// 后退
this.$parent.back();
} else {
// 后退
window.history.go(-1);
}
},
/**
* app选中地址回选
* @param {Object} addressInfo [服务器返回数据]
*/
appSelectAddressCallback (addressInfo) {
if (this.isAndroid.value) {
this.$refs.itemsInfo.getAppAddressInfo(addressInfo);
} else {
if (addressInfo) {
this.$refs.itemsInfo.getAppAddressInfo(JSON.parse(addressInfo));
} else {
this.$refs.itemsInfo.getAppAddressInfo();
}
}
},
},
//请求数据
created () {
if (this.isiPhone.value || this.isiPad.value) {
this.pointsToast_control = this.$route.query.pointsToast_control;
} else {
let ext = window.localStorage.getItem("ext");
this.pointsToast_control = this.getParameterByName(
"pointsToast_control",
ext
);
}
},
mounted () {
// 地址回选原生回调
var that = this;
window["appSelectAddressCallback"] = function (result) {
that.appSelectAddressCallback(result);
};
// if (this.plat == "i") {
// var that = this;
// function resolution (data) {
// that.appSelectAddressCallback();
// }
// this.$bridge.registerHandler("appSelectAddressCallback", function (
// data,
// responseCallback
// ) {
// resolution(data);
// responseCallback(data);
// });
// } else if (this.plat == "a") {
// }
// 页面显示监听
// document.addEventListener('visibilitychange', () => {
// // 页面显示出来了
// if (document.hidden === false) {
// this.list = []; // 中奖记录列表
// this.page = 0;
// this.isMore =1; // 0没有更多1有更多
// this.loadMore();
// }
// });
}
}
</script>
<style rel="stylesheet/less" scoped lang="less">
@import 'pointsMyCollection';
</style>