Commit 9d8c5647 by wjw

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

parents 04d936bd bf533d59
Showing with 1346 additions and 483 deletions
......@@ -14,6 +14,7 @@ App({
appImageBase: '../../../image/',
appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/',
shopId: iEnvironmental.shopId,
pointInfo: iEnvironmental.pointInfo,
payStateTimer: 0,
......@@ -61,17 +62,20 @@ App({
// console.log("返回:", res);
let code = res.data.code * 1;
if (200 == code) {
// if (200 == code && true == res.data.success) {
if (200 == code && true == res.data.success) {
if (obj.success) {
obj.success(res.data)
}
} else if (402 == code) { // token失效
this.refreshToken({
success: function () {
success: () => {
this.wxRequest(obj)
}
})
} else if (500 === code) {
if (obj.success) {
obj.success(res)
}
} else {
if (obj.fail) {
let err = {
......
......@@ -56,7 +56,6 @@
"pages/pay/coupon-input/coupon-input",
"pages/pay/coupon-detail/coupon-detail",
"pages/login/login"
],
"usingComponents": {
"navigation": "./component/navigation/navigation",
......
......@@ -4,6 +4,8 @@ Page({
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
option: {},
phone: '13316748039',
hotline: false, //客服热线
......@@ -13,8 +15,12 @@ Page({
shopRecommendD: [], // 底部第二商店推荐
},
onLoad: function () {
onLoad: function (option) {
this.setData({
option: option
})
// formPage=order&shopAppId=1&commodityType=5
},
onShow: function () {
......@@ -73,8 +79,8 @@ Page({
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
}
funcList.push(funcItem)
}
......@@ -100,8 +106,8 @@ Page({
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
}
funcList.push(funcItem)
}
......@@ -127,8 +133,8 @@ Page({
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
}
funcList.push(funcItem)
}
......@@ -154,8 +160,8 @@ Page({
'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
}
funcList.push(funcItem)
}
......@@ -209,6 +215,25 @@ Page({
},
/**
* 点击推荐餐品
* @function
* @param {object} - event
* @returns
*/
onBuyRecommendFood: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 5
let funcShopAppId = event.currentTarget.dataset.id
let funcCommodityItem = event.currentTarget.dataset.item
console.log(funcCommodityItem)
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food?commodityId=' + funcCommodityItem.id + '&sideBarId=' + funcCommodityItem.sideBarId
})
},
/**
* 所有
* @function
* @param {object} - event
......@@ -284,7 +309,7 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
url: '/pages/commodity/menu-food/menu-food'
})
},
......@@ -301,7 +326,26 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-art/menu-art'
url: '/pages/commodity/menu-food/menu-food'
})
},
/**
* 点击推荐文创
* @function
* @param {object} - event
* @returns
*/
onBuyRecommendOriginality: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 4
let funcShopAppId = event.currentTarget.dataset.id
let funcCommodityItem = event.currentTarget.dataset.item
console.log(funcCommodityItem)
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food?commodityId=' + funcCommodityItem.id + '&sideBarId=' + funcCommodityItem.sideBarId
})
},
......
......@@ -23,7 +23,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendA}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<view class="shop-menu-item col con-c align-c" data-id="{{6}}" data-item="{{item}}" bindtap="onBuyRecommendFood">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......@@ -39,7 +39,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendB}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<view class="shop-menu-item col con-c align-c" data-id="{{4}}" data-item="{{item}}" bindtap="onBuyRecommendFood">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......@@ -59,12 +59,15 @@
<image src="{{resourcesBase + 'commodity/home/services-title.png'}}"></image>
</view>
<view class="services-list col align-c">
<!-- 精灵鸟理想国 -->
<view class="services-list-item col align-c" data-id="{{3}}" bindtap="onBuyMembership">
<image src="{{resourcesBase + 'commodity/home/services-1.png'}}"></image>
</view>
<!-- 故宫海洋世界 -->
<view class="services-list-item col align-c" data-id="{{1}}" bindtap="onBuyPassCheck">
<image src="{{resourcesBase + 'commodity/home/services-2.png'}}"></image>
</view>
<!-- 元养水韵 -->
<view class="services-list-item col align-c" data-id="{{7}}" bindtap="onBuyService">
<image src="{{resourcesBase + 'commodity/home/services-3.png'}}"></image>
</view>
......@@ -110,7 +113,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendC}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<view class="shop-menu-item col con-c align-c" data-id="{{1}}" data-item="{{item}}" bindtap="onBuyRecommendOriginality">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......@@ -126,7 +129,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendD}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c">
<view class="shop-menu-item col con-c align-c" data-id="{{3}}" data-item="{{item}}" bindtap="onBuyRecommendOriginality">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......
......@@ -5,8 +5,11 @@ Page({
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {},
animationPointHeight: 0,
animationPointOrigin: 0,
winAnimationPoint: false,
......@@ -29,16 +32,22 @@ Page({
winCommodityDetail: false,
},
onLoad: function () {
onLoad: function (option) {
this.setData({
option: option
})
this.resetShoppingCart()
this.setCartAnimation()
this.setShopInfo()
this.querySideBar()
},
onUnload: function () {
// 离开页面清空商品数据
wx.setStorageSync('shoppingCartBuffer', [])
onShow: function () {
if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
this.resetShoppingCart()
}
},
/**
......@@ -53,6 +62,15 @@ Page({
duration: 500,
timingFunction: 'ease'
})
// 获取购物车高度
const funcQuery = wx.createSelectorQuery()
funcQuery.select('#cart').boundingClientRect()
funcQuery.exec((result) => {
this.setData({
animationPointOrigin: result[0].top + 4
})
})
},
/**
......@@ -74,7 +92,7 @@ Page({
winAnimationPoint: true,
})
let funcTimer = setTimeout(() => {
this.animation.translate(0, 0).step()
this.animation.translate(0, this.data.animationPointOrigin).step()
this.setData({
animationData: this.animation.export(),
// winAnimationPoint: false,
......@@ -88,7 +106,14 @@ Page({
this.setData({
shopInfo: funcShopInfo
})
console.log(this.data.shopInfo)
},
resetShoppingCart: function () {
this.setData({
shoppingCart: [],
shoppingCartTotal: 0,
})
wx.setStorageSync('shoppingCartBuffer', [])
},
/**
......@@ -115,6 +140,18 @@ Page({
funcSideBar.push(funcItem)
}
// 判断是否从推荐菜单进入
if (this.data.option.sideBarId) {
for (let i = 0, l = funcSideBar.length; i < l; i++) {
if (funcSideBar[i].id === this.data.option.sideBarId) {
this.setData({
currentIndex: i
})
break
}
}
}
this.setData({
sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab
......@@ -148,7 +185,7 @@ Page({
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].genre, // 商品分类标识
'typeId': funcResponse[i].genre, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
......@@ -165,10 +202,13 @@ Page({
'notificationId': funcResponse[i].notificationId, // 下单须知
'quantityMin': 1,
'quantityMax': funcResponse[i].number,
'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'isActive': true,
}
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
......@@ -189,6 +229,23 @@ Page({
winLoading: false,
commodityList: funcCommodityList,
})
// 判断是否从推荐菜单进入,主动查询商品详情
if (this.data.option.commodityId) {
for (let i = 0, l = funcCommodityList.length; i < l; i++) {
if (funcCommodityList[i].id === this.data.option.commodityId) {
let funcEvent = {
currentTarget: {
dataset: {
item: funcCommodityList[i]
}
}
}
this.onCommodityDetail(funcEvent)
break
}
}
}
},
})
},
......@@ -266,31 +323,45 @@ Page({
let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false
let funcWinToast = true
let funcItem = event.currentTarget.dataset.item
if (!funcItem) {
funcWinToast = true
funcItem = this.data.commodityDetail
}
console.log(funcItem)
// 判断购物车中是否存在同类商品
// 修改相应的商品数量
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
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break
}
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
}
} else {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
// 重新计算购物车总数
......@@ -303,8 +374,11 @@ Page({
shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast,
winToastNothing: funcWinToastNothing,
winCommodityDetail: false,
})
console.log(funcShoppingCart)
},
/**
......
......@@ -2,11 +2,13 @@
l-image-class="toast-image"
l-class="toast-bg"
show="{{winToast}}"
mask="{{true}}"
image="/image/success.png"
title="添加购物车成功"
duration="400"
></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast
show="{{winLoading}}"
icon="loading"
......@@ -31,8 +33,8 @@
<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">
<view class="commodity-item row" data-item="{{item}}" bind:tap="onCommodityDetail">
<view class="item-img">
<image src="{{item.cover}}" mode="widthFix"></image>
</view>
<view class="item-info">
......@@ -79,7 +81,7 @@
</view>
<view class="item-operation-add">
<button class="row con-c align-c" data-item="{{item}}" bindtap="onCommodityAdd">
<button class="row con-c align-c" data-item="{{item}}" catchtap="onCommodityAdd">
<image mode="widthFix" src="{{imageBase + 'icon/cart-3.png'}}"></image>
</button>
</view>
......@@ -89,9 +91,9 @@
</block>
<!-- 购物车按钮 -->
<view class="cart-btn row con-c align-c" bindtap="onShoppingCart">
<view id="cart" class="cart row con-c align-c" bindtap="onShoppingCart">
<!-- 添加动画圆点 -->
<view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view>
<!-- <view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view> -->
<view class="cart-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap">
......
......@@ -13,7 +13,7 @@ page {
.side-bar {
width: 160rpx;
height: 100vh;
margin-top: 140rpx;
padding-top: 126rpx;
overflow-y: scroll;
background: #f2f3f5;
}
......@@ -58,7 +58,7 @@ page {
color: #959da9;
}
.cart-btn {
.cart {
position: fixed;
right: 48rpx;
bottom: 160rpx;
......@@ -188,6 +188,13 @@ page {
height: 24rpx;
}
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap {
flex: 1;
}
......@@ -378,9 +385,10 @@ image {
/* 购物车样式 */
.cart-animation {
position: fixed;
top: 0;
right: 48rpx;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
background: red;
background: #86c5e1;
}
\ No newline at end of file
......@@ -5,6 +5,8 @@ Page({
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {},
animationPointHeight: 0,
animationPointOrigin: 0,
......@@ -14,6 +16,7 @@ Page({
shopInfo: {},
sideBar: [], // 侧边菜单
sideBarTopPadding: 0,
menuTitle: '', // 商品列表标题
commodityList: [], // 商品列表
commodityDetail: {}, // 商品详情
......@@ -30,7 +33,13 @@ Page({
winCommodityDetail: false,
},
onLoad: function () {
onLoad: function (option) {
this.setData({
option: option
})
this.setSideBarStyle()
this.resetShoppingCart()
this.setCartAnimation()
......@@ -41,9 +50,20 @@ Page({
onShow: function () {
if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
this.resetShoppingCart()
} else {
this.setData({
shoppingCart: wx.getStorageSync('shoppingCartBuffer')
})
this.selectionTotal()
}
},
setSideBarStyle: function () {
this.setData({
sideBarTopPadding: wx.getStorageSync('navigationStatusHeight') + wx.getStorageSync('navigationCapsuleHeight')
})
},
/**
* 添加动画初始
* @function
......@@ -61,7 +81,6 @@ Page({
const funcQuery = wx.createSelectorQuery()
funcQuery.select('#cart').boundingClientRect()
funcQuery.exec((result) => {
console.log(result)
this.setData({
animationPointOrigin: result[0].top + 4
})
......@@ -101,7 +120,6 @@ Page({
this.setData({
shopInfo: funcShopInfo
})
console.log(this.data.shopInfo)
},
resetShoppingCart: function () {
......@@ -136,6 +154,18 @@ Page({
funcSideBar.push(funcItem)
}
// 判断是否从推荐菜单进入
if (this.data.option.sideBarId) {
for (let i = 0, l = funcSideBar.length; i < l; i++) {
if (funcSideBar[i].id === this.data.option.sideBarId) {
this.setData({
currentIndex: i
})
break
}
}
}
this.setData({
sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab
......@@ -186,10 +216,13 @@ Page({
'notificationId': funcResponse[i].notificationId, // 下单须知
'quantityMin': 1,
'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'isActive': true,
}
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
......@@ -211,8 +244,22 @@ Page({
commodityList: funcCommodityList,
})
console.log('commodityList')
console.log(JSON.stringify(this.data.commodityList))
// 判断是否从推荐菜单进入,主动查询商品详情
if (this.data.option.commodityId) {
for (let i = 0, l = funcCommodityList.length; i < l; i++) {
if (funcCommodityList[i].id === this.data.option.commodityId) {
let funcEvent = {
currentTarget: {
dataset: {
item: funcCommodityList[i]
}
}
}
this.onCommodityDetail(funcEvent)
break
}
}
}
},
})
},
......@@ -242,7 +289,6 @@ Page({
* @returns
*/
onCommodityDetail: function (event) {
console.log('onCommodityDetail', event)
let funcItem = event.currentTarget.dataset.item
App.wxRequest({
......@@ -291,44 +337,68 @@ Page({
let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false
let funcWinToast = true
let funcItem = event.currentTarget.dataset.item
if (!funcItem) {
funcWinToast = true
funcItem = this.data.commodityDetail
}
console.log(funcItem)
// 判断购物车中是否存在同类商品
// 修改相应的商品数量
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
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break
}
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
}
} else {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
this.setData({
shoppingCart: funcShoppingCart,
winToast: funcWinToast,
winToastNothing: funcWinToastNothing,
winCommodityDetail: false,
})
// 重新计算购物车数量
this.selectionTotal()
},
selectionTotal: function () {
// 重新计算购物车总数
let funcShoppingCart = this.data.shoppingCart
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,
})
},
......
......@@ -2,11 +2,13 @@
l-image-class="toast-image"
l-class="toast-bg"
show="{{winToast}}"
mask="{{true}}"
image="/image/success.png"
title="添加购物车成功"
duration="400"
></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast
show="{{winLoading}}"
icon="loading"
......@@ -19,7 +21,7 @@
<view class="row">
<!-- 侧边菜单 -->
<view class="side-bar">
<view class="side-bar" style="{{'padding-top: ' + sideBarTopPadding + 'px;'}}">
<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>
......@@ -91,7 +93,7 @@
<!-- 购物车按钮 -->
<view id="cart" class="cart row con-c align-c" bindtap="onShoppingCart">
<!-- 添加动画圆点 -->
<view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view>
<!-- <view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view> -->
<view class="cart-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap">
......
......@@ -13,7 +13,6 @@ page {
.side-bar {
width: 160rpx;
height: 100vh;
margin-top: 140rpx;
overflow-y: scroll;
background: #f2f3f5;
}
......@@ -188,6 +187,13 @@ page {
height: 24rpx;
}
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap {
flex: 1;
}
......
......@@ -5,8 +5,11 @@ Page({
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {},
animationPointHeight: 0,
animationPointOrigin: 0,
winAnimationPoint: false,
......@@ -29,16 +32,22 @@ Page({
winCommodityDetail: false,
},
onLoad: function () {
onLoad: function (option) {
this.setData({
option: option
})
this.resetShoppingCart()
this.setCartAnimation()
this.setShopInfo()
this.querySideBar()
},
onUnload: function () {
// 离开页面清空商品数据
wx.setStorageSync('shoppingCartBuffer', [])
onShow: function () {
if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
this.resetShoppingCart()
}
},
/**
......@@ -53,6 +62,15 @@ Page({
duration: 500,
timingFunction: 'ease'
})
// 获取购物车高度
const funcQuery = wx.createSelectorQuery()
funcQuery.select('#cart').boundingClientRect()
funcQuery.exec((result) => {
this.setData({
animationPointOrigin: result[0].top + 4
})
})
},
/**
......@@ -74,7 +92,7 @@ Page({
winAnimationPoint: true,
})
let funcTimer = setTimeout(() => {
this.animation.translate(0, 0).step()
this.animation.translate(0, this.data.animationPointOrigin).step()
this.setData({
animationData: this.animation.export(),
// winAnimationPoint: false,
......@@ -88,7 +106,14 @@ Page({
this.setData({
shopInfo: funcShopInfo
})
console.log(this.data.shopInfo)
},
resetShoppingCart: function () {
this.setData({
shoppingCart: [],
shoppingCartTotal: 0,
})
wx.setStorageSync('shoppingCartBuffer', [])
},
/**
......@@ -115,6 +140,18 @@ Page({
funcSideBar.push(funcItem)
}
// 判断是否从推荐菜单进入
if (this.data.option.sideBarId) {
for (let i = 0, l = funcSideBar.length; i < l; i++) {
if (funcSideBar[i].id === this.data.option.sideBarId) {
this.setData({
currentIndex: i
})
break
}
}
}
this.setData({
sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab
......@@ -148,7 +185,7 @@ Page({
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].genre, // 商品分类标识
'typeId': funcResponse[i].genre, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
......@@ -165,10 +202,13 @@ Page({
'notificationId': funcResponse[i].notificationId, // 下单须知
'quantityMin': 1,
'quantityMax': funcResponse[i].number,
'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'isActive': true,
}
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
......@@ -189,6 +229,23 @@ Page({
winLoading: false,
commodityList: funcCommodityList,
})
// 判断是否从推荐菜单进入,主动查询商品详情
if (this.data.option.commodityId) {
for (let i = 0, l = funcCommodityList.length; i < l; i++) {
if (funcCommodityList[i].id === this.data.option.commodityId) {
let funcEvent = {
currentTarget: {
dataset: {
item: funcCommodityList[i]
}
}
}
this.onCommodityDetail(funcEvent)
break
}
}
}
},
})
},
......@@ -266,31 +323,45 @@ Page({
let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false
let funcWinToast = true
let funcItem = event.currentTarget.dataset.item
if (!funcItem) {
funcWinToast = true
funcItem = this.data.commodityDetail
}
console.log(funcItem)
// 判断购物车中是否存在同类商品
// 修改相应的商品数量
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
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break
}
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
}
} else {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1
funcShoppingCart.push(funcItem)
}
}
// 重新计算购物车总数
......@@ -303,8 +374,11 @@ Page({
shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast,
winToastNothing: funcWinToastNothing,
winCommodityDetail: false,
})
console.log(funcShoppingCart)
},
/**
......
......@@ -2,11 +2,13 @@
l-image-class="toast-image"
l-class="toast-bg"
show="{{winToast}}"
mask="{{true}}"
image="/image/success.png"
title="添加购物车成功"
duration="400"
></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast
show="{{winLoading}}"
icon="loading"
......@@ -31,8 +33,8 @@
<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">
<view class="commodity-item row" data-item="{{item}}" bind:tap="onCommodityDetail">
<view class="item-img">
<image src="{{item.cover}}" mode="widthFix"></image>
</view>
<view class="item-info">
......@@ -79,7 +81,7 @@
</view>
<view class="item-operation-add">
<button class="row con-c align-c" data-item="{{item}}" bindtap="onCommodityAdd">
<button class="row con-c align-c" data-item="{{item}}" catchtap="onCommodityAdd">
<image mode="widthFix" src="{{imageBase + 'icon/cart-3.png'}}"></image>
</button>
</view>
......@@ -89,9 +91,9 @@
</block>
<!-- 购物车按钮 -->
<view class="cart-btn row con-c align-c" bindtap="onShoppingCart">
<view id="cart" class="cart row con-c align-c" bindtap="onShoppingCart">
<!-- 添加动画圆点 -->
<view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view>
<!-- <view class="cart-animation" wx:if="{{winAnimationPoint}}" animation="{{animationData}}"></view> -->
<view class="cart-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap">
......
......@@ -13,7 +13,7 @@ page {
.side-bar {
width: 160rpx;
height: 100vh;
margin-top: 140rpx;
padding-top: 126rpx;
overflow-y: scroll;
background: #f2f3f5;
}
......@@ -58,7 +58,7 @@ page {
color: #959da9;
}
.cart-btn {
.cart {
position: fixed;
right: 48rpx;
bottom: 160rpx;
......@@ -188,6 +188,13 @@ page {
height: 24rpx;
}
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap {
flex: 1;
}
......@@ -378,9 +385,10 @@ image {
/* 购物车样式 */
.cart-animation {
position: fixed;
top: 0;
right: 48rpx;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
background: red;
background: #86c5e1;
}
\ No newline at end of file
......@@ -122,7 +122,7 @@ Page({
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].classifyId, // 商品分类标识
'typeId': funcResponse[i].genre, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
......
......@@ -161,7 +161,7 @@ Page({
let funcShoppingCart = this.data.shoppingCart
if (funcShoppingCart[funcIndex].quantityMax <= funcShoppingCart[funcIndex].quantity) return
funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 10
funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 1
this.setData({
shoppingCart: funcShoppingCart
})
......@@ -263,6 +263,7 @@ Page({
// 格式化金额
funcAmountDiscount = funcAmountDiscount - funcAmountPay
console.log('funcAmountDiscount', funcAmountDiscount)
funcAmountPay = App.modular.utils.formatAmount(funcAmountPay)
funcAmountDiscount = App.modular.utils.formatAmount(funcAmountDiscount)
......
......@@ -47,7 +47,7 @@
.shopping-cart-list {
width: 750rpx;
margin-top: 50rpx;
padding-bottom: 200rpx;
padding-bottom: 240rpx;
}
.list-item {
......
......@@ -8,6 +8,9 @@ let logicData = {
Page({
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
mapCss: '',
pointDetail: './image/card/01.png',
winPointDetail: false,
......
......@@ -19,7 +19,7 @@
<navigation class="navigation" titleText="智慧导览" backIcon="/image/back.png"></navigation>
<scroll-view class="guide" scroll-x scroll-left="{{selectionPoint}}">
<image id="guide-map" src="http://sm-web.meiqicloud.com/userfiles/appResources/guide/guide.png" style="{{mapCss}}"></image>
<image id="guide-map" src="{{resourcesBase + 'guide/guide.png'}}" style="{{mapCss}}"></image>
<view class="point-map" style="{{mapCss}}" catch:tap="onCancel">
<block wx:for="{{pointInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
......@@ -44,7 +44,7 @@
</scroll-view>
<view class="point-detail" hidden="{{!winPointDetail}}" catch:tap="onPointDetail">
<image src="{{pointDetail}}"></image>
<image src="{{resourcesBase + pointDetail}}"></image>
</view>
<view class="save-map row con-c align-c" bindtap="onSaveMap">
......
......@@ -5,7 +5,7 @@ let output = [
id: '',
name: '温泉洋房(建设中)',
icon: './image/icon/01.png',
card: './image/card/01.png',
card: 'guide/card/01.png',
detail: '/pages/play/point-detail/point-detail?id=105',
isActive: false,
}, {
......@@ -14,7 +14,7 @@ let output = [
id: '',
name: '海错图2号馆',
icon: './image/icon/02.png',
card: './image/card/02.png',
card: 'guide/card/02.png',
detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false,
}, {
......@@ -23,7 +23,7 @@ let output = [
id: 1,
name: '海错图1号馆',
icon: './image/icon/03.png',
card: './image/card/03.png',
card: 'guide/card/03.png',
detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false,
}, {
......@@ -32,7 +32,7 @@ let output = [
id: 4,
name: '原味舒食',
icon: './image/icon/04.png',
card: './image/card/04.png',
card: 'guide/card/04.png',
detail: '/pages/play/service-detail/service-detail?id=4',
isActive: false,
}, {
......@@ -41,7 +41,7 @@ let output = [
id: 6,
name: '星空影院',
icon: './image/icon/05.png',
card: './image/card/05.png',
card: 'guide/card/05.png',
detail: '/pages/play/service-detail/service-detail?id=6',
isActive: false,
}, {
......@@ -50,7 +50,7 @@ let output = [
id: 3,
name: '元养水韵SPA',
icon: './image/icon/06.png',
card: './image/card/06.png',
card: 'guide/card/06.png',
detail: '/pages/play/service-detail/service-detail?id=3',
isActive: false,
}, {
......@@ -59,7 +59,7 @@ let output = [
id: 5,
name: '原野MOJITO',
icon: './image/icon/07.png',
card: './image/card/07.png',
card: 'guide/card/07.png',
detail: '/pages/play/service-detail/service-detail?id=5',
isActive: false,
}, {
......@@ -68,7 +68,7 @@ let output = [
id: 2,
name: '拾光花坊',
icon: './image/icon/08.png',
card: './image/card/08.png',
card: 'guide/card/08.png',
detail: '/pages/play/service-detail/service-detail?id=2',
isActive: false,
}, {
......@@ -77,7 +77,7 @@ let output = [
id: '',
name: '星光广场',
icon: './image/icon/09.png',
card: './image/card/09.png',
card: 'guide/card/09.png',
detail: '/pages/play/point-detail/point-detail?id=101',
isActive: false,
}, {
......@@ -86,7 +86,7 @@ let output = [
id: '',
name: '云之亭',
icon: './image/icon/10.png',
card: './image/card/10.png',
card: 'guide/card/10.png',
detail: '/pages/play/point-detail/point-detail?id=102',
isActive: false,
}, {
......@@ -95,7 +95,7 @@ let output = [
id: '',
name: '湿地公园',
icon: './image/icon/11.png',
card: './image/card/11.png',
card: 'guide/card/11.png',
detail: '/pages/play/point-detail/point-detail?id=103',
isActive: false,
}, {
......@@ -104,7 +104,7 @@ let output = [
id: '',
name: '新月码头',
icon: './image/icon/12.png',
card: './image/card/12.png',
card: 'guide/card/12.png',
detail: '/pages/play/point-detail/point-detail?id=104',
isActive: false,
}, {
......@@ -113,7 +113,7 @@ let output = [
id: '',
name: '儿童营地',
icon: './image/icon/13.png',
card: './image/card/13.png',
card: 'guide/card/13.png',
detail: '/pages/campsite/home-mirror/home-mirror',
isActive: false,
}, {
......@@ -122,7 +122,7 @@ let output = [
id: '',
name: '星耀银湖',
icon: './image/icon/14.png',
card: './image/card/14.png',
card: 'guide/card/14.png',
detail: '/pages/play/point-detail/point-detail?id=106',
isActive: false,
}, {
......@@ -131,7 +131,7 @@ let output = [
id: '',
name: '奇幻森林',
icon: './image/icon/15.png',
card: './image/card/15.png',
card: 'guide/card/15.png',
detail: '/pages/play/point-detail/point-detail?id=107',
isActive: false,
},
......
......@@ -8,7 +8,7 @@ Page({
data: {
imageBase: App.globalData.appImageBase,
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
userInfo: {
'openId': '',
......@@ -20,7 +20,7 @@ Page({
'sex': '',
'userType': 0
},
mobile: '',
nickName: '',
avatarUrl: '/pages/mine/home/image/avatar.png',
......@@ -30,10 +30,10 @@ Page({
approveList: ['园区门票优惠', '餐厅价格优惠', 'SPA服务优惠', '免费观看电影', '无须预约入园', '尽享多重特权'],
activityList: [],
isRegister: false, // 是否注册,
// 右上角消息
passBadge: 0,
foodBadge: 22 ,
foodBadge: 22,
movieBadge: 1,
spaBadge: 0,
artBadge: 101,
......@@ -41,8 +41,7 @@ Page({
showMoreOrder: false, // 查看更多订单
showMoreActivity: false, // 查看更多活动
myOrder: {
passOrder: [
{
passOrder: [{
id: 0,
logo: '',
store: '儿童营地',
......@@ -63,26 +62,22 @@ Page({
],
artOrder: {
logo: '',
orderList: [
{
id: 0,
store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30',
quantity: '共1张门票'
},
]
orderList: [{
id: 0,
store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30',
quantity: '共1张门票'
}, ]
}
},
appointmentList: [
{
time: '8月15日-7月15日 10:00-12:00',
img: '',
title: '日落观光游船体验活动之船行碧波共赏美景',
num: 3
}
]
appointmentList: [{
time: '8月15日-7月15日 10:00-12:00',
img: '',
title: '日落观光游船体验活动之船行碧波共赏美景',
num: 3
}]
},
close() {
......@@ -111,7 +106,12 @@ Page({
onShow: function () {
this.setUserInfo()
},
// 去核销
goCouponInput(event) {
wx.navigateTo({
url: '/pages/pay/coupon-input/coupon-input',
})
},
setUserInfo: function () {
let funcUserInfo = wx.getStorageSync('userInfo')
......@@ -214,7 +214,11 @@ Page({
var that = this
App.wxRequest({
url: '/api/v1/activity/getMyActivityList',
data: { activeState: '0,1', pageSize: 10, pageNo: 1 },
data: {
activeState: '0,1',
pageSize: 10,
pageNo: 1
},
success: function (res) {
let list = res.data.list
let tmpArr = []
......@@ -222,12 +226,18 @@ Page({
let state = item.activeState * 1
let type = 0
switch (state) {
case 0: type = 1; break;
case 1: type = 0; break;
case 2: type = 2; break;
case 0:
type = 1;
break;
case 1:
type = 0;
break;
case 2:
type = 2;
break;
}
let obj = {
time: item.enrollDate,//activeDate + ' ' + item.activeTime,
time: item.enrollDate, //activeDate + ' ' + item.activeTime,
type: type,
content: item.address,
title: item.name,
......@@ -249,7 +259,7 @@ Page({
url: '/api/v1/subscribe/getList',
data: {
state: '1',
type: ''//0 入园预约 1 看房预约 全部 空字符
type: '' //0 入园预约 1 看房预约 全部 空字符
},
success: function (res) {
let tmpArr = []
......
......@@ -47,7 +47,7 @@
</view>
</view>
<view class="coupon row align-c">
<view class="coupon row align-c" bindtap="goCouponInput">
<view class="cpopon-info col">
<text>券码核销</text>
<text>所属门店:拾光花坊</text>
......
......@@ -2,6 +2,14 @@ page {
height: 100%;
}
.fixed-tab {
position: fixed;
background: #fff;
top: 176rpx;
z-index: 99;
}
.navigation-order {
z-index: 1700;
position: fixed;
......@@ -45,7 +53,7 @@ page {
background: rgba(0, 0, 0, .65);
}
.order-type-selection > view {
.order-type-selection>view {
width: 750rpx;
min-height: 240rpx;
padding-top: 10rpx;
......@@ -77,7 +85,9 @@ page {
}
.container-order {
margin-top: 170rpx;
/* margin-top: 170rpx; */
margin-top: 288rpx;
}
.container {
......@@ -124,7 +134,7 @@ page {
background: #FFFFFF;
}
.order-list-item > view {
.order-list-item>view {
width: 610rpx;
}
......@@ -242,7 +252,7 @@ page {
margin-top: 56rpx;
}
.code-info-qrcode > image {
.code-info-qrcode>image {
display: block;
width: 296rpx;
height: 296rpx;
......@@ -297,7 +307,34 @@ page {
background: #A9A8A7;
}
.code-close > image {
.code-close>image {
width: 48rpx;
height: 48rpx;
}
.empty-cart {
width: 176rpx;
height: 176rpx;
/* background-color: #ccc; */
}
.empty-title {
margin-top: 64rpx;
color: #959DA9;
font-size: 38rpx;
line-height: 52rpx;
}
.empty-btn {
width: 308rpx;
height: 96rpx;
margin-top: 68rpx;
color: #fff;
font-size: 30rpx;
line-height: 96rpx;
text-align: center;
background: #86C5E1;
border-radius: 4rpx;
}
\ No newline at end of file
const App = getApp()
Page({
data: {
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
couponInfo: {
type: '套票',
store: '儿童营地',
id: '26719921231',
useTime: '2020-11-06'
},
goodsList: [
{
id: 0,
cover: '',
name: '咖喱蔬菜大虾',
quantity: '2',
price: '30.60'
},
{
id: 1,
cover: '',
name: '南瓜坚果汤',
quantity: '3',
price: '30.60'
},
],
orderInfo: {
name: '林有一',
phone: '15802035122',
idNum: '350600366462131',
}
couponInfo: null,
// {
// type: '套票',
// store: '儿童营地',
// id: '26719921231',
// useTime: '2020-11-06'
// },
goodsList: null,
// [
// {
// id: 0,
// cover: '',
// name: '咖喱蔬菜大虾',
// quantity: '2',
// price: '30.60'
// },
// {
// id: 1,
// cover: '',
// name: '南瓜坚果汤',
// quantity: '3',
// price: '30.60'
// },
// ],
userList: null,
orderInfo: null,
// {
// name: '林有一',
// phone: '15802035122',
// idNum: '350600366462131',
// },
remarks: null, // 备注
couponDetail: null,
},
onLoad: function (options) {
console.log(options)
if (options.type) options.type = Number(options.type)
let orderType = options.type
this.setData({
orderType
})
this.setView()
},
setView() {
let orderType = this.data.orderType
switch (orderType) {
case 4:
this.setData({
goodsList: [
{
cover: '',
name: '《海错图》超级豪华精致古风限量版折扇',
quantity: '1',
price: '30.60'
}
],
note: '身份证号变更为350600366462132'
})
break
case 5:
break
// if (options.type) options.type = Number(options.type)
// let orderType = options.type
// this.setData({
// orderType
// })
// this.setView()
if (options.couponDetail) {
let data = JSON.parse(options.couponDetail)
let tmpGoodsList = [];
data.smOrderDetails.forEach(item => {
var tmpItem = {
id: item.commodityId,
cover: item.imgUrl,
name: item.name,
quantity: item.number,
price: item.totalPrices,
}
tmpGoodsList.push(tmpItem)
})
let tmpUserList = [];
data.smPersonalDetails.forEach(item => {
var tmpItem = {
name: item.name,
phone: item.cellPhone,
idNum: item.identityCard,
}
tmpUserList.push(tmpItem)
})
this.setData({
['couponInfo.type']: data.goodType,
['couponInfo.store']: data.officeName,
['couponInfo.id']: data.serialNumber,
['couponInfo.useTime']: data.expireTime,
goodsList: tmpGoodsList,
userList: tmpUserList,
remarks: data.remarks,
couponDetail: data,
})
}
},
// 取消核销
cancelOperation() {
wx.navigateBack()
},
// 确认核销'
submitOperation() {
let that = this
wx.lin.showDialog({
type:"confirm",
title:"",
content:"是否确认核销券码" ,
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
that.doVolume()
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
doVolume() {
let that = this
wx.lin.showToast({
icon: 'loading',
title: '正在核销',
show: true,
mask: true,
duration: 1000 * 60,
})
App.wxRequest({
url: '/api/v1/volume/doVolume',
data: {
volumeId: that.data.couponDetail.volumeId,
},
success: function(res) {
wx.lin.showToast({
image: '/image/success.png',
title: '核销成功',
})
setTimeout(()=>{
wx.navigateBack()
},2000);
},
fail: function(err) {
wx.lin.showToast({
image: '/image/error.png',
title: err.msg,
})
}
})
}
})
\ No newline at end of file
<navigation class="navigation" titleText="券码核销" background="#ffffff" backIcon="/image/back.png"></navigation>
<l-dialog />
<l-toast l-image-class="toast-image"></l-toast>
<view class="container">
<view class="list-wrapper">
<view class="title-wrapper">兑换券信息</view>
......@@ -25,7 +26,7 @@
<view class="goods-list">
<view class="goods-item row align-c" wx:for="{{goodsList}}" wx:key="id">
<view class="goods-img">
<image mode="widthFix" src="{{item.cover}}"></image>
<image mode="aspectFill" src="{{item.cover}}"></image>
</view>
<view class="goods-name">{{item.name}}</view>
<view class="goods-price-num col">
......@@ -38,47 +39,32 @@
</view>
</view>
</view>
<view class="list-wrapper">
<view class="list-wrapper" wx:for="{{userList}}" wx:key="index">
<view class="title-wrapper">订单详情</view>
<view class="info-wrapper row con-b">
<view class="info-name">姓名</view>
<view class="info-text">{{orderInfo.name}}</view>
<view class="info-text">{{item.name}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-wrapper row con-b" wx:if="{{item.phone}}">
<view class="info-name">手机</view>
<view class="info-text">{{orderInfo.phone}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view>
<view class="info-text">{{item.phone}}</view>
</view>
</view>
<view class="list-wrapper">
<view class="title-wrapper">订单详情</view>
<view class="info-wrapper row con-b">
<view class="info-name">姓名</view>
<view class="info-text">{{orderInfo.name}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">手机</view>
<view class="info-text">{{orderInfo.phone}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-wrapper row con-b" wx:if="{{item.idNum}}">
<view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view>
<view class="info-text">{{item.idNum}}</view>
</view>
</view>
<view class="list-wrapper" wx:if="{{note}}">
<view class="list-wrapper" wx:if="{{remarks}}">
<view class="title-wrapper">备注</view>
<view class="info-wrapper row con-b">
<view class="info-name">{{note}}</view>
<view class="info-name">{{remarks}}</view>
</view>
</view>
</view>
<view class="footer-wrapper">
<view class="footer-btn row con-b align-e">
<view class="cancel-btn">取消核销</view>
<view class="confirm-btn">确认核销</view>
<view class="cancel-btn" bindtap="cancelOperation">取消核销</view>
<view class="confirm-btn" bindtap="submitOperation">确认核销</view>
</view>
<Blank></Blank>
</view>
.container {
margin-top: 120rpx;
margin-top: 150rpx;
padding-bottom: 196rpx;
}
.list-wrapper {
......
const App = getApp()
Page({
data: {
avatarUrl: '/pages/mine/home/image/avatar.png',
showDialog: false
showDialog: false,
showDialogSmg: '非本店券码,无法使用',
couponCode: '',
},
onLoad: function (options) {
},
handleWriteOff() {
let showDialog = true
this.getVolumeDetails(this.data.couponCode)
},
//券码输入
bindCouponInput(e) {
this.setData({
showDialog
couponCode: e.detail.value
})
},
// 扫码
handleScanCode() {
let that = this
wx.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log(res)
let result = res.result
that.getVolumeDetails(result)
}
})
},
getVolumeDetails(couponCode) {
if (!couponCode || couponCode.length == 0) {
wx.lin.showToast({
image: '/image/error.png',
title: '请输入券码',
})
return
}
let that = this
wx.lin.showToast({
icon: 'loading',
title: '正在识别',
show: true,
mask: true,
duration: 1000 * 60,
})
App.wxRequest({
url: '/api/v1/volume/getVolumeDetails',
data: {
serialNumber: couponCode,
},
success: function(res) {
wx.lin.hideToast()
let couponDetail = JSON.stringify(res.data)
wx.navigateTo({
url: '/pages/pay/coupon-detail/coupon-detail?couponDetail='+couponDetail,
})
},
fail: function(err) {
wx.lin.hideToast()
that.setData({
showDialogSmg: err.msg,
showDialog: true
})
}
})
}
})
\ No newline at end of file
<navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation>
<l-toast l-image-class="toast-image"></l-toast>
<view class="container">
<!-- 头像信息 -->
<view class="header col align-c">
......@@ -25,12 +25,12 @@
</view>
<!-- 核销输入框 -->
<view class="coupon-input-wrapper row con-b">
<input placeholder="请输入券码" placeholder-style="color: #C2C7CF"></input>
<input placeholder="请输入券码" placeholder-style="color: #C2C7CF" bindinput="bindCouponInput" value="{{couponCode}}"></input>
<view class="coupon-input-btn" bindtap="handleWriteOff">核销</view>
<l-dialog show="{{showDialog}}" l-class="dialog-wrapper" l-title-class="dialog-title" l-confirm-class="dialog-confirm" title="非本店券码,无法使用">
<view class="dialog-content">所属门店:原味舒食</view>
<l-dialog show="{{showDialog}}" l-class="dialog-wrapper" l-title-class="dialog-title" l-confirm-class="dialog-confirm" title="{{showDialogSmg}}">
<!-- <view class="dialog-content">所属门店:原味舒食</view> -->
</l-dialog>
<l-toast show="{{true}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="核销成功" />
<!-- <l-toast show="{{true}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="核销成功" /> -->
</view>
<!-- 扫码核销 -->
......
......@@ -3,37 +3,31 @@ let App = getApp()
Page({
data: {
imageBase: App.globalData.appImageBase,
scoreServe: 0, // 服务分数
scoreServe: 0, // 服务分数
scoreServeText: '0.0',
scoreProduct: 0, // 产品分数
scoreProduct: 0, // 产品分数
scoreProductText: '0.0',
scoreEnvironment: 0, // 环境分数
scoreEnvironmentText: '0.0',
content: '', // 评价内容,
imgUrls: [], // 评价图片本地路径
content: '', // 评价内容,
imgUrls: [], // 评价图片本地路径
orderInfo: {
orderId: '02aaa9a62d5645c59109218c27d2174a',
name: '精灵鸟理想国年卡',
price: '1680.00',
quantity: 4,
coverList: [
{
id: 0,
imgUrl: ''
},
{
id: 1,
imgUrl: ''
},
{
id: 2,
imgUrl: ''
}
]
id: '',
name: '',
amount: '',
commodity: []
},
},
onLoad: function (options) {
console.log(options, '----------options------');
let orderItem = JSON.parse(options.orderItem)
this.setData({
orderInfo: orderItem
})
},
/**
/**
* 评价分数
* @function
* @param
......@@ -41,14 +35,21 @@ Page({
*/
onChangeScore: function (event) {
// type 1: 服务评价 2: 产品评价 3: 环境评价
const { index, type } = event.currentTarget.dataset
const {
index,
type
} = event.currentTarget.dataset
console.log(index, type)
let { scoreServe, scoreProduct, scoreEnvironment } = this.data
let {
scoreServe,
scoreProduct,
scoreEnvironment
} = this.data
switch (type) {
case 1:
scoreServe = index + 1
break
case 2:
case 2:
scoreProduct = index + 1
break
case 3:
......@@ -76,7 +77,7 @@ Page({
content
})
},
/**
/**
* 新增评价图片
* @function
* @param
......@@ -114,8 +115,8 @@ Page({
filePath: funcFile,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
'token': App.globalData.token
'Content-Type': 'multipart/form-data',
'token': App.globalData.token
},
success: (res) => {
const data = JSON.parse(res.data)
......@@ -130,9 +131,9 @@ Page({
// fileUrls
// })
let formData = {}
formData.orderId = this.data.orderInfo.orderId
formData.orderId = this.data.orderInfo.id
formData.imgUrls = fileUrls,
formData.serviceEvaluation = this.data.scoreServeText
formData.serviceEvaluation = this.data.scoreServeText
formData.productEvaluation = this.data.scoreProductText
formData.environmentalEvaluation = this.data.scoreEnvironmentText
formData.content = this.data.content
......@@ -149,10 +150,13 @@ Page({
},
success: (response) => {
console.log(response)
wx.navigateBack({
delta: 0,
})
}
})
}
})
}
})
\ No newline at end of file
<navigation class="navigation" titleText="订单评价" background="#ffffff" backIcon="/image/back.png"></navigation>
<view class="container con-s">
<view class="order-wrapper">
<view class="order-title">
<text>购买商品</text>
</view>
<view class="row align-c">
<block wx:for="{{orderInfo.coverList}}" wx:key="id">
<view class="order-cover">
<image src="{{item.imgUrl}}"></image>
</view>
</block>
<view class="order-wrapper">
<view class="order-title">
<text>购买商品</text>
</view>
<view class="row align-c">
<block wx:for="{{orderInfo.commodity}}" wx:key="id">
<view class="order-cover">
<image src="{{item.cover}}"></image>
</view>
</block>
<view class="order-name" wx:if="{{orderInfo.coverList.length === 1}}">
<text>{{orderInfo.name}}</text>
</view>
<view class="order-price-wrapper col align-e">
<view class="order-price">
<text class="price-symbol">¥</text>
<text>{{orderInfo.price}}</text>
</view>
<view class="order-quantity">
<text>{{'共' + orderInfo.quantity + '件'}}</text>
</view>
</view>
</view>
</view>
<view class="order-name" wx:if="{{orderInfo.commodity.length === 1}}">
<text>{{orderInfo.name}}</text>
</view>
<view class="order-price-wrapper col align-e">
<view class="order-price">
<text class="price-symbol">¥</text>
<text>{{orderInfo.amount}}</text>
</view>
<view class="order-quantity">
<text>{{'共' + orderInfo.commodity.length + '件'}}</text>
</view>
</view>
</view>
</view>
<view class="order-comment-wrapper">
<view class="order-comment-title">
<text>订单评价</text>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>服务评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{1}}">
<image wx:if="{{scoreServe >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreServe < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreServeText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>产品评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{2}}">
<image wx:if="{{scoreProduct >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreProduct < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreProductText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>环境评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{3}}">
<image wx:if="{{scoreEnvironment >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreEnvironment < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreEnvironmentText + '星'}}</text>
</view>
</view>
<view class="order-comment">
<l-textarea placeholder="您的评价与建议,会让园区做的更好" placeholder-style="color: #C2C7CF" maxlength="200" l-class="l-textarea" border="{{false}}" bind:linblur="eventInputDone" />
<view class="order-picker">
<l-image-picker l-item-class="l-image-item" l-class="l-picker" count="9" size="3" size-type="compressed" custom="{{true}}" bind:linchange="eventImageAdd" bind:linremove="eventImageRemove">
<view class="col con-c align-c">
<image class="icon-img"></image>
<text>添加图片</text>
</view>
</l-image-picker>
</view>
</view>
</view>
<view class="footer-wrapper">
<view class="comment-btn" bindtap="onSubmitCommennt">
<text>提交评价</text>
</view>
</view>
<view class="order-comment-wrapper">
<view class="order-comment-title">
<text>订单评价</text>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>服务评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{1}}">
<image wx:if="{{scoreServe >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreServe < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreServeText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>产品评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{2}}">
<image wx:if="{{scoreProduct >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreProduct < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreProductText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>环境评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{3}}">
<image wx:if="{{scoreEnvironment >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreEnvironment < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreEnvironmentText + '星'}}</text>
</view>
</view>
<view class="order-comment">
<l-textarea placeholder="您的评价与建议,会让园区做的更好" placeholder-style="color: #C2C7CF" maxlength="200" l-class="l-textarea" border="{{false}}" bind:linblur="eventInputDone" />
<view class="order-picker">
<l-image-picker l-item-class="l-image-item" l-class="l-picker" count="9" size="3" size-type="compressed" custom="{{true}}" bind:linchange="eventImageAdd" bind:linremove="eventImageRemove">
<view class="col con-c align-c">
<image class="icon-img"></image>
<text>添加图片</text>
</view>
</l-image-picker>
</view>
</view>
</view>
<view class="footer-wrapper">
<view class="comment-btn" bindtap="onSubmitCommennt">
<text>提交评价</text>
</view>
</view>
</view>
\ No newline at end of file
......@@ -142,6 +142,7 @@
padding: 30rpx 40rpx 0;
background-color: #fff;
border-top: 1px solid #E2E7EF;
z-index: 5;
}
.comment-btn {
width: 670rpx;
......
......@@ -7,13 +7,15 @@ Page({
shopInfo: {},
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderInfo: {},
fromPage: '',
codeInfo: {},
isFromUse: false,
winCode: false,
residuePayTime: "", //剩余支付时间
},
onLoad: function (options) {
......@@ -37,6 +39,7 @@ Page({
* @returns
*/
queryOrderDetail: function () {
let that = this
App.wxRequest({
url: '/api/v1/order/getOrderDetail',
data: {
......@@ -46,15 +49,14 @@ Page({
let funcResponse = response.data
let funcOrderInfo = {
'id': this.data.orderInfo.id,
'score': funcResponse.integral, // 积分
'state': Number(funcResponse.status), // 订单状态
'amount': funcResponse.totalMoney, // 实付金额
'contactName': funcResponse.name, // 联系人名称
'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodityType': Number(funcResponse.goodType), // 商品类型
'score': funcResponse.integral, // 积分
'state': Number(funcResponse.status), // 订单状态
'amount': funcResponse.totalMoney, // 实付金额
'contactName': funcResponse.name, // 联系人名称
'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodityType': Number(funcResponse.goodType), // 商品类型
'commodity': [],
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipTimeSubmit': funcResponse.createDate,
'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'),
'tipIntegral': funcResponse.integral
......@@ -65,14 +67,43 @@ Page({
for (let i = 0, l = funcCommodity.length; i < l; i++) {
let funcCommodityItem = {
'cover': funcCommodity[i].imgUrl,
'name': funcCommodity[i].name, // 名称
'quantity': funcCommodity[i].number, // 数量
'amount': funcCommodity[i].totalPrices, // 总价
'state': Number(funcCommodity[i].status), // 状态
'codeId': funcCommodity[i].volumeId, // 券码
'name': funcCommodity[i].name, // 名称
'quantity': funcCommodity[i].number, // 数量
'amount': funcCommodity[i].totalPrices, // 总价
'state': Number(funcCommodity[i].status), // 状态
'codeId': funcCommodity[i].volumeId, // 券码
}
funcOrderInfo.commodity.push(funcCommodityItem)
}
// 倒计时
if (funcOrderInfo.state == 0) {
// 待付款状态
let doTime = 15 * 60 * 1000
let timeInter = setInterval(() => {
let creatdTime = new Date(funcOrderInfo.tipTimeSubmit.replace(/-/g, '/')).getTime()
let endTime = creatdTime + doTime
let now = new Date().getTime()
let residueStamp = endTime - now
let residuePayTime = App.modular.miment(residueStamp).format('mm:ss')
if (residueStamp > 0) {
that.setData({
residuePayTime: residuePayTime
})
} else {
console.log(residueStamp, 'residueStamp----------------');
clearInterval(timeInter)
// that.queryOrderDetail()
let state = `orderInfo.state`
that.setData({
[state]: -1
})
}
}, 1000)
}
this.setData({
orderInfo: funcOrderInfo
......@@ -87,6 +118,8 @@ Page({
})
},
onCouponCode: function (event) {
let funcOrderInfo = event.currentTarget.dataset.item
App.wxRequest({
......
......@@ -8,7 +8,7 @@
<text>订单待付款</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>请在 {{residuePayTime}} 内付款,否则将自动取消订单</text>
</view>
</view>
......@@ -23,7 +23,7 @@
<text>订单已过期</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>有效期xxx-xxx</text>
</view>
</view>
......@@ -32,7 +32,7 @@
<text>订单已取消</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>下单后15分钟内未付款,自动取消订单</text>
</view>
</view>
......@@ -79,7 +79,6 @@
<text class="info-content-item-tip">18030303030</text>
</view>
</view>
<view class="info-line row con-b align-c">
<view class="info-line-point-left"></view>
<view class="info-line-line"></view>
......
<l-toast show="{{winToast}}" icon="error" title="{{toastContent}}"></l-toast>
<!-- 购买须知详情 -->
<view class="notice-detail" wx:if="{{winNoticeDetail}}" bindtap="onNoticeClose">
<view class="notice-item" animation="{{animation}}">
<image src="{{noticeDetail}}"></image>
<view class="notice-title">
<text>{{noticeText}}</text>
</view>
<view class="notice-rich">
<rich-text nodes="{{noticeDetail}}"></rich-text>
</view>
</view>
</view>
......@@ -171,11 +174,13 @@
</view>
<view class="quantity-input row con-b align-c">
<l-button l-class="input-button input-cut" special="{{true}}" bind:lintap="onQuantityCut">
<image class="input-icon" src="{{imageBase + 'cut.png'}}"></image>
<image wx:if="{{1 < quantity}}" class="input-icon" src="{{imageBase + 'icon/cut-1.png'}}"></image>
<image wx:if="{{1 === quantity}}" class="input-icon" src="{{imageBase + 'icon/cut-2.png'}}"></image>
</l-button>
<text class="text" style="{{formQuantity === 0 ? 'color: #C2C7CF' : 'color: #15191F'}}">{{quantity}}</text>
<l-button l-class="input-button input-add" special="{{true}}" bind:lintap="onQuantityAdd">
<image class="input-icon" src="{{imageBase + 'add.png'}}"></image>
<image wx:if="{{quantity < quantityMax}}" class="input-icon" src="{{imageBase + 'icon/add-1.png'}}"></image>
<image wx:if="{{quantity === quantityMax}}" class="input-icon" src="{{imageBase + 'icon/add-2.png'}}"></image>
</l-button>
</view>
<view class="quantity-other row con-b align-c">
......@@ -190,7 +195,7 @@
</view>
<!-- winContact -->
<view class="contact" wx:if="{{winContact && !winNoticeDetail}}">
<view class="contact" wx:if="{{winContact && !winNoticeDetail && !winStockTip}}">
<view class="contact-title col">
<text>{{contactTitle}}</text>
<text>仅用于接收订单确认短信</text>
......@@ -202,13 +207,13 @@
</view>
<view class="contact-input col">
<text>手机号</text>
<input placeholder="请输入手机号" maxlength="11" data-type="phone" data-index="{{0}}" bindblur="onInputBlur"></input>
<input placeholder="请输入手机号" maxlength="11" type="number" data-type="phone" data-index="{{0}}" bindblur="onInputBlur"></input>
<text>{{registerInfo[0].errorPhone}}</text>
</view>
</view>
<!-- winRegister -->
<view class="register" wx:if="{{winRegister && !winNoticeDetail}}">
<view class="register" wx:if="{{winRegister && !winNoticeDetail && !winStockTip}}">
<view class="register-title col">
<text>填写贵宾信息</text>
</view>
......@@ -219,7 +224,7 @@
<block wx:for="{{registerInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="register-item-title">
<text>{{'年卡' + (index + 1)}}</text>
<text>{{registerTitle + (index + 1)}}</text>
</view>
<view class="contact-input col">
<text>姓名</text>
......@@ -228,7 +233,7 @@
</view>
<view class="contact-input col">
<text>手机号</text>
<input placeholder="请输入手机号" maxlength="11" data-type="phone" data-index="{{index}}" bindblur="onInputBlur"></input>
<input placeholder="请输入手机号" maxlength="11" type="number" data-type="phone" data-index="{{index}}" bindblur="onInputBlur"></input>
<text>{{item.errorPhone}}</text>
</view>
<view class="contact-input col">
......@@ -241,7 +246,7 @@
</view>
<!-- winButtonPay -->
<cover-view class="pay" wx:if="{{winButtonPay && !winNoticeDetail}}">
<cover-view class="pay" wx:if="{{winButtonPay && !winNoticeDetail && !winStockTip}}">
<cover-view class="pay-tip row align-c">
<cover-image src="{{imageBase + 'fail-icon-4.png'}}"></cover-image>
<cover-view class="pay-tip-text row con-c align-c">付款后一经确认不得退款</cover-view>
......@@ -255,4 +260,24 @@
<!-- winButtonAppointment -->
<cover-view class="appointment row con-c align-c" wx:if="{{winButtonAppointment && !winNoticeDetail}}">
<cover-view class="appointment-confirm row con-c align-c">确认预约</cover-view>
</cover-view>
\ No newline at end of file
</cover-view>
<!-- 库存不足提示 -->
<view class="stock-mask row con-c align-c" wx:if="{{winStockTip}}">
<view class="stock col con-c align-c">
<view class="stock-tip row con-c align-c">
<text>{{'抱歉,您本单商品有' + stockList.length + '件库存不足'}}</text>
</view>
<view class="stock-info col con-c align-c">
<block wx:for="{{stockList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="stock-item row align-c">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
</block>
</view>
<view class="stock-close row con-c align-c" bindtap="onStockTipClose">
<button class="row con-c align-c">返回购物车</button>
</view>
</view>
</view>
\ No newline at end of file
......@@ -14,15 +14,31 @@
left: 0;
bottom: -950rpx;
width: 750rpx;
padding: 28px 0 50rpx 0;
height: 70%;
padding: 130rpx 40rpx 50rpx 40rpx;
border-radius: 24px 24px 0px 0px;
background: #FFFFFF;
}
.notice-item image {
display: block;
width: 750rpx;
height: 950rpx;
.notice-title {
position: absolute;
top: 50rpx;
width: 670rpx;
height: 130rpx;
}
.notice-title text {
height: 58rpx;
font-size: 42rpx;
font-weight: 500;
line-height: 58rpx;
color: #15191F;
}
.notice-rich {
width: 670rpx;
height: 100%;
overflow-y: scroll;
}
.container {
......@@ -865,4 +881,73 @@
color: #959da9;
font-size: 26rpx;
line-height: 44rpx;
}
/* 库存不足 */
.stock-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .6);
}
.stock {
width: 606rpx;
padding: 56rpx 40rpx 40rpx 40rpx;
background: #FFFFFF;
}
.stock-tip {
width: 526rpx;
padding-bottom: 58rpx;
border-bottom: 1px #E2E7EF solid;
}
.stock-tip text {
height: 48rpx;
font-size: 34rpx;
font-weight: 500;
line-height: 48rpx;
color: #15191F;
}
.stock-info {
width: 526rpx;
}
.stock-close {
margin-top: 96rpx;
}
.stock-close > button {
width: 526rpx;
height: 80rpx;
border-radius: 4px;
background: #86C5E1;
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
color: #FFFFFF;
}
.stock-item {
width: 526rpx;
height: 96rpx;
margin-top: 64rpx;
}
.stock-item image {
width: 96rpx;
height: 96rpx;
margin-right: 32rpx;
}
.stock-item text {
font-size: 30rpx;
font-weight: 400;
line-height: 42rpx;
color: #15191F;
}
\ No newline at end of file
const App = getApp()
let logicData = {
pageScrollLock: false,
pageScrollTimer: 0,
}
Page({
data: {
bannerImg: App.globalData.appResourcesBase + 'play/home/type.png',
......@@ -12,6 +7,10 @@ Page({
navigationLogoTop: 0,
navigationLogoMarginTop: 0,
movieList: [],
recentList: [
{
id: 0,
......@@ -61,7 +60,8 @@ Page({
},
onShow: function () {
this.getActivityList(1)
this.queryActivity()
this.queryMovie()
},
/**
......@@ -82,42 +82,22 @@ Page({
},
/**
* 设置标题高度
* 查询主题活动
* @function
* @param
* @returns
*/
onActivity: function () {
wx.navigateTo({
url: '/pages/play/activity/activity'
})
},
onActivityDetail: function (funcItem) {
// console.log(funcItem)
wx.navigateTo({
url: '/pages/activity-detail/activity-detail?id=' + funcItem.currentTarget.dataset.id
})
},
onShopDetail: function (funcItem) {
wx.navigateTo({
url: '/pages/play/service-detail/service-detail?id=' + funcItem.currentTarget.dataset.id
})
},
//主题活动列表 type 1 近期 0 往期
getActivityList(type) {
queryActivity: function () {
var that = this
App.wxRequest({
url: '/api/v1/activity/getList',
data: {
listType: type,
listType: 1,
pageSize: 10,
pageNo: 1,
tagId: '101',
},
success: function (res) {
success: (res) => {
var tmpArr = [];
res.data.list.forEach(item => {
var tmpItem = {
......@@ -131,24 +111,84 @@ Page({
tmpArr.push(tmpItem)
})
// 活动开始时间倒序排序
// tmpArr.sort(function(a,b) {
// return new Date(b.beginDate.replace(/月/g,"\/").replace(/日/g,"\/")) - new Date(a.beginDate.replace(/月/g,"\/").replace(/日/g,"\/"))
// })
this.setData({
banner: tmpArr
})
}
})
},
if (type == 1) {
that.setData({
banner: tmpArr
})
} else {
that.setData({
other: tmpArr
})
/**
* 查询热映电影
* @function
* @param
* @returns
*/
queryMovie: function () {
App.wxRequest({
url: '/api/v1/film/getAllFilm',
data: {
'weekType': 0,
'pageSize': 10,
'pageNo': 1,
},
success: (response) => {
let funcResponse = response.data.list
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'name': funcResponse[i].activityId,
'dateBegin': funcResponse[i].beginDate,
'dateEnd': funcResponse[i].endDate,
'cover': funcResponse[i].cover,
'movieDirector': funcResponse[i].filmDirector,
'movieLeader': funcResponse[i].filmLead,
'movieName': funcResponse[i].filmName,
'movieType': funcResponse[i].filmType,
'movieKeyWord': funcResponse[i].keyword,
'movieLeader': funcResponse[i].filmLead,
'price': funcResponse[i].visitorPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceType': 1,
'tagsId': funcResponse[i].tagIds,
'tags': funcResponse[i].tags,
}
funcList.push(funcItem)
}
this.setData({
movieList: funcList
})
}
})
},
/**
* 设置标题高度
* @function
* @param
* @returns
*/
onActivity: function () {
wx.navigateTo({
url: '/pages/play/activity/activity'
})
},
onActivityDetail: function (funcItem) {
// console.log(funcItem)
wx.navigateTo({
url: '/pages/activity-detail/activity-detail?id=' + funcItem.currentTarget.dataset.id
})
},
onShopDetail: function (funcItem) {
wx.navigateTo({
url: '/pages/play/service-detail/service-detail?id=' + funcItem.currentTarget.dataset.id
})
},
//跳转到艺文
onToArt: function () {
wx.navigateTo({
......@@ -195,8 +235,11 @@ Page({
})
},
onAllActivity: function () {
wx.navigateTo({
url: '/pages/play/activity/activity'
})
},
onAllRecent: function () {
wx.navigateTo({
......
......@@ -17,12 +17,12 @@
<view class="title row con-b align-c">
<image src="./image/title-activity.png">近期活动</image>
<text bindtap="onAllRecent">查看全部</text>
<text bindtap="onAllRecent" bindtap="onAllActivity">查看全部</text>
</view>
<swiper class="recent-swiper" next-margin="38rpx" bindchange="swiperRecentChange">
<block wx:for="{{recentList}}" wx:key="id">
<block wx:for="{{banner}}" wx:key="id">
<swiper-item class="recent-item">
<image class="{{swiperRecentCurrent === index ? 'recent-item-left' : '' }} {{swiperRecentCurrent === recentList.length - 1 ? 'recent-item-center' : ''}}" src="{{item.img}}"></image>
<image class="{{swiperRecentCurrent === index ? 'recent-item-left' : '' }} {{swiperRecentCurrent === banner.length - 1 ? 'recent-item-center' : ''}}" src="{{item.cover}}"></image>
</swiper-item>
</block>
</swiper>
......@@ -36,13 +36,13 @@
<swiper-item class="movie-item col con-e">
<view class="movie-wrapper {{swiperMovieCurrent === index ? 'movie-item-left' : '' }} {{swiperMovieCurrent === movieList.length - 1 ? 'movie-item-center' : ''}}">
<view class="movie-cover">
<image src="{{item.img}}"></image>
<image src="{{item.cover}}"></image>
</view>
<view class="movie-info-wrapper">
<view class="movie-name row">
<text>{{item.name}}</text>
<text>{{item.movieName}}</text>
<view class="movie-dimensional">
<text>{{item.dimensional}}</text>
<text>{{item.movieType}}</text>
</view>
</view>
<view class="movie-info row">
......@@ -50,7 +50,7 @@
<text>类型</text>
</view>
<view class="movie-info-right">
<text>{{item.type}}</text>
<text>{{item.movieType}}</text>
</view>
</view>
<view class="movie-info row">
......@@ -58,7 +58,7 @@
<text>导演</text>
</view>
<view class="movie-info-right">
<text>{{item.director}}</text>
<text>{{item.movieDirector}}</text>
</view>
</view>
<view class="movie-btn">
......
......@@ -190,11 +190,8 @@
}
.movie-info-right {
display: -webkit-box;
margin-left: 8rpx;
color: #656e7b;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
......
......@@ -10,6 +10,7 @@ Page({
data: {
imageBase: App.globalData.appImageBase,
option: {},
// 导航栏相关属性
navigationStyle: {
......@@ -69,8 +70,9 @@ Page({
},
onLoad: function (options) {
options.id = 1
logicData.option = options
this.setData({
option: options
})
this.queryDetail(Number(options.id))
},
......@@ -80,12 +82,12 @@ Page({
* @param {string} - funcToken
* @returns
*/
queryDetail: function (funcIndex) {
funcIndex = funcIndex - 1
queryDetail: function (funcAppId) {
let funcIndex = 0
// 预设数据
let funcDetail = [
{
id: 1,
appId: 1,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-1-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-1-1-2.png',
......@@ -144,7 +146,7 @@ Page({
],
contact: '13316748039'
}, {
id: 2,
appId: 5,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-1-2-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-1-2-2.png',
......@@ -158,7 +160,7 @@ Page({
],
contact: '13316748039'
}, {
id: 3,
appId: 7,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-2-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-2-1-2.png',
......@@ -175,7 +177,7 @@ Page({
],
contact: '13316748039'
}, {
id: 4,
appId: 6,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-3-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-3-1-2.png',
......@@ -195,7 +197,7 @@ Page({
],
contact: '13316748039'
}, {
id: 5,
appId: 4,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-3-2-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-3-2-2.png',
......@@ -209,7 +211,7 @@ Page({
],
contact: '13316748039'
}, {
id: 6,
appId: 2,
banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-4-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-4-1-2.png',
......@@ -228,7 +230,30 @@ Page({
}
]
// 读取预设信息,banner 图片等等
for (let i = 0, l = funcDetail.length; i < l; i++) {
if (funcAppId === funcDetail[i].appId) {
funcIndex = i
break
}
}
console.log(funcIndex)
// 缓存当前商店信息
for (let i = 0, l = App.globalData.shopId.length; i < l; i++) {
if (funcAppId === App.globalData.shopId[i].appId) {
let funcItem = {
'id': 'd9436d7018de43809824b6ec221ea01f',
'appId': 6,
'name': '原味舒食',
'logo': 'shop/logo-6.png',
'cover': 'shop/cover-6.png',
'shopType': ''
}
wx.setStorageSync('shopInfoBuffer', funcItem)
break
}
}
this.setData({
banner: funcDetail[funcIndex].banner,
......@@ -252,9 +277,17 @@ Page({
}
},
queryDetailActivity: function () {
},
queryDetailCommodity: function () {
},
onLocation: function () {
wx.navigateTo({
url: '/pages/home/guide/guide?id=' + Number(logicData.option.id)
url: '/pages/home/guide/guide?id=' + Number(this.data.option.id)
})
},
......
......@@ -25,9 +25,17 @@ let output = {
* @returns
*/
formatAmount: function (funcAmountValue) {
if (funcAmountValue === 0) funcAmountValue = '000'
if (!funcAmountValue && funcAmountValue !== 0) return
console.log(funcAmountValue, funcAmountValue.toString().length)
switch (funcAmountValue.toString().length) {
case 1:
funcAmountValue = '00' + funcAmountValue
break
if (!funcAmountValue) return
case 2:
funcAmountValue = '0' + funcAmountValue
break
}
return funcAmountValue.toString().replace(/([0-9]{2})$/, '.$1')
},
......
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