Commit 5cd9f8cf by 李伟康

提交代码

1 parent f2930326
Showing 118 changed files with 4269 additions and 215 deletions
import api from '../request/http'
module.exports = {
/**获取集团或者门店详细信息 */
getMerchantDetail(data) {
return api.post({
method: 'scrm.api.carlife.merchant.detail',
...data
})
}
}
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
module.exports = {
/**查询商户的指定类型专区列表 */
getZoneInfo(zoneType) {
return api.post({
method: `scrm.api.shopmall.zoneInfo.weapp.listByMerchantId`,
zoneType //专区类型(1发现频道,2商城专区)
})
},
}
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
module.exports = {
/**获取商户小程序首页配置 */
getHomeConfig(data) {
return api.post({
method: `scrm.api.shopmall.weapp.homeConfig.getByMerchant`,
...data
})
},
/**查询当前商户的分类列表 */
getClassifyList(data) {
return api.post({
method: `scrm.api.shopmall.classify.weapp.listByMerchantId`,
...data
})
},
/** 分页查询活动 */
getActivityList(data) {
return api.post({
method: 'scrm.api.shopmall.weapp.activity.page',
pageSize: 10,
...data
})
},
}
\ No newline at end of file \ No newline at end of file
import wechatApi from './wechat' import wechatApi from './wechat'
import entmicroApi from './entmicro' import entmicroApi from './entmicro'
import userApi from './user' import userApi from './user'
module.exports = {wechatApi,entmicroApi,userApi}
\ No newline at end of file \ No newline at end of file
import homeApi from './home'
import discoveryApi from './discovery'
import shopmallApi from './shopmall'
import mineApi from './mine'
module.exports = {
wechatApi,
entmicroApi,
userApi,
homeApi,
discoveryApi,
shopmallApi,
mineApi
}
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
module.exports = {
/**获取集团或者门店详细信息 */
getMerchantDetail(data) {
return api.post({
method: 'scrm.api.carlife.merchant.detail',
...data
})
},
/**获取当前用户的收货地址列表 */
getUserAddressList(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.list`,
...data
})
},
/**根据ID获取用户收货地址 */
getUserAddress(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.getById`,
...data
})
},
/** 新增用户收货地址 */
addUserAddress(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.add`,
...data
})
},
/**编辑用户收货地址 */
updateUserAddress(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.update`,
...data
})
},
/** 更改为默认收货地址 */
setUserAddressDefault(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.updateDefault`,
...data
})
},
/** 删除用户收货地址 */
delUserAddress(data) {
return api.post({
method: `scrm.api.carlife.weapp.userAddress.delete`,
...data
})
},
/** 获取用户默认收货地址 */
getUserAddressDefault() {
return api.fetch('scrm.api.carlife.weapp.userAddress.getDefault')
},
}
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
module.exports = {
/** 分页查询商城专区的商品信息 */
getGoodsList(data) {
return api.post({
method: `scrm.api.shopmall.zoneInfo.weapp.goodsPage`,
pageNum: 1,
pageSize: 999,
...data
})
},
/** 添加购物车 */
addShoppingcart(data) {
return api.post({
method: `scrm.api.shopmall.weapp.shoppingcart.add`,
...data
})
},
/** 购物车删除商品 */
delShoppingcart(data) {
return api.post({
method: `scrm.api.shopmall.weapp.shoppingcart.delete`,
...data
})
},
/** 分页获取购物车 */
getShoppingcartList(data) {
return api.post({
method: `scrm.api.shopmall.weapp.shoppingcart.list`,
...data
})
},
/** 购物车商品变更(比如修改数量) */
updateShoppingcart(data) {
return api.post({
method: `scrm.api.shopmall.weapp.shoppingcart.update`,
...data
})
},
/** 领取确认订单最大优惠券 */
getMaxCoupon(orderGoods) {
return api.fetch('scrm.api.shopmall.weapp.order.coupons.get', {
orderGoods
})
},
/**购物车结算 */
settlementShoppingcart(data) {
return api.post({
method: `scrm.api.shopmall.weapp.shoppingcart.settlement`,
...data
})
},
/** 创建订单(立即购买) */
createOrder(data) {
return api.post({
method: `scrm.api.shopmall.weapp.order.create`,
...data
})
},
/**创建支付订单(去付款) */
payOrder(data) {
return api.post({
method: `scrm.api.shopmall.weapp.order.createPay`,
...data
})
},
}
\ No newline at end of file \ No newline at end of file
...@@ -55,7 +55,7 @@ class UsersApi { ...@@ -55,7 +55,7 @@ class UsersApi {
/**授权手机号 */ /**授权手机号 */
async authUserPhone(detail, sessionId) { async authUserPhone(detail, sessionId) {
if (!sessionId) { if (!sessionId) {
wx.$api.showToast('缺少sessionId') wx.p.wxApi.showToast('缺少sessionId')
Promise.reject({ Promise.reject({
errMsg: '缺少sessionId' errMsg: '缺少sessionId'
}) })
...@@ -63,19 +63,15 @@ class UsersApi { ...@@ -63,19 +63,15 @@ class UsersApi {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject() if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
wx.$api.showLoading() wx.p.wxApi.showLoading()
detail.sessionId = sessionId detail.sessionId = sessionId
wx.$storage.rm('userInfo')
wx.$storage.rm('sessionId')
return http.fetch('scrm.api.sso.weapp.auth.phone', detail) return http.fetch('scrm.api.sso.weapp.auth.phone', detail)
} else Promise.reject(detail.errMsg) } else Promise.reject(detail.errMsg)
} }
/**退出登录 */ /**退出登录 */
logout() { logout() {
return fetcht({ return http.fetch('scrm.api.sso.user.logout')
method: 'scrm.api.sso.wechat.applets.logout'
})
} }
/** 手机号获取短信验证码 */ /** 手机号获取短信验证码 */
getSmsCode(mobile) { getSmsCode(mobile) {
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"tabBar": { "tabBar": {
"color": "#5A6066", "color": "#937F82",
"selectedColor": "#3666FE", "selectedColor": "#8A303A",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "white", "borderStyle": "white",
"list": [ "list": [
...@@ -63,20 +63,26 @@ ...@@ -63,20 +63,26 @@
{ {
"root": "packageMall", "root": "packageMall",
"pages": [ "pages": [
"pages/index/index" "pages/index/index",
"pages/shoppingCart/shoppingCart",
"pages/pay/pay"
] ]
}, },
{ {
"root": "packageMine", "root": "packageMine",
"pages": [ "pages": [
"pages/index/index" "pages/index/index",
"pages/setting/index",
"pages/address/index/index",
"pages/address/detail/detail"
] ]
} }
], ],
"usingComponents": { "usingComponents": {
"calendar": "/components/Calendar/Calendar", "calendar": "/components/Calendar/Calendar",
"navigation-bar": "/components/NavigationBar/NavigationBar", "navigation-bar": "/components/NavigationBar/NavigationBar",
"glsx-image": "/components/image/index" "glsx-image": "/components/image/index",
"authorize": "/components/Authorize/Authorize"
}, },
"style": "v2", "style": "v2",
"resolveAlias": { "resolveAlias": {
......
...@@ -4,8 +4,8 @@ page { ...@@ -4,8 +4,8 @@ page {
background-color: #F7F7F7; background-color: #F7F7F7;
color: #282829; color: #282829;
font-size: 28rpx; font-size: 28rpx;
--themeColor: #F13C3D; --themeColor: #8A303A;
--btnColor: #FC5B32; --btnColor: #8A303A;
--borderRadius: 8rpx; --borderRadius: 8rpx;
--margin: 32rpx; --margin: 32rpx;
/* 兼容 IOS<11.2 先constant再env */ /* 兼容 IOS<11.2 先constant再env */
......

1.71 KB | W: | H:

6.29 KB | W: | H:

assets/images/equity.png
assets/images/equity.png
assets/images/equity.png
assets/images/equity.png
  • 2-up
  • Swipe
  • Onion skin

1.74 KB | W: | H:

5.93 KB | W: | H:

assets/images/equity_active.png
assets/images/equity_active.png
assets/images/equity_active.png
assets/images/equity_active.png
  • 2-up
  • Swipe
  • Onion skin

1.42 KB | W: | H:

4.43 KB | W: | H:

assets/images/home.png
assets/images/home.png
assets/images/home.png
assets/images/home.png
  • 2-up
  • Swipe
  • Onion skin

1.63 KB | W: | H:

4.83 KB | W: | H:

assets/images/home_active.png
assets/images/home_active.png
assets/images/home_active.png
assets/images/home_active.png
  • 2-up
  • Swipe
  • Onion skin

928 Bytes | W: | H:

2.22 KB | W: | H:

assets/images/mall.png
assets/images/mall.png
assets/images/mall.png
assets/images/mall.png
  • 2-up
  • Swipe
  • Onion skin

1.49 KB | W: | H:

5.07 KB | W: | H:

assets/images/mall_active.png
assets/images/mall_active.png
assets/images/mall_active.png
assets/images/mall_active.png
  • 2-up
  • Swipe
  • Onion skin

1.34 KB | W: | H:

5.36 KB | W: | H:

assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
  • 2-up
  • Swipe
  • Onion skin

1.47 KB | W: | H:

6.3 KB | W: | H:

assets/images/mine_active.png
assets/images/mine_active.png
assets/images/mine_active.png
assets/images/mine_active.png
  • 2-up
  • Swipe
  • Onion skin
/**app.wxss**/ /**app.wxss**/
.flex {
display: flex;
align-items: center;
}
.sticky { .sticky {
position: sticky; position: sticky;
......
// components/Authorize/Authorize.js // components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -39,7 +35,7 @@ Component({ ...@@ -39,7 +35,7 @@ Component({
} }
}, },
observers: { observers: {
'show': function (newVal) { show: function (newVal) {
this.setData({ this.setData({
openSet: newVal openSet: newVal
}) })
...@@ -48,9 +44,7 @@ Component({ ...@@ -48,9 +44,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -58,15 +52,10 @@ Component({ ...@@ -58,15 +52,10 @@ Component({
/** /**
* 禁止滑动 * 禁止滑动
*/ */
noScroll: wx.p.util.noScroll(), noScroll(){},
cancel(e) { cancel(e) {
let { let { confirm } = e.currentTarget.dataset
confirm let { buttonType, title } = this.data
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let _this = this let _this = this
if (buttonType == 'getUserInfo' && confirm) { if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({ wx.getUserProfile({
...@@ -87,11 +76,7 @@ Component({ ...@@ -87,11 +76,7 @@ Component({
/**检验是否已授权位置 */ /**检验是否已授权位置 */
check() { check() {
const _this = this const _this = this
let { let { buttonType, scopeType, autoOpen } = this.properties
buttonType,
scopeType,
autoOpen
} = this.properties
if (buttonType != 'getPhoneNumber') { if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}` let type = `scope.${scopeType}`
buttonType = 'openSetting' buttonType = 'openSetting'
...@@ -128,12 +113,9 @@ Component({ ...@@ -128,12 +113,9 @@ Component({
} }
}) })
} }
}, },
/**授权手机号 */ /**授权手机号 */
getPhoneNumber({ getPhoneNumber({ detail }) {
detail
}) {
console.log(detail) console.log(detail)
this.triggerEvent('getphonenumber', detail) this.triggerEvent('getphonenumber', detail)
} }
...@@ -144,4 +126,4 @@ Component({ ...@@ -144,4 +126,4 @@ Component({
}, },
hide: function () {} hide: function () {}
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
}, // 是否显示确定按钮 }, // 是否显示确定按钮
calenderColor: { calenderColor: {
type: String, type: String,
value: '#FC5B32' value: '#8A303A'
}, // 日历主题色 }, // 日历主题色
previous: { previous: {
type: Number, type: Number,
......
// components/glTextarea/glTextarea.js
import { haveEmoji, replaceEmoji } from '~/utils/emoji'
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
customMaxLength: Boolean,
placeholder: String,
showWordLimit: Boolean,
disabled: Boolean,
value: String,
textStyle: String,
filterEmoji: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
edit: true,
value: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
setValue(value) {
let { customMaxLength, maxlength } = this.data
if (this.properties.filterEmoji) {
if (haveEmoji(value)) value = replaceEmoji(value)
}
if (customMaxLength && maxlength != -1) value = value.substring(0, maxlength)
this.setData({ value })
return value
},
textareaInput(e) {
let { value } = e.detail
value = this.setValue(value)
this.triggerEvent('input', {
value
})
},
textareaBlur(e) {
let { value } = e.detail
this.setData({
edit: true
})
value = this.setValue(value)
this.triggerEvent('blur', {
value
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<text class='textarea' bindtap="openTextarea"
style="color:{{value?'#282829':'#B1B1B3'}}; {{textStyle}}">{{value||placeholder||'请输入'}}</text>
</block>
<block wx:else>
<textarea class='_textarea_' maxlength="{{customMaxLength?-1:maxlength}}" value='{{value}}'
bindinput='textareaInput' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur'></textarea>
</block>
<block wx:if='{{maxlength>0&&showWordLimit}}'>
<view class='wordLimit'>
{{value.length||0}} / {{maxlength}}
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/glTextarea/glTextarea.wxss */
.textarea-box {
width: 100%;
min-height: 120rpx;
position: relative;
height: 100%;
}
.textarea-box .textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
line-height: 32rpx;
word-break: break-all;
}
._textarea_ {
width: 100%;
height: calc(100% - 40rpx);
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
// components/navigationBar/navigationBar.js // components/navigationBar/navigationBar.js
// import {
// componentsMixin
// } from '../../mixins/index'
Component({ Component({
// behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
navStyle: String, navStyle: String,
custom: Boolean, custom: Boolean,
showBack: Boolean,
pageTitle: { pageTitle: {
type: String, type: String,
value: '', value: '',
...@@ -40,11 +37,26 @@ Component({ ...@@ -40,11 +37,26 @@ Component({
* 获取自定义导航栏信息 * 获取自定义导航栏信息
*/ */
wx.getSystemInfo().then(res => { wx.getSystemInfo().then(res => {
let { fontSizeSetting, statusBarHeight, screenWidth } = res let {
const { height, right, width, top } = wx.getMenuButtonBoundingClientRect() fontSizeSetting,
let navigationBarHeight = height + (top - statusBarHeight) * 2 + 4 // 4 statusBarHeight,
screenWidth
} = res
const {
height,
right,
width,
top
} = wx.getMenuButtonBoundingClientRect(),
currentPages = getCurrentPages(), {
showBack
} = this.data
if (showBack && currentPages.length > 1) this.setData({
SHOWBACK: true
})
let navigationBarHeight = height + ((top - statusBarHeight) * 2)
let navigationBarPadding = screenWidth - right let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width * 2)
this.setData({ this.setData({
statusBarHeight, statusBarHeight,
navigationBarHeight, navigationBarHeight,
...@@ -57,10 +69,12 @@ Component({ ...@@ -57,10 +69,12 @@ Component({
}) })
}) })
}, },
emit({ navigationBarHeight, statusBarHeight }) { emit({
navigationBarHeight,
statusBarHeight
}) {
let navHeight = navigationBarHeight + statusBarHeight let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.p.router.getPageInstance() const thisPage = wx.p.router.getPageInstance()
const currentPages = getCurrentPages()
this.triggerEvent('navbarReady', { this.triggerEvent('navbarReady', {
height: navHeight, height: navHeight,
statusBarHeight statusBarHeight
...@@ -72,10 +86,9 @@ Component({ ...@@ -72,10 +86,9 @@ Component({
navHeight, navHeight,
statusBarHeight statusBarHeight
}) })
if (currentPages.length == 1 && !thisPage.rootName) },
thisPage.setData({ back() {
showHomeBtn: true wx.p.router.back()
})
} }
}, },
lifetimes: { lifetimes: {
...@@ -84,4 +97,4 @@ Component({ ...@@ -84,4 +97,4 @@ Component({
this.setPageTitle() this.setPageTitle()
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
<view class="navigation-bar" id="navigation-bar" <view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}"> <block wx:if="{{!custom}}">
<block wx:if="{{!custom}}"> <view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}"> <block wx:if="{{SHOWBACK}}">
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}"> <view class="back " bindtap="back">
<slot></slot> <image class="img" src="./images/icon-back.png" />
</view> </view>
</view> </block>
</block> <view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
<block wx:else> <slot/>
<slot></slot> </view>
</block> </view>
</block>
<block wx:else>
<slot/>
</block>
</view> </view>
\ No newline at end of file \ No newline at end of file
/* components/navigationBar/navigationBar.wxss */ /* components/navigationBar/navigationBar.wxss */
.navigation-bar{ .navigation-bar {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
...@@ -8,16 +8,18 @@ ...@@ -8,16 +8,18 @@
background-color: #fff; background-color: #fff;
transition: all .15s; transition: all .15s;
} }
.navigation-bar-box{
.navigation-bar-box {
position: relative; position: relative;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-sizing: border-box; box-sizing: border-box;
} }
.navigation-bar-titleText{
.navigation-bar-titleText {
color: #333333; color: #333333;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -27,18 +29,29 @@ ...@@ -27,18 +29,29 @@
text-align: center; text-align: center;
letter-spacing: 1rpx; letter-spacing: 1rpx;
} }
.back-box{
.back-box {
width: 76rpx; width: 76rpx;
height: 100%; height: 100%;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
} }
.back{
.back {
position: absolute; position: absolute;
left: 20rpx; left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 36rpx; width: 100rpx;
height: 36rpx; /* height: 34rpx; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back .img {
width: 16rpx;
height: 34rpx;
} }
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "确认订单"
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/pay/pay.wxss */
@import "../shoppingCart/shoppingCart.scss";
.address-box {
padding: var(--margin) 20rpx;
height: 164rpx;
background-color: #fff;
border-radius: var(--borderRadius);
box-sizing: border-box;
margin-bottom: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.address-box .left {
width: 580rpx;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-left: 8rpx;
}
.address-box .left .top {
display: flex;
align-items: center;
}
.address-box .default {
width: 120rpx;
height: 40rpx;
font-size: 24rpx;
color: #fff;
background-color: var(--themeColor);
border-radius: 4rpx;
margin: 0 20rpx;
flex-shrink: 0;
}
.address-box .bottom{
color: #B1B1B3;
}
.address-box .phone {
margin-left: auto;
}
.address-box .right {
width: calc(100% - 580rpx);
justify-content: flex-end;
}
.address-box .right .icon {
width: 16rpx;
height: 28rpx;
}
.content-box{
padding-left: 24rpx;
background-color: #fff;
border-radius: 8px;
}
.merchantName{
display: flex;
height: 82rpx;
align-items: center;
padding-right: 24rpx;
border-bottom: 2rpx solid #EFF0F2;
}
.box .item .content .goods-info {
width: 100%;
}
.text .description {
font-size: 24rpx;
margin-top: 4rpx;
color: #B1B1B3;
}
.tips {
box-sizing: border-box;
height: 100rpx;
padding: 0 var(--margin);
border-radius: var(--borderRadius);
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
color: #666;
background-color: #fff;
}
.tips .price {
font-size: 36rpx;
color: var(--btnColor);
font-weight: 500;
}
.goods-action .left {
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 360rpx);
font-size: 24rpx;
}
.goods-action .left .total{
width: auto;
}
.discounts {
margin-top: 24rpx;
position:relative;
}
.discounts .selected {
height: 40rpx;
background: rgba(252, 91, 50, 0.12);
border-radius: 4rpx;
font-size: 24rpx;
font-weight: 500;
color: #8A303A;
line-height: 40rpx;
padding:0 20rpx;
position:absolute;
left:104rpx;
top: 50%;
transform: translate(0, -50%);
}
/*支付成功*/
.modal-container{
background: rgba(0,0,0,0.8000);
z-index: 9999;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.modal-body{
width: 83%;
height: 364rpx;
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.modal-body .icon{
width: 100rpx;
height: 100rpx;
margin-top: 48rpx;
}
.modal-body .text{
font-size: 32rpx;
font-weight: 500;
color: #2D2D2E;
margin-top: 24rpx;
}
.modal-body .btn{
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 1rpx;
border-top: 1rpx solid #e5e5e5;
height: 98rpx;
font-size: 32rpx;
font-weight: 500;
color: #8A303A;
}
.flex_ccc{
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
<view class="layout" style="padding-bottom:{{padding_bottom }}px">
<view class="box">
<block wx:if="{{addressFlag}}">
<block wx:if="{{shopFlag && shopCartFlag}}">
<view class="address-box" bindtap="jump">
<block wx:if="{{contactInfo.contactAddress}}">
<view class="left">
<view class="top">
<view class="name text-hide">{{contactInfo.contactName}}</view>
<block wx:if="{{isDefault}}">
<view class="default text-center">默认地址</view>
</block>
<view class="phone">{{contactInfo.contactPhone}}</view>
</view>
<view class="bottom text-hide">{{contactInfo.contactAddress}}</view>
</view>
</block>
<block wx:else>
选择收货地址
</block>
<view class="right text-center">
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</view>
</block>
</block>
<view class="content-box">
<view class="merchantName text-hide">
{{merchantName}}
</view>
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item">
<view class="content">
<view class="goods-info">
<view class="preview">
<image webp src="{{item.goodsImage}}"></image>
</view>
<view class="text">
<view class="name">
<view class="text-hide">
{{item.goodsName}}
</view>
<view class="text-hide description">{{item.specificationData || ''}}</view>
</view>
<view class="price-box">
<view class="price">
<text class="unit">¥</text>{{item.retailPrice}}
</view>
<view wx:if="{{!isPay}}">
x{{item.goodsNumber}}
</view>
<stepper wx:if="{{isPay}}" count="{{item.goodsNumber}}" max="{{item.stock}}" data-id="{{isActivity?item.goodsId:item.id}}" bindchange="changeCount" data-index="{{index}}"></stepper>
</view>
</view>
</view>
</view>
</view>
</block>
</view>
<block wx:if="{{expressFee != null}}">
<view class="tips" wx:if="{{shopFlag}}">
运费:
<view class="price">¥{{expressFee}}</view>
</view>
</block>
<block wx:if="{{!isActivity}}">
<block wx:if="{{orderCouponDTO}}">
<view class="tips discounts" bindtap="showCouponFun">
优惠:
<block wx:if="{{orderCouponDTO.isChecked}}">
<view class="selected">已选一张</view>
<view class="price">-¥{{(orderCouponDTO.denomination)/100}}</view>
</block>
<block wx:else>
<view>不使用优惠券</view>
</block>
</view>
</block>
</block>
</view>
</view>
<coupon-goods show="{{showCoupon}}" order="{{1}}" couponData="{{userCouponDTOS}}" bindclick="changeCoupon"></coupon-goods>
<block wx:if="{{addressFlag}}">
<goods-action bindready="goodsActionReady" custom>
<view class="goods-action">
<view class="left">
<view class="radio">
共{{goodsNumber}}件,合计:
</view>
<view class="total">
<view class="price">
<text class="unit">¥</text>{{money|| 0}}
</view>
</view>
</view>
<view class="btn text-center" bindtap="checkOut">结算({{goodsList.length}})</view>
</view>
</goods-action>
</block>
<!-- 支付成功 -->
<view wx:if="{{showSuccessModal}}" class="modal-container flex_ccc">
<view class="modal-body">
<image webp src="{{IMGURL}}equity/return_success.png?v={{img_version}}" class="icon"></image>
<view class="text">支付成功</view>
<view class="btn flex_ccc" catch:tap="closeSuccessModal">我知道了</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// components/Stepper/Stepper.js
Component({
/**
* 组件的属性列表
*/
properties: {
count: Number,
min: {
type: Number,
value: 1
},
max: {
type: Number,
value: 99,
observer(n) {
if (n && this.data.count > n) {
this.setData({ count: n })
this.triggerEvent('change', Number(n))
}
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
let { value } = e.detail
let {
max,
} = this.data
if (value > max) value = max
this.setData({ count: value })
},
tap() { },
blur(e) {
let { value } = e.detail
let {
min,
} = this.data
if (value < min) value = min
this.setData({ count: value })
this.triggerEvent('change', Number(value))
},
change(e) {
let {
add
} = e.currentTarget.dataset
let num = add ? 1 : -1
let {
count,
min,
max
} = this.data
if (count == min && !add) return
if (count == max && add) return
count += num
this.triggerEvent('change', Number(count))
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="stepper-box">
<view class="minus count-box text-center {{count == min?'opacity':''}}" catchtap="change"></view>
<input class="num count-box text-center" type="number" catchinput="input" value="{{count}}" catchblur="blur" catchtap="tap" />
<view class="add count-box text-center {{count == max?'opacity':''}}" catchtap="change" data-add>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Stepper/Stepper.wxss */
@import '/style/common.wxss';
.stepper-box {
display: flex;
align-items: center;
}
.stepper-box .count-box {
width: 52rpx;
height: 52rpx;
background: #F0F0F0;
margin-left: 7rpx;
font-size: 26rpx;
text-align: center;
color: #323233;
font-weight: normal;
position: relative;
}
.stepper-box .count-box.opacity::after ,.stepper-box .count-box.opacity::before{
opacity: .25;
}
.stepper-box .minus {
border-radius: 7rpx 0 0 7rpx;
background: transparent;
}
.stepper-box .num {
width: 59rpx;
}
.stepper-box .add {
border-radius: 0 7rpx 7rpx 0;
background: transparent;
}
.stepper-box .add::before,
.stepper-box .add::after,
.stepper-box .minus::after {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
content: '';
background-color: #2C2C2C;
border-radius: 2rpx;
}
.stepper-box .add::before,.stepper-box .minus::after {
width: 25rpx;
height: 2rpx;
}
.stepper-box .add::after{
width: 2rpx;
height: 25rpx;
}
\ No newline at end of file \ No newline at end of file
Page({
/**
* 页面的初始数据
*/
data: {
goodsList: [],
chooseIndex: null
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
jump() {
wx.p.router.switchTab('/pages/tab/mall/index')
},
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
this.setData({
[`goodsList[${index}].list[${ind}].goodsNumber`]: count
})
if (chooseIndex == index) this.cheackAll(index)
wx.p.wxApi.showLoading('正在加载...')
let params = {
id: item.id,
goodsId: item.goodsId,
goodsNumber: count
}
if (item.specificationKey) params.specificationKey = item.specificationKey
wx.p.api.shopmallApi.updateShoppingcart(params).then(res => {
wx.hideLoading()
})
},
choose(e) {
let {
index,
ind
} = e.currentTarget.dataset
let {
goodsList,
chooseIndex
} = this.data
if (chooseIndex != null && chooseIndex != index) return
if (goodsList[index].list[ind].showDel) {
this.hide(e)
return
}
this.setData({
[`goodsList[${index}].list[${ind}].active`]: !goodsList[index].list[ind].active
})
this.cheackAll(index)
},
cheackAll(index) {
let count = 0
let sum = 0
let {
goodsList
} = this.data
let allActive = true
try {
goodsList[index].list.map(e => {
if (!e.active) throw false
})
} 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
})
},
chooseAll(e) {
let {
index
} = e.currentTarget.dataset
let {
goodsList,
chooseIndex
} = this.data
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)
},
checkOut() {
let {
chooseIndex,
goodsList
} = this.data
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
})
})
},
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('删除成功')
wx.$Track.setTrack({
id,
type: '购物车移除商品'
},
7
)
setTimeout(() => {
this.getShoppingcartList()
}, 1.5 * 1000)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
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
})
},
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 \ No newline at end of file
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"stepper": "./components/Stepper/Stepper"
}
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/shoppingCart/shoppingCart.wxss */
.nothing-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: #fff;
}
.nothing {
padding-top: 140rpx;
text-align: center;
color: #B1B1B3;
}
.nothing .icon {
margin: 0 auto 8rpx;
width: 322rpx;
height: 320rpx;
}
.nothing .btn {
margin: 64rpx auto 0;
width: 332rpx;
height: 88rpx;
border-radius: 8rpx;
border: 2rpx solid #B1B1B3;
color: #656566;
font-size: 32rpx;
}
.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;
}
.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;
}
.box .item .content .icon,
.box .item .content .goods-info .preview {
margin-right: 20rpx;
}
.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;
}
.box .item .content .goods-info .text {
width: calc(100% - 180rpx);
height: 160rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.box .item .content .goods-info .text .price-box {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.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;
justify-content: space-between;
align-items: center;
}
.goods-action .btn {
width: 332rpx;
height: 80rpx;
color: #FFFFFF;
background: var(--btnColor);
border-radius: var(--borderRadius);
font-weight: 500;
}
.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 \ No newline at end of file
<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">
<image webp src="{{IMGURL}}mall/shoppingcart.png?v={{img_version}}" />
</view>
购物车还是空的
<view class="btn text-center" bindtap="jump">随便看看</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="name text-hide">
{{item.payeeMerchantName}}
</view>
</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">
<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>
<view class="del text-center" catchtap="del" data-id="{{i.id}}">删除</view>
</view>
</block>
</view>
</view>
</block>
</view>
</block>
</block>
</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>
<view class="btn text-center" bindtap="checkOut">结算({{count||0}})</view>
</view>
</goods-action>
</block>
\ No newline at end of file \ No newline at end of file
// packageEquity/pages/serviceApply/util/components/areaSelect.js
Component({
/**
* 组件的属性列表
*/
properties: {
provinceShow:Boolean,
provinceList:{
type:Array,
observer: function(val) {
this.setData({
provinceList: val
})
}
}
},
/**
* 组件的初始数据
*/
data: {
region: [0, 0, 0],//地址每列的index
regionCode: [],
provinceList: []
},
/**
* 组件的方法列表
*/
methods: {
emitHideRegion(){},
// 省市切换
bindChange(e) {
// 用于对比滑动的是哪一列数据
const val = e.detail.value
if(this.data.region[0] !== val[0]) {
// 如果滑动的是第一列数据,让二三列恢复到0
this.setData({
region: [val[0], 0, 0]
})
} else if(this.data.region[1] !== val[1]) {
// 滑动的是第二列数据
this.setData({
region: [val[0], val[1], 0]
})
} else {
this.setData({
region: e.detail.value
})
}
},
// 确定提交
comfirm() {
const {provinceList, region} = this.data
// 省市code
const provinceCode = provinceList[region[0]].addressCode
const cityCode = provinceList[region[0]].children[region[1]].addressCode
const townCode = provinceList[region[0]].children[region[1]].children[region[2]].addressCode
const codeData = [provinceCode,cityCode,townCode]
// 省市名称
const provinceName = provinceList[region[0]].addressName
const cityName = provinceList[region[0]].children[region[1]].addressName
const townName = provinceList[region[0]].children[region[1]].children[region[2]].addressName
const provinceNameData = [provinceName,cityName,townName]
this.triggerEvent('getProvinceCode',{codeData,provinceNameData})
this.triggerEvent('cancelProvince')
},
// 取消
cancel() {
this.triggerEvent('cancelProvince')
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
.dialog_mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
background: rgba(0, 0, 0, 0.5);
}
.dialog_container {
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 70%;
background: white;
border-radius: 40rpx 40rpx 0 0;
box-shadow: 0px -2rpx 4rpx 0px rgba(0, 0, 0, 0.06);
z-index: 9999;
}
.header {
height: 112rpx;
box-sizing: border-box;
padding: 0 32rpx;
}
.header .cancle {
font-size: 28rpx;
font-weight: 500;
color: #969799;
}
.header .title {
font-size: 32rpx;
font-weight: 500;
color: #323233;
}
.header .comfirm {
font-size: 28rpx;
font-weight: 500;
color: #8A303A;
}
.main{
height: calc(100% - 112rpx);
box-sizing: border-box;
padding: 0 32rpx;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
\ No newline at end of file \ No newline at end of file
<view wx:if="{{provinceShow}}" class="dialog_mask {{provinceShow?'dialog_show':''}}">
<view class="dialog_mask" bindtap="cancel"></view>
<view class="dialog_container">
<view class="header flex_scb">
<view class="cancle" bindtap="cancel">取消</view>
<view class="title">城市地区</view>
<view class="comfirm" bindtap="comfirm">确定</view>
</view>
<view class="main">
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 100%;" value="{{region}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{provinceList}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{provinceList[region[0]].children}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{provinceList[region[0]].children[region[1]].children}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/address/detail/detail.js
import mapApi from '~/utils/mapapi/mapapi'
const phoneRex = /^[1]([3-9])[0-9]{9}$/
Page({
/**
* 页面的初始数据
*/
data: {
userObj: {
receiveName: '',
phoneNumber: '',
region: [],
address: '',
isDefault: 0,
platformObj:{}
}
},
onLoad: function (options) {
if (options.id) {
wx.setNavigationBarTitle({
title: '编辑收货地址'
})
wx.p.api.mineApi.getUserAddress(options).then(data => {
data = wx.p.util.clearObjNull(data)
data.region = [data.province, data.city, data.area]
this.setData({
userObj: data
})
})
}
if (options.isChooseAddress) {
this.setData({
isChooseAddress: true
})
}
if (options.isDefault) {
this.setData({
'userObj.isDefault': 1
})
}
},
useLocation() {
let {
currentAddress: { formatted_addresses, address_component, ad_info }
} = this.data
this.setData({
'userObj.address': formatted_addresses.recommend,
'userObj.region': [address_component.province, address_component.city, address_component.district],
'userObj.areaId': ad_info.adcode
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { },
/**获取当前位置 */
getLocation() {
let { currentAddress } = this.data
if (currentAddress) return
wx.getLocation({
type: 'gcj02'
})
.then(({ latitude, longitude }) => {
this.setData({
current: true,
unauthorized: false
})
mapApi.detailedAdrress([latitude, longitude]).then(detail => {
console.log(detail)
this.setData({
currentAddress: detail
})
})
})
.catch(err => {
console.log(err)
wx.p.wxApi.showToast('获取位置失败')
})
},
/**打开授权设置 */
authAddress() {
this.setData({
showAuth: true
})
},
/**授权失败 */
authFail() {
this.setData({
unauthorized: true
})
},
/**授权成功 */
authSuccess() {
this.getLocation()
},
input(e) {
let { target } = e.currentTarget.dataset
let { value } = e.detail
this.setData({
[`userObj.${target}`]: value
})
},
blur(e) {
let { value } = e.detail
this.setData({
'userObj.address': value
})
},
save() {
let { userObj, isChooseAddress } = this.data
try {
Object.keys(userObj).map(key => {
if (key == 'receiveName' && !userObj[key]) throw '请输入姓名'
if (key == 'phoneNumber') {
if (!userObj[key]) throw '请输入手机号'
if (!phoneRex.test(userObj[key])) throw '请输入正确的手机号'
}
if (Array.isArray(userObj[key]) && !userObj[key].length) throw '请选择省市区'
if (key == 'address' && !userObj[key]) throw '请填写详细地址'
})
} catch (error) {
wx.p.wxApi.showToast(error)
return
}
let [province, city, area] = userObj.region
let obj = {
...userObj,
province,
city,
area
}
delete obj.region
let target = obj.id ? 'updateUserAddress' : 'addUserAddress'
if (obj.id) {
delete obj.userId
delete obj.createTime
delete obj.updateTime
}
wx.p.api.mineApi[target](obj).then(() => {
wx.p.wxApi.showToast('操作成功')
setTimeout(() => {
if (isChooseAddress) {
wx.p.router.back(page => {
let contactAddress = `${province}${city}${area}${userObj.address}`
page.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: userObj.receiveName,
contactPhone: userObj.phoneNumber
}
})
}, 2)
} else {
wx.p.router.back()
}
}, 1.5e3)
})
},
/**选择地区 */
chooseArea(e) {
console.log(e)
let { value, code } = e.detail
let { userObj } = this.data
userObj.region = [value[0], value[1], value[2]]
userObj.provinceId = code[0]
userObj.cityId = code[1]
userObj.areaId = code[2]
this.setData({
userObj
})
},
setDefault() {
this.setData({
'userObj.isDefault': this.data.userObj.isDefault == 0 ? 1 : 0
})
},
showSelect(){
this.setData({
showAreaSelect:true
})
},
cancelProvince(){
this.setData({
showAreaSelect:false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () { },
/**
* 生命周期函数--监听页面显示
*/
onShow: function () { },
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () { }
})
{
"navigationBarTitleText": "新建收货地址",
"usingComponents":{
"area-select":"./components/AreaSelect/index",
"gl-textarea": "/components/GlTextarea/GlTextarea"
}
}
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/address/detail/detail.wxss */
@import '../index/index.scss';
.layout {
padding: var(--margin);
}
.current {
padding: var(--margin);
background: #fff;
border-radius:var(--borderRadius);
}
.current .address-box {
display: flex;
align-items: flex-start;
font-size: var(--margin);
justify-content: space-between;
position: relative;
}
.current .address-box .address-icon{
position: absolute;
width: 36rpx;
height: 36rpx;
left: 0;
}
.current .address-info {
width: calc(100% - 178rpx);
box-sizing: border-box;
padding-left: 68rpx;
}
.current .address-info .address-title {
font-weight: 500;
margin-bottom: 12rpx;
}
.current .address-info .address {
color: #656566;
font-size: 28rpx;
}
.current .address-btn {
font-size: 24rpx;
background-color: var(--themeColor);
width: 168rpx;
height: 40rpx;
color: #fff;
}
.user-info {
margin-top: 24rpx;
padding: 0 var(--margin);
background-color: #fff;
font-size: 28rpx;
}
.user-info .item {
min-height: 108rpx;
display: flex;
align-items: center;
border-bottom: 2rpx solid #E3E3E6;
box-sizing: border-box;
padding: 26rpx 0;
}
.user-info .textarea {
border-bottom: none;
}
.user-info .item .label {
width: 192rpx;
}
.user-info .item .value {
width: calc(100% - 192rpx);
font-size: 28rpx;
}
.user-info .textarea {
align-items: flex-start;
padding-top: 26rpx;
}
.user-info .textarea .value{
height: 120rpx;
}
.default {
display: flex;
align-items: center;
font-size: 24rpx;
color: #2D2D2E;
margin-top: 24rpx;
}
.default icon {
margin-right: 8rpx;
}
.default-btn{
margin-top: 206rpx;
}
\ No newline at end of file \ No newline at end of file
<view class="layout">
<view class="current">
<block wx:if="{{!current}}">
<block wx:if="{{unauthorized}}">
<view bindtap="authAddress">授权获取当前位置</view>
</block>
<block wx:else>
获取当前位置中...
</block>
</block>
<block wx:else>
<view class="address-box">
<view class="address-icon y-center">
<glsx-image src="mine/location.png"></glsx-image>
</view>
<view class="address-info">
<view class="address-title text-hide">{{currentAddress.formatted_addresses.recommend}}</view>
<view class="address text-hide">{{currentAddress.address}}</view>
</view>
<view class="address-btn text-center" bindtap="useLocation">使用当前定位</view>
</view>
</block>
</view>
<view class="user-info">
<view class="item">
<view class="label">
收货人
</view>
<view class="value">
<input bindblur="input" data-target="receiveName" maxlength="10" value="{{userObj.receiveName}}" type="text" placeholder="请输入姓名" placeholder-style="color:#B1B1B3;" />
</view>
</view>
<view class="item">
<view class="label">
手机号
</view>
<view class="value">
<input bindblur="input" data-target="phoneNumber" value="{{userObj.phoneNumber}}" type="number" maxlength="11" placeholder="请输入手机号" placeholder-style="color:#B1B1B3;" />
</view>
</view>
<picker value="{{userObj.region}}" mode="region" bindchange="chooseArea">
<view class="item">
<view class="label">
选择地区
</view>
<view class="value " style="color:{{userObj.region.length?'':'#B1B1B3'}}">
{{userObj.region[0]}}
<block wx:if="{{userObj.region.length}}">
{{userObj.region[0]}}{{userObj.region[1]}}{{userObj.region[2]}}
</block>
<block wx:else>请选择省/市/区</block>
</view>
</view>
</picker>
<view class="item textarea">
<view class="label">
详细地址
</view>
<view class="value">
<gl-textarea value="{{userObj.address}}" bindblur="blur" customMaxLength filterEmoji maxlength="30" placeholder="小区楼栋/乡村名称">
</gl-textarea>
</view>
</view>
</view>
<view class="default" bindtap="setDefault">
<block wx:if="{{userObj.isDefault == 1}}">
<icon type="success" size="24rpx" color="#8A303A"></icon>
</block>
<block wx:else>
<icon type="circle" size="24rpx" color="#E3E3E6"></icon>
</block>
设为默认地址
</view>
<view class="default-btn" bindtap="save">保存并使用</view>
</view>
<authorize scopeType="userLocation" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
// packageMine/pages/address/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
addressList: []
},
jump(e) {
let {
id,
} = e.currentTarget.dataset, {
isChooseAddress,
addressList,
} = this.data, isDefault = addressList.length == 0
wx.p.router.go('/packageMine/pages/address/detail/detail', {
id,
isChooseAddress,
isDefault
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData(options)
},
chooseThis(e) {
let {
item
} = e.currentTarget.dataset, {
isChooseAddress,
} = this.data
if (isChooseAddress) {
wx.p.router.back(page => {
const contactAddress = `${item.province}${item.city}${item.area}${item.address}`
page.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: item.receiveName,
contactPhone: item.phoneNumber
},
isDefault: item.isDefault == 1
})
})
} else {
wx.p.router.go('/packageMine/pages/address/detail/detail', {
id: item.id,
})
}
},
getUserAddressList() {
wx.showLoading()
this.setData({
addressList: []
})
wx.p.api.mineApi.getUserAddressList().then(data => {
this.setData({
addressList: data
})
wx.hideLoading()
})
},
chooseDefault(e) {
let {
item: {
id,
isDefault
},
item
} = e.currentTarget.dataset
if (isDefault != 0) return
wx.p.api.mineApi.setUserAddressDefault({
id
}).then(() => {
wx.p.wxApi.showToast('操作成功')
let {
isChooseAddress
} = this.data
if (isChooseAddress) {
wx.p.router.back(page => {
const contactAddress = `${item.province}${item.city}${item.area}${item.address}`
page.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: item.receiveName,
contactPhone: item.phoneNumber
},
isDefault: true,
})
})
} else {
this.getUserAddressList()
}
})
},
del(e) {
let {
id
} = e.currentTarget.dataset
wx.showModal({
title: '温馨提示',
content: '是否删除当前地址?',
cancelText: '否',
confirmText: '是',
confirmColor: '#F13C3D'
}).then(res => {
if (res.confirm) {
wx.p.api.mineApi.delUserAddress({
id
}).then(() => {
wx.p.wxApi.showToast('删除成功')
setTimeout(() => {
this.getUserAddressList()
}, 1.5e3)
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserAddressList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "我的地址"
}
\ No newline at end of file \ No newline at end of file
/* packageMine/pages/address/index/index.wxss *//* packageMine/pages/address/index/index.wxss */
.layout{
padding-bottom: calc(100rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(100rpx + var(--envSafeAreaInsetBottom));
}
.address-item{
margin: var(--margin);
background-color: #fff;
border-radius:var(--borderRadius);
min-height: 234rpx;
padding: 0 var(--margin);
}
.address-item .top{
display: flex;
align-items: center;
padding-top: 34rpx;
justify-content: space-between;
}
.address-item .top .info{
width: calc(100% - 70rpx);
padding-bottom: 20rpx;
}
.address-item .top .info .user{
margin-bottom: 20rpx;
}
.address-item .top .info .user text{
margin-left: 48rpx;
}
.address-item .top .icon-box{
width: 70rpx;
min-height: 154rpx;
}
.address-item .top .icon {
width: var(--margin);
height: var(--margin);
}
.address-item .bottom{
height: 78rpx;
border-top: 2rpx solid #E3E3E6;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
}
.address-item .bottom .choose {
display: flex;
align-items: center;
height: 100%;
}
.address-item .bottom .del {
display: flex;
align-items: center;
height: 100%;
color: #656566;
width: 100rpx;
justify-content: flex-end;
}
.address-item .bottom .choose.default{
color: var(--btnColor);
}
.address-item .bottom .choose icon{
margin-right: 20rpx;
}
.btn-box{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100rpx;
background-color: #fff;
}
.btn-box .btn{
margin: 6rpx var(--margin);
background-color:var(--btnColor);
height: 88rpx;
color: #fff;
font-size: var(--margin);
border-radius:var(--borderRadius);
}
\ No newline at end of file \ No newline at end of file
<view class="layout isFullSucreen">
<block wx:for="{{addressList}}" wx:key="index">
<view class="address-item" catchtap="chooseThis" data-item="{{item}}">
<view class="top">
<view class="info">
<view class="user">
{{item.receiveName}}
<text>{{platform?item.receiveMobile:item.phoneNumber}}</text>
</view>
<view wx:if="{{!platform}}" class="address">{{item.province}}{{item.city}}{{item.area}}{{item.address}}</view>
<view wx:if="{{platform}}" class="address">{{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.address}}</view>
</view>
<block wx:if="{{!isChooseAddress}}">
<view class="icon-box text-center" catchtap="jump" data-item="{{item}}" data-edit data-id="{{item.id}}">
<view class="sprite-icon icon-address-edit"></view>
</view>
</block>
</view>
<view class="bottom">
<view class="choose {{item.isDefault == 1?'default':''}}" catchtap="chooseDefault" data-item="{{item}}">
<icon type="{{item.isDefault == 1?'success':'circle'}}" size="28rpx" color="{{item.isDefault == 1?'#8A303A':'#E3E3E6'}}"></icon>
默认地址
</view>
<block wx:if="{{!isChooseAddress}}">
<view class="del" catchtap="del" data-item="{{item}}" data-id="{{item.id}}">删除</view>
</block>
</view>
</view>
</block>
</view>
<view class="btn-box isFullSucreen">
<view class="btn text-center" bindtap="jump">新增收货地址</view>
</view>
\ No newline at end of file \ No newline at end of file
Page({
/**
* 页面的初始数据
*/
data: {},
//退出登录
logout() {
wx.p.api.userApi.logout().then(async ({
code,
message
}) => {
if (code == '0') {
// wx.$Track.setTrack({}, 4)
wx.$authStatus = true
// wx.$util.removeSystemStorage()
wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId')
wx.p.router.back(prevPage => {
prevPage.setData({
userInfo: null,
isMember: false,
})
})
} else {
if (code == '21' || code == '20') {
try {
const res = await wx.p.api.userApi.login()
if(res.code == 0) this.logout()
else throw res.message
} catch (error) {
wx.p.wxApi.showToast(error)
}
} else wx.p.wxApi.showToast(message)
}
})
},
goAgreement() {
wx.p.router.jumpH5('https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/privacy.html', true)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "设置"
}
\ No newline at end of file \ No newline at end of file
page {
background-color: #F8F9FC;
}
.ctn {
margin-top: 8rpx;
}
.topCtn {
width: 100%;
height: 88rpx;
background-color: #fff;
display: flex;
justify-content: space-between;
box-sizing: border-box;
padding: 12rpx 48rpx;
line-height: 64rpx;
}
.text {
font-weight: 400;
font-size: 28rpx;
color: #0A0D14;
text-align: center;
}
.default-btn {
background: var(--btnColor);
border-radius: 8rpx;
position: fixed;
bottom: 70rpx;
}
.setting-icon {
width: 36rpx;
vertical-align: middle;
}
\ No newline at end of file \ No newline at end of file
<!--packageMine/pages/setting/index/index.wxml-->
<view class="ctn">
<view class="topCtn" bindtap="goAgreement">
<view class="text">隐私政策</view>
<view>
<image webp mode="widthFix" class="setting-icon" src="{{IMGURL}}index/setting-icon.png?v={{img_version}}"></image>
</view>
</view>
<view class="default-btn x-center" bindtap="logout">退出登录</view>
</view>
\ No newline at end of file \ No newline at end of file
// pages/Login/Login.js const phoneRex = /^[1]([3-9])[0-9]{9}$/
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
loginType: 0,
isAgree: false,
mobile: '',
captcha: '',
count: 0
}, },
changeLoginType() {
/** const {
* 生命周期函数--监听页面加载 loginType
*/ } = this.data
onLoad(options) { this.setData({
loginType: loginType == 0 ? 1 : 0
})
}, },
// 同意隐私政策
/** handleChangeAgree() {
* 生命周期函数--监听页面初次渲染完成 this.setData({
*/ isAgree: !this.data.isAgree
onReady() { })
}, },
/** // 跳转隐私政策页面
* 生命周期函数--监听页面显示 handleAgree(e) {
*/ const {
onShow() { name
} = e.currentTarget.dataset
wx.p.router.jumpH5(`https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/${name}.html`, true)
}, },
async onLoad() {
/** wx.p.wxApi.showLoading()
* 生命周期函数--监听页面隐藏 const {
*/ data
onHide() { } = await wx.p.api.userApi.login()
if (data) this.sessionId = data.sessionId
wx.hideLoading()
}, },
input(e) {
/** const {
* 生命周期函数--监听页面卸载 value
*/ } = e.detail, {
onUnload() { name
} = e.target.dataset
this.setData({
[name]: value
})
}, },
/**获取验证码 */
/** async getSmsCode() {
* 页面相关事件处理函数--监听用户下拉动作 const {
*/ mobile,
onPullDownRefresh() { count
} = this.data
try {
if (!phoneRex.test(mobile)) throw '请输入正确的手机号'
if (count) throw '验证码发送过于频繁,请稍后在试'
} catch (error) {
return wx.p.wxApi.showToast(error)
}
wx.p.wxApi.showLoading()
try {
const {
code,
message
} = await wx.p.api.userApi.getSmsCode(mobile)
if (code == '0') {
wx.p.wxApi.showToast('验证码已发送')
this.countDown(60)
} else wx.p.wxApi.showToast(message || '发送验证码失败')
} catch (error) {
wx.p.wxApi.showToast(error)
}
}, },
/**验证码倒计时 */
/** countDown(countDown) {
* 页面上拉触底事件的处理函数 if (countDown) this.setData({
*/ count: countDown
onReachBottom() { })
setTimeout(() => {
let {
count
} = this.data
this.setData({
count: --count
})
if (count > 0) this.countDown()
else this.setData({
count: null
})
}, 1e3)
},
showTips(message) {
wx.p.wxApi.showToast(typeof message == 'string' ? message : '请同意以下用户协议')
},
/**手机号短信登录 */
async phoneLogin() {
const {
mobile,
captcha,
isAgree
} = this.data
try {
if (!mobile) throw '请输入手机号'
if (!captcha) throw '请输入验证码'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号'
if (!isAgree) throw '请同意以下用户协议'
wx.p.wxApi.showLoading()
const {
code,
data,
message
} = await wx.p.api.userApi.phoneLogin({
mobile,
captcha,
sessionId: this.sessionId
})
if (code == '0') this.customerLoginCallBack(data)
else throw message
wx.hideLoading()
} catch (error) {
this.showTips(error || '服务不可用')
}
},
/**微信登录 */
async getPhoneNumber({
detail
}) {
const {
isAgree
} = this.data
try {
if (detail.errMsg.includes('deny')) return
if (!detail?.code) throw '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
if (!isAgree) throw '请同意以下用户协议'
wx.p.wxApi.showLoading()
const {
code,
data,
message
} = await wx.p.api.userApi.authUserPhone(detail, this.sessionId)
wx.hideLoading()
if (code == '0') this.customerLoginCallBack(data)
else throw message
} catch (error) {
console.log(error)
this.onLoad()
this.showTips(error || '服务不可用')
}
},
/**C端登录回调 */
customerLoginCallBack(data) {
wx.$authStatus = false
wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId)
// 返回上一页
wx.p.router.back(thisPage => {
thisPage.setData({
userInfo: data
})
})
}, },
/** back() {
* 用户点击右上角分享 wx.p.router.back()
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": {} "usingComponents": {},
"navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
/* pages/Login/Login.wxss */
\ No newline at end of file \ No newline at end of file
<!--pages/Login/Login.wxml--> <view class="layout">
<text>pages/Login/Login.wxml</text> <navigation-bar navStyle="background:transparent;" custom page-title="登录">
<view class="nav-bar flex">
<view class="back flex" bindtap="back">
<view class="icon">
<glsx-image src="login/login-back.png"></glsx-image>
</view>
</view>
登录
</view>
</navigation-bar>
<view class="content" style="margin-top: {{navHeight}}px;">
<block wx:if="{{loginType==0}}">
<view class="h1">
欢迎使用
<view class="logo">
<glsx-image src="login/logo.png"></glsx-image>
</view>
</view>
<view class="wx-box">
<block wx:if="{{!isAgree}}">
<button class="wx-auth-button text-center {{isAgree}}" bindtap="showTips">登录</button>
</block>
<block wx:else>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">登录</button>
</block>
</view>
</block>
<block wx:else>
<view class="h3">
手机号登录
</view>
<view class="box">
<view class="login-item flex">
<input maxlength="11" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写手机号" bindinput="input" data-name="mobile" class="input" value="{{mobile}}" />
</view>
<view class="login-item flex">
<input maxlength="4" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写验证码" bindinput="input" data-name="captcha" class="input" value="{{captcha}}" />
<button disabled="{{!mobile}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view>
</view>
<button class="wx-auth-button text-center" bindtap="phoneLogin">登录</button>
</block>
<view class="type-box flex">
<view class="title" bindtap="changeLoginType">
其他方式
</view>
<!-- <view class="type" bindtap="changeLoginType">
<view class="icon">
<glsx-image src="common/{{loginType == 0?'phone':'wx'}}.png"></glsx-image>
</view>
{{loginType == 0?'手机号':'微信登录'}}
</view> -->
</view>
<view class="tips text-center" bindtap="handleChangeAgree">
<view class="check {{isAgree}}">
<glsx-image src="login/check.png" class="icon"></glsx-image>
</view>
阅读并同意以下协议
<text class="txt-orange" catchtap="handleAgree" data-name="privacy">《隐私协议》</text>
<text class="txt-orange" catchtap="handleAgree" data-name="agreement">《服务使用协议》</text>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* pages/login/login.wxss */
page {
background-color: #000 !important;
}
.nav-bar {
height: 100%;
position: relative;
font-weight: 600;
font-size: 34rpx;
color: #FFFFFF;
justify-content: center;
}
.nav-bar .back {
height: 100%;
justify-content: center;
padding: 0 40rpx;
position: absolute;
top: 0;
left: 0;
}
.nav-bar .back .icon {
width: 16rpx;
height: 28rpx;
}
@keyframes opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.h1 {
padding: 20rpx 0;
font-size: 44rpx;
color: #fff;
text-align: center;
}
.h1 .logo {
width: 402rpx;
height: 144rpx;
margin: 44rpx auto 0;
}
.h3 {
font-weight: 500;
font-size: 44rpx;
color: #fff;
padding: 146rpx 106rpx 0;
}
.wx-box {
margin: 472rpx auto 0;
}
.wx-auth-button {
width: 590rpx !important;
height: 96rpx;
background: var(--btnColor);
border-radius: 16rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
padding: 0;
}
.wx-auth-button[disabled]:not([type]) {
background: #CCCED1 !important;
border-color: #CCCED1 !important;
color: #fff !important;
box-shadow: none;
}
.wx-auth-button[disabled]:not([type])::after {
border-color: #CCCED1 !important;
}
.type-box {
flex-direction: column;
margin-top: 33rpx;
font-size: 24rpx;
color: #8A8C90;
}
.type .icon {
width: 68rpx;
height: 68rpx;
margin: 40rpx auto 12rpx;
}
.tips {
font-size: 24rpx;
color: #C9C9C9;
position: fixed;
bottom: 56rpx;
left: 0;
width: 100%;
padding: 20rpx 0;
}
.tips .check {
width: 24rpx;
height: 24rpx;
box-sizing: border-box;
border-radius: 100%;
border: 2rpx solid #fff;
margin-right: 8rpx;
position: relative;
}
.tips .check.true {
border-color: var(--btnColor);
}
.tips .check .icon {
display: none;
width: 100%;
height: 100%;
}
.tips .check.true .icon {
display: block;
}
.txt-orange {
color: #fff;
}
/* 手机号 */
.box {
margin: 0 105rpx 306rpx;
animation: opacity .25s forwards;
}
.login-item {
height: 88rpx;
border-bottom: 2rpx solid #E3E3E6;
margin-top: 34rpx;
}
.login-item .input {
flex: 1;
}
.placeholderClass {
color: #CCCED1;
}
.code-btn {
font-size: 24rpx;
color: #5092FF;
flex-shrink: 0;
margin-left: auto;
padding: 0 !important;
width: fit-content !important;
}
.code-btn[disabled]:not([type]) {
background-color: transparent;
}
.code-btn::after {
display: none;
}
\ No newline at end of file \ 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('/packageShopmall/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: {}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<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>{{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>
<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 "/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 image {
flex: 0 0 48rpx;
height: 32rpx;
margin-right: 12rpx;
margin-top: 5rpx;
}
.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: #FF6038;
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>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: #FF6038;
display: flex;
}
.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: #FA2C18;
}
.time.start {
color: #FF9F0A;
}
.time.start .time-content {
background: #FF9F0A;
}
.time.end .time-content {
background: #FA2C18;
}
\ No newline at end of file \ No newline at end of file
// components/banner/banner.js
Component({
/**
* 组件的属性列表
*/
properties: {
bannerList: {
type: Array,
value: []
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
jumpGoods(e) {
let {
id,
url,
equity,
item
} = e.currentTarget.dataset
if (id) {
wx.p.router.go('/packageShopmall/packageMall/pages/detail/detail', {
id,
isActivity: false,
notIntercept: true
})
} else if (equity) {
wx.p.router.go('/packageShopmall/packageEquity/pages/allEquity/allEquity')
} else {
if (url) wx.p.router.go('/packageShopmall/packageIndex/pages/bannerJumpPage/bannerJumpPage', item)
}
},
changePage(e) {
let {
bannerList
} = this.data
bannerList.map(i => i.active = false)
let {
current
} = e.detail
bannerList[current].active = true
this.setData({
bannerList
})
},
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file \ No newline at end of file
<block>
<view class="banner">
<swiper class="swiper" bindchange="changePage" autoplay interval="5000">
<block wx:for="{{bannerList}}" wx:key="index">
<swiper-item>
<block>
<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>
</block>
</swiper-item>
</block>
</swiper>
<block wx:if="{{bannerList.length > 1}}">
<view class="banner-dots">
<block wx:for="{{bannerList}}" wx:key="index">
<view class="dots {{item.active?'active':''}}"></view>
</block>
</view>
</block>
</view>
</block>
.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: #2A69FF;
}
\ No newline at end of file \ No newline at end of file
// components/good-tab/good-tab.js
Component({
/**
* 组件的属性列表
*/
properties: {
tab: Array,
openScroll: Boolean,
index: {
type: Number,
observer: function (n) {
this.setData({
count: n,
to: `to-${n}`
})
}
},
align: {
type: String,
default: ''
}
},
/**
* 组件的初始数据
*/
data: {
count: 0,
to: '',
IMGURL: wx.$imgUrl
},
attached() {
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
count
} = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`
})
this.triggerEvent('click', count)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file \ No newline at end of file
<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 src="home/tab-line.png"></glsx-image>
</view>
</view>
</block>
</scroll-view>
</block>
\ No newline at end of file \ No newline at end of file
/* components/Tab/Tab.wxss */
@import "/style/common.wxss";
.tab-box {
display: flex;
height: 68rpx;
width: 100%;
box-sizing: border-box;
}
.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;
}
.left .text {
justify-content: flex-start;
}
.flex .tab .text {
padding: 0;
}
.tab.active .text {
font-weight: 500;
transition: all .25s;
color: #0A0D14;
}
.tab .line {
display: flex;
align-items: center;
justify-content: center;
transform: scale(0);
transition: all .25s;
}
.tab .line image {
width: 40rpx;
height: 16rpx;
}
.tab.active .line {
transform: scale(1);
}
.tab-box::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
\ No newline at end of file \ No newline at end of file
// components/Goods/Goods.js
import {
centsToyuan
} from '~/utils/format'
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
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({
list: val
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
IMGURL: wx.$imgUrl
},
/**
* 组件的方法列表
*/
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.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('/packageShopmall/packageMall/pages/detail/detail', {
id,
isActivity,
notIntercept: true
})
}
},
lifetimes: {
attached() {
this.setWidth()
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<wxs module="fn">
module.exports = {
priceFilter: function(e, num) {
return e.toString().split('.')[num] || ''
}
}
</wxs>
<view class="Goods">
<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}}" />
</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}}" />
</block>
</view>
<template name="item">
<view
class='item-box'
wx:if="{{item.goods}}"
bindtap='jump'
data-item="{{item}}">
<view class="preview">
<image webp src="{{item.goods.goodsImage}}" lazy-load></image>
</view>
<view class="item-box-content">
<view class='item-box-title'>
<image wx:if="{{item.goods.isMemberGoods}}" webp src="{{item.IMGURL}}index/member-goods-icon.png" />
<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>
</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">
<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>
<view wx:if="{{item.goods.freeShipping}}" class="free-shipping">包邮</view>
</view>
</view>
</view>
</template>
</view>
/* components/Goods/Goods.wxss */
.Goods{
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding: 16rpx 20rpx 0;
box-sizing: border-box;
}
.Goods .left, .Goods .right {
display: inline-block;
vertical-align: top;
width: 50%;
}
.Goods .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: 28rpx;
color: #0A0D14;
}
.item-box-title image{
flex: 0 0 48rpx;
height: 32rpx;
margin-right: 12rpx;
margin-top: 5rpx;
}
.item-box-title text{
font-size: 28rpx;
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: #FF6038;
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: -10rpx;
}
.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: #FF6038;
}
.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 text{
margin-right: 16rpx;
}
.item-box-goods-label{
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;
}
.free-shipping{
margin-left: 8rpx;
padding: 0 8rpx;
}
// 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 \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ 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 \ 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 \ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {},
lifetimes: {
ready() {
// this.getMerchantDetail()
this.toCheckMember()
}
},
/**
* 组件的方法列表
*/
methods: {
getMerchantDetail() {
const merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
mineApi
.getMerchantDetail()
.then(data => {
if (data.bussinessBegintime) {
data.bussinessBegintime = data.bussinessBegintime.split(':')[0] + ':' + data.bussinessBegintime.split(':')[1]
}
if (data.bussinessEndtime) {
data.bussinessEndtime = data.bussinessEndtime.split(':')[0] + ':' + data.bussinessEndtime.split(':')[1]
}
this.setData({
merchantDetail: data
})
this.getConsultantInfo()
})
},
// 获取当前用户服务顾问
getConsultantInfo() {
let merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
if (merchantId) {
merchantId = Number(JSON.parse(merchantId))
}
let data = {
merchantId: merchantId
}
mineApi.getConsultantInfo(data).then(({
code,
data
}) => {
if (code == '0') {
this.setData({
consultant: data
})
}
})
},
// 获取用户会员信息
toCheckMember() {
wx.p.router.intercept(false).then(res => {
if (res) {
return this.setData({
memberInfo: undefined
})
} else {
wx.p.api.equityApi.checkOpenMember().then(res => {
if (res.data && res.data.validitDate) {
res.data.time = new Date(res.data.validitDate).format('yyyy.MM.dd')
}
if (res.code == 0 && res.data) {
// 获取门店会员卡信息
this.getMemberCardData()
}
})
}
})
},
// 获取门店会员卡信息
getMemberCardData() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
wx.p.api.equityApi.memberCard({
merchantId
}).then(res => {
this.setData({
memberInfo: res
})
})
},
callPhone() {
let item = this.data.merchantDetail
wx.makePhoneCall({
phoneNumber: item.residentPhone.toString()
})
},
toBuyMember() {
wx.navigateTo({
url: '/packageShopmall/packageEquity/pages/open/open'
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file \ 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">海马刀酒类旗舰店</view>
<view class="store-phone" bindtap="callPhone">
<glsx-image src="home/store-phone.png"></glsx-image>
</view>
</view>
<view class="equity-box">
<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="{{!memberInfo.equityName}}">
<view class="equity-btn" bindtap="toBuyMember">立即开通</view>
</block>
</view>
</view>
</view>
\ No newline at end of file \ 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;
}
.store-img {
width: 200rpx;
height: 112rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.store-name {
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
.store-phone {
margin-left: auto;
width: 56rpx;
height: 56rpx;
}
.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 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 \ No newline at end of file
const navStyle = 'background-color: transparent;'
Page({ Page({
// behaviors: [kfMixin], // behaviors: [kfMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
navStyle, pageNum: 1,
showPage:true goodsIndex: 0,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData(options) this.getActivityList()
},
navbarReady(e) {
let {
height
} = e.detail
this.setData({
navHeight: height
})
}, },
jump(){ getActivityList() {
wx.p.router.go('/packageIndex/pages/index/index',{ wx.p.wxApi.showLoading()
a:123, let total = 0
b:['555','苟利国家生死岂因祸福避趋之'], let {
c:{ activityList,
AA:321, pageNum
BB:'xxx' } = 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数据
})
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
})
} }
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() {
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
})
})
},
changeTab(e) {
this.setData({
goodsIndex: e.detail
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.getHomeConfig()
}, },
/** /**
...@@ -50,16 +148,26 @@ Page({ ...@@ -50,16 +148,26 @@ Page({
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh() {
this.setData({
noticeContent: ''
})
this.getActivityList()
},
onReachBottom() {
let {
pageNum,
total
} = this.data
wx.p.util.onReachBottom({
pageNum,
total,
}, () => {
this.getActivityList()
})
}, },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {}
} })
})
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": { "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"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"onReachBottomDistance": 10, "onReachBottomDistance": 10,
"backgroundColor": "#FC5B32", "backgroundColor": "#F9F7F7",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
/* pages/tab/index/pages/index/index.wxss */ /* pages/tab/index/pages/index/index.wxss */
page { page {
background-color: #F8F9FC; background-color: #F9F7F7;
} }
...@@ -31,25 +31,24 @@ page { ...@@ -31,25 +31,24 @@ page {
} }
.widget-box { .widget-box {
font-size: 20rpx; margin-left: 16rpx;
margin-left: 26rpx; width: 112rpx;
color: #fff; height: 40rpx;
display: flex;
flex-flow: column;
align-items: center;
z-index: 10;
} }
.widget-box image {
height: 30rpx;
width: 34rpx;
}
.layout { .layout {
padding-bottom: 200rpx; padding-bottom: 200rpx;
position: relative; position: relative;
padding-top: 16rpx; padding-top: 16rpx;
background: transparent; background: transparent;
.notice-bar {
height: 56rpx;
border-radius: 8rpx;
margin: 6rpx 0 16rpx;
}
} }
.bg-box { .bg-box {
...@@ -74,7 +73,7 @@ page { ...@@ -74,7 +73,7 @@ page {
} }
.sticky { .sticky {
background: #F8F9FC; background: #F9F7F7;
padding: 10rpx 0; padding: 10rpx 0;
} }
...@@ -140,44 +139,6 @@ page { ...@@ -140,44 +139,6 @@ page {
color: #2A69FF; color: #2A69FF;
} }
.widget-box .flex-box {
position: relative;
display: flex;
border-radius: var(--borderRadius);
padding: 10rpx 20rpx 10rpx 100rpx;
/* background: linear-gradient(201deg, #7BA6FF 0%, #1C72FB 100%); */
box-sizing: border-box;
animation: showFlex .5s forwards;
font-size: 20rpx;
justify-content: space-between;
width: 320rpx;
}
.widget-box .flex-box .view {
opacity: 0;
animation: showView .1s forwards .5s;
}
@keyframes showFlex {
0% {
right: -1000%;
}
100% {
right: 0;
}
}
@keyframes showView {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.split-line { .split-line {
padding-bottom: 20rpx; padding-bottom: 20rpx;
text-align: center; text-align: center;
...@@ -188,10 +149,9 @@ page { ...@@ -188,10 +149,9 @@ page {
width: 100%; width: 100%;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-family: PingFangSC-Medium;
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
color: #0A0D14; color: #000;
} }
.split-line .split-title .line { .split-line .split-title .line {
...@@ -199,14 +159,14 @@ page { ...@@ -199,14 +159,14 @@ page {
height: 4rpx; height: 4rpx;
border-radius: 2px; border-radius: 2px;
} }
.split-line .split-title .left-line { .split-line .split-title .left-line {
background-image: linear-gradient(90deg, rgba(252, 237, 205, 0.00) 0%, #2A69FF 100%); background-image: linear-gradient(90deg, #fcedcd00 0%, #8A303A 100%);
margin-right: 71rpx; margin-right: 71rpx;
} }
.split-line .split-title .right-line { .split-line .split-title .right-line {
background-image: linear-gradient(90deg, #2A69FF 0%, rgba(252, 237, 205, 0.00) 100%); background-image: linear-gradient(90deg, #8A303A 0%, #fcedcd00 100%);
margin-left: 71rpx; margin-left: 71rpx;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!