Commit c51d1a9d by liujinsa

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 7c36675a abb552d8
const app = getApp() const app = getApp();
console.log(app, 'apppppppppp') console.log(app, "apppppppppp");
Component({ Component({
pageLifetimes: { pageLifetimes: {
show() { show() {
console.log('哈哈哈哈') console.log("哈哈哈哈");
if (typeof this.getTabBar === 'function' && if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar()) {
this.getTabBar().setData({ this.getTabBar().setData({
selected: 1 selected: 1
}) });
} }
} }
}, },
...@@ -17,18 +16,23 @@ Component({ ...@@ -17,18 +16,23 @@ Component({
selected: 0, selected: 0,
color: "#7A7E83", color: "#7A7E83",
selectedColor: "#3cc51f", selectedColor: "#3cc51f",
list: [{ list: [
{
pagePath: "/pages/home/main", pagePath: "/pages/home/main",
iconPath: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", iconPath:
selectedIconPath: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
selectedIconPath:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
text: "组件", text: "组件",
//--多主题 //--多主题
condition: "", condition: "",
icon: "ant-daishouhuo", icon: "ant-daishouhuo",
iconType: 1, //0 iconfont 1 image iconType: 1, //0 iconfont 1 image
imgUrl: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", imgUrl:
selectImgUrl: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
selectImgUrl:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
link: { link: {
key: "1.1.1.7", key: "1.1.1.7",
link: "/personalCenter/spokesmanCenter?distributionModel=1", link: "/personalCenter/spokesmanCenter?distributionModel=1",
...@@ -39,7 +43,8 @@ Component({ ...@@ -39,7 +43,8 @@ Component({
title: "分类页", title: "分类页",
version: "1.0.0", version: "1.0.0",
visible: 1 visible: 1
}, { },
{
pagePath: "/pages/index/main", pagePath: "/pages/index/main",
iconPath: "/static/images/bofang.png", iconPath: "/static/images/bofang.png",
selectedIconPath: "/static/images/bofang.png", selectedIconPath: "/static/images/bofang.png",
...@@ -56,67 +61,63 @@ Component({ ...@@ -56,67 +61,63 @@ Component({
title: "分类页", title: "分类页",
version: "1.0.0", version: "1.0.0",
visible: 1 visible: 1
}], }
componentData: {} ],
componentData: {},
show: true
}, },
attached() { attached() {
let that = this let that = this;
if (app.globalData.footerVal) { if (app.globalData.footerVal) {
that.setData({ that.setData({
componentData: app.globalData.footerVal.componentData, componentData: app.globalData.footerVal.componentData,
list: app.globalData.footerVal.componentData.list list: app.globalData.footerVal.componentData.list
}) });
} else { } else {
app.footerCallBack = function (params) { app.footerCallBack = function(params) {
that.setData({ that.setData({
componentData: params.componentData, componentData: params.componentData,
list: params.componentData.list list: params.componentData.list
}) });
} };
} }
// ----------webview 变化 // ----------webview 变化
console.log('启动1111',this.getTabBar()) console.log("启动1111", this.getTabBar());
app.webviewCallBack = function(state, params) {
app.webviewCallBack = function (state,params) { console.log("webview变化", state, params);
console.log('webview变化',state,params) };
}
}, },
methods: { methods: {
init() { init() {},
},
switchTab(e) { switchTab(e) {
const { const { index } = e.currentTarget.dataset;
index console.log("755555555", this.data.list[index].link);
} = e.currentTarget.dataset
console.log('755555555', this.data.list[index].link)
app.$themeToLink(this.data.list[index]["link"], 1);
app.$themeToLink(this.data.list[index]['link'],1)
// this.toPage(this.data.list[index].link,index) // this.toPage(this.data.list[index].link,index)
// this.setData({ // this.setData({
// selected: index // selected: index
// }) // })
}, },
toPage(data,index){ toPage(data, index) {
console.log('index98',index,this) console.log("index98", index, this);
// index=index==0?index+1:index // index=index==0?index+1:index
// 跳转 // 跳转
if (data.link=='/') { if (data.link == "/") {
wx.switchTab({ wx.switchTab({
url: '/pages/home/main', url: "/pages/home/main"
}) });
}else{ } else {
wx.switchTab({ wx.switchTab({
url: `/pages/tabBar${index}/main`, url: `/pages/tabBar${index}/main`
}) });
// ?from=tabbar&backpath=${ // ?from=tabbar&backpath=${
// data.link // data.link
// } // }
} }
} }
} }
}) });
<!--miniprogram/custom-tab-bar/index.wxml--> <!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar"> <cover-view class="tab-bar" wx:if="{{show}}">
<cover-view class="antt ant-daipinglun"></cover-view> <cover-view class="antt ant-daipinglun"></cover-view>
<cover-view class="iconfont icon-fenzhi">3</cover-view> <cover-view class="iconfont icon-fenzhi">3</cover-view>
<cover-view class="tab-bar-border"></cover-view> <cover-view class="tab-bar-border"></cover-view>
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}" <cover-view
bindtap="switchTab"> wx:for="{{list}}"
wx:key="index"
class="tab-bar-item"
data-path="{{item.link}}"
data-index="{{index}}"
bindtap="switchTab"
>
<cover-view wx:if="{{item.iconType==0||!item.iconType}}"> <cover-view wx:if="{{item.iconType==0||!item.iconType}}">
<cover-view class="antt {{item.icon}}"></cover-view> <cover-view class="antt {{item.icon}}"></cover-view>
</cover-view> </cover-view>
<cover-view wx:elif="{{item.iconType==1}}" <cover-view
wx:elif="{{item.iconType==1}}"
class="img-view" class="img-view"
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}"> style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}"
>
<cover-image src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></cover-image> <cover-image src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></cover-image>
</cover-view> </cover-view>
<!-- 名称 --> <!-- 名称 -->
<cover-view <cover-view style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
{{item.title}}</cover-view> {{item.title}}</cover-view>
</cover-view> </cover-view>
</cover-view> </cover-view>
import {requestPOST,requestGET} from "@/utils/request.js";
export default {
ordercustomerinfo(options){
return requestPOST(`${process.env.OLSHOP_URL}/order/place_order_customer_info`,options)
},
}
\ No newline at end of file
import { requestPOST, requestGET } from "@/utils/request.js";
export default {
getSingleItemActivityV2(data) {
return requestPOST(`${process.env.OLSHOP_URL}/promotion/v2/query_single_item_activity_detail`, data);
},
// 根据列表查询活动
query_single_item_activity_list_by_ids(data) {
return requestPOST(`${process.env.OLSHOP_URL}/promotion/query_single_item_activity_list_by_ids`, data);
},
};
\ No newline at end of file
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div :style="{'background-color':getColor,'height':getHeight}" class="interval">
</div>
</template>
<script>
export default {
name:'interval',
props: ["datas"],
computed: {
getColor(){
return this.datas.componentData.color;
},
getHeight() {
return this.datas.componentData.initheight+'px';
}
}
};
</script>
<style lang="scss" scoped>
.interval{
// border: 1px solid rgba(205,75,155,0.5);
}
</style>
<!-- 链接 -->
<template>
<div
class="links"
:style="{'background-color':datas.componentData['backgroundColor'],'color':datas.componentData['fontColor'],
'text-align':datas.componentData['arrowsSite'],'line-height':datas.componentData['initcharSize']+'em'}"
@click="onclickHandle()"
>
<span
:style="{'font-size':datas.componentData['initcharSize']+'em'}"
>{{datas.componentData['title']}}</span>
<span class="jt" v-if="datas.componentData['arrowShow']"></span>
</div>
</template>
<script>
const app = getApp()
export default {
name: "links",
props: {
datas: {
type: Object,
default: {}
},
render: {
type: Boolean,
default: false
}
},
data() {
return {};
},
methods: {
onclickHandle() {
app.$themeToLink(this.datas.componentData.link);
}
},
computed: {},
components: {}
};
</script>
<style lang="scss" scoped>
.links {
font-size: 16px;
padding-right: 10px;
// height: 35px;
// line-height: 35px;
.jt {
display: inline-block;
border-top: 1px solid;
border-right: 1px solid;
width: 10px;
height: 10px;
-webkit-transform: rotate(-135deg);
transform: rotate(405deg);
margin-left: 10px;
// vertical-align: middle;
}
}
</style>
\ No newline at end of file
<template>
<div
class="partition"
:style="{
'padding-top':getPaddingList[0]['value']+'px',
'padding-bottom':getPaddingList[1]['value']+'px',
'padding-left':getPaddingList[2]['value']+'px',
'padding-right':getPaddingList[3]['value']+'px',
}"
>
<div
:style="{
'border-width':'1px',
'border-top-style':getLineStyle,
'border-top-color':getLineColor,
}"
></div>
</div>
</template>
<script>
export default {
name: "partition",
props: ["datas"],
data() {
return {};
},
computed: {
getPaddingList() {
return this.datas.componentData.paddingList;
},
getLineColor() {
return this.datas.componentData.lineColor;
},
getLineStyle() {
return this.datas.componentData.initlineStyle;
}
}
};
</script>
<style lang="scss" scoped>
</style>
<!-- 文字上下滚动 -->
<template>
<div
class="marquee"
v-if="targetShow"
:style="[this.render?{'pointer-events':'none'}:'',{'top':datas.componentData.yPosition+'em'}]"
>
<div class="marquee_box">
<div class="evaluate" :class="animate?'animation_in':'animation_out'">
<img :src="selectImg | DFSImg(300,300)" alt />
<span>{{subName}}刚刚购买了一单</span>
</div>
</div>
</div>
</template>
<script>
let api;
const app = getApp()
export default {
name: "shop-popup",
props: {
render: {
type: Boolean,
default: false
},
datas: {
type: Object,
default: function() {
return {};
}
}
},
data() {
return {
targetShow: false,
selectIndex: 0,
animate: true,
selectImg: "",
selectname: "小工蚁",
marqueeList: [],
setTime1: null,
setTime2: null,
subName : ''
};
},
created() {},
mounted() {
this.init()
},
watch : {
// 'datas.componentData._tempData' : function(newVal){
// this.marqueeList = newVal;
// this.targetShow = true;
// this.play()
// }
},
methods: {
init() {
clearTimeout(this.setTime1);
clearTimeout(this.setTime2);
try {
// api = require("~/api/orderinfo").default;
this.ordercustomerinfo();
} catch (error) {}
// if (this.render) {
// clearTimeout(this.setTime1);
// clearTimeout(this.setTime2);
// try {
// // api = require("~/api/orderinfo").default;
// this.ordercustomerinfo();
// } catch (error) {}
// } else {
// this.targetShow = true;
// }
},
subName() {
if (this.selectname.length > 1) {
return `${this.selectname.substr(0, 1)}****${this.selectname.charAt(
this.selectname.length - 1
)}`;
} else if (this.selectname.length == 1) {
return `${this.selectname.substr(0, 1)}****`;
} else {
return `****`;
}
},
ordercustomerinfo() {
app.orderApi.ordercustomerinfo({
page: 1,
rows: 100
})
.then(res => {
if (res.data.code == 200 && res.data.data.length > 0) {
this.targetShow = true;
this.marqueeList = res.data.data;
this.play();
}
});
},
play() {
//赋值
this.selectname = this.marqueeList[this.selectIndex].customerNickname;
this.selectImg = this.marqueeList[this.selectIndex].customerHeadImage;
if (this.selectname.length > 1) {
this.subName = `${this.selectname.substr(0, 1)}****${this.selectname.charAt(
this.selectname.length - 1
)}`;
} else if (this.selectname.length == 1) {
this.subName = `${this.selectname.substr(0, 1)}****`;
} else {
this.subName = `****`;
}
this.animate = true;
clearTimeout(this.setTime1);
clearTimeout(this.setTime2);
this.setTime1 = setTimeout(() => {
this.animate = false;
this.setTime2 = setTimeout(() => {
this.selectImg = "";
//递增
this.selectIndex++;
if (this.selectIndex >= this.marqueeList.length) {
this.selectIndex = 0;
}
this.play();
}, 2000);
}, 5000);
}
},
deactivated() {
clearTimeout(this.setTime1);
clearTimeout(this.setTime2);
}
};
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.marquee {
font-size: 16px;
width: 100%;
align-items: center;
color: #3a3a3a;
display: flex;
box-sizing: border-box;
overflow: hidden;
position: fixed;
// top: 10%;
left: 0px;
z-index: 1999;
}
.marquee_box {
display: block;
position: relative;
// height: 30px;
.evaluate {
height: 23px;
line-height: 23px;
font-size: 14px;
padding: 0 3px;
text-decoration: none;
list-style: none;
background: rgba(0, 0, 0, 0.3);
margin-left: 12px;
color: #ffffff;
display: flex;
align-items: center;
border-radius: 23px;
img {
width: 17px;
height: 17px;
margin-right: 5px;
border-radius: 50%;
}
opacity: 0;
}
.animation_in {
opacity: 1;
animation: warn 2s ease;
}
.animation_out {
opacity: 0;
animation: warn_out 1s ease;
}
}
@keyframes warn {
0% {
opacity: 0;
margin-top: 30px;
}
100% {
opacity: 1;
margin-top: 0px;
}
}
@keyframes warn_out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
...@@ -3,6 +3,8 @@ import App from './App' ...@@ -3,6 +3,8 @@ import App from './App'
import Store from './store/index' import Store from './store/index'
import "../static/nicon/iconfont.css" import "../static/nicon/iconfont.css"
import goodsApi from "./api/goods" import goodsApi from "./api/goods"
import orderApi from "./api/order"
import promoteApi from "./api/promote";
import { DFSImg } from "@/utils/index"; import { DFSImg } from "@/utils/index";
import { $themeToLink } from "@/utils/mayi" import { $themeToLink } from "@/utils/mayi"
...@@ -36,6 +38,7 @@ mpApp.pageCallBack = function () { } ...@@ -36,6 +38,7 @@ mpApp.pageCallBack = function () { }
mpApp.footerCallBack = function () { } mpApp.footerCallBack = function () { }
// webview变化 // webview变化
mpApp.webviewCallBack = function () { } mpApp.webviewCallBack = function () { }
mpApp.shareInit = function () {};
console.log('3555555', wx) console.log('3555555', wx)
// 全局跳转 data为link对象 // 全局跳转 data为link对象
...@@ -43,4 +46,6 @@ mpApp.$themeToLink = $themeToLink ...@@ -43,4 +46,6 @@ mpApp.$themeToLink = $themeToLink
// api // api
mpApp.goodsApi = goodsApi; mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi;
mpApp.DFSImg = DFSImg; mpApp.DFSImg = DFSImg;
...@@ -19,6 +19,24 @@ ...@@ -19,6 +19,24 @@
<cube-nav :datas="item"></cube-nav> <cube-nav :datas="item"></cube-nav>
</div> </div>
</div> </div>
<div v-else-if="item.componentCode == 'time-limited-discount'">
<time-limited-discount :datas="item"></time-limited-discount>
</div>
<div v-if="item.componentCode == 'links'">
<links :datas="item"></links>
</div>
<div v-if="item.componentCode == 'interval'">
<interval :datas="item"></interval>
</div>
<div v-if="item.componentCode == 'partition'">
<partition :datas="item"></partition>
</div>
<div v-if="item.componentCode == 'shop-popup'">
<shop-popup :datas="item"></shop-popup>
</div>
<div v-if="item.componentCode == 'float-button'">
<float-button :datas="item"></float-button>
</div>
</div> </div>
<bottomCont></bottomCont> <bottomCont></bottomCont>
</scroll-view> </scroll-view>
...@@ -35,6 +53,7 @@ ...@@ -35,6 +53,7 @@
<van-button type="primary">按钮</van-button> --> <van-button type="primary">按钮</van-button> -->
<!-- </div> --> <!-- </div> -->
<share-popup></share-popup>
</div> </div>
</template> </template>
...@@ -42,6 +61,11 @@ ...@@ -42,6 +61,11 @@
import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js" import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js"
import bottomCont from "../../components/bottomCont" import bottomCont from "../../components/bottomCont"
import ThemeDataPlant from "../../components/ThemeDataPlant" import ThemeDataPlant from "../../components/ThemeDataPlant"
import links from '@/components/basicTool/link/index.vue'
import interval from '@/components/basicTool/interval/index.vue'
import partition from '@/components/basicTool/partition/index.vue'
import shopPopup from '@/components/basicTool/shop-popup/index.vue'
import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js";
export default { export default {
components: { components: {
...@@ -54,8 +78,38 @@ export default { ...@@ -54,8 +78,38 @@ export default {
pageData: {}, pageData: {},
}; };
}, },
onLoad() { components:{
links,
interval,
partition,
shopPopup,
},
onShareAppMessage: function(res) {
if (res.from === "button") {
console.log(res.target,'-----------78');
}
return {
title: "分享1",
path: "",
imageUrl:"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/18d0044d-9634-4c89-8321-3e8ff8e94cce.png",
success: function(res) {
console.log("成功", res);
}
};
},
onLoad(options) {
let that = this; let that = this;
// 来源
if (options.from == "logout") {
//来自用户登出
wx.removeStorage({
key: "sessionid"
});
wx.removeStorage({
key: "openid"
});
}
// 获取页面数据
if (this.mpApp.globalData.pageList) { if (this.mpApp.globalData.pageList) {
that.init(this.mpApp.globalData.pageList); that.init(this.mpApp.globalData.pageList);
} else { } else {
......
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
"usingComponents": { "usingComponents": {
"banner": "/static/nativeComponents/Banner/index", "banner": "/static/nativeComponents/Banner/index",
"goods-list": "/static/nativeComponents/GoodsList/index", "goods-list": "/static/nativeComponents/GoodsList/index",
"time-limited-discount": "/static/nativeComponents/TimeLimitedDiscount/index",
"waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index", "waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index",
"van-button": "/static/vant/button/index", "van-button": "/static/vant/button/index",
"area-navigation":"/static/nativeComponents/AreaNavigation/index", "area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index" "cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"share-popup":"/static/nativeComponents/SharePopup/index"
}, },
"enablePullDownRefresh":true "enablePullDownRefresh":true
} }
\ No newline at end of file
...@@ -133,7 +133,8 @@ export default { ...@@ -133,7 +133,8 @@ export default {
if(this.page.includes("?")){ if(this.page.includes("?")){
this.params="&mixid=" + this.shopId; this.params="&mixid=" + this.shopId;
} }
options.params && (this.params += "&" + serialize(options.params)); options.params && (this.params += "&" + serialize(decodeURIComponent(options.params)));
console.log(this.page,this.params)
} else if (options.from && options.from == "livedBackShop") { } else if (options.from && options.from == "livedBackShop") {
//直播页back到商城 //直播页back到商城
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 1, index: 1,
ss: "", ss: "",
}; };
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/"); let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0); homeIndex != 0 && homeIndex == this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) { if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
this.page = getUrlofLink( this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link this.mpApp.globalData.footerVal.componentData.list[this.index].link
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 2, index: 2,
ss: "", ss: "",
}; };
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 3, index: 3,
ss: "", ss: "",
}; };
...@@ -37,9 +37,15 @@ export default { ...@@ -37,9 +37,15 @@ export default {
let homeIndex = checkTabbarPage("/"); let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0); homeIndex != 0 && homeIndex==this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) { if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
this.page = getUrlofLink( let p= getUrlofLink(this.mpApp.globalData.footerVal.componentData.list[this.index].link);
this.mpApp.globalData.footerVal.componentData.list[this.index].link let pl=p.split('?')
); if (pl[1]) {
this.page=pl[0]
this.params+='&'+pl[1]
}else{
this.page = p
}
this.mpApp.globalData.tabBarPageLink = ""; this.mpApp.globalData.tabBarPageLink = "";
} }
}, },
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 4, index: 4,
ss: "", ss: "",
}; };
...@@ -37,9 +37,15 @@ export default { ...@@ -37,9 +37,15 @@ export default {
let homeIndex = checkTabbarPage("/"); let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0); homeIndex != 0 && homeIndex==this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) { if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
this.page = getUrlofLink( let p= getUrlofLink(this.mpApp.globalData.footerVal.componentData.list[this.index].link);
this.mpApp.globalData.footerVal.componentData.list[this.index].link let pl=p.split('?')
); if (pl[1]) {
this.page=pl[0]
this.params+='&'+pl[1]
}else{
this.page = p
}
this.mpApp.globalData.tabBarPageLink = ""; this.mpApp.globalData.tabBarPageLink = "";
} }
}, },
......
...@@ -5,6 +5,7 @@ export function getUrlofLink(data) { ...@@ -5,6 +5,7 @@ export function getUrlofLink(data) {
// 全局跳转 data:link数据 option:是否为底部栏触发 // 全局跳转 data:link数据 option:是否为底部栏触发
export function $themeToLink(data, option) { export function $themeToLink(data, option) {
let app = getApp();
let type = data.type; let type = data.type;
// 点击底部栏 // 点击底部栏
...@@ -72,6 +73,7 @@ export function $themeToLink(data, option) { ...@@ -72,6 +73,7 @@ export function $themeToLink(data, option) {
// this.$themeCouponClick(data.feature.value.couponCode, data.feature.value); // this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
} else if (featureType == 1) {//分享 } else if (featureType == 1) {//分享
console.log('是分享了。。。。'); console.log('是分享了。。。。');
app.shareInit({ itemList: data.feature.value });
} else if (featureType == "themeMemberCardClick" || featureType == 2) { //会员卡 } else if (featureType == "themeMemberCardClick" || featureType == 2) { //会员卡
// this.$themeMemberCardClick(data.feature.value); // this.$themeMemberCardClick(data.feature.value);
} }
......
...@@ -18,39 +18,53 @@ Component({ ...@@ -18,39 +18,53 @@ Component({
positionCity: "", positionCity: "",
changeShow: false, changeShow: false,
positionName: '定位中', positionName: '定位中',
wxReady: false wxReady: false,
designateAreaObj : null
}, },
ready(){ ready(){
console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++') console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++')
console.log(getCurrentPages()) console.log(getCurrentPages())
this.setData({
designateAreaObj: this.data.datas.componentData.designateAreaObj
})
if (this.data.datas.componentInfo.visible == 1) { if (this.data.datas.componentInfo.visible == 1) {
let _this = this; let _this = this;
if (wx.getStorageSync('location')) { if (wx.getStorageSync('location')) {
this.setData({ this.setData({
'datas.componentData.designateAreaObj': JSON.parse(wx.getStorageSync('location')) 'designateAreaObj.id': JSON.parse(wx.getStorageSync('location')).id,
'designateAreaObj.regionName': JSON.parse(wx.getStorageSync('location')).regionName,
'designateAreaObj.regionType': JSON.parse(wx.getStorageSync('location')).regionType,
'designateAreaObj.systemRegionId': JSON.parse(wx.getStorageSync('location')).systemRegionId,
'designateAreaObj.outId': JSON.parse(wx.getStorageSync('location')).outId,
'designateAreaObj.areaGroupId': JSON.parse(wx.getStorageSync('location')).areaGroupId,
}) })
this.setData({ this.setData({
positionName: this.data.datas.componentData.designateAreaObj.regionName positionName: this.data.designateAreaObj.regionName
}) })
} }
console.log('组件1', this.data.designateAreaObj)
wx.getLocation({ wx.getLocation({
type: 'wgs84', type: 'wgs84',
success(res) { success(res) {
console.log('组件1111', _this.data.designateAreaObj)
console.log(res, '++++++++++获取地区') console.log(res, '++++++++++获取地区')
const latitude = res.latitude const latitude = res.latitude
const longitude = res.longitude const longitude = res.longitude
console.log('组件2', _this.data.designateAreaObj)
wx.request({ wx.request({
url: `http://test-m-shop.mayi888.cn/test/innerApi/shopApiService/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`, url: `http://test-m-shop.mayi888.cn/test/innerApi/shopApiService/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`,
header: { header: {
'Shop-Mixid': 'Id9uwD' 'Shop-Mixid': 'Id9uwD'
}, },
success(data) { success(data) {
console.log('组件3', _this.data.designateAreaObj)
if (data.data.code == '200') { if (data.data.code == '200') {
let city = '' let city = ''
data.data.data.forEach(item => { data.data.data.forEach(item => {
...@@ -68,8 +82,9 @@ Component({ ...@@ -68,8 +82,9 @@ Component({
}) })
} }
console.log(_this.data.positionCity, '定位城市信息') console.log(_this.data.positionCity, '定位城市信息')
console.log(_this.data.datas.componentData.designateAreaObj,'组件信息') console.log(_this.data.designateAreaObj,'组件信息')
let str = JSON.stringify({ let str = JSON.stringify({
id: _this.data.positionCity.operatingAreaAreaId, id: _this.data.positionCity.operatingAreaAreaId,
regionName: _this.data.positionCity.regionName, regionName: _this.data.positionCity.regionName,
...@@ -81,7 +96,7 @@ Component({ ...@@ -81,7 +96,7 @@ Component({
console.log(str,'str.......') console.log(str,'str.......')
wx.setStorageSync('location', str) wx.setStorageSync('location', str)
if (_this.data.positionCity.operatingAreaAreaId == _this.data.datas.componentData.designateAreaObj.id){ if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id){
_this.setData({ _this.setData({
positionName: _this.data.positionCity.regionName positionName: _this.data.positionCity.regionName
}) })
...@@ -94,7 +109,43 @@ Component({ ...@@ -94,7 +109,43 @@ Component({
} else { } else {
if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) {
wx.setStorageSync('location', JSON.stringify({
id: _this.data.designateAreaObj.id,
regionName: _this.data.designateAreaObj.regionName,
regionType: _this.data.designateAreaObj.regionType,
systemRegionId: _this.data.designateAreaObj.systemRegionId,
areaGroupId: _this.data.designateAreaObj.areaGroupId,
outId: _this.data.designateAreaObj.outId
}))
_this.setData({
positionName: _this.data.designateAreaObj.regionName
})
}
}
}
},
fail(){
console.log('定位')
if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) {
wx.setStorageSync('location', JSON.stringify({
id: _this.data.designateAreaObj.id,
regionName: _this.data.designateAreaObj.regionName,
regionType: _this.data.designateAreaObj.regionType,
systemRegionId: _this.data.designateAreaObj.systemRegionId,
areaGroupId: _this.data.designateAreaObj.areaGroupId,
outId: _this.data.designateAreaObj.outId
}))
_this.setData({
positionName: _this.data.designateAreaObj.regionName
})
}
} }
} }
}) })
...@@ -102,17 +153,35 @@ Component({ ...@@ -102,17 +153,35 @@ Component({
}, },
fail(error) { fail(error) {
console.log('定位失败') console.log('定位失败')
if(!wx.getStorageSync('location')){
if(_this.data.designateAreaObj.id){
wx.setStorageSync('location', JSON.stringify({
id : _this.data.designateAreaObj.id,
regionName: _this.data.designateAreaObj.regionName,
regionType: _this.data.designateAreaObj.regionType,
systemRegionId : _this.data.designateAreaObj.systemRegionId,
areaGroupId : _this.data.designateAreaObj.areaGroupId,
outId : _this.data.designateAreaObj.outId
}))
_this.setData({
positionName : _this.data.designateAreaObj.regionName
})
}
}
} }
}) })
} }
console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++') console.log('111111++++++++++++++++++++定位组件加载好了++++++++++++++++++++111')
}, },
pageLifetimes : { pageLifetimes : {
show(){ show(){
console.log('组件页面出来show', this.data.datas.componentData.designateAreaObj) console.log('组件页面出来show', this.data.designateAreaObj)
console.log('组件页面出来show', this.data.positionCity) console.log('组件页面出来show', this.data.positionCity)
if(wx.getStorageSync('location')){ if(wx.getStorageSync('location')){
...@@ -124,12 +193,12 @@ Component({ ...@@ -124,12 +193,12 @@ Component({
}) })
this.setData({ this.setData({
'datas.componentData.designateAreaObj.id': locationObj.id, 'designateAreaObj.id': locationObj.id,
'datas.componentData.designateAreaObj.regionName': locationObj.regionName, 'designateAreaObj.regionName': locationObj.regionName,
'datas.componentData.designateAreaObj.regionType': locationObj.regionType, 'designateAreaObj.regionType': locationObj.regionType,
'datas.componentData.designateAreaObj.systemRegionId': locationObj.systemRegionId, 'designateAreaObj.systemRegionId': locationObj.systemRegionId,
'datas.componentData.designateAreaObj.areaGroupId': locationObj.areaGroupId, '.designateAreaObj.areaGroupId': locationObj.areaGroupId,
'datas.componentData.designateAreaObj.outId': locationObj.outId 'designateAreaObj.outId': locationObj.outId
}) })
let obj = { let obj = {
...@@ -153,12 +222,12 @@ Component({ ...@@ -153,12 +222,12 @@ Component({
positionName: locationObj.regionName positionName: locationObj.regionName
}) })
this.setData({ this.setData({
'datas.componentData.designateAreaObj.id': locationObj.id, 'designateAreaObj.id': locationObj.id,
'datas.componentData.designateAreaObj.regionName': locationObj.regionName, 'designateAreaObj.regionName': locationObj.regionName,
'datas.componentData.designateAreaObj.regionType': locationObj.regionType, 'designateAreaObj.regionType': locationObj.regionType,
'datas.componentData.designateAreaObj.systemRegionId': locationObj.systemRegionId, 'designateAreaObj.systemRegionId': locationObj.systemRegionId,
'datas.componentData.designateAreaObj.areaGroupId': locationObj.areaGroupId, 'designateAreaObj.areaGroupId': locationObj.areaGroupId,
'datas.componentData.designateAreaObj.outId': locationObj.outId 'designateAreaObj.outId': locationObj.outId
}) })
let obj = { let obj = {
operatingAreaAreaId: locationObj.id, operatingAreaAreaId: locationObj.id,
...@@ -189,17 +258,17 @@ Component({ ...@@ -189,17 +258,17 @@ Component({
changeTo(){ changeTo(){
this.setData({ this.setData({
'datas.componentData.designateAreaObj.id': this.data.positionCity.operatingAreaAreaId, 'designateAreaObj.id': this.data.positionCity.operatingAreaAreaId,
'datas.componentData.designateAreaObj.regionName': this.data.positionCity.regionName, 'designateAreaObj.regionName': this.data.positionCity.regionName,
'datas.componentData.designateAreaObj.regionType': this.data.positionCity.regionType, 'designateAreaObj.regionType': this.data.positionCity.regionType,
'datas.componentData.designateAreaObj.systemRegionId': this.data.positionCity.systemRegionId, 'designateAreaObj.systemRegionId': this.data.positionCity.systemRegionId,
'datas.componentData.designateAreaObj.areaGroupId': this.data.positionCity.areaGroupId, 'designateAreaObj.areaGroupId': this.data.positionCity.areaGroupId,
'datas.componentData.designateAreaObj.outId': this.data.positionCity.outId 'designateAreaObj.outId': this.data.positionCity.outId
}) })
console.log(this.data.datas.componentData.designateAreaObj) console.log(this.data.designateAreaObj)
console.log(this.data.positionCity) console.log(this.data.positionCity)
let change = JSON.stringify(this.data.datas.componentData.designateAreaObj) let change = JSON.stringify(this.data.designateAreaObj)
this.setData({ this.setData({
positionName: this.data.positionCity.regionName, positionName: this.data.positionCity.regionName,
changeShow : false changeShow : false
...@@ -208,10 +277,10 @@ Component({ ...@@ -208,10 +277,10 @@ Component({
// wx.startPullDownRefresh() // wx.startPullDownRefresh()
}, },
continueBrowser(){ continueBrowser(){
console.log(this.data.datas.componentData.designateAreaObj) console.log(this.data.designateAreaObj)
wx.setStorageSync('location', JSON.stringify(this.data.datas.componentData.designateAreaObj)) wx.setStorageSync('location', JSON.stringify(this.data.designateAreaObj))
this.setData({ this.setData({
positionName: this.data.datas.componentData.designateAreaObj.regionName, positionName: this.data.designateAreaObj.regionName,
changeShow: false changeShow: false
}) })
// wx.startPullDownRefresh() // wx.startPullDownRefresh()
...@@ -220,7 +289,13 @@ Component({ ...@@ -220,7 +289,13 @@ Component({
changeOtherCity(){ changeOtherCity(){
console.log(getCurrentPages()) console.log(getCurrentPages())
wx.navigateTo({ wx.navigateTo({
url: '/pages/changeAdr/main?areaGroupId=' + this.data.datas.componentData.areaGroupId, url: '/pages/changeAdr/main?areaGroupId=' + this.data.datas.componentData.designateAreaObj.areaGroupId,
})
},
toSearchPage(){
app.$themeToLink({
type : 1,
link: '/goodsSearch/goodsSearch'
}) })
} }
}, },
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<van-icon name="arrow-down" style="margin-left:4rpx" /> <van-icon name="arrow-down" style="margin-left:4rpx" />
</view> </view>
<view class="area-r"> <view class="area-r">
<input class="area-search" type="text" style="background-color:{{datas.componentData.searchBgColor}};font-size:{{datas.componentData.searchFontSize / 16 + 'em'}};color:{{datas.componentData.searchFontColor}};font-weight:{{datas.componentData.searchFontWeight}}"> <input class="area-search" type="text" bindtap="toSearchPage" style="background-color:{{datas.componentData.searchBgColor}};font-size:{{datas.componentData.searchFontSize / 16 + 'em'}};color:{{datas.componentData.searchFontColor}};font-weight:{{datas.componentData.searchFontWeight}}">
</input> </input>
</view> </view>
......
...@@ -45,8 +45,6 @@ Component({ ...@@ -45,8 +45,6 @@ Component({
getImgSize: (100 - this.data.datas.componentData.imgSize) / 2 getImgSize: (100 - this.data.datas.componentData.imgSize) / 2
}) })
let arr = [] let arr = []
let count = this.data.datas.componentData.columnNum * this.data.datas.componentData.rowNum; let count = this.data.datas.componentData.columnNum * this.data.datas.componentData.rowNum;
let num = Math.ceil(this.data.imgList.length / count); let num = Math.ceil(this.data.imgList.length / count);
...@@ -65,9 +63,33 @@ Component({ ...@@ -65,9 +63,33 @@ Component({
this.createSelectorQuery().select('.cube-item').boundingClientRect(function(res) { this.createSelectorQuery().select('.cube-item').boundingClientRect(function(res) {
console.log('swiper-wrap', res) console.log('swiper-wrap', res)
if (res) { if (res) {
if (_this.data.datas.componentData.rowNum == 1){
_this.setData({
cube3H: res.height * 2 * _this.data.datas.componentData.rowNum
})
} else if (_this.data.datas.componentData.rowNum == 2){
if(_this.data.imgList.length / _this.data.datas.componentData.columnNum > 1){
_this.setData({ _this.setData({
cube3H: res.height * 2 * _this.data.datas.componentData.rowNum cube3H: res.height * 2 * _this.data.datas.componentData.rowNum
}) })
}else{
_this.setData({
cube3H: res.height * 2 * 1
})
}
} else if (_this.data.datas.componentData.rowNum == 3){
if (_this.data.datas.componentData.columnNum == 1){
_this.setData({
cube3H: res.height * 2 * (_this.data.imgList / _this.data.datas.componentData.rowNum)
})
}else{
_this.setData({
cube3H: res.height * 2 * (Math.ceil(_this.data.imgList.length / _this.data.datas.componentData.columnNum))
})
}
}
} }
}).exec() }).exec()
...@@ -150,6 +172,7 @@ Component({ ...@@ -150,6 +172,7 @@ Component({
onclickHandle(e){ onclickHandle(e){
let item = e.currentTarget.dataset.item let item = e.currentTarget.dataset.item
console.log(item) console.log(item)
app.$themeToLink(item.link)
} }
} }
}) })
\ No newline at end of file
// static/nativeComponents/FloatButton/index.js
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
imgIcon : ''
},
ready(){
this.setData({
imgIcon: app.DFSImg(this.data.datas.componentData.backgroundImage, this.data.datas.componentData['sizeInfo']['width'] * 6, this.data.datas.componentData['sizeInfo']['width'] * 6,1)
})
},
/**
* 组件的方法列表
*/
methods: {
clickHandler(){
console.log('浮窗点击', this.data.datas.componentData.link)
app.$themeToLink(this.data.datas.componentData.link)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/FloatButton/index.wxml-->
<movable-area class="float-botton">
<movable-view class="movable-view {{datas.componentData.style==0 ? 'icon-class':'img-class'}}" direction="all" style="width:{{datas.componentData['sizeInfo']['width']/12}}em;height:{{datas.componentData['sizeInfo']['width']/12}}em;top:{{datas.componentData['position']['y']}}em;left:{{datas.componentData['position']['y']}}em;background-color:{{datas.componentData.style==0?datas.componentData['backgroundColor']:'transparent'}};box-shadow:{{(datas.componentData.style==0 && datas.componentData.boxShadow)?'rgba(0, 0, 0, 0.5) 0px 0px 10rpx':'none'}}" bindtap="clickHandler">
<view wx:if="{{datas.componentData.style==0}}" class="content">
<view wx:if="{{datas.componentData.icon.type==1}}">
<i
wx:if="{{datas.componentData.version}}"
class="content-img antt {{datas.componentData.icon.src}}"
style="font-size:1.6em;color:{{datas.componentData['contentColor']}}"
></i>
<i
wx:else
class="content-img antt iconfont {{datas.componentData.icon.src}}"
style="font-size:1.6em;color:{{datas.componentData['contentColor']}}"
>
</i>
</view>
<image wx:elif="{{datas.componentData.icon.type==2}}" class="content-img" src="{{datas.componentData.icon.src}}"></image>
<view class="content-name" style="font-size:{{datas.componentData['fontSize']}}em;color:{{datas.componentData['contentColor']}}">{{datas.componentData['content']}}</view>
</view>
<image wx:else class="imgs" src="{{imgIcon}}">
</image>
</movable-view>
</movable-area>
/* static/nativeComponents/FloatButton/index.wxss */
@import '../../nicon/iconfont.wxss';
@import "/static/font/common_icon.wxss";
.float-botton{
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 100;
pointer-events: none;
}
.movable-view{
user-select: none;
text-align: center;
font-size: 24rpx;
color: white;
z-index: 1500;
pointer-events: all;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.icon-class {
border-radius: 50%;
overflow: hidden;
/* padding: 0 10rpx; */
}
.content{
width: 100%;
}
.content-img{
width: 100%;
padding:0 0 8rpx 0;
}
i {
font-size: 32rpx;
}
.imgs {
width: 100%;
height: 100%;
object-fit: contain;
}
\ No newline at end of file
const app = getApp();
const { $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
showPop: false,
custom: {
textShow: 1,
itemList: [1, 1, 1],
itemListInfo: [],
href: "",
toPage: "", //跳转的页面
callback: "", //回调函数
extends: {} //额外参数
},
distributorVal: "",
type: 0,
phone: "",
href: "",
posterId: -1,
spokesmanGroupId: "",
spokesmanShopId: "",
spokesmanRelId: "",
hasInvitationStatus: 0,
nickname: "",
shareGoodsInfo: {},
giftIsSend: false,
miniProgram: 0,
flag: false,
productId: "",
copyLink: "32132132"
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {
let _this = this;
let { custom } =this.data;
app.shareInit = function(list) {
for (const key in list) {
if (list.hasOwnProperty(key)) {
if (custom[key] !== "undefined" && custom[key] !== undefined && list[key] !== "undefined" && list[key] !== undefined) {
custom[key] = list[key];
}
}
}
_this.setData({ custom });
_this.showPopup();
};
},
showPopup() {
this.setData({ showPop: true });
this.getTabBar().setData({ show: false });
},
onClose() {
this.setData({ showPop: false });
this.getTabBar().setData({ show: true });
},
cancel() {
this.onClose();
},
copyText(e) {
let { text } = e.currentTarget.dataset;
let pagePath = getCurrentPages()[0].route;
let copyVal = pagePath + text;
wx.setClipboardData({
data: copyVal,
success: function(res) {
wx.getClipboardData({
success: function(res) {
wx.showToast({ title: "复制成功" });
}
});
}
});
},
toPosters() {
let linkVal = `/goods/posters`;
$themeToLink({ type: 1, link: linkVal });
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-popup": "/static/vant/popup/index"
}
}
<!-- 分享弹窗 -->
<view class="SharePopup" id="SharePopup">
<van-popup
show="{{ showPop }}"
position="bottom"
bind:close="onClose"
>
<!-- <view class="share-tip">
<text style="color:#333;font-size:28rpx;">朋友通过你分享的页面成功购买后,你可获得奖励金</text>
<text style="color:#333;font-size:24rpx;">可在【我的】 - 【distributorVal】查看奖励金</text>
</view>
<view class="share-tip">
<text style="color:#333;font-size:28rpx;">朋友通过你分享的页面成功登录后,将成为你的客户</text>
<text style="color:#333;font-size:24rpx;">可在【我的】 - 【distributorVal】-【我的客户】查看</text>
</view> -->
<view class="share-main">
<view class="share-item" wx:if="{{custom.itemList[0]==1}}">
<button
type="text"
open-type="share"
class="shareButton"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/015d5cd2-183a-44aa-9b66-5f7c2e627089.png"></image>
<text class="item-text">微信分享</text>
</button>
</view>
<view
class="share-item"
bindtap="copyText"
data-text="{{copyLink}}"
wx:if="{{custom.itemList[1]==1}}"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/0320a722-25d2-4a30-900f-790c2a541f2f.png"></image>
<text class="item-text">复制链接</text>
</view>
<view
class="share-item"
bindtap="toPosters"
wx:if="{{custom.itemList[2]==1}}"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/18d0044d-9634-4c89-8321-3e8ff8e94cce.png"></image>
<text class="item-text">生成海报</text>
</view>
</view>
<view class="share-cancel" bindtap="cancel">取消</view>
</van-popup>
</view>
.share-tip {
padding: 24rpx 0 0 32rpx;
text-align: center;
}
.share-tip text {
line-height: 48rpx;
}
.share-main {
width: 100%;
height: 254rpx;
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 20rpx solid #eeeeed;
}
.shareButton {
background-color: transparent;
padding-left: 0;
padding-right: 0;
line-height: inherit;
border-radius:0;
font-size: 28rpx;
}
.shareButton::after {
border: none;
}
.share-main .share-item {
text-align: center;
color: #333;
font-size: 28rpx;
}
.share-main .share-item image {
width: 112rpx;
height: 112rpx;
margin-bottom: 10rpx;
}
.share-cancel {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 34rpx;
color: #f82f2e;
}
const app = getApp();
const { $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {
datas: {
type: Object
},
countDownShow: {
type: Boolean
},
num: {
type: Number
}
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
// hideItem: false,
timeData: {}
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {},
onChange(e) {
let { isStart, startTime } = this.data.datas;
isStart =
new Date(startTime.replace(/-/g, "/")).getTime() > new Date().getTime()
? true
: false;
this.setData({ timeData: e.detail, "datas.isStart": isStart });
},
toActivity() {
$themeToLink({ type: 1, link: `/brandTopics/${this.data.datas.id}` });
}
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
};
Component(componentOptions)
{
"component": true,
"usingComponents": {
"van-count-down": "/static/vant/count-down/index"
}
}
<!-- 活动列表item -->
<view
class="activityListItem"
wx:if="{{!datas.isEnd}}"
bindtap="toActivity"
>
<view class="title">
{{datas.singleItemActivityName}}
</view>
<view class="cover">
<image mode="center" src="{{datas.singleItemActivityCoverImage}}"></image>
</view>
<view class="countDown flex" wx:if="{{countDownShow}}">
<van-count-down
use-slot
time="{{datas.isStart?datas.startTimeTimeStamp:datas.endTimeTimeStamp}}"
class="countDown"
bind:change="onChange"
>
<view class="time">
<text class="colon">距{{datas.isStart?'开始':'结束'}}</text>
<text class="block">{{ timeData.days }}</text>
<text class="colon">天</text>
<text class="block">{{ timeData.hours }}</text>
<text class="colon">时</text>
<text class="block">{{ timeData.minutes }}</text>
<text class="colon">分</text>
<text class="block">{{ timeData.seconds }}</text>
<text class="colon">秒</text>
</view>
</van-count-down>
</view>
</view>
.activityListItem {
margin-bottom: 20rpx;
padding: 20rpx 0;
background: #fff;
border-radius: 8rpx;
-webkit-border-radius: 8rpx;
-moz-border-radius: 8rpx;
-ms-border-radius: 8rpx;
-o-border-radius: 8rpx;
}
.title {
padding: 8rpx 20rpx;
font-size: 34rpx;
color: #333;
font-weight: bold;
text-align: left;
}
.cover {
margin: 8rpx 0;
width: 100%;
height: 300rpx;
overflow: hidden;
}
.cover image {
width: 100%;
}
.countDown {
padding: 4rpx 10rpx;
justify-content: flex-end;
font-size: 24rpx;
color: #666;
}
.countDown .block {
display: inline-block;
width: 40rpx;
height: 40rpx;
text-align: center;
line-height: 40rpx;
border-radius: 4rpx;
background: #333;
color: #fff;
-webkit-border-radius: 4rpx;
-moz-border-radius: 4rpx;
-ms-border-radius: 4rpx;
-o-border-radius: 4rpx;
}
.time{
display: flex;
align-items: center;
justify-content: flex-end;
margin-right: 10rpx;
}
.colon{
font-size: 30rpx;
}
.block{
margin: 0 10rpx;
color: #fff;
}
\ No newline at end of file
let d = null;
const app = getApp();
const { promoteApi, DFSImg, $themeToLink } = app;
// 倒计时方法
if (typeof xcsoft == "undefined") var xcsoft = new function() {}();
xcsoft.countdown = function(a, b, c) {
d = new Object();
var e = 0;
if (typeof a == "object") {
var f = parseInt(new Date().getTime() / 1000);
var g = a.startTime ? parseInt(a.startTime) : 0;
g = g == 0 ? f : g;
var h = a.endTime;
var x = g - f;
d.decimal = parseInt(a.msec ? a.msec : 0);
} else {
var f = 0;
var x = 0;
d.decimal = 0;
var h = a;
var i = h.toString();
if (i.indexOf(".") > 0) {
d.decimal = i.split(".")[1];
if (d.decimal > 3) {
d.decimal = 3;
}
}
}
d.time = h;
d.finish = false;
if (isNaN(h)) {
var j = h.substring(0, 19);
j = j.replace(/-/g, "/");
d.time = new Date(j).getTime() / 1000;
}
var k = d.decimal == 0 ? 100 : 100;
d.day = 0;
d.hour = 0;
d.minute = 0;
d.second = 0;
d.t = setInterval(function() {
e = new Date().getTime();
f = parseInt(e / 1000 + x);
var l = d.time - f;
if (l <= 0) {
e = 0;
l = 0;
}
if (l >= 0) {
d = xcsoft.getTimeObject(d, l);
}
if (d.decimal == 1) {
d.msecZero = d.msec = parseInt(10 - (e % 1000) / 100);
if (d.msec == 10 || l == 0) {
d.msecZero = d.msec = 0;
}
} else if (d.decimal == 2) {
d.msecZero = d.msec = parseInt(100 - (e % 1000) / 10);
if (d.msec < 10) {
d.msecZero = "0" + d.msec;
} else if (d.msec == 100 || l == 0) {
d.msec = 0;
d.msecZero = "0" + d.msec;
}
} else {
d.msecZero = d.msec = parseInt(1000 - e % 1000);
if (d.msec < 10) {
d.msecZero = "00" + d.msec;
} else if (d.msec < 100) {
d.msecZero = "0" + d.msec;
} else if (d.msec == 1000 || l == 0) {
d.msec = 0;
d.msecZero = "00" + d.msec;
}
}
if (b) {
b(d);
}
if (l <= 0 || d.stop == true) {
clearInterval(d.t);
d.finish = true;
if (c) c(d);
}
}, k);
};
xcsoft.getTimeObject = function(a, l) {
var b = 60;
var c = b * b;
var d = 24 * c;
a.days = Math.floor(l / d);
a.year = Math.floor(a.days / 365);
a.day = Math.floor(a.days % 365);
a.hour = Math.floor((l % d) / c);
a.minute = Math.floor((l - (a.days * d + a.hour * c)) / b);
a.second = Math.floor(l % b);
a.dayZero = a.day < 10 ? "0" + a.day : a.day;
a.daysZero = a.days < 10 ? "0" + a.days : a.days;
a.hourZero = a.hour < 10 ? "0" + a.hour : a.hour;
a.minuteZero = a.minute < 10 ? "0" + a.minute : a.minute;
a.secondZero = a.second < 10 ? "0" + a.second : a.second;
return a;
};
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {
datas: {
type: Object
}
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
timeData: {},
isLoading: true,
deleteFlag: false, //活动未禁用
newTime: new Date().getTime(),
timer: null,
hideAll: false,
days: 0,
hours: 0,
minute: 0,
second: 0
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {
let { goodsList, activityCode, selectActivityValue, dimension } = this.data.datas.componentData;
let { deleteFlag, endTimeData } = this.data;
if (activityCode == "") {
return;
}
let query = {
singleItemActivityId: activityCode,
whetherShowSoldOutGoods: 1
};
promoteApi.getSingleItemActivityV2(query).then(res => {
if (res.data.code == 200) {
let copyData = res.data.data;
deleteFlag = copyData.activityStatus != 2 ? true : false;
if (dimension == 0 && copyData.goodsItems.length == 0) {
deleteFlag = true;
}
endTimeData = new Date(copyData.endTime.replace(/-/g, "/")).getTime() - new Date().getTime();
console.log(endTimeData, "----------------------150");
this.setData({ endTime: endTimeData });
let _this = this;
this.setData({ deleteFlag });
console.log("------------155")
// setTimeout(() => {
// xcsoft.countdown(_this.data.datas.componentData.endTime, function (time) {
// console.log("--------------157")
// let { days, hours, minute, second } = _this.data;
// days = time.dayZero;
// hours = time.hourZero;
// minute = time.minuteZero;
// second = time.secondZero;
// // _this.setData({ days, hours, minute, second });
// }, function(time) {
// //倒计时结束后的操作
// });
// setTimeout(() => {
// this.setData({ isLoading: true });
// }, 100);
// }, 100);
copyData.goodsItems.forEach((item, index) => {
item.productImgUrl = DFSImg(item.imgUrl);
item.minPrice = parseFloat(item.discountPrice);
item.maxPrice = parseFloat(item.salePrice);
});
this.setData({
goodsList: copyData.goodsItems,
selectActivityValue: copyData.singleItemActivityName
});
}
});
},
initArticityList() {
let ids = [];
let { actList } = this.data.datas.componentData;
let { isLoading } = this.data;
if (actList.length > 0) {
ids = actList.map(item => {
return item.id;
});
}
if (ids.length == 0) {
this.setData({ isLoading:false });
return;
}
promoteApi.query_single_item_activity_list_by_ids(ids).then(res => {
if (res.data.code == 200) {
let list = res.data.data ||[];
if (list.length > 0) {
let hideNum = 0;
list.forEach((item, index) => {
if (new Date(item.endTime.replace(/-/g, "/")).getTime() - new Date().getTime() <= 0) {
item.isEnd = true;
hideNum += 1;
} else {
item.isEnd = false;
}
item.startTimeTimeStamp = new Date(item.startTime.replace(/-/g, "/")).getTime() - new Date().getTime();
item.endTimeTimeStamp = new Date(item.endTime.replace(/-/g, "/")).getTime() - new Date().getTime();
item.singleItemActivityCoverImage = DFSImg(item.singleItemActivityCoverImage);
item.isStart = new Date(item.startTime.replace(/-/g, "/")).getTime() > new Date().getTime() ? true : false;
})
this.setData({ "datas.componentData.actList": list });
if (hideNum == actList.length) {
this.setData({ hideAll:true });
}
}
}
});
},
onChange(e) {
this.setData({ timeData: e.detail });
},
onclickProduct(e) {
console.log(e.currentTarget.dataset.items,'-------------------------226');
let { terminalProductId, terminalGoodsMixId, productId } = e.currentTarget.dataset.items;
$themeToLink({ type: 1, link: `/goods/${productId}?limitedLime=true&endTime=${this.data.datas.componentData.endTime}&terminalProductId="${terminalProductId}&terminalGoodsMixId=${terminalGoodsMixId}` });
},
onclickOrder(e) {
let { terminalGoodsMixId, terminalGoodsId, goodsId } = e.currentTarget.dataset.items;
$themeToLink({
type: 1,
link: `/order/orderConfirm?productGoodsMixId=${terminalGoodsMixId}&productGoodsId=${terminalGoodsId}&goodsId=${goodsId}&qty=1&goodsString=null`
});
},
getData() {
let { dimension } = this.data.datas.componentData;
if (dimension == 0) {
this.init();
} else if (dimension == 1) {
this.initArticityList();
}
}
},
// 组件生命周期
lifetimes: {
created() {},
ready() {
this.getData();
},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
this.getData();
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
};
Component(componentOptions)
{
"component": true,
"usingComponents": {
"activity-list-item":"./activityListItem/index",
"van-count-down": "/static/vant/count-down/index"
}
}
<!-- 限时活动 -->
<view class="time-limited-discount" style="padding-top:{{datas.componentData.paddingList[0].value*2}}rpx;padding-bottom:{{datas.componentData.paddingList[1].value*2}}rpx;padding-left:{{datas.componentData.paddingList[2].value*2}}rpx;padding-right:{{datas.componentData.paddingList[3].value*2}}rpx;--backgroundColor:{{datas.componentData.backgroundColor}}">
<!-- 标题 -->
<view class="tops {{datas.componentData['countDownShow']?'hideCountDown':''}}">
<view class="topInfo">
<view class="title">
{{datas.componentData.dimension ==0?datas.componentData.selectActivityValue:datas.componentData.actTitle}}
</view>
<view class="subheading" wx:if="{{datas.componentData['countDownShow']&&datas.componentData.dimension==0}}">
<view wx:if="{{datas.componentData['endTime']&&endTime>0}}">
<van-count-down
use-slot
time="{{endTime}}"
class="countDown"
bind:change="onChange"
>
<text class="endTime days">{{ timeData.days }}</text>
<text class="endTimedot">天</text>
<text class="endTime hours">{{ timeData.hours }}</text>
<text class="endTimedot">:</text>
<text class="endTime minute">{{ timeData.minutes }}</text>
<text class="endTimedot">:</text>
<text class="endTime second">{{ timeData.seconds }}</text>
</van-count-down>
</view>
<view class="countDown" wx:elif="{{isLoading}}">
活动已结束
</view>
</view>
</view>
</view>
<!-- 内容 -->
<!-- 网格模式 -->
<view class="goods" wx:if="{{datas.componentData.style==='list'}}">
<view class="goodsList">
<view
class="goodsItem {{datas.componentData.columnNum==2?'style2':'style3'}}"
wx:for="{{datas.componentData.goodsList}}"
wx:key="index"
style="width:{{100/datas.componentData.columnNum}}%"
>
<view class="goods-item-child {{datas.componentData.columnNum==1?'goods-item-child-flex':''}}">
<view class="imgBox slidebox1">
<view
class="goodsPicture"
bindtap="onclickProduct"
data-items="{{datas.componentData.goodsList[index]}}"
style="padding:{{datas.componentData.imgSize}}"
>
<image mode="widthFix" src="{{datas.componentData.goodsList[index]['productImgUrl']}}"></image>
<view class="whiteBg" wx:if="{{datas.componentData.goodsList[index].oversoldFlag==0&&datas.componentData.goodsList[index].saleQty-0<=0}}">
<view class="cover">
<text>商品</text>
<text>售罄</text>
</view>
</view>
</view>
</view>
<view class="info">
<view class="name">
{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['productName']:'名称'}}
</view>
<view class="allPrice">
<view>
<!-- <text class="price" wx:if="{{((hours-0)+(minute-0)+(second-0))!=0}}">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</text>
<text class="price" wx:else>¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</text>
<text class="delPrice" wx:if="{{((hours-0)+(minute-0)+(second-0))!=0}}">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['maxPrice']:0}}</text> -->
<view class="price">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</view>
<view class="delPrice">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['maxPrice']:0}}</view>
</view>
<view
class="btn"
style="background:#333;"
data-items="{{datas.componentData.goodsList[index]}}"
catchtap="onclickOrder"
>
立即抢购
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 横向滑动 -->
<view class="goods1" wx:elif="{{datas.componentData.style==='across'}}">
<view
class="goods-item"
wx:for="{{datas.componentData.goodsList}}"
wx:key="index"
>
<view class="items">
<view class="imgBox slidebox2">
<view
class="goodsPicture"
wx:if="{{datas.componentData.goodsList[index]!=null}}"
style="padding:{{datas.componentData.imgSize}}"
data-items="{{datas.componentData.goodsList[index]}}"
bindtap="onclickProduct"
>
<image mode="widthFix" src="{{datas.componentData.goodsList[index]['productImgUrl']}}"></image>
<view class="whiteBg" wx:if="{{datas.componentData.goodsList[index].oversoldFlag==0&&datas.componentData.goodsList[index].saleQty-0<=0}}">
<view class="cover">
<text>商品</text>
<text>售罄</text>
</view>
</view>
</view>
</view>
<view class="info">
<!-- <text class="price" wx:if="{{((hours-0)+(minute-0)+(second-0))!=0}}">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</text>
<text class="price" wx:else>¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</text>
<text class="delPrice" wx:if="{{((hours-0)+(minute-0)+(second-0))!=0}}">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['maxPrice']:0}}</text> -->
<view class="price">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['minPrice']:0}}</view>
<view class="delPrice">¥{{datas.componentData.goodsList[index]!=null?datas.componentData.goodsList[index]['maxPrice']:0}}</view>
</view>
</view>
</view>
</view>
<!-- 活动列表 -->
<activity-list-item
wx:if="{{datas.componentData.dimension == 1}}"
wx:for="{{datas.componentData.actList}}"
wx:key="index"
datas="{{item}}"
num="{{index}}"
countDownShow="{{datas.componentData['countDownShow']}}"
></activity-list-item>
</view>
.time-limited-discount {
background: var(--backgroundColor);
font-size: 32rpx;
}
.tops {
padding: 8rpx 0;
}
.hideCountDown {
display: flex;
justify-content: space-between;
align-items: center;
}
.topInfo {
width: 100%;
display: flex;
justify-content: space-between;
align-content: center;
}
.topInfo .title {
font-size: 38rpx;
color: #333;
font-weight: bold;
text-align: left;
}
.topInfo .subheading {
position: relative;
display: flex;
align-items: center;
}
.subheading.countDown {
display: flex;
justify-content: space-around;
align-items: center;
}
.endTime {
padding: 4rpx 10rpx;
border-radius: 6rpx;
background: #6a6b6b;
color: #fff;
font-weight: bold;
-webkit-border-radius: 6rpx;
-moz-border-radius: 6rpx;
-ms-border-radius: 6rpx;
-o-border-radius: 6rpx;
}
.endTimedot {
padding: 0 10rpx;
}
.goods {
width: 100%;
}
.goodsList {
display: flex;
align-items: flex-start;
}
.goodsItem {
box-sizing: border-box;
}
.goods-item-child {
border-radius: 5px;
overflow: hidden;
background: #fff;
margin: 0 10rpx;
}
.goods-item-child .info {
padding: 10rpx 20rpx 12rpx;
}
.goods-item-child .info .name {
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 44rpx;
font-size: 32rpx;
height: 92rpx;
}
.goods-item-child .info .allPrice {
display: flex;
justify-content: space-between;
align-items: center;
}
.price {
font-weight: 600;
margin-top: 10rpx;
color: #ff3434;
font-size: 32rpx;
}
.delPrice {
text-decoration: line-through;
margin-top: 10rpx;
color: #999;
}
.goods-item-child .info .allPrice .btn {
font-size: 24rpx;
background: #333;
padding: 8rpx;
color: #fff;
border-radius: 10rpx;
-webkit-border-radius: 10rpx;
-moz-border-radius: 10rpx;
-ms-border-radius: 10rpx;
-o-border-radius: 10rpx;
}
.goods-item-child-flex {
display: flex;
justify-content: space-between;
align-items: center;
}
.imgBox {
position: relative;
overflow: hidden;
width: 100%;
height: 40vw;
display: flex;
align-items: center;
justify-content: center;
}
.imgBox .goodsPicture{
width: 100%;
}
.goods-item-child-flex .imgBox {
width: 30%;
padding-bottom: 30%;
}
.goods-item-child-flex .info {
width: 70%;
}
.goodsPicture .whiteBg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(#fff, 0.7);
}
.goodsPicture .whiteBg .cover {
position: absolute;
top: 40rpx;
left: 40rpx;
right: 40rpx;
bottom: 40rpx;
display: flex;
background: rgba(#333, 0.6);
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 50%;
}
.goodsPicture .whiteBg .cover text {
color: #fff;
font-weight: bold;
letter-spacing: 6rpx;
text-align: center;
}
.goods1 {
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
-webkit-overflow-scrolling: touch; /* ios5+ */
}
.goods1 .goods-item {
display: inline-block;
vertical-align: top;
white-space: initial;
margin-right: 20rpx;
width: 40%;
}
.goods1 .goods-item .items {
border-radius: 5px;
overflow: hidden;
background: #ffffff;
}
.goods1 .goods-item .info {
text-align: center;
}
.goods1 .goods-item .slidebox2 {
box-sizing: border-box;
-moz-box-sizing: border-box; /* Firefox */
-webkit-box-sizing: border-box; /* Safari */
}
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 to comment