Commit d18b7cad by 程智春

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

parents 8d919715 40c48936
...@@ -2,6 +2,17 @@ const app = getApp() ...@@ -2,6 +2,17 @@ const app = getApp()
console.log(app, 'apppppppppp') console.log(app, 'apppppppppp')
Component({ Component({
pageLifetimes: {
show() {
console.log('哈哈哈哈')
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 1
})
}
}
},
data: { data: {
selected: 0, selected: 0,
color: "#7A7E83", color: "#7A7E83",
...@@ -65,7 +76,9 @@ Component({ ...@@ -65,7 +76,9 @@ Component({
} }
// ----------webview 变化 // ----------webview 变化
console.log('启动1111') 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)
} }
...@@ -75,27 +88,22 @@ Component({ ...@@ -75,27 +88,22 @@ Component({
}, },
switchTab(e) { switchTab(e) {
// mpApp.$themeToLink //
const { const {
index index
} = e.currentTarget.dataset } = e.currentTarget.dataset
console.log('755555555', this.data.list[index].link) console.log('755555555', this.data.list[index].link)
// if (index == this.data.selected) return
app.globalData.tabBarPageLink=this.data.list[index].link.link
console.log(app,'aaaa') app.$themeToLink(this.data.list[index]['link'],1)
this.toPage(this.data.list[index].link,index)
// return // this.toPage(this.data.list[index].link,index)
// app.$themeToLink(this.data.list[index].link)
// this.setData({ // this.setData({
// selected: index // selected: index
// }) // })
}, },
toPage(data,index){ toPage(data,index){
console.log('index98',index) console.log('index98',index,this)
// index=index==0?index+1:index
// 跳转 // 跳转
if (data.link=='/') { if (data.link=='/') {
wx.switchTab({ wx.switchTab({
......
<!--miniprogram/custom-tab-bar/index.wxml--> <!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar"> <cover-view class="tab-bar">
<cover-view class="antt ant-daipinglun"></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 wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}"
bindtap="switchTab"> bindtap="switchTab">
......
@font-face {font-family: "iconfont";
src: url('//at.alicdn.com/t/font_1457682_3rf83d24buy.eot?t=1604541583326'); /* IE9 */
src: url('//at.alicdn.com/t/font_1457682_3rf83d24buy.eot?t=1604541583326#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAB+8AAsAAAAAOPAAAB9sAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCKAArYJMYzATYCJAOBSAtmAAQgBYRtB4RVG84uZYYYbBwA8mZfQ1HUKMFIzf7/Y3IyhoAJunlfbDhYyE6hD5oW7eKw2VjpX7AvFUdu+qNkCq8yjvI06x3+PJwBk59pVTuPt6WtTlJGkW9Lw8qwsuf7rvK8mXcoQUJRy9/37l56KQVPSBaFUAiF8GiUREgcDiFBUUP6/zBnprGbA8lOdg+InwV+AwmWw90i+2N95S8o4bYXKvDCAYFj/44gAAiq295305SkFFBc+hRFYZoFFGUYWdrwtM1/x4ESwgESxlmIMhvBxk1oq0AXTp2BkXNrc1XfhfYcq3bGyvjGWl2lrsKFuv55FLKDUSSY3CfUGMDB5D4BAm7mbbM+XOG9PSWkYiOVMWu/mCAr6lzgSq6VUUFGBei6IIu6TVJPJ2aIPg8n3DTBgi1uguVdfRkHGiAlONXtT+39abbPSR8mhuUKTvpat1LXPIwF6D6WfCBd+z+dZSsdBkgBqlYvT8EfLpqDLmU1M/bdakbSrsdLGvtIy7IOPMsKIHVc51IBSb5LnnVoHdpBO0AVAJbUpU+Zqqjiy3C9vGR0YglSo6zH71GZda4/w/s+5Ltqcxhe0K5hQFzbkhnV4fHgNh55PgPMmq1PBbdlXbwFzYg6gsIWM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I1UQ8U7f38QxOArgmbz7HNzLfq8J/hGOFZ/6c5KFRBpmZER3tsaoL0jbdZcT2x9N9YjlhxzNCMhU8VVgekeMtViO6absEZqZVsSe5FTY6iT+pIdPmbaG0zOS5qn0iCGdbV0vOeRuooppWoTcpTfqe799ju30Ps/VMcdJH1pD5Bmyk+A9r7iWfokf4P6bkG2qQbTI7bmsTQxvxjo+N+clcKzMV5jydl5kbjCWgEe1qzVxMeZjTmZ6sG4Gvh/pg2I1Tg1hVBn2HVQgySSo+y0sjPWI7K/YU1KR4Klh5c8ayUh/B9DDyLiusl33TOl3Q/uFEfLEiiTXCUgT1rGTwhqSaN6JPrfnps+2APaTl3Bdm93L27CQAA') format('woff2'),
url('//at.alicdn.com/t/font_1457682_3rf83d24buy.woff?t=1604541583326') format('woff'),
url('//at.alicdn.com/t/font_1457682_3rf83d24buy.ttf?t=1604541583326') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('//at.alicdn.com/t/font_1457682_3rf83d24buy.svg?t=1604541583326#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-tuceng1:before {
content: "\e692";
}
.icon-tuceng2:before {
content: "\e706";
}
.icon-fenzhi:before {
content: "\e629";
}
.icon-tuceng:before {
content: "\e621";
}
.icon-mokuai:before {
content: "\e604";
}
.icon-fengge:before {
content: "\e607";
}
.icon-iconfontquestion:before {
content: "\e60b";
}
.icon-bianji:before {
content: "\e637";
}
.icon-shezhi:before {
content: "\e781";
}
.icon-lui-dot:before {
content: "\e66";
}
.icon-Notvisible:before {
content: "\e6fe";
}
.icon-browse:before {
content: "\e745";
}
.icon-qingkong1:before {
content: "\e624";
}
.icon-zhongxin:before {
content: "\e68b";
}
.icon-tianjia:before {
content: "\e602";
}
.icon-shangchuantupian11:before {
content: "\c652";
}
.icon-daoru1:before {
content: "\e63b";
}
.icon-theme-fenxiang:before {
content: "\e610";
}
.icon-tuijian:before {
content: "\e63f";
}
.icon-huodong:before {
content: "\e606";
}
.icon-huodong1:before {
content: "\e61f";
}
.icon-tuijian1:before {
content: "\e620";
}
.icon-wode:before {
content: "\e603";
}
.icon-gouwuche:before {
content: "\e605";
}
.icon-fenlei1:before {
content: "\e649";
}
.icon-home:before {
content: "\e64b";
}
.icon-in_gouxuan:before {
content: "\e601";
}
.icon-jiahao:before {
content: "\e61c";
}
.icon-tupian2:before {
content: "\e636";
}
.icon-gonggao:before {
content: "\e611";
}
.icon-dazhuanpan:before {
content: "\e616";
}
.icon-duoxingwenben:before {
content: "\e7e1";
}
.icon-xianshiqianggou:before {
content: "\e633";
}
.icon-icon-test:before {
content: "\e61d";
}
.icon-liebiao:before {
content: "\e627";
}
.icon-article:before {
content: "\e7e7";
}
.icon-fengexian:before {
content: "\e66e";
}
.icon-lunboxiaoguo:before {
content: "\e675";
}
.icon-youhuiquan:before {
content: "\e697";
}
.icon-zixun:before {
content: "\e66c";
}
.icon-lianjie:before {
content: "\e623";
}
.icon-guanggaolianmeng:before {
content: "\e7dd";
}
.icon-fabu:before {
content: "\e600";
}
.icon-pintu:before {
content: "\e61e";
}
.icon-fanhui:before {
content: "\e60a";
}
.icon-shanchuguanbicha:before {
content: "\e809";
}
.icon-shanchu1:before {
content: "\e6d0";
}
.icon-shanchu:before {
content: "\e609";
}
.icon-iconset0308:before {
content: "\e6cf";
}
page { page {
--main-color: #ffffff; --main-color: #ffffff;
--minor-color: #ffffff; --minor-color: #ffffff;
......
...@@ -53,6 +53,8 @@ export default { ...@@ -53,6 +53,8 @@ export default {
let defaultComponentModel = res.data.data.shopThemeData; let defaultComponentModel = res.data.data.shopThemeData;
this.mpApp.globalData.shopThemeData = res.data.data.shopThemeData; this.mpApp.globalData.shopThemeData = res.data.data.shopThemeData;
this.mpApp.globalData.shopInfo=res.data.data;
// 获取底部栏数据 // 获取底部栏数据
let val = JSON.parse(defaultComponentModel); let val = JSON.parse(defaultComponentModel);
if (val && val.defaultComponentModel) { if (val && val.defaultComponentModel) {
......
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
...@@ -4,6 +4,7 @@ import Store from './store/index' ...@@ -4,6 +4,7 @@ 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 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"
...@@ -45,4 +46,5 @@ mpApp.$themeToLink = $themeToLink ...@@ -45,4 +46,5 @@ mpApp.$themeToLink = $themeToLink
// api // api
mpApp.goodsApi = goodsApi; mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi; mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi;
mpApp.DFSImg = DFSImg; mpApp.DFSImg = DFSImg;
<template> <template>
<div class="domain"> <div class="domain">
<view class="ant-daipinglun">1</view>
<!-- <goods-list id="goodsList"></goods-list> --> <!-- <goods-list id="goodsList"></goods-list> -->
<scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;" scroll-y="true">
<div v-for="(item,index) in pageData" :key="index"> <div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner'"> <div v-if="item.componentCode=='banner'">
<banner :datas="item"></banner> <banner :datas="item"></banner>
</div> </div>
<div v-else-if="item.componentCode=='goods-list'"> <div v-else-if="item.componentCode=='goods-list'" style="height:100%;">
<goods-list :datas="item"></goods-list> <goods-list class="goodsListItem" :datas="item"></goods-list>
</div> </div>
<div v-if="item.componentCode == 'area-navigation'"> <div v-else-if="item.componentCode == 'area-navigation'">
<area-navigation :datas="item"></area-navigation> <area-navigation :datas="item"></area-navigation>
</div> </div>
<div v-if="item.componentCode == 'cube-nav'"> <div v-else-if="item.componentCode == 'cube-nav'">
<cube-nav :datas="item"></cube-nav> <cube-nav :datas="item"></cube-nav>
</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'"> <div v-if="item.componentCode == 'links'">
<links :datas="item"></links> <links :datas="item"></links>
</div> </div>
...@@ -30,11 +35,12 @@ ...@@ -30,11 +35,12 @@
<float-button :datas="item"></float-button> <float-button :datas="item"></float-button>
</div> </div>
</div> </div>
</scroll-view>
<!-- <image <!-- <image
src="http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750" src="http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
></image> ></image>
<van-button type="primary">按钮</van-button> <van-button type="primary">按钮</van-button>
<view class="ant-bofang">1</view> --> -->
<!-- ----瀑布流开始---- --> <!-- ----瀑布流开始---- -->
<!-- <waterfall-flow id="waterfallFlow"></waterfall-flow> --> <!-- <waterfall-flow id="waterfallFlow"></waterfall-flow> -->
<!-- ----瀑布流结束---- --> <!-- ----瀑布流结束---- -->
...@@ -51,6 +57,8 @@ import links from '@/components/basicTool/link/index.vue' ...@@ -51,6 +57,8 @@ import links from '@/components/basicTool/link/index.vue'
import interval from '@/components/basicTool/interval/index.vue' import interval from '@/components/basicTool/interval/index.vue'
import partition from '@/components/basicTool/partition/index.vue' import partition from '@/components/basicTool/partition/index.vue'
import shopPopup from '@/components/basicTool/shop-popup/index.vue' import shopPopup from '@/components/basicTool/shop-popup/index.vue'
import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js";
export default { export default {
data() { data() {
return { return {
...@@ -74,19 +82,31 @@ export default { ...@@ -74,19 +82,31 @@ export default {
}; };
} }
}, },
onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/'));
},
methods: { methods: {
init(pageList) { init(pageList) {
setTabBarActive.bind(this)(checkTabbarPage('/'));
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0]; this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
this.pageData = JSON.parse(this.pageInfo.pageData); this.pageData = JSON.parse(this.pageInfo.pageData);
console.log('36',this.pageData) console.log("36", this.pageData);
},
scrolls(el){
console.log('scroll')
this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
}, },
scrolltolower(){
console.log("scrolltolower")
}
}, },
}; };
</script> </script>
<style> <style>
.domain { .domain {
text-align: center; /* text-align: center; */
/* padding-top: 50%; */ /* padding-top: 50%; */
} }
</style> </style>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"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",
......
...@@ -79,15 +79,6 @@ export default { ...@@ -79,15 +79,6 @@ export default {
this.options = options; this.options = options;
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
console.log(
wx.getStorageSync("sessionid"),
options,
"index------",
this.shopId,
"-----",
wx.getStorageSync("openid"),
this.shopId
);
//获取openId //获取openId
wx.login({ wx.login({
success: res => { success: res => {
...@@ -109,21 +100,7 @@ export default { ...@@ -109,21 +100,7 @@ export default {
//检测登录态 //检测登录态
this.checkLogin(); this.checkLogin();
console.log(this.params,6666666)
this.options = options; this.options = options;
console.log('-------1',options.scene)
console.log(this.options)
console.log('-------link',this.mpApp.globalData.tabBarPageLink)
// tabbar 跳转
// if (this.mpApp.globalData.tabBarPageLink) {
// this.page = this.mpApp.globalData.tabBarPageLink;
// this.mpApp.globalData.tabBarPageLink=''
// }
// if (options.from && options.from == "tabbar") {
// this.page = decodeURIComponent(options.backpath);
// }
// ---------
if (options.share) { if (options.share) {
//来自分享 //来自分享
this.link = decodeURIComponent(options.share); this.link = decodeURIComponent(options.share);
...@@ -153,6 +130,9 @@ export default { ...@@ -153,6 +130,9 @@ export default {
} else if (options.from && (options.from == "home" || options.from == "livedToIndex")) { } else if (options.from && (options.from == "home" || options.from == "livedToIndex")) {
//来自直播详情 //来自直播详情
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
if(this.page.includes("?")){
this.params="&mixid=" + this.shopId;
}
options.params && (this.params += "&" + serialize(options.params)); options.params && (this.params += "&" + serialize(options.params));
} else if (options.from && options.from == "livedBackShop") { } else if (options.from && options.from == "livedBackShop") {
//直播页back到商城 //直播页back到商城
...@@ -327,6 +307,19 @@ export default { ...@@ -327,6 +307,19 @@ export default {
} }
this.init(); this.init();
}, },
onShow(){
let ss=wx.getStorageSync("sessionid");
if (ss && !this.params.includes("sessionid")) {
this.params +=`&sessionid=${ss}`
}
console.log(this.getTabBar,'312')
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: this.index
})
}
},
methods: { methods: {
init() { init() {
// 获取小程序开启的订阅消息配置 // 获取小程序开启的订阅消息配置
......
...@@ -27,12 +27,14 @@ ...@@ -27,12 +27,14 @@
<script> <script>
import { serialize } from "@/utils/index"; import { serialize } from "@/utils/index";
import { checkTabbarPage } from "@/utils/mayi";
import { wx_decode } from "@/utils/wxIndex.js"; import { wx_decode } from "@/utils/wxIndex.js";
import login from "@/api/login"; import login from "@/api/login";
import shop from "@/api/shop"; import shop from "@/api/shop";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
var WXBizDataCrypt = require("@/utils/WXBizDataCrypt"); var WXBizDataCrypt = require("@/utils/WXBizDataCrypt");
export default { export default {
name:'login',
components: { components: {
// card // card
}, },
...@@ -315,12 +317,25 @@ export default { ...@@ -315,12 +317,25 @@ export default {
delta: 1 delta: 1
}); });
}else{ }else{
wx.reLaunch({ let parseLink=decodeURIComponent(this.backPath);
let isTabbarIndex =checkTabbarPage(parseLink)
console.log('32111',isTabbarIndex,parseLink)
wx.navigateBack()
return
if(isTabbarIndex>-1){
wx.navigateBack()
// wx.switchTab({
// url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
// })
}else{
wx.redirectTo({
url: `../index/main?from=login&backpath=${ url: `../index/main?from=login&backpath=${
this.backPath this.backPath
}&params=${encodeURIComponent(this.backParams)}` }&params=${encodeURIComponent(this.backParams)}`
}); });
} }
}
}, },
getPhoneNumber(e) { getPhoneNumber(e) {
wx.checkSession({ wx.checkSession({
......
...@@ -3,28 +3,39 @@ ...@@ -3,28 +3,39 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
<script> <script>
import { getUrlofLink } from "../../utils/mayi.js"; import {
getUrlofLink,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default { export default {
data() { data() {
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,
index:1 index: 1,
ss: "",
}; };
}, },
computed: { computed: {
pageUrl() { pageUrl() {
return this.link + this.page + this.params; return this.link + this.page + this.params + this.ss;
}, },
}, },
onLoad(options) { onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/");
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
...@@ -32,20 +43,13 @@ export default { ...@@ -32,20 +43,13 @@ export default {
this.mpApp.globalData.tabBarPageLink = ""; this.mpApp.globalData.tabBarPageLink = "";
} }
}, },
onShow(){ onShow() {
console.log('show') let ss = wx.getStorageSync("sessionid");
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) { if (!this.ss && ss) {
this.page = getUrlofLink( this.ss = `&sessionid=${ss}`;
this.mpApp.globalData.footerVal.componentData.list[this.index].link
);
this.mpApp.globalData.tabBarPageLink = "";
} }
// if (typeof this.getTabBar === 'function' &&
// this.getTabBar()) { setTabBarActive.bind(this)(this.index);
// this.getTabBar().setData({
// selected: 0
// })
// }
}, },
methods: { methods: {
handleError(data) { handleError(data) {
......
...@@ -3,28 +3,39 @@ ...@@ -3,28 +3,39 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
<script> <script>
import { getUrlofLink } from "../../utils/mayi.js"; import {
getUrlofLink,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default { export default {
data() { data() {
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,
index:2 index: 2,
ss: "",
}; };
}, },
computed: { computed: {
pageUrl() { pageUrl() {
return this.link + this.page + this.params; return this.link + this.page + this.params + this.ss;
}, },
}, },
onLoad(options) { onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/");
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
...@@ -32,14 +43,14 @@ export default { ...@@ -32,14 +43,14 @@ export default {
this.mpApp.globalData.tabBarPageLink = ""; this.mpApp.globalData.tabBarPageLink = "";
} }
}, },
// onShow(){ onShow() {
// if (typeof this.getTabBar === 'function' && let ss = wx.getStorageSync("sessionid");
// this.getTabBar()) { if (!this.ss && ss) {
// this.getTabBar().setData({ this.ss = `&sessionid=${ss}`;
// selected: 0 }
// })
// } setTabBarActive.bind(this)(this.index);
// }, },
methods: { methods: {
handleError(data) { handleError(data) {
wx.showLoading({ wx.showLoading({
......
...@@ -3,43 +3,60 @@ ...@@ -3,43 +3,60 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
<script> <script>
import { getUrlofLink } from "../../utils/mayi.js"; import {
getUrlofLink,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default { export default {
data() { data() {
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,
index:3 index: 3,
ss: "",
}; };
}, },
computed: { computed: {
pageUrl() { pageUrl() {
return this.link + this.page + this.params; return this.link + this.page + this.params + this.ss;
}, },
}, },
onLoad(options) { onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/");
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 = "";
} }
}, },
// onShow(){ onShow() {
// if (typeof this.getTabBar === 'function' && let ss = wx.getStorageSync("sessionid");
// this.getTabBar()) { if (!this.ss && ss) {
// this.getTabBar().setData({ this.ss = `&sessionid=${ss}`;
// selected: 0 }
// })
// } setTabBarActive.bind(this)(this.index);
// }, },
methods: { methods: {
handleError(data) { handleError(data) {
wx.showLoading({ wx.showLoading({
......
...@@ -3,43 +3,60 @@ ...@@ -3,43 +3,60 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
<script> <script>
import { getUrlofLink } from "../../utils/mayi.js"; import {
getUrlofLink,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default { export default {
data() { data() {
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,
index:4 index: 4,
ss: "",
}; };
}, },
computed: { computed: {
pageUrl() { pageUrl() {
return this.link + this.page + this.params; return this.link + this.page + this.params + this.ss;
}, },
}, },
onLoad(options) { onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/");
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 = "";
} }
}, },
// onShow(){ onShow() {
// if (typeof this.getTabBar === 'function' && let ss = wx.getStorageSync("sessionid");
// this.getTabBar()) { if (!this.ss && ss) {
// this.getTabBar().setData({ this.ss = `&sessionid=${ss}`;
// selected: 0 }
// })
// } setTabBarActive.bind(this)(this.index);
// }, },
methods: { methods: {
handleError(data) { handleError(data) {
wx.showLoading({ wx.showLoading({
......
...@@ -3,13 +3,24 @@ export function getUrlofLink(data) { ...@@ -3,13 +3,24 @@ export function getUrlofLink(data) {
return data.link return data.link
} }
// 全局跳转 // 全局跳转 data:link数据 option:是否为底部栏触发
export function $themeToLink(data) { export function $themeToLink(data, option) {
let app = getApp()
let footerVal = app.globalData.footerVal.componentData.list;
console.log('393939', footerVal)
let type = data.type; let type = data.type;
// 点击底部栏
if (option) {
let parseLink = getUrlofLink(data);
let isTabbarIndex = checkTabbarPage(parseLink);
// 替换首页位置
isTabbarIndex = isTabbarIndex == 0 ? checkTabbarPage('/') : isTabbarIndex
wx.switchTab({
url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
})
console.log(option, data)
return
}
// 历史数据 // 历史数据
if (type == undefined || type == 'undefined') { if (type == undefined || type == 'undefined') {
if (data.length > 0) { if (data.length > 0) {
...@@ -17,17 +28,16 @@ export function $themeToLink(data) { ...@@ -17,17 +28,16 @@ export function $themeToLink(data) {
} }
return return
} }
// 底部导航跳转 // 底部导航跳转
let parseLink = getUrlofLink(data) // let parseLink=getUrlofLink(data)
let isFooter = footerVal.findIndex(item => { // let isTabbarIndex =checkTabbarPage(parseLink )
return item.link.link == parseLink // if (isTabbarIndex>-1) {
}) // wx.switchTab({
if (isFooter > -1) { // url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
wx.switchTab({ // })
url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isFooter}/main`, // return
}) // }
return
}
// ----------------- // -----------------
...@@ -77,10 +87,32 @@ export function $themeToLink(data) { ...@@ -77,10 +87,32 @@ export function $themeToLink(data) {
} }
} }
function toPage(backPath, backParams) { function toPage(backPath, backParams = "") {
wx.navigateTo({ wx.navigateTo({
url: `../index/main?from=home&backpath=${backPath}&params=${encodeURIComponent(backParams)}` url: `../index/main?from=home&backpath=${encodeURIComponent(backPath)}&params=${encodeURIComponent(backParams)}`
}); });
} }
// check url是否为底部栏配置项
\ No newline at end of file // check 链接是否为底部导航栏页面 返回索引
export function checkTabbarPage(link) {
let app = getApp()
if (!app.globalData.footerVal) return -1
let footerVal = app.globalData.footerVal.componentData.list;
let isFooter = footerVal.findIndex(item => {
return item.link.link == link
})
return isFooter
}
// 当前底部栏选中项
export function setTabBarActive(data) {
console.log(this, 'this', data)
if (data < 0 || !this.$mp.page) return
if (typeof this.$mp.page.getTabBar === 'function' &&
this.$mp.page.getTabBar()) {
this.$mp.page.getTabBar().setData({
selected: data
})
}
}
const app = getApp();
const { goodsApi, DFSImg, $themeToLink } = app;
const componentOptions = { const componentOptions = {
// 组件选项 // 组件选项
options: { options: {
...@@ -18,7 +20,7 @@ const componentOptions = { ...@@ -18,7 +20,7 @@ const componentOptions = {
// 组件数据 // 组件数据
data: { data: {
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
timeData: {}, timeData: {}
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -54,7 +56,49 @@ const componentOptions = { ...@@ -54,7 +56,49 @@ const componentOptions = {
}, },
onChange(e) { onChange(e) {
this.setData({ timeData: e.detail }); this.setData({ timeData: e.detail });
},
onclickProduct() {
let { goodsType } = this.data.datas.componentData;
let {
productId,
terminalProductId,
terminalGoodsMixId
} = this.data.items;
let linkVal = "";
if (goodsType == 0) {
linkVal = `/goods/${productId}?terminalProductId=${terminalProductId}`;
} else if (goodsType == 1) {
linkVal = `/pointShop/goodsDetail?productId${productId}&terminalProductId=${terminalProductId}&terminalGoodsMixId=${terminalGoodsMixId}`;
}
$themeToLink({
type: 1,
link: linkVal
});
},
onclickBuynow() {
let { btnType } = this.data.datas.componentData;
let {
minProductGoodsMixid,
minProductGoodsId,
minGoodsId
} = this.data.items;
let linkVal = "";
if (btnType < 6) {
// 加入购物车
console.log("加入购物车");
// this.$themeAddToCard(item);
} else {
// 进入确认订单
linkVal = `/order/orderConfirm?productGoodsMixId=${minProductGoodsMixid}&productGoodsId=${minProductGoodsId}&goodsId=${minGoodsId}&qty=1&goodsString=null&source=3`;
} }
console.log(linkVal, "-------90");
$themeToLink({ type: 1, link: linkVal });
},
toMerchants() {
let { orgId } = this.data.items;
$themeToLink({ type: 1, link: `/merchantsDetail/${orgId}` });
},
}, },
// 组件生命周期 // 组件生命周期
lifetimes: { lifetimes: {
......
<!-- 商品列表item --> <!-- 商品列表item -->
<view class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}" style="--proGap2:{{datas.componentData.proGap*2}}rpx;"> <view
class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}"
style="--proGap2:{{datas.componentData.proGap*2}}rpx;"
bindtap="onclickProduct"
>
<view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};"> <view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius}}em;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};">
<!-- 商户入口-顶部 --> <!-- 商户入口-顶部 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}"> <view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData['merchantsEntrance'] && datas.componentData['merchantsEntranceType'] == 0 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items != null}}"> <view class="left flex" wx:if="{{items != null}}">
<view class="logo"> <view class="logo">
<image mode='widthFix' src="{{items.shopLogoUrl}}" /> <image mode='widthFix' src="{{items.shopLogoUrl}}" />
...@@ -71,7 +79,11 @@ ...@@ -71,7 +79,11 @@
<!-- 商品详情 --> <!-- 商品详情 -->
<view class="info" style="text-align:{{datas.componentData['initcharAlign']}};"> <view class="info" style="text-align:{{datas.componentData['initcharAlign']}};">
<view class="info-top flex"> <view class="info-top flex">
<view class="name" wx:if="{{datas.componentData['nameShow']}}"> <view
class="name"
wx:if="{{datas.componentData['nameShow']}}"
style="color:{{datas.componentData['nameColor']}};font-weight:{{datas.componentData['nameFontWeight']}};font-size:{{datas.componentData['nameFontSize']}}em;height:2.8em;"
>
{{items!=null?items['productName']:'名称'}} {{items!=null?items['productName']:'名称'}}
</view> </view>
<view <view
...@@ -148,7 +160,7 @@ ...@@ -148,7 +160,7 @@
> >
已售罄 已售罄
</view> </view>
<view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}"> <view wx:if="{{(items&&items.totalQty-0>0||items&&items.oversoldFlag==1)&& datas.componentData['paynow']}}" catchtap="onclickBuynow">
<text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text> <text wx:if="{{datas.componentData.btnType<6}}" style="color:{{datas.componentData.btnColor}}" class="buy-now-icon iconfont-common {{datas.componentData.btnIcon}}"></text>
<view <view
wx:else wx:else
...@@ -187,7 +199,11 @@ ...@@ -187,7 +199,11 @@
</block> </block>
</view> </view>
<!-- 商户入口二 --> <!-- 商户入口二 -->
<view class="merchantsEntrance flex" wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}"> <view
class="merchantsEntrance flex"
bindtoMerchants="toMerchants"
wx:if="{{datas.componentData.merchantsEntrance&&datas.componentData.merchantsEntranceType==1 && datas.componentData.style!='heap'}}"
>
<view class="left flex" wx:if="{{items!=null}}"> <view class="left flex" wx:if="{{items!=null}}">
<view class="logo"> <view class="logo">
<image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" /> <image mode='widthFix' src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/ppefWK8BS6.png?x-oss-process=image/resize,limit_1,w_150,h_150" />
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
display: flex; display: flex;
} }
.goods-item-child-bd{ .goods-item-child-bd{
border: 1px solid var(--border-color); border: 1px solid var(--border_color);
} }
image{ image{
width: 100%; width: 100%;
......
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
wx:key="index" wx:key="index"
data-index="{{index}}" data-index="{{index}}"
class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}" class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}"
bindtap="next" bindtouchstart="touchCard.start"
catchtouchstart="touchCard.start" bindtouchmove="touchCard.move"
catchtouchmove="touchCard.move" bindtouchend="touchCard.end"
catchtouchend="touchCard.end" bindtouchcancel="touchCard.cancel"
catchtouchcancel="touchCard.cancel"
> >
<goods-item <goods-item
style="width:100%" style="width:100%"
......
const app = getApp(); const app = getApp();
const { goodsApi,DFSImg } = app; const { goodsApi, DFSImg, $themeToLink } = app;
const componentOptions = { const componentOptions = {
// 组件选项 // 组件选项
options: { options: {
...@@ -16,7 +16,10 @@ const componentOptions = { ...@@ -16,7 +16,10 @@ const componentOptions = {
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
titleIcon: "", titleIcon: "",
classificationLoadPage: 1, classificationLoadPage: 1,
classificationLoadNum: 10 classificationLoadNum: 10,
queryProductInfoLoading: false,
loading: false,
finished: false
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -65,7 +68,9 @@ const componentOptions = { ...@@ -65,7 +68,9 @@ const componentOptions = {
titleIcon titleIcon
} = this.data.datas.componentData; } = this.data.datas.componentData;
angleSignImg = DFSImg(angleSignImg); angleSignImg = DFSImg(angleSignImg);
if (titleIcon) {
titleIcon = DFSImg(titleIcon); titleIcon = DFSImg(titleIcon);
}
this.setData({ this.setData({
"data.datas.componentData.angleSignImg": angleSignImg, "data.datas.componentData.angleSignImg": angleSignImg,
titleIcon titleIcon
...@@ -91,39 +96,63 @@ const componentOptions = { ...@@ -91,39 +96,63 @@ const componentOptions = {
}, },
getProductList(code, type) { getProductList(code, type) {
let { goodsList, goodsSort } = this.data.datas.componentData; let { goodsList, goodsSort } = this.data.datas.componentData;
let {
classificationLoadPage,
loading,
finished,
queryProductInfoLoading
} = this.data;
if (queryProductInfoLoading == true) {
return;
}
this.setData({ queryProductInfoLoading: true });
// type 1初始化 2滚动加载 // type 1初始化 2滚动加载
//分类查 //分类查
if (code == 1) { if (code == 1) {
if (type == 1) {
classificationLoadPage = 1;
} else {
classificationLoadPage++;
loading = true;
}
this.setData({ classificationLoadPage, loading });
let query = { let query = {
categoryId: this.data.datas.componentData.categoryId, categoryId: this.data.datas.componentData.categoryId,
page: this.showRowNum() page: this.showRowNum() ? classificationLoadPage : 1,
? 1
: this.data.datas.componentData.classificationLoadPage, // 当前页
rows: this.showRowNum() rows: this.showRowNum()
? this.getItemNum() ? this.data.classificationLoadNum
: this.classificationLoadNum, // 一页多少条 : this.getItemNum(),
sortColumn: this.data.datas.componentData.goodsSort, sortColumn: goodsSort,
sortType: this.data.datas.componentData.goodsSort != 2 ? 1 : 0, sortType: goodsSort != 2 ? 1 : 0,
whetherShowSoldOutGoods: this.data.datas.componentData whetherShowSoldOutGoods: this.data.datas.componentData
.whetherShowSoldOutGoods, //查询销售数量 .whetherShowSoldOutGoods,
whetherQueryCollectCount: true, //查询收藏数 whetherQueryCollectCount: true,
whetherUseVirtualSalesQty: true, //是否使用虚拟销售数量 whetherUseVirtualSalesQty: true,
whetherUseVirtualCollectCount: true, //是否使用虚拟收藏人数 whetherUseVirtualCollectCount: true,
whetherFindDistributionCommission: this whetherFindDistributionCommission: this
.whetherFindDistributionCommission, //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) .whetherFindDistributionCommission,
whetherFindRecommendedCardFlag: this.data.datas.componentData.vipPrice whetherFindRecommendedCardFlag: this.data.datas.componentData.vipPrice
? 1 ? 1
: 0, //是否查询会员价 1是 0否 : 0,
whetherShowGoodsDefaultTagFlag: this.data.datas.componentData whetherShowGoodsDefaultTagFlag: this.data.datas.componentData
.marketingTag .marketingTag
? 1 ? 1
: 0, //是否展示营销标签 1是 0否 : 0,
whetherFindMultiShopFlag: 1 //是否查询多商户 //商城使用 whetherFindMultiShopFlag: 1
}; }; // 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用
goodsApi.queryProductInfo(query).then(res => { goodsApi.queryProductInfo(query).then(res => {
this.setData({ loading: false, queryProductInfoLoading: false });
if (res.data.code == 200) { if (res.data.code == 200) {
let goodsList = res.data.data.list; let goodsLists = res.data.data.list;
this.goodsListVal(goodsList); if (type == 1) {
goodsList = goodsLists;
} else {
goodsList = [...goodsList, ...goodsLists];
}
if (goodsLists && goodsLists.length < 10) {
this.setData({ finished: true });
}
this.goodsListVal(goodsList, type);
} }
}); });
} else { } else {
...@@ -177,13 +206,13 @@ const componentOptions = { ...@@ -177,13 +206,13 @@ const componentOptions = {
goodsApi.queryMoreProductInfo(moreQuery).then(res => { goodsApi.queryMoreProductInfo(moreQuery).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
goodsList = res.data.data; goodsList = res.data.data;
this.goodsListVal(goodsList); this.goodsListVal(goodsList, 1);
} }
}); });
}, },
goodsListVal(goodsList) { goodsListVal(goodsList, type) {
console.log(goodsList,"------------goodsListVal") console.log(goodsList, "------------goodsListVal");
goodsList.forEach((item,index) => { goodsList.forEach((item, index) => {
item.marketingTag = item.defaultTags item.marketingTag = item.defaultTags
? this.filtermark( ? this.filtermark(
item.defaultTags, item.defaultTags,
...@@ -191,21 +220,21 @@ const componentOptions = { ...@@ -191,21 +220,21 @@ const componentOptions = {
) )
: []; : [];
item.shopLogoUrl = DFSImg(item.shopLogoUrl); item.shopLogoUrl = DFSImg(item.shopLogoUrl);
item.coverImage = DFSImg(item.coverImage); item.coverImage = DFSImg(item.coverImage, 100, 100, 0);
item.productImgUrl = DFSImg(item.productImgUrl); item.productImgUrl = DFSImg(item.productImgUrl, 100, 100, 0);
item.minPrice = Number(item.minPrice).toFixed(2); item.minPrice = Number(item.minPrice).toFixed(2);
item.qty = Number(item.qty); item.qty = Number(item.qty);
item.saleQty = Number(item.saleQty); item.saleQty = Number(item.saleQty);
item.totalCollectionCount = Number(item.totalCollectionCount) || 0; item.totalCollectionCount = Number(item.totalCollectionCount) || 0;
item.minPriceAfterRecommendedCardPriceTable = item.minPriceAfterRecommendedCardPriceTable? item.minPriceAfterRecommendedCardPriceTable = item.minPriceAfterRecommendedCardPriceTable
Number(item.minPriceAfterRecommendedCardPriceTable):""; ? Number(item.minPriceAfterRecommendedCardPriceTable)
item.minProductGoodsCommission = item.minProductGoodsCommission? : "";
Number(item.minProductGoodsCommission).toFixed(2) : 0; item.minProductGoodsCommission = item.minProductGoodsCommission
item.minGoodsSuggestedRetailPrice = item ? Number(item.minProductGoodsCommission).toFixed(2)
.minGoodsSuggestedRetailPrice?Number( : 0;
item.minGoodsSuggestedRetailPrice item.minGoodsSuggestedRetailPrice = item.minGoodsSuggestedRetailPrice
) ? Number(item.minGoodsSuggestedRetailPrice).toFixed(2)
.toFixed(2) : ""; : "";
item.showVipPrice = this.showVipPrice(item, index); item.showVipPrice = this.showVipPrice(item, index);
item.showVipTag = this.showVipTag(item, index); item.showVipTag = this.showVipTag(item, index);
if (item.saleTime) { if (item.saleTime) {
...@@ -217,9 +246,17 @@ const componentOptions = { ...@@ -217,9 +246,17 @@ const componentOptions = {
this.setData({ this.setData({
"datas.componentData.goodsList": goodsList "datas.componentData.goodsList": goodsList
}); });
if (type == 1) {
// 初始化
if (this.selectComponent("#waterfallFlow")) { if (this.selectComponent("#waterfallFlow")) {
this.selectComponent("#waterfallFlow").initList(); this.selectComponent("#waterfallFlow").initList();
} }
} else {
// 滚动加载
if (this.selectComponent("#waterfallFlow")) {
this.selectComponent("#waterfallFlow").reLoadPro();
}
}
}, 0); }, 0);
}, },
getSaleTime(val) { getSaleTime(val) {
...@@ -249,9 +286,9 @@ const componentOptions = { ...@@ -249,9 +286,9 @@ const componentOptions = {
} }
}, },
showRowNum() { showRowNum() {
return !( return (
this.data.datas.componentData.moreShow == false && this.data.datas.componentData.moreShow == false &&
this.data.datas.componentData.getStyle == "waterfall" && this.data.datas.componentData.style == "waterfall" &&
this.data.datas.componentData.goodsSource == "classify" this.data.datas.componentData.goodsSource == "classify"
); );
}, },
...@@ -278,21 +315,50 @@ const componentOptions = { ...@@ -278,21 +315,50 @@ const componentOptions = {
} }
return showFlag; return showFlag;
}, },
showVipTag(item,index) { showVipTag(item, index) {
// 索引 0 显示价格 1显示名称 // 索引 0 显示价格 1显示名称
let showFlag = false; let showFlag = false;
let vipPrice = item["minPriceAfterRecommendedCardPriceTable"]; let vipPrice = item["minPriceAfterRecommendedCardPriceTable"];
let showTag = item["recommendedCardMinPricePriceTableName"]; let showTag = item["recommendedCardMinPricePriceTableName"];
if ( if (vipPrice && showTag && Number(vipPrice) <= Number(item["minPrice"])) {
vipPrice &&
showTag &&
Number(vipPrice) <= Number(item["minPrice"])
) {
showFlag = true; showFlag = true;
} }
return showFlag; return showFlag;
},
getScroll(el) {
// 是指定分类且不显示查看更多的瀑布流组件滚动加载
let { goodsSource, moreShow, style } = this.data.datas.componentData;
if (
goodsSource == "classify" &&
moreShow == false &&
style == "waterfall"
) {
this.selectComponent("#waterfallFlow").getScroll(el);
} }
}, },
// 分页加载
onLoad() {
console.log("---触发分页加载");
this.getProductList(1, 2);
},
viewMore() {
let { goodsType,style, categoryName, categoryId } = this.data.datas.componentData;
let linkVal = "";
if (goodsType != 1) {
if (style == "list") {
linkVal = `/goods/commodityMenu?categoryName=${categoryName}&categoryId=${categoryId}`;
} else {
linkVal = `/goods/commodityMenu`;
}
} else {
linkVal = `/pointShop/productList?categoryName=${categoryName}&categoryId=${categoryId}`;
}
$themeToLink({
type: 1,
link:linkVal,
});
}
}
}; };
Component(componentOptions); Component(componentOptions);
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
</view> </view>
<view class="title">{{datas.componentData['titles']}}</view> <view class="title">{{datas.componentData['titles']}}</view>
</view> </view>
<view class="moreTop" wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}"> <view
class="moreTop"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='top' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多 查看更多
<text class="jt"></text> <text class="jt"></text>
</view> </view>
...@@ -63,6 +67,9 @@ ...@@ -63,6 +67,9 @@
datas="{{datas}}" datas="{{datas}}"
padding="{{datas.componentData.proGap}}" padding="{{datas.componentData.proGap}}"
wx:if="{{datas.componentData.goodsList}}" wx:if="{{datas.componentData.goodsList}}"
bindonLoad="onLoad"
loading="{{loading}}"
finished="{{finished}}"
></waterfall-flow> ></waterfall-flow>
</view> </view>
<!-- 横向列表 --> <!-- 横向列表 -->
...@@ -88,7 +95,14 @@ ...@@ -88,7 +95,14 @@
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}"> <view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<heap-item datas="{{datas}}"></heap-item> <heap-item datas="{{datas}}"></heap-item>
</view> </view>
<view
class="moreBottom"
bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='bottom' && datas.componentData['goodsSource']!='assign'}}"
>
查看更多
<text class="jt"></text>
</view>
</view> </view>
</view> </view>
...@@ -40,7 +40,7 @@ image{ ...@@ -40,7 +40,7 @@ image{
font-size: 13px; font-size: 13px;
color: #6b6b6b; color: #6b6b6b;
} }
.moreTop .jt { .moreTop .jt,.moreBottom .jt{
display: inline-block; display: inline-block;
border-top: 1px solid; border-top: 1px solid;
border-right: 1px solid; border-right: 1px solid;
...@@ -50,6 +50,12 @@ image{ ...@@ -50,6 +50,12 @@ image{
transform: rotate(405deg); transform: rotate(405deg);
margin-left: 0px; margin-left: 0px;
} }
.moreBottom {
font-size: 13px;
text-align: center;
padding-top: 0.54em;
color: #6b6b6b;
}
.goodsItem-list{ .goodsItem-list{
flex-wrap: wrap; flex-wrap: wrap;
} }
......
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="{{!hideItem||!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:true });
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() {},
attached() {
this.getData();
},
ready() {},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
this.getData();
// 重新执行定时器等操作
},
// 页面被隐藏
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>
<!-- 活动列表 -->
<block wx:if="{{datas.componentData.dimension == 1 && isLoading}}">
<activity-list-item
wx:for="{{datas.componentData.actList}}"
wx:key="index"
datas="{{item}}"
num="{{index}}"
countDownShow="{{datas.componentData['countDownShow']}}"
></activity-list-item>
</block>
</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 */
}
...@@ -13,8 +13,17 @@ Component({ ...@@ -13,8 +13,17 @@ Component({
}, },
padding: { padding: {
type: Number type: Number
},
loading: {
type: Boolean
},
finished: {
type: Boolean
} }
}, },
onPageScroll(e) {
console.log(e);
},
lifetimes: { lifetimes: {
created() { created() {
console.log("进入组件created"); console.log("进入组件created");
...@@ -26,7 +35,14 @@ Component({ ...@@ -26,7 +35,14 @@ Component({
}, },
ready() { ready() {
console.log("进入组件ready"); console.log("进入组件ready");
// this.reLoadPro(); let _this = this;
let { clientHeight } = this.data;
wx.getSystemInfo({
success: function(res) {
let clientHeight = parseInt(res.windowHeight);
_this.setData({ clientHeight });
}
});
} }
}, },
observers: {}, observers: {},
...@@ -36,50 +52,71 @@ Component({ ...@@ -36,50 +52,71 @@ Component({
//列高度数组 //列高度数组
waterfallDeviationHeight: [0, 0], waterfallDeviationHeight: [0, 0],
contentList: [], contentList: [],
inj: 0 inj: 0,
clientHeight: 0, //窗口高度
goodsNum:0,
}, },
methods: { methods: {
// 初始化数组 // 初始化数组
initList() { initList() {
// 初始化容器 // 初始化容器
let contentList = this.data.contentList; let { contentList, waterfallDeviationHeight } = this.data;
contentList[0] = []; contentList[0] = [];
contentList[1] = []; contentList[1] = [];
this.setData({ contentList }); waterfallDeviationHeight = [0,0];
this.setData({ contentList, waterfallDeviationHeight });
console.log(this.data.note, "-------------------185"); console.log(this.data.note, "-------------------185");
this.reLoadPro(); this.reLoadPro();
}, },
async reLoadPro() { async reLoadPro() {
let _this = this; this.setHeight(this.data.goodsNum);
// this.setHeight(0); this.setData({ goodsNum:this.data.note.length>0?this.data.note.length+1:0 });
}, },
setHeight(i) { setHeight(i) {
let _this = this; let _this = this;
let item = this.data.note[i]; let item = this.data.note[i];
console.log(i, "---------------i"); // console.log(i, "---------------i");
console.log( // console.log(
this.data.waterfallDeviationHeight, // this.data.waterfallDeviationHeight,
"-------waterfallDeviationHeight" // "-------waterfallDeviationHeight"
); // );
let minIndex = this.filterMin(); let minIndex = this.filterMin();
console.log(minIndex, "---------------126"); // console.log(minIndex, "---------------126");
let contentList = this.data.contentList; let contentList = this.data.contentList;
contentList[minIndex].push(item); contentList[minIndex].push(item);
this.setData({ contentList }); this.setData({ contentList });
const queryDom = wx.createSelectorQuery().in(this); _this
queryDom.select(`.item${minIndex}`).boundingClientRect(); .createSelectorQuery()
queryDom.exec(res => { .select(`.item${minIndex}`)
res[0].height; .boundingClientRect(function(res) {
console.log(res[0], "--------------res"); if (res) {
res.height;
console.log(res, "--------------res");
let waterfallDeviationHeight = _this.data.waterfallDeviationHeight; let waterfallDeviationHeight = _this.data.waterfallDeviationHeight;
waterfallDeviationHeight[minIndex] = res[0].height; waterfallDeviationHeight[minIndex] = res.height;
_this.setData({ waterfallDeviationHeight }); _this.setData({ waterfallDeviationHeight });
if (i >= _this.data.note.length - 1) { if (i >= _this.data.note.length - 1) {
return; return;
} }
i++; i++;
_this.setHeight(i); _this.setHeight(i);
}); }
})
.exec();
// const queryDom = wx.createSelectorQuery().in(this);
// queryDom.select(`.item${minIndex}`).boundingClientRect();
// queryDom.exec(res => {
// res[0].height;
// console.log(res[0], "--------------res");
// let waterfallDeviationHeight = _this.data.waterfallDeviationHeight;
// waterfallDeviationHeight[minIndex] = res[0].height;
// _this.setData({ waterfallDeviationHeight });
// if (i >= _this.data.note.length - 1) {
// return;
// }
// i++;
// _this.setHeight(i);
// });
}, },
filterMin() { filterMin() {
let val = Math.min.apply(null, this.data.waterfallDeviationHeight); let val = Math.min.apply(null, this.data.waterfallDeviationHeight);
...@@ -101,6 +138,26 @@ Component({ ...@@ -101,6 +138,26 @@ Component({
ev.target.dataset.id, ev.target.dataset.id,
"-----------------------219" "-----------------------219"
); );
},
getScroll(el) {
let { finished } = this.properties;
let _this = this;
_this
.createSelectorQuery()
.select("#waterfallFlow")
.boundingClientRect(function(res) {
if (res) {
console.log(el, "-------------118");
console.log(res, "---------------35");
let scrollTop = parseInt(el.target.scrollTop);
let domHeight = parseInt(res.height);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if (scrollTop + _this.data.clientHeight >= domHeight - 150 && finished == false) {
_this.triggerEvent("onLoad");
}
}
})
.exec();
} }
} }
}); });
<!--瀑布流组件--> <!--瀑布流组件-->
<view class="waterfallFlow" style="--proGap:{{padding}}rpx"> <view
class="waterfallFlow"
id="waterfallFlow"
style="--proGap:{{padding}}rpx"
>
<view class="container flex"> <view class="container flex">
<view <view
wx:for="{{contentList}}" wx:for="{{contentList}}"
...@@ -21,5 +25,10 @@ ...@@ -21,5 +25,10 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 上拉加载底部展示 -->
<view class="loadBottom" wx:if="{{datas.componentData.goodsSource == 'classify' && datas.componentData.moreShow == false &&datas.componentData.style == 'waterfall'}}">
<text wx:if="{{loading}}">加载中~</text>
<text wx:if="{{ finished}}">暂无更多</text>
</view>
</view> </view>
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