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,6 +52,7 @@ export default { | ||
| 52 | itemInfo: null, | 52 | itemInfo: null, |
| 53 | addressInfo: null, | 53 | addressInfo: null, |
| 54 | goodsId: null, // 兑换商品ID | 54 | goodsId: null, // 兑换商品ID |
| 55 | + orderId: null, // 订单ID 先兑换后填地址使用 | ||
| 55 | // drawRecordItemInfo: null // 中奖记录单条信息 | 56 | // drawRecordItemInfo: null // 中奖记录单条信息 |
| 56 | }; | 57 | }; |
| 57 | }, | 58 | }, |
| @@ -85,9 +86,13 @@ export default { | @@ -85,9 +86,13 @@ export default { | ||
| 85 | }, | 86 | }, |
| 86 | methods: { | 87 | methods: { |
| 87 | // 父组件点击兑换调用子组件传值商品商品信息 | 88 | // 父组件点击兑换调用子组件传值商品商品信息 |
| 88 | - getItemInfo (content) { | 89 | + getItemInfo (content, orderId) { |
| 89 | this.itemInfo = content; | 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 | this.luckDrawGift(content.id); | 97 | this.luckDrawGift(content.id); |
| 93 | // 获取首选地址接口 | 98 | // 获取首选地址接口 |
| @@ -251,15 +256,30 @@ export default { | @@ -251,15 +256,30 @@ export default { | ||
| 251 | * 确定 | 256 | * 确定 |
| 252 | */ | 257 | */ |
| 253 | confirm () { | 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 | this.$parent.pointsToast_control = false; | 273 | this.$parent.pointsToast_control = false; |
| 260 | // 安卓手机下特殊处理 | 274 | // 安卓手机下特殊处理 |
| 261 | if (this.isAndroid.value) { | 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 | orderInfo.addressId = window.localStorage.getItem("addressId") || this.addressInfo.id | 283 | orderInfo.addressId = window.localStorage.getItem("addressId") || this.addressInfo.id |
| 264 | orderInfo.pointsToast_control = this.getParameterByName("pointsToast_control") | 284 | orderInfo.pointsToast_control = this.getParameterByName("pointsToast_control") |
| 265 | // 安卓下清除locaStroe的ext数据 | 285 | // 安卓下清除locaStroe的ext数据 |
| @@ -268,7 +288,7 @@ export default { | @@ -268,7 +288,7 @@ export default { | ||
| 268 | window.location.href = | 288 | window.location.href = |
| 269 | window.location.href.split("?")[0] + | 289 | window.location.href.split("?")[0] + |
| 270 | "?uid=" + | 290 | "?uid=" + |
| 271 | - this.getStore("uid") | 291 | + this.getStore("uid") + "&goodsId=" + this.$route.query.goodsId || this.goodsId |
| 272 | } | 292 | } |
| 273 | // 最新地址信息回传给父组件 | 293 | // 最新地址信息回传给父组件 |
| 274 | this.$parent.addressInfo = this.addressInfo; | 294 | this.$parent.addressInfo = this.addressInfo; |
| @@ -276,7 +296,7 @@ export default { | @@ -276,7 +296,7 @@ export default { | ||
| 276 | }, | 296 | }, |
| 277 | // 更改地址 | 297 | // 更改地址 |
| 278 | changeAddress () { | 298 | changeAddress () { |
| 279 | - // 安卓手机两次更改地址goodsId没拿到从咯擦S | 299 | + // 安卓手机两次更改地址goodsId没拿到从 |
| 280 | if (this.isAndroid.value && !this.goodsId) { | 300 | if (this.isAndroid.value && !this.goodsId) { |
| 281 | let ext = "&" + window.localStorage.getItem("ext") | 301 | let ext = "&" + window.localStorage.getItem("ext") |
| 282 | this.goodsId = this.getParameterByName( | 302 | this.goodsId = this.getParameterByName( |
| @@ -295,6 +315,8 @@ export default { | @@ -295,6 +315,8 @@ export default { | ||
| 295 | encodeURIComponent( | 315 | encodeURIComponent( |
| 296 | "goodsId=" + | 316 | "goodsId=" + |
| 297 | this.goodsId + | 317 | this.goodsId + |
| 318 | + "orderId=" + | ||
| 319 | + this.orderId + | ||
| 298 | "&pointsToast_control=" + | 320 | "&pointsToast_control=" + |
| 299 | this.$parent.pointsToast_control | 321 | this.$parent.pointsToast_control |
| 300 | ) + | 322 | ) + |
src/pages/goodDetails/goodDetails.less
| 1 | .good-details-box{ | 1 | .good-details-box{ |
| 2 | padding-bottom: 130px; | 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 | .goods-img{ | 24 | .goods-img{ |
| 4 | display: block; | 25 | display: block; |
| 5 | width: 100%; | 26 | width: 100%; |
src/pages/goodDetails/goodDetails.vue
| @@ -10,13 +10,16 @@ | @@ -10,13 +10,16 @@ | ||
| 10 | > | 10 | > |
| 11 | </call-app-box> | 11 | </call-app-box> |
| 12 | <back-box | 12 | <back-box |
| 13 | - v-if="$parent.isBack && isCNLive.value" | 13 | + v-if="isCNLive.value" |
| 14 | + :class="{'hide': $route.query.hideBack == true}" | ||
| 14 | class="back-box" | 15 | class="back-box" |
| 15 | :style="'padding-top: ' + $parent.top.value + 'px'" | 16 | :style="'padding-top: ' + $parent.top.value + 'px'" |
| 16 | @back="back" | 17 | @back="back" |
| 17 | :backs="backs" | 18 | :backs="backs" |
| 18 | > | 19 | > |
| 19 | </back-box> | 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 | <!-- <swiper | 24 | <!-- <swiper |
| 22 | :style=" | 25 | :style=" |
| @@ -165,7 +168,7 @@ export default { | @@ -165,7 +168,7 @@ export default { | ||
| 165 | title: "", | 168 | title: "", |
| 166 | message: "确定使用" + this.goodsInfo.num + "积分兑换?", | 169 | message: "确定使用" + this.goodsInfo.num + "积分兑换?", |
| 167 | confirmButtonText: "确定", | 170 | confirmButtonText: "确定", |
| 168 | - confirmButtonCallback: this.callAppModalCallback, | 171 | + confirmButtonCallback: this.addIntegralOrderconfirm, |
| 169 | showCancelButton: true, | 172 | showCancelButton: true, |
| 170 | cancelButtonText: "取消" | 173 | cancelButtonText: "取消" |
| 171 | }; | 174 | }; |
| @@ -175,7 +178,7 @@ export default { | @@ -175,7 +178,7 @@ export default { | ||
| 175 | this.$parent.$refs.showModal.showLayer(); | 178 | this.$parent.$refs.showModal.showLayer(); |
| 176 | }, | 179 | }, |
| 177 | // 确定兑换回调 | 180 | // 确定兑换回调 |
| 178 | - callAppModalCallback () { | 181 | + addIntegralOrderconfirm () { |
| 179 | // isExchange为false才可兑换防止连续点击 | 182 | // isExchange为false才可兑换防止连续点击 |
| 180 | if (!this.isExchange) { | 183 | if (!this.isExchange) { |
| 181 | // 兑换 | 184 | // 兑换 |
| @@ -183,6 +186,15 @@ export default { | @@ -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 | addIntegralOrder () { | 200 | addIntegralOrder () { |
| @@ -217,14 +229,15 @@ export default { | @@ -217,14 +229,15 @@ export default { | ||
| 217 | // 两秒后可继续兑换 | 229 | // 两秒后可继续兑换 |
| 218 | let _this = this | 230 | let _this = this |
| 219 | setTimeout(function () { | 231 | setTimeout(function () { |
| 220 | - this.isExchange = false; | 232 | + _this.isExchange = false; |
| 221 | }, 1500); | 233 | }, 1500); |
| 222 | // 显示查看地址弹框 | 234 | // 显示查看地址弹框 |
| 223 | let options = { | 235 | let options = { |
| 224 | message: "兑换成功", | 236 | message: "兑换成功", |
| 225 | messageAlign: "center", | 237 | messageAlign: "center", |
| 226 | confirmButtonText: "我知道了", | 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 | this.$set(this.$parent, "showOptions", options); | 242 | this.$set(this.$parent, "showOptions", options); |
| 230 | // 显示通用浮层 | 243 | // 显示通用浮层 |
| @@ -233,20 +246,15 @@ export default { | @@ -233,20 +246,15 @@ export default { | ||
| 233 | 246 | ||
| 234 | // 获取积分商品详情页失败 | 247 | // 获取积分商品详情页失败 |
| 235 | Toast(res.message); | 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 | this.pointsToast_control = true; | 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,6 +341,27 @@ export default { | ||
| 333 | 341 | ||
| 334 | }, | 342 | }, |
| 335 | mounted () { | 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 | </script> | 367 | </script> |
src/pages/pointsMall/pointsMall.less
| @@ -10,6 +10,18 @@ | @@ -10,6 +10,18 @@ | ||
| 10 | height: 93px; | 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 | .main_box{ | 25 | .main_box{ |
| 14 | width: 100%; | 26 | width: 100%; |
| 15 | // min-height: 1840px; | 27 | // min-height: 1840px; |