Commit 5cd9f8cf by 李伟康

提交代码

1 parent f2930326
Showing 118 changed files with 5840 additions and 677 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
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
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
import wechatApi from './wechat'
import entmicroApi from './entmicro'
import userApi from './user'
module.exports = {wechatApi,entmicroApi,userApi}
\ 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
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
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
......@@ -55,7 +55,7 @@ class UsersApi {
/**授权手机号 */
async authUserPhone(detail, sessionId) {
if (!sessionId) {
wx.$api.showToast('缺少sessionId')
wx.p.wxApi.showToast('缺少sessionId')
Promise.reject({
errMsg: '缺少sessionId'
})
......@@ -63,19 +63,15 @@ class UsersApi {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
wx.$api.showLoading()
wx.p.wxApi.showLoading()
detail.sessionId = sessionId
wx.$storage.rm('userInfo')
wx.$storage.rm('sessionId')
return http.fetch('scrm.api.sso.weapp.auth.phone', detail)
} else Promise.reject(detail.errMsg)
}
/**退出登录 */
logout() {
return fetcht({
method: 'scrm.api.sso.wechat.applets.logout'
})
return http.fetch('scrm.api.sso.user.logout')
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
......
......@@ -16,8 +16,8 @@
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#5A6066",
"selectedColor": "#3666FE",
"color": "#937F82",
"selectedColor": "#8A303A",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [
......@@ -63,20 +63,26 @@
{
"root": "packageMall",
"pages": [
"pages/index/index"
"pages/index/index",
"pages/shoppingCart/shoppingCart",
"pages/pay/pay"
]
},
{
"root": "packageMine",
"pages": [
"pages/index/index"
"pages/index/index",
"pages/setting/index",
"pages/address/index/index",
"pages/address/detail/detail"
]
}
],
"usingComponents": {
"calendar": "/components/Calendar/Calendar",
"navigation-bar": "/components/NavigationBar/NavigationBar",
"glsx-image": "/components/image/index"
"glsx-image": "/components/image/index",
"authorize": "/components/Authorize/Authorize"
},
"style": "v2",
"resolveAlias": {
......
......@@ -4,8 +4,8 @@ page {
background-color: #F7F7F7;
color: #282829;
font-size: 28rpx;
--themeColor: #F13C3D;
--btnColor: #FC5B32;
--themeColor: #8A303A;
--btnColor: #8A303A;
--borderRadius: 8rpx;
--margin: 32rpx;
/* 兼容 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**/
.flex {
display: flex;
align-items: center;
}
.sticky {
position: sticky;
......
// components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
......@@ -39,7 +35,7 @@ Component({
}
},
observers: {
'show': function (newVal) {
show: function (newVal) {
this.setData({
openSet: newVal
})
......@@ -48,9 +44,7 @@ Component({
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
*/
......@@ -58,15 +52,10 @@ Component({
/**
* 禁止滑动
*/
noScroll: wx.p.util.noScroll(),
noScroll(){},
cancel(e) {
let {
confirm
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let { confirm } = e.currentTarget.dataset
let { buttonType, title } = this.data
let _this = this
if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({
......@@ -87,11 +76,7 @@ Component({
/**检验是否已授权位置 */
check() {
const _this = this
let {
buttonType,
scopeType,
autoOpen
} = this.properties
let { buttonType, scopeType, autoOpen } = this.properties
if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}`
buttonType = 'openSetting'
......@@ -128,12 +113,9 @@ Component({
}
})
}
},
/**授权手机号 */
getPhoneNumber({
detail
}) {
getPhoneNumber({ detail }) {
console.log(detail)
this.triggerEvent('getphonenumber', detail)
}
......@@ -144,4 +126,4 @@ Component({
},
hide: function () {}
}
})
\ No newline at end of file
})
......@@ -24,7 +24,7 @@ export default {
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#FC5B32'
value: '#8A303A'
}, // 日历主题色
previous: {
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
<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
/* 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
// import {
// componentsMixin
// } from '../../mixins/index'
Component({
// behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {
navStyle: String,
custom: Boolean,
showBack: Boolean,
pageTitle: {
type: String,
value: '',
......@@ -40,11 +37,26 @@ Component({
* 获取自定义导航栏信息
*/
wx.getSystemInfo().then(res => {
let { fontSizeSetting, statusBarHeight, screenWidth } = res
const { height, right, width, top } = wx.getMenuButtonBoundingClientRect()
let navigationBarHeight = height + (top - statusBarHeight) * 2 + 4 // 4
let {
fontSizeSetting,
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 navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width * 2)
this.setData({
statusBarHeight,
navigationBarHeight,
......@@ -57,10 +69,12 @@ Component({
})
})
},
emit({ navigationBarHeight, statusBarHeight }) {
emit({
navigationBarHeight,
statusBarHeight
}) {
let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.p.router.getPageInstance()
const currentPages = getCurrentPages()
this.triggerEvent('navbarReady', {
height: navHeight,
statusBarHeight
......@@ -72,10 +86,9 @@ Component({
navHeight,
statusBarHeight
})
if (currentPages.length == 1 && !thisPage.rootName)
thisPage.setData({
showHomeBtn: true
})
},
back() {
wx.p.router.back()
}
},
lifetimes: {
......@@ -84,4 +97,4 @@ Component({
this.setPageTitle()
}
}
})
})
\ No newline at end of file
<view class="navigation-bar" id="navigation-bar"
style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
<slot></slot>
</view>
</view>
</block>
<block wx:else>
<slot></slot>
</block>
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<block wx:if="{{SHOWBACK}}">
<view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" />
</view>
</block>
<view class="navigation-bar-titleText" style="{{navigationBarTextWidth}}">
<slot/>
</view>
</view>
</block>
<block wx:else>
<slot/>
</block>
</view>
\ No newline at end of file
/* components/navigationBar/navigationBar.wxss */
.navigation-bar{
.navigation-bar {
position: fixed;
top: 0;
left: 0;
......@@ -8,16 +8,18 @@
background-color: #fff;
transition: all .15s;
}
.navigation-bar-box{
.navigation-bar-box {
position: relative;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.navigation-bar-titleText{
.navigation-bar-titleText {
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
......@@ -27,18 +29,29 @@
text-align: center;
letter-spacing: 1rpx;
}
.back-box{
.back-box {
width: 76rpx;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.back{
.back {
position: absolute;
left: 20rpx;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 36rpx;
height: 36rpx;
width: 100rpx;
/* height: 34rpx; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back .img {
width: 16rpx;
height: 34rpx;
}
\ No newline at end of file
// packageMall/pages/pay/pay.js
let timer
Page({
/**
* 页面的初始数据
*/
data: {
contactInfo: {},
orderCouponDTO: '', //最大优惠券
userCouponDTOS: [], //优惠券列表,
couponCost: 0,
goodsNumber: 1,
isPay: false,
isCoupon: true,
shopFlag: true,
shopCartFlag: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.isPay) {
//单个商品进来
let {
isActivity,
params,
contactInfo,
goodsList,
goodsInfo
} = options
this.setData({
merchantName: goodsList.merchantName,
goodsInfo: goodsInfo,
goodsList: [goodsList],
orderParams: params,
addressFlag: true,
isPay: true,
contactInfo,
isDefault: options.isDefault,
isActivity
})
let orderGoods = this.data.orderParams.orderGoodsList
this.getMaxCoupon(orderGoods)
if (goodsInfo.deliveryType == 1) {
this.setData({
shopFlag: false
})
}
if (goodsInfo.deliveryType == 2) {
this.setData({
shopCartFlag: true
})
}
} else {
//购物车过来
let orderGoods = []
this.getUserAddressDefault()
options.goodsList.map(e => {
orderGoods.push({
goodsId: e.goodsId,
goodsNumber: e.goodsNumber
})
if (e.deliveryType == 2) {
this.setData({
shopCartFlag: true
})
}
})
this.setData({
...options
})
this.getMaxCoupon(orderGoods)
}
},
changeCount(e) {
console.log(e)
let {
index,
id
} = e.currentTarget.dataset
let goodsNumber = e.detail
let {
orderParams,
goodsList
} = this.data
goodsList[index].goodsNumber = goodsNumber
for (let i = 0; i < orderParams.orderGoodsList.length; i++) {
console.log(orderParams.orderGoodsList[i].goodsId == id)
if (orderParams.orderGoodsList && orderParams.orderGoodsList[i].goodsId == id) {
orderParams.orderGoodsList[i].goodsNumber = goodsNumber
this.setData({
orderParams
})
}
}
let orderGoods = this.data.orderParams.orderGoodsList
this.getMaxCoupon(orderGoods)
this.setData({
orderParams,
goodsList
})
},
getMoney() {
let {
isActivity,
goodsList,
couponCost,
isPay
} = this.data
let expressFeeArray = []
if (isActivity) {
couponCost = 0
}
let retailPrice = 0
let expressFee = 0
let goodsNumber = 0
let sum = 0
if (isPay) {
retailPrice = Number(goodsList[0].retailPrice)
expressFee = Number(goodsList[0].expressFee)
goodsNumber = Number(goodsList[0].goodsNumber)
sum = Number(retailPrice * goodsNumber + expressFee).toFixed(2)
} else {
goodsList.map(e => {
expressFeeArray.push(e.expressFee)
// expressFee += e.expressFee
goodsNumber += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
})
//取运费最大值
expressFeeArray.sort((a, b) => {
return b - a
})
expressFee = expressFeeArray[0]
sum = sum + expressFee
}
let money = (parseFloat(sum) - parseFloat(couponCost)).toFixed(2)
this.setData({
sum: sum,
expressFee,
goodsNumber,
money
})
},
//获取最大优惠券
getMaxCoupon(orderGoods) {
this.data.orderCouponDTO = ''
if (this.data.isCoupon && !this.data.isActivity) {
wx.p.api.shopmallApi.getMaxCoupon(orderGoods).then(res => {
if (res.code == 0 && res.data && res.data.orderCouponDTO && res.data.userCouponDTOS.length > 0) {
let {
orderCouponDTO,
userCouponDTOS
} = res.data
orderCouponDTO.isChecked = true
userCouponDTOS.forEach(item => {
item.id == orderCouponDTO.userCouponId ? (item.isChecked = true) : (item.isChecked = false)
})
if (orderCouponDTO && orderCouponDTO.denomination) {
this.data.couponCost = Number(orderCouponDTO.denomination / 100)
} else {
this.data.couponCost = 0
}
this.setData({
couponCost: this.data.couponCost,
orderCouponDTO: orderCouponDTO,
userCouponDTOS: userCouponDTOS
})
} else {
this.setData({
couponCost: 0,
orderCouponDTO: '',
userCouponDTOS: []
})
}
this.getMoney()
})
} else {
this.setData({
couponCost: 0
})
this.getMoney()
}
},
changeCoupon(e) {
if (e.detail) {
let userCouponDTOS = e.detail
let {
isCoupon,
couponCost
} = this.data
let orderCouponDTO = {}
if (userCouponDTOS.some(item => item.isChecked)) {
isCoupon = true
userCouponDTOS.forEach(item => {
if (item.isChecked) {
orderCouponDTO = {
goodIds: item.goodIds,
userCouponId: item.id,
couponName: item.couponName,
denomination: item.denomination,
full: item.full,
isChecked: true
}
}
})
} else {
orderCouponDTO.isChecked = false
isCoupon = false
}
if (orderCouponDTO && orderCouponDTO.denomination) {
couponCost = orderCouponDTO.denomination / 100
} else {
couponCost = 0
}
this.setData({
isCoupon: isCoupon,
couponCost: couponCost,
userCouponDTOS: userCouponDTOS,
orderCouponDTO: orderCouponDTO,
showCoupon: false
})
this.getMoney()
} else {
this.setData({
showCoupon: false
})
}
},
showCouponFun() {
this.setData({
showCoupon: true,
userCouponDTOS: this.data.userCouponDTOS
})
},
checkOut() {
try {
/**购物车 */
let ids = []
let {
contactInfo,
orderParams,
orderCouponDTO,
goodsList,
isPay,
goodsInfo,
shopCartFlag
} = this.data
goodsList.map(e => ids.push(e.id))
if (!isPay) {
//购物车结算
if (!contactInfo.contactAddress && shopCartFlag) {
wx.p.wxApi.showToast('请填写收货地址')
return
}
if (orderCouponDTO.isChecked) {
if (!shopCartFlag) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
orderCouponDTO
}
} else {
orderParams = {
...contactInfo,
orderCouponDTO
}
}
} else {
if (!shopCartFlag) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' '
}
} else {
orderParams = {
...contactInfo
}
}
}
wx.p.wxApi.showLoading()
wx.p.api.shopmallApi
.settlementShoppingcart({
...orderParams,
ids
})
.then(data => {
this.pay(data[0].orderCode)
})
} else {
//立即购买
if (orderCouponDTO.isChecked) {
if (goodsInfo.deliveryType == 1) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
...orderParams,
orderCouponDTO
}
} else {
orderParams = {
...contactInfo,
...orderParams,
orderCouponDTO
}
}
} else {
if (goodsInfo.deliveryType == 1) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
...orderParams
}
} else {
orderParams = {
...contactInfo,
...orderParams
}
}
}
// 添加推荐人
const staff = wx.p.storage.get('shareStaff')
if (staff) {
let tem = JSON.parse(staff)
orderParams.shareStaffUuid = tem.shareStaffUuid
orderParams.shareStaffName = tem.shareStaffName
}
clearTimeout(timer)
timer = setTimeout(() => {
wx.p.api.shopmallApi.createOrder(orderParams).then(data => {
this.pay(data.orderCode)
})
}, 500)
}
} catch (error) {
wx.hideLoading()
}
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
jump() {
wx.p.router.go('/packageMine/pages/address/index/index', {
isChooseAddress: true,
})
},
pay(orderCode) {
let _this = this
let {
isPay,
goodsList
} = this.data
wx.p.wxApi.showLoading('结算中...')
wx.p.api.shopmallApi
.payOrder({
orderCode
})
.then(({
needPay,
payParams
}) => {
wx.hideLoading()
wx.$Track.setTrack({
goodsList
},
7
)
if (needPay) {
let params = {
nonceStr: payParams.nonceStr,
paySign: payParams.paySign,
signType: payParams.signType,
timeStamp: payParams.timeStamp,
package: payParams.packages
}
wx.requestPayment({
...params,
success(res) {
_this.requestSubscribeMessage()
const staffTrack = wx.p.storage.get('shareStaffTracker')
if (staffTrack) {
let tem = JSON.parse(staffTrack)
tem.item_type = tem.isActivity ? 3 : 1
tem.action_type = 3
tem.item_id = tem.id
tem.order_id = orderCode
wx.$util.reportData(tem, false, false, true)
wx.p.storage.rm('shareStaffTracker')
}
wx.p.storage.rm('shareStaff')
},
fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.router.back(() => {}, isPay ? 1 : 2)
} else {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
params
})
}
}
})
} else {
this.setData({
showSuccessModal: true
})
// _this.requestSubscribeMessage()
}
})
},
requestSubscribeMessage() {
let systemInfo = wx.p.storage.get('system_info')
if (systemInfo && systemInfo.environment != 'wxwork') {
wx.p.router.reLaunch('/packageShopmall/packageMine/pages/order/complete/complete', {
success: true
})
return
}
let tmplIds
wx.p.api.shopmallApi.requestSubscribeMessage().then(res => {
tmplIds = res.data
wx.requestSubscribeMessage({
tmplIds: tmplIds,
success(res) {
console.log(res)
wx.p.router.reLaunch('/packageShopmall/packageMine/pages/order/complete/complete', {
success: true
})
}
})
})
},
getUserAddressList() {
if (this.platformShop) {
return
}
wx.p.api.mineApi.getUserAddressList().then(data => {
if (data && data.length < 1) {
this.setData({
contactInfo: {}
})
}
})
},
getUserAddressDefault() {
wx.p.api.mineApi.getUserAddressDefault().then(({
code,
data
}) => {
console.log(data)
if (code == '0') {
let contactAddress = data.address ? `${data.province}${data.city}${data.area}${data.address}` : ''
this.setData({
contactInfo: {
contactAddress,
contactName: data.receiveName,
contactPhone: data.phoneNumber
},
isDefault: data.isDefault == 1
})
}
this.setData({
addressFlag: true
})
})
},
closeSuccessModal() {
this.requestSubscribeMessage()
this.setData({
showSuccessModal: false
})
},
toPayOrder(orderCode) {
wx.p.api.shopmallApi.platformGoodsPayOrder({
orderCode,
paymentSource: 1
}).then(res => {
wx.hideLoading();
if (res) {
const {
timeStamp,
nonceStr,
packages,
signType,
paySign
} = res.payParams
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: nonceStr,
package: packages,
signType: signType,
paySign: paySign,
success() {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
success: true
})
},
fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.wxApi.showToast('取消支付')
}
}
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (!this.data.orderCode) this.getUserAddressList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file
{
"navigationBarTitleText": "确认订单"
}
\ 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
<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
// 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
{
"component": true,
"usingComponents": {}
}
\ 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
/* 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
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
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"stepper": "./components/Stepper/Stepper"
}
}
\ 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
<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
// 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
.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
<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
// 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
/* 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
<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
{
"navigationBarTitleText": "我的地址"
}
\ 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
<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
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
{
"usingComponents": {},
"navigationBarTitleText": "设置"
}
\ 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
<!--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
// pages/Login/Login.js
const phoneRex = /^[1]([3-9])[0-9]{9}$/
Page({
/**
* 页面的初始数据
*/
data: {
loginType: 0,
isAgree: false,
mobile: '',
captcha: '',
count: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
changeLoginType() {
const {
loginType
} = this.data
this.setData({
loginType: loginType == 0 ? 1 : 0
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
// 同意隐私政策
handleChangeAgree() {
this.setData({
isAgree: !this.data.isAgree
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 跳转隐私政策页面
handleAgree(e) {
const {
name
} = e.currentTarget.dataset
wx.p.router.jumpH5(`https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/${name}.html`, true)
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
async onLoad() {
wx.p.wxApi.showLoading()
const {
data
} = await wx.p.api.userApi.login()
if (data) this.sessionId = data.sessionId
wx.hideLoading()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
input(e) {
const {
value
} = e.detail, {
name
} = e.target.dataset
this.setData({
[name]: value
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
/**获取验证码 */
async getSmsCode() {
const {
mobile,
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)
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
/**验证码倒计时 */
countDown(countDown) {
if (countDown) this.setData({
count: countDown
})
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
})
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
back() {
wx.p.router.back()
}
})
\ No newline at end of file
{
"usingComponents": {}
"usingComponents": {},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/Login/Login.wxss */
\ No newline at end of file
<!--pages/Login/Login.wxml-->
<text>pages/Login/Login.wxml</text>
<view class="layout">
<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
/* 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
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
<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
// 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
{
"usingComponents": {
},
"component": true
}
\ 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
// 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
{
"usingComponents": {
},
"component": true
}
\ 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
/* 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
// 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
{
"component": true,
"usingComponents": {}
}
\ 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
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<block wx:if="{{show}}">
<view class="marquee-box" style="font-size:{{fontSize * 2}}rpx">
<view class="notice-title">
<glsx-image src="home/notice.png"></glsx-image>
</view>
<view class="box" id="marquee" style="min-height:{{fontSize / 0.55 * 2}}rpx">
<view class="content" id="content" style="opacity:{{flag?1:0}};" animation="{{animation}}">
<block wx:if="{{data}}">{{data}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
</view>
</view>
</block>
\ No newline at end of file
.marquee-box {
margin: 0 20rpx;
padding: 12rpx 0 12rpx 8rpx;
box-sizing: border-box;
display: flex;
align-items: center;
flex-shrink: 0;
color: #666666;
}
.marquee-box .notice-title {
width: 76rpx;
height: 36rpx;
}
.marquee-box .box {
width: calc(100% - 12rpx);
margin-left: 12rpx;
position: relative;
overflow: hidden;
color: #666666;
}
.marquee-box .box .content {
width: auto;
height: 100%;
position: absolute;
top: 50%;
left: 0;
white-space: nowrap;
transform: translateY(-50%);
display: flex;
align-items: center;
}
\ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {},
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
{
"usingComponents": {
},
"component": true
}
\ No newline at end of file
<view class="store-equity-box">
<view class="store-box">
<view class="store-img">
<glsx-image src="home/store-icon.png"></glsx-image>
</view>
<view class="store-name">海马刀酒类旗舰店</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
.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
const navStyle = 'background-color: transparent;'
Page({
// behaviors: [kfMixin],
/**
* 页面的初始数据
*/
data: {
navStyle,
showPage:true
pageNum: 1,
goodsIndex: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData(options)
this.getActivityList()
},
navbarReady(e) {
let {
height
} = e.detail
this.setData({
navHeight: height
})
},
jump(){
wx.p.router.go('/packageIndex/pages/index/index',{
a:123,
b:['555','苟利国家生死岂因祸福避趋之'],
c:{
AA:321,
BB:'xxx'
getActivityList() {
wx.p.wxApi.showLoading()
let total = 0
let {
activityList,
pageNum
} = this.data
wx.p.api.homeApi.getActivityList({
currentPage: pageNum,
type: 2,
activityStatusList: [1, 2]
})
.then(data => {
total = data.total
this.setData({
total,
activityList: pageNum > 1 ? [...activityList, ...data.list] : data.list // 防止多次请求 数据重复 page不变不concat数据
})
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 () {
this.getHomeConfig()
},
/**
......@@ -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
{
"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",
"onReachBottomDistance": 10,
"backgroundColor": "#FC5B32",
"backgroundColor": "#F9F7F7",
"enablePullDownRefresh": true
}
/* pages/tab/index/pages/index/index.wxss */
page {
background-color: #F8F9FC;
background-color: #F9F7F7;
}
......@@ -31,25 +31,24 @@ page {
}
.widget-box {
font-size: 20rpx;
margin-left: 26rpx;
color: #fff;
display: flex;
flex-flow: column;
align-items: center;
z-index: 10;
margin-left: 16rpx;
width: 112rpx;
height: 40rpx;
}
.widget-box image {
height: 30rpx;
width: 34rpx;
}
.layout {
padding-bottom: 200rpx;
position: relative;
padding-top: 16rpx;
background: transparent;
.notice-bar {
height: 56rpx;
border-radius: 8rpx;
margin: 6rpx 0 16rpx;
}
}
.bg-box {
......@@ -74,7 +73,7 @@ page {
}
.sticky {
background: #F8F9FC;
background: #F9F7F7;
padding: 10rpx 0;
}
......@@ -140,44 +139,6 @@ page {
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 {
padding-bottom: 20rpx;
text-align: center;
......@@ -188,10 +149,9 @@ page {
width: 100%;
justify-content: center;
align-items: center;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 16px;
color: #0A0D14;
color: #000;
}
.split-line .split-title .line {
......@@ -199,14 +159,14 @@ page {
height: 4rpx;
border-radius: 2px;
}
.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;
}
.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;
}
......
<block wx:if="{{showPage}}">
<navigation-bar page-title="首页" custom="{{true}}" bindnavbarReady="navbarReady">
<block wx:if="{{IMGURL}}">
<view class="home-top flex">
<view class="logo">
<image webp src="{{IMGURL}}index/home_logo.png" webp></image>
</view>
<view class="widget-box" wx:if="{{showKF}}" bindtap="openKF">
<image webp src="{{IMGURL}}index/icon-kf.png"></image>
<view class="online-text">客服</view>
</view>
<navigation-bar page-title="首页" custom bindnavbarReady="navbarReady" navStyle="background-color: transparent;">
<view class="home-top flex">
海马刀
<view class="widget-box" bindtap="openKF">
<glsx-image src="home/kf.png"></glsx-image>
</view>
</view>
</navigation-bar>
<block wx:if="{{navHeight}}">
<view class="layout" style="top:{{navHeight}}px">
<!-- 门店信息 -->
<view class="store-box">
<store-equity></store-equity>
</view>
<!-- 公告 -->
<block wx:if="{{noticeContent}}">
<view class="notice-bar">
<notice-bar data="{{noticeContent}}" speed="7500"></notice-bar>
</view>
<image class="scroll-bg" webp src="{{IMGURL}}index/navigationBar_bg.png"></image>
</block>
</navigation-bar>
<block wx:if="{{navHeight}}">
<view class="layout" style="top:{{navHeight}}px">
<view class="bg-box" style="height:{{270 + navHeight * 2}}rpx;top:-{{navHeight}}px">
<view class="bg">
<image webp src="{{IMGURL}}index/home-bg.png"></image>
</view>
</view>
<!-- 门店信息 -->
<block>
<view class="store-box">
<store-equity id="com-0"></store-equity>
</view>
</block>
<!-- 菜单 -->
<view class="menu-box">
<menu-list data="{{utilList}}" isLogin="{{userInfo.isLogin}}"></menu-list>
</view>
<!-- 公告 -->
<block wx:if="{{noticeContent}}">
<view class="notice-bar">
<notice-bar data="{{noticeContent}}" speed="7500" id="com-1"></notice-bar>
</view>
</block>
<!-- banner -->
<view class="banner-box" wx:if="{{bannerList.length > 0}}">
<!-- banner -->
<block wx:if="{{bannerList.length}}">
<view class="banner-box">
<banner bannerList="{{bannerList}}"></banner>
</view>
<view class="split-line" wx:if="{{goodsFlag}}">
<view class="split-title">
<view class="line left-line"></view>
<view class="title">精品推荐</view>
<view class="line right-line"></view>
</view>
<view class="split-text">品质精选,超值低价</view>
</block>
<view class="split-line" wx:if="{{goodsFlag}}">
<view class="split-title">
<view class="line left-line"></view>
<view class="title">精品推荐</view>
<view class="line right-line"></view>
</view>
<!-- 商品 -->
<block wx:if="{{goodsFlag}}">
<view wx:if="{{classifyList.length}}">
<view class="goods-box">
<view class="sticky" style="top:{{navHeight}}px;">
<good-tab tab="{{tab}}" align="left" openScroll bindclick="changeTab" index="{{goodsIndex}}"></good-tab>
</view>
<view wx:if="{{tab[goodsIndex]!='特惠精选'}}" class="goods-content">
<block wx:if="{{classifyList.length}}">
<block wx:for="{{classifyList}}" wx:key="index">
<block wx:if="{{index == goodsIndex}}">
<block wx:if="{{item.goodsData}}">
<goods list="{{item.goodsData}}"></goods>
</block>
<block wx:elif="{{item.activityData}}">
<activity nothing="{{nothing}}" list="{{item.activityData}}"></activity>
</block>
<view class="split-text">品质精选,超值低价</view>
</view>
<!-- 商品 -->
<block wx:if="{{goodsFlag}}">
<view wx:if="{{classifyList.length}}">
<view class="goods-box">
<view class="sticky" style="top:{{navHeight}}px;">
<good-tab tab="{{tab}}" align="left" openScroll bindclick="changeTab" index="{{goodsIndex}}"></good-tab>
</view>
<view wx:if="{{tab[goodsIndex]!='特惠精选'}}" class="goods-content">
<block wx:if="{{classifyList.length}}">
<block wx:for="{{classifyList}}" wx:key="index">
<block wx:if="{{index == goodsIndex}}">
<block wx:if="{{item.goodsData}}">
<goods list="{{item.goodsData}}"></goods>
</block>
<block wx:elif="{{item.activityData}}">
<activity nothing="{{nothing}}" list="{{item.activityData}}"></activity>
</block>
</block>
</block>
</view>
<!-- 平台商品 -->
<view wx:if="{{tab[goodsIndex]=='特惠精选'}}" class="goods-content">
<block wx:if="{{platformGoods.length}}">
<platform-goods list="{{platformGoods}}"></platform-goods>
</block>
</view>
<block wx:if="{{classifyList[goodsIndex].classifyName == '秒杀'}}">
<view class="btn text-center" bindtap="jump" data-url="activity.index">
查看更多
<view class="icon">
<image webp src="{{IMGURL}}index/more.png"></image>
</view>
</view>
</block>
</view>
</view>
<block wx:else>
<view class="nothing flex">
<view class="icon">
<image webp src="{{IMGURL}}index/index-activity-nothing.png"></image>
<block wx:if="{{classifyList[goodsIndex].classifyName == '秒杀'}}">
<view class="btn text-center" bindtap="jump" data-url="activity.index">
查看更多
<view class="icon">
<image webp src="{{IMGURL}}index/more.png"></image>
</view>
</view>
暂无优惠活动,敬请期待
</block>
</view>
</view>
<block wx:else>
<view class="nothing flex">
<view class="icon">
<image webp src="{{IMGURL}}index/index-activity-nothing.png"></image>
</view>
</block>
暂无优惠活动,敬请期待
</view>
</block>
<view class="back-to-top {{scrollToTop ? 'show-top': 'hidden-top'}}" bindtap="backTop">
<image webp src="{{IMGURL}}index/back-to-top.png"></image>
</view>
</block>
<view class="back-to-top {{scrollToTop ? 'show-top': 'hidden-top'}}" bindtap="backTop">
<image webp src="{{IMGURL}}index/back-to-top.png"></image>
</view>
</block>
<!-- 客服 -->
<customer show="{{widgetStatus}}" customerlist="{{customerlist}}" bindclose="closeCustomer"></customer>
<login show="{{showLogin}}"></login>
</view>
</block>
<block wx:else>
<page-loading color="#2A69FF" isFullScreen></page-loading>
</block>
\ No newline at end of file
<!-- 客服 -->
<customer show="{{widgetStatus}}" customerlist="{{customerlist}}" bindclose="closeCustomer"></customer>
\ No newline at end of file
// components/Goods/Goods.js
import { centsToyuan } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
observer(n, o) {
if (n) {
if (n.activityInfo) {
n.originalPrice = ''
n.retailPrice = n.activityInfo.activityPrice
n.goodsStatistics.saleAmount = n.activityInfo.saleAmount
if (n.activityInfo.specificationExtraList && n.activityInfo.specificationExtraList.length) {
n.retailPrice = n.activityInfo.specificationExtraList[0].retailPrice
n.up = true
}
} else {
if (n.originalPrice) n.originalPrice = centsToyuan(n.originalPrice)
if (n.specificationDetailList && n.specificationDetailList.length) {
n.retailPrice = n.specificationDetailList[0].retailPrice
n.up = true
}
}
n.retailPrice = Number(centsToyuan(n.retailPrice)).toFixed(2)
if (n.retailPrice > 9999) {
n.retailPrice = Number(n.retailPrice / 10000).toFixed(2)
n.unit = '万'
}
this.setData({ item: n })
}
}
},
indexStyle: Boolean
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
setWidth() {
wx.p.wxApi.getViewInfo(
'.Goods',
res => {
this.setData({
previewHeight: res.width * 2
})
},
this
)
},
jump(e) {
let { item } = e.currentTarget.dataset
let { id, activityInfo } = item
let isActivity = false
if (activityInfo) {
id = activityInfo.id
isActivity = true
}
wx.p.router.go('/packageMall/pages/detail/detail', { id, isActivity, notIntercept: true })
}
},
lifetimes: {
attached() {
this.setWidth()
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="Goods" bindtap="jump" data-item="{{item}}">
<view class="preview" style="height:{{previewHeight}}rpx">
<glsx-image webp src="{{item.goodsImage}}" lazy-load></glsx-image>
</view>
<view class="name text-hide">{{item.goodsName}}</view>
<view class="info ">
<view class="icon">
<glsx-image webp src="mall/eye.png"></glsx-image>
</view>
<view class="text text-hide">{{item.goodsStatistics.viewAmount||0}}|售出{{item.goodsStatistics.saleAmount || 0}}
</view>
</view>
<view class="price">
<view class="now {{indexStyle}}">
<text class="unit">¥</text>{{item.retailPrice || 0}}
<text class="unit up" wx:if="{{item.unit}}">{{item.unit}}</text>
<text class="unit up" wx:if="{{item.up}}">起</text>
</view>
<block wx:if="{{item.originalPrice >= 0 && item.originalPrice}}">
<view class="old">
¥{{item.originalPrice || 0}}
</view>
</block>
</view>
</view>
\ No newline at end of file
/* components/Goods/Goods.wxss */
.Goods{
width: 100%;
border-radius: 8rpx;
}
.Goods .preview {
border-radius: 8rpx;
overflow: hidden;
height: 252rpx;
}
.Goods .name {
color: #2D2D2E;
margin: 16rpx 0 ;
}
.Goods .info {
color: #B1B1B3;
font-size: 20rpx;
display: flex;
align-items: center;
}
.Goods .info .icon {
width: 24rpx;
height: 24rpx;
margin-right: 2rpx;
}
.Goods .info .icon .text{
width: calc(100% - 26rpx);
}
.Goods .price {
display: flex;
align-items: center;
margin-top: 14rpx;
font-size: 20rpx;
}
.Goods .price .now {
display: flex;
align-items: baseline;
color: var(--btnColor);
font-size: 34rpx;
line-height: 34rpx;
font-weight: 500;
letter-spacing: -0.5rpx;
}
.Goods .price .now.true{
font-size: 40rpx;
line-height: 40rpx;
}
.Goods .price .now .unit {
font-size: 20rpx;
margin: 0 4rpx;
}
.Goods .price .now.true .unit{
font-size: 24rpx;
}
.Goods .price .now .up{
transform: translateY(-2rpx);
}
.Goods .price .old {
color: #C9CACC;
text-decoration: line-through;
margin-left: 8rpx;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
// components/SearchBox/SearchBox.js
Component({
/**
* 组件的属性列表
*/
properties: {
placeholder: {
type: String,
value: '请输入搜索内容'
},
value: {
type: String,
value: '',
observer(n) {
this.setData({
inputValue: n
})
}
},
searchType: {
type: Number,
value: 1
}
},
/**
* 组件的初始数据
*/
data: {
inputValue: ''
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
let {
value
} = e.detail
this.setData({
inputValue:value
})
},
blur(e){
let {inputValue} = this.data
this.setData({
inputValue
})
},
clear() {
this.setData({
inputValue: ''
})
},
confirm(e) {
let {
value
} = e.detail
this.triggerEvent('search', value)
},
search(e) {
let {
value
} = e.currentTarget.dataset
this.triggerEvent('search', value)
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="search-box box-center">
<view class="search type-{{searchType}}">
<view class="input-box">
<view class="icon box-center">
<icon type="search" size="20"></icon>
</view>
<input type="text" bindinput="input" bindblur="blur" value="{{inputValue}}" placeholder-class="input-placeholder"
placeholder="{{placeholder}}" confirm-type="search" class="input" bindconfirm="confirm" />
<block wx:if="{{inputValue}}">
<view class="clear-box" bindtap="clear">
<view class="sprite-icon icon-clear"></view>
</view>
</block>
</view>
<view class="button box-center" bindtap="search" data-value="{{inputValue}}">搜索</view>
</view>
</view>
\ No newline at end of file
/* components/SearchBox/SearchBox.wxss */
.search-box {
height: 104rpx;
box-sizing: border-box;
padding: 0 var(--margin);
background-color: #fff;
}
.box-center {
display: flex;
align-items: center;
justify-content: center;
}
.search {
width: 100%;
height: 72rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.type-1 {
padding: 0 6rpx;
border-radius: 38px;
border: 3rpx solid var(--btnColor);
}
.type-1 .button {
width: 104rpx;
height: 60rpx;
border-radius: 38rpx;
background-color: var(--btnColor);
color: #fff;
font-size: var(--margin);
}
.type-1 .input-box {
width: calc(100% - 110rpx);
display: flex;
align-items: center;
}
.input-box .icon {
width: 58rpx;
}
.type-1 .input-box .input,
.type-2 .input-box .input {
width: calc(100% - 130rpx);
font-size: 28rpx;
}
.input-box .clear-box{
width: 58rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.input-box .clear-box .clear{
width: 32rpx;
height: 32rpx;
opacity: .7;
}
.type-2 .input-box {
display: flex;
align-items: center;
width: 592rpx;
height: 100%;
background: #F8F8F8;
border-radius: 38rpx;
}
.type-2 .button {
color: #656566;
font-size: var(--margin);
}
.input-placeholder {
color: #CFCFCF;
font-size: 28rpx;
}
\ No newline at end of file
// components/tabView/tabView.js
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height: null,
tagIndex: {
type: Number,
value: 0
},
refresherEnabled: Boolean,
triggered: Boolean
},
/**
* 组件的初始数据
*/
data: {
scrollTop: 0,
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
let {
index,
item
} = e.currentTarget.dataset
item.index = index
this.setData({
scrollTop: 0,
tagIndex: index
})
this.triggerEvent('click', item)
},
tabScrollTolower(e) {
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e) {
this.triggerEvent('viewScrollTolower')
},
bindrefresherrefresh(e) {
this.triggerEvent('refresherrefresh')
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="tab-box" id="tabView" style="height:calc(100vh - {{height}}px)">
<scroll-view style="height:100%;" scroll-y class="tab" bindscrolltolower="tabScrollTolower">
<view>
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{tagIndex==index?'active':''}}" bindtap="click" data-item="{{item}}" data-index="{{index}}">
{{item.zoneName}}</view>
</block>
</view>
</scroll-view>
<view class="view">
<view style="height:100%;">
<scroll-view style="height:100%" scroll-y scroll-top="{{scrollTop}}" bindscrolltolower="viewScrollTolower"
refresher-enabled="{{refresherEnabled}}" refresher-triggered="{{triggered}}"
bindrefresherrefresh="bindrefresherrefresh">
<view class="content">
<slot name="content"></slot>
</view>
</scroll-view>
</view>
</view>
</view>
\ No newline at end of file
/* components/tabView/tabView.wxss */
.tab-box {
display: flex;
}
.tab {
width: 21.33%;
box-sizing: border-box;
text-align: center;
background: #F9F7F7;
}
.view {
width: 78.67%;
height: 100%;
position: relative;
background: #fff;
}
.tab-item {
width: 100%;
height: 120rpx;
line-height: 120rpx;
font-size: 26rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #666666;
box-sizing: border-box;
padding: 0 10rpx;
transition: all .5s;
background: #F2EFEF;
}
.active {
font-weight: 500;
background: #fff;
position: sticky;
top: 0;
color: #000;
}
.active::after {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
background-color: var(--btnColor);
content: '';
animation: show-border .5s forwards;
}
@keyframes show-border {
0% {
height: 0;
}
100% {
height: 60rpx;
}
}
.refresherEnabled {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
opacity: 0;
}
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
\ No newline at end of file
......@@ -5,16 +5,51 @@ Page({
* 页面的初始数据
*/
data: {
tagIndex: 0,
tabList: []
},
navbarReady(e) {
console.log(e)
let {
height
} = e.detail
this.setData({
navHeight: height,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getZoneInfo()
},
getZoneInfo() {
wx.p.api.discoveryApi.getZoneInfo(2).then(data => {
let tabList = [{
zoneName: '门店自营',
id: '',
zoneImg: `mall/default-banner.png`
}]
data.map(e => tabList.push(e))
this.setData({
tabList,
flag: true
})
this.getGoodsList()
})
},
getGoodsList(zoneId) {
wx.p.wxApi.showLoading('加载中...')
let params = {}
if (zoneId) params.zoneId = zoneId
wx.p.api.shopmallApi.getGoodsList(params).then(({ list }) => {
this.setData({
goodsList: list,
goodsFlag: true
})
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......@@ -26,9 +61,36 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
let { tabList, tagIndex } = this.data
this.setData({
goodsList: [],
goodsFlag: false
})
if (tabList.length == 0) return
this.getGoodsList(tabList[tagIndex].id)
},
goShoppingCart() {
wx.p.router.go('/packageMall/pages/shoppingCart/shoppingCart')
},
tabclick(e) {
let { index } = e.detail
let { tagIndex, tabList } = this.data
if (index == tagIndex) return
this.setData({
tagIndex: index,
goodsList: [],
goodsFlag: false
})
this.getGoodsList(tabList[index].id)
},
search(e) {
let value = e.detail
let { goodsList } = this.data
wx.p.router.go('/packageMall/pages/search/search', {
value,
goodsList
})
},
/**
* 生命周期函数--监听页面隐藏
*/
......
{
"usingComponents": {}
"usingComponents": {
"search-box":"./components/SearchBox/SearchBox",
"tab-view":"./components/TabView/TabView",
"goods":"./components/Goods/Goods"
},
"navigationBarTitleText": "商城",
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/tab/mall/index.wxss */
\ No newline at end of file
/* pages/tab/index/pages/mall/mall.wxss */
/* pages/tab/mall/mall.wxss */
.mall-layout{
position: relative;
}
.tab-view-box {
padding: 16rpx var(--margin);
}
.tab-view-box .banner {
height: 220rpx;
border-radius: 8rpx;
overflow: hidden;
}
.tab-view-box .title {
display: flex;
justify-content: space-between;
height: 80rpx;
align-items: center;
border-bottom: 2rpx solid #EFF0F2;
}
.tab-view-box .title .icon {
width: 40rpx;
height: 40rpx;
}
.tab-view-box .goods-box {
padding: 18rpx 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.tab-view-box .goods-box .item{
width: 252rpx;
margin-bottom: 18rpx;
}
.list-nothing{
flex-direction: column;
}
\ No newline at end of file
<!--pages/tab/mall/index.wxml-->
<text>pages/tab/mall/index.wxml</text>
<navigation-bar bindnavbarReady="navbarReady">商城</navigation-bar>
<view class="mall-layout" style="margin-top: {{navHeight}}px;">
<search-box search-type="2" bindsearch="search"></search-box>
<block wx:if="{{flag}}">
<block wx:if="{{tabList.length}}">
<tab-view tabList="{{tabList}}" tagIndex="{{tagIndex}}" height="{{52 + navHeight}}" bindclick="tabclick">
<view class="tab-view-box" slot="content">
<block wx:if='{{goodsFlag}}'>
<view class="box">
<view class="banner">
<glsx-image webp src="{{tabList[tagIndex].zoneImg}}"></glsx-image>
</view>
<view class="title">
{{tabList[tagIndex].zoneName}}
<view class="icon" bindtap="goShoppingCart">
<glsx-image webp src="mall/shopping.png"></glsx-image>
</view>
</view>
<view class="goods-box">
<block wx:if="{{goodsList.length}}">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item">
<goods item="{{item}}"></goods>
</view>
</block>
</block>
<block wx:else>
<view class="list-nothing flex">
<view class="icon">
<glsx-image webp src="mall/goods-nothing.png"></glsx-image>
</view>
当前门店暂无上架商品
</view>
</block>
</view>
</view>
</block>
</view>
</tab-view>
</block>
<block wx:else>
<view class="list-nothing flex">
<view class="icon">
<glsx-image webp src="mall/goods-nothing.png"></glsx-image>
</view>
当前门店暂无上架商品
</view>
</block>
</block>
</view>
\ No newline at end of file
// pages/tab/mine/components/myOrder/myOrder.js
Component({
/**
* 组件的属性列表
*/
properties: {
orderNumberList: Object
},
/**
* 组件的初始数据
*/
data: {
orderList: [{
text: '待支付',
imageUrl: 'noPay'
},
{
text: '待发货',
imageUrl: 'noTakeCommodity'
},
{
text: '待收货',
imageUrl: 'takeCommodity'
},
// {
// text: '评价',
// imageUrl: 'appraise'
// },
{
text: '售后',
imageUrl: 'aftermarket'
}
]
},
/**
* 组件的方法列表
*/
methods: {
goOrder(e) {
let userInfo = wx.$util.getUserInfo()
if (userInfo) {
let index = e.currentTarget.dataset.key + 1
wx.navigateTo({
url: '/packageShopmall/packageMine/pages/order/index/index?tabIndex=' + (index || '')
})
} else {
wx.navigateTo({
url: '/pages/Login/Login'
})
}
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!-- 我的订单 -->
<view class="order-box box">
<view class="title">
我的订单
<view class="edit" bindtap="goOrder">
全部
<view class="arrow">
<glsx-image webp src="mine/right.png"></glsx-image>
</view>
</view>
</view>
<view class="btnBox">
<view class="independentBox" wx:for="{{orderList}}" wx:key="index" bindtap="goOrder" data-key="{{index}}">
<view class="order-img">
<glsx-image webp src="mine/{{item.imageUrl}}.png"></glsx-image>
</view>
<text class="order-content">{{item.text}}</text>
<text class="order-number" wx:if="{{orderNumberList[index] != 0 && orderNumberList}}">{{orderNumberList[index]}}</text>
</view>
</view>
</view>
\ No newline at end of file
.order-box {
background-color: #fff;
box-sizing: border-box;
padding: 28rpx var(--margin);
position: relative;
border-radius: 16rpx;
}
.box {
margin: 20rpx 20rpx 0 20rpx;
}
.order-box .title {
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
font-family: PingFangSC-Medium;
font-size: 32rpx;
color: #0A0D14;
}
.order-box .title .edit {
font-size: 24rpx;
font-weight: normal;
color: #858A94;
display: flex;
align-items: center;
}
.order-box .title .edit .arrow {
width: 20rpx;
height: 20rpx;
transform: translateY(1rpx);
}
.order-box .btnBox {
display: flex;
justify-content: space-between;
}
.order-box .btnBox .independentBox {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
.order-box .btnBox .independentBox .order-img {
width: 64rpx;
height: 64rpx;
margin: 40rpx 0 26rpx 0;
}
.order-box .btnBox .independentBox .order-content {
font-family: PingFangSC-Regular;
font-size: 24rpx;
color: #0A0D14;
letter-spacing: 0;
}
.order-box .btnBox .independentBox .order-number {
width: 28rpx;
height: 28rpx;
background: #FF6038;
border-radius: 50%;
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 18rpx;
color: #FFFFFF;
line-height: 28rpx;
text-align: center;
position: absolute;
right: 0;
top: 30rpx;
}
\ No newline at end of file
......@@ -5,7 +5,18 @@ Page({
* 页面的初始数据
*/
data: {
toolList: [
{
text: '购物车',
icon: 'myShopping',
url: '/packageMall/pages/shoppingCart/shoppingCart'
},
{
text: '我的地址',
icon: 'myAddress',
url: '/packageMine/pages/address/index/index'
},
],
},
/**
......@@ -14,7 +25,24 @@ Page({
onLoad(options) {
},
navbarReady(e) {
let {
height
} = e.detail
this.setData({
user_box_style: `padding-top:${height + 20}px`
})
},
login() {
wx.p.router.go('/pages/Login/Login')
},
goSetUp(){
wx.p.router.go('/packageMine/pages/setting/index')
},
jump(e){
const {url} = e.currentTarget.dataset
wx.p.router.go(url)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
{
"usingComponents": {},
"usingComponents": {
"myOrder":"./components/myOrder/myOrder"
},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/tab/mine/mine.wxss */
page {
background-color: #F9F7F7;
}
.layout {
padding-bottom: 60rpx;
position: relative;
}
.bg {
width: 100%;
height: 422rpx !important;
position: absolute;
z-index: -1;
top: 0;
left: 0;
}
.navigation-bar {
position: fixed;
top: 0;
......@@ -26,10 +21,8 @@
.user-box {
position: relative;
/* height: 283rpx; */
box-sizing: border-box;
padding-left: var(--margin);
/* background: linear-gradient(180deg, #EDF2FA 0%, #FFFFFF 100%); */
}
.user-box .coupon-info view {
......@@ -74,10 +67,6 @@
display: flex;
align-items: center;
font-size: 32rpx;
.text {
max-width: 50%;
}
}
.user-info .setUp {
......@@ -111,229 +100,21 @@
color: #3F444D;
}
.car-box {
background-color: #fff;
/* box-shadow: 0 4rpx 16rpx 0 rgba(0, 0, 0, 0.1); */
border-radius: 16rpx;
min-height: 222rpx;
}
.car-box.GH {
height: 388rpx;
}
.my-car {
height: 270rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(252, 91, 50, 0.06) 100%);
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx 24rpx;
}
.car-info .bottm {
display: flex;
justify-content: center;
}
.car-info .btn {
width: 378rpx;
height: 100rpx;
background: #F5F8FF;
border-radius: 50px;
margin-top: 16rpx;
font-family: PingFangSC-Regular;
font-size: 28rpx;
color: #2A69FF;
display: flex;
align-items: center;
justify-content: center;
line-height: 40rpx;
}
.car-info .btn .btn-icon {
width: 40rpx;
height: 40rpx;
margin-right: 24rpx;
}
.car-info {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: var(--margin);
font-size: var(--margin);
color: #656566;
}
.car-info .icon-mine-arrow {
transform: translateY(8rpx);
margin-left: 6rpx;
}
.car-info .title {
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
font-family: PingFangSC-Medium;
font-size: 32rpx;
color: #0A0D14;
}
.car-info .title .edit {
font-size: 24rpx;
font-weight: normal;
color: #858A94;
display: flex;
align-items: center;
}
.car-info .title .edit .arrow {
width: 8rpx;
height: 14rpx;
margin-left: 10rpx;
}
.car-info .btnBox {
display: flex;
margin-top: 24rpx;
align-items: center;
.left-wrap{
.logo{
width: 84rpx;
height: 84rpx;
margin-bottom: 16rpx;
}
.row{
display: flex;
.name{
width: 98rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-weight: 600;
font-size: 24rpx;
color: #3F444D;
}
}
}
.right-wrap-panel{
width: 100%;
border-left: 2rpx solid #efefef;
box-sizing: border-box;
padding-left: 20rpx;
margin-left: 30rpx;
overflow: hidden;
.scroll_widget{
width: calc(100% - 20rpx);
height: 120rpx;
overflow: hidden;
vertical-align: top;
white-space: nowrap;
.device{
display: inline-block;
.wrapper2{
display: flex;
align-items: center;
}
.icon{
width: 120rpx;
height: 120rpx;
}
.text{
width: 184rpx;
height: 72rpx;
font-weight: 400;
font-size: 26rpx;
color: #0A0D14;
white-space: pre-wrap;
}
}
}
}
}
.car-info .btnBox .leftIcon {
width: 84rpx;
height: 84rpx;
}
.car-info .btnBox .rightBox {
margin-left: 20rpx;
}
.car-info .btnBox .plate-name {
width: 40rpx;
height: 40rpx;
background: #2A69FF;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
margin-right: 8rpx;
display: inline-block;
line-height: 40rpx;
text-align: center;
}
.car-info .btnBox .plate-number {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #0A0D14;
}
.car-info .btnBox .car-brand {
font-size: 24rpx;
max-width: 542rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 15rpx;
color: #3F444D;
}
.car-info .btnBox .car-brand .brand-name {
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 24rpx;
color: #3F444D;
}
.coupon-box {
background: #FFFFFF;
box-sizing: border-box;
border-radius: 16rpx 16rpx 0 0;
padding: var(--margin);
}
.coupon-box .title {
font-family: PingFangSC-Medium;
border-radius: 16rpx;
font-weight: 500;
font-size: 32rpx;
color: #0A0D14;
}
.coupon-box .item {
flex: 1;
justify-content: center;
flex-direction: column;
align-items: center;
margin-top: 24rpx;
}
.coupon-box .coupon-number {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #0A0D14;
}
height: 100rpx;
padding: 0 32rpx;
.coupon-box .coupon-content {
font-size: 24rpx;
color: #0A0D14;
.icon {
width: 28rpx;
height: 28rpx;
margin-left: auto;
}
}
.user-items {
......@@ -499,7 +280,8 @@
align-items: center;
margin-right: 57rpx;
}
.tool-box .btnBox .independentBox:nth-child(5){
.tool-box .btnBox .independentBox:nth-child(5) {
margin-right: 0;
}
......@@ -571,15 +353,18 @@
align-items: center;
margin-left: auto;
}
.icon-mine-arrow {
transform: translateY(8rpx);
margin-left: 6rpx;
}
}
.sprite-icon {
.sprite-icon {
background-image: url(https://img02.glsx.com.cn/weapp/resource/dj-shopmall-test/sprite-1650770528010.png) !important;
background-size: 376rpx 364rpx !important;
}
.car-info .icon-mine-arrow {
transform: translateY(4rpx) !important;
margin-left: 6rpx;
......
<view class="navigation-bar">
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="个人中心">个人中心</navigation-bar>
<navigation-bar navStyle="background-color: transparent;" bindnavbarReady="navbarReady" page-title="个人中心">个人中心</navigation-bar>
</view>
<view class="layout" wx:if="{{user_box_style}}">
<view class="user-box" style="{{user_box_style}}">
<view class="user-info">
<view class="avatar">
<block wx:if="{{userInfo && userInfo.headImgUrl}}">
<image webp src="{{userInfo.headImgUrl}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.jpg?v={{img_version}}"></image>
</block>
</view>
<view class="info {{userInfo?'':'auth'}}">
<block wx:if="{{userInfo}}">
<view class="nickName">
{{userInfo.nickName || '微信用户'}}
<view class="vip text-center">已认证</view>
</view>
<view class="phone">{{userInfo.phone}}</view>
<block wx:if="{{user_box_style}}">
<view class="layout mine">
<view class="user-box" style="{{user_box_style}}">
<view class="user-info">
<view class="avatar">
<block wx:if="{{userInfo && userInfo.headImgUrl}}">
<image src="{{userInfo.headImgUrl}}" />
</block>
<block wx:else>
<glsx-image webp src="mine/default-avatar.png"></glsx-image>
</block>
</view>
<view class="info auth">
<block wx:if="{{userInfo}}">
<view class="nickName">
<text class="text text-hide">{{userInfo.nickName || '微信用户'}}</text>
<view class="vip">
<glsx-image webp src="mine/certification.png"></glsx-image>
</view>
<view class="vip_card" wx:if="{{isMember}}">
<glsx-image webp src="mine/goldCard.png"></glsx-image>
</view>
</view>
<view class="phone">{{username}}{{userInfo.phone}}</view>
</block>
<block wx:else>
点击登录
</block>
</view>
<block wx:if="{{!userInfo}}">
<view class="auth-button" bindtap="login"></view>
</block>
<block wx:else>点击登录</block>
</view>
<block wx:if="{{!userInfo}}">
<view class="auth-button" bindtap="login"></view>
<!-- <button open-type="getPhoneNumber" bindtap="login" bindgetphonenumber="getPhoneNumber" class="auth-button"></button> -->
</block>
<block wx:if="{{userInfo && !userInfo.nickName}}">
<view class="auth-button" bindtap="showAuthModal"></view>
</block>
</view>
<view class="coupon-info flex">
<view class="item flex" bindtap="goto" data-url="coupon">
{{total || '0'}}
<view>我的优惠券/张</view>
</view>
<view class="item flex" bindtap="goto" data-url="boutique">
{{gitTotal || '0'}}
<view>精品礼券/张</view>
<view class="setUp {{userInfo ? '' : 'setUpZinx'}}" bindtap="goSetUp">
<glsx-image webp src="mine/setUp.png"></glsx-image>
</view>
</view>
</view>
</view>
<!-- 广汇车辆 -->
<block wx:if="{{carFlag}}">
<view class="car-box box GH">
<block wx:if="{{!carList.length}}">
<view class="add-car text-center">
添加爱车专属优惠
<view class="btn flex" bindtap="goto" data-url="GHVehicleInfo">
<view class="sprite-icon icon-mine-add"></view>
添加
</view>
<!-- 会员卡 -->
<view class="member-box">
<view class="left-box">
<view class="member-icon">
<glsx-image webp src="mine/member.png"></glsx-image>
</view>
<view class="left-content">
<view class="card">会员权益卡</view>
<!-- <view class="card">{{memberInfo.equityName}}</view> -->
<view class="describe" wx:if="{{!isMember}}">生活权益|专享超百项生活权益</view>
<view class="describe" wx:else>{{vipInfo.time}} 到期</view>
</view>
</view>
<block wx:if="{{!isMember}}">
<view class="member-button" bindtap="toBuyMember">开通会员</view>
<view class="member-price" bindtap="toBuyMember" wx:if="{{memberInfo.goodPrice}}">特惠¥{{memberInfo.goodPrice}}起</view>
</block>
<block wx:else>
<view class="car-info">
<view class="title">
我的爱车
<view class="edit" bindtap="goto" data-url="GHVehicleInfo" data-name="list">
管理
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</view>
<view class="my-car">
<gh-car-card item="{{carList[0]}}" selectedCar="null"></gh-car-card>
<view class="goUseBox" bindtap="goInterests">
去使用
<view class="goUseBox-icon">
<glsx-image webp src="mine/goUse.png"></glsx-image>
</view>
</view>
</block>
</view>
</block>
<block wx:if="{{merchantDetail}}">
<view class="merchant-box box">
<view class="title">
<view class="name text-hide">{{merchantDetail.storeName}}</view>
<!-- 我的券包 -->
<view class="coupon-box box flex">
我的卡券
<view class="icon">
<glsx-image src="mine/mine-arrow.png"></glsx-image>
</view>
<view class="address">{{merchantDetail.address}}</view>
<view class="serve-item">
<block wx:if="{{merchantDetail.appointmentPhone}}">
<view class="item flex" bindtap="phoneCall" data-phone="{{merchantDetail.appointmentPhone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
</block>
<block wx:if="{{merchantDetail.merchantAddress}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="sprite-icon icon-mine-gh-gps"></view>
导航
</view>
</block>
<block wx:if="{{consultant == null}}">
<view class="item-counselor flex" bindtap="openConsultant" data-item="{{merchantDetail}}">
<view class="icon">
<image webp src="{{IMGURL}}mine/serve.png?v={{img_version}}"></image>
</view>
<!-- 我的订单 -->
<myOrder orderNumberList="{{orderNumberList}}" />
<!-- 常用工具 -->
<view class="tool-box box">
<view class="title">常用工具</view>
<view class="btnBox">
<block wx:for="{{toolList}}" wx:key="index">
<view class="independentBox" bindtap="jump" data-url="{{item.url}}">
<view class="tool-img">
<glsx-image webp src="mine/{{item.icon}}.png"></glsx-image>
</view>
选择服务顾问
<text class="tool-content">{{item.text}}</text>
</view>
</block>
</view>
<block wx:if="{{consultant != null}}">
<view class="counselor">
<view class="userInfo">
<view class="counselor-avatar">
<block wx:if="{{consultant.avatar}}">
<image webp src="{{consultant.avatar}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.png?v={{img_version}}"></image>
</block>
</view>
<view>{{consultant.consultantName}}</view>
</view>
<view class="userInfo">
<view class="user-phone" bindtap="phoneCall" data-phone="{{consultant.phone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
<view class="more" bindtap="goCounselor">更多</view>
</view>
</view>
</block>
</view>
</block>
<view class="user-items box">
<block wx:for="{{utilList}}" wx:key="index">
<view class="item" bindtap="jump" data-item="{{item}}">
<view class="label">
<view class="sprite-icon icon-mine-{{item.icon || item.url}} icon"></view>
{{item.text}}
</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
</view>
</view>
\ No newline at end of file
</block>
\ No newline at end of file
......@@ -24,7 +24,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.api.showLoading('加载中...')
wx.p.wxApi.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url)
let param = this.getParams(decodeUrl)
if (param.urlParam) {
......
......@@ -5,7 +5,8 @@ class RouterBefore {
}
/**监听页面 */
pageLeaveProxy(thisPage) {
let onLoad = thisPage.onLoad
let onLoad = thisPage.onLoad,
onShow = thisPage.onShow
thisPage.onLoad = function () {
const event = getApp().globalData.ROUTE_QUERY
let options = {
......@@ -13,7 +14,13 @@ class RouterBefore {
...arguments[0]
}
getApp().globalData.ROUTE_QUERY = {}
onLoad && onLoad.apply(this, [options]),(this.options = options)
onLoad && onLoad.apply(this, [options]), (this.options = options)
}
thisPage.onShow = function () {
const userInfo = wx.p.storage.get('userInfo')
onShow && onShow.apply(this, arguments), (this.setData({
userInfo
}))
}
}
/**全局注册事件 */
......
import getAppId from '~/utils/utils_wx'
// 图片cdn 加速使用地址
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram-test/cgacar/'
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/hmd/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
......@@ -19,7 +19,7 @@ export const STORAGE_OBJECTkEY = {
// 图片版本号
export const IMG_VERSION = async () => {
const accountInfo = await util.getMockData()
const accountInfo = await wx.p.util.getMockData()
return accountInfo?.version || Date.now()
}
......
......@@ -127,8 +127,7 @@ const getViewInfo = (name, callBack, componentThis) => {
query
.selectAll(name)
.boundingClientRect(res => {
console.log('res: ', res)
callBack(res)
callBack(res[0])
})
.exec()
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!