Commit 6d05f25b by zhangxw

首页

1 parent d9404859
Showing 73 changed files with 2414 additions and 2336 deletions
......@@ -55,7 +55,9 @@
"pages/bankAccount/list/list",
"pages/integral/withdrawalNote/withdrawalNote",
"pages/integral/toCash/toCash",
"pages/integral/withdrawalSuccess/withdrawalSuccess"
"pages/integral/withdrawalSuccess/withdrawalSuccess",
"pages/SpecialSale/SpecialSale",
"pages/goodsDetail/index"
]
},
{
......
......@@ -5,15 +5,9 @@
<block wx:else>
<view class="goods-action">
<view class="navigation-box">
<view class="item" bindtap="jump" data-url="home">
<view class="sprite-icon">
<glsx-image src="mall/goods-home.png"></glsx-image>
</view>
首页
</view>
<view class="item" wx:if="{{!hideShop}}" bindtap="jump">
<view class="sprite-icon" >
<glsx-image src="mall/goods-shopping.png"></glsx-image>
<glsx-image src="/index/goods-cart.png"></glsx-image>
</view>
购物车
</view>
......@@ -23,7 +17,7 @@
加入购物车
</view>
<view class="btn pay text-center {{payDisabled && hideShop?'disabled':''}} {{stock?'disabled':''}} {{buyFlag?'disabled':''}}" bindtap="click" data-event="pay">
立即购买
立即兑换
</view>
</view>
</view>
......
......@@ -23,7 +23,7 @@
}
}
.goods-action {
padding: 10rpx var(--margin);
padding: 12rpx 24rpx;
display: flex;
align-items: center;
box-sizing: border-box;
......@@ -57,23 +57,24 @@
display: flex;
align-items: center;
margin-left: auto;
border-radius: var(--borderRadius);
border-radius: 20rpx;
overflow: hidden;
}
.btn-box .btn {
width: 258rpx;
height: 80rpx;
width: 304rpx;
height: 84rpx;
color: #fff;
font-size: 28rpx;
}
.btn-box .pay {
background-color: var(--btnColor);
background-color: #FB8A32;
}
.btn-box .join {
background-color: #FDC23E;
color: #FB8A32;
background-color: #FEF2EA;
}
.btn-box.true .join{
display: none;
......
......@@ -9,40 +9,7 @@ Component({
properties: {
list: {
type: Array,
value: [],
observer(val, o) {
if (val) {
val.forEach(v => {
v.IMGURL = this.data.IMGURL
let n = v.goods
if (n) {
if (n.activityInfo) {
n.originalPrice = ''
n.retailPrice = n.activityInfo.activityPrice
n.goodsStatistics.saleAmount = n.activityInfo.saleAmount
if (n.activityInfo.specificationExtraList && n.activityInfo.specificationExtraList.length) {
n.retailPrice = n.activityInfo.specificationExtraList[0].retailPrice
v.up = true
}
} else {
if (n.originalPrice) n.originalPrice = centsToyuan(n.originalPrice)
if (n.specificationDetailList && n.specificationDetailList.length) {
n.retailPrice = n.specificationDetailList[0].retailPrice
v.up = true
}
}
n.retailPrice = Number(centsToyuan(n.retailPrice)).toFixed(2)
if (n.retailPrice > 9999) {
n.retailPrice = Number(n.retailPrice / 10000).toFixed(2)
v.unit = '万'
}
}
})
this.setData({
list: val
})
}
}
value: []
}
},
......@@ -68,27 +35,15 @@ Component({
this
)
},
jump(e) {
let {
item
} = e.currentTarget.dataset
let {
id,
activityInfo
} = item.classifyName && item.classifyName == '秒杀' ? item : item.goods
let isActivity = false
if (activityInfo) {
id = activityInfo.id
isActivity = true
}
if (item.classifyName && item.classifyName == '秒杀') {
isActivity = true
}
wx.p.router.go('/packageMall/pages/detail/detail', {
id,
isActivity,
notIntercept: true
})
// 进入商品详情
handleSale(e) {
let { target } = e.currentTarget.dataset
wx.p.router.go('/packageIndex/pages/goodsDetail/index', target)
},
// 加入购物车
joinCart(e) {
let { target } = e.currentTarget.dataset
console.log('33333')
}
},
lifetimes: {
......
......@@ -17,45 +17,28 @@
</block>
</view>
<template name="item">
<view class='item-box' wx:if="{{item.goods}}" bindtap='jump' data-item="{{item}}">
<view class='item-box' wx:if="{{item.goodsId}}" bindtap='handleSale' data-target="{{item}}">
<view class="preview">
<image webp src="{{item.goods.goodsImage}}" lazy-load></image>
<image webp src="{{item.goodsUrl}}" lazy-load></image>
</view>
<view class="item-box-content">
<view class='item-box-title'>
<image class="item-box-title-image" wx:if="{{item.goods.isMemberGoods}}" webp src="{{item.IMGURL}}index/member-goods-icon.png" />
<text class="item-box-title-text">{{item.goods.goodsName}}</text>
</view>
<view class='item-box-time'>
<view class="text text-hide">
{{item.goodsStatistics.viewAmount||0}}人查看|售出{{item.goodsStatistics.saleAmount || 0}}
</view>
<text class="item-box-title-text">{{item.goodsName}}</text>
</view>
<view class="item-box-price">
<view class="now">
<text class="unit">¥</text>
<text>{{fn.priceFilter(item.goods.retailPrice || 0, 0)}}.</text>
<text class="price-last">{{fn.priceFilter(item.goods.retailPrice || 0, 1)}}</text>
<text class="unit up" wx:if="{{item.unit}}">{{item.unit}}</text>
<text class="unit up" wx:if="{{item.up}}">起</text>
</view>
<block wx:if="{{item.goods.originalPrice >= 0 && item.goods.originalPrice}}">
<view class="old">¥{{item.goods.originalPrice || 0}}</view>
</block>
</view>
<view class="item-box-bubble">
<!-- 会员商品 -->
<view wx:if="{{item.goods.isMemberGoods}}" class="text item-box-bubble-view">
<text class="item-box-bubble-text">会员价</text>
开通会员权益立享
<view class="points-price">
{{item.salePoints}}
<text>积分</text>
</view>
</view>
<view class="item-box-goods-label">
<view wx:if="{{item.goods.relatedCoupon}}" class="coupon-logotype">
<text wx:if="{{item.goods.relatedCoupon}}" class="coupon-logo">券</text>
<text class="coupon-name">{{item.goods.relatedCoupon.couponName}}</text>
<view class="item-box-btn">
<view class="market-price">市场价: <text>¥{{item.marketPrice}}</text></view>
<view class="btn" catchtap="handleSale" data-target="{{item}}">
<view class="cart" catchtap="joinCart" data-target="{{item}}">
<glsx-image src="/index/cart.png"></glsx-image>
</view>
<view>兑换</view>
</view>
<view wx:if="{{item.goods.freeShipping}}" class="free-shipping">包邮</view>
</view>
</view>
</view>
......
......@@ -10,6 +10,8 @@
flex-wrap: wrap;
padding: 16rpx 20rpx 0;
box-sizing: border-box;
border-radius: 24rpx 24rpx 0 0;
}
.Goods .left, .Goods .right {
display: inline-block;
......@@ -24,7 +26,6 @@
.left .item-box, .right .item-box{
margin-bottom: 20rpx;
background: #FFFFFF;
border-radius: 8px;
overflow: hidden;
}
......@@ -40,6 +41,8 @@
.item-box .preview{
width: 100%;
height: 344rpx;
border-radius: 24rpx;
overflow: hidden;
}
.item-box-content{
......@@ -83,103 +86,44 @@
align-items: center;
}
.item-box-price{
margin-top: 12rpx;
display: flex;
align-items: center;
margin-top: 14rpx;
font-size: 20rpx;
}
.item-box-price .now{
font-size: 40rpx;
color: var(--btnColor);
font-weight: 600;
}
.item-box-price .now .unit{
font-size: 24rpx;
color: #FC5B32;
font-size: 38rpx;
font-weight: 500;
}
.item-box-price .now .price-last{
font-size: 24rpx;
.item-box-price text{
font-weight: 400;
font-size: 22rpx;
}
.item-box-price .old{
color: #3F444D;
text-decoration: line-through;
margin-left: 8rpx;
margin-bottom: -10rpx;
.item-box-btn {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
}
.item-box-bubble .item-box-bubble-view{
position: relative;
background: #FFF5F3;
height: 40rpx;
line-height: 40rpx;
padding-left: 12rpx;
border-radius: 0 8rpx 8rpx 8rpx;
margin-top: 14rpx;
.item-box-btn .market-price {
font-size: 20rpx;
color: #FF6038;
}
.item-box-bubble .item-box-bubble-view::after {
content: '';
position: absolute;
width: 0;
height: 0;
top: -16rpx;
right: -16rpx;
left: 0;
border-right: 16rpx solid transparent;
border-bottom: 16rpx solid #FFF5F3;
color: #858A94;
}
.item-box-bubble .item-box-bubble-text{
margin-right: 16rpx;
.item-box-btn .market-price text {
text-decoration: line-through;
}
.item-box-goods-label{
.item-box-btn .btn {
box-sizing: border-box;
display: flex;
align-items: center;
margin-top: 8rpx;
position: relative;
}
.coupon-logotype, .free-shipping{
font-size: 16rpx;
height: 22rpx;
border: 2rpx solid #FF6038;
border-radius: 4rpx;
color: #FF590E;
}
.coupon-logotype{
position: relative;
}
.coupon-logotype .coupon-logo{
color: #fff;
width: 26rpx;
height: 26rpx;
position: absolute;
left: -2rpx;
top: -2rpx;
margin: 0;
display: inline-block;
text-align: center;
border-radius: 4rpx;
font-size: 16rpx;
line-height: 24rpx;
background: #FF6038;
}
.coupon-logotype .coupon-name{
margin-left: 30rpx;
padding-right: 4rpx;
justify-content: space-between;
padding-right: 16rpx;
color: #FFFFFF;
font-weight: 500;
font-size: 24rpx;
width: 132rpx;
height: 48rpx;
background: #FB8A32;
border-radius: 14rpx;
}
.free-shipping{
margin-left: 8rpx;
padding: 0 8rpx;
.item-box-btn .btn .cart {
width: 48rpx;
height: 48rpx;
}
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*!
* mp-html v2.2.2
* https://github.com/jin-yufeng/mp-html
*
* Released under the MIT license
* Author: Jin Yufeng
*/
var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:Boolean,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){clearInterval(this._timer),this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var o=this;return new Promise(function(i,r){if(!o.data.useAnchor)return void r(Error("Anchor is disabled"));var a=wx.createSelectorQuery().in(o._in?o._in.page:o).select((o._in?o._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();o._in?a.select(o._in.selector).scrollOffset().select(o._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(o.data.useAnchor)||0);o._in?o._in.page.setData(e({},o._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),i()})})},getText:function(e){var t="";return function e(n){for(var o=0;o<n.length;o++){var i=n[o];if("text"===i.type)t+=i.text.replace(/&amp;/g,"&");else if("br"===i.name)t+="\n";else{var r="p"===i.name||"div"===i.name||"tr"===i.name||"li"===i.name||"h"===i.name[0]&&i.name[1]>"0"&&i.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),i.children&&e(i.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==i.name&&"th"!==i.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setContent:function(e,n){var o=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var i={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,l=r.length;l--;)i["nodes[".concat(a+l,"]")]=r[l];else i.nodes=r;this.setData(i,function(){o._hook("onLoad"),o.triggerEvent("load")});var s;clearInterval(this._timer),this._timer=setInterval(function(){o.getRect().then(function(e){e.height===s&&(o.triggerEvent("ready",e),clearInterval(o._timer)),s=e.height}).catch(function(){})},350)},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});
\ No newline at end of file
{"component":true,"usingComponents":{"node":"./node/node"}}
\ No newline at end of file
<view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot wx:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg]}}" catchadd="_add"/></view>
\ No newline at end of file
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}
\ No newline at end of file
"use strict";function t(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}Component({data:{ctrl:{}},properties:{childs:Array,opts:Array},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){for(var i=t.split("_"),e=this.data.childs[i[0]],r=1;r<i.length;r++)e=e.children[i[r]];return e},play:function(t){if(this.root.data.pauseVideo){for(var i=!1,e=t.target.id,r=this.root._videos.length;r--;)this.root._videos[r].id===e?i=!0:this.root._videos[r].pause();if(!i){var s=wx.createVideoContext(e,this);s.id=e,this.root._videos.push(s)}}},imgTap:function(t){var i=this.getNode(t.target.dataset.i);if(i.a)return this.linkTap(i.a);if(!i.attrs.ignore&&(this.root.triggerEvent("imgtap",i.attrs),this.root.data.previewImg)){var e=this.root.imgList[i.i];wx.previewImage({current:e,urls:this.root.imgList})}},imgLoad:function(i){var e,r=i.target.dataset.i,s=this.getNode(r);s.w?(this.data.opts[1]&&!this.data.ctrl[r]||-1===this.data.ctrl[r])&&(e=1):e=i.detail.width,e&&this.setData(t({},"ctrl."+r,e))},linkTap:function(t){var i=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},e=i.attrs||t,r=e.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(i.children||[])},e)),r&&("#"===r[0]?this.root.navigateTo(r.substring(1)).catch(function(){}):r.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:r,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:r,fail:function(){wx.switchTab({url:r,fail:function(){}})}}))},mediaError:function(i){var e=i.target.dataset.i,r=this.getNode(e);if("video"===r.name||"audio"===r.name){var s=(this.data.ctrl[e]||0)+1;if(s>r.src.length&&(s=0),s<r.src.length)return this.setData(t({},"ctrl."+e,s))}else"img"===r.name&&this.data.opts[2]&&this.setData(t({},"ctrl."+e,-1));this.root&&this.root.triggerEvent("error",{source:r.name,attrs:r.attrs,errMsg:i.detail.errMsg})}}});
\ No newline at end of file
{"component":true,"usingComponents":{"node":"./node"}}
\ No newline at end of file
<wxs module="use">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n){return!n.c&&(!n.children||"a"===n.name||!e[n.name]&&-1===(n.attrs.style||"").indexOf("inline"))};</wxs><template name="el"><block wx:if="{{n.name==='img'}}"><image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{n.h?'':'widthFix'}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="{{opts[4] ? 'imgTap' : ''}}" bindlongpress="noop"/></block><text wx:elif="{{n.text}}" user-select="{{n.us}}" decode>{{n.text}}</text><text wx:elif="{{n.name==='br'}}">\n</text><view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" nodes="{{[n]}}"/></template><block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"><template wx:if="{{use(n1)}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"><template wx:if="{{use(n2)}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"><template wx:if="{{use(n3)}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"><template wx:if="{{use(n4)}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"><template wx:if="{{use(n5)}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block>
\ No newline at end of file
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block}
\ No newline at end of file
// packageIndex/pages/SpecialSale/SpecialSale.js
Page({
/**
* 页面的初始数据
*/
data: {
pageParams: {},
goodsList: [{
goodsId: '1',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: 'Tempo得宝手帕纸',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '2',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸',
salePoints: '69.9',
marketPrice: '79.9'
}, {
goodsId: '3',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '5100西藏冰川矿泉水整箱',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '4',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '洁柔Face纸巾抽纸3层',
salePoints: '10',
marketPrice: '15.9'
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
console.log(params)
this.setData({
pageParams: params
})
}).catch(err => {
console.error('参数获取失败:', err)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {
"goods": "/components/goods/goods"
},
"component": true
"navigationStyle": "custom"
}
\ No newline at end of file
/* packageIndex/pages/SpecialSale/SpecialSale.wxss */
.page-title {
text-align: center;
color: #2D2D2E;
font-size: 34rpx;
font-weight: 600;
}
.container {
overflow: auto;
.special-image {
width: 100%;
height: 360rpx;
}
.goods-content {
width: 100%;
box-sizing: border-box;
margin-top: -66rpx;
background-image: linear-gradient(180deg, #ffffffb3 0%, #FFFFFF 9%);
border-radius: 24rpx 24rpx 0 0;
padding: 20rpx 0;
border: 2rpx solid #FFFFFF;
border-bottom: 0;
backdrop-filter: blur(20rpx);
}
}
\ No newline at end of file
<!--packageIndex/pages/SpecialSale/SpecialSale.wxml-->
<navigation-bar page-title="专场" navStyle="{{navStyle}}" showBack="{{true}}">
<view class="page-title">{{pageParams.saleName}}</view>
</navigation-bar>
<block wx:if="{{navHeight}}">
<view class="container" style="height: calc(100vh - {{navHeight}}px);margin-top: {{navHeight}}px;">
<view class="special-image">
<glsx-image src="{{pageParams.url}}"></glsx-image>
</view>
<view class="goods-content">
<view class="goods-content-top"></view>
<view class="goods-box">
<goods list="{{goodsList}}"></goods>
</view>
</view>
</view>
</block>
\ No newline at end of file
import { shopmallApi } from '~/api/api'
Component({
/**
* 组件的属性列表
*/
properties: {
idIndex: Number,
address:Array,
show: {
type: Boolean,
observer: function (val, o) {
if (val && this.properties.address.length) {
this.properties.address.forEach((item, index) => {
if (item.id == this.properties.idIndex) {
this.setData({
currentIndex: index,
})
}
})
}
}
},
staff:Boolean
},
/**
* 组件的初始数据
*/
data: {
currentIndex: 0,
addressList: []
},
/**
* 组件的方法列表
*/
methods: {
back() {
// this.triggerEvent('getAddress', { addressInfo: this.data.addressInfo })
this.cancel()
},
comfirm(e) {
let { url } = e.currentTarget.dataset
wx.$router.go(url,{
platform:true,
staff:this.data.staff,
notIntercept:this.data.staff
})
// this.cancel()
},
cancel() {
this.setData({
show: false
})
},
toSelect(e) {
const { item } = e.currentTarget.dataset
const contactAddress = item.provinceName+item.cityName+item.countyName+item.address
this.triggerEvent('getAddress', {defaultAddress:item,contactAddress})
this.cancel()
},
addressList() {
let para = {}
console.log(this.data.staff,'this.data.staff');
if(this.data.staff){
para.businessType = 1
}
shopmallApi.platformAddressList(para).then(data => {
this.setData({
address: data
})
wx.hideLoading()
})
}
},
lifetimes: {
attached: function () {
wx.$eventbus.on('REFRESH_PLATFORM_ADDRESS',()=>{
this.addressList()
})
},
},
})
.popclass {
border-radius: 16rpx 16rpx 0 0;
}
.container {
height: 100%;
}
.address-container {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.address-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.container {
position: absolute;
width: 100%;
height: 80%;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
left: 0;
bottom: 0;
animation: show-sku-box .5s forwards;
z-index: 2;
padding: 44rpx 40rpx;
}
}
.headeer {
height: 104rpx;
background: #F7F7F7;
border-radius: 16rpx 16rpx 0 0;
box-sizing: border-box;
padding: 0 40rpx;
.icon {
width: 40rpx;
height: 40rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #282829;
}
}
.list-pannel {
height: 868rpx;
.scroll {
height: 868rpx;
}
.cell {
display: flex;
align-items: center;
box-sizing: border-box;
padding: 32rpx 40rpx;
position: relative;
.check-box {
margin-right: 20rpx;
.icon {
width: 40rpx;
height: 40rpx;
}
}
.content-box {
.name-phone {
font-weight: 400;
font-size: 24rpx;
color: #707071;
}
.address {
width: 606rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #333435;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 44rpx;
margin: 4rpx 0 10rpx 0;
}
.default-tip {
width: 104rpx;
height: 32rpx;
background: #f13c3d0f;
border: 1.2rpx solid #F13C3D;
border-radius: 4rpx;
font-weight: 400;
font-size: 20rpx;
color: #F13C3D;
}
}
.line {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 670rpx;
height: 2rpx;
background: #EFF0F2;
}
}
}
.footer {
height: 104rpx;
background: #FFFFFF;
box-shadow: 0 0 0 0 #E9E9E9;
box-sizing: border-box;
padding: 0 32rpx;
.btn {
width: 100%;
height: 80rpx;
background: #ffffff0f;
border: 2rpx solid #FC5B32;
border-radius: 8rpx;
font-weight: 500;
font-size: 28rpx;
color: #EE7A31;
}
}
.flex_sbc {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file
<!-- <van-popup show="{{ show }}" bind:click-overlay="cancel" custom-class="popclass" position="bottom" custom-style="height: 1076rpx"></van-popup> -->
<view class="address-container" hidden="{{!show}}">
<view class="address-bg" bindtap="cancel"></view>
<view class="container">
<view class="headeer flex_sbc">
<!-- <glsx-image bind:tap="back" webp class="icon" src="glsx/equity/version/3_9_0/back-icon.png"></glsx-image> -->
<view></view>
<view class="title">选择收货地址</view>
<glsx-image bind:tap="cancel" webp class="icon" src="glsx/equity/version/3_9_0/close-icon.png"></glsx-image>
</view>
<view class="list-pannel">
<scroll-view class="scroll" scroll-y="{{true}}">
<block wx:for="{{address}}" wx:key="index">
<view bind:tap="toSelect" data-item="{{item}}" data-index="{{index}}" class="cell">
<view class="check-box">
<glsx-image webp class="icon" src="glsx/equity/version/3_9_0/{{currentIndex==index?'select-icon-active':'select-icon'}}.png"></glsx-image>
</view>
<view class="content-box">
<view class="name-phone">{{item.receiveName}} {{item.receiveMobile}}</view>
<view class="address">{{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.address}}</view>
<view wx:if="{{item.isDefault==1}}" class="default-tip flex_cc">默认地址</view>
</view>
<view class="line"></view>
</view>
</block>
</scroll-view>
</view>
<view class="footer flex_cc">
<view bind:tap="comfirm" data-url="/packageShopmall/packageMine/pages/address/detail/detail" class="btn flex_cc">新增地址</view>
</view>
</view>
</view>
// import { shopmallApi } from '~/api/api'
// import USERAPI from "~/api/usersApi/index";
import NP from 'number-precision'
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
address: Array,
type: String,
goods: Object,
defaultAddress: Object,
defaultAds: String,
staffShop:Boolean,
canPay:Boolean
},
data: {
currentIndex: 0,
goodsNumber: 1,
showJfModal:false,
jfCount:0
},
/**
* 组件的方法列表
*/
methods: {
computeJf(num) {
let {goods,jfCount,staffShop} = this.data
if(!staffShop)return
jfCount = NP.times(goods.redeemPoints,num)
this.setData({
jfCount
})
},
cancel() {
this.setData({
show: false
})
this.triggerEvent('cancelSku')
},
changeCount(e) {
this.triggerEvent('getCount', e.detail)
this.computeJf(e.detail)
this.setData({
goodsNumber: e.detail
})
},
toShowAddressModal() {
console.log('222')
this.setData({
showAddress: true
})
},
getAddress(e) {
this.setData({
defaultAds: e.detail.contactAddress,
defaultAddress: e.detail.defaultAddress
})
this.triggerEvent('sameAddress', e.detail)
},
intRemain(e) {
this.setData({
remain: e.detail.value
})
},
toCreatedOrder() {
const userInfo = wx.$util.getUserInfo()
const userStorage = wx.$storage.get("userInfo");
const { remain, goods, goodsNumber, defaultAddress,staffShop } = this.data
if(!defaultAddress.receiveName){
return wx.$api.showToast('请选择收货地址')
}
const params = {
receiveName: defaultAddress.receiveName,
receiveMobile: defaultAddress.receiveMobile,
provinceId: defaultAddress.provinceId,
provinceName: defaultAddress.provinceName,
cityId: defaultAddress.cityId,
cityName: defaultAddress.cityName,
countyId: defaultAddress.countyId,
countyName: defaultAddress.countyName,
address: defaultAddress.address,
customerOpenId:staffShop?userStorage.weChatOpenId:userInfo.openId,
buyerMsg: remain,
orderGoodsList: [{
goodsSkuCode: goods.goodsSkuCode,
goodsSkuName: goods.goodsSkuName,
sellQty: goodsNumber,
}],
}
wx.$api.showLoading('支付中...')
const HTTPNAME = staffShop?'jfToCreateOrder':'platformGoodsCreateOrder'
shopmallApi[HTTPNAME](params).then(res => {
if(staffShop&&!goods.salePrice){
wx.hideLoading();
wx.$router.reLaunch('/packageStoreAssistant/packageMine/pages/ShopPaySuccess/index')
return
}
if (res) this.toPayOrder(res.orderCode)
})
},
toPayOrder(orderCode) {
const { staffShop } = this.data
const HTTPNAME =staffShop?'orderCreatePay':'platformGoodsPayOrder'
shopmallApi[HTTPNAME]({ orderCode, paymentSource: 1 }).then(res => {
wx.hideLoading();
if (res) {
const { timeStamp, nonceStr, packages, signType, paySign } = res.payParams
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: nonceStr,
package: packages,
signType: signType,
paySign: paySign,
success() {
const URL = staffShop?'/packageStoreAssistant/packageMine/pages/ShopPaySuccess/index':'/packageShopmall/packageMine/pages/order/complete/complete'
wx.$router.reLaunch(URL, {
success: true,
})
},
fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
wx.$api.showToast('取消支付')
}
}
})
}
if(staffShop){
wx.$eventbus.emit('REFRESH_WITHDRALWAL')
}
})
},
// 检查登录状态
async checkLoginStatus() {
if(this.data.staffShop){
this.setData({showJfModal:true})
return
}
const sessionId = wx.$util.getSessionId(),
userInfo = wx.$util.getUserInfo() || null;
if ((userInfo && !userInfo.phone) || !userInfo) return this.reLogin()
if (sessionId) {
const {
code
} = await USERAPI.checkSession({
sessionId,
});
if (code == "0") this.toCreatedOrder()
else this.reLogin();
} else this.reLogin();
},
reLogin() {
wx.navigateTo({
url: '/pages/Login/Login'
})
}
}
})
{
"component": true,
"usingComponents": {}
"usingComponents": {
"address":"../Adress/index",
"stepper": "/components/Stepper/Stepper"
}
}
\ No newline at end of file
.sku-container {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.sku-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.container {
position: absolute;
width: 100%;
height: 80%;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
left: 0;
bottom: 0;
animation: show-sku-box .5s forwards;
z-index: 2;
padding: 44rpx 40rpx;
}
}
.goods-box {
.cover {
width: 180rpx;
height: 180rpx;
border-radius: 24rpx;
overflow: hidden;
}
.right-box {
padding-left: 40rpx;
.price-box {
font-weight: 700;
color: #FC5B32;
display: table-cell;
vertical-align: bottom;
text {
color: #FF6038;
font-size: 40rpx;
font-weight: 600;
margin-right: 4rpx;
}
.price {
font-size: 64rpx;
}
}
.stock {
font-weight: 400;
font-size: 20rpx;
color: #858A94;
margin: 10rpx 0 8rpx 0;
}
.selct-box {
font-weight: 400;
font-size: 20rpx;
color: #858A94;
}
}
}
.sku-box {
.title {
font-weight: 400;
font-size: 28rpx;
color: #1B233D;
margin-top: 48rpx;
margin-bottom: 26rpx;
}
.sku-list {
display: flex;
flex-wrap: wrap;
.sku {
padding: 6rpx 20rpx;
background: #F5F6FA;
border-radius: 12rpx;
margin-right: 16rpx;
margin-bottom: 20rpx;
}
.sku_active {
background: #fc5b320f;
border: 2rpx solid #FC5B32;
border-radius: 4rpx;
font-weight: 400;
font-size: 24rpx;
color: #FC5B32;
}
}
}
.count-box {
margin-top: 20rpx;
.title {
font-weight: 400;
font-size: 28rpx;
color: #434345;
}
.right {
.tip {
font-weight: 400;
font-size: 20rpx;
color: #F13C3D;
}
.stepper {
margin-left: 16rpx;
}
}
}
.textarea-box {
margin-top: 48rpx;
.title {
font-weight: 400;
font-size: 28rpx;
color: #4C4D4F;
margin-bottom: 20rpx;
}
.pannel {
width: 100%;
box-sizing: border-box;
padding: 16rpx 20rpx;
height: 128rpx;
background: #F5F6FA;
border-radius: 16rpx;
.textarea-placeholder {
font-weight: 400;
font-size: 24rpx;
color: #9E9EA8;
}
.textArea {
height: 100%;
}
}
}
.adress-box {
margin-top: 52rpx;
.title {
font-weight: 400;
font-size: 28rpx;
color: #1B233D;
}
.content {
font-weight: 400;
font-size: 24rpx;
color: #333435;
width: 490rpx;
text-align: right;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 8rpx;
}
.emptyText {
color: #858A94;
}
.pos {
width: 36rpx;
height: 36rpx;
}
}
.btn-wrap {
position: fixed;
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
padding: 8rpx 40rpx 68rpx;
background: white;
.btn {
width: 100%;
height: 80rpx;
background: #FB8A32;
border-radius: 20rpx;
font-weight: 500;
font-size: 30rpx;
color: #FFFFFF;
}
.diable_btn{
background: #999999;
color: #FFFFFF;
border: none;
box-shadow: none;
}
}
.flex_sc {
display: flex;
align-items: center;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
\ No newline at end of file
<!-- <van-popup show="{{ show }}" bind:click-overlay="cancel" custom-class="popclass" position="bottom" custom-style="height: 90%"></van-popup> -->
<view class="sku-container" hidden="{{!show}}">
<view class="sku-bg" bindtap="cancel"></view>
<view class="container">
<view class="goods-box flex_sc">
<view class="cover">
<glsx-image class="cover" src="{{goods.imageResponses[0].imgUrl}}" />
</view>
<view class="right-box">
<view class="price-box">
<text class="price">{{goods.salePrice || 35}}</text><text>积分</text>
</view>
<view wx:if="{{goods.goodsStock}}" class="stock">有货(库存{{goods.goodsStock}})</view>
<view wx:else class="stock">暂无存货</view>
<view class="selct-box">已选:{{goodsNumber}}{{goods.goodsUnit}}</view>
</view>
</view>
<view class="sku-box">
<view class="title">规格</view>
<view class="sku-list">
<block wx:for="{{goods.specificationResponses}}" wx:key="index">
<view class="sku flex_cc sku_active">{{item.specName}}:{{item.specValue}}</view>
</block>
</view>
</view>
<view class="count-box flex_scb">
<view class="title">数量</view>
<view class="right flex_sc">
<!-- <view class="tip">至少购买{{goods.startQty}}{{goods.goodsUnit}}</view> -->
<view class="stepper">
<stepper count="{{goodsNumber}}" min="{{goods.startQty}}" max="{{goods.goodsStock}}" catchchange="changeCount"></stepper>
</view>
</view>
</view>
<view class="textarea-box">
<view class="title">订单备注</view>
<view class="pannel">
<textarea bindinput="intRemain" maxlength="100" class="textArea" placeholder="请输入备注信息(选填)" placeholder-class="textarea-placeholder"></textarea>
</view>
</view>
<view bind:tap="toShowAddressModal" class="adress-box flex_scb">
<view class="title">收货地址</view>
<view class="right flex_scb">
<view class=" content {{defaultAds?'':'emptyText'}}">{{defaultAds || '请选择'}}</view>
<mp-icon icon="arrow" bind:tap="showSkuModal" color="#B1B1B3" size="{{10}}"></mp-icon>
</view>
</view>
<view class="btn-wrap flex_cc">
<view wx:if="{{staffShop&&!canPay}}" class="btn flex_cc diable_btn">积分不足</view>
<view wx:else bind:tap="checkLoginStatus" class="btn flex_cc">确认</view>
</view>
<view style="height:290rpx"></view>
</view>
</view>
<address wx:if="{{showAddress}}" staff="{{staffShop}}" address="{{address}}" idIndex="{{defaultAddress.id}}" bind:getAddress="getAddress" show="{{showAddress}}"></address>
<!-- <jf-modal bind:comfirmOrder="toCreatedOrder" count="{{jfCount || goods.redeemPoints}}" show="{{showJfModal}}"></jf-modal> -->
const navStyle = 'background-color: transparent;'
let navBarHeight = 38
// import { mineApi, shopmallApi } from '~/api/api'
// import MineApi from '~/api/mineApi/index'
// import NP from 'number-precision'
// import USERAPI from '~/api/usersApi/index'
Page({
data: {
navStyle,
tabs: ['商品详情', '商品参数'],
curTabIndex: 0,
service: {
1001: '不支持无理由退货',
1002: '支持7天无理由退货',
1003: '支持7天无理由退货(拆封后不支持)',
1004: '支持7天无理由退货(激活后不支持)',
1005: '支持7天无理由退货(安装后不支持)',
1006: '支持7天无理由退货(使用后不支持)',
},
skuInfo: '',
staffShop: false,
isCarOwner: false,
payWayActions: [{ name: '金额支付', type: 1, disabled: false }, { name: '积分兑换', type: 2, disabled: false }],
detailInfo: {
pointsPrice: 25,
marketPrice: 30,
imageResponses: [{
imgUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png'
}],
saleNum: 600,
remaining: 56,
goodsName: '九阳保温饭盒焖烧杯九阳保温饭盒焖烧杯九阳保温饭盒焖烧杯九阳',
goodsDescribe: '<figure class="image"><img src="https://img.yunzhonghe.com/image/1592793907468wHVTWiUHIc.png"></figure>'
}
},
appHide() {
wx.offAppHide()
wx.onAppHide(() => {
if (this.timer) clearInterval(this.timer)
this.trackQuery.view = 5
})
},
/**添加埋点结束 */
navbarReady(e) {
navBarHeight = e.detail.height
},
onPageScroll(e) {
const { curTabIndex } = this.data
if (curTabIndex == 0) {
this.scrollY = e.scrollTop
}
this.setData({
navStyle: e.scrollTop >= navBarHeight || curTabIndex ? '' : navStyle,
opacity: curTabIndex == 1 ? 1 : e.scrollTop / 200,
})
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
goodsActionClick(e) {
if (e.detail == 'join') return this.toAddShopCar()
if (this.data.isCarOwner) return this.judgePayWay()
this.showSkuModal(e.detail)
},
onLoad(options) {
wx.p.router.getRouterParams(options).then(params => {
// this.getDetail(options)
}).catch(err => {
console.error('参数获取失败:', err)
})
// this.getPlatFormAddress(staff)
},
showSkuModal(type) {
console.log('111')
// if (this.data.isCarOwner) return
this.setData({
showSku: true,
clickType: type
})
wx.setPageStyle({
style: {
overflow: 'hidden'
}
})
},
// 获取默认的地址
getPlatFormAddress(staff) {
wx.showLoading()
let para = {}
if (staff) {
para.businessType = 1
}else{
const SID = wx.$util.getSessionId()
if (!SID) return wx.hideLoading()
}
shopmallApi.platformAddressList(para).then(data => {
wx.hideLoading()
let contactAddress = '', defaultAddress = {}
let _isSetDefault = false
if (data && data.length) {
data.forEach(el => {
if (el.isDefault == 1) {
contactAddress = el.provinceName + el.cityName + el.countyName + el.address,
defaultAddress = el
_isSetDefault = true
}
})
if (!_isSetDefault) {
let _first = data[0]
contactAddress = _first.provinceName + _first.cityName + _first.countyName + _first.address,
defaultAddress = _first
}
}
this.setData({
addressList: data,
contactAddress,
defaultAddress
})
})
},
jump(e) {
let { url, isChooseAddress } = e.currentTarget.dataset
wx.$router.go(url, {
isChooseAddress,
platform: true,
staff: this.data.staffShop,
notIntercept: this.data.staffShop
})
},
back() {
wx.$router.back()
},
changeTab(e) {
if (this.data.opacity < 0.8) return
this.setData({
curTabIndex: e.currentTarget.dataset.index,
opacity: e.currentTarget.dataset.index
}, () => {
setTimeout(() => {
wx.pageScrollTo({
scrollTop: this.scrollY
})
}, 200)
})
},
// 获取详情
getDetail(options) {
if(!options || !options.id)return
const { id, staff, score, isCarOwner, openId } = options
const merchantId = wx.$storage.get("srcm_shopmall_merchant_id");
this.merchantId = merchantId
let para = { id }, canPay = true
if (staff) para.businessType = 1
if (isCarOwner) {
if (openId) {
this.shareOpenId = options.openId
}
this.data.enter_time = new Date().format('yyyy-MM-dd hh:mm:ss')
this.firstEnter = true
this.appHide()
this.getMyIntegral()
para.merchantId = merchantId
}
shopmallApi.platformGoodsDetail(para).then(res => {
if (res && res.specificationResponses) {
this.toGetSpecString(res, res.startQty)
}
if (staff) {
canPay = score > res.redeemPoints
}
// if (isCarOwner) {
// res.retailPrice = NP.divide(res.retailPrice, 100)
// }
this.setData({
detailInfo: res || {},
canPay,
isCarOwner
})
})
},
toGetSpecString(info, count) {
let skuInfo = this.data, num = '', weight = ''
num = `${count}${info.goodsUnit}`
weight = `${info.grossWeight}${info.grossWeightUnit}`
skuInfo = `${info.specificationResponses[0].specValue}` + `,${weight}` + `,${num}`
this.setData({
skuInfo
})
},
getCount(e) {
this.toGetSpecString(this.data.detailInfo, e.detail)
this.count = e.detail
},
// 添加购物车
toAddShopCar() {
const { detailInfo, isCarOwner } = this.data
const PARAMS = {
goodsId: detailInfo.id,
goodsNumber: this.count || detailInfo.startQty,
cartType: 2,
goodsSkuCode: detailInfo.goodsSkuCode
}
if (isCarOwner) {
PARAMS.carOwnerPlatformFlag = 1
PARAMS.merchantId = this.merchantId
PARAMS.cartType = 4
}
if(isCarOwner&&!detailInfo.retailPrice&&detailInfo.exchangeIntegral)return
shopmallApi.platformAddCar(PARAMS).then(res => {
wx.$api.showToast('添加成功!在购物车等亲~')
})
},
// 同步选择的地址
resetAddress(e) {
this.setData(e.detail)
},
toDuiHuang() {
if (this.data.canPay) {
this.showSkuModal('pay')
}
},
getViewInfo() {
wx.$api.getViewInfo(
'.fixed_btn_wrap',
res => {
this.setData({
padding_bottom: res.height
})
},
this
)
},
closeSku() {
wx.setPageStyle({
style: {
overflow: 'unset'
}
})
},
//获取我的积分
getMyIntegral() {
shopmallApi.getMyIntegralApi({}).then(res => {
if (res) {
this.setData({
availableIntegral: res.availableIntegral
})
}
})
},
judgePayWay() {
const { availableIntegral, detailInfo, payWayActions } = this.data
if (detailInfo.exchangeIntegralFlag) {
const canPay = +availableIntegral > +detailInfo.exchangeIntegral
const canMoneyPay = !detailInfo.retailPrice
if (!canPay) {
payWayActions[1].disabled = true
payWayActions[1].name = '积分不足'
}
if(canMoneyPay){
payWayActions[0].disabled = true
}
this.setData({
showPayWay: true,
canPay,
payWayActions
})
} else {
this.jumpToPay()
}
},
closePayWayModal() {
this.setData({
showPayWay: false
})
},
//选择支付方式
selectPayWay(e) {
const val = e.detail
if (val.type == 2) {
this.useJFtoPay = true
} else {
this.useJFtoPay = false
}
this.jumpToPay()
this.closePayWayModal()
},
// 跳转确认支付订单页面
jumpToPay() {
const { detailInfo } = this.data
const obj = {
useJFtoPay: this.useJFtoPay,
merchantName: detailInfo.merchantName,
merchantId: detailInfo.merchantId,
goodsList: [{
goodsImage: detailInfo.imageResponses[0].imgUrl,
goodsSkuName: detailInfo.goodsSkuName,
retailPrice: detailInfo.retailPrice,
exchangeIntegral: detailInfo.exchangeIntegral,
goodsNumber: 1,
goodsStock: detailInfo.goodsStock,
goodsId: detailInfo.id,
isPay: false,
goodsSkuCode: detailInfo.goodsSkuCode,
}]
}
const query = `?goodsInfo=${JSON.stringify(obj)}`
wx.navigateTo({
url: '/packageShopmall/packageMall/pages/platformShop/pay/index' + query,
});
},
onUnload: function () {
const {
isCarOwner
} = this.data
if (!isCarOwner) return
if (this.timer) clearInterval(this.timer)
this.trackQuery.view = 5
},
onShareAppMessage: function () {
const merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
const userInfo = wx.$util.getUserInfo()
let {
detailInfo,
isCarOwner
} = this.data, open_id = ''
if (!isCarOwner) return
this.trackQuery.view = 4
if (userInfo) open_id = userInfo.openId
let title = detailInfo.goodsSkuName
let path = `${this.route}?id=${detailInfo.id}&openId=${open_id}`
let imageUrl = ''
detailInfo.imageResponses.map(e => {
imageUrl = e.imgUrl
})
if (merchantId) path = `${path}&merchantId=${merchantId}&isCarOwner=${isCarOwner || false}`
return {
imageUrl,
title,
path
}
},
})
\ No newline at end of file
{
"navigationStyle": "custom",
"usingComponents":{
"mp-html":"/components/mp-html/index",
"sku": "./components/Sku"
}
}
\ No newline at end of file
/* packageMall/pages/detail/detail.wxss */
page {
background: #F7F8FA;
}
.flex {
display: flex;
align-items: center;
position: relative;
}
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
.navigation {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.back {
position: absolute;
left: 20rpx;
width: 64rpx;
height: 64rpx;
background: #ffffff80;
border: 1rpx solid #E5E5E5;
border-radius: 32rpx;
}
.page-title {
font-size: 34rpx;
font-weight: 600;
color: #282829;
}
}
}
.layout {
.banner-box {
height: 750rpx;
position: relative;
.banner {
height: 100%;
}
.dot-box {
position: absolute;
bottom: 24rpx;
border-radius: 2rpx;
overflow: hidden;
display: flex;
}
.banner video {
width: 100%;
height: 100%;
}
.dot {
width: 20rpx;
height: var(--borderRadius);
background: rgba(255, 255, 255, 0.3);
transition: all .5s;
}
.dot.active {
background-color: #fff;
}
}
.goods-container {
background: #F7F8FA;
padding: 16rpx 0;
.container-item {
margin: 0 16rpx;
padding: 28rpx 24rpx;
background: #FFFFFF;
border-radius: 24rpx;
margin-bottom: 16rpx;
}
.goods-box {
.price{
display: flex;
justify-content: space-between;
}
.price-box {
display: flex;
.sale-price {
font-size: 54rpx;
color: #FC5B32;
font-weight: 700;
text {
font-size: 28rpx;
font-weight: 500;
}
}
.market-price {
text-decoration: line-through;
font-size: 24rpx;
color: #B1B1B3;
margin: 36rpx 0 0 12rpx;
}
}
.count {
color: #B1B1B3;
font-size: 24rpx;
}
.goods-title {
margin-top: 20rpx;
color: #282829;
font-size: 34rpx;
font-weight: 500;
font-family: PingFangSC-Medium;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
.select-params-box {
.cell {
height: 88rpx;
display: flex;
align-items: center;
justify-content: space-between;
.flex {
width: 100%;
}
.title {
width: 80rpx;
font-size: 24rpx;
color: #707071;
}
.content {
width: calc(100% - 140rpx);
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
word-break: break-all;
}
.flex_ccc {
display: flex;
justify-content: center;
flex-direction: column;
}
}
}
.goods-detail-box {
.title {
text-align: center;
font-size: 24rpx;
color: #B1B1B3;
}
}
}
}
.tab-widget {
position: fixed;
left: 0;
right: 0;
top: 0;
background: white;
height: 88rpx;
z-index: 99;
opacity: 0;
.tab-box {
position: relative;
width: 50%;
height: 88rpx;
font-weight: 400;
font-size: 28rpx;
color: #656566;
.line {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 66rpx;
height: 6rpx;
background: #FC5B32;
border-radius: 2rpx;
}
}
}
.fixed_btn_wrap {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 100rpx;
background: #FFFFFF;
box-sizing: border-box;
padding:4rpx 48rpx;
.dh_btn {
background: #FC5B32;
border: 1.6rpx solid #FC5B32;
box-shadow: 0 4rpx 12rpx 4rpx #f13c3d1a;
border-radius: 20rpx;
height: 80rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.grey_btn{
background: #999999;
border: none;
box-shadow: none;
}
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
\ No newline at end of file
<view class="navigation-bar">
<navigation-bar custom navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="商品详情">
<view class="navigation">
<view class="back text-center" bindtap="back">
<mp-icon icon="back" color="#323233" size="{{12}}"></mp-icon>
</view>
<view class="page-title">商品详情</view>
</view>
</navigation-bar>
</view>
<view class="tab-widget flex_sc" style="top:{{padding_bottom}}px;opacity:{{opacity}};z-index:{{opacity>0.9?99:1}}">
<block wx:for="{{tabs}}" wx:key="index">
<view bind:tap="changeTab" data-index="{{index}}" class="tab-box flex_cc">
<text>{{item}}</text>
<view wx:if="{{curTabIndex==index}}" class="line"></view>
</view>
</block>
</view>
<view hidden="{{curTabIndex!=0}}">
<view class="layout" style="padding-bottom:{{padding_bottom + 20}}px;">
<view class="banner-box">
<swiper class="banner" bindchange="changeBanner">
<block wx:for="{{detailInfo.imageResponses}}" wx:key="index">
<swiper-item>
<glsx-image class="icon-bg" src="{{item.imgUrl}}" />
</swiper-item>
</block>
</swiper>
<block wx:if="{{detailInfo.imageResponses.length > 1}}">
<view class="dot-box x-center">
<block wx:for="{{detailInfo.imageResponses}}" wx:key="index">
<view class="dot {{bannerIndex == index ? 'active':''}}"></view>
</block>
</view>
</block>
</view>
<view class="goods-container">
<view class="container-item goods-box">
<view class="price">
<view class="price-box">
<view class="sale-price">
{{detailInfo.pointsPrice}}
<text>积分</text>
</view>
<view class="market-price">¥{{detailInfo.marketPrice}}</view>
</view>
<view class="count">
<text>剩余 {{detailInfo.remaining}}</text> | <text>销售 {{detailInfo.saleNum}}</text>
</view>
</view>
<view class="goods-title">{{detailInfo.goodsName}}</view>
</view>
<view class="container-item select-params-box">
<view class="cell">
<view class="flex">
<view class="title">已选</view>
<view bind:tap="showSkuModal" class="content flex_ccc">
<view>{{skuInfo}}</view>
</view>
</view>
<mp-icon icon="arrow" bind:tap="showSkuModal" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell">
<view class="flex">
<view class="title">配送</view>
<view bindtap="jump" data-is-choose-address data-url="/packageShopmall/packageMine/pages/address/index/index" class="content flex_ccc">
<view class="address-text">{{contactAddress || '--'}}</view>
</view>
</view>
<mp-icon icon="arrow" color="#B1B1B3" size="{{12}}"></mp-icon>
</view>
<view class="cell">
<view class="title">服务</view>
<view class="content flex_ccc">
<view>{{service[detailInfo.returnGoodsRules]}},包邮,正品保障</view>
</view>
</view>
</view>
<view class="goods-detail-box">
<view class="title">图文详情</view>
<view class="image-list-wrap">
<mp-html content="{{detailInfo.goodsDescribe}}"></mp-html>
</view>
</view>
</view>
</view>
</view>
<view hidden="{{curTabIndex!=1}}">
<view class="layout" style="padding-bottom:{{padding_bottom + 20}}px;">
<view class="inner" style="padding-top:{{padding_bottom+48}}px">
<view class="title">商品参数</view>
<view class="table-wrap">
<view class="cell flex_sc">
<view class="label-box flex_sc">商品编号</view>
<view class="content-box flex_sc">{{detailInfo.goodsSkuCode}}</view>
</view>
<view class="cell flex_sc">
<view class="title-box flex_sc">参数</view>
</view>
<block wx:for="{{detailInfo.attributeResponses}}" wx:key="index">
<view wx:if="{{item.attributeName}}" class="cell flex_sc">
<view class="label-box flex_sc">{{item.attributeName}}</view>
<view class="content-box flex_sc">{{item.attributeValueName}}</view>
</view>
</block>
</view>
</view>
</view>
</view>
<view wx:if="{{staffShop}}" class="fixed_btn_wrap">
<view bind:tap="toDuiHuang" class="dh_btn {{canPay?'':'grey_btn'}}">
{{canPay?'立即兑换':'积分不足'}}
</view>
</view>
<block wx:if="{{navHeight&&!staffShop}}">
<goods-action platformShop="{{true}}" bindready="goodsActionReady" pay-disabled="{{false}}" upgradeSet="{{!detailInfo.retailPrice&&detailInfo.exchangeIntegral}}" stock="{{detailInfo.goodsStock===0}}" buyFlag="{{false}}" bindclick="goodsActionClick" hideShop="{{false}}"></goods-action>
</block>
<sku staffShop="{{staffShop}}" canPay="{{canPay}}" bind:cancelSku="closeSku" bind:getCount="getCount" bind:sameAddress="resetAddress" wx:if="{{showSku}}" show="{{showSku}}" defaultAds="{{contactAddress}}" goods="{{detailInfo}}" defaultAddress="{{defaultAddress}}" address="{{addressList}}"></sku>
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
// components/Goods/Goods.js
import { centsToyuan } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
observer(n, o) {
if (n) {
if (n.activityInfo) {
n.originalPrice = ''
n.retailPrice = n.activityInfo.activityPrice
n.goodsStatistics.saleAmount = n.activityInfo.saleAmount
if (n.activityInfo.specificationExtraList && n.activityInfo.specificationExtraList.length) {
n.retailPrice = n.activityInfo.specificationExtraList[0].retailPrice
n.up = true
}
} else {
if (n.originalPrice) n.originalPrice = centsToyuan(n.originalPrice)
if (n.specificationDetailList && n.specificationDetailList.length) {
n.retailPrice = n.specificationDetailList[0].retailPrice
n.up = true
}
}
n.retailPrice = Number(centsToyuan(n.retailPrice)).toFixed(2)
if (n.retailPrice > 9999) {
n.retailPrice = Number(n.retailPrice / 10000).toFixed(2)
n.unit = '万'
}
this.setData({ item: n })
}
}
},
indexStyle: Boolean
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
setWidth() {
wx.p.wxApi.getViewInfo(
'.Goods',
res => {
this.setData({
previewHeight: res.width * 2
})
},
this
)
},
jump(e) {
let { item } = e.currentTarget.dataset
let { id, activityInfo } = item
let isActivity = false
if (activityInfo) {
id = activityInfo.id
isActivity = true
}
wx.p.router.go('/packageMall/pages/detail/detail', { id, isActivity, notIntercept: true })
}
},
lifetimes: {
attached() {
this.setWidth()
}
}
})
<view class="Goods" bindtap="jump" data-item="{{item}}">
<view class="preview" style="height:{{previewHeight}}rpx">
<glsx-image webp src="{{item.goodsImage}}" lazy-load></glsx-image>
</view>
<view class="name text-hide">{{item.goodsName}}</view>
<view class="info ">
<view class="icon">
<glsx-image webp src="mall/eye.png"></glsx-image>
</view>
<view class="text text-hide">{{item.goodsStatistics.viewAmount||0}}|售出{{item.goodsStatistics.saleAmount || 0}}
</view>
</view>
<view class="price">
<view class="now {{indexStyle}}">
<text class="unit">¥</text>{{item.retailPrice || 0}}
<text class="unit up" wx:if="{{item.unit}}">{{item.unit}}</text>
<text class="unit up" wx:if="{{item.up}}">起</text>
</view>
<block wx:if="{{item.originalPrice >= 0 && item.originalPrice}}">
<view class="old">
¥{{item.originalPrice || 0}}
</view>
</block>
</view>
</view>
\ No newline at end of file
/* components/Goods/Goods.wxss */
.Goods{
width: 100%;
border-radius: 8rpx;
}
.Goods .preview {
border-radius: 8rpx;
overflow: hidden;
height: 252rpx;
}
.Goods .name {
color: #2D2D2E;
margin: 16rpx 0 ;
}
.Goods .info {
color: #B1B1B3;
font-size: 20rpx;
display: flex;
align-items: center;
}
.Goods .info .icon {
width: 24rpx;
height: 24rpx;
margin-right: 2rpx;
}
.Goods .info .icon .text{
width: calc(100% - 26rpx);
}
.Goods .price {
display: flex;
align-items: center;
margin-top: 14rpx;
font-size: 20rpx;
}
.Goods .price .now {
display: flex;
align-items: baseline;
color: var(--btnColor);
font-size: 34rpx;
line-height: 34rpx;
font-weight: 500;
letter-spacing: -0.5rpx;
}
.Goods .price .now.true{
font-size: 40rpx;
line-height: 40rpx;
}
.Goods .price .now .unit {
font-size: 20rpx;
margin: 0 4rpx;
}
.Goods .price .now.true .unit{
font-size: 24rpx;
}
.Goods .price .now .up{
transform: translateY(-2rpx);
}
.Goods .price .old {
color: #C9CACC;
text-decoration: line-through;
margin-left: auto;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
// components/tabView/tabView.js
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height: null,
tagIndex: {
type: Number,
value: 0
},
refresherEnabled: Boolean,
triggered: Boolean
},
/**
* 组件的初始数据
*/
data: {
scrollTop: 0,
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
index,
item
} = e.currentTarget.dataset
item.index = index
this.setData({
scrollTop: 0,
tagIndex: index
})
this.triggerEvent('click', item)
},
tabScrollTolower(e) {
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e) {
this.triggerEvent('viewScrollTolower')
},
bindrefresherrefresh(e) {
this.triggerEvent('refresherrefresh')
}
}
})
\ No newline at end of file
<view class="tab-box" id="tabView" style="height:calc(100vh - {{height}}px)">
<scroll-view style="height:100%;" scroll-y class="tab" bindscrolltolower="tabScrollTolower">
<view>
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{tagIndex==index?'active':''}}" bindtap="click" data-item="{{item}}" data-index="{{index}}">
{{item.zoneName}}</view>
</block>
</view>
</scroll-view>
<view class="view">
<view style="height:100%;">
<scroll-view style="height:100%" scroll-y scroll-top="{{scrollTop}}" bindscrolltolower="viewScrollTolower"
refresher-enabled="{{refresherEnabled}}" refresher-triggered="{{triggered}}"
bindrefresherrefresh="bindrefresherrefresh">
<view class="content">
<slot name="content"></slot>
</view>
</scroll-view>
</view>
</view>
</view>
\ No newline at end of file
/* components/tabView/tabView.wxss */
.tab-box {
display: flex;
}
.tab {
width: 21.33%;
box-sizing: border-box;
text-align: center;
background: #F9F7F7;
}
.tab ::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
.view {
width: 78.67%;
height: 100%;
position: relative;
background: #F9F7F7;
}
.tab-item {
width: 100%;
height: 120rpx;
line-height: 120rpx;
font-size: 26rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #666666;
box-sizing: border-box;
padding: 0 10rpx;
transition: all .5s;
background: #F2EFEF;
}
.active {
font-weight: 500;
background: #fff;
position: sticky;
top: 0;
color: #000;
}
.active::after {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
background-color: var(--btnColor);
content: '';
animation: show-border .5s forwards;
}
@keyframes show-border {
0% {
height: 0;
}
100% {
height: 60rpx;
}
}
.refresherEnabled {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
opacity: 0;
}
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
\ No newline at end of file
// pages/tab/mall/index.js
const defaultClassify = ['今日推荐', '新酒预售', '口粮特选', '店铺爆款', '寰球名庄', '红葡萄酒', '白葡萄酒', '雷司令', '起泡酒', '果汁', '西班牙', '南非', '意大利', '德国']
Page({
/**
* 页面的初始数据
*/
data: {
tagIndex: 0,
tabList: [],
goodsList: []
goodsList: [{
}],
chooseIndex: null,
shoppingcartFlag: true
},
pageNum: 1,
total: 0,
async search(e) {
let value = e.detail
let {
goodsList,
tagIndex
} = this.data
if (tagIndex == 0) {
if (this.goodsStorageList) this.jumpSearch(this.goodsStorageList, value)
else if (goodsList.length < this.total) {
this.getGoodsList(res => {
this.goodsStorageList = res
this.jumpSearch(res, value)
})
} else this.jumpSearch(goodsList, value)
} else this.jumpSearch(goodsList, value)
},
jumpSearch(goodsList, value) {
wx.p.router.go('/packageMall/pages/search/search', {
value,
goodsList,
notIntercept: true
})
goodsActionReady(e) {
this.setData({
searchVal: ''
padding_bottom: e.detail
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getMerchantClassify()
this.getGoodsList()
},
async getMerchantClassify() {
wx.p.wxApi.showLoading('加载中...')
try {
const {
merchantId
} = wx.p.storage.get('merchant_info'),
res = await wx.p.api.shopmallApi.getMerchantClassify({
merchantId
})
let tabList = [{
zoneName: '全部',
id: '',
zoneImg: `mall/default-banner.png`
}]
res.list.map(e => {
let tab = {
zoneName: e.classifyName,
id: e.id,
zoneImg: `mall/${e.classifyName}.png`
}
if (!defaultClassify.includes(e.classifyName)) tab.zoneImg = `mall/default-banner.png`
tabList.push(tab)
})
this.setData({
tabList,
flag: true
})
wx.hideLoading()
} catch (error) {
wx.p.wxApi.showToast(error)
}
},
getGoodsList(callBack) {
wx.hideLoading()
const {
tagIndex
changeCount(e) {
console.log(e)
let count = e.detail
let {
index,
item,
ind
} = e.currentTarget.dataset
if (item.goodsNumber == count) return
let {
chooseIndex
} = this.data
if (tagIndex != 0) return
wx.p.wxApi.showLoading('加载中...')
this.setData({
[`goodsList[${index}].list[${ind}].goodsNumber`]: count
})
if (chooseIndex == index) this.cheackAll(index)
wx.p.wxApi.showLoading('正在加载...')
let params = {
pageSize: callBack ? 99999 : 10,
pageNum: callBack ? 1 : this.pageNum
id: item.id,
goodsId: item.goodsId,
goodsNumber: count
}
wx.p.api.shopmallApi.getGoodsList(params).then(({
list,
total
}) => {
if (callBack) callBack(list)
else {
let {
goodsList
} = this.data
this.setData({
goodsList: goodsList.concat(list),
goodsFlag: true
})
this.total = total
}
if (item.specificationKey) params.specificationKey = item.specificationKey
wx.p.api.shopmallApi.updateShoppingcart(params).then(res => {
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
choose(e) {
let {
index,
ind
} = e.currentTarget.dataset
let {
tabList,
tagIndex
goodsList,
chooseIndex
} = this.data
if (tabList.length == 0) return
this.changeData(tagIndex)
},
changeData(index) {
if (chooseIndex != null && chooseIndex != index) return
if (goodsList[index].list[ind].showDel) {
this.hide(e)
return
}
this.setData({
tagIndex: index,
goodsList: [],
goodsFlag: false,
nothing: false
[`goodsList[${index}].list[${ind}].active`]: !goodsList[index].list[ind].active
})
this.pageNum = 1
const {
tabList
} = this.data
if (tabList[index].id) this.getMerchantClassifyGoods(tabList[index].id)
else this.getGoodsList()
this.cheackAll(index)
},
async getMerchantClassifyGoods(id) {
wx.p.wxApi.showLoading('加载中...')
cheackAll(index) {
let count = 0
let sum = 0
let {
goodsList
} = this.data
let allActive = true
try {
const {
merchantId
} = wx.p.storage.get('merchant_info'), {
goodsRefList
} = await wx.p.api.shopmallApi.getMerchantClassifyGoods({
id,
merchantId
goodsList[index].list.map(e => {
if (!e.active) throw false
})
let goodsList = []
if (goodsRefList && goodsRefList.length) {
goodsRefList.map(e => {
e.goods.goodsStatistics = e.goodsStatistics
goodsList.push(e.goods)
})
}
this.setData({
goodsList,
goodsFlag: true
})
wx.hideLoading()
} catch (error) {
allActive = error
}
goodsList[index].list.map(e => {
if (e.active) {
count += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
}
})
this.setData({
[`goodsList[${index}].active`]: allActive,
count,
sum: sum == 0 ? 0 : Number(sum).toFixed(2),
chooseIndex: count == 0 ? null : index
})
},
goShoppingCart() {
wx.p.router.go('/packageMall/pages/shoppingCart/shoppingCart')
},
tabclick(e) {
chooseAll(e) {
let {
index
} = e.detail
} = e.currentTarget.dataset
let {
tagIndex
goodsList,
chooseIndex
} = this.data
if (index == tagIndex) return
this.changeData(index)
this.goodsStorageList = null
if (chooseIndex != null && chooseIndex != index) return
let all = true
try {
goodsList[index].list.map(i => {
if (!i.active) throw false
})
} catch (error) {
goodsList[index].list.map(i => (i.active = true))
all = error
}
if (all) goodsList[index].list.map(i => (i.active = false))
this.setData({
goodsList
})
this.cheackAll(index)
},
viewScrollTolower() {
const {
tagIndex
checkOut() {
let {
chooseIndex,
goodsList
} = this.data
if (tagIndex == 0) {
let {
pageNum,
total
} = this
wx.p.util.onReachBottom({
pageNum,
total,
_this: this
}, () => {
this.pageNum++
this.getGoodsList()
})
let {
list,
payeeMerchantName,
} = goodsList[chooseIndex]
let data = []
list.map(e => (e.active ? data.push(e) : ''))
wx.p.router.go('/packageMall/pages/pay/pay', {
goodsList: data,
merchantName: payeeMerchantName
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.getShoppingcartList()
},
getShoppingcartList() {
wx.p.wxApi.showLoading('加载中...')
let para = {
cartType: 1
}
wx.p.api.shopmallApi
.getShoppingcartList(para)
.then(data => {
data.map(e => {
e.list.map(i => (i.retailPrice = Number(i.retailPrice).toFixed(2)))
})
this.setData({
goodsList: data,
shoppingcartFlag: true,
count: 0,
sum: 0,
chooseIndex: null
})
wx.hideLoading()
})
.catch(() => {
this.setData({
shoppingcartFlag: true
})
})
},
onTabItemTap(e) {
this.goodsStorageList = null
del(e) {
wx.p.wxApi.showLoading('请稍后...')
let {
id
} = e.target.dataset
let para = {
cartType: 1,
id
}
wx.p.api.shopmallApi.delShoppingcart(para).then(res => {
wx.p.wxApi.showToast('删除成功')
setTimeout(() => {
this.getShoppingcartList()
}, 1.5 * 1000)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
onReachBottom: function () {},
hide(e) {
let {
goodsList
} = this.data
let {
index,
ind
} = e.currentTarget.dataset
if (goodsList[index].list[ind].showDel)
this.setData({
[`goodsList[${index}].list[${ind}].showDel`]: false
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
start(e) {
let cell = e.changedTouches[0]
this.startX = cell.clientX
this.startY = cell.clientY
},
move(e) {
let {
startX,
startY
} = this
let {
index,
ind
} = e.currentTarget.dataset
let {
clientX,
clientY
} = e.changedTouches[0]
let X = clientX - startX
let Y = clientY - startY
let angle = (360 * Math.atan(Y / X)) / (2 * Math.PI)
let result = clientX < startX
if (Math.abs(angle) > 30) return
this.setData({
[`goodsList[${index}].list[${ind}].showDel`]: result
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"search-box":"./components/SearchBox/SearchBox",
"tab-view":"./components/TabView/TabView",
"goods":"./components/Goods/Goods"
},
"navigationBarTitleText": "商城",
"navigationStyle": "custom"
"stepper": "/components/Stepper/Stepper"
}
}
\ No newline at end of file
/* pages/tab/index/pages/mall/mall.wxss */
/* pages/tab/mall/mall.wxss */
.mall-layout{
page {
background: #F7F8FA;
}
.nothing-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: #F7F8FA;
}
.nothing {
padding-top: 140rpx;
text-align: center;
color: #7A8299;
}
.nothing .icon {
margin: 0 auto 32rpx;
width: 320rpx;
height: 300rpx;
}
.box {
padding: 24rpx var(--margin);
}
.item-box {
margin-bottom: 24rpx;
background: #FFFFFF;
border-radius: 8rpx;
padding-left: 24rpx;
}
.item-box.disabled {
opacity: .5;
}
.item-box .top {
height: 80rpx;
display: flex;
align-items: center;
padding-right: 24rpx;
}
.item-box .top .icon {
margin-right: 18rpx;
}
.item-box .top .name {
width: calc(100% - 50rpx);
}
.item-box .list {
border-top: 2rpx solid #EFF0F2;
}
.box .item {
width: 100%;
height: 208rpx;
background: #FFFFFF;
border-radius: 8rpx;
margin-bottom: 24rpx;
overflow: hidden;
display: flex;
justify-content: space-between;
position: relative;
}
.tab-view-box {
padding: 16rpx var(--margin);
.box .item .content {
width: 100%;
padding-right: 24rpx;
box-sizing: border-box;
transition: all .5s;
transform: translateX(112rpx);
margin-left: -112rpx;
position: relative;
display: flex;
align-items: center;
}
.tab-view-box .box{
animation: show-box-opacity .25s forwards;
.box .item .content .icon,
.box .item .content .goods-info .preview {
margin-right: 20rpx;
}
.tab-view-box .banner {
height: 220rpx;
.box .item .content .goods-info {
width: calc(100% - 60rpx);
display: flex;
align-items: center;
}
.box .item .content .goods-info .preview {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
}
.tab-view-box .title {
.box .item .content .goods-info .text {
width: calc(100% - 180rpx);
height: 160rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 80rpx;
align-items: center;
border-bottom: 2rpx solid #EFF0F2;
}
.tab-view-box .title .icon {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
.box .item .content .goods-info .text .price-box {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.tab-view-box .goods-box {
padding: 18rpx 0;
.box .item .content .goods-info .text .price-box .price {
color: var(--btnColor);
font-size: 36rpx;
display: flex;
align-items: baseline;
font-weight: 500;
}
.box .item .content .goods-info .text .price-box .price .unit {
font-size: 24rpx;
}
.box .item .del {
width: 112rpx;
height: 100%;
background: var(--themeColor);
transform: translateX(112rpx);
transition: all .5s;
color: #fff;
}
.box .touch-move-active .content,
.box .touch-move-active .del {
transform: translateX(0);
}
.goods-action {
padding: 10rpx var(--margin);
box-sizing: border-box;
height: 100rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
.tab-view-box .goods-box .item{
width: 252rpx;
margin-bottom: 18rpx;
.goods-action .btn {
width: 332rpx;
height: 80rpx;
color: #FFFFFF;
background: var(--btnColor);
border-radius: var(--borderRadius);
font-weight: 500;
padding: 0 !important;
margin: 0 !important;
font-size: 28rpx;
&[disabled]:not([type]) {
background: #CCCED1 !important;
border-color: #CCCED1 !important;
color: #fff !important;
box-shadow: none;
}
}
.list-nothing{
flex-direction: column;
.goods-action .total {
width: calc(100% - 360rpx);
font-size: 24rpx;
display: flex;
align-items: baseline;
}
.goods-action .total .price {
color: var(--btnColor);
font-size: 40rpx;
display: flex;
align-items: baseline;
font-weight: 500;
}
.goods-action .total .price .unit {
font-size: 24rpx;
}
.specification {
font-size: 24rpx;
color: #B1B1B3;
}
\ No newline at end of file
<navigation-bar>商城</navigation-bar>
<view class="mall-layout" style="margin-top: {{navHeight}}px;">
<search-box search-type="2" bindsearch="search" model:value="{{searchVal}}"></search-box>
<block wx:if="{{flag}}">
<block wx:if="{{tabList.length}}">
<tab-view tabList="{{tabList}}" tagIndex="{{tagIndex}}" height="{{52 + navHeight}}" bindclick="tabclick" bindviewScrollTolower="viewScrollTolower">
<view class="tab-view-box" slot="content">
<block wx:if='{{goodsFlag}}'>
<view class="box">
<view class="banner">
<!-- <glsx-image webp src="{{tabList[tagIndex].zoneImg}}"></glsx-image> -->
<glsx-image src="{{tabList[tagIndex].zoneImg}}"></glsx-image>
<view class="layout" style="padding-bottom:{{padding_bottom }}px">
<block wx:if="{{shoppingcartFlag}}">
<block wx:if="{{!goodsList.length}}">
<view class="nothing-box">
<view class="nothing">
<view class="icon">
<glsx-image webp src="/cart/nothing-icon.png" />
</view>
您的购物车空空如也
</view>
</view>
</block>
<block wx:else>
<view class="box">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item-box {{chooseIndex != null && chooseIndex != index?'disabled':''}}">
<view class="top" catchtap="chooseAll" data-index="{{index}}" >
<view class="icon text-center">
<icon type="{{item.active?'success':'circle'}}" color="{{item.active?'#8A303A':'#B1B1B3'}}" size="20">
</icon>
</view>
<view class="title">
{{tabList[tagIndex].zoneName}}
<view class="icon" bindtap="goShoppingCart">
<glsx-image webp src="mall/shopping.png"></glsx-image>
</view>
<view class="name text-hide">
{{item.payeeMerchantName}}
</view>
<view class="goods-box">
<block wx:if="{{goodsList.length}}">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item">
<goods item="{{item}}"></goods>
</view>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing">到底啦!!</view>
</block>
</block>
<block wx:else>
<view class="list-nothing flex">
</view>
<view class="list">
<block wx:for="{{item.list}}" wx:for-item="i" wx:for-index="ind" wx:key="ind">
<view class="item {{i.showDel?'touch-move-active':''}}" data-index="{{index}}" data-ind="{{ind}}"
bindtouchstart="start" bindtouchmove="move">
<view class="content" catchtap="choose" data-index="{{index}}" data-ind="{{ind}}">
<view class="icon">
<glsx-image webp src="mall/goods-nothing.png"></glsx-image>
<icon type="{{i.active?'success':'circle'}}" color="{{i.active?'#8A303A':'#B1B1B3'}}" size="20">
</icon>
</view>
<view class="goods-info">
<view class="preview">
<image webp src="{{i.goodsImage}}"></image>
</view>
<view class="text">
<view class="text-hide">{{i.goodsName}}</view>
<view class="specification" wx:if="{{i.specificationData}}">{{i.specificationData}}</view>
<view class="price-box">
<view class="price">
<text class="unit">¥</text>{{i.retailPrice || 0}}
</view>
<stepper count="{{i.goodsNumber}}" max="{{i.goodsStock}}" catchchange="changeCount"
data-index="{{index}}" data-ind="{{ind}}" data-item="{{i}}"></stepper>
</view>
</view>
</view>
当前门店暂无上架商品
</view>
</block>
</view>
<view class="del text-center" catchtap="del" data-id="{{i.id}}">删除</view>
</view>
</block>
</view>
</block>
</view>
</tab-view>
</block>
<block wx:else>
<view class="list-nothing flex">
<view class="icon">
<glsx-image webp src="mall/goods-nothing.png"></glsx-image>
</view>
当前门店暂无上架商品
</view>
</block>
</view>
</block>
</block>
</view>
\ No newline at end of file
</view>
<block wx:if="{{goodsList.length}}">
<goods-action bindready="goodsActionReady" custom>
<view class="goods-action">
<view class="total">合计:
<view class="price">
<text class="unit">¥</text>{{sum||0}}
</view>
</view>
<button class="btn text-center" bindtap="checkOut" disabled="{{count<1}}">结算({{count||0}})</button>
</view>
</goods-action>
</block>
\ No newline at end of file
......@@ -12,6 +12,5 @@
</view>
</block>
</view>
<view class="button box-center" bindtap="search" data-value="{{value}}">搜索</view>
</view>
</view>
\ No newline at end of file
/* components/SearchBox/SearchBox.wxss */
.search-box {
height: 104rpx;
height: 72rpx;
box-sizing: border-box;
padding: 0 var(--margin);
background-color: #F9F7F7;
padding: 0 24rpx;
}
.box-center {
......@@ -23,8 +23,8 @@
.type-1 {
padding: 0 6rpx;
border-radius: 38px;
border: 3rpx solid var(--btnColor);
border-radius: 36px;
background: #FFFFFF;
}
.type-1 .button {
......@@ -79,6 +79,6 @@
}
.input-placeholder {
color: #CFCFCF;
color: #7E8A9D;
font-size: 28rpx;
}
\ No newline at end of file
import { centsToyuan } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
value: [],
observer(val, o) {
if (val) {
val.forEach(v => {
let n = v
if (n) {
n.activityPrice = Number(centsToyuan(n.activityPrice)).toFixed(2)
if (n.activityPrice > 9999) {
n.activityPrice = Number(n.activityPrice / 10000).toFixed(2)
n.unit = '万'
}
}
})
if (this.time) clearTimeout(this.time)
this.countDown(val)
this.setData({ list: val })
}
}
},
nothing: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
IMGURL: wx.$imgUrl
},
/**
* 组件的方法列表
*/
methods: {
jump(e) {
let { id } = e.currentTarget.dataset
wx.p.router.go('/packageMall/pages/detail/detail', { id, isActivity: true, notIntercept: true })
},
countDown(params) {
params.forEach(v => {
let n = v
if (n) {
let nowTime = new Date().getTime()
n.startTime = new Date(n.startTime).getTime()
n.endTime = new Date(n.endTime).getTime()
// 1未开始 2进行中 3已结束
let activityStatus = nowTime < n.startTime ? 1 : nowTime > n.startTime && nowTime < n.endTime ? 2 : 3
n.activityStatus = activityStatus
const addZero = i => (i < 10 ? `0${i}` : `${i}`)
let endTime = activityStatus == 2 ? n.endTime : n.startTime
let lefttime = parseInt((endTime - nowTime) / 1000)
let d = parseInt(lefttime / (24 * 60 * 60))
let h = parseInt((lefttime / (60 * 60)) % 24)
let m = parseInt((lefttime / 60) % 60)
let s = parseInt(lefttime % 60)
h = addZero(h)
m = addZero(m)
s = addZero(s)
n.day = d > 0 ? d + '天' : d
n.dayList = [h, m, s]
}
})
this.setData({ list: params })
this.time = setTimeout(() => {
this.countDown(params)
}, 1000)
}
},
lifetimes: {}
})
<wxs module="fn">
module.exports = {
priceFilter: function(e, num) {
if(!e)return
return e.split('.')[num]
}
}
</wxs>
<view class="Activity">
<view class="left">
<block wx:for="{{list}}" wx:for-index="idx" wx:key="idx" wx:for-item="item">
<template is="item" data="{{item}}" wx:if="{{idx%2==0}}"></template>
</block>
</view>
<view class="right">
<block wx:for="{{list}}" wx:for-index="idx" wx:key="idx" wx:for-item="item">
<template is="item" data="{{item}}" wx:if="{{idx%2==1}}"></template>
</block>
</view>
<template name="item">
<view class="item-box" bindtap="jump" data-id="{{item.id}}">
<view class="preview">
<image webp src="{{item.activityImg}}" lazy-load></image>
</view>
<view class="item-box-content">
<view class='item-box-title'><text class="item-box-title-text">{{item.activityName}}</text></view>
<view class='item-box-time'>
<view class="text text-hide">{{item.viewAmount||0}}人查看|售出{{item.saleAmount || 0}}</view>
</view>
<view class="item-box-price">
<view class="now">
<text class="unit">¥</text>
<text>{{fn.priceFilter(item.activityPrice || 0, 0)}}.</text>
<text class="price-last">{{fn.priceFilter(item.activityPrice || 0, 1)}}</text>
<text class="unit up" wx:if="{{item.unit}}">{{item.unit}}</text>
<text class="unit up" wx:if="{{item.up}}">起</text>
</view>
<block wx:if="{{item.goods.originalPrice >= 0 && item.goods.originalPrice}}">
<view class="old">
¥{{item.goods.originalPrice || 0}}
</view>
</block>
</view>
<view class="item-box-bubble">
<!-- 活动 -->
<view class="item-box-bubble-view">
<text class="activity-text">秒杀价</text>
<view class="time-box">
<view class="time {{item.activityStatus == 1 ? 'start' : 'end'}} " wx:if="{{item.activityStatus != 3}}">
<view class="day">{{item.day || ''}}</view>
<block wx:for="{{item.dayList}}" wx:key="index">
<view class="time-content text-center">
{{item}}
</view>
<view class="unit" wx:if="{{index < 2}}"> :</view>
</block>
<text>{{item.activityStatus == 1 ? '开始' : '结束'}}</text>
</view>
<view class="time finished" wx:else>已结束</view>
</view>
</view>
</view>
</view>
</view>
</template>
<block wx:if="{{nothing}}">
<view class="list-nothing to-bottom"></view>
</block>
</view>
@import "/assets/style/common.wxss";
.Activity {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding: 16rpx 20rpx 0;
box-sizing: border-box;
}
.Activity .left,
.Activity .right {
display: inline-block;
vertical-align: top;
width: 50%;
}
.Activity .name {
color: #2D2D2E;
margin: 16rpx 0;
}
.left .item-box,
.right .item-box {
margin-bottom: 20rpx;
background: #FFFFFF;
border-radius: 8px;
overflow: hidden;
}
.left .item-box {
margin-right: 11rpx;
}
.right .item-box {
margin-left: 11rpx;
}
.item-box .preview {
width: 100%;
height: 344rpx;
}
.item-box-content {
padding: 20rpx;
}
.item-box-title {
display: flex;
align-items: flex-start;
font-weight: 400;
font-size: 14px;
color: #0A0D14;
}
.item-box-title .item-box-title-image {
flex: 0 0 48rpx;
height: 32rpx;
margin-right: 12rpx;
margin-top: 5rpx;
}
.item-box-title .item-box-title-text {
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.item-box-time {
font-weight: 500;
font-size: 10px;
color: #858A94;
margin-top: 12rpx;
vertical-align: middle;
}
.item-box-price {
margin-top: 12rpx;
display: flex;
align-items: center;
margin-top: 14rpx;
font-size: 20rpx;
}
.item-box-price .now {
font-size: 40rpx;
color: var(--btnColor);
font-weight: 600;
}
.item-box-price .now .unit {
font-size: 24rpx;
}
.item-box-price .now .price-last {
font-size: 24rpx;
}
.item-box-price .old {
color: #3F444D;
text-decoration: line-through;
margin-left: 8rpx;
margin-bottom: -6rpx;
}
.item-box-bubble>.item-box-bubble-view {
position: relative;
background: #FFF5F3;
height: 40rpx;
line-height: 40rpx;
padding-left: 12rpx;
border-radius: 0 8rpx 8rpx 8rpx;
margin-top: 14rpx;
font-size: 20rpx;
color: var(--btnColor);
display: flex;
}
.item-box-bubble>.item-box-bubble-view::after {
content: '';
position: absolute;
width: 0;
height: 0;
top: -16rpx;
right: -16rpx;
left: 0;
border-right: 16rpx solid transparent;
border-bottom: 16rpx solid #FFF5F3;
}
.item-box-bubble .activity-text {
margin-right: 16rpx;
}
.time {
display: flex;
align-items: center;
}
.time .time-content {
width: 30rpx;
height: 28rpx;
border-radius: 4rpx;
line-height: 28rpx;
text-align: center;
color: #ffffff;
font-size: 19rpx;
margin: 0 4rpx;
}
.time.end {
color:var(--btnColor);
}
.time.start {
color: #FF9F0A;
}
.time.start .time-content {
background: #FF9F0A;
}
.time.end .time-content {
background: var(--btnColor);
}
\ No newline at end of file
// components/banner/banner.js
Component({
/**
* 组件的属性列表
*/
properties: {
bannerList: {
type: Array,
value: [],
observer(n) {
this.setData({
dotsList: new Array(n.length),
bannerIndex: 0
})
}
},
},
/**
* 组件的初始数据
*/
data: {
dotsList: [],
bannerIndex: 0
},
/**
* 组件的方法列表
*/
methods: {
jumpGoods(e) {
let {
id,
url,
equity,
item
} = e.currentTarget.dataset
if (item.bannerType == 'channels') {
if (item.type) wx.openChannelsLive({
...item,
success(res) {
console.log(res)
},
fail(err) {
if (err && err.errMsg && !err.errMsg.includes('cancel')) wx.p.wxApi.showToast(err.errMsg)
}
})
else wx.reserveChannelsLive({
noticeId: item.noticeId
})
return
}
if (id) wx.p.router.go('/packageMall/pages/detail/detail', {
id,
isActivity: false,
notIntercept: true
})
else if (equity) wx.p.router.go('/packageEquity/pages/allEquity/allEquity')
else if (url) wx.p.router.go('/packageIndex/pages/bannerJumpPage/bannerJumpPage', item)
},
changePage(e) {
let {
current,
source
} = e.detail
if(source == 'autoplay' || source == 'touch') this.setData({
bannerIndex: current
})
},
}
})
\ No newline at end of file
<view class="banner">
<swiper class="swiper" bindanimationfinish="changePage" autoplay interval="5000" current="{{bannerIndex}}">
<block wx:for="{{bannerList}}" wx:key="index">
<swiper-item>
<image webp src="{{item.bannerImg}}" class="banner-img" bindtap="jumpGoods" data-item="{{item}}" data-bannerType="{{item.bannerType}}" data-id="{{item.goods.id}}" data-url="{{item.linkUrl}}" data-equity="{{item.equity}}"></image>
</swiper-item>
</block>
</swiper>
<block wx:if="{{dotsList.length}}">
<view class="banner-dots">
<block wx:for="{{dotsList}}" wx:key="index">
<view class="dots {{bannerIndex == index?'active':''}}"></view>
</block>
</view>
</block>
</view>
\ No newline at end of file
.banner {
padding: 12rpx 20rpx 40rpx;
position: relative;
height: 140rpx;
overflow: hidden;
position: relative;
border-radius: 16rpx;
}
.banner .swiper {
height: 100%;
border-radius: 16rpx;
overflow: hidden;
position: relative;
transform: translateY(0);
}
.banner .swiper.border {
border: 16rpx solid #fff;
box-sizing: border-box;
background: #D6D6D6;
}
.banner .swiper .logo {
left: 50%;
}
.banner .swiper-item,
.banner .banner-img {
border-radius: 16rpx;
overflow: hidden;
}
.banner .banner-dots {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
width: 100%;
bottom: 52rpx;
left: 0;
}
.banner .banner-dots .dots {
width: 12rpx;
height: 4rpx;
margin: 0 6rpx;
border-radius: 3rpx;
background-color: rgba(0, 0, 0, .5);
transition: all .5s;
}
.banner .banner-dots .dots.active {
background-color: var(--btnColor);
}
\ No newline at end of file
// components/banner/banner.js
Component({
/**
* 组件的属性列表
*/
properties: {
customerlist: {
type: Array,
value: []
},
show: Boolean
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
showFlex() {
this.setData({
show: false
})
},
// 保存客服企微二维码
saveClick() {
const [item] = this.data.customerlist
if (!item || !item.qrCode) return
let _this = this
wx.downloadFile({
url: item.qrCode,
success: function (res) {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function (data) {
wx.showToast({
title: "保存成功",
icon: "success",
duration: 2000
});
},
fail: function (err) {
console.log(err);
if(err.errMsg.includes('deny')) _this.setData({
showAuth:true
})
},
complete(res) {
// console.log(res);
}
});
}
});
},
/**授权失败 */
authFail() {
this.setData({
unauthorized: true
})
},
/**授权成功 */
authSuccess() {
this.saveClick()
},
}
})
\ No newline at end of file
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file
<block wx:if="{{show}}">
<view class="model" catchtouchmove="noScroll">
<view class="bgkf">
<glsx-image webp src="home/home-kf-bg.png"></glsx-image>
<view class="close-icon" bindtap="showFlex">
<glsx-image class="image-close"webp src="home/kf-close.png"></glsx-image>
</view>
<view class="qr-box">
<view class="userinfo-wrap">
<view class="icon">
<image class="image-icon" wx:if="{{customerlist[0].thumbAvatar}}" webp src="{{customerlist[0].thumbAvatar}}"></image>
<glsx-image class="image-icon" wx:else webp src="home/kf-persion-icon.png"></glsx-image>
</view>
<view class="name">{{customerlist[0].staffName || ''}}</view>
<view class="mobile" wx:if="{{customerlist[0].staffPhone}}">
<glsx-image class="image-mobile" webp src="home/kf-mobile.png"></glsx-image>
<text>{{customerlist[0].staffPhone}}</text>
</view>
<view class="qr-icon">
<glsx-image webp src="home/home-kf-qr-bg.png"></glsx-image>
<view class="qr-code">
<image webp src="{{customerlist[0].qrCode}}" show-menu-by-longpress="{{customerlist[0].qrCode}}"></image>
</view>
</view>
</view>
</view>
<view class="kf-text">
<view class="text-left kf-text-view" ><glsx-image class="kf-image" webp src="home/home-Kf-down.png"></glsx-image><text>保存图片\n到相册</text></view>
<view class="kf-text-view"><glsx-image webp class="kf-image" src="home/home-Kf-phone.png"></glsx-image><text>打开微信扫一扫添加客服企微</text></view>
</view>
<view class="save-btn">
<view class="btn text-center" bindtap="saveClick">
保存
</view>
</view>
</view>
</view>
</block>
<authorize scopeType="writePhotosAlbum" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
\ No newline at end of file
.model {
position: fixed;
left: 0;
right: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
z-index: 100;
}
.close-icon{
width:48rpx;
height:48rpx;
position: absolute;
right: 16rpx;
top: -68rpx;
}
.close-icon .image-close{
width:48rpx;
height:48rpx;
}
.model .bgkf {
width: 600rpx;
height: 700rpx;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
.model .qr-box {
height: 560rpx;
width: 100%;
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
}
.model .bgkf .icon {
width: 104rpx;
height: 104rpx;
border-radius: 50%;
position: absolute;
top: -28rpx;
}
.model .bgkf .icon .image-icon {
border-radius: 50%;
}
.userinfo-wrap {
display: flex;
align-items: center;
flex-direction: column
}
.qr-box .text {
font-size: 32rpx;
font-weight: 500;
color: #282829;
line-height: 44rpx;
}
.qr-box .name {
font-size: 36rpx;
font-weight: 500;
color: #282829;
line-height: 50rpx;
margin: 80rpx 0 0 0;
text-align: center;
}
.qr-box .mobile{
font-size: 32rpx;
font-weight: 500;
line-height: 44rpx;
display: inline-flex;
justify-content: center;
align-items: center;
margin-bottom: 20rpx;
}
.qr-box .mobile .image-mobile{
width: 24rpx;
height: 26rpx;
}
.qr-box .qr-icon {
width: 284rpx;
height: 284rpx;
position: relative;
}
.qr-box .qr-code {
width: 220rpx;
height: 220rpx;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
.kf-text{
width:100%;
height:140rpx;
position: absolute;
bottom: 0;
z-index: 2;
display: flex;
background: #F9F7F7;
border-radius: 0 0 10px 10px;
padding: 0 40rpx;
box-sizing: border-box;
}
.kf-text .kf-text-view{
flex: 1;
display: flex;
align-items: center;
justify-content: left;
font-weight: 400;
font-size: 12px;
margin-left: 20rpx;
color: #B1B1B3;
}
.kf-text .kf-image{
flex-shrink: 0;
width: 60rpx;
height: 60rpx;
margin-right: 12rpx;
}
.save-btn{
display: flex;
align-items: center;
justify-content: center;
margin-top: 32rpx;
}
.save-btn .btn{
width: 420rpx;
height: 80rpx;
background: var(--btnColor);
border-radius: 8rpx;
}
.save-btn .btn.text-center{
text-align: center;
line-height: 80rpx;
color: #ffffff;
font-size: 28rpx;
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ Component({
*/
properties: {
tab: Array,
subTab: Array,
openScroll: Boolean,
index: {
type: Number,
......@@ -27,7 +28,10 @@ Component({
data: {
count: 0,
to: '',
IMGURL: wx.$imgUrl
IMGURL: wx.$imgUrl,
activeTab: '',
activeSubTab: '',
subTo: ''
},
attached() {
......@@ -36,6 +40,20 @@ Component({
* 组件的方法列表
*/
methods: {
handleFixedTabChange(e) {
let { value } = e.currentTarget.dataset
this.setData({
activeTab: value,
to: `to-${value}`
})
},
handleDynamicTabChange(e) {
let { value } = e.currentTarget.dataset
this.setData({
activeSubTab: value,
subTo: `to-${value}`
})
},
click(e) {
let {
count
......
<block wx:if="{{openScroll}}">
<scroll-view class="tab-box {{align}}" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}">
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}" id="to-{{index}}">
<view class="text">{{item}}</view>
<view class="line">
<glsx-image class="line-image" src="home/tab-line.png"></glsx-image>
<view class="goods-tabs-container">
<!-- 第一行固定Tab -->
<scroll-view scroll-x class="fixed-tabs" scroll-into-view="{{to}}">
<block wx:for="{{tab}}" wx:key="index">
<view
class="tab-item {{activeTab === item.id ? 'active' : ''}}"
bindtap="handleFixedTabChange"
data-value="{{item.id}}"
id="to-{{item.id}}"
>
{{item.label}}
<view class="underline" wx:if="{{activeTab == item.id}}"></view>
</view>
</view>
</block>
</scroll-view>
</block>
</scroll-view>
<!-- 第二行动态Tab -->
<scroll-view scroll-x class="dynamic-tabs" scroll-into-view="{{subTo}}">
<block wx:for="{{subTab}}" wx:key="index">
<view
class="tab-item {{activeSubTab === item.id ? 'active' : ''}}"
bindtap="handleDynamicTabChange"
data-value="{{item.id}}"
id="to-{{item.id}}"
>
{{item.label}}
</view>
</block>
</scroll-view>
</view>
</block>
\ No newline at end of file
......@@ -2,78 +2,59 @@
@import "/assets/style/common.wxss";
.tab-box {
display: flex;
height: 68rpx;
.goods-tabs-container {
width: 100%;
box-sizing: border-box;
}
.tab-box ::-webkit-scrollbar{
display: none;
width: 0;
height: 0;
color: transparent;
}
.tab-box.left {
padding-left: 32rpx;
}
.left .tab {
padding-right: 40rpx;
flex-shrink: 0;
}
.flex .tab {
flex: 1;
}
.tab {
position: relative;
}
.tab .text {
height: 44rpx;
box-sizing: border-box;
color: #23272F;
font-size: 32rpx;
margin-bottom: 8rpx;
font-weight: 400;
display: flex;
flex-direction: column;
height: 100%;
padding: 24rpx;
}
.left .text {
justify-content: flex-start;
.fixed-tabs, .dynamic-tabs {
white-space: nowrap;
padding: 8rpx 0;
}
.flex .tab .text {
padding: 0;
.fixed-tabs .tab-item {
display: inline-flex;
flex-flow: column;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #5E6579;
font-weight: 500;
margin-right: 32rpx;
}
.tab.active .text {
font-weight: 500;
transition: all .25s;
color: #0A0D14;
.fixed-tabs .tab-item.active {
color: #FB8A32;
font-size: 28rpx;
}
.tab .line {
display: flex;
align-items: center;
justify-content: center;
transform: scale(0);
transition: all .25s;
.fixed-tabs .underline {
display: inline-block;
width: 36rpx;
height: 6rpx;
background-color: #FB8A32;
border-radius: 6rpx;
}
.tab .line .line-image {
width: 40rpx;
height: 16rpx;
.dynamic-tabs {
margin-top: 10rpx;
}
.tab.active .line {
transform: scale(1);
.dynamic-tabs .tab-item{
display: inline-block;
padding: 10rpx 24rpx;
margin-right: 16rpx;
border-radius: 24rpx;
font-size: 22rpx;
color: #666666;
background-color: #EBEFF3;
}
.tab-box::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
.dynamic-tabs .tab-item.active {
color: #FB8A32;
background-color: #FFF3EA;
}
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
// components/marquee/marquee.js
let timer = null
Component({
/**
* 组件的属性列表
*/
properties: {
data: {
type: String,
observer: function (n) {
if (n) this.begin()
}
},
delay: {
type: Number,
value: 1000
},
fontSize: {
type: Number,
value: 11
},
speed: {
type: Number,
value: 5000
}
},
/**
* 组件的初始数据
*/
data: {
flag: true,
show: true
},
/**
* 组件的方法列表
*/
methods: {
/**
* 获取宽度
*/
begin() {
let boxWidth = 0
let valueWidth = 0
wx.p.wxApi.getViewInfo(
'#marquee',
res => {
boxWidth = res.width
this.setData({
boxWidth
})
wx.p.wxApi.getViewInfo(
'#content',
contentInfo => {
valueWidth = contentInfo.width
if (boxWidth - 20 <= valueWidth) {
this.setData({
valueWidth,
isRun: true
})
this.run()
}
},
this
)
},
this
)
},
run() {
clearTimeout(timer)
let {
speed,
delay,
valueWidth
} = this.data
let animation = wx
.createAnimation({
duration: speed,
timingFunction: 'linear',
delay
})
.left(`-${valueWidth}px`)
.step()
this.setData({
animation: animation.export()
})
let time = Number(delay) + Number(speed) + 1000
timer = setTimeout(() => {
this.setData({
flag: false
})
this.again()
}, time)
},
again() {
clearTimeout(timer)
let {
boxWidth
} = this.data
let animation = wx
.createAnimation({
duration: 1,
timingFunction: 'linear'
})
.left(`${boxWidth}px`)
.step()
this.setData({
animation: animation.export()
})
timer = setTimeout(() => {
this.setData({
flag: true
})
this.reset()
}, 500)
},
reset() {
clearTimeout(timer)
let {
valueWidth,
boxWidth,
speed
} = this.data
let animation = wx
.createAnimation({
duration: speed * (boxWidth / valueWidth).toFixed(2),
timingFunction: 'linear'
})
.left('0%')
.step()
this.setData({
animation: animation.export()
})
timer = setTimeout(() => {
this.run()
}, Number(speed) + 1000)
},
},
pageLifetimes: {
show: function () {
this.setData({
show: true
})
this.begin()
},
hide: function () {
if (this.data.isRun) {
this.reset()
clearTimeout(timer)
this.setData({
show: false
})
}
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<block wx:if="{{show}}">
<view class="marquee-box" style="font-size:{{fontSize * 2}}rpx">
<view class="notice-title">
<glsx-image src="home/notice.png"></glsx-image>
</view>
<view class="box" id="marquee" style="min-height:{{fontSize / 0.55 * 2}}rpx">
<view class="content" id="content" style="opacity:{{flag?1:0}};" animation="{{animation}}">
<block wx:if="{{data}}">{{data}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
</view>
</view>
</block>
\ No newline at end of file
.marquee-box {
margin: 0 20rpx;
padding: 12rpx 0 12rpx 8rpx;
box-sizing: border-box;
display: flex;
align-items: center;
flex-shrink: 0;
color: #666666;
}
.marquee-box .notice-title {
width: 76rpx;
height: 36rpx;
}
.marquee-box .box {
width: calc(100% - 12rpx);
margin-left: 12rpx;
position: relative;
overflow: hidden;
color: #666666;
}
.marquee-box .box .content {
width: auto;
height: 100%;
position: absolute;
top: 50%;
left: 0;
white-space: nowrap;
transform: translateY(-50%);
display: flex;
align-items: center;
}
\ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
init() {
this.getMemberCardData()
this.getMerchantDetail()
this.toCheckMember()
},
onPullDownRefresh() {
this.init()
},
getMerchantDetail() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.mineApi.getMerchantDetail({
merchantId
}).then(data => {
this.setData({
merchantDetail: data,
})
})
},
// 获取用户会员信息
toCheckMember() {
// wx.p.router.intercept(false).then(res => {
// if (res) {
// this.setData({
// isMember: false,
// })
// } else {
// wx.p.api.equityApi.checkOpenMember().then(res => {
// let isMember = false
// if (res.data && res.data.validitDate) {
// res.data.time = new Date(res.data.validitDate).format('yyyy.MM.dd')
// }
// if (res.code == 0 && res.data) {
// isMember = true
// }
// this.setData({
// isMember
// })
// })
// }
// })
},
// 获取门店会员卡信息
getMemberCardData() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.equityApi.memberCard({
merchantId
}).then(res => {
this.setData({
memberInfo: res,
flag: true
})
})
},
callPhone() {
let item = this.data.merchantDetail
wx.makePhoneCall({
phoneNumber: item.residentPhone.toString()
})
},
toBuyMember() {
wx.p.router.go('/packageEquity/pages/open/open', {
notIntercept: true
})
},
jump() {
const {
memberInfo
} = this.data
if (memberInfo.equityName) wx.p.router.switchTab('/pages/tab/equity/index')
}
},
lifetimes: {
ready() {
this.init()
}
},
pageLifetimes: {
show() {
this.toCheckMember()
},
hide() {
if (!this.data.memberInfo) this.setData({
flag: false
})
}
},
})
\ No newline at end of file
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file
<view class="store-equity-box">
<view class="store-box">
<view class="store-img">
<glsx-image src="home/store-icon.png"></glsx-image>
</view>
<view class="store-name">{{merchantDetail.merchantName}}</view>
<view class="store-phone" bindtap="callPhone">
<glsx-image src="home/store-phone.png"></glsx-image>
</view>
</view>
<block wx:if="{{flag}}">
<view class="equity-box" bindtap="jump">
<view class="bg">
<glsx-image src="home/store-bg.png"></glsx-image>
</view>
<view class="content">
<glsx-image class="equity-icon" src="home/vip-icon.png"></glsx-image>
<text class="text">生活权益|专享超百种生活权益</text>
<block wx:if="{{!isMember}}">
<view class="content-view equity-btn" bindtap="toBuyMember">立即开通</view>
</block>
</view>
</view>
</block>
</view>
\ No newline at end of file
.store-equity-box {
display: flex;
flex-flow: column;
padding: 0 20rpx;
}
.store-box {
padding: 16rpx;
background: #FFFFFF;
box-shadow: 0 4rpx 12rpx 0 #0000001a;
border-radius: 16rpx;
display: flex;
z-index: 2;
align-items: center;
position: relative;
}
.store-img {
width: 200rpx;
height: 112rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.store-name {
font-weight: 500;
font-size: 32rpx;
color: #000000;
max-width: 50%;
}
.store-phone {
position: absolute;
right: 16rpx;
top: 50%;
transform: translateY(-50%);
width: 80rpx;
height: 104rpx;
}
.equity-box {
height: 92rpx;
width: 100%;
position: relative;
transform: translateY(-10rpx);
}
.equity-box .bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.equity-box .content {
width: 100%;
height: 100%;
padding: 10rpx 16rpx 0 16rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.equity-box .content .content-view {
height: 100%;
display: flex;
align-items: center;
}
.equity-box .content .equity-icon {
width: 32rpx;
height: 32rpx;
}
.equity-box .content .text {
font-size: 20rpx;
margin-left:12rpx;
background: linear-gradient(to right, #FDE8BF, #DDA15F);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.equity-box .content .text .money-text {
color: #8A303A;
}
.equity-box .content .equity-btn {
width: 136rpx;
height: 42rpx;
background-image: radial-gradient(circle at 12% 25%, #FDE8BF 0%, #DDA15F 98%);
border-radius: 11px;
font-size: 12px;
color: #0A0D14;
display: inline-block;
text-align: center;
line-height: 42rpx;
margin-left: auto;
}
\ No newline at end of file
......@@ -9,117 +9,140 @@ Page({
data: {
pageNum: 1,
goodsIndex: 0,
customerlist: []
customerlist: [],
navStyle : "background-color: transparent;",
animationData: {},
specialSaleArr: [{
id: 1,
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png',
saleName: '九阳专场'
}, {
id: 2,
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-bg.png',
saleName: '维达专场'
}],
tab: [{
id: '1',
label: '我能兑换'
}, {
id: '',
label: '全部'
}, {
id: '2',
label: '100积分以下'
}, {
id: '3',
label: '100-200积分'
}, {
id: '4',
label: '200-300积分'
}],
subTab: [{
id: '',
label: '全部品类'
}, {
id: '1',
label: '汽车保养'
}, {
id: '2',
label: '车载设备'
}, {
id: '3',
label: '个护清洁'
}, {
id: '4',
label: '休闲零食'
}],
goodsList: [{
goodsId: '1',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: 'Tempo得宝手帕纸',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '2',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '维达抽纸超韧整箱M码家用实惠装面巾纸',
salePoints: '69.9',
marketPrice: '79.9'
}, {
goodsId: '3',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png',
goodsName: '5100西藏冰川矿泉水整箱',
salePoints: '10',
marketPrice: '15.9'
}, {
goodsId: '4',
goodsUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/login/login-img.png',
goodsName: '洁柔Face纸巾抽纸3层',
salePoints: '10',
marketPrice: '15.9'
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getHomeConfig()
this.getActivityList()
onReady() {
this.startAnimation();
},
getActivityList() {
wx.p.wxApi.showLoading()
let total = 0
let {
activityList,
pageNum
} = this.data
wx.p.api.homeApi.getActivityList({
currentPage: pageNum,
type: 2,
activityStatusList: [1, 2]
})
.then(data => {
total = data.total
this.setData({
total,
activityList: pageNum > 1 ? [...activityList, ...data.list] : data.list // 防止多次请求 数据重复 page不变不concat数据
// 顶部公告动画
startAnimation: function() {
const query = wx.createSelectorQuery()
query.select('.text-container').boundingClientRect()
query.select('.text').boundingClientRect()
query.exec((res) => {
const containerWidth = res[0]?.width
const textWidth = res[1]?.width
// 只有文字宽度超过容器宽度时才滚动
if (textWidth > containerWidth) {
const animation = wx.createAnimation({
duration: (textWidth / 30) * 1000, // 根据文字长度调整滚动时间
timingFunction: 'linear',
delay: 0
})
this.getClassifyList(pageNum > 1 ? [...activityList, ...data.list] : data.list)
})
},
getClassifyList(list) {
wx.p.api.homeApi.getClassifyList().then(data => {
let tab = []
let classifyList = []
if (list.length) {
data.unshift({
classifyName: '秒杀',
goodsList: list
animation.translateX(-textWidth).step()
this.setData({
animationData: animation.export()
})
// 设置循环
setTimeout(() => {
this.resetAnimation();
}, (textWidth / 30) * 1000)
}
data.map(e => {
e.goodsList &&
e.goodsList.length &&
e.goodsList.map(i => {
i &&
i.length &&
i.map(c => {
c.goods.goodsStatistics = c.goodsStatistics
c.goods.id = c.goodsId
})
})
if (e.goodsList && e.goodsList.length) {
e.count = 0
// 处理数据
let [arr, obj] = [
[], {}
]
e.goodsList.forEach((val, id) => {
if (val instanceof Array) {
val.forEach((item, index) => {
arr.push(item)
})
obj = {
goodsData: arr
}
} else {
val.classifyName = e.classifyName
arr.push(val)
obj = {
activityData: arr
}
}
})
classifyList.push(obj)
tab.push(e.classifyName)
}
})
this.setData({
goodsFlag: true,
classifyList,
tab
})
wx.hideLoading()
})
},
//获取banner
getHomeConfig(refresh) {
wx.p.api.homeApi.getHomeConfig().then(data => {
let {
noticeContent
} = data
//在线客服
let customerlist = []
if (data.customerServerName && data.customerServerOrCode) {
customerlist.push({
staffName: data.customerServerName,
qrCode: data.customerServerOrCode,
thumbAvatar: data.customerServerAvatar,
staffPhone: data.customerServerPhone
})
}
let bannerList = []
if (data.bannerList && data.bannerList.length) bannerList = data.bannerList
this.setData({
noticeContent,
bannerList
})
this.filterKfList(data)
if (refresh) this.selectComponent('#channels').init(false)
resetAnimation: function() {
const animation = wx.createAnimation({
duration: 0,
timingFunction: 'linear',
delay: 0
})
animation.translateX(0).step()
this.setData({
animationData: animation.export()
})
setTimeout(() => {
this.startAnimation()
}, 50)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
// 跳转积分中心
handleToPointCenter() {
wx.p.router.go('/packageIndex/pages/integral/index/index')
},
// 查看公告政策详情
policyDetail() {
wx.p.router.jumpH5(`https://fgk.chinatax.gov.cn/zcfgk/c100012/c5241472/content.html`)
},
// 跳转专场
handleSpecialSale(e) {
console.log(e, 2222)
let { target } = e.currentTarget.dataset
wx.p.router.go('/packageIndex/pages/SpecialSale/SpecialSale', target)
},
changeTab(e) {
this.setData({
......@@ -145,14 +168,6 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.setData({
noticeContent: ''
})
this.getHomeConfig(true)
this.getActivityList()
this.selectComponent('#storeQuity').onPullDownRefresh()
},
onReachBottom() {
let {
pageNum,
......
{
"usingComponents": {
"store-equity":"./components/store-equity/store-equity",
"notice-bar": "./components/noticeBar/noticeBar",
"banner": "./components/banner/banner",
"good-tab": "./components/good-tab/good-tab",
"goods": "./components/goods/goods",
"activity": "./components/activity/activity",
"customer": "./components/customer/customer"
"goods": "/components/goods/goods",
"search-box": "./components/SearchBox/SearchBox"
},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
"backgroundColor": "#F9F7F7",
"enablePullDownRefresh": true
"backgroundColor": "#F9F7F7"
}
/* pages/tab/index/pages/index/index.wxss */
page {
background-color: #F9F7F7;
background-color: #F8F9FC;
}
.home-top {
height: 88rpx;
display: flex;
align-items: center;
padding-left: 30rpx;
}
.flex {
display: flex;
align-items: center;
.page-title {
text-align: center;
font-size: 34rpx;
font-weight: 600;
color: #FFFFFF;
}
.scroll-bg {
position: absolute;
.bg {
width: 100%;
height: 480rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/index-bg.png') no-repeat;
background-size: 100% 480rpx;
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
.logo {
z-index: 10;
}
.logo image {
width: 176rpx;
height: 34rpx;
}
.widget-box {
margin-left: 16rpx;
width: 112rpx;
height: 40rpx;
.container-box {
height: 100vh;
overflow: hidden;
}
.layout {
.container {
box-sizing: border-box;
position: relative;
padding-top: 16rpx;
background: transparent;
.notice-bar {
height: 56rpx;
border-radius: 8rpx;
margin: 6rpx 0 16rpx;
overflow: auto;
.points-box {
margin: 20rpx 20rpx 0 0;
display: flex;
align-items: center;
justify-content: flex-end;
.points-btn {
box-sizing: border-box;
min-width: 210rpx;
height: 68rpx;
background: #FFFFFF;
border-radius: 34rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12rpx 0 20rpx;
.icon {
display: inline-block;
width: 28rpx;
height: 28rpx;
margin-right: 6rpx;
}
.points-num {
display: inline-block;
color: #FF334F;
font-size: 44rpx;
font-weight: 700;
}
}
}
.layout {
width: 100%;
box-sizing: border-box;
margin-top: 148rpx;
background-image: linear-gradient(180deg, #ffffffb3 0%, #FFFFFF 9%);
border-radius: 24rpx 24rpx 0 0;
padding: 20rpx 0;
border: 2rpx solid #FFFFFF;
border-bottom: 0;
backdrop-filter: blur(20rpx);
.notic-box {
box-sizing: border-box;
margin: 0 20rpx 16rpx 20rpx;
width: calc(100% - 40rpx);
height: 64rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/notic-bg.png') no-repeat;
background-size: 100% 64rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 14rpx 0 20rpx;
position: relative;
.text-container {
width: calc(100% - 100rpx);
height: 40rpx;
overflow: hidden;
white-space: nowrap;
position: relative;
.text {
color: #FFFFFF;
font-size: 24rpx;
font-weight: 500;
display: inline-block;
position: absolute;
}
}
.detail-btn {
flex-shrink: 0;
width: 80rpx;
height: 44rpx;
margin-left: 8rpx;
position: relative;
text {
position: absolute;
top: 6rpx;
left: 10rpx;
font-size: 20rpx;
color: #F75454;
font-weight: 500;
}
}
}
.special-sale-box {
padding: 0 20rpx;
background-color: #F8F9FC;
.item {
width: 100%;
height: 340rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
overflow: hidden;
position: relative;
.item-name {
width: 166rpx;
height: 78rpx;
position: absolute;
left: 0;
top: 0;
background: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/points-mall/index/special-sale.png') no-repeat;
background-size: 166rpx 78rpx;
color: #FFFFFF;
padding: 10rpx 20rpx;
}
&:last-child {
margin-bottom: 0;
}
}
}
.goods-content {
box-sizing: border-box;
.goods-box-title {
position: sticky;
top: 0;
left: 0;
color: #0A0D14;
font-size: 32rpx;
font-weight: 600;
padding: 24rpx;
background-color: #F8F9FC;
}
.goods-box {
background: #FFFFFF;
border-radius: 24rpx 24rpx 0 0;
width: 100%;
box-sizing: border-box;
overflow: hidden;
}
}
}
}
.bg-box {
width: 100%;
height: 446rpx;
overflow: hidden;
position: absolute;
left: 0;
}
.bg {
width: 100%;
height: 100%;
position: absolute;
z-index: -1;
top: 0;
left: 0;
}
.menu-box {
margin-top: 14rpx;
}
.sticky {
background: #F9F7F7;
padding: 10rpx 0;
}
.wx {
position: fixed;
right: 0;
bottom: 245rpx;
width: 96rpx;
height: 96rpx;
z-index: 100;
}
.hidden-top {
animation: hideToTop .5s forwards;
}
.show-top {
animation: showToTop .5s forwards;
}
@keyframes hideToTop {
0% {
transform: translateX(0);
}
100% {
transform: translateX(80rpx);
}
}
@keyframes showToTop {
0% {
transform: translateX(40rpx);
}
100% {
transform: translateX(0);
}
}
.nothing {
flex-direction: column;
font-size: 28rpx;
color: #858A94;
}
.nothing .icon {
width: 320rpx;
height: 320rpx;
margin-bottom: 8rpx;
}
.widget .icon {
width: 100%;
height: 200%;
position: relative;
}
.online-text {
font-size: 16rpx;
color: #2A69FF;
}
.split-line {
padding-bottom: 20rpx;
text-align: center;
}
.split-line .split-title {
display: flex;
width: 100%;
justify-content: center;
align-items: center;
font-weight: 500;
font-size: 16px;
color: #000;
}
.split-line .split-title .line {
width: 60rpx;
height: 4rpx;
border-radius: 2px;
}
.split-line .split-title .left-line {
background-image: linear-gradient(90deg, #fcedcd00 0%, #8A303A 100%);
margin-right: 71rpx;
}
.split-line .split-title .right-line {
background-image: linear-gradient(90deg, #8A303A 0%, #fcedcd00 100%);
margin-left: 71rpx;
}
.split-line .split-text {
margin-top: 10rpx;
width: 100%;
font-family: PingFangSC-Regular;
font-size: 12px;
color: #858A94;
}
.goods-bottom {
padding: 20rpx 0;
text-align: center;
font-size: 24rpx;
color: #999999;
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!