Commit 45f42c5f0bab89a2a52b4b51ffcc5cd623565c4f

Authored by 王强
1 parent 028f0237

积分兑换,线下领取,我得订单添加领取按钮~

src/pages/partyBuildingGoodDetails/partyBuildingGoodDetails.vue
... ... @@ -362,15 +362,6 @@ export default {
362 362 */
363 363 addLuckIntegralOrder (addressId) {
364 364  
365   - console.log('addLuckIntegralOrder', addressId);
366   - console.log('uid', this.getStore("uid"));
367   - console.log('id', this.$route.query.goodsId);
368   - console.log('addressId', addressId || (this.currentAddress && this.currentAddress.id ? this.currentAddress.id : ''));
369   -
370   - // return false;
371   -
372   -
373   -
374 365 // 加载中提示
375 366 Indicator.open("加载中...");
376 367  
... ...
src/pages/pointsExchangeRecords/pointsExchangeRecords.less
... ... @@ -96,6 +96,17 @@
96 96 line-height: 60px;
97 97 text-align: center;
98 98 }
  99 + .gray{
  100 + width: 160px;
  101 + height: 60px;
  102 + border: 1px solid #9B9B9B;
  103 + border-radius: 30px;
  104 + font-size: 30px;
  105 + font-weight: 400;
  106 + color: #9B9B9B;
  107 + line-height: 60px;
  108 + text-align: center;
  109 + }
99 110 img{
100 111 display: block;
101 112 width: 22px;
... ...
src/pages/pointsExchangeRecords/pointsExchangeRecords.vue
... ... @@ -7,7 +7,7 @@
7 7  
8 8 <!--返回按钮-->
9 9 <img @click="goback" class="goback" src="static/img/icon_back.png" />
10   - <div class="text">我的订单</div>
  10 + <div class="text">{{ title }}</div>
11 11 </div>
12 12 </div>
13 13  
... ... @@ -29,7 +29,7 @@
29 29 <span v-show="item.price>0"> + {{item.price}}元</span>
30 30 </div>
31 31 <div class="exchange_time">
32   - 兑换时间 {{item.create_time*1000 | datetime('yyyy-MM-dd hh:mm:ss')}}
  32 + 兑换时间 {{item.create_time * 1000 | datetime('yyyy-MM-dd hh:mm:ss')}}
33 33 </div>
34 34 <div v-show="item.shop_type == 1 && !item.address_name && !item.address_address && !item.address_phone" class="btn-box">
35 35  
... ... @@ -42,6 +42,12 @@
42 42 <!-- 已填写地址等待发货状态 -->
43 43 <div v-show="item.sendtime && item.sendtime>0" class="look_logistics">查看物流</div>
44 44 </div>
  45 + <div v-show="item.shop_type == 4" class="btn-box">
  46 +
  47 + <!-- 已填写地址等待发货状态 -->
  48 + <div class="gray" v-show="item.sendtime && item.sendtime>0">已领取</div>
  49 + <div class="look_logistics" v-show="item.sendtime && item.sendtime==0">确认领取</div>
  50 + </div>
45 51 </div>
46 52 </div>
47 53 </div>
... ... @@ -49,7 +55,7 @@
49 55 <!-- 暂无记录展示 -->
50 56 <div v-show="list.length == 0 && isCall" class="no_gift_tip">
51 57 <img src="static/img/no_gift_tip.png" alt=""/>
52   - <div class="text">暂无我的订单</div>
  58 + <div class="text">暂无订单</div>
53 59 </div>
54 60 <div v-show="list.length>0 && isMore ==0" class="is_more">
55 61 没有更多了
... ... @@ -67,7 +73,8 @@ import { Toast, Indicator } from &quot;mint-ui&quot;;
67 73 export default {
68 74 data () {
69 75 return {
70   - list: [], // 中奖记录列表
  76 + title: "", // 标题
  77 + list: [], // 订单列表记录列表
71 78 page: 0,
72 79 isMore: 1, // 0没有更多1有更多
73 80 addressInfo: null, // 暂存已选商品发货地址信息
... ... @@ -130,8 +137,91 @@ export default {
130 137 this.$set(this.$parent, "showOptions", options);
131 138 // 显示通用浮层
132 139 this.$parent.$refs.showModal.showLayer();
  140 + } else if (item.shop_type == 4 && item.sendtime == 0) {
  141 + // 线下领取商品
  142 + // 校验登录
  143 + if (this.$parent.checkLogin()) {
  144 + // 提示用积分值兑换兑换
  145 + let options = {
  146 + title: "",
  147 + message: "确认领取?",
  148 + confirmButtonText: "确定",
  149 + confirmButtonCallback: this.finishLuckIntegralOrder,
  150 + showCancelButton: true,
  151 + cancelButtonText: "取消",
  152 + params:item
  153 + };
  154 + // 调用showModal层参数
  155 + this.$set(this.$parent, "showOptions", options);
  156 + // 显示通用浮层
  157 + this.$parent.$refs.showModal.showLayer();
  158 + }
133 159 }
134 160 },
  161 +
  162 + /**
  163 + * 确认领取
  164 + * @param {object} item [订单信息]
  165 + */
  166 + finishLuckIntegralOrder(item) {
  167 +
  168 + // 加载中提示
  169 + Indicator.open("确认中...");
  170 +
  171 + // 请求接口
  172 + this.http("/Api/" + this.getApiVersion().LuckDraw + "/finishLuckIntegralOrder", {
  173 + id: item.id,
  174 + uid: this.getStore("uid")
  175 + }, this.finishLuckIntegralOrderCallback, {
  176 + method: "POST",
  177 + item
  178 + });
  179 + },
  180 +
  181 + /**
  182 + * 确认领取回调
  183 + * @param {Object} res [服务器返回数据]
  184 + * @param {Object} ext [扩展参数]
  185 + */
  186 + finishLuckIntegralOrderCallback (res, ext) {
  187 +
  188 + console.log('finishLuckIntegralOrderCallback', res, ext);
  189 +
  190 + // 加载完成
  191 + Indicator.close();
  192 +
  193 + // 提示标题
  194 + let title = '';
  195 +
  196 + // 返回处理
  197 + if (res.code == 200) {
  198 +
  199 + // 领取成功
  200 + title = '领取成功';
  201 +
  202 + // 设置领取成功状态
  203 + ext.item.sendtime = new Date().getTime();
  204 + } else {
  205 +
  206 + // 领取失败
  207 + title = '领取失败';
  208 + }
  209 +
  210 + // 显示查看地址弹框
  211 + let options = {
  212 + title: title,
  213 + message: "",
  214 + messageAlign: "center",
  215 + confirmButtonText: "我知道了",
  216 + confirmButtonCallback: ""
  217 + };
  218 +
  219 + this.$set(this.$parent, "showOptions", options);
  220 +
  221 + // 显示通用浮层
  222 + this.$parent.$refs.showModal.showLayer();
  223 + },
  224 +
135 225 // 填写地址
136 226 // addAddressInfo (item) {
137 227 // // 如果是实物弹起填写地址弹窗
... ... @@ -184,41 +274,43 @@ export default {
184 274 this.page++;
185 275 this.getmyLuckDraw(this.page);
186 276 },
187   - // 抽奖记录
  277 +
188 278 /**
189   - * 获取活动详情页信息
190   - * @param {string} id [活动id]
191   - * * @param {string} uid [用户id]
  279 + * 获取订单列表
  280 + * @param {String} page [页码]
192 281 */
193   - getmyLuckDraw (page) {
  282 + getmyLuckDraw(page) {
  283 +
  284 + // 判断是否有更多
194 285 if (this.isMore == 1) {
  286 +
195 287 // 加载中提示
196 288 Indicator.open("加载中...");
  289 +
197 290 // 请求接口
198   - this.http(
199   - "/Api/" + this.getApiVersion().LuckDraw + "/myLuckIntegralOrder",
200   - {
201   - uid: this.getStore("uid"),
202   - page: page,
203   - type: this.$route.query.type // 1亲子嘉年华 2 康疫健步 3 积分商城 4 脐橙 7 健康商城
204   - },
205   - this.myLuckDrawCallback,
206   - {
207   - method: "POST"
208   - }
209   - );
  291 + this.http("/Api/" + this.getApiVersion().LuckDraw + "/myLuckIntegralOrder", {
  292 + uid: this.getStore("uid"),
  293 + page: page,
  294 + type: this.$route.query.type // 1亲子嘉年华 2 康疫健步 3 积分商城 4 脐橙 7 健康商城 11 积分兑换订单列表
  295 + }, this.myLuckDrawCallback, {
  296 + method: "POST"
  297 + });
210 298 }
211 299 },
  300 +
212 301 /**
213 302 * 获取抽奖记录信息回调
214 303 * @param {object} res [服务器返回数据]
215 304 * @param {object} ext [扩展参数]
216 305 */
217 306 myLuckDrawCallback (res, ext) {
  307 +
218 308 this.loading = false;
  309 +
219 310 // 加载完成
220 311 Indicator.close();
221 312 this.isCall = true;
  313 +
222 314 // 返回处理
223 315 if (res.code == 200) {
224 316 // 解构数据
... ... @@ -226,18 +318,22 @@ export default {
226 318 if (datas.list.length == 0) {
227 319 this.isMore = 0;
228 320 } else {
229   - /* 获取活动详情页数据 开始 */
  321 +
  322 + /* 获取积分兑换订单数据 开始 */
230 323 for (let i = 1; i <= datas.list.length; i++) {
231 324 this.list.push(datas.list[i - 1]);
232 325 }
233 326 }
234   - /* 获取抽奖记录 结束 */
  327 +
  328 + /* 获取积分兑换订单数据 结束 */
235 329 } else if (res.code == 400) {
236   - // 获取抽奖记录失败
  330 +
  331 + // 获取订单失败
237 332 Toast(res.message);
238 333 } else {
239   - // 获取抽奖记录失败
240   - Toast("获取抽奖记录失败");
  334 +
  335 + // 获取订单失败
  336 + Toast("获取订单失败");
241 337 }
242 338 },
243 339 /**
... ... @@ -287,6 +383,9 @@ export default {
287 383 },
288 384 //请求数据
289 385 created () {
  386 + // 设置标题
  387 + this.$set(this, "title", "我的订单");
  388 +
290 389 if (this.isiPhone.value || this.isiPad.value) {
291 390 this.pointsToast_control = this.$route.query.pointsToast_control;
292 391 } else {
... ... @@ -297,6 +396,24 @@ export default {
297 396 );
298 397 }
299 398 },
  399 + //对象内部的属性监听,也叫深度监听
  400 + head: {
  401 + title () {
  402 + return {
  403 + inner: this.title
  404 + }
  405 + }
  406 + },
  407 + watch: {
  408 + // 设置页面标题
  409 + title (newVal) {
  410 + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
  411 + this.$iFrame.insertIFrame(newVal);
  412 + } else {
  413 + this.$emit("updateHead");
  414 + }
  415 + }
  416 + },
300 417 mounted () {
301 418 // 地址回选原生回调
302 419 var that = this;
... ... @@ -336,5 +453,4 @@ export default {
336 453  
337 454 <style rel="stylesheet/less" scoped lang="less">
338 455 @import 'pointsExchangeRecords';
339   -</style>
340   -
  456 +</style>
341 457 \ No newline at end of file
... ...