Commit 16424ae940865af28a175fd67b0688a2da940a6f
1 parent
3f832e9b
填写地址优化
Showing
4 changed files
with
106 additions
and
22 deletions
src/components/addressToast/addressToast.vue
| ... | ... | @@ -52,6 +52,7 @@ export default { |
| 52 | 52 | itemInfo: null, |
| 53 | 53 | addressInfo: null, |
| 54 | 54 | goodsId: null, // 兑换商品ID |
| 55 | + orderId: null, // 订单ID 先兑换后填地址使用 | |
| 55 | 56 | // drawRecordItemInfo: null // 中奖记录单条信息 |
| 56 | 57 | }; |
| 57 | 58 | }, |
| ... | ... | @@ -85,9 +86,13 @@ export default { |
| 85 | 86 | }, |
| 86 | 87 | methods: { |
| 87 | 88 | // 父组件点击兑换调用子组件传值商品商品信息 |
| 88 | - getItemInfo (content) { | |
| 89 | + getItemInfo (content, orderId) { | |
| 89 | 90 | this.itemInfo = content; |
| 90 | - this.goodsId = content.id; // 获取需要兑换商品的ID | |
| 91 | + if (orderId) { | |
| 92 | + this.orderId = orderId | |
| 93 | + } else { | |
| 94 | + this.goodsId = content.id; // 获取需要兑换商品的ID | |
| 95 | + } | |
| 91 | 96 | // 获取商品信息接口 |
| 92 | 97 | this.luckDrawGift(content.id); |
| 93 | 98 | // 获取首选地址接口 |
| ... | ... | @@ -251,15 +256,30 @@ export default { |
| 251 | 256 | * 确定 |
| 252 | 257 | */ |
| 253 | 258 | confirm () { |
| 254 | - let orderInfo = { | |
| 255 | - addressId: this.$route.query.addressId || this.addressInfo.id, | |
| 256 | - id: this.$route.query.goodsId || this.goodsId, // 兑换商品ID | |
| 257 | - }; | |
| 259 | + // 兑换商品的ID分两种一种是订单ID填写地址;一种是有商品地址填写地址 | |
| 260 | + let orderInfo; | |
| 261 | + if (this.$route.query.orderId || this.orderId) { | |
| 262 | + orderInfo = { | |
| 263 | + addressId: this.$route.query.addressId || this.addressInfo.id, | |
| 264 | + id: this.$route.query.orderId || this.orderId, // 兑换商品ID | |
| 265 | + }; | |
| 266 | + } else if (this.$route.query.goodsId || this.goodsId) { | |
| 267 | + orderInfo = { | |
| 268 | + addressId: this.$route.query.addressId || this.addressInfo.id, | |
| 269 | + id: this.$route.query.goodsId || this.goodsId, // 兑换商品ID | |
| 270 | + }; | |
| 271 | + } | |
| 258 | 272 | // 隐藏弹框 |
| 259 | 273 | this.$parent.pointsToast_control = false; |
| 260 | 274 | // 安卓手机下特殊处理 |
| 261 | 275 | if (this.isAndroid.value) { |
| 262 | - orderInfo.id = this.getParameterByName("goodsId") || this.goodsId | |
| 276 | + // 兑换商品的ID分两种一种是订单ID填写地址;一种是有商品地址填写地址 | |
| 277 | + if (this.getParameterByName("orderId") || this.orderId) { | |
| 278 | + orderInfo.id = this.getParameterByName("orderId") || this.orderId | |
| 279 | + } else if (this.getParameterByName("goodsId") || this.goodsId) { | |
| 280 | + orderInfo.id = this.getParameterByName("goodsId") || this.goodsId | |
| 281 | + } | |
| 282 | + | |
| 263 | 283 | orderInfo.addressId = window.localStorage.getItem("addressId") || this.addressInfo.id |
| 264 | 284 | orderInfo.pointsToast_control = this.getParameterByName("pointsToast_control") |
| 265 | 285 | // 安卓下清除locaStroe的ext数据 |
| ... | ... | @@ -268,7 +288,7 @@ export default { |
| 268 | 288 | window.location.href = |
| 269 | 289 | window.location.href.split("?")[0] + |
| 270 | 290 | "?uid=" + |
| 271 | - this.getStore("uid") | |
| 291 | + this.getStore("uid") + "&goodsId=" + this.$route.query.goodsId || this.goodsId | |
| 272 | 292 | } |
| 273 | 293 | // 最新地址信息回传给父组件 |
| 274 | 294 | this.$parent.addressInfo = this.addressInfo; |
| ... | ... | @@ -276,7 +296,7 @@ export default { |
| 276 | 296 | }, |
| 277 | 297 | // 更改地址 |
| 278 | 298 | changeAddress () { |
| 279 | - // 安卓手机两次更改地址goodsId没拿到从咯擦S | |
| 299 | + // 安卓手机两次更改地址goodsId没拿到从 | |
| 280 | 300 | if (this.isAndroid.value && !this.goodsId) { |
| 281 | 301 | let ext = "&" + window.localStorage.getItem("ext") |
| 282 | 302 | this.goodsId = this.getParameterByName( |
| ... | ... | @@ -295,6 +315,8 @@ export default { |
| 295 | 315 | encodeURIComponent( |
| 296 | 316 | "goodsId=" + |
| 297 | 317 | this.goodsId + |
| 318 | + "orderId=" + | |
| 319 | + this.orderId + | |
| 298 | 320 | "&pointsToast_control=" + |
| 299 | 321 | this.$parent.pointsToast_control |
| 300 | 322 | ) + | ... | ... |
src/pages/goodDetails/goodDetails.less
| 1 | 1 | .good-details-box{ |
| 2 | 2 | padding-bottom: 130px; |
| 3 | + .pl { | |
| 4 | + background-color: transparent; | |
| 5 | + width: 100%; | |
| 6 | + &.is-open-app { | |
| 7 | + height: 122px; | |
| 8 | + } | |
| 9 | + &.is-cnlive { | |
| 10 | + height: 93px; | |
| 11 | + } | |
| 12 | + } | |
| 13 | + .hide{ | |
| 14 | + display:none; | |
| 15 | + } | |
| 16 | + .call-app-box{ | |
| 17 | + position: fixed; | |
| 18 | + } | |
| 19 | + .back-box{ | |
| 20 | + background-color: #FFF; | |
| 21 | + position:fixed; | |
| 22 | + position: fixed; | |
| 23 | + } | |
| 3 | 24 | .goods-img{ |
| 4 | 25 | display: block; |
| 5 | 26 | width: 100%; | ... | ... |
src/pages/goodDetails/goodDetails.vue
| ... | ... | @@ -10,13 +10,16 @@ |
| 10 | 10 | > |
| 11 | 11 | </call-app-box> |
| 12 | 12 | <back-box |
| 13 | - v-if="$parent.isBack && isCNLive.value" | |
| 13 | + v-if="isCNLive.value" | |
| 14 | + :class="{'hide': $route.query.hideBack == true}" | |
| 14 | 15 | class="back-box" |
| 15 | 16 | :style="'padding-top: ' + $parent.top.value + 'px'" |
| 16 | 17 | @back="back" |
| 17 | 18 | :backs="backs" |
| 18 | 19 | > |
| 19 | 20 | </back-box> |
| 21 | + <!-- pl --> | |
| 22 | + <div class="pl" :class="{'is-cnlive': isCNLive.value, 'is-open-app': $parent.isOpenApp.value, 'hide': $route.query.hideBack == true}"></div> | |
| 20 | 23 | <!--轮播--> |
| 21 | 24 | <!-- <swiper |
| 22 | 25 | :style=" |
| ... | ... | @@ -165,7 +168,7 @@ export default { |
| 165 | 168 | title: "", |
| 166 | 169 | message: "确定使用" + this.goodsInfo.num + "积分兑换?", |
| 167 | 170 | confirmButtonText: "确定", |
| 168 | - confirmButtonCallback: this.callAppModalCallback, | |
| 171 | + confirmButtonCallback: this.addIntegralOrderconfirm, | |
| 169 | 172 | showCancelButton: true, |
| 170 | 173 | cancelButtonText: "取消" |
| 171 | 174 | }; |
| ... | ... | @@ -175,7 +178,7 @@ export default { |
| 175 | 178 | this.$parent.$refs.showModal.showLayer(); |
| 176 | 179 | }, |
| 177 | 180 | // 确定兑换回调 |
| 178 | - callAppModalCallback () { | |
| 181 | + addIntegralOrderconfirm () { | |
| 179 | 182 | // isExchange为false才可兑换防止连续点击 |
| 180 | 183 | if (!this.isExchange) { |
| 181 | 184 | // 兑换 |
| ... | ... | @@ -183,6 +186,15 @@ export default { |
| 183 | 186 | } |
| 184 | 187 | }, |
| 185 | 188 | /** |
| 189 | + * 分享 | |
| 190 | + */ | |
| 191 | + toShare () { | |
| 192 | + // 判断分享 | |
| 193 | + if (typeof this.$parent.toShare === 'function') { | |
| 194 | + this.$parent.toShare(38, this.$route.query.id || 0); | |
| 195 | + } | |
| 196 | + }, | |
| 197 | + /** | |
| 186 | 198 | * 积分商品详情页页面接口 |
| 187 | 199 | */ |
| 188 | 200 | addIntegralOrder () { |
| ... | ... | @@ -217,14 +229,15 @@ export default { |
| 217 | 229 | // 两秒后可继续兑换 |
| 218 | 230 | let _this = this |
| 219 | 231 | setTimeout(function () { |
| 220 | - this.isExchange = false; | |
| 232 | + _this.isExchange = false; | |
| 221 | 233 | }, 1500); |
| 222 | 234 | // 显示查看地址弹框 |
| 223 | 235 | let options = { |
| 224 | 236 | message: "兑换成功", |
| 225 | 237 | messageAlign: "center", |
| 226 | 238 | confirmButtonText: "我知道了", |
| 227 | - // confirmButtonCallback: (datas.shop_type == 1) ? this.addAddressCallback(datas.shop_type) : "" | |
| 239 | + confirmButtonCallback: this.addAddressCallback, | |
| 240 | + params: { shopType: datas.shop_type, id: datas.id } | |
| 228 | 241 | }; |
| 229 | 242 | this.$set(this.$parent, "showOptions", options); |
| 230 | 243 | // 显示通用浮层 |
| ... | ... | @@ -233,20 +246,15 @@ export default { |
| 233 | 246 | |
| 234 | 247 | // 获取积分商品详情页失败 |
| 235 | 248 | Toast(res.message); |
| 236 | - } else { | |
| 237 | - | |
| 238 | - // 获取积分商品详情页失败 | |
| 239 | - Toast("获取积分商品详情页失败"); | |
| 240 | 249 | } |
| 241 | 250 | }, |
| 242 | 251 | // 填写地址 |
| 243 | - addAddressCallback (shopType) { | |
| 244 | - debugger | |
| 252 | + addAddressCallback (params) { | |
| 245 | 253 | // 如果是实物弹起填写地址弹窗 |
| 246 | - if (shopType == 1) { | |
| 254 | + if (params.shopType == 1) { | |
| 247 | 255 | this.pointsToast_control = true; |
| 248 | 256 | // 礼品兑换弹框派发 |
| 249 | - this.$refs.itemsInfo.getItemInfo(this.goodsInfo) | |
| 257 | + this.$refs.itemsInfo.getItemInfo(this.goodsInfo, params.id) | |
| 250 | 258 | } |
| 251 | 259 | }, |
| 252 | 260 | /** |
| ... | ... | @@ -333,6 +341,27 @@ export default { |
| 333 | 341 | |
| 334 | 342 | }, |
| 335 | 343 | mounted () { |
| 344 | + // 如果是App外,设置唤起App和微信内分享参数 | |
| 345 | + if (!this.isCNLive.value) { | |
| 346 | + | |
| 347 | + // 唤起详情页 | |
| 348 | + if (typeof this.$parent.getOpenApp === "function") { | |
| 349 | + this.$parent.getOpenApp({ | |
| 350 | + type: 38, | |
| 351 | + id: this.$route.query.id || 1, | |
| 352 | + url: "" | |
| 353 | + }); | |
| 354 | + } | |
| 355 | + | |
| 356 | + // 分享详情页 | |
| 357 | + if (typeof this.$parent.getShareData === "function") { | |
| 358 | + this.$parent.getShareData({ | |
| 359 | + type: 38, | |
| 360 | + id: this.$route.query.id || 1, | |
| 361 | + url: "" | |
| 362 | + }); | |
| 363 | + } | |
| 364 | + } | |
| 336 | 365 | } |
| 337 | 366 | } |
| 338 | 367 | </script> | ... | ... |
src/pages/pointsMall/pointsMall.less
| ... | ... | @@ -10,6 +10,18 @@ |
| 10 | 10 | height: 93px; |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | +.hide{ | |
| 14 | + display:none; | |
| 15 | +} | |
| 16 | +.call-app-box{ | |
| 17 | + position: fixed; | |
| 18 | + z-index: 2; | |
| 19 | +} | |
| 20 | +.back-box{ | |
| 21 | + background-color: #FFF; | |
| 22 | + position:fixed; | |
| 23 | + position: fixed; | |
| 24 | +} | |
| 13 | 25 | .main_box{ |
| 14 | 26 | width: 100%; |
| 15 | 27 | // min-height: 1840px; | ... | ... |