Commit 32d61dea by 严立

LL - 门票商品下单

parent 9ccd285c
......@@ -15,6 +15,8 @@ App({
appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/',
shopId: iEnvironmental.shopId,
payStateTimer: 0,
token: '',
refreshToken: '',
userInfo: null,
......
......@@ -113,8 +113,8 @@
},
{
"pagePath": "pages/commodity/home/home",
"iconPath": "image/tabbar/play.png",
"selectedIconPath": "image/tabbar/play-s.png",
"iconPath": "image/tabbar/service.png",
"selectedIconPath": "image/tabbar/service-s.png",
"text": "服务"
},
{
......
......@@ -159,9 +159,6 @@ Component({
textCss: App.cssObjectToCssString(funcTextStyle),
iconCss: App.cssObjectToCssString(funcIconStyle),
})
console.log(this.data.iconCss)
},
/**
......
.navbar {
z-index: 2000;
z-index: 9000;
display: flex;
flex-direction: row;
justify-content: space-between;
......
......@@ -15,13 +15,13 @@ let Development = {
// 门店信息
shopId: [
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', name: '海错图', logo: 'shopping-cart-logo-4.png', title: ['', '海错图购票', '11', '海错图文创店', '22', '儿童营地接待区', '33'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', name: '星空影院', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', name: '儿童营地', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] },
{ appId: 4, id: 'c63893bb472f43bca4ec72f890bcb4fd', name: '原野MOJITO', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
{ appId: 5, id: '26c40446fc454a02abe61758176597f6', name: '拾光花坊', logo: 'shopping-cart-logo-7.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', name: '原味舒食', logo: 'shopping-cart-logo-1.png', title: ['', '儿童营地入园购票', '1', '1', '1', '原味舒食', '1'] },
{ appId: 7, id: '2614f117406548718bc091f24368c16e', name: '元养水韵SPA', logo: 'shopping-cart-logo-7.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', name: '海错图', logo: 'shopping-cart-logo-4.png', title: ['海错图', '海错图购票', '海错图', '海错图文创店', '海错图', '海错图', '海错图'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', name: '星空影院', logo: 'shopping-cart-logo-6.png', title: ['星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', name: '儿童营地', logo: 'shopping-cart-logo-6.png', title: ['儿童营地', '儿童营地入园购票', '儿童营地', '儿童营地', '儿童营地', '儿童营地接待区', '儿童营地'] },
{ appId: 4, id: 'c63893bb472f43bca4ec72f890bcb4fd', name: '原野MOJITO', logo: 'shopping-cart-logo-6.png', title: ['原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO', '原野MOJITO'] },
{ appId: 5, id: '26c40446fc454a02abe61758176597f6', name: '拾光花坊', logo: 'shopping-cart-logo-7.png', title: ['拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', name: '原味舒食', logo: 'shopping-cart-logo-1.png', title: ['原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食', '原味舒食'] },
{ appId: 7, id: '2614f117406548718bc091f24368c16e', name: '元养水韵SPA', logo: 'shopping-cart-logo-7.png', title: ['元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA'] },
]
}
......
......@@ -19,13 +19,15 @@
<swiper-item>
<view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-1.png'}}"></image>
<button class="row con-c align-c" data-id="{{6}}" data-type="{{5}}" bindtap="onGoShop"></button>
<button class="row con-c align-c" data-id="{{6}}" bindtap="onBuyFood"></button>
</view>
<view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}">
<image></image>
<text>炭烤猪肋排拼盘</text>
<block wx:for="{{shopRecommendA}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
</block>
</view>
</swiper-item>
......@@ -33,13 +35,15 @@
<swiper-item>
<view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-2.png'}}"></image>
<button class="row con-c align-c" data-id="{{5}}" data-type="{{5}}" bindtap="onGoShop"></button>
<button class="row con-c align-c" data-id="{{4}}" bindtap="onBuyFood"></button>
</view>
<view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}">
<image></image>
<text>炭烤猪肋排拼盘</text>
<block wx:for="{{shopRecommendB}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
</block>
</view>
</swiper-item>
</swiper>
......@@ -51,17 +55,17 @@
<text>您可以用最优惠的价格</text>
<text>享受超级服务</text>
</view>
<view class="services-banner">
<view class="services-banner" bindtap="onBuyAll">
<image src="{{resourcesBase + 'commodity/home/services-title.png'}}"></image>
</view>
<view class="services-list col align-c">
<view class="services-list-item col align-c" data-id="{{3}}" data-type="{{1}}" bindtap="onGoShop">
<view class="services-list-item col align-c" data-id="{{3}}" bindtap="onBuyMembership">
<image src="{{resourcesBase + 'commodity/home/services-1.png'}}"></image>
</view>
<view class="services-list-item col align-c" data-id="{{1}}" data-type="{{1}}" bindtap="onGoShop">
<view class="services-list-item col align-c" data-id="{{1}}" bindtap="onBuyPassCheck">
<image src="{{resourcesBase + 'commodity/home/services-2.png'}}"></image>
</view>
<view class="services-list-item col align-c" data-id="{{7}}" data-type="{{1}}" bindtap="onGoShop">
<view class="services-list-item col align-c" data-id="{{7}}" bindtap="onBuyService">
<image src="{{resourcesBase + 'commodity/home/services-3.png'}}"></image>
</view>
</view>
......@@ -77,11 +81,11 @@
<image src="{{resourcesBase + 'commodity/home/reception-title.png'}}"></image>
</view>
<view class="reception-list col align-c">
<view class="reception-list-item col align-c" data-id="{{3}}" data-type="{{5}}" bindtap="onGoShop">
<view class="reception-list-item col align-c" data-id="{{3}}" bindtap="onBuySupply">
<image src="{{resourcesBase + 'commodity/home/reception-1.png'}}"></image>
<text>儿童营地接待区</text>
</view>
<view class="reception-list-item col align-c" data-id="{{5}}" data-type="{{3}}" bindtap="onGoShop">
<view class="reception-list-item col align-c" data-id="{{5}}" bindtap="onBuySupply">
<image src="{{resourcesBase + 'commodity/home/reception-2.png'}}"></image>
<text>拾光花坊</text>
</view>
......@@ -102,13 +106,15 @@
<swiper-item>
<view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-3.png'}}"></image>
<button class="row con-c align-c" data-id="{{1}}" data-type="{{4}}" bindtap="onGoShop"></button>
<button class="row con-c align-c" data-id="{{1}}" bindtap="onBuyOriginality"></button>
</view>
<view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}">
<image></image>
<text>炭烤猪肋排拼盘</text>
<block wx:for="{{shopRecommendC}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
</block>
</view>
</swiper-item>
......@@ -116,13 +122,15 @@
<swiper-item>
<view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-4.png'}}"></image>
<button class="row con-c align-c" data-id="{{3}}" data-type="{{4}}" bindtap="onGoShop"></button>
<button class="row con-c align-c" data-id="{{3}}" bindtap="onBuyOriginality"></button>
</view>
<view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}">
<image></image>
<text>炭烤猪肋排拼盘</text>
<block wx:for="{{shopRecommendD}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
</block>
</view>
</swiper-item>
</swiper>
......
......@@ -243,9 +243,9 @@ swiper {
position: relative;
top: -100rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
flex-direction: row;
margin: 0 40rpx;
}
......@@ -259,8 +259,12 @@ swiper {
.shop-menu-item > text {
display: block;
max-width: 300rpx;
margin: 40rpx 0 48rpx 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 30rpx;
font-weight: 300;
line-height: 42rpx;
......
let App = getApp()
Page({
data: {
shopInfo: {},
sideBar: [], // 侧边菜单
menuTitle: '', // 商品列表标题
commodityList: [], // 商品列表
commodityDetail: {}, // 商品详情
shoppingCart: [], // 购物车列表
shoppingCartTotal: 0, // 购物车总数
currentIndex: 0,
scrollTop: 0,
winToast: false,
winLoading: false,
winCommodityDetail: false,
},
onLoad: function () {
this.setShopInfo()
this.querySideBar()
},
setShopInfo: function () {
let funcShopInfo = wx.getStorageSync('shopInfoBuffer')
this.setData({
shopInfo: funcShopInfo
})
console.log(this.data.shopInfo)
},
/**
* 查询分类
* @function
* @param
* @returns
*/
querySideBar: function () {
App.wxRequest({
url: '/api/v1/commodity/getClassifys',
data: {
'officeId': this.data.shopInfo.id,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcSideBar = []
let funcResponse = response.data
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id,
'tab': funcResponse[i].name,
}
funcSideBar.push(funcItem)
}
this.setData({
sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab
})
this.queryCommodity()
}
})
},
/**
* 查询分类商品
* @function
* @param
* @returns
*/
queryCommodity: function () {
this.setData({
winLoading: true
})
App.wxRequest({
url: '/api/v1/commodity/getCommoditys',
data: {
'officeId': this.data.shopInfo.id,
'classifyId': this.data.sideBar[this.data.currentIndex].id,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcCommodityList = []
let funcResponse = response.data
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].classifyId, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'price': funcResponse[i].sightseerPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].sightseerPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceDiscount': funcResponse[i].price, // 活动价
'priceDiscountText': App.modular.utils.formatAmount(funcResponse[i].price), // 活动价文本格式
'priceType': 1,
'describe': funcResponse[i].synopsis,
'tags': funcResponse[i].tags,
}
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (funcItem.priceDiscount) {
funcItem.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (funcItem.price !== funcItem.priceSpecial && funcUserType) {
funcItem.priceType = 2
} else {
funcItem.priceType = 3
}
}
funcCommodityList.push(funcItem)
}
this.setData({
winLoading: false,
commodityList: funcCommodityList,
})
},
})
},
/**
* 侧边菜单选择事件
* @function
* @param {object} - event
* @returns
*/
onSelectionSideBar: function (event) {
let funcIndex = event.currentTarget.dataset.index
let funcMenuTitle = this.data.sideBar[funcIndex].tab
this.setData({
currentIndex: funcIndex,
menuTitle: funcMenuTitle,
scrollTop: 0
})
this.queryCommodity()
},
/**
* 查询商品详情
* @function
* @param {object} - event
* @returns
*/
onCommodityDetail: function (event) {
let funcItem = event.currentTarget.dataset.item
App.wxRequest({
url: '/api/v1/commodity/getCommodityParticulars',
data: {
'commodityId': funcItem.id,
'classifyId': funcItem.typeId,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcResponse = response.data
funcItem.banner = funcResponse.imgs.split('|')
funcItem.banner.pop()
this.setData({
commodityDetail: funcItem,
winCommodityDetail: true
})
}
})
},
/**
* 关闭商品详情
* @function
* @param
* @returns
*/
onCommodityClose: function () {
this.setData({
winCommodityDetail: false
})
},
/**
* 添加商品
* @function
* @param {object} - event
* @returns
*/
onCommodityAdd: function (event) {
let funcShoppingCart = this.data.shoppingCart
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false
let funcItem = event.currentTarget.dataset.item
if (!funcItem) {
funcWinToast = true
funcItem = this.data.commodityDetail
}
// 判断购物车中是否存在同类商品
// 修改相应的商品数量
if (funcShoppingCart.length !== 0) {
for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
if (funcItem.id === funcShoppingCart[i].id) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
break
}
if (i === funcShoppingCart.length - 1) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
} else {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
// 重新计算购物车总数
let funcShoppingCartTotal = 0
for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
funcShoppingCartTotal = funcShoppingCartTotal + funcShoppingCart[i].quantity
}
this.setData({
shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast,
winCommodityDetail: false,
})
},
onLoad: function (options) {
/**
* 跳转购物车页面
* @function
* @param
* @returns
*/
onShoppingCart: function () {
wx.setStorageSync('shoppingCartBuffer', this.data.shoppingCart)
wx.navigateTo({
url: '/pages/commodity/shopping-cart/shopping-cart',
})
},
})
\ No newline at end of file
<!--pages/home/home/home.wxml-->
<text>pages/home/home/home.wxml</text>
<l-toast
l-image-class="toast-image"
l-class="toast-bg"
show="{{winToast}}"
mask="{{true}}"
image="/image/success.png"
title="添加购物车成功"
></l-toast>
<l-toast
show="{{winLoading}}"
icon="loading"
title="加载中"
duration="20000"
mask="{{true}}"
></l-toast>
<navigation class="navigation" titleText="{{shopInfo.name}}" background="#FFFFFF;" backIcon="/image/back.png"></navigation>
<view class="row">
<!-- 侧边菜单 -->
<view class="side-bar">
<block wx:for="{{sideBar}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="menu-item {{currentIndex === index ? 'active' : ''}}" data-index="{{index}}" bindtap="onSelectionSideBar">
<text>{{item.tab}}</text>
</view>
</block>
</view>
<!-- 商品列表 -->
<view class="menu-list">
<view class="right-content-title">{{menuTitle}}</view>
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="commodity-item row">
<view class="item-img" data-item="{{item}}" bindtap="onCommodityDetail">
<image src="{{item.cover}}" mode="widthFix"></image>
</view>
<view class="item-info">
<view class="item-info-title">{{item.name}}</view>
<view class="item-info-text-wrap">
<view wx:if="{{item.describe}}">{{item.describe}}</view>
<view wx:else class="item-info-content"></view>
</view>
<view class="item-other row con-b">
<!-- 活动价样式 -->
<view wx:if="{{item.priceType === 1}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.priceDiscountText}}</text>
<text class="item-price-discount">活动价</text>
</view>
<view class="item-info-old-price row align-c">
<text>¥</text>
<text>{{item.priceText}}</text>
</view>
</view>
<!-- 业主价样式 -->
<view wx:if="{{item.priceType === 2}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.priceSpecialText}}</text>
<text class="item-price-special">业主价</text>
</view>
<view class="item-info-old-price row align-c">
<text>¥</text>
<text>{{item.priceText}}</text>
</view>
</view>
<!-- 普通价样式 -->
<view wx:if="{{item.priceType === 3}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.priceText}}</text>
<text></text>
</view>
</view>
<view class="item-operation-add">
<button class="row con-c align-c" data-item="{{item}}" bindtap="onCommodityAdd">
<image mode="widthFix" src="/image/add-w.png"></image>
</button>
</view>
</view>
</view>
</view>
</block>
<!-- 购物车按钮 -->
<view class="cart-btn row con-c align-c" bindtap="onShoppingCart">
<view class="cart-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap">
<image src="../../../image/cart.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<!-- 商品详情弹窗 -->
<l-popup show="{{winCommodityDetail}}" content-align="center" locked="{{true}}">
<view class="popup-wrap">
<view id="banner" class="banner">
<swiper autoplay circular class="banner-swiper" interval="5000" duration="500">
<block wx:for="{{commodityDetail.banner}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<swiper-item class="banner-swiper-item">
<image class="banner-swiper-image" src="{{item}}"></image>
</swiper-item>
</block>
</swiper>
<view class="banner-wave">
<image src="/image/ornament-1.png" mode="widthFix"></image>
</view>
</view>
<view class="popup-info-wrapper">
<view class="popuo-info-title">{{commodityDetail.name}}</view>
<view class="popup-info-text">{{commodityDetail.describe}}</view>
</view>
<view class="popup-footer-wrapper">
<!-- 活动价样式 -->
<view class="popup-price-row row align-c" wx:if="{{commodityDetail.priceType === 1}}">
<view class="detail-price-discount row con-c align-c">
<text>活动价</text>
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.priceDiscountText}}</text>
</view>
<view class="popup-price-old">
<text>¥</text>
<text>{{commodityDetail.priceText}}</text>
</view>
</view>
<!-- 业主价样式 -->
<view class="popup-price-row row align-c" wx:if="{{commodityDetail.priceType === 2}}">
<view class="detail-price-special row con-c align-c">
<text>业主价</text>
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.priceSpecialText}}</text>
</view>
<view class="popup-price-old">
<text>¥</text>
<text>{{commodityDetail.priceText}}</text>
</view>
</view>
<!-- 普通价样式 -->
<view class="popup-price-row row align-c" wx:if="{{commodityDetail.priceType === 3}}">
<view class="popup-price-special row con-c align-c">
<text></text>
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.priceText}}</text>
</view>
</view>
<view class="popup-footer-btn row con-c align-c" bindtap="onCommodityAdd">加入购物车</view>
</view>
</view>
<view class="popup-close-btn row con-c align-c" bindtap="onCommodityClose">
<view class="popup-close">
<image mode="widthFix" src="../../../image/icon_close.png"></image>
</view>
</view>
</l-popup>
\ No newline at end of file
/* pages/home/home/home.wxss */
\ No newline at end of file
page {
overflow: hidden;
}
.navigation {
z-index: 1100;
position: fixed;
top: 0;
left: 0;
width: 750rpx;
}
.side-bar {
width: 160rpx;
height: 100vh;
margin-top: 140rpx;
overflow-y: scroll;
background: #f2f3f5;
}
.side-bar::-webkit-scrollbar {
width: 0;
}
.menu-item {
height: 136rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 26rpx;
color: #656e7b;
}
.menu-item.active {
color: #5cb5dd;
font-weight: 600;
background: #fff;
border-left: 8rpx solid #86c5e1;
}
.menu-list {
width: 590rpx;
height: 100vh;
margin-top: 140rpx;
padding: 0 32rpx 200rpx 32rpx;
overflow-y: scroll;
background: #FFFFFF;
}
.right-content::-webkit-scrollbar {
width: 0;
}
.right-content-title {
height: 100rpx;
padding: 32rpx 0;
font-size: 26rpx;
color: #959da9;
}
.cart-btn {
position: fixed;
right: 48rpx;
bottom: 160rpx;
width: 104rpx;
height: 104rpx;
border-radius: 50%;
background-color: #86c5e1;
}
.cart-num {
position: absolute;
top: 0;
right: 0;
height: 32rpx;
padding: 0 12rpx;
font-size: 22rpx;
line-height: 32rpx;
border: 1px solid #86c5e1;
border-radius: 17rpx;
color: #86c5e1;
background-color: #fff;
}
.cart-img-wrap {
width: 48rpx;
height: 48rpx;
}
.commodity-item {
width: 100%;
min-height: 250rpx;
padding-bottom: 56rpx;
box-sizing: border-box;
}
.item-img {
width: 160rpx;
height: 160rpx;
}
.item-info {
flex: 1;
margin-left: 28rpx;
}
.item-info-title {
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
color: #15191F;
}
.item-info-text-wrap {
display: -webkit-box;
width: 342rpx;
height: 64rpx;
margin-top: 16rpx;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
font-size: 22rpx;
font-weight: 400;
line-height: 32rpx;
color: #959DA9;
}
.item-info-content {
height: 40rpx;
}
.item-other {
margin-top: 24rpx;
}
.item-operation {
margin-top: 24rpx;
font-size: 30rpx;
font-weight: 600;
color: #15191f;
}
.item-price text:nth-child(1) {
font-size: 22rpx;
}
.item-price text:nth-child(2) {
margin-right: 8rpx;
font-size: 30rpx;
}
.item-price-discount {
width: 78rpx;
height: 32rpx;
border-radius: 4px;
background: #FAEDEA;
text-align: center;
font-size: 18rpx;
font-weight: 500;
line-height: 32rpx;
color: #EF4E4E;
}
.item-price-special {
width: 78rpx;
height: 32rpx;
border-radius: 4px;
background: linear-gradient(180deg, #3F4357 0%, #252532 100%);
text-align: center;
font-size: 18rpx;
font-weight: 500;
line-height: 32rpx;
color: #E8D0AF;
}
.item-operation-add button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #86C5E1;
}
.item-operation-add image {
width: 24rpx;
height: 24rpx;
}
.goods-add-btn-wrap {
flex: 1;
}
.l-btn-circle {
border-radius: 50% !important;
font-size: 24rpx;
}
.item-info-old-price {
margin-top: 4rpx;
font-size: 22rpx;
color: #959da9;
text-decoration: line-through;
}
.popup-wrap {
width: 606rpx;
margin-top: 100rpx;
background-color: #fff;
border-radius: 4rpx;
}
.popup-img-wrap {
width: 606rpx;
height: 382rpx;
}
.popup-info-wrapper {
padding: 48rpx 40rpx;
}
.popuo-info-title {
font-size: 34rpx;
color: #15191f;
}
.popup-info-text {
margin-top: 24rpx;
font-size: 22rpx;
line-height: 32rpx;
color: #959da9;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.popup-footer-wrapper {
margin: 0 40rpx;
padding: 40rpx 0;
border-top: 1px solid #e2e7ef;
}
.popup-price-row {
padding: 10rpx 0;
}
.popup-price-now {
color: #15191f;
}
.detail-price text:nth-child(1) {
height: 52rpx;
font-size: 30rpx;
font-weight: 500;
line-height: 52rpx;
color: #15191F;
}
.detail-price text:nth-child(2) {
height: 52rpx;
font-size: 38rpx;
font-weight: 500;
line-height: 52rpx;
color: #15191F;
}
.detail-price-discount {
width: 90rpx;
height: 36rpx;
margin-right: 16rpx;
border-radius: 4px;
background: #FAEDEA;
text-align: center;
font-size: 18rpx;
font-weight: 500;
line-height: 32rpx;
color: #EF4E4E;
}
.detail-price-special {
width: 90rpx;
height: 36rpx;
margin-right: 16rpx;
border-radius: 4px;
background: linear-gradient(180deg, #3F4357 0%, #252532 100%);
text-align: center;
font-size: 18rpx;
font-weight: 500;
line-height: 32rpx;
color: #E8D0AF;
}
.popup-price-old {
margin-left: 20rpx;
font-size: 26rpx;
color: #959da9;
text-decoration: line-through;
}
.popup-footer-btn {
width: 526rpx;
height: 80rpx;
margin-top: 30rpx;
font-size: 30rpx;
color: #fff;
background-color: #86c5e1;
border-radius: 4rpx;
}
.popup-close-btn {
width: 80rpx;
height: 80rpx;
margin: 48rpx auto 0;
background: rgba(254, 252, 249, 0.5);
border-radius: 50%;
}
.popup-close {
width: 40rpx;
height: 40rpx;
}
.toast-bg {
min-width: 262rpx !important;
min-height: 262prx !important;
}
.toast-image {
z-index: 1900;
}
image {
width: 100%;
height: 100%;
}
/* 商品详情样式 */
.banner {
position: relative;
width: 606rpx;
height: 382rpx;
border-radius: 4px;
background: #FFFFFF;
}
.banner-swiper,
.banner-swiper-item,
.banner-swiper-image {
position: absolute;
top: 0 !important;
left: 0 !important;
width: 606rpx;
height: 382rpx;
}
.banner-wave {
z-index: 1100;
position: absolute;
bottom: -2rpx;
left: 0;
width: 606rpx;
height: 50rpx;
}
.banner-wave image {
width: 606rpx;
height: 50rpx;
}
\ No newline at end of file
......@@ -56,16 +56,6 @@ Page({
'tab': funcResponse[i].name,
}
funcSideBar.push(funcItem)
funcSideBar.push({ id: '1', tab: '2' })
funcSideBar.push({ id: '1', tab: '3' })
funcSideBar.push({ id: '1', tab: '4' })
funcSideBar.push({ id: '1', tab: '5' })
funcSideBar.push({ id: '1', tab: '6' })
funcSideBar.push({ id: '1', tab: '7' })
funcSideBar.push({ id: '1', tab: '8' })
funcSideBar.push({ id: '1', tab: '9' })
funcSideBar.push({ id: '1', tab: '10' })
funcSideBar.push({ id: '1', tab: '11' })
}
this.setData({
......
<navigation class="navigation" titleText="{{titleText}}" backIcon="/image/back.png"></navigation>
<navigation class="navigation" titleText="{{navbarTitle}}" backIcon="/image/back.png"></navigation>
<view class="container con-s" style="background: {{bgColor}}">
<view class="background-img">
<image src="{{backgroundImg}}"></image>
<image wx:if="{{banner}}" src="{{resourcesBase + banner}}"></image>
</view>
<block wx:for="{{projectList}}" wx:key="id">
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="project-wrapper col">
<view class="project-cover">
<image src=""></image>
<image src="{{item.cover}}"></image>
</view>
<view class="project-info">
<view class="project-name">
<text>{{item.name}}</text>
</view>
<view class="project-msg" wx:if="{{item.msg}}">
<text>{{item.msg}}</text>
<text>{{item.describe}}</text>
</view>
<view class="project-price-wrapper row align-c">
<view class="price-special-msg" wx:if="{{item.isSpecial}}">
<text>业主价</text>
</view>
<view class="price-special">
<text class="price-symbol">¥</text>
<text>{{item.priceSpecial}}</text>
<text class="price-unit" wx:if="{{item.unit}}">{{'/' + item.unit}}</text>
<text>{{item.priceSpecialText}}</text>
<text class="price-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view>
<view class="price-old">
<text>{{'¥' + item.price}}</text>
<text class="price-old-unit" wx:if="{{item.unit}}">{{'/' + item.unit}}</text>
<text>¥</text>
<text>{{item.priceText}}</text>
<text class="price-old-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view>
</view>
<view class="project-btn">
<text>{{item.btn}}</text>
<view class="project-btn" data-item="{{item}}" bindtap="onBuy">
<text>{{buyText}}</text>
</view>
</view>
</view>
......
let App = getApp()
Page({
data: {
shopInfo: {},
commodityTypeId: '',
commodityList: [],
winLoading: false,
projectType: 1, // 1 儿童营地,2 - SPA,3 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
bannerIndex: 0,
banner: [
......@@ -117,8 +125,88 @@ Page({
}
},
onLoad: function (options) {
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
this.queryCommodityTab()
},
queryCommodityTab: function () {
App.wxRequest({
url: '/api/v1/commodity/getClassifys',
data: {
'officeId': this.data.shopInfo.id,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcResponse = response.data
this.setData({
commodityTypeId: funcResponse[0].id
})
this.queryCommodity()
}
})
},
queryCommodity: function () {
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
App.wxRequest({
url: '/api/v1/commodity/getCommoditys',
data: {
'officeId': this.data.shopInfo.id,
'classifyId': this.data.commodityTypeId,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcCommodityList = []
let funcResponse = response.data
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].classifyId, // 商品分类标识
'inventoriesId': funcResponse[i].inventorie[0].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'price': funcResponse[i].inventorie[0].sightseerPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].inventorie[0].sightseerPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].inventorie[0].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].inventorie[0].ownerPrice), // 业主价文本格式
'priceDiscount': funcResponse[i].inventorie[0].price, // 活动价
'priceDiscountText': App.modular.utils.formatAmount(funcResponse[i].inventorie[0].price), // 活动价文本格式
'priceType': 1,
'describe': funcResponse[i].synopsis,
'tags': funcResponse[i].tags,
}
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (funcItem.priceDiscount) {
funcItem.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (funcItem.price !== funcItem.priceSpecial && funcUserType) {
funcItem.priceType = 2
} else {
funcItem.priceType = 3
}
}
funcCommodityList.push(funcItem)
}
this.setData({
winLoading: false,
commodityList: funcCommodityList,
})
},
})
},
/**
* banner 切换图片同步自定义标识组件
* @function
......
......@@ -16,12 +16,12 @@
</view>
</view>
<block wx:for="{{projectAll}}" wx:for-index="key" wx:for-item="value">
<block wx:for="{{projectAll}}" wx:for-index="key" wx:for-item="item">
<view class="project-wrapper">
<view class="project-title">
<image src="{{value.titleImg}}"></image>
<image src="{{item.titleImg}}"></image>
</view>
<block wx:for="{{value.list}}">
<block wx:for="{{item.list}}">
<view class="project-item row">
<view class="project-cover">
<image src="{{item.cover}}"></image>
......@@ -54,7 +54,7 @@
</view>
<view class="project-buy-wrapper col align-e">
<view class="project-buy-btn">
<text>{{value.btn}}</text>
<text>{{item.btn}}</text>
</view>
</view>
</view>
......
......@@ -94,8 +94,6 @@ Page({
})
this.selectionTotal()
console.log(JSON.stringify(funcShoppingCart))
},
/**
......@@ -288,7 +286,7 @@ Page({
// 在此之前需要校验用户是否登录,以及商品库存是否充足
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=5' + '&amount=' + this.data.amountPay
url: '/pages/pay/order-input/order-input?type=5'
})
},
......
......@@ -251,12 +251,9 @@ Page({
tempArray.push(strategy)
}
console.log('tempArray', tempArray)
if (that.data.pageNo == 1) {
var newArr = tempArray.slice(1)
var firstItem = tempArray[0]
console.log('firstItem', firstItem)
that.setData({
moreData: (tempArray.length >= Number(res.data.count)) ? false : true,
['strategyFirstItem.id']: firstItem.id,
......@@ -346,6 +343,5 @@ Page({
wx.navigateTo({
url: '/pages/pay/order-comment/order-comment',
});
}
})
\ No newline at end of file
......@@ -7,7 +7,7 @@ Page({
isphone: false,
},
onLoad: function(options) {
onLoad: function (options) {
let mobile = wx.getStorageSync('mobile')
let nickName = wx.getStorageSync('nickName')
let avatarUrl = wx.getStorageSync('avatarUrl')
......@@ -19,7 +19,7 @@ Page({
})
},
back: function(e) {
back: function (e) {
if (this.data.islogin && this.data.isphone) {
console.log('授权及绑定成功')
} else {
......@@ -36,7 +36,7 @@ Page({
/*
* 获取用户信息
*/
userInfoHandler(res) {
userInfoHandler: function (res) {
console.log('userInfo', res)
if (!res.detail.userInfo) {
return
......@@ -71,7 +71,7 @@ Page({
/*
* 绑定手机号
*/
userPhoneHandler(res) {
userPhoneHandler: function (res) {
console.log('userPhone', res)
if (!res.detail.encryptedData) {
return
......@@ -99,8 +99,8 @@ Page({
})
},
registUserInfo(obj) {
app.registUserInfo({
registUserInfo: function (obj) {
App.registUserInfo({
param: obj.param,
success: function(res) {
if (obj.success) {
......@@ -110,7 +110,7 @@ Page({
})
},
checkFinish() {
checkFinish: function () {
if (this.data.islogin && this.data.isphone) {
wx.navigateBack({})
}
......
......@@ -68,6 +68,10 @@
color: #FFFFFF;
}
.container-order {
margin-top: 170rpx;
}
.container {
position: relative;
}
......
......@@ -98,7 +98,7 @@
</view>
<view class="shopping-cart-list">
<block wx:for="{{shoppingCartList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shopping-cart-item row con-b align-c" data-item="{{item}}">
<view wx:if="{{item.isActive}}" class="shopping-cart-item row con-b align-c" data-item="{{item}}">
<view class="shopping-cart-item-cover">
<image src="{{item.cover}}"></image>
</view>
......@@ -106,7 +106,7 @@
<text>{{item.name}}</text>
</view>
<view class="shopping-cart-item-info col">
<text>{{'¥' + item.priceConfirm}}</text>
<text>{{'¥' + item.priceFinal}}</text>
<text>{{'x' + item.quantity}}</text>
</view>
</view>
......
......@@ -4,11 +4,10 @@
"ignore": []
},
"setting": {
"urlCheck": false,
"urlCheck": true,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
......@@ -20,12 +19,13 @@
"checkInvalidKey": true,
"checkSiteMap": false,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"preloadBackgroundData": false,
"compileHotReLoad": false,
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
......
// 程序缓存关键字说明
// shopInfoBuffer: 门店详情信息
// buyCommodityInfo: 当前购买商品信息 - 单一种类
// buyCommodityInfoList: 当前购买商品信息 - 多种种类
\ No newline at end of file
......@@ -30,6 +30,29 @@ let output = {
if (!funcAmountValue) return
return funcAmountValue.toString().replace(/([0-9]{2})$/, '.$1')
},
// 项目通用函数
/**
* 商品价格选择函数
* 当商品的价格针对不同用户拥有不同价格时,可以通过此函数进行判断,确定最终支付价格
* @function
* @param {array } - funcCommodityList 商品列表
* @returns
*/
priceSelection: function (funcCommodityList) {
let funcUserStatus = wx.getStorageSync('userInfo').userType
// 属性名称为使用者身份标识
// 属性数值为对应能享受的价格字段,优先级按照数组顺序
let funcStatusPrice = {
'0': ['priceDiscount', 'price'],
'1': ['priceDiscount', 'priceSpecial'],
}
for (let i = 0, l = funcCommodityList.length; i < l; i++) {
}
},
}
export default output
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment