Commit 23fa9511 by MichaelJier

Merge branch 'test' into feature/feature_redPacketRain_v1.2.0

parents f92a1862 5519fc1d
......@@ -2,7 +2,7 @@
<div class="shop">
<div class="btn">
<showcase @enterMarket="_enterMarket"/>
<div class="icon" @click.stop="isShow = !isShow"></div>
<div class="icon" @click.stop="_enterMarket('')"></div>
</div>
<market-frame v-model="isShow" :marketSrc="marketSrc"/>
<!-- <transition name="move-bottom">
......
<template>
<div class="wrapper">
<div class="shop-hot-box" v-transfer-dom="'#menu-list-box'" v-if="menuList.every(item => item.menuInfo !== 'shop' ) && caseInfo.status">
<shop-box :showHot="!!caseInfo.status"></shop-box>
<shop-box :showHot="!!caseInfo.status" :isMarket="true"></shop-box>
</div>
<div class="swiper-container" ref="swiper">
<div class="swiper-wrapper">
......
<template>
<div class="shop" :style="{height: showList ? '100%' : ''}">
<shop-list :menuId="menuId" v-show="showList"></shop-list>
<shop-list :menuId="menuId" v-show="showList" :isMarket="isMarket"></shop-list>
<div class="shop-hot-box" v-transfer-dom="'#menu-list-box'" v-if="showHot">
<shop-hot :menuId="menuId"></shop-hot>
<shop-hot :menuId="menuId" :isMarket="isMarket"></shop-hot>
</div>
</div>
</template>
......@@ -18,6 +18,10 @@ export default {
},
props: {
menuId: {},
isMarket: {
type: Boolean,
default: false
},
showList: {
type: Boolean,
default: false
......
......@@ -33,7 +33,11 @@ import { mapGetters } from 'vuex';
export default {
name: 'shop-hot',
props: {
menuId: {}
menuId: {},
isMarket: {
type: Boolean,
default: false
},
},
data() {
return {
......@@ -130,7 +134,7 @@ export default {
}
},
buyShop() {
this.$Bus.$emit('bus-buyShop', this.info);
this.$Bus.$emit(`${this.isMarket ? 'market' : 'bus' }-buyShop`, this.info);
},
close() {
this.info = {};
......
......@@ -72,7 +72,11 @@ export default {
marketFrame
},
props: {
menuId: {}
menuId: {},
isMarket: {
type: Boolean,
default: false
},
},
data() {
return {
......@@ -102,15 +106,13 @@ export default {
},
},
mounted() {
if (this.menuId){
this.getList();
this.$Bus.$on('bus-editShop', this.editShop);
this.$Bus.$on('bus-deleteShop', this.deleteShop);
this.$Bus.$on('bus-addShopBind', this.addShopBind);
this.$Bus.$on('bus-cancelShopBind', this.cancelShopBind);
this.$Bus.$on('bus-changeSort', this.changeSort);
this.$Bus.$on('bus-buyShop', this._showDetails);
}
this.getList();
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-editShop`, this.editShop);
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-deleteShop`, this.deleteShop);
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-addShopBind`, this.addShopBind);
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-cancelShopBind`, this.cancelShopBind);
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-changeSort`, this.changeSort);
this.$Bus.$on(`${this.isMarket ? 'market' : 'bus'}-buyShop`, this._showDetails);
},
methods: {
getMore() {
......@@ -122,7 +124,7 @@ export default {
}
},
async getList() {
if (!this.isAjax) {
if (!this.isAjax || !this.menuId) {
return false;
}
this.isAjax = false;
......
......@@ -109,7 +109,6 @@ export default {
},
mounted() {
this.get_addressList();
this.$Bus.$on('bus-goPay', this.goPay);
},
methods: {
async get_addressList() {
......
......@@ -36,7 +36,7 @@ export default {
set(nVal) {
if (!nVal) {
console.log('关闭商城')
window.removeEventListener('message', this.switchPostMessage, false)
window.removeEventListener('message', this.switchPostMessage.bind(this), false)
}
this.$emit('input', nVal);
}
......@@ -53,7 +53,8 @@ export default {
_close() {
this.isShow = false;
},
switchPostMessage(message) {
switchPostMessage(e) {
const message = e.data
if (!message.cmd) return
if (!this[message.cmd]) return
this[message.cmd](message.data)
......@@ -62,21 +63,41 @@ export default {
this.$Bus.$emit('bus-showLogin', true);
},
sourceLinkShop(sourceContent) {
this.$Bus.$emit('bus-buyShop', {
this.$Bus.$emit('market-buyShop', {
type: 2,
source: 2,
sourceContent
});
},
sourceCommandShop(sourceContent) {
this.$Bus.$emit('bus-buyShop', {
this.$Bus.$emit('market-buyShop', {
type: 2,
source: 1,
sourceContent
});
},
payShop(res) {
this.$Bus.$emit('bus-goPay', res);
const { tradeType, prepayInfo } = res.data;
const { uin } = this.channelInfo;
const DEF_SITE = process.client
? process.env.DEF_SITE + (window.location.protocol.split(':')[0] === 'https' ? process.env.HTTPS_PORT : process.env.HTTP_PORT)
: `http:${process.env.DEF_SITE + process.env.HTTP_PORT}`;
if (res.data.url) {
window.location.href = res.data.url;
} else if (tradeType === 'MWEB') {
const wxh5pay = `https:${process.env.DEF_SITE + process.env.HTTPS_PORT}/pay/wxh5pay?uin=${uin}`;
const backUrl = encodeURIComponent(window.location.href);
const transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
const payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
const url = `${wxh5pay}&url=${payUrl}`;
window.location.href = url;
} else if (tradeType === 'JSAPI') {
const data = encodeURIComponent(JSON.stringify(res.data));
const url = `${DEF_SITE}/pay/wxpay?uin=${uin}&payconfig=${data}`;
window.location.href = url;
} else {
this.$layer.msg('网络错误,请稍后重试!');
}
},
goMarket() {
window.location.href = `${this.DEF_SITE}/shop/home?uin=${this.channelInfo.uin}`
......@@ -86,7 +107,7 @@ export default {
value(newVal) {
if (newVal){
console.log('开启商城')
window.addEventListener('message', this.switchPostMessage, false)
window.addEventListener('message', this.switchPostMessage.bind(this), false)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment