Commit 8530a62f by wjw

Merge branch 'master' of http://120.77.182.185/yanl/mini-shimao.git into master

# Conflicts:
#	pages/pay/order-detail/order-detail.wxml
parents 93bd6f16 3a64cb5f
...@@ -15,6 +15,8 @@ App({ ...@@ -15,6 +15,8 @@ App({
appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/', appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/',
shopId: iEnvironmental.shopId, shopId: iEnvironmental.shopId,
payStateTimer: 0,
token: '', token: '',
refreshToken: '', refreshToken: '',
userInfo: null, userInfo: null,
......
...@@ -113,8 +113,8 @@ ...@@ -113,8 +113,8 @@
}, },
{ {
"pagePath": "pages/commodity/home/home", "pagePath": "pages/commodity/home/home",
"iconPath": "image/tabbar/play.png", "iconPath": "image/tabbar/service.png",
"selectedIconPath": "image/tabbar/play-s.png", "selectedIconPath": "image/tabbar/service-s.png",
"text": "服务" "text": "服务"
}, },
{ {
......
...@@ -159,9 +159,6 @@ Component({ ...@@ -159,9 +159,6 @@ Component({
textCss: App.cssObjectToCssString(funcTextStyle), textCss: App.cssObjectToCssString(funcTextStyle),
iconCss: App.cssObjectToCssString(funcIconStyle), iconCss: App.cssObjectToCssString(funcIconStyle),
}) })
console.log(this.data.iconCss)
}, },
/** /**
......
.navbar { .navbar {
z-index: 2000; z-index: 9000;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
......
...@@ -15,13 +15,13 @@ let Development = { ...@@ -15,13 +15,13 @@ let Development = {
// 门店信息 // 门店信息
shopId: [ shopId: [
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', name: '海错图', logo: 'shopping-cart-logo-4.png', title: ['', '海错图购票', '11', '海错图文创店', '22', '儿童营地接待区', '33'] }, { appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', name: '海错图', logo: 'shopping-cart-logo-4.png', title: ['海错图', '海错图购票', '海错图', '海错图文创店', '海错图', '海错图', '海错图'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', name: '星空影院', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] }, { appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', name: '星空影院', logo: 'shopping-cart-logo-6.png', title: ['星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院', '星空影院'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', name: '儿童营地', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] }, { 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: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] }, { 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: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] }, { appId: 5, id: '26c40446fc454a02abe61758176597f6', name: '拾光花坊', logo: 'shopping-cart-logo-7.png', title: ['拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊', '拾光花坊'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', name: '原味舒食', logo: 'shopping-cart-logo-1.png', title: ['', '儿童营地入园购票', '1', '1', '1', '原味舒食', '1'] }, { 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: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] }, { appId: 7, id: '2614f117406548718bc091f24368c16e', name: '元养水韵SPA', logo: 'shopping-cart-logo-7.png', title: ['元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA', '元养水韵SPA'] },
] ]
} }
......
// pages/home/service/service.js
const App = getApp() const App = getApp()
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
phone: '13316748039', phone: '13316748039',
hotline: false, //客服热线 hotline: false, //客服热线
shopRecommendA: [], // 顶部第一商店推荐
shopRecommendB: [], // 顶部第二商店推荐
shopRecommendC: [], // 底部第一商店推荐
shopRecommendD: [], // 底部第二商店推荐
}, },
onGoShop: function (event) { onLoad: function () {
let funcShopType = event.currentTarget.dataset.type this.queryRecommend()
let funcShopAppId = event.currentTarget.dataset.id },
/**
* 查询推荐商品
* @function
* @param {object} - funcEvent
* @returns
*/
queryRecommend: function () {
let funcShopInfo = [
{
'shopId': '',
'shopAppId': 6,
'commodityType': 5
}, {
'shopId': '',
'shopAppId': 4,
'commodityType': 5
}, {
'shopId': '',
'shopAppId': 1,
'commodityType': 4
}, {
'shopId': '',
'shopAppId': 3,
'commodityType': 4
},
]
param: for (let i = 0, l = funcShopInfo.length; i < l; i++) {
shop: for (let ii = 0, ll = App.globalData.shopId.length; ii < ll; ii++) {
if (funcShopInfo[i].shopAppId === App.globalData.shopId[ii].appId) {
funcShopInfo[i].shopId = App.globalData.shopId[ii].id
break shop
}
}
}
// 顶部第一商店推荐
App.wxRequest({
url: '/api/v1/commodity/recommend',
data: {
'officeId': funcShopInfo[0].shopId,
'genre': 5,
'tag': '202',
},
success: (response) => {
let funcResponse = response.data
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
}
funcList.push(funcItem)
}
this.setData({
shopRecommendA: funcList
})
}
})
// 顶部第二商店推荐
App.wxRequest({
url: '/api/v1/commodity/recommend',
data: {
'officeId': funcShopInfo[1].shopId,
'genre': 5,
'tag': '202',
},
success: (response) => {
let funcResponse = response.data
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
}
funcList.push(funcItem)
}
this.setData({
shopRecommendB: funcList
})
}
})
// 底部第一商店推荐
App.wxRequest({
url: '/api/v1/commodity/recommend',
data: {
'officeId': funcShopInfo[2].shopId,
'genre': 4,
'tag': '202',
},
success: (response) => {
let funcResponse = response.data
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
}
funcList.push(funcItem)
}
this.setData({
shopRecommendC: funcList
})
}
})
// 底部第二商店推荐
App.wxRequest({
url: '/api/v1/commodity/recommend',
data: {
'officeId': funcShopInfo[3].shopId,
'genre': 4,
'tag': '202',
},
success: (response) => {
let funcResponse = response.data
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
}
funcList.push(funcItem)
}
this.setData({
shopRecommendD: funcList
})
}
})
},
/**
* 缓存用户信息
* @function
* @param {object} - event
* @returns
*/
setShopInfo: function (funcShopAppId, funcShopType) {
// 获取门店基本信息 // 获取门店基本信息
let funcShopId = App.globalData.shopId let funcShopId = App.globalData.shopId
for (let i = 0, l = funcShopId.length; i < l; i++) { for (let i = 0, l = funcShopId.length; i < l; i++) {
...@@ -32,43 +184,121 @@ Page({ ...@@ -32,43 +184,121 @@ Page({
break break
} }
} }
},
// 1 - 年卡月卡,2 - 普通商品,3 - 门票商品,4 - 文创商品,5 - 餐品,6 - 积分商品 /**
switch (funcShopType) { * 餐品
case 1: * @function
wx.navigateTo({ * @param {object} - event
url: '/pages/commodity/menu-snacks/menu-snacks' * @returns
}) */
break onBuyFood: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 5
let funcShopAppId = event.currentTarget.dataset.id
case 4: this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({ wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks' url: '/pages/commodity/menu-food/menu-food'
}) })
break },
case 5: /**
wx.navigateTo({ * 所有
url: '/pages/commodity/menu-snacks/menu-snacks' * @function
}) * @param {object} - event
break * @returns
} */
onBuyAll: function () {
wx.navigateTo({
url: '/pages/commodity/project/project'
})
},
/**
* 年卡月卡
* @function
* @param {object} - event
* @returns
*/
onBuyMembership: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 1
let funcShopAppId = event.currentTarget.dataset.id
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/project-detail/project-detail'
})
},
/**
* 门票
* @function
* @param {object} - event
* @returns
*/
onBuyPassCheck: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 3
let funcShopAppId = event.currentTarget.dataset.id
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/project-detail/project-detail'
})
}, },
/** /**
* 跳转门票页面 * 服务套餐
* @function * @function
* @param {object} - event * @param {object} - event
* @returns * @returns
*/ */
onMemberList: function (event) { onBuyService: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 2
let funcShopAppId = event.currentTarget.dataset.id
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/project-detail/project-detail'
})
}, },
onReceptionList: function (event) { /**
* 能量补给
* @function
* @param {object} - event
* @returns
*/
onBuySupply: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 2
let funcShopAppId = event.currentTarget.dataset.id
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
})
}, },
/**
* 文创
* @function
* @param {object} - event
* @returns
*/
onBuyOriginality: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 4
let funcShopAppId = event.currentTarget.dataset.id
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-art/menu-art'
})
},
//客服热线拨打 //客服热线拨打
call() { call() {
......
...@@ -19,13 +19,15 @@ ...@@ -19,13 +19,15 @@
<swiper-item> <swiper-item>
<view class="shop-banner row con-c"> <view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-1.png'}}"></image> <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>
<view class="shop-menu"> <view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}"> <block wx:for="{{shopRecommendA}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<image></image> <view class="shop-menu-item col con-c align-c">
<text>炭烤猪肋排拼盘</text> <image src="{{item.cover}}"></image>
</view> <text>{{item.name}}</text>
</view>
</block>
</view> </view>
</swiper-item> </swiper-item>
...@@ -33,13 +35,15 @@ ...@@ -33,13 +35,15 @@
<swiper-item> <swiper-item>
<view class="shop-banner row con-c"> <view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-2.png'}}"></image> <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>
<view class="shop-menu"> <view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}"> <block wx:for="{{shopRecommendB}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<image></image> <view class="shop-menu-item col con-c align-c">
<text>炭烤猪肋排拼盘</text> <image src="{{item.cover}}"></image>
</view> <text>{{item.name}}</text>
</view>
</block>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -51,17 +55,17 @@ ...@@ -51,17 +55,17 @@
<text>您可以用最优惠的价格</text> <text>您可以用最优惠的价格</text>
<text>享受超级服务</text> <text>享受超级服务</text>
</view> </view>
<view class="services-banner"> <view class="services-banner" bindtap="onBuyAll">
<image src="{{resourcesBase + 'commodity/home/services-title.png'}}"></image> <image src="{{resourcesBase + 'commodity/home/services-title.png'}}"></image>
</view> </view>
<view class="services-list col align-c"> <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> <image src="{{resourcesBase + 'commodity/home/services-1.png'}}"></image>
</view> </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> <image src="{{resourcesBase + 'commodity/home/services-2.png'}}"></image>
</view> </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> <image src="{{resourcesBase + 'commodity/home/services-3.png'}}"></image>
</view> </view>
</view> </view>
...@@ -77,11 +81,11 @@ ...@@ -77,11 +81,11 @@
<image src="{{resourcesBase + 'commodity/home/reception-title.png'}}"></image> <image src="{{resourcesBase + 'commodity/home/reception-title.png'}}"></image>
</view> </view>
<view class="reception-list col align-c"> <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> <image src="{{resourcesBase + 'commodity/home/reception-1.png'}}"></image>
<text>儿童营地接待区</text> <text>儿童营地接待区</text>
</view> </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> <image src="{{resourcesBase + 'commodity/home/reception-2.png'}}"></image>
<text>拾光花坊</text> <text>拾光花坊</text>
</view> </view>
...@@ -102,13 +106,15 @@ ...@@ -102,13 +106,15 @@
<swiper-item> <swiper-item>
<view class="shop-banner row con-c"> <view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-3.png'}}"></image> <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>
<view class="shop-menu"> <view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}"> <block wx:for="{{shopRecommendC}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<image></image> <view class="shop-menu-item col con-c align-c">
<text>炭烤猪肋排拼盘</text> <image src="{{item.cover}}"></image>
</view> <text>{{item.name}}</text>
</view>
</block>
</view> </view>
</swiper-item> </swiper-item>
...@@ -116,13 +122,15 @@ ...@@ -116,13 +122,15 @@
<swiper-item> <swiper-item>
<view class="shop-banner row con-c"> <view class="shop-banner row con-c">
<image src="{{resourcesBase + 'commodity/home/shop-4.png'}}"></image> <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>
<view class="shop-menu"> <view class="shop-menu">
<view class="shop-menu-item" wx:for="{{4}}"> <block wx:for="{{shopRecommendD}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<image></image> <view class="shop-menu-item col con-c align-c">
<text>炭烤猪肋排拼盘</text> <image src="{{item.cover}}"></image>
</view> <text>{{item.name}}</text>
</view>
</block>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
......
...@@ -243,9 +243,9 @@ swiper { ...@@ -243,9 +243,9 @@ swiper {
position: relative; position: relative;
top: -100rpx; top: -100rpx;
display: flex; display: flex;
flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
flex-direction: row;
margin: 0 40rpx; margin: 0 40rpx;
} }
...@@ -259,8 +259,12 @@ swiper { ...@@ -259,8 +259,12 @@ swiper {
.shop-menu-item > text { .shop-menu-item > text {
display: block; display: block;
max-width: 300rpx;
margin: 40rpx 0 48rpx 0; margin: 40rpx 0 48rpx 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 30rpx; font-size: 30rpx;
font-weight: 300; font-weight: 300;
line-height: 42rpx; line-height: 42rpx;
......
let App = getApp()
Page({ Page({
data: { 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--> <l-toast
<text>pages/home/home/home.wxml</text> 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 */ page {
\ No newline at end of file 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({ ...@@ -56,16 +56,6 @@ Page({
'tab': funcResponse[i].name, 'tab': funcResponse[i].name,
} }
funcSideBar.push(funcItem) 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({ this.setData({
......
// pages/commodity/project-detail/project-detail.js let App = getApp()
Page({ Page({
data: { data: {
projectType: 3, // 1 儿童营地,2 - SPA,3 - 文创 imageBase: App.globalData.appImageBase,
titleText: '', resourcesBase: App.globalData.appResourcesBase,
navbarTitle: '',
banner: '',
bgColor: '', bgColor: '',
backgroundImg: '', buyText: '',
projectList: [] unitText: '',
userInfo: {},
commodityList: [],
}, },
onLoad: function (options) { onLoad: function () {
let { projectType } = this.data // 设置当前门店信息
switch (projectType) { this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
switch (this.data.shopInfo.appId) {
case 1: case 1:
this.setData({ this.setData({
titleText: '儿童营地', navbarTitle: '海错图购票',
backgroundImg: '', banner: 'service/detail-banner-1.png',
bgColor: 'linear-gradient(180deg, rgba(246, 218, 218, 0) 0%, #F6DADA 100%)', bgColor: '#F5ECD8',
projectList: [ buyText: '购买门票',
{ unitText: '/人',
id: 0, commodityList: []
cover: '',
name: '儿童营地日票(次票)',
priceSpecial: '10',
price: '49',
unit: '次',
btn: '购买门票',
isSpecial: true
},
{
id: 1,
cover: '',
name: '儿童营地日票(套票)',
priceSpecial: '80',
price: '100',
unit: '次',
btn: '购买门票',
isSpecial: true
},
{
id: 2,
cover: '',
name: '儿童营地月卡',
priceSpecial: '300',
price: '500',
unit: '人',
btn: '购买门票',
isSpecial: true
},
{
id: 3,
cover: '',
name: '儿童营地年卡',
priceSpecial: '1680',
price: '2680',
unit: '人',
btn: '购买门票',
isSpecial: true
}
]
}) })
break break
case 2:
case 3:
this.setData({ this.setData({
titleText: '元养水韵SPA服务', navbarTitle: '儿童营地',
backgroundImg: '', banner: 'service/detail-banner-3.png',
bgColor: '#8FC3CB', bgColor: '#F6DADA',
projectList: [ buyText: '购买门票',
{ unitText: '/人',
id: 0, commodityList: []
cover: '',
name: '泰国皇室经典SPA芳香精油理疗套餐',
msg: '保湿补水,深层清洁,提亮肤色',
priceSpecial: '120',
price: '180',
btn: '购买',
isSpecial: true
},
{
id: 1,
cover: '',
name: '全身舒缓释压芳香SPA护理',
msg: '保湿补水,深层清洁,提亮肤色',
priceSpecial: '120',
price: '180',
btn: '购买',
isSpecial: false
},
]
}) })
break break
case 3:
case 7:
this.setData({ this.setData({
titleText: '海错图购票', navbarTitle: '元养水韵SPA服务',
backgroundImg: '', banner: 'service/detail-banner-7.png',
bgColor: '#F5ECD8', bgColor: '#8FC3CB',
projectList: [ buyText: '购买',
{ unitText: '',
id: 0, commodityList: []
cover: '',
name: '海错图平日票',
priceSpecial: '42',
price: '49',
unit: '人',
btn: '购买门票',
isSpecial: true
},
{
id: 1,
cover: '',
name: '海错图周末票',
priceSpecial: '60',
price: '80',
unit: '人',
btn: '购买门票',
isSpecial: true
}
]
}) })
break break
} }
this.queryCommodity()
},
queryCommodity: function () {
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
App.wxRequest({
url: '/api/v1/commodity/getCommoditys',
data: {
'officeId': this.data.shopInfo.id,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcCommodityList = []
let funcResponse = response.data
switch (this.data.shopInfo.shopType) {
// 年卡月卡
case 1:
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)
}
console.log(JSON.stringify(funcCommodityList))
break
// 普通商品
case 2:
// 门票商品
case 3:
default:
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)
}
console.log(JSON.stringify(funcCommodityList))
break
}
this.setData({
winLoading: false,
commodityList: funcCommodityList,
})
},
})
},
onBuy: function (event) {
let funcAmount = 0
let funcCommodityInfo = event.currentTarget.dataset.item
// 补充必要参数
funcCommodityInfo.quantity = 1
funcCommodityInfo.quantityMin = 1
funcCommodityInfo.quantityMax = 1
funcCommodityInfo.isActive = true
wx.setStorageSync('shoppingCartBuffer', [funcCommodityInfo])
console.log(JSON.stringify(funcCommodityInfo))
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + this.data.shopInfo.shopType
})
}, },
}) })
\ No newline at end of file
<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="container con-s" style="background: {{bgColor}}">
<view class="background-img"> <view class="background-img">
<image src="{{backgroundImg}}"></image> <image wx:if="{{banner}}" src="{{resourcesBase + banner}}"></image>
</view> </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-wrapper col">
<view class="project-cover"> <view class="project-cover">
<image src=""></image> <image src="{{item.cover}}"></image>
</view> </view>
<view class="project-info"> <view class="project-info">
<view class="project-name"> <view class="project-name">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
<view class="project-msg" wx:if="{{item.msg}}"> <view class="project-msg" wx:if="{{item.msg}}">
<text>{{item.msg}}</text> <text>{{item.describe}}</text>
</view> </view>
<view class="project-price-wrapper row align-c">
<view class="price-special-msg" wx:if="{{item.isSpecial}}"> <!-- 活动价样式 -->
<view class="project-price-wrapper row align-c" wx:if="{{item.priceType === 1}}">
<view class="item-price-discount row con-c align-c">
<text>活动价</text>
</view>
<view class="price-special">
<text class="price-symbol">¥</text>
<text>{{item.priceDiscountText}}</text>
<text class="price-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view>
<view class="price-old">
<text>¥</text>
<text>{{item.priceText}}</text>
<text class="price-old-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view>
</view>
<!-- 业主价样式 -->
<view class="project-price-wrapper row align-c" wx:if="{{item.priceType === 2}}">
<view class="item-price-special row con-c align-c">
<text>业主价</text> <text>业主价</text>
</view> </view>
<view class="price-special"> <view class="price-special">
<text class="price-symbol">¥</text> <text class="price-symbol">¥</text>
<text>{{item.priceSpecial}}</text> <text>{{item.priceSpecialText}}</text>
<text class="price-unit" wx:if="{{item.unit}}">{{'/' + item.unit}}</text> <text class="price-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view> </view>
<view class="price-old"> <view class="price-old">
<text>{{'¥' + item.price}}</text> <text>¥</text>
<text class="price-old-unit" wx:if="{{item.unit}}">{{'/' + item.unit}}</text> <text>{{item.priceText}}</text>
<text class="price-old-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view>
</view>
<!-- 普通价样式 -->
<view class="project-price-wrapper row align-c" wx:if="{{item.priceType === 3}}">
<view class="price-special-msg row con-c align-c">
<text></text>
</view>
<view class="price-special">
<text class="price-symbol">¥</text>
<text>{{item.priceText}}</text>
<text class="price-unit" wx:if="{{item.unit}}">{{unitText}}</text>
</view> </view>
</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> </view>
</view> </view>
......
...@@ -13,44 +13,64 @@ ...@@ -13,44 +13,64 @@
margin-bottom: 48rpx; margin-bottom: 48rpx;
border-radius: 4rpx; border-radius: 4rpx;
} }
.project-cover { .project-cover {
width: 670rpx; width: 670rpx;
height: 376rpx; height: 376rpx;
background-color: lightpink; background-color: lightpink;
} }
.project-info { .project-info {
position: relative; position: relative;
padding: 32rpx; padding: 32rpx;
background-color: #fff; background-color: #fff;
} }
.project-name { .project-name {
color: #15191F; color: #15191F;
font-size: 34rpx; font-size: 34rpx;
font-weight: 600; font-weight: 600;
line-height: 48rpx; line-height: 48rpx;
} }
.project-msg { .project-msg {
margin-top: 16rpx; margin-top: 16rpx;
color: #959DA9; color: #959DA9;
font-size: 26rpx; font-size: 26rpx;
line-height: 36rpx; line-height: 36rpx;
} }
.project-price-wrapper { .project-price-wrapper {
height: 64rpx; height: 64rpx;
margin-top: 40rpx; margin-top: 40rpx;
line-height: 64rpx; line-height: 64rpx;
} }
.price-special-msg {
.item-price-discount {
width: 78rpx; width: 78rpx;
height: 32rpx; height: 32rpx;
margin-right: 12rpx; margin-right: 12rpx;
color: #E8D0AF; border-radius: 4px;
background: #FAEDEA;
font-size: 18rpx; font-size: 18rpx;
text-align: center; font-weight: 500;
line-height: 32rpx; line-height: 26rpx;
color: #EF4E4E;
}
.item-price-special {
width: 78rpx;
height: 32rpx;
border-radius: 4px;
background: linear-gradient(180deg, #3F4357 0%, #252532 100%); background: linear-gradient(180deg, #3F4357 0%, #252532 100%);
border-radius: 4rpx;
font-size: 18rpx;
font-weight: 500;
line-height: 26rpx;
color: #E8D0AF;
} }
.price-special { .price-special {
margin-right: 12rpx; margin-right: 12rpx;
color: #EF4E4E; color: #EF4E4E;
...@@ -58,23 +78,27 @@ ...@@ -58,23 +78,27 @@
line-height: 34rpx; line-height: 34rpx;
font-weight: 600; font-weight: 600;
} }
.price-symbol { .price-symbol {
font-size: 24rpx; font-size: 24rpx;
} }
.price-unit { .price-unit {
font-size: 20rpx; font-size: 20rpx;
} }
.price-old { .price-old {
margin-top: 10rpx;
color: #959DA9; color: #959DA9;
font-size: 22rpx; font-size: 22rpx;
line-height: 32rpx; line-height: 32rpx;
letter-spacing: 1rpx; letter-spacing: 1rpx;
text-decoration: line-through; text-decoration: line-through;
} }
.price-old-unit { .price-old-unit {
font-size: 18rpx; font-size: 18rpx;
} }
.project-btn { .project-btn {
position: absolute; position: absolute;
right: 32rpx; right: 32rpx;
......
let App = getApp()
Page({ Page({
data: { data: {
shopInfo: {},
commodityTypeId: '',
commodityList: [],
winLoading: false,
projectType: 1, // 1 儿童营地,2 - SPA,3 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 projectType: 1, // 1 儿童营地,2 - SPA,3 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
bannerIndex: 0, bannerIndex: 0,
banner: [ banner: [
...@@ -117,8 +125,88 @@ Page({ ...@@ -117,8 +125,88 @@ Page({
} }
}, },
onLoad: function (options) { 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 切换图片同步自定义标识组件 * banner 切换图片同步自定义标识组件
* @function * @function
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
</view> </view>
</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-wrapper">
<view class="project-title"> <view class="project-title">
<image src="{{value.titleImg}}"></image> <image src="{{item.titleImg}}"></image>
</view> </view>
<block wx:for="{{value.list}}"> <block wx:for="{{item.list}}">
<view class="project-item row"> <view class="project-item row">
<view class="project-cover"> <view class="project-cover">
<image src="{{item.cover}}"></image> <image src="{{item.cover}}"></image>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</view> </view>
<view class="project-buy-wrapper col align-e"> <view class="project-buy-wrapper col align-e">
<view class="project-buy-btn"> <view class="project-buy-btn">
<text>{{value.btn}}</text> <text>{{item.btn}}</text>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -94,8 +94,6 @@ Page({ ...@@ -94,8 +94,6 @@ Page({
}) })
this.selectionTotal() this.selectionTotal()
console.log(JSON.stringify(funcShoppingCart))
}, },
/** /**
...@@ -288,7 +286,7 @@ Page({ ...@@ -288,7 +286,7 @@ Page({
// 在此之前需要校验用户是否登录,以及商品库存是否充足 // 在此之前需要校验用户是否登录,以及商品库存是否充足
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=5' + '&amount=' + this.data.amountPay url: '/pages/pay/order-input/order-input?type=5'
}) })
}, },
......
...@@ -8,6 +8,7 @@ let logicData = { ...@@ -8,6 +8,7 @@ let logicData = {
Page({ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
// 导航栏相关属性 // 导航栏相关属性
navigationStyle: { navigationStyle: {
...@@ -251,12 +252,9 @@ Page({ ...@@ -251,12 +252,9 @@ Page({
tempArray.push(strategy) tempArray.push(strategy)
} }
console.log('tempArray', tempArray)
if (that.data.pageNo == 1) { if (that.data.pageNo == 1) {
var newArr = tempArray.slice(1) var newArr = tempArray.slice(1)
var firstItem = tempArray[0] var firstItem = tempArray[0]
console.log('firstItem', firstItem)
that.setData({ that.setData({
moreData: (tempArray.length >= Number(res.data.count)) ? false : true, moreData: (tempArray.length >= Number(res.data.count)) ? false : true,
['strategyFirstItem.id']: firstItem.id, ['strategyFirstItem.id']: firstItem.id,
...@@ -346,6 +344,5 @@ Page({ ...@@ -346,6 +344,5 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/order-comment/order-comment', url: '/pages/pay/order-comment/order-comment',
}); });
} }
}) })
\ No newline at end of file
...@@ -7,7 +7,7 @@ Page({ ...@@ -7,7 +7,7 @@ Page({
isphone: false, isphone: false,
}, },
onLoad: function(options) { onLoad: function (options) {
let mobile = wx.getStorageSync('mobile') let mobile = wx.getStorageSync('mobile')
let nickName = wx.getStorageSync('nickName') let nickName = wx.getStorageSync('nickName')
let avatarUrl = wx.getStorageSync('avatarUrl') let avatarUrl = wx.getStorageSync('avatarUrl')
...@@ -19,7 +19,7 @@ Page({ ...@@ -19,7 +19,7 @@ Page({
}) })
}, },
back: function(e) { back: function (e) {
if (this.data.islogin && this.data.isphone) { if (this.data.islogin && this.data.isphone) {
console.log('授权及绑定成功') console.log('授权及绑定成功')
} else { } else {
...@@ -36,7 +36,7 @@ Page({ ...@@ -36,7 +36,7 @@ Page({
/* /*
* 获取用户信息 * 获取用户信息
*/ */
userInfoHandler(res) { userInfoHandler: function (res) {
console.log('userInfo', res) console.log('userInfo', res)
if (!res.detail.userInfo) { if (!res.detail.userInfo) {
return return
...@@ -71,7 +71,7 @@ Page({ ...@@ -71,7 +71,7 @@ Page({
/* /*
* 绑定手机号 * 绑定手机号
*/ */
userPhoneHandler(res) { userPhoneHandler: function (res) {
console.log('userPhone', res) console.log('userPhone', res)
if (!res.detail.encryptedData) { if (!res.detail.encryptedData) {
return return
...@@ -99,8 +99,8 @@ Page({ ...@@ -99,8 +99,8 @@ Page({
}) })
}, },
registUserInfo(obj) { registUserInfo: function (obj) {
app.registUserInfo({ App.registUserInfo({
param: obj.param, param: obj.param,
success: function(res) { success: function(res) {
if (obj.success) { if (obj.success) {
...@@ -110,7 +110,7 @@ Page({ ...@@ -110,7 +110,7 @@ Page({
}) })
}, },
checkFinish() { checkFinish: function () {
if (this.data.islogin && this.data.isphone) { if (this.data.islogin && this.data.isphone) {
wx.navigateBack({}) wx.navigateBack({})
} }
......
...@@ -3,173 +3,294 @@ const App = getApp() ...@@ -3,173 +3,294 @@ const App = getApp()
Page({ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
orderTypeTitle: '全部分类', orderTypeTitle: '全部分类',
orderTypeHeight: 0, orderTypeHeight: 0,
statusActive: 0, orderType: [],
orderTypeActive: 0,
statusList: [ statusList: [
{ 'id': 0, 'name': '全部' }, { 'value': '', 'name': '全部' },
{ 'id': 1, 'name': '待付款' }, { 'value': '0', 'name': '待付款' },
{ 'id': 2, 'name': '待使用' }, { 'value': '1', 'name': '待使用' },
{ 'id': 3, 'name': '取消/过期' }, { 'value': '-1, 4', 'name': '取消/过期' },
], ],
statusActive: 0,
orderList: [
{
'id': 0, orderList: [],
'logo': '', orderPages: 1,
'name': '原味舒食',
'status': 0,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 20
}],
'total': 0,
'amount': '130.30'
}, {
'id': 0,
'logo': '',
'name': '原味舒食',
'status': 1,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 10
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}],
'total': 0,
'amount': '130.30'
}, {
'id': 0,
'logo': '',
'name': '原味舒食',
'status': 2,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 10
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}],
'total': 0,
'amount': '130.30'
}, {
'id': 0,
'logo': '',
'name': '原味舒食',
'status': 3,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 10
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}],
'total': 0,
'amount': '130.30'
}, {
'id': 0,
'logo': '',
'name': '原味舒食',
'status': 4,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 10
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}],
'total': 0,
'amount': '130.30'
}, {
'id': 0,
'logo': '',
'name': '原味舒食',
'status': 5,
'commodity': [{
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 2,
'price': 10
}, {
'cover': '',
'name': '咖喱蔬菜大虾',
'quantity': 5,
'price': 24
}],
'total': 0,
'amount': '130.30'
}
],
winOrderType: false, winOrderType: false,
}, },
onLoad: function (options) { onLoad: function (options) {
this.queryOrder() this.setOrderType()
}, },
/**
* 查询订单列表
* @function
* @param
* @returns
*/
queryOrder: function () { queryOrder: function () {
let funcName = this.data.orderType[this.data.orderTypeActive].value
let funcValue = this.data.statusList[this.data.statusActive].value
console.log(this.data.orderType)
console.log(this.data.statusList)
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/getOrderList', url: '/api/v1/order/getOrderList',
data: { data: {
'goodType': '', 'goodType': this.data.orderType[this.data.orderTypeActive].value,
'status': '', 'status': this.data.statusList[this.data.statusActive].value,
'pageSize': -1, 'pageSize': 10,
'pageNo': '', 'pageNo': this.data.orderPages,
},
success: (response) => {
let funcResponse = response.data
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].orderId,
'logo': '',
'name': funcResponse[i].officeName,
'total': 0,
'status': Number(funcResponse[i].status),
'amount': funcResponse[i].totalMoney,
'commodity': [],
}
// 添加订单商品列表
let funcTotal = 0
let funcCommodity = funcResponse[i].smOrderDetails
for (let ii = 0, ll = funcCommodity.length; ii < ll; ii++) {
let funcCommodityItem = {
'cover': funcCommodity[ii].imgUrl,
'name': funcCommodity[ii].name,
'quantity': funcCommodity[ii].number,
'price': funcCommodity[ii].unitPrice,
}
funcTotal = funcTotal + funcCommodityItem.quantity
funcItem.commodity.push(funcCommodityItem)
}
funcItem.total = funcTotal
// 映射门店信息
for (let i = 0, l = App.globalData.shopId.length; i < l; i++) {
if (funcItem.name === App.globalData.shopId[i].name) {
funcItem.logo = App.globalData.shopId[i].logo
break
}
}
// 映射显示状态与后台状态
switch (funcItem.status) {
case -2:
funcItem.status = 0
break
case -1:
funcItem.status = 1
break
case 0:
funcItem.status = 2
break
case 1:
funcItem.status = 3
break
case 2:
funcItem.status = 5
break
}
funcList.push(funcItem)
}
this.setData({
orderList: funcList
})
}
})
},
/**
* 初始化订单类型数据字典
* @function
* @param
* @returns
*/
setOrderType: function () {
App.wxRequest({
url: '/api/v1/common/getDictByType',
data: {
'type': 'good_type',
}, },
success: (response) => { success: (response) => {
console.log(response) console.log(response)
let funcResponse = response.data
let funcList = [{ 'value': '', 'name': '全部分类' }]
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'value': funcResponse[i].value,
'name': funcResponse[i].label,
}
funcList.push(funcItem)
}
this.setData({
'orderType': funcList
})
this.queryOrder()
} }
}) })
}, },
onOrderType: function () { onOrderType: function () {
this.setData({ this.setData({
winOrderType: !this.data.winOrderType 'winOrderType': !this.data.winOrderType
}) })
}, },
/**
* 订单分类
* @function
* @param {object} - event
* @returns
*/
onOrderTypeSelection: function (event) { onOrderTypeSelection: function (event) {
console.log(event.currentTarget.dataset.id) let funcItem = event.currentTarget.dataset.item
let funcIndex = event.currentTarget.dataset.index
console.log(funcItem)
this.setData({ this.setData({
orderTypeTitle: event.currentTarget.dataset.id 'orderTypeTitle': funcItem.name,
'orderTypeActive': funcIndex,
'orderPages': 1,
}) })
this.queryOrder()
}, },
/**
* 订单状态
* @function
* @param {object} - event
* @returns
*/
onSelectionStatus: function (event) { onSelectionStatus: function (event) {
console.log(event.currentTarget.dataset.type)
this.setData({ this.setData({
statusActive: Number(event.currentTarget.dataset.type) 'statusActive': Number(event.currentTarget.dataset.type),
'orderPages': 1,
}) })
this.queryOrder()
}, },
onNavigationBack: function () { onNavigationBack: function () {
wx.navigateBack({ wx.navigateBack({
delta: 1 'delta': 1
})
},
/**
* 订单详情
* @function
* @param
* @returns
*/
onOrderDetail: function (event) {
let funcItem = event.currentTarget.dataset.item
wx.navigateTo({
url: '/pages/pay/order-detail/order-detail?id=' + funcItem.id,
})
},
/**
* 订单取消
* @function
* @param
* @returns
*/
onOrderCancel: function (event) {
let funcItem = event.target.dataset.item
App.wxRequest({
url: '/api/v1/order/cancelOrder',
data: {
'orderId': funcItem.id,
'type': 0,
},
success: (response) => {
console.log(response)
}
})
this.queryOrder()
},
/**
* 订单删除
* @function
* @param
* @returns
*/
onOrderRemove: function (event) {
let funcItem = event.target.dataset.item
App.wxRequest({
url: '/api/v1/order/cancelOrder',
data: {
'orderId': funcItem.id,
'type': 1,
},
success: (response) => {
console.log(response)
}
}) })
this.queryOrder()
},
/**
* 订单支付
* @function
* @param
* @returns
*/
onOrderPay: function (event) {
},
/**
* 订单使用
* @function
* @param
* @returns
*/
onOrderUse: function (event) {
},
/**
* 订单评价
* @function
* @param
* @returns
*/
onOrderEvaluate: function (event) {
},
/**
* 订单再次下单
* @function
* @param
* @returns
*/
onOrderAgain: function (event) {
}, },
}) })
\ No newline at end of file
...@@ -10,26 +10,43 @@ ...@@ -10,26 +10,43 @@
<view class="order-type-selection col" wx:if="{{winOrderType}}" bindtap="onOrderType"> <view class="order-type-selection col" wx:if="{{winOrderType}}" bindtap="onOrderType">
<view> <view>
<view class="order-type-row row con-b align-c"> <view class="order-type-row row con-b align-c">
<view class="order-type-item row con-c align-c {{orderTypeTitle === '全部分类' ? 'order-type-item-active' : ''}}" data-id="全部分类" bindtap="onOrderTypeSelection"> <block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<text>全部分类</text> <view
</view> wx:if="{{index < 3}}"
<view class="order-type-item row con-c align-c {{orderTypeTitle === '门票' ? 'order-type-item-active' : ''}}" data-id="门票" bindtap="onOrderTypeSelection"> class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
<text>门票</text> data-item="{{item}}"
</view> data-index="{{index}}"
<view class="order-type-item row con-c align-c {{orderTypeTitle === '餐饮' ? 'order-type-item-active' : ''}}" data-id="餐饮" bindtap="onOrderTypeSelection"> bindtap="onOrderTypeSelection"
<text>餐饮</text> >
</view> <text>{{item.name}}</text>
</view>
</block>
</view> </view>
<view class="order-type-row row con-b align-c"> <view class="order-type-row row con-b align-c">
<view class="order-type-item row con-c align-c {{orderTypeTitle === '影票' ? 'order-type-item-active' : ''}}" data-id="影票" bindtap="onOrderTypeSelection"> <block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<text>影票</text> <view
</view> wx:if="{{3 <= index && index < 6}}"
<view class="order-type-item row con-c align-c {{orderTypeTitle === 'SPA' ? 'order-type-item-active' : ''}}" data-id="SPA" bindtap="onOrderTypeSelection"> class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
<text>SPA</text> data-item="{{item}}"
</view> data-index="{{index}}"
<view class="order-type-item row con-c align-c {{orderTypeTitle === '文创' ? 'order-type-item-active' : ''}}" data-id="文创" bindtap="onOrderTypeSelection"> bindtap="onOrderTypeSelection"
<text>文创</text> >
</view> <text>{{item.name}}</text>
</view>
</block>
</view>
<view class="order-type-row row con-b align-c">
<block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
wx:if="{{6 <= index && index < 9}}"
class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
data-item="{{item}}"
data-index="{{index}}"
bindtap="onOrderTypeSelection"
>
<text>{{item.name}}</text>
</view>
</block>
</view> </view>
</view> </view>
</view> </view>
...@@ -45,10 +62,10 @@ ...@@ -45,10 +62,10 @@
<view class="order-list col con-c align-c"> <view class="order-list col con-c align-c">
<block wx:for="{{orderList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{orderList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="order-list-item col align-c"> <view class="order-list-item col align-c" data-item="{{item}}" bindtap="onOrderDetail">
<view class="order-list-item-title row con-b align-c"> <view class="order-list-item-title row con-b align-c">
<view class="row align-c"> <view class="row align-c">
<image src=""></image> <image wx:if="{{item.logo}}" src="{{resourcesBase + 'commodity/' + item.logo}}"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
<view> <view>
...@@ -60,29 +77,34 @@ ...@@ -60,29 +77,34 @@
<text class="message" wx:if="{{item.status === 5}}">已评价</text> <text class="message" wx:if="{{item.status === 5}}">已评价</text>
</view> </view>
</view> </view>
<!-- 商品数量样式一 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length === 1}}"> <view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length === 1}}">
<image class="cover" src=""></image> <image class="cover" src="{{item.commodity[0].cover}}"></image>
<text class="name">精灵鸟理想国单人次票精灵鸟理想国单人次票</text> <text class="name">精灵鸟理想国单人次票精灵鸟理想国单人次票</text>
<text class="total">{{'x ' + item.total}}</text> <text class="total">{{'x ' + item.total}}</text>
</view> </view>
<!-- 商品数量样式二 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length >= 2}}"> <view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length >= 2}}">
<block wx:for="{{item.commodity}}" wx:for-index="commodityIndex" wx:for-item="commodityItem" wx:key="commodityIndex"> <block wx:for="{{item.commodity}}" wx:for-index="commodityIndex" wx:for-item="commodityItem" wx:key="commodityIndex">
<image class="cover" src=""></image> <image class="cover" src="{{commodityItem.cover}}"></image>
</block> </block>
<text class="total">{{'共 ' + item.total + ' 件'}}</text> <text class="total">{{'共 ' + item.total + ' 件'}}</text>
</view> </view>
<view class="order-list-item-operation row con-b align-c"> <view class="order-list-item-operation row con-b align-c">
<view class="row align-c"> <view class="row align-c">
<text class="amount">实付:</text> <text class="amount">实付:</text>
<text class="amount">¥20.00</text> <text class="amount">¥20.00</text>
</view> </view>
<view class="row align-c"> <view class="row align-c">
<button wx:if="{{item.status === 0}}" class="delete row con-c align-c">取消订单</button> <button wx:if="{{item.status === 0}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderCancel">取消订单</button>
<button wx:if="{{item.status >= 3}}" class="delete row con-c align-c">删除订单</button> <button wx:if="{{item.status >= 3}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button>
<button wx:if="{{item.status === 0}}" class="again row con-c align-c">去支付</button> <button wx:if="{{item.status === 0}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button wx:if="{{item.status === 1}}" class="again row con-c align-c">去使用</button> <button wx:if="{{item.status === 1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button wx:if="{{item.status === 2}}" class="again row con-c align-c">去评价</button> <button wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button wx:if="{{item.status === 3}}" class="again row con-c align-c">再次下单</button> <button wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
font-size: 26rpx; font-size: 26rpx;
} }
.order-type image {
width: 32rpx;
height: 32rpx;
}
/* 订单类型选择 */ /* 订单类型选择 */
.order-type-selection { .order-type-selection {
z-index: 1700; z-index: 1700;
...@@ -39,7 +44,7 @@ ...@@ -39,7 +44,7 @@
.order-type-selection > view { .order-type-selection > view {
width: 750rpx; width: 750rpx;
height: 240rpx; min-height: 240rpx;
padding-top: 10rpx; padding-top: 10rpx;
border-radius: 0px 0px 24rpx 24rpx; border-radius: 0px 0px 24rpx 24rpx;
background: #FFFFFF; background: #FFFFFF;
...@@ -68,6 +73,10 @@ ...@@ -68,6 +73,10 @@
color: #FFFFFF; color: #FFFFFF;
} }
.container-order {
margin-top: 170rpx;
}
.container { .container {
position: relative; position: relative;
} }
......
// pages/orderDetail/index.js let App = getApp()
Page({ Page({
data: { data: {
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderInfo: {
id: '',
no: '12345994500652',
price: '61.20',
time: '2020-09-30 12:00:00',
payTime: '2020-09-30 12:11:11',
score: 50,
commodity: [], // 购买商品列表
},
showNotice: false, showNotice: false,
isFoodOrder: true, isFoodOrder: true,
...@@ -10,125 +25,73 @@ Page({ ...@@ -10,125 +25,73 @@ Page({
swiperCurrent: 0, swiperCurrent: 0,
showCodePopup: false, showCodePopup: false,
statusTips: '', statusTips: '',
// ticketInfo: {
// store: '元养水韵SPA',
// status: 1, // 0未使用 1待评价 2已过期 3已取消 4已评价
// time: '周一至周日 10:00 - 20:00',
// name: '文碧海',
// phone: '17612345222',
// useNum:'1件商品可用',
// useTime: '2019.09.30 - 2020.12.30',
// sealImg: './image/seal.png'
// },
ticketInfo: { ticketInfo: {
status: 2, // 0未使用 1待评价 2已过期 3已取消 4已评价 5待付款 status: 2, // 0未使用 1待评价 2已过期 3已取消 4已评价 5待付款
ticketType: 's', ticketType: 's',
store: '拾光花坊插花分享会', store: '拾光花坊插花分享会',
date: '8月24日 10:00 - 12:30', date: '8月24日 10:00 - 12:30',
// time: '10:00 - 12:30', // time: '10:00 - 12:30',
address: '拾光花坊2号厅', address: '拾光花坊2号厅',
name: '文碧海', name: '文碧海',
phone: '17612345222', phone: '17612345222',
useNum:'1件商品可用', useNum:'1件商品可用',
useTime: '2019.09.30 - 2020.12.30', useTime: '2019.09.30 - 2020.12.30',
sealImg: './image/seal2.png', sealImg: './image/seal2.png',
sealImg2: './image/seal2-1.png' sealImg2: './image/seal2-1.png'
},
goodsInfo: {
titleImg: './image/goods_title.png',
title: '海错图展馆',
list: [
{
id: 0,
infoText: '拾光花坊国际花艺设计咖啡烘焙基础知识交流分享会',
img: './image/goods_item.png',
price: '30.60',
used: '查看券码'
},
{
id: 1,
infoText: '《海错图》展览单人门票',
img: './image/goods_item.png',
price: '30.60',
used: '已使用'
},
]
}, },
// ticketInfo: { codeList: [
// status: 1, // 0未使用 1待评价 2已过期 3已取消 4已评价 5待付款
// store: '夏日音乐盛典星光之夜主题演唱会',
// date: '8月24日 - 10月30日',
// time: '10:00 - 12:30',
// address: '世茂 · 碧海银湖营销展示中心前100米星光广场',
// name: '文碧海',
// phone: '17612345222',
// useNum:'1件商品可用',
// useTime: '2019.09.30 - 2020.12.30',
// sealImg: './image/seal2.png',
// sealImg2: './image/seal2-1.png'
// },
// ticketInfo: {
// type: 'movie',
// status: 0, // 0未使用 1待评价 2已过期 3已取消 4已评价 5待付款
// store: '阿凡达',
// date: '8月24日 10:00 - 12:30',
// name: '文碧海',
// phone: '17612345222',
// useNum:'3张电影票',
// useTime: '2019.09.30 - 2020.12.30',
// sealImg: './image/seal2.png',
// sealImg2: './image/seal2-1.png'
// },
goodsInfo:{
titleImg: './image/goods_title.png',
title: '海错图展馆',
list: [
{ {
id: 0, id: 0,
infoText: '拾光花坊国际花艺设计咖啡烘焙基础知识交流分享会', title: '《 阿凡达 》电影票',
img: './image/goods_item.png', img: './image/QRcode.png',
price: '30.60', num: '2179 7092 0925'
used: '查看券码'
}, },
{ {
id: 1, id: 1,
infoText: '《海错图》展览单人门票', title: '《 阿凡达 》电影票',
img: './image/goods_item.png', img: './image/QRcode.png',
price: '30.60', num: '2179 7092 0925',
used: '已使用' codeUsed: true
}, },
{
id: 2,
title: '《 阿凡达 》电影票',
img: './image/QRcode.png',
num: '2179 7092 0925'
}
] ]
}, },
// goodsInfo:{
// titleImg: './image/good2.png', onLoad: function (options) {
// title: '元养水韵SPA', let funcOrderInfo = this.data.orderInfo
// list: [ funcOrderInfo.id = options.id
// { this.setData({
// id: 0, orderInfo: funcOrderInfo
// infoText: '肌底补水保湿焕肤提亮SPA套餐', })
// img: './image/goods_item2.png',
// price: '30.60', this.queryOrderDetail()
// used: '查看券码'
// }, return
// {
// id: 1,
// infoText: '泰国皇室经典SPA',
// img: './image/goods_item2.png',
// price: '30.60',
// used: '已使用'
// },
// ]
// },
orderInfo: {
price: '61.20',
no: '12345994500652',
time: '2020-09-30 12:00:00',
payTime: '2020-09-30 12:11:11',
score: 50
},
codeList: [
{
id: 0,
title: '《 阿凡达 》电影票',
img: './image/QRcode.png',
num: '2179 7092 0925'
},
{
id: 1,
title: '《 阿凡达 》电影票',
img: './image/QRcode.png',
num: '2179 7092 0925',
codeUsed: true
},
{
id: 2,
title: '《 阿凡达 》电影票',
img: './image/QRcode.png',
num: '2179 7092 0925'
}
]
},
onLoad(options) {
console.log(options) console.log(options)
if (options.type) options.type = Number(options.type) if (options.type) options.type = Number(options.type)
let statusText = '' let statusText = ''
...@@ -142,12 +105,14 @@ Page({ ...@@ -142,12 +105,14 @@ Page({
ticketInfo.status = 0 ticketInfo.status = 0
bottom = '-32rpx' bottom = '-32rpx'
break break
case 1: case 1:
ticketInfo.status = 1 ticketInfo.status = 1
statusText = '活动待评价', statusText = '活动待评价',
statusTips = '评价本单获得10积分' statusTips = '评价本单获得10积分'
orderBtnText = '去评价' orderBtnText = '去评价'
break break
case 2: case 2:
ticketInfo.status = 2 ticketInfo.status = 2
statusText = '活动已结束' statusText = '活动已结束'
...@@ -175,14 +140,16 @@ Page({ ...@@ -175,14 +140,16 @@ Page({
console.log(typeof options.type) console.log(typeof options.type)
switch (options.type) { switch (options.type) {
case 0: case 0:
ticketInfo.status = 0 ticketInfo.status = 0
bottom = '-32rpx' bottom = '-32rpx'
break break
case 1: case 1:
ticketInfo.status = 1 ticketInfo.status = 1
statusText = '订单待评价', statusText = '订单待评价',
orderBtnText = '去评价' orderBtnText = '去评价'
break break
case 2: case 2:
console.log(2) console.log(2)
...@@ -190,16 +157,19 @@ Page({ ...@@ -190,16 +157,19 @@ Page({
statusText = '订单已过期' statusText = '订单已过期'
statusTips = '有效期2019.09.30 - 2020.12.30' statusTips = '有效期2019.09.30 - 2020.12.30'
break break
case 3: case 3:
ticketInfo.status = 3 ticketInfo.status = 3
statusText = '订单已取消' statusText = '订单已取消'
statusTips = '下单后15分钟内未付款,自动取消订单' statusTips = '下单后15分钟内未付款,自动取消订单'
orderBtnText = '再次下单' orderBtnText = '再次下单'
break break
case 4: case 4:
ticketInfo.status = 4 ticketInfo.status = 4
statusText = '订单已评价' statusText = '订单已评价'
break break
case 5: case 5:
ticketInfo.status = 5 ticketInfo.status = 5
statusText = '订单待付款' statusText = '订单待付款'
...@@ -216,42 +186,98 @@ Page({ ...@@ -216,42 +186,98 @@ Page({
ticketInfo ticketInfo
}) })
}, },
/**
* 订单详情
* @function
* @param
* @returns
*/
queryOrderDetail: function () {
App.wxRequest({
url: '/api/v1/order/getOrderDetail',
data: {
'orderId': this.data.orderInfo.id
},
success: (response) => {
let funcResponse = response.data
let funcOrderInfo = {
'id': this.data.orderInfo.id,
'logo': '',
'shopName': funcResponse.officeName, // 使用门店
'score': funcResponse.integral, // 积分
'status': funcResponse.status, // 订单状态
'amount': funcResponse.totalMoney, // 实付金额
'contactName': funcResponse.name, // 联系人名称
'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodity': [],
}
// 添加订单商品列表
let funcCommodity = funcResponse.smOrderDetails
for (let i = 0, l = funcCommodity.length; i < l; i++) {
let funcCommodityItem = {
'cover': '',
'name': funcCommodity[i].name, // 名称
'quantity': funcCommodity[i].number, // 数量
'amount': funcCommodity[i].totalPrices, // 总价
'status': funcCommodity[i].status, // 状态
}
funcOrderInfo.commodity.push(funcCommodityItem)
}
// 映射门店信息
for (let i = 0, l = App.globalData.shopId.length; i < l; i++) {
if (funcOrderInfo.name === App.globalData.shopId[i].name) {
funcOrderInfo.logo = App.globalData.shopId[i].logo
break
}
}
this.setData({
orderInfo: funcOrderInfo
})
console.log(JSON.stringify(funcOrderInfo))
}
})
},
handleQRcode() { handleQRcode() {
let showCodePopup = true let showCodePopup = true
this.setData({ this.setData({
showCodePopup showCodePopup
}) })
}, },
closeQRcode() { closeQRcode() {
let showCodePopup = false let showCodePopup = false
this.setData({ this.setData({
showCodePopup showCodePopup
}) })
}, },
handleNotice() { handleNotice() {
let showNotice = true let showNotice = true
this.setData({ this.setData({
showNotice showNotice
}) })
}, },
swiperChange(e) { swiperChange(e) {
let swiperCurrent = e.detail.current let swiperCurrent = e.detail.current
this.setData({ this.setData({
swiperCurrent swiperCurrent
}) })
}, },
setClipboard(e) { setClipboard(e) {
const index = e.currentTarget.dataset.index const index = e.currentTarget.dataset.index
const data = this.data.codeList[index].num const data = this.data.codeList[index].num
wx.setClipboardData({ wx.setClipboardData({
data: data, data: data,
success (res) { success (res) {
wx.getClipboardData({ wx.getClipboardData({
success (res) { success (res) {
console.log(res.data) // data console.log(res.data) // data
} }
}) })
} }
}) })
} }
}) })
\ No newline at end of file
<view class="order-status col con-c {{ticketInfo.status === 1 || ticketInfo.status === 5 ? 'bgPink' : ''}}" wx:if="{{ticketInfo.status !== 0}}"> <!-- <navigation class="navigation" titleText="订单详情" color="#ffffff" background="#FFFFFF"></navigation> -->
<view class="status-text">{{statusText}}</view>
<view class="status-tips" wx:if="{{statusTips}}">{{statusTips}}</view>
</view>
<view class="ticket-wrapper"> <view class="container">
<!-- 票券上 --> <!-- 订单状态 -->
<view class="ticket-main col {{ticketInfo.status !== 0 ? 'border-none' : ''}}"> <view class="state row con-c">
<view class="ticket-row-store row {{ticketInfo.store.length>11?'align-s':'align-c'}}"> <!-- <view class="state-content col con-c" wx:if="{{orderInfo.state === 0}}"> -->
<view class="ticket-left">{{ticketInfo.type === 'movie' ? '电影' :'使用门店'}}</view> <view class="state-content col con-c">
<view class="ticket-right"> <view class="state-content-title row">
<view class="ticket-store">{{ticketInfo.store}}</view> <text>订单待付款</text>
</view> </view>
</view> <view class="state-content-tip row">
<view class="ticket-row-time row"> <text>内付款,否则将自动取消订单</text>
<view class="ticket-left">{{ticketInfo.date && ticketInfo.type === 'movie' ? '场次': (ticketInfo.date ? '活动时间' : '')}}</view> </view>
<view class="ticket-right"> </view>
<view class="ticket-date">{{ticketInfo.date}}</view>
<view class="ticket-time">{{ticketInfo.time}}</view>
</view>
</view>
<view class="ticket-row-time row" wx:if="{{ticketInfo.address}}">
<view class="ticket-left">活动地点</view>
<view class="ticket-right">
<view class="ticket-address">{{ticketInfo.address}}</view>
</view>
</view>
<view class="ticket-info">
<view class="ticket-row-name row align-c">
<view class="ticket-left">订单信息</view>
<view class="ticket-right">
<view class="ticket-name">{{ticketInfo.name}}</view>
</view>
</view>
<view class="ticket-row-phone row">
<view class="ticket-left"></view>
<view class="ticket-right">
<view class="ticket-phone">{{ticketInfo.phone}}</view>
</view>
</view>
</view>
<!-- 印章 -->
<view class="seal-wrapper" style="bottom: {{bottom}}">
<image class="seal" mode="widthFix" src="{{ticketInfo.status === 0 ? ticketInfo.sealImg : ticketInfo.sealImg2}}"></image>
</view>
<!-- 白色圆 -->
<view class="circle" wx:if="{{ticketInfo.status === 0}}"></view>
</view>
<!-- 票券下 -->
<view class="ticket-footer col align-c" wx:if="{{ticketInfo.status === 0}}">
<view class="ticket-footer-top">{{ticketInfo.useNum}}</view>
<view class="ticket-footer-middle" bindtap="handleQRcode">一键扫码</view>
<view class="ticket-footer-bottom">{{ticketInfo.useTime}}</view>
</view>
<!-- 扫码弹窗 -->
<l-popup show="{{showCodePopup}}" l-class="l-popup-bg" animation="{{false}}">
<view class="scan-code-wrapper col align-c">
<view class="code-header">20件商品可用</view>
<view class="code-tips">请将券码出示给门店核销人员</view>
<swiper class="code-main" next-margin="64rpx" bindchange="swiperChange">
<swiper-item wx:for="{{codeList}}" wx:key="id">
<view class="code-item col con-c align-c {{index === swiperCurrent ? 'item-center' : ''}}">
<view class="code-item-title">{{item.title}}</view>
<view class="code-img">
<image mode="widthFix" src="{{item.img}}"></image>
<view wx:if="{{item.codeUsed}}" class="code-img-used"></view>
</view>
<view class="code-num-wrapper row align-c con-a">
<view class="code-num-title {{item.codeUsed ? 'code-used' : ''}}">券码{{index+1}}:</view>
<view class="code-num {{item.codeUsed ? 'code-used' : ''}}">{{item.num}}</view>
<view class="num-copy" wx:if="{{!item.codeUsed}}" bindtap="setClipboard" data-index="{{index}}">复制</view>
</view>
<view class="code-used-seal" wx:if="{{item.codeUsed}}">
<image mode="widthFix" src="./image/used.png"></image>
</view>
</view>
</swiper-item>
</swiper>
<view class="img-num row align-c con-b">
<text class="current-img-num">{{swiperCurrent+1}}</text>
<text class="symbol-img-num">/</text>
<text class="total-img-num">{{codeList.length}}</text>
</view>
<view class="code-close-btn row con-c align-c" bindtap="closeQRcode">
<image mode="widthFix" src="/image/icon_close.png"></image>
</view>
</view>
</l-popup>
</view>
<view class="tips-wrapper" wx:if="{{ticketInfo.ticketType === 'food'}}"> <view class="state-content col con-c" wx:if="{{orderInfo.state === 3}}">
<Tips text="请在下单内3天内取餐,逾期无效"></Tips> <view class="state-content-title row">
</view> <text>订单待评价</text>
</view>
</view>
<view class="notice-wrapper row con-e" bindtap="handleNotice" wx:if="{{ticketInfo.orderType === 1}}"> <view class="state-content state-content-invalid col con-c" wx:if="{{orderInfo.state === 4}}">
<view class="notice">{{ticketInfo.status === 0 ? '使用须知' : '购买须知'}}</view> <view class="state-content-title row">
<l-icon name="right" color="#959DAA" size="22" /> <text>订单已过期</text>
</view> </view>
<l-popup show="{{showNotice}}" content-align="bottom"> <view class="state-content-tip row">
<view class="notice-popup-wrapper"> <text>内付款,否则将自动取消订单</text>
<view class="notice-popup-title">购买须知</view> </view>
<scroll-view scroll-y class="notice-popup-content"> </view>
</scroll-view>
</view>
</l-popup>
<view class="state-content state-content-invalid col con-c" wx:if="{{orderInfo.state === -1}}">
<view class="state-content-title row">
<text>订单已取消</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
</view>
</view>
<view class="goods-wrapper"> <view class="state-content state-content-invalid col con-c" wx:if="{{orderInfo.state === 3}}">
<view class="goods-title">购买商品</view> <view class="state-content-title row">
<view class="goods-list"> <text>订单已评价</text>
<view class="goods-list-title-wrapper row align-c"> </view>
<view class="goods-list-title-img">
<image mode="widthFix" src="{{goodsInfo.titleImg}}"></image>
</view>
<view class="goods-list-title">{{goodsInfo.title}}</view>
</view>
<view class="goods-item row" wx:for="{{goodsInfo.list}}" wx:key="id">
<view class="goods-item-img">
<image mode="widthFix" src="{{item.img}}"></image>
</view>
<view class="goods-item-info col con-a">
<view class="goods-item-info-text">{{item.infoText}}</view>
<view class="goods-item-info-price">
<text class="price-symbol">¥</text>
<text class="price">{{item.price}}</text>
</view> </view>
</view>
<view class="goods-item-btn {{item.used === '已使用'?'disabled':''}}" bindtap="handleQRcode">{{item.used}}</view>
</view> </view>
</view>
</view>
<view class="order-info-wrapper"> <!-- 订单信息 -->
<view class="order-price"> <view class="info">
<text class="order-price-symbol">¥</text> <!-- 年卡月卡 -->
<text>{{orderInfo.price}}</text> <view class="info-content col con-c">
</view> <view class="info-content-item row">
<view class="order-title">实付金额</view> <text class="info-content-item-label">使用门店</text>
<view class="order-info"> <text class="info-content-item-title">儿童营地</text>
<view class="order-item">订单编号:{{orderInfo.no}}</view> </view>
<view class="order-item">下单时间:{{orderInfo.time}}</view> <view class="info-content-item row">
<view class="order-item">付款时间:{{orderInfo.payTime}}</view> <text class="info-content-item-label"></text>
<view class="order-item">获得积分:{{orderInfo.score}}分</view> <text class="info-content-item-describe">周一至周日 10:00 - 20:00</text>
</view> </view>
</view> </view>
<!-- 普通商品 -->
<!-- 餐品 -->
<view class="info-content col con-c">
<view class="info-content-item row">
<text class="info-content-item-label">使用门店</text>
<text class="info-content-item-title">儿童营地</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label"></text>
<text class="info-content-item-describe">周一至周日 10:00 - 20:00</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">订单信息</text>
<text class="info-content-item-tip">儿童营地</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label"></text>
<text class="info-content-item-tip">18030303030</text>
</view>
</view>
<view class="footer-btn row con-e" wx:if="{{ticketInfo.status !== 0}}"> <!-- 活动 -->
<view class="delete-btn" wx:if="{{ticketInfo.status !== 0 && ticketInfo.status !== 1}}">删除订单</view> <view class="info-content col con-c">
<view class="order-btn" wx:if="{{ticketInfo.status === 1 || ticketInfo.status === 3 || ticketInfo.status === 5}}">{{orderBtnText}}</view> <view class="info-content-item row">
</view> <text class="info-content-item-label">报名活动</text>
<text class="info-content-item-title">儿童营地儿童营地儿童营地儿童营地儿童营地儿童营地</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">活动时间</text>
<text class="info-content-item-describe">周一至周日 10:00 - 20:00</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">活动地点</text>
<text class="info-content-item-describe">儿童营地</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">订单信息</text>
<text class="info-content-item-tip">姓名</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label"></text>
<text class="info-content-item-tip">18030303030</text>
</view>
</view>
<Blank></Blank> <!-- 观影 -->
\ No newline at end of file <view class="info-content col con-c">
<view class="info-content-item row">
<text class="info-content-item-label">电影</text>
<text class="info-content-item-title">儿童营地</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">场次</text>
<text class="info-content-item-describe">周一至周日 10:00 - 20:00</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label">订单信息</text>
<text class="info-content-item-tip">姓名</text>
</view>
<view class="info-content-item row">
<text class="info-content-item-label"></text>
<text class="info-content-item-tip">18030303030</text>
</view>
</view>
</view>
<!-- 商品信息 -->
<view class="commodity col">
<view class="commodity-title">
<text>购买商品</text>
</view>
<view class="commodity-list">
<view class="commodity-shop-info row align-c">
<image></image>
<text>商店名称</text>
</view>
<view class="commodity-item row align-c">
<image></image>
<view class="commodity-item-info col">
<view>
<text>儿童营地年卡</text>
</view>
<view>
<text>1680.00</text>
</view>
</view>
<view class="commodity-item-operation">
<button class="row con-c align-c">查看券码</button>
</view>
</view>
</view>
</view>
<!-- 订单提示 -->
<view class="tip">
</view>
</view>
\ No newline at end of file
.order-status { /* 订单状态 */
width: 670rpx; .state {
height: 240rpx; width: 750rpx;
margin: 64rpx auto 0;
padding-left: 32rpx;
color: #15191F;
background-color: #ECF4F8;
}
.status-text {
font-size: 54rpx;
font-weight: 600;
}
.status-tips {
margin-top: 24rpx;
}
.bgPink {
background-color: #F3E1E1;
} }
.ticket-wrapper { .state-content {
width: 670rpx; width: 670rpx;
margin: 64rpx auto 0; height: 240rpx;
} padding: 0 32rpx;
.ticket-main { border-radius: 4px;
position: relative; background: #F3E1E1;
width: 100%;
padding: 48rpx 32rpx 46rpx;
background-color: #F3F4F6;
border-bottom: 1px dashed #E2E7EF;
}
.border-none {
border-bottom: none;
}
.ticket-left {
width: 152rpx;
display: table-cell;
vertical-align: bottom;
font-size: 26rpx;
color: #959DA9;
}
.ticket-right {
flex: 1;
font-size: 26rpx;
}
.ticket-store {
font-size: 38rpx;
color: #15191F;
font-weight: 600;
}
.ticket-row-time, .ticket-row-phone {
margin-top: 16rpx;
}
.ticket-time, .ticket-address, .ticket-date {
font-size: 30rpx;
line-height: 42rpx;
} }
.ticket-info { .state-content-invalid {
margin-top: 48rpx; background: #ECF4F8;
} }
.seal-wrapper { .state-content-title text {
position: absolute; height: 76rpx;
right: 0; font-size: 54rpx;
bottom: -32rpx; font-weight: 500;
width: 166rpx; line-height: 76rpx;
height: 200rpx; color: #15191F;
}
.seal {
width: 100%;
height: 100%;
} }
.circle { .state-content-tip {
position: absolute; margin-top: 24rpx;
left: -18rpx;
bottom: -18rpx;
width: 36rpx;
height: 36rpx;
border-radius: 50%;
background-color: #fff;
} }
.ticket-footer { .state-content-tip text {
padding: 50rpx 32rpx 24rpx; height: 36rpx;
background-color: #F3F4F6; font-size: 26rpx;
} font-weight: 400;
.ticket-footer-top { line-height: 36rpx;
font-size: 34rpx; color: #15191F;
color: #15191F;
}
.ticket-footer-middle {
width: 606rpx;
height: 96rpx;
line-height: 96rpx;
margin: 40rpx 0;
color: #fff;
text-align: center;
background-color: #86C5E1;
border-radius: 4rpx;
}
.ticket-footer-bottom {
font-size: 26rpx;
color: #959DAA;
} }
/* 扫码弹窗 */ /* 订单信息 */
.scan-code-wrapper { .info-content {
width: 670rpx;
} min-height: 206rpx;
.code-header { padding: 48rpx 32rpx;
height: 70rpx; background: #F3F4F6;
color: #fff; border-radius: 4px;
font-size: 30rpx; overflow: hidden;
text-align: center;
font-weight: 600;
}
.code-tips {
height: 92rpx;
color: #fff;
font-size: 26rpx;
text-align: center;
}
.code-main {
width: 750rpx;
height: 666rpx;
}
.code-item {
position: relative;
width: 526rpx;
height: 666rpx;
background-color: #fff;
border-radius: 4rpx;
}
.item-center {
margin-left: 112rpx;
}
.code-item-title {
color: #15191F;
font-size: 30rpx;
font-weight: 600;
}
.code-img {
position: relative;
width: 296rpx;
height: 296rpx;
margin: 56rpx 0;
}
.code-img-used {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #FFFFFF;
opacity: .9;
z-index: 10;
}
.code-num-wrapper {
width: 446rpx;
height: 96rpx;
padding: 0 24rpx;
background-color: #F2F3F5;
border-radius: 4rpx;
line-height: 96rpx;
}
.code-num-title {
color: #959DA9;
text-decoration: none !important;
font-size: 26rpx;
}
.code-num {
color: #15191F;
font-size: 30rpx;
}
.code-used {
color: #C2C7CF;
text-decoration: line-through;
}
.num-copy {
color: #5DB5DD;
font-size: 26rpx;
}
.code-used-seal {
position: absolute;
right: -68rpx;
transform: translateY(56rpx);
width: 254rpx;
height: 254rpx;
z-index: 11;
}
.img-num {
width: 65rpx;
margin-top: 54rpx;
}
.current-img-num {
color: #fff;
font-size: 34rpx;
}
.symbol-img-num, .total-img-num {
color: #979797;
font-size: 26rpx;
}
.code-close-btn {
width: 80rpx;
height: 80rpx;
margin-top: 35rpx;
background: rgba(254, 252, 249, 0.5);
border-radius: 50%;
}
.code-close-btn image {
width: 60%;
} }
.l-popup-bg { .info-content-item {
background: rgba(0, 0, 0, .4); position: relative;
margin-top: 16rpx;
} }
.tips-wrapper { .info-content-item-label {
margin: 40rpx 40rpx 0; width: 104rpx;
} height: 36rpx;
.notice-wrapper { margin-right: 48rpx;
width: 100%; font-size: 26rpx;
height: 100rpx; font-weight: 400;
padding: 0 40rpx; line-height: 36rpx;
line-height: 100rpx; color: #959DA9;
}
.notice {
margin-right: 8rpx;
color: #15191F;
font-size: 26rpx;
}
.notice-popup-wrapper {
padding: 56rpx 40rpx 68rpx;
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
}
.notice-popup-title {
width: 100%;
height: 90rpx;
}
.notice-content {
max-height: 896rpx;
} }
.info-content-item-title {
position: relative;
top: -8rpx;
width: 454rpx;
min-height: 52rpx;
.goods-wrapper { word-wrap: break-word;
padding: 32rpx 40rpx 0; font-size: 38rpx;
} font-weight: 500;
.goods-title { line-height: 52rpx;
color: #15191F; color: #15191F;
font-size: 34rpx;
font-weight: 600;
}
.goods-list {
margin-top: 40rpx;
padding: 0 32rpx 14rpx;
background-color: #F5F6F8;
}
.goods-list-title-wrapper {
width: 100%;
height: 132rpx;
}
.goods-list-title-img {
min-width: 40rpx;
min-height: 54rpx;
max-width: 74rpx;
max-height: 74rpx;
}
.goods-list-title {
margin-left: 16rpx;
color: #15191F;
font-size: 26rpx;
font-weight: 600;
}
.goods-item {
margin-bottom: 22rpx;
padding-bottom: 22rpx;
border-bottom: 1px solid #E2E7EF;
}
.goods-item:last-child {
margin-bottom: 0rpx;
border-bottom: none;
}
.goods-item-img {
width: 140rpx;
height: 136rpx;
}
.goods-item-info {
flex: 1;
padding-left: 24rpx;
}
.goods-item-info-text {
color: #15191F;
font-size: 26rpx;
font-weight: 600;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.goods-item-info-price {
color: #15191F;
font-weight: 600;
}
.price-symbol {
font-size: 22rpx;
}
.price{
font-size: 26rpx;
}
.goods-item-btn {
width: 120rpx;
height: 56rpx;
margin-top: 40rpx;
margin-left: 32rpx;
color: #fff;
font-size: 22rpx;
text-align: center;
line-height: 56rpx;
background-color: #86C5E1;
border-radius: 4rpx;
}
.disabled {
background-color: #C8E1EC;
} }
.order-info-wrapper { .info-content-item-describe {
position: relative; height: 42rpx;
width: 670rpx; font-size: 30rpx;
margin: 64rpx 40rpx 64rpx; font-weight: 500;
} line-height: 42rpx;
.order-price { color: #15191F;
position: absolute;
top: 0;
right: 0;
width: 134rpx;
height: 58rpx;
color: #5DB5DD;
font-size: 40rpx;
font-weight: 600;
} }
.order-price-symbol {
font-size: 34rpx; .info-content-item-tip {
height: 36rpx;
font-size: 26rpx;
font-weight: 500;
line-height: 36rpx;
color: #15191F;
} }
.order-title {
width: 100%; /* 商品信息 */
line-height: 68rpx; .commodity {
font-size: 34rpx; margin: 0 40rpx;
font-weight: 600;
} }
.order-info {
margin-top: 22rpx; .commodity-title {
height: 48rpx;
font-size: 34rpx;
font-weight: 500;
line-height: 48px;
color: #15191F;
} }
.order-item {
width: 100%; .commodity-list {
color: #959DA9; width: 670rpx;
font-size: 22rpx; height: 676rpx;
line-height: 42rpx; padding: 40rpx;
border-radius: 4px;
background: #F3F4F6;
} }
.footer-btn { .commodity-shop-info > image {
padding: 32rpx 20rpx 0; max-width: 62rpx;
border-top: 1px solid #E2E7EF; max-height: 62rpx;
margin-right: 16rpx;
background: #999999;
} }
.delete-btn, .order-btn {
width: 200rpx; .commodity-item {
line-height: 96rpx; width: 606rpx;
margin-right: 24rpx; height: 184rpx;
border-radius: 4rpx; border-bottom: 1px #E2E7EF solid;
font-size: 30rpx;
font-weight: 600;
text-align: center;
} }
.delete-btn {
color: #656E7B; .commodity-item > image {
background-color: #fff; width: 140rpx;
border: 1px solid #C2C7CF; height: 136rpx;
margin-right: 24rpx;
background: #999999;
} }
.order-btn {
color: #fff; .commodity-item-info {
background-color: #86C5E1; width: 290rpx;
} }
image { .commodity-item-operation {
width: 100%; width: 290rpx;
height: 100%; margin-right: 32rpx;
} }
.commodity-item-operation > button {
width: 120rpx;
height: 56rpx;
border-radius: 4px;
background: #86C5E1;
font-size: 22rpx;
font-weight: 500;
line-height: 32rpx;
color: #FFFFFF;
}
\ No newline at end of file
...@@ -13,7 +13,6 @@ let logicData = { ...@@ -13,7 +13,6 @@ let logicData = {
} }
let pagePayId = '' let pagePayId = ''
let pagePayStateTimer = 0
Page({ Page({
data: { data: {
...@@ -22,6 +21,7 @@ Page({ ...@@ -22,6 +21,7 @@ Page({
shopInfo: {}, shopInfo: {},
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
formName: '', formName: '',
...@@ -30,16 +30,7 @@ Page({ ...@@ -30,16 +30,7 @@ Page({
isSubmit: false, isSubmit: false,
// 购买内容 // 购买内容
buyContent: '', buyContent: '', // 商品封面
buyPass: [
App.globalData.appResourcesBase + 'pay/content-pass-1.png', // 年卡月卡预设图片
App.globalData.appResourcesBase + 'pay/content-pass-2.png', // 年卡月卡预设图片
App.globalData.appResourcesBase + 'pay/content-pass-3.png', // 年卡月卡预设图片
App.globalData.appResourcesBase + 'pay/content-pass-4.png', // 年卡月卡预设图片
],
buyPoint: [
App.globalData.appResourcesBase + 'pay/content-service-1.png',
],
buyContentCover: '', buyContentCover: '',
buyContentTitle: '', buyContentTitle: '',
buyContentTime: '', buyContentTime: '',
...@@ -90,29 +81,26 @@ Page({ ...@@ -90,29 +81,26 @@ Page({
winNoticeDetail: false, // 购买须知详情 winNoticeDetail: false, // 购买须知详情
}, },
onLoad: function (options) { onLoad: function (options) {
// 设置门店信息
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
if (options.type) options.type = Number(options.type) if (options.type) options.type = Number(options.type)
if (options.passType) options.passType = Number(options.passType)
if (options.amount) {
this.setData({
payAmount: options.amount
})
}
logicData.option = options logicData.option = options
this.setShopInfo()
this.setShoppingCartData()
this.setView() this.setView()
this.animation = wx.createAnimation({ this.animation = wx.createAnimation({
duration: 700, duration: 700,
timingFunction: 'ease' timingFunction: 'ease'
}) })
this.setShoppingCartData()
}, },
/**
* 设置页面视图
* @function
* @param
* @returns
*/
setView: function () { setView: function () {
this.setData({ this.setData({
registerInfo: [JSON.parse(JSON.stringify(logicData.registerInfoItem))] registerInfo: [JSON.parse(JSON.stringify(logicData.registerInfoItem))]
...@@ -122,7 +110,7 @@ Page({ ...@@ -122,7 +110,7 @@ Page({
case 1: case 1:
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContent: this.data.buyPass[logicData.option.passType], buyContent: this.data.shoppingCartList[0].cover,
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -140,7 +128,7 @@ Page({ ...@@ -140,7 +128,7 @@ Page({
case 2: case 2:
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContent: this.data.buyPoint[0], buyContent: this.data.shoppingCartList[0].cover,
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -179,17 +167,6 @@ Page({ ...@@ -179,17 +167,6 @@ Page({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-12:00', buyContentTime: '周一至周日 10:00-12:00',
shoppingCartList: [{
cover: '',
name: '《海错图》超级豪华精致古风限量版折扇',
quantity: 12,
price: '60.50',
}, {
cover: '',
name: '《海错图》主题画册',
quantity: 12,
price: '60.50',
}],
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: true, // 购买清单 winShoppingCart: true, // 购买清单
...@@ -209,17 +186,6 @@ Page({ ...@@ -209,17 +186,6 @@ Page({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30', buyContentTime: '周一至周日 10:00-21:30',
shoppingCartList: [{
cover: '',
name: '低温鸡胸沙拉',
quantity: 12,
price: '60.50',
}, {
cover: '',
name: '抹茶酸奶芝士',
quantity: 12,
price: '60.50',
}],
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: true, // 购买清单 winShoppingCart: true, // 购买清单
...@@ -281,34 +247,55 @@ Page({ ...@@ -281,34 +247,55 @@ Page({
}) })
}, },
/**
* 设置当前商店信息
* @function
* @param
* @returns
*/
setShopInfo: function () {
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer'),
})
},
setShoppingCartData: function () { setShoppingCartData: function () {
// 读取上级页面的购物车数据,默认选中所有。 // 读取上级页面的购物车数据,默认选中所有。
let funcShoppingCart = wx.getStorageSync('shoppingCartBuffer') let funcShoppingCart = wx.getStorageSync('shoppingCartBuffer')
console.log('funcShoppingCart', JSON.stringify(funcShoppingCart))
// 设置商品的最终提交价格,仅用于展示 // 设置商品的最终提交价格
let funcPayAmount = 0
for (let i = 0, l = funcShoppingCart.length; i < l; i++) { for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
switch (funcShoppingCart[i].priceType) { switch (funcShoppingCart[i].priceType) {
// 活动价
case 1: case 1:
// 活动价 funcShoppingCart[i].priceFinal = funcShoppingCart[i].priceDiscountText
funcShoppingCart[i].priceConfirm = funcShoppingCart[i].priceDiscountText funcShoppingCart[i].priceUnit = funcShoppingCart[i].priceDiscount
break break
// 业主价
case 2: case 2:
// 业主价 funcShoppingCart[i].priceFinal = funcShoppingCart[i].priceSpecialText
funcShoppingCart[i].priceConfirm = funcShoppingCart[i].priceSpecialText funcShoppingCart[i].priceUnit = funcShoppingCart[i].priceSpecial
break break
// 普通价
case 3: case 3:
// 普通价 funcShoppingCart[i].priceFinal = funcShoppingCart[i].priceText
funcShoppingCart[i].priceConfirm = funcShoppingCart[i].priceText funcShoppingCart[i].priceUnit = funcShoppingCart[i].price
break break
} }
if (funcShoppingCart[i].isActive) funcPayAmount = funcPayAmount + funcShoppingCart[i].priceUnit * funcShoppingCart[i].quantity
} }
this.setData({ this.setData({
shoppingCartList: funcShoppingCart shoppingCartList: funcShoppingCart,
payAmount: App.modular.utils.formatAmount(funcPayAmount),
}) })
console.log('----------')
console.log('funcShoppingCart', JSON.stringify(this.data.shoppingCartList))
}, },
/** /**
...@@ -412,6 +399,15 @@ Page({ ...@@ -412,6 +399,15 @@ Page({
quantityError: '', quantityError: '',
}) })
// 商品列表中的所有商品数量增加
let funcShoppingCart = this.data.shoppingCartList
for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
funcShoppingCart[i].quantity = this.data.quantity
}
wx.setStorageSync('shoppingCartBuffer', funcShoppingCart)
this.setShoppingCartData()
// 年卡月卡类型
if (this.data.orderType === 1) { if (this.data.orderType === 1) {
let funcRegisterInfo = this.data.registerInfo let funcRegisterInfo = this.data.registerInfo
funcRegisterInfo.pop() funcRegisterInfo.pop()
...@@ -437,12 +433,26 @@ Page({ ...@@ -437,12 +433,26 @@ Page({
return return
} }
let funcRegisterInfo = this.data.registerInfo
funcRegisterInfo.push(JSON.parse(JSON.stringify(logicData.registerInfoItem)))
this.setData({ this.setData({
quantity: this.data.quantity + 1, quantity: this.data.quantity + 1,
registerInfo: funcRegisterInfo
}) })
// 商品列表中的所有商品数量增加
let funcShoppingCart = this.data.shoppingCartList
for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
funcShoppingCart[i].quantity = this.data.quantity
}
wx.setStorageSync('shoppingCartBuffer', funcShoppingCart)
this.setShoppingCartData()
// 年卡月卡类型
if (this.data.orderType === 1) {
let funcRegisterInfo = this.data.registerInfo
funcRegisterInfo.push(JSON.parse(JSON.stringify(logicData.registerInfoItem)))
this.setData({
registerInfo: funcRegisterInfo
})
}
}, },
/** /**
...@@ -475,6 +485,8 @@ Page({ ...@@ -475,6 +485,8 @@ Page({
} }
} }
} }
console.log('inspectData', funcPass)
return funcPass return funcPass
}, },
...@@ -502,8 +514,8 @@ Page({ ...@@ -502,8 +514,8 @@ Page({
'goodType': funcShoppingCartList[i].typeId, 'goodType': funcShoppingCartList[i].typeId,
'name': funcShoppingCartList[i].name, 'name': funcShoppingCartList[i].name,
'number': funcShoppingCartList[i].quantity, 'number': funcShoppingCartList[i].quantity,
'unitPrice': Number(funcShoppingCartList[i].priceConfirm), 'unitPrice': Number(funcShoppingCartList[i].priceFinal),
'totalPrices': funcShoppingCartList[i].quantity * Number(funcShoppingCartList[i].priceConfirm) 'totalPrices': funcShoppingCartList[i].quantity * Number(funcShoppingCartList[i].priceFinal)
} }
funcCommodity.push(funcItem) funcCommodity.push(funcItem)
} }
...@@ -540,19 +552,19 @@ Page({ ...@@ -540,19 +552,19 @@ Page({
'package': funcResponse.package, 'package': funcResponse.package,
'signType': funcResponse.signType, 'signType': funcResponse.signType,
'paySign': funcResponse.paySign, 'paySign': funcResponse.paySign,
'success': function (response) { 'success': (response) => {
if (response.errMsg === 'requestPayment:ok') { if (response.errMsg === 'requestPayment:ok') {
// 用户点击支付完成按钮回调 // 用户点击支付完成按钮回调
// This.payStatus(true) this.payStatus(true)
} }
if (response.errMsg === 'requestPayment:fail cancel') { if (response.errMsg === 'requestPayment:fail cancel') {
clearInterval(pagePayStateTimer) clearInterval(App.globalData.payStateTimer)
this.payStatus(false) this.payStatus(false)
} }
}, },
'fail': function (response) { 'fail': function (response) {
clearInterval(pagePayStateTimer) clearInterval(App.globalData.payStateTimer)
this.payStatus(false) this.payStatus(false)
} }
}) })
...@@ -567,7 +579,7 @@ Page({ ...@@ -567,7 +579,7 @@ Page({
queryPayStatus: function () { queryPayStatus: function () {
let funcIndex = 0 let funcIndex = 0
pagePayStateTimer = setInterval(() => { App.globalData.payStateTimer = setInterval(() => {
if (!pagePayId) return if (!pagePayId) return
App.wxRequest({ App.wxRequest({
...@@ -598,7 +610,7 @@ Page({ ...@@ -598,7 +610,7 @@ Page({
* @returns * @returns
*/ */
payStatus: function (funcPayResult) { payStatus: function (funcPayResult) {
clearInterval(pagePayStateTimer) clearInterval(App.globalData.payStateTimer)
wx.navigateTo({ wx.navigateTo({
url: '/pages/pay/order-state/order-state?state=' + funcPayResult + '&amount=' + this.data.buyContentAmount url: '/pages/pay/order-state/order-state?state=' + funcPayResult + '&amount=' + this.data.buyContentAmount
}) })
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
</view> </view>
<view class="shopping-cart-list"> <view class="shopping-cart-list">
<block wx:for="{{shoppingCartList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <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"> <view class="shopping-cart-item-cover">
<image src="{{item.cover}}"></image> <image src="{{item.cover}}"></image>
</view> </view>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
<view class="shopping-cart-item-info col"> <view class="shopping-cart-item-info col">
<text>{{'¥' + item.priceConfirm}}</text> <text>{{'¥' + item.priceFinal}}</text>
<text>{{'x' + item.quantity}}</text> <text>{{'x' + item.quantity}}</text>
</view> </view>
</view> </view>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": true,
"es6": true, "es6": true,
"enhance": true, "enhance": true,
"postcss": true, "postcss": true,
...@@ -21,16 +21,17 @@ ...@@ -21,16 +21,17 @@
"checkSiteMap": false, "checkSiteMap": false,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false,
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": false, "useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false, "userConfirmedUseCompilerModuleSwitch": false,
"useMultiFrameRuntime": true,
"useApiHook": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [] "packNpmRelationList": []
}, },
......
// 程序缓存关键字说明 // 程序缓存关键字说明
// shopInfoBuffer: 门店详情信息 // shopInfoBuffer: 门店详情信息
// buyCommodityInfo: 当前购买商品信息 - 单一种类
// buyCommodityInfoList: 当前购买商品信息 - 多种种类
\ No newline at end of file
...@@ -30,6 +30,29 @@ let output = { ...@@ -30,6 +30,29 @@ let output = {
if (!funcAmountValue) return if (!funcAmountValue) return
return funcAmountValue.toString().replace(/([0-9]{2})$/, '.$1') 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 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