Commit 9d8c5647 by wjw

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

parents 04d936bd bf533d59
Showing with 1376 additions and 382 deletions
...@@ -14,6 +14,7 @@ App({ ...@@ -14,6 +14,7 @@ App({
appImageBase: '../../../image/', appImageBase: '../../../image/',
appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/', appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/',
shopId: iEnvironmental.shopId, shopId: iEnvironmental.shopId,
pointInfo: iEnvironmental.pointInfo,
payStateTimer: 0, payStateTimer: 0,
...@@ -61,17 +62,20 @@ App({ ...@@ -61,17 +62,20 @@ App({
// console.log("返回:", res); // console.log("返回:", res);
let code = res.data.code * 1; 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) { if (obj.success) {
obj.success(res.data) obj.success(res.data)
} }
} else if (402 == code) { // token失效 } else if (402 == code) { // token失效
this.refreshToken({ this.refreshToken({
success: function () { success: () => {
this.wxRequest(obj) this.wxRequest(obj)
} }
}) })
} else if (500 === code) {
if (obj.success) {
obj.success(res)
}
} else { } else {
if (obj.fail) { if (obj.fail) {
let err = { let err = {
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
"pages/pay/coupon-input/coupon-input", "pages/pay/coupon-input/coupon-input",
"pages/pay/coupon-detail/coupon-detail", "pages/pay/coupon-detail/coupon-detail",
"pages/login/login" "pages/login/login"
], ],
"usingComponents": { "usingComponents": {
"navigation": "./component/navigation/navigation", "navigation": "./component/navigation/navigation",
......
...@@ -4,6 +4,8 @@ Page({ ...@@ -4,6 +4,8 @@ Page({
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
option: {},
phone: '13316748039', phone: '13316748039',
hotline: false, //客服热线 hotline: false, //客服热线
...@@ -13,8 +15,12 @@ Page({ ...@@ -13,8 +15,12 @@ Page({
shopRecommendD: [], // 底部第二商店推荐 shopRecommendD: [], // 底部第二商店推荐
}, },
onLoad: function () { onLoad: function (option) {
this.setData({
option: option
})
// formPage=order&shopAppId=1&commodityType=5
}, },
onShow: function () { onShow: function () {
...@@ -73,8 +79,8 @@ Page({ ...@@ -73,8 +79,8 @@ Page({
'id': funcResponse[i].id, // 商品标识 'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name, 'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面 'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre, 'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
} }
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -100,8 +106,8 @@ Page({ ...@@ -100,8 +106,8 @@ Page({
'id': funcResponse[i].id, // 商品标识 'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name, 'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面 'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre, 'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
} }
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -127,8 +133,8 @@ Page({ ...@@ -127,8 +133,8 @@ Page({
'id': funcResponse[i].id, // 商品标识 'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name, 'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面 'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre, 'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
} }
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -154,8 +160,8 @@ Page({ ...@@ -154,8 +160,8 @@ Page({
'id': funcResponse[i].id, // 商品标识 'id': funcResponse[i].id, // 商品标识
'name': funcResponse[i].name, 'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面 'cover': funcResponse[i].coverImg, // 商品封面
'typeId': funcResponse[i].classifyId, // 商品分类标识
'shopType': funcResponse[i].genre, 'shopType': funcResponse[i].genre,
'sideBarId': funcResponse[i].classifyId, // 商品所属标签
} }
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -209,6 +215,25 @@ Page({ ...@@ -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 * @function
* @param {object} - event * @param {object} - event
...@@ -284,7 +309,7 @@ Page({ ...@@ -284,7 +309,7 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType) this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({ wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks' url: '/pages/commodity/menu-food/menu-food'
}) })
}, },
...@@ -301,7 +326,26 @@ Page({ ...@@ -301,7 +326,26 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType) this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({ 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 @@ ...@@ -23,7 +23,7 @@
</view> </view>
<view class="shop-menu"> <view class="shop-menu">
<block wx:for="{{shopRecommendA}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <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> <image src="{{item.cover}}"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</view> </view>
<view class="shop-menu"> <view class="shop-menu">
<block wx:for="{{shopRecommendB}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <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> <image src="{{item.cover}}"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
...@@ -59,12 +59,15 @@ ...@@ -59,12 +59,15 @@
<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}}" bindtap="onBuyMembership"> <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}}" bindtap="onBuyPassCheck"> <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}}" bindtap="onBuyService"> <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>
...@@ -110,7 +113,7 @@ ...@@ -110,7 +113,7 @@
</view> </view>
<view class="shop-menu"> <view class="shop-menu">
<block wx:for="{{shopRecommendC}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <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> <image src="{{item.cover}}"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
...@@ -126,7 +129,7 @@ ...@@ -126,7 +129,7 @@
</view> </view>
<view class="shop-menu"> <view class="shop-menu">
<block wx:for="{{shopRecommendD}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <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> <image src="{{item.cover}}"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
......
...@@ -5,8 +5,11 @@ Page({ ...@@ -5,8 +5,11 @@ Page({
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {}, animationData: {},
animationPointHeight: 0, animationPointHeight: 0,
animationPointOrigin: 0,
winAnimationPoint: false, winAnimationPoint: false,
...@@ -29,16 +32,22 @@ Page({ ...@@ -29,16 +32,22 @@ Page({
winCommodityDetail: false, winCommodityDetail: false,
}, },
onLoad: function () { onLoad: function (option) {
this.setData({
option: option
})
this.resetShoppingCart()
this.setCartAnimation() this.setCartAnimation()
this.setShopInfo() this.setShopInfo()
this.querySideBar() this.querySideBar()
}, },
onUnload: function () { onShow: function () {
// 离开页面清空商品数据 if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
wx.setStorageSync('shoppingCartBuffer', []) this.resetShoppingCart()
}
}, },
/** /**
...@@ -53,6 +62,15 @@ Page({ ...@@ -53,6 +62,15 @@ Page({
duration: 500, duration: 500,
timingFunction: 'ease' 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({ ...@@ -74,7 +92,7 @@ Page({
winAnimationPoint: true, winAnimationPoint: true,
}) })
let funcTimer = setTimeout(() => { let funcTimer = setTimeout(() => {
this.animation.translate(0, 0).step() this.animation.translate(0, this.data.animationPointOrigin).step()
this.setData({ this.setData({
animationData: this.animation.export(), animationData: this.animation.export(),
// winAnimationPoint: false, // winAnimationPoint: false,
...@@ -88,7 +106,14 @@ Page({ ...@@ -88,7 +106,14 @@ Page({
this.setData({ this.setData({
shopInfo: funcShopInfo shopInfo: funcShopInfo
}) })
console.log(this.data.shopInfo) },
resetShoppingCart: function () {
this.setData({
shoppingCart: [],
shoppingCartTotal: 0,
})
wx.setStorageSync('shoppingCartBuffer', [])
}, },
/** /**
...@@ -115,6 +140,18 @@ Page({ ...@@ -115,6 +140,18 @@ Page({
funcSideBar.push(funcItem) 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({ this.setData({
sideBar: funcSideBar, sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab menuTitle: funcSideBar[0].tab
...@@ -165,10 +202,13 @@ Page({ ...@@ -165,10 +202,13 @@ Page({
'notificationId': funcResponse[i].notificationId, // 下单须知 'notificationId': funcResponse[i].notificationId, // 下单须知
'quantityMin': 1, 'quantityMin': 1,
'quantityMax': funcResponse[i].number, 'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'isActive': true, 'isActive': true,
} }
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型 // 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价 // 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
...@@ -189,6 +229,23 @@ Page({ ...@@ -189,6 +229,23 @@ Page({
winLoading: false, winLoading: false,
commodityList: funcCommodityList, 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,32 +323,46 @@ Page({ ...@@ -266,32 +323,46 @@ Page({
let funcShoppingCart = this.data.shoppingCart let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分 // 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false let funcWinToast = true
let funcItem = event.currentTarget.dataset.item let funcItem = event.currentTarget.dataset.item
if (!funcItem) { if (!funcItem) {
funcWinToast = true funcWinToast = true
funcItem = this.data.commodityDetail funcItem = this.data.commodityDetail
} }
console.log(funcItem)
// 判断购物车中是否存在同类商品 // 判断购物车中是否存在同类商品
// 修改相应的商品数量 // 修改相应的商品数量
if (funcShoppingCart.length !== 0) { if (funcShoppingCart.length !== 0) {
for (let i = 0, l = funcShoppingCart.length; i < l; i++) { for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
if (funcItem.id === funcShoppingCart[i].id) { if (funcItem.id === funcShoppingCart[i].id) {
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1 funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break break
} }
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) { if (i === funcShoppingCart.length - 1) {
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) funcShoppingCart.push(funcItem)
} }
} }
}
} else { } else {
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) funcShoppingCart.push(funcItem)
} }
}
// 重新计算购物车总数 // 重新计算购物车总数
let funcShoppingCartTotal = 0 let funcShoppingCartTotal = 0
...@@ -303,8 +374,11 @@ Page({ ...@@ -303,8 +374,11 @@ Page({
shoppingCart: funcShoppingCart, shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal, shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast, winToast: funcWinToast,
winToastNothing: funcWinToastNothing,
winCommodityDetail: false, winCommodityDetail: false,
}) })
console.log(funcShoppingCart)
}, },
/** /**
......
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
l-image-class="toast-image" l-image-class="toast-image"
l-class="toast-bg" l-class="toast-bg"
show="{{winToast}}" show="{{winToast}}"
mask="{{true}}"
image="/image/success.png" image="/image/success.png"
title="添加购物车成功" title="添加购物车成功"
duration="400"
></l-toast> ></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast <l-toast
show="{{winLoading}}" show="{{winLoading}}"
icon="loading" icon="loading"
...@@ -31,8 +33,8 @@ ...@@ -31,8 +33,8 @@
<view class="menu-list"> <view class="menu-list">
<view class="right-content-title">{{menuTitle}}</view> <view class="right-content-title">{{menuTitle}}</view>
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="commodity-item row"> <view class="commodity-item row" data-item="{{item}}" bind:tap="onCommodityDetail">
<view class="item-img" data-item="{{item}}" bindtap="onCommodityDetail"> <view class="item-img">
<image src="{{item.cover}}" mode="widthFix"></image> <image src="{{item.cover}}" mode="widthFix"></image>
</view> </view>
<view class="item-info"> <view class="item-info">
...@@ -79,7 +81,7 @@ ...@@ -79,7 +81,7 @@
</view> </view>
<view class="item-operation-add"> <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> <image mode="widthFix" src="{{imageBase + 'icon/cart-3.png'}}"></image>
</button> </button>
</view> </view>
...@@ -89,9 +91,9 @@ ...@@ -89,9 +91,9 @@
</block> </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-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap"> <view class="cart-img-wrap">
......
...@@ -13,7 +13,7 @@ page { ...@@ -13,7 +13,7 @@ page {
.side-bar { .side-bar {
width: 160rpx; width: 160rpx;
height: 100vh; height: 100vh;
margin-top: 140rpx; padding-top: 126rpx;
overflow-y: scroll; overflow-y: scroll;
background: #f2f3f5; background: #f2f3f5;
} }
...@@ -58,7 +58,7 @@ page { ...@@ -58,7 +58,7 @@ page {
color: #959da9; color: #959da9;
} }
.cart-btn { .cart {
position: fixed; position: fixed;
right: 48rpx; right: 48rpx;
bottom: 160rpx; bottom: 160rpx;
...@@ -188,6 +188,13 @@ page { ...@@ -188,6 +188,13 @@ page {
height: 24rpx; height: 24rpx;
} }
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap { .goods-add-btn-wrap {
flex: 1; flex: 1;
} }
...@@ -378,9 +385,10 @@ image { ...@@ -378,9 +385,10 @@ image {
/* 购物车样式 */ /* 购物车样式 */
.cart-animation { .cart-animation {
position: fixed; position: fixed;
top: 0;
right: 48rpx; right: 48rpx;
width: 26rpx; width: 26rpx;
height: 26rpx; height: 26rpx;
border-radius: 50%; border-radius: 50%;
background: red; background: #86c5e1;
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ Page({ ...@@ -5,6 +5,8 @@ Page({
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {}, animationData: {},
animationPointHeight: 0, animationPointHeight: 0,
animationPointOrigin: 0, animationPointOrigin: 0,
...@@ -14,6 +16,7 @@ Page({ ...@@ -14,6 +16,7 @@ Page({
shopInfo: {}, shopInfo: {},
sideBar: [], // 侧边菜单 sideBar: [], // 侧边菜单
sideBarTopPadding: 0,
menuTitle: '', // 商品列表标题 menuTitle: '', // 商品列表标题
commodityList: [], // 商品列表 commodityList: [], // 商品列表
commodityDetail: {}, // 商品详情 commodityDetail: {}, // 商品详情
...@@ -30,7 +33,13 @@ Page({ ...@@ -30,7 +33,13 @@ Page({
winCommodityDetail: false, winCommodityDetail: false,
}, },
onLoad: function () { onLoad: function (option) {
this.setData({
option: option
})
this.setSideBarStyle()
this.resetShoppingCart() this.resetShoppingCart()
this.setCartAnimation() this.setCartAnimation()
...@@ -41,9 +50,20 @@ Page({ ...@@ -41,9 +50,20 @@ Page({
onShow: function () { onShow: function () {
if (wx.getStorageSync('shoppingCartBuffer').length === 0) { if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
this.resetShoppingCart() this.resetShoppingCart()
} else {
this.setData({
shoppingCart: wx.getStorageSync('shoppingCartBuffer')
})
this.selectionTotal()
} }
}, },
setSideBarStyle: function () {
this.setData({
sideBarTopPadding: wx.getStorageSync('navigationStatusHeight') + wx.getStorageSync('navigationCapsuleHeight')
})
},
/** /**
* 添加动画初始 * 添加动画初始
* @function * @function
...@@ -61,7 +81,6 @@ Page({ ...@@ -61,7 +81,6 @@ Page({
const funcQuery = wx.createSelectorQuery() const funcQuery = wx.createSelectorQuery()
funcQuery.select('#cart').boundingClientRect() funcQuery.select('#cart').boundingClientRect()
funcQuery.exec((result) => { funcQuery.exec((result) => {
console.log(result)
this.setData({ this.setData({
animationPointOrigin: result[0].top + 4 animationPointOrigin: result[0].top + 4
}) })
...@@ -101,7 +120,6 @@ Page({ ...@@ -101,7 +120,6 @@ Page({
this.setData({ this.setData({
shopInfo: funcShopInfo shopInfo: funcShopInfo
}) })
console.log(this.data.shopInfo)
}, },
resetShoppingCart: function () { resetShoppingCart: function () {
...@@ -136,6 +154,18 @@ Page({ ...@@ -136,6 +154,18 @@ Page({
funcSideBar.push(funcItem) 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({ this.setData({
sideBar: funcSideBar, sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab menuTitle: funcSideBar[0].tab
...@@ -190,6 +220,9 @@ Page({ ...@@ -190,6 +220,9 @@ Page({
'isActive': true, 'isActive': true,
} }
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型 // 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价 // 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
...@@ -211,8 +244,22 @@ Page({ ...@@ -211,8 +244,22 @@ Page({
commodityList: funcCommodityList, 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({ ...@@ -242,7 +289,6 @@ Page({
* @returns * @returns
*/ */
onCommodityDetail: function (event) { onCommodityDetail: function (event) {
console.log('onCommodityDetail', event)
let funcItem = event.currentTarget.dataset.item let funcItem = event.currentTarget.dataset.item
App.wxRequest({ App.wxRequest({
...@@ -291,44 +337,68 @@ Page({ ...@@ -291,44 +337,68 @@ Page({
let funcShoppingCart = this.data.shoppingCart let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分 // 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false let funcWinToast = true
let funcItem = event.currentTarget.dataset.item let funcItem = event.currentTarget.dataset.item
if (!funcItem) { if (!funcItem) {
funcWinToast = true funcWinToast = true
funcItem = this.data.commodityDetail funcItem = this.data.commodityDetail
} }
console.log(funcItem)
// 判断购物车中是否存在同类商品 // 判断购物车中是否存在同类商品
// 修改相应的商品数量 // 修改相应的商品数量
if (funcShoppingCart.length !== 0) { if (funcShoppingCart.length !== 0) {
for (let i = 0, l = funcShoppingCart.length; i < l; i++) { for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
if (funcItem.id === funcShoppingCart[i].id) { if (funcItem.id === funcShoppingCart[i].id) {
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1 funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break break
} }
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) { if (i === funcShoppingCart.length - 1) {
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) funcShoppingCart.push(funcItem)
} }
} }
}
} else { } else {
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) 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 let funcShoppingCartTotal = 0
for (let i = 0, l = funcShoppingCart.length; i < l; i++) { for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
funcShoppingCartTotal = funcShoppingCartTotal + funcShoppingCart[i].quantity funcShoppingCartTotal = funcShoppingCartTotal + funcShoppingCart[i].quantity
} }
this.setData({ this.setData({
shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal, shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast,
winCommodityDetail: false,
}) })
}, },
......
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
l-image-class="toast-image" l-image-class="toast-image"
l-class="toast-bg" l-class="toast-bg"
show="{{winToast}}" show="{{winToast}}"
mask="{{true}}"
image="/image/success.png" image="/image/success.png"
title="添加购物车成功" title="添加购物车成功"
duration="400"
></l-toast> ></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast <l-toast
show="{{winLoading}}" show="{{winLoading}}"
icon="loading" icon="loading"
...@@ -19,7 +21,7 @@ ...@@ -19,7 +21,7 @@
<view class="row"> <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"> <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"> <view class="menu-item {{currentIndex === index ? 'active' : ''}}" data-index="{{index}}" bindtap="onSelectionSideBar">
<text>{{item.tab}}</text> <text>{{item.tab}}</text>
...@@ -91,7 +93,7 @@ ...@@ -91,7 +93,7 @@
<!-- 购物车按钮 --> <!-- 购物车按钮 -->
<view id="cart" class="cart 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-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap"> <view class="cart-img-wrap">
......
...@@ -13,7 +13,6 @@ page { ...@@ -13,7 +13,6 @@ page {
.side-bar { .side-bar {
width: 160rpx; width: 160rpx;
height: 100vh; height: 100vh;
margin-top: 140rpx;
overflow-y: scroll; overflow-y: scroll;
background: #f2f3f5; background: #f2f3f5;
} }
...@@ -188,6 +187,13 @@ page { ...@@ -188,6 +187,13 @@ page {
height: 24rpx; height: 24rpx;
} }
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap { .goods-add-btn-wrap {
flex: 1; flex: 1;
} }
......
...@@ -5,8 +5,11 @@ Page({ ...@@ -5,8 +5,11 @@ Page({
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
option: {},
animationData: {}, animationData: {},
animationPointHeight: 0, animationPointHeight: 0,
animationPointOrigin: 0,
winAnimationPoint: false, winAnimationPoint: false,
...@@ -29,16 +32,22 @@ Page({ ...@@ -29,16 +32,22 @@ Page({
winCommodityDetail: false, winCommodityDetail: false,
}, },
onLoad: function () { onLoad: function (option) {
this.setData({
option: option
})
this.resetShoppingCart()
this.setCartAnimation() this.setCartAnimation()
this.setShopInfo() this.setShopInfo()
this.querySideBar() this.querySideBar()
}, },
onUnload: function () { onShow: function () {
// 离开页面清空商品数据 if (wx.getStorageSync('shoppingCartBuffer').length === 0) {
wx.setStorageSync('shoppingCartBuffer', []) this.resetShoppingCart()
}
}, },
/** /**
...@@ -53,6 +62,15 @@ Page({ ...@@ -53,6 +62,15 @@ Page({
duration: 500, duration: 500,
timingFunction: 'ease' 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({ ...@@ -74,7 +92,7 @@ Page({
winAnimationPoint: true, winAnimationPoint: true,
}) })
let funcTimer = setTimeout(() => { let funcTimer = setTimeout(() => {
this.animation.translate(0, 0).step() this.animation.translate(0, this.data.animationPointOrigin).step()
this.setData({ this.setData({
animationData: this.animation.export(), animationData: this.animation.export(),
// winAnimationPoint: false, // winAnimationPoint: false,
...@@ -88,7 +106,14 @@ Page({ ...@@ -88,7 +106,14 @@ Page({
this.setData({ this.setData({
shopInfo: funcShopInfo shopInfo: funcShopInfo
}) })
console.log(this.data.shopInfo) },
resetShoppingCart: function () {
this.setData({
shoppingCart: [],
shoppingCartTotal: 0,
})
wx.setStorageSync('shoppingCartBuffer', [])
}, },
/** /**
...@@ -115,6 +140,18 @@ Page({ ...@@ -115,6 +140,18 @@ Page({
funcSideBar.push(funcItem) 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({ this.setData({
sideBar: funcSideBar, sideBar: funcSideBar,
menuTitle: funcSideBar[0].tab menuTitle: funcSideBar[0].tab
...@@ -165,10 +202,13 @@ Page({ ...@@ -165,10 +202,13 @@ Page({
'notificationId': funcResponse[i].notificationId, // 下单须知 'notificationId': funcResponse[i].notificationId, // 下单须知
'quantityMin': 1, 'quantityMin': 1,
'quantityMax': funcResponse[i].number, 'quantityMax': funcResponse[i].number < 20 ? funcResponse[i].number : 20, // 最大上限 20 件
'isActive': true, 'isActive': true,
} }
// 没有库存了
if (funcItem.quantityMax === 0) funcItem.isStockMax = true
let funcUserType = wx.getStorageSync('userInfo').userType let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型 // 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价 // 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
...@@ -189,6 +229,23 @@ Page({ ...@@ -189,6 +229,23 @@ Page({
winLoading: false, winLoading: false,
commodityList: funcCommodityList, 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,32 +323,46 @@ Page({ ...@@ -266,32 +323,46 @@ Page({
let funcShoppingCart = this.data.shoppingCart let funcShoppingCart = this.data.shoppingCart
let funcWinToastNothing = false
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分 // 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false let funcWinToast = true
let funcItem = event.currentTarget.dataset.item let funcItem = event.currentTarget.dataset.item
if (!funcItem) { if (!funcItem) {
funcWinToast = true funcWinToast = true
funcItem = this.data.commodityDetail funcItem = this.data.commodityDetail
} }
console.log(funcItem)
// 判断购物车中是否存在同类商品 // 判断购物车中是否存在同类商品
// 修改相应的商品数量 // 修改相应的商品数量
if (funcShoppingCart.length !== 0) { if (funcShoppingCart.length !== 0) {
for (let i = 0, l = funcShoppingCart.length; i < l; i++) { for (let i = 0, l = funcShoppingCart.length; i < l; i++) {
if (funcItem.id === funcShoppingCart[i].id) { if (funcItem.id === funcShoppingCart[i].id) {
if (funcShoppingCart[i].quantity < funcShoppingCart[i].quantityMax) {
funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1 funcShoppingCart[i].quantity = funcShoppingCart[i].quantity + 1
} else {
funcWinToastNothing = true
funcWinToast = false
}
break break
} }
// 当前添加商品不在购物车里的场景
if (i === funcShoppingCart.length - 1) { if (i === funcShoppingCart.length - 1) {
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) funcShoppingCart.push(funcItem)
} }
} }
}
} else { } else {
// 库存要大于零才能添加
if (funcItem.quantityMax > 0) {
funcItem.quantity = 1 funcItem.quantity = 1
funcShoppingCart.push(funcItem) funcShoppingCart.push(funcItem)
} }
}
// 重新计算购物车总数 // 重新计算购物车总数
let funcShoppingCartTotal = 0 let funcShoppingCartTotal = 0
...@@ -303,8 +374,11 @@ Page({ ...@@ -303,8 +374,11 @@ Page({
shoppingCart: funcShoppingCart, shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal, shoppingCartTotal: funcShoppingCartTotal,
winToast: funcWinToast, winToast: funcWinToast,
winToastNothing: funcWinToastNothing,
winCommodityDetail: false, winCommodityDetail: false,
}) })
console.log(funcShoppingCart)
}, },
/** /**
......
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
l-image-class="toast-image" l-image-class="toast-image"
l-class="toast-bg" l-class="toast-bg"
show="{{winToast}}" show="{{winToast}}"
mask="{{true}}"
image="/image/success.png" image="/image/success.png"
title="添加购物车成功" title="添加购物车成功"
duration="400"
></l-toast> ></l-toast>
<l-toast show="{{winToastNothing}}" icon="error" title="没有更多商品了" duration="400"></l-toast>
<l-toast <l-toast
show="{{winLoading}}" show="{{winLoading}}"
icon="loading" icon="loading"
...@@ -31,8 +33,8 @@ ...@@ -31,8 +33,8 @@
<view class="menu-list"> <view class="menu-list">
<view class="right-content-title">{{menuTitle}}</view> <view class="right-content-title">{{menuTitle}}</view>
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="commodity-item row"> <view class="commodity-item row" data-item="{{item}}" bind:tap="onCommodityDetail">
<view class="item-img" data-item="{{item}}" bindtap="onCommodityDetail"> <view class="item-img">
<image src="{{item.cover}}" mode="widthFix"></image> <image src="{{item.cover}}" mode="widthFix"></image>
</view> </view>
<view class="item-info"> <view class="item-info">
...@@ -79,7 +81,7 @@ ...@@ -79,7 +81,7 @@
</view> </view>
<view class="item-operation-add"> <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> <image mode="widthFix" src="{{imageBase + 'icon/cart-3.png'}}"></image>
</button> </button>
</view> </view>
...@@ -89,9 +91,9 @@ ...@@ -89,9 +91,9 @@
</block> </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-num row con-c align-c">{{shoppingCartTotal}}</view>
<view class="cart-img-wrap"> <view class="cart-img-wrap">
......
...@@ -13,7 +13,7 @@ page { ...@@ -13,7 +13,7 @@ page {
.side-bar { .side-bar {
width: 160rpx; width: 160rpx;
height: 100vh; height: 100vh;
margin-top: 140rpx; padding-top: 126rpx;
overflow-y: scroll; overflow-y: scroll;
background: #f2f3f5; background: #f2f3f5;
} }
...@@ -58,7 +58,7 @@ page { ...@@ -58,7 +58,7 @@ page {
color: #959da9; color: #959da9;
} }
.cart-btn { .cart {
position: fixed; position: fixed;
right: 48rpx; right: 48rpx;
bottom: 160rpx; bottom: 160rpx;
...@@ -188,6 +188,13 @@ page { ...@@ -188,6 +188,13 @@ page {
height: 24rpx; height: 24rpx;
} }
.item-operation-add-disable button {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: #999999;
}
.goods-add-btn-wrap { .goods-add-btn-wrap {
flex: 1; flex: 1;
} }
...@@ -378,9 +385,10 @@ image { ...@@ -378,9 +385,10 @@ image {
/* 购物车样式 */ /* 购物车样式 */
.cart-animation { .cart-animation {
position: fixed; position: fixed;
top: 0;
right: 48rpx; right: 48rpx;
width: 26rpx; width: 26rpx;
height: 26rpx; height: 26rpx;
border-radius: 50%; border-radius: 50%;
background: red; background: #86c5e1;
} }
\ No newline at end of file
...@@ -122,7 +122,7 @@ Page({ ...@@ -122,7 +122,7 @@ Page({
for (let i = 0, l = funcResponse.length; i < l; i++) { for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = { let funcItem = {
'id': funcResponse[i].id, // 商品标识 'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].classifyId, // 商品分类标识 'typeId': funcResponse[i].genre, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识 'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name, 'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面 'cover': funcResponse[i].coverImg, // 商品封面
......
...@@ -161,7 +161,7 @@ Page({ ...@@ -161,7 +161,7 @@ Page({
let funcShoppingCart = this.data.shoppingCart let funcShoppingCart = this.data.shoppingCart
if (funcShoppingCart[funcIndex].quantityMax <= funcShoppingCart[funcIndex].quantity) return if (funcShoppingCart[funcIndex].quantityMax <= funcShoppingCart[funcIndex].quantity) return
funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 10 funcShoppingCart[funcIndex].quantity = funcShoppingCart[funcIndex].quantity + 1
this.setData({ this.setData({
shoppingCart: funcShoppingCart shoppingCart: funcShoppingCart
}) })
...@@ -263,6 +263,7 @@ Page({ ...@@ -263,6 +263,7 @@ Page({
// 格式化金额 // 格式化金额
funcAmountDiscount = funcAmountDiscount - funcAmountPay funcAmountDiscount = funcAmountDiscount - funcAmountPay
console.log('funcAmountDiscount', funcAmountDiscount)
funcAmountPay = App.modular.utils.formatAmount(funcAmountPay) funcAmountPay = App.modular.utils.formatAmount(funcAmountPay)
funcAmountDiscount = App.modular.utils.formatAmount(funcAmountDiscount) funcAmountDiscount = App.modular.utils.formatAmount(funcAmountDiscount)
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
.shopping-cart-list { .shopping-cart-list {
width: 750rpx; width: 750rpx;
margin-top: 50rpx; margin-top: 50rpx;
padding-bottom: 200rpx; padding-bottom: 240rpx;
} }
.list-item { .list-item {
......
...@@ -8,6 +8,9 @@ let logicData = { ...@@ -8,6 +8,9 @@ let logicData = {
Page({ Page({
data: { data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
mapCss: '', mapCss: '',
pointDetail: './image/card/01.png', pointDetail: './image/card/01.png',
winPointDetail: false, winPointDetail: false,
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<navigation class="navigation" titleText="智慧导览" backIcon="/image/back.png"></navigation> <navigation class="navigation" titleText="智慧导览" backIcon="/image/back.png"></navigation>
<scroll-view class="guide" scroll-x scroll-left="{{selectionPoint}}"> <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"> <view class="point-map" style="{{mapCss}}" catch:tap="onCancel">
<block wx:for="{{pointInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{pointInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view <view
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</scroll-view> </scroll-view>
<view class="point-detail" hidden="{{!winPointDetail}}" catch:tap="onPointDetail"> <view class="point-detail" hidden="{{!winPointDetail}}" catch:tap="onPointDetail">
<image src="{{pointDetail}}"></image> <image src="{{resourcesBase + pointDetail}}"></image>
</view> </view>
<view class="save-map row con-c align-c" bindtap="onSaveMap"> <view class="save-map row con-c align-c" bindtap="onSaveMap">
......
...@@ -5,7 +5,7 @@ let output = [ ...@@ -5,7 +5,7 @@ let output = [
id: '', id: '',
name: '温泉洋房(建设中)', name: '温泉洋房(建设中)',
icon: './image/icon/01.png', icon: './image/icon/01.png',
card: './image/card/01.png', card: 'guide/card/01.png',
detail: '/pages/play/point-detail/point-detail?id=105', detail: '/pages/play/point-detail/point-detail?id=105',
isActive: false, isActive: false,
}, { }, {
...@@ -14,7 +14,7 @@ let output = [ ...@@ -14,7 +14,7 @@ let output = [
id: '', id: '',
name: '海错图2号馆', name: '海错图2号馆',
icon: './image/icon/02.png', icon: './image/icon/02.png',
card: './image/card/02.png', card: 'guide/card/02.png',
detail: '/pages/play/service-detail/service-detail?id=1', detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false, isActive: false,
}, { }, {
...@@ -23,7 +23,7 @@ let output = [ ...@@ -23,7 +23,7 @@ let output = [
id: 1, id: 1,
name: '海错图1号馆', name: '海错图1号馆',
icon: './image/icon/03.png', icon: './image/icon/03.png',
card: './image/card/03.png', card: 'guide/card/03.png',
detail: '/pages/play/service-detail/service-detail?id=1', detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false, isActive: false,
}, { }, {
...@@ -32,7 +32,7 @@ let output = [ ...@@ -32,7 +32,7 @@ let output = [
id: 4, id: 4,
name: '原味舒食', name: '原味舒食',
icon: './image/icon/04.png', icon: './image/icon/04.png',
card: './image/card/04.png', card: 'guide/card/04.png',
detail: '/pages/play/service-detail/service-detail?id=4', detail: '/pages/play/service-detail/service-detail?id=4',
isActive: false, isActive: false,
}, { }, {
...@@ -41,7 +41,7 @@ let output = [ ...@@ -41,7 +41,7 @@ let output = [
id: 6, id: 6,
name: '星空影院', name: '星空影院',
icon: './image/icon/05.png', icon: './image/icon/05.png',
card: './image/card/05.png', card: 'guide/card/05.png',
detail: '/pages/play/service-detail/service-detail?id=6', detail: '/pages/play/service-detail/service-detail?id=6',
isActive: false, isActive: false,
}, { }, {
...@@ -50,7 +50,7 @@ let output = [ ...@@ -50,7 +50,7 @@ let output = [
id: 3, id: 3,
name: '元养水韵SPA', name: '元养水韵SPA',
icon: './image/icon/06.png', icon: './image/icon/06.png',
card: './image/card/06.png', card: 'guide/card/06.png',
detail: '/pages/play/service-detail/service-detail?id=3', detail: '/pages/play/service-detail/service-detail?id=3',
isActive: false, isActive: false,
}, { }, {
...@@ -59,7 +59,7 @@ let output = [ ...@@ -59,7 +59,7 @@ let output = [
id: 5, id: 5,
name: '原野MOJITO', name: '原野MOJITO',
icon: './image/icon/07.png', icon: './image/icon/07.png',
card: './image/card/07.png', card: 'guide/card/07.png',
detail: '/pages/play/service-detail/service-detail?id=5', detail: '/pages/play/service-detail/service-detail?id=5',
isActive: false, isActive: false,
}, { }, {
...@@ -68,7 +68,7 @@ let output = [ ...@@ -68,7 +68,7 @@ let output = [
id: 2, id: 2,
name: '拾光花坊', name: '拾光花坊',
icon: './image/icon/08.png', icon: './image/icon/08.png',
card: './image/card/08.png', card: 'guide/card/08.png',
detail: '/pages/play/service-detail/service-detail?id=2', detail: '/pages/play/service-detail/service-detail?id=2',
isActive: false, isActive: false,
}, { }, {
...@@ -77,7 +77,7 @@ let output = [ ...@@ -77,7 +77,7 @@ let output = [
id: '', id: '',
name: '星光广场', name: '星光广场',
icon: './image/icon/09.png', icon: './image/icon/09.png',
card: './image/card/09.png', card: 'guide/card/09.png',
detail: '/pages/play/point-detail/point-detail?id=101', detail: '/pages/play/point-detail/point-detail?id=101',
isActive: false, isActive: false,
}, { }, {
...@@ -86,7 +86,7 @@ let output = [ ...@@ -86,7 +86,7 @@ let output = [
id: '', id: '',
name: '云之亭', name: '云之亭',
icon: './image/icon/10.png', icon: './image/icon/10.png',
card: './image/card/10.png', card: 'guide/card/10.png',
detail: '/pages/play/point-detail/point-detail?id=102', detail: '/pages/play/point-detail/point-detail?id=102',
isActive: false, isActive: false,
}, { }, {
...@@ -95,7 +95,7 @@ let output = [ ...@@ -95,7 +95,7 @@ let output = [
id: '', id: '',
name: '湿地公园', name: '湿地公园',
icon: './image/icon/11.png', icon: './image/icon/11.png',
card: './image/card/11.png', card: 'guide/card/11.png',
detail: '/pages/play/point-detail/point-detail?id=103', detail: '/pages/play/point-detail/point-detail?id=103',
isActive: false, isActive: false,
}, { }, {
...@@ -104,7 +104,7 @@ let output = [ ...@@ -104,7 +104,7 @@ let output = [
id: '', id: '',
name: '新月码头', name: '新月码头',
icon: './image/icon/12.png', icon: './image/icon/12.png',
card: './image/card/12.png', card: 'guide/card/12.png',
detail: '/pages/play/point-detail/point-detail?id=104', detail: '/pages/play/point-detail/point-detail?id=104',
isActive: false, isActive: false,
}, { }, {
...@@ -113,7 +113,7 @@ let output = [ ...@@ -113,7 +113,7 @@ let output = [
id: '', id: '',
name: '儿童营地', name: '儿童营地',
icon: './image/icon/13.png', icon: './image/icon/13.png',
card: './image/card/13.png', card: 'guide/card/13.png',
detail: '/pages/campsite/home-mirror/home-mirror', detail: '/pages/campsite/home-mirror/home-mirror',
isActive: false, isActive: false,
}, { }, {
...@@ -122,7 +122,7 @@ let output = [ ...@@ -122,7 +122,7 @@ let output = [
id: '', id: '',
name: '星耀银湖', name: '星耀银湖',
icon: './image/icon/14.png', icon: './image/icon/14.png',
card: './image/card/14.png', card: 'guide/card/14.png',
detail: '/pages/play/point-detail/point-detail?id=106', detail: '/pages/play/point-detail/point-detail?id=106',
isActive: false, isActive: false,
}, { }, {
...@@ -131,7 +131,7 @@ let output = [ ...@@ -131,7 +131,7 @@ let output = [
id: '', id: '',
name: '奇幻森林', name: '奇幻森林',
icon: './image/icon/15.png', icon: './image/icon/15.png',
card: './image/card/15.png', card: 'guide/card/15.png',
detail: '/pages/play/point-detail/point-detail?id=107', detail: '/pages/play/point-detail/point-detail?id=107',
isActive: false, isActive: false,
}, },
......
...@@ -33,7 +33,7 @@ Page({ ...@@ -33,7 +33,7 @@ Page({
// 右上角消息 // 右上角消息
passBadge: 0, passBadge: 0,
foodBadge: 22 , foodBadge: 22,
movieBadge: 1, movieBadge: 1,
spaBadge: 0, spaBadge: 0,
artBadge: 101, artBadge: 101,
...@@ -41,8 +41,7 @@ Page({ ...@@ -41,8 +41,7 @@ Page({
showMoreOrder: false, // 查看更多订单 showMoreOrder: false, // 查看更多订单
showMoreActivity: false, // 查看更多活动 showMoreActivity: false, // 查看更多活动
myOrder: { myOrder: {
passOrder: [ passOrder: [{
{
id: 0, id: 0,
logo: '', logo: '',
store: '儿童营地', store: '儿童营地',
...@@ -63,26 +62,22 @@ Page({ ...@@ -63,26 +62,22 @@ Page({
], ],
artOrder: { artOrder: {
logo: '', logo: '',
orderList: [ orderList: [{
{
id: 0, id: 0,
store: '海错图展馆', store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png', cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票', title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30', time: '有效期至 2020.09.30',
quantity: '共1张门票' quantity: '共1张门票'
}, }, ]
]
} }
}, },
appointmentList: [ appointmentList: [{
{
time: '8月15日-7月15日 10:00-12:00', time: '8月15日-7月15日 10:00-12:00',
img: '', img: '',
title: '日落观光游船体验活动之船行碧波共赏美景', title: '日落观光游船体验活动之船行碧波共赏美景',
num: 3 num: 3
} }]
]
}, },
close() { close() {
...@@ -111,7 +106,12 @@ Page({ ...@@ -111,7 +106,12 @@ Page({
onShow: function () { onShow: function () {
this.setUserInfo() this.setUserInfo()
}, },
// 去核销
goCouponInput(event) {
wx.navigateTo({
url: '/pages/pay/coupon-input/coupon-input',
})
},
setUserInfo: function () { setUserInfo: function () {
let funcUserInfo = wx.getStorageSync('userInfo') let funcUserInfo = wx.getStorageSync('userInfo')
...@@ -214,7 +214,11 @@ Page({ ...@@ -214,7 +214,11 @@ Page({
var that = this var that = this
App.wxRequest({ App.wxRequest({
url: '/api/v1/activity/getMyActivityList', url: '/api/v1/activity/getMyActivityList',
data: { activeState: '0,1', pageSize: 10, pageNo: 1 }, data: {
activeState: '0,1',
pageSize: 10,
pageNo: 1
},
success: function (res) { success: function (res) {
let list = res.data.list let list = res.data.list
let tmpArr = [] let tmpArr = []
...@@ -222,12 +226,18 @@ Page({ ...@@ -222,12 +226,18 @@ Page({
let state = item.activeState * 1 let state = item.activeState * 1
let type = 0 let type = 0
switch (state) { switch (state) {
case 0: type = 1; break; case 0:
case 1: type = 0; break; type = 1;
case 2: type = 2; break; break;
case 1:
type = 0;
break;
case 2:
type = 2;
break;
} }
let obj = { let obj = {
time: item.enrollDate,//activeDate + ' ' + item.activeTime, time: item.enrollDate, //activeDate + ' ' + item.activeTime,
type: type, type: type,
content: item.address, content: item.address,
title: item.name, title: item.name,
...@@ -249,7 +259,7 @@ Page({ ...@@ -249,7 +259,7 @@ Page({
url: '/api/v1/subscribe/getList', url: '/api/v1/subscribe/getList',
data: { data: {
state: '1', state: '1',
type: ''//0 入园预约 1 看房预约 全部 空字符 type: '' //0 入园预约 1 看房预约 全部 空字符
}, },
success: function (res) { success: function (res) {
let tmpArr = [] let tmpArr = []
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</view> </view>
</view> </view>
<view class="coupon row align-c"> <view class="coupon row align-c" bindtap="goCouponInput">
<view class="cpopon-info col"> <view class="cpopon-info col">
<text>券码核销</text> <text>券码核销</text>
<text>所属门店:拾光花坊</text> <text>所属门店:拾光花坊</text>
......
...@@ -4,26 +4,34 @@ Page({ ...@@ -4,26 +4,34 @@ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
orderTypeTitle: '全部分类', orderTypeTitle: '全部分类',
orderTypeHeight: 0, orderTypeHeight: 0,
orderType: [], orderType: [],
orderTypeActive: 0, orderTypeActive: 0,
isDoing: false,
statusList: [ statusList: [{
{ 'value': '', 'name': '全部' }, 'value': '',
{ 'value': '0', 'name': '待付款' }, 'name': '全部'
{ 'value': '1', 'name': '待使用' }, },
{ 'value': '-1, 4', 'name': '取消/过期' }, {
'value': '0',
'name': '待付款'
},
{
'value': '1',
'name': '待使用'
},
{
'value': '-1, 4',
'name': '取消/过期'
},
], ],
statusActive: 0, statusActive: 0,
orderList: [], orderList: [],
orderPages: 1, orderPages: 1,
winOrderType: false, winOrderType: false,
isLoading: false,
isFinished: false
}, },
onLoad: function (options) { onLoad: function (options) {
this.setOrderType() this.setOrderType()
...@@ -36,9 +44,21 @@ Page({ ...@@ -36,9 +44,21 @@ Page({
* @returns * @returns
*/ */
queryOrder: function () { queryOrder: function () {
// 数据全部加载完成不再执行
console.log(this.data.isFinished, '-----------------------------------this.data.isFinished');
if (this.data.isFinished) return
let that = this;
let funcName = this.data.orderType[this.data.orderTypeActive].value let funcName = this.data.orderType[this.data.orderTypeActive].value
let funcValue = this.data.statusList[this.data.statusActive].value let funcValue = this.data.statusList[this.data.statusActive].value
this.setData({
isLoading: true
})
wx.showLoading({
title: '加载中',
})
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/getOrderList', url: '/api/v1/order/getOrderList',
data: { data: {
...@@ -48,7 +68,13 @@ Page({ ...@@ -48,7 +68,13 @@ Page({
'pageNo': this.data.orderPages, 'pageNo': this.data.orderPages,
}, },
success: (response) => { success: (response) => {
wx.hideLoading()
let funcResponse = response.data let funcResponse = response.data
if (funcResponse.length < 10) {
that.setData({
isFinished: true
})
}
let funcList = [] let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) { for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = { let funcItem = {
...@@ -61,6 +87,7 @@ Page({ ...@@ -61,6 +87,7 @@ Page({
'status': Number(funcResponse[i].status), 'status': Number(funcResponse[i].status),
'amount': funcResponse[i].totalMoney, 'amount': funcResponse[i].totalMoney,
'commodity': [], 'commodity': [],
'wxRequest': funcResponse[i].wxRequest
} }
// 添加订单商品列表 // 添加订单商品列表
...@@ -92,8 +119,11 @@ Page({ ...@@ -92,8 +119,11 @@ Page({
this.setData({ this.setData({
orderList: this.data.orderList.concat(funcList) orderList: this.data.orderList.concat(funcList)
}) })
that.setData({
isLoading: false
})
console.log(this.data.orderList)
} }
}) })
}, },
...@@ -113,7 +143,10 @@ Page({ ...@@ -113,7 +143,10 @@ Page({
success: (response) => { success: (response) => {
console.log(response) console.log(response)
let funcResponse = response.data let funcResponse = response.data
let funcList = [{ 'value': '', 'name': '全部分类' }] let funcList = [{
'value': '',
'name': '全部分类'
}]
for (let i = 0, l = funcResponse.length; i < l; i++) { for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = { let funcItem = {
'value': funcResponse[i].value, 'value': funcResponse[i].value,
...@@ -152,12 +185,23 @@ Page({ ...@@ -152,12 +185,23 @@ Page({
'orderTypeActive': funcIndex, 'orderTypeActive': funcIndex,
'orderPages': 1, 'orderPages': 1,
'orderList': [], 'orderList': [],
'isFinished': false
}) })
this.queryOrder() this.queryOrder()
}, },
/** /**
* 去逛逛
* @function
* @param {object} - event
* @returns
*/
onToBuy: function (event) {
this.onOrderAgain(event)
},
/**
* 订单状态 * 订单状态
* @function * @function
* @param {object} - event * @param {object} - event
...@@ -165,6 +209,7 @@ Page({ ...@@ -165,6 +209,7 @@ Page({
*/ */
onSelectionStatus: function (event) { onSelectionStatus: function (event) {
this.setData({ this.setData({
'isFinished': false,
'statusActive': Number(event.currentTarget.dataset.type), 'statusActive': Number(event.currentTarget.dataset.type),
'orderPages': 1, 'orderPages': 1,
'orderList': [], 'orderList': [],
...@@ -209,7 +254,21 @@ Page({ ...@@ -209,7 +254,21 @@ Page({
* @returns * @returns
*/ */
onOrderCancel: function (event) { onOrderCancel: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item let funcItem = event.target.dataset.item
// let index = event.target.dataset.index
// // 无刷新更新数据
// let status = `orderList[${index}].status`
// this.setData({
// [status]:-1
// })
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/cancelOrder', url: '/api/v1/order/cancelOrder',
data: { data: {
...@@ -217,14 +276,19 @@ Page({ ...@@ -217,14 +276,19 @@ Page({
'type': 0, 'type': 0,
}, },
success: (response) => { success: (response) => {
console.log(response) wx.hideLoading()
} that.setData({
isDoing: false
}) })
this.setData({
that.setData({
'orderList': [], 'orderList': [],
'orderPages': 1, 'orderPages': 1,
}) })
this.queryOrder() that.queryOrder()
}
})
}, },
/** /**
...@@ -234,6 +298,14 @@ Page({ ...@@ -234,6 +298,14 @@ Page({
* @returns * @returns
*/ */
onOrderRemove: function (event) { onOrderRemove: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item let funcItem = event.target.dataset.item
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/cancelOrder', url: '/api/v1/order/cancelOrder',
...@@ -242,14 +314,48 @@ Page({ ...@@ -242,14 +314,48 @@ Page({
'type': 1, 'type': 1,
}, },
success: (response) => { success: (response) => {
console.log(response) wx.hideLoading()
} that.setData({
}) isDoing: false,
this.setData({
'orderList': [], 'orderList': [],
'orderPages': 1, 'orderPages': 1,
}) })
this.queryOrder() that.queryOrder()
console.log(response)
}
})
},
/**
* 检验数据是否都通过
* @function
* @param
* @returns
*/
inspectData: function () {
let funcPass = true
// 校验数组用户信息
let funcRegisterInfo = this.data.registerInfo
for (let i = 0, l = funcRegisterInfo.length; i < l; i++) {
if (funcRegisterInfo[i].name === '' || funcRegisterInfo[i].errorName !== '') {
this.setUserInfo('name', funcRegisterInfo[i].name, i, App.modular.rule.item('name', funcRegisterInfo[i].name))
funcPass = false
}
if (funcRegisterInfo[i].phone === '' || funcRegisterInfo[i].errorPhone !== '') {
this.setUserInfo('phone', funcRegisterInfo[i].phone, i, App.modular.rule.item('phone', funcRegisterInfo[i].phone))
funcPass = false
}
// 仅在需要的订单场景下校验
if ([1].indexOf(this.data.orderType) >= 0) {
if (funcRegisterInfo[i].identity === '' || funcRegisterInfo[i].errorIdentity !== '') {
this.setUserInfo('identity', funcRegisterInfo[i].identity, i, App.modular.rule.item('identity', funcRegisterInfo[i].identity))
funcPass = false
}
}
}
return funcPass
}, },
/** /**
...@@ -258,7 +364,34 @@ Page({ ...@@ -258,7 +364,34 @@ Page({
* @param * @param
* @returns * @returns
*/ */
onOrderPay: function (event) { onOrderPay: function (event) {
// 数据校验不通过
let that = this
let funcItem = event.currentTarget.dataset.item
let wxRequest = funcItem.wxRequest
// 待支付返回的wx支付参数
if (wxRequest) {
wx.requestPayment({
timeStamp: wxRequest.timeStamp,
nonceStr: wxRequest.nonceStr,
package: wxRequest.package,
signType: wxRequest.signType,
paySign: wxRequest.paySign,
success(res) {
that.setData({
'orderList': [],
'orderPages': 1,
})
that.queryOrder()
},
fail(res) {}
})
}
}, },
...@@ -269,7 +402,7 @@ Page({ ...@@ -269,7 +402,7 @@ Page({
* @returns * @returns
*/ */
onOrderUse: function (event) { onOrderUse: function (event) {
this.onOrderDetail() this.onOrderDetail(event)
}, },
/** /**
...@@ -279,17 +412,53 @@ Page({ ...@@ -279,17 +412,53 @@ Page({
* @returns * @returns
*/ */
onOrderEvaluate: function (event) { onOrderEvaluate: function (event) {
console.log(event.currentTarget.dataset, '----------------event.currentTarget.dataset');
let item = JSON.stringify(event.currentTarget.dataset.item)
wx.navigateTo({
url: `/pages/pay/order-comment/order-comment?orderItem=${item}`,
})
},
/**
* 缓存用户信息
* @function
* @param {object} - event
* @returns
*/
setShopInfo: function (funcShopAppId, funcShopType) {
// 获取门店基本信息
let funcShopId = App.globalData.shopId
for (let i = 0, l = funcShopId.length; i < l; i++) {
if (funcShopAppId === funcShopId[i].appId) {
let funcShopInfo = {
'id': funcShopId[i].id,
'appId': funcShopId[i].appId,
'name': funcShopId[i].title[funcShopType],
'logo': funcShopId[i].logo,
'cover': funcShopId[i].cover,
'shopType': funcShopType,
}
wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break
}
}
}, },
/** /**
* 订单再次下单 * 订单再次下单、去逛逛
* @function * @function
* @param * @param
* @returns * @returns
*/ */
onOrderAgain: function (event) { onOrderAgain: function (event) {
let item = event.currentTarget.dataset.item
let commodityType = item.goodType
let shopAppId = wx.getStorageSync('shopInfoBuffer') ? wx.getStorageSync('shopInfoBuffer').appId : ""
wx.navigateTo({
url: `/pages/commodity/menu-food/menu-food?formPage=order&shopAppId=${shopAppId}&commodityType=${commodityType}`,
})
}, },
/** /**
...@@ -299,6 +468,7 @@ Page({ ...@@ -299,6 +468,7 @@ Page({
* @returns * @returns
*/ */
onReachBottom: function () { onReachBottom: function () {
this.setData({ this.setData({
orderPages: this.data.orderPages + 1 orderPages: this.data.orderPages + 1
}) })
......
...@@ -13,39 +13,21 @@ ...@@ -13,39 +13,21 @@
<view> <view>
<view class="order-type-row row con-b align-c"> <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"> <block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view <view wx:if="{{index < 3}}" class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="onOrderTypeSelection">
wx:if="{{index < 3}}"
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> <text>{{item.name}}</text>
</view> </view>
</block> </block>
</view> </view>
<view class="order-type-row row con-b align-c"> <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"> <block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view <view wx:if="{{3 <= index && index < 6}}" class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="onOrderTypeSelection">
wx:if="{{3 <= index && index < 6}}"
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> <text>{{item.name}}</text>
</view> </view>
</block> </block>
</view> </view>
<view class="order-type-row row con-b align-c"> <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"> <block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view <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">
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> <text>{{item.name}}</text>
</view> </view>
</block> </block>
...@@ -55,14 +37,14 @@ ...@@ -55,14 +37,14 @@
<!-- 订单列表 --> <!-- 订单列表 -->
<view class="container-order"> <view class="container-order">
<view class="status row con-b align-c"> <view class="status row con-b align-c fixed-tab">
<block wx:for="{{statusList}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{statusList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="status-item row con-c align-c {{index === statusActive ? 'status-item-active' : ''}}" data-type="{{index}}" bindtap="onSelectionStatus"> <view class="status-item row con-c align-c {{index === statusActive ? 'status-item-active' : ''}}" data-type="{{index}}" bindtap="onSelectionStatus">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
</block> </block>
</view> </view>
<block wx:if="{{orderList.length>0}}">
<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" data-item="{{item}}" bindtap="onOrderDetail"> <view class="order-list-item col align-c" data-item="{{item}}" bindtap="onOrderDetail">
...@@ -99,20 +81,32 @@ ...@@ -99,20 +81,32 @@
<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">¥{{item.amount}}</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" data-item="{{item}}" catchtap="onOrderCancel">取消订单</button> <button wx:if="{{item.status === 0}}" class="delete row con-c align-c" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button>
<button wx:if="{{item.status === -1 || item.status === 4}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button> <button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 4}}" 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" data-item="{{item}}" catchtap="onOrderPay">去支付</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 0}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button> <button disabled="{{isDoing}}" wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view>
</view> </view>
</view> </view>
</block>
</view> </view>
</block> </block>
<block wx:else>
<view class="empty col con-c align-c" wx:if="{{!isLoading}}">
<image class="empty-cart" src=""></image>
<view class="empty-title">
<text>{{ statusActive!=0? '暂无相关订单':'暂无订单'}}</text>
</view> </view>
<view class="empty-btn" bindtap="onToBuy" wx:if="{{statusActive===0}}">
<text>去逛逛</text>
</view>
</view>
</block>
</view> </view>
<!-- 二维码弹窗 --> <!-- 二维码弹窗 -->
......
...@@ -2,6 +2,14 @@ page { ...@@ -2,6 +2,14 @@ page {
height: 100%; height: 100%;
} }
.fixed-tab {
position: fixed;
background: #fff;
top: 176rpx;
z-index: 99;
}
.navigation-order { .navigation-order {
z-index: 1700; z-index: 1700;
position: fixed; position: fixed;
...@@ -45,7 +53,7 @@ page { ...@@ -45,7 +53,7 @@ page {
background: rgba(0, 0, 0, .65); background: rgba(0, 0, 0, .65);
} }
.order-type-selection > view { .order-type-selection>view {
width: 750rpx; width: 750rpx;
min-height: 240rpx; min-height: 240rpx;
padding-top: 10rpx; padding-top: 10rpx;
...@@ -77,7 +85,9 @@ page { ...@@ -77,7 +85,9 @@ page {
} }
.container-order { .container-order {
margin-top: 170rpx; /* margin-top: 170rpx; */
margin-top: 288rpx;
} }
.container { .container {
...@@ -124,7 +134,7 @@ page { ...@@ -124,7 +134,7 @@ page {
background: #FFFFFF; background: #FFFFFF;
} }
.order-list-item > view { .order-list-item>view {
width: 610rpx; width: 610rpx;
} }
...@@ -242,7 +252,7 @@ page { ...@@ -242,7 +252,7 @@ page {
margin-top: 56rpx; margin-top: 56rpx;
} }
.code-info-qrcode > image { .code-info-qrcode>image {
display: block; display: block;
width: 296rpx; width: 296rpx;
height: 296rpx; height: 296rpx;
...@@ -297,7 +307,34 @@ page { ...@@ -297,7 +307,34 @@ page {
background: #A9A8A7; background: #A9A8A7;
} }
.code-close > image { .code-close>image {
width: 48rpx; width: 48rpx;
height: 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({ Page({
data: { data: {
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
couponInfo: { couponInfo: null,
type: '套票', // {
store: '儿童营地', // type: '套票',
id: '26719921231', // store: '儿童营地',
useTime: '2020-11-06' // 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,
}, },
goodsList: [ onLoad: function (options) {
{ console.log(options)
id: 0, // if (options.type) options.type = Number(options.type)
cover: '', // let orderType = options.type
name: '咖喱蔬菜大虾', // this.setData({
quantity: '2', // orderType
price: '30.60' // })
// 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,
})
}
}, },
{
id: 1, // 取消核销
cover: '', cancelOperation() {
name: '南瓜坚果汤', wx.navigateBack()
quantity: '3',
price: '30.60'
}, },
],
orderInfo: { // 确认核销'
name: '林有一', submitOperation() {
phone: '15802035122', let that = this
idNum: '350600366462131', wx.lin.showDialog({
type:"confirm",
title:"",
content:"是否确认核销券码" ,
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
that.doVolume()
} else if (res.cancel) {
console.log('用户点击取消')
}
} }
})
}, },
onLoad: function (options) {
console.log(options) doVolume() {
if (options.type) options.type = Number(options.type) let that = this
let orderType = options.type wx.lin.showToast({
this.setData({ icon: 'loading',
orderType 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: '核销成功',
}) })
this.setView() setTimeout(()=>{
wx.navigateBack()
},2000);
}, },
setView() { fail: function(err) {
let orderType = this.data.orderType wx.lin.showToast({
switch (orderType) { image: '/image/error.png',
case 4: title: err.msg,
this.setData({ })
goodsList: [
{
cover: '',
name: '《海错图》超级豪华精致古风限量版折扇',
quantity: '1',
price: '30.60'
} }
],
note: '身份证号变更为350600366462132'
}) })
break
case 5:
break
} }
},
}) })
\ No newline at end of file
<navigation class="navigation" titleText="券码核销" background="#ffffff" backIcon="/image/back.png"></navigation> <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="container">
<view class="list-wrapper"> <view class="list-wrapper">
<view class="title-wrapper">兑换券信息</view> <view class="title-wrapper">兑换券信息</view>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<view class="goods-list"> <view class="goods-list">
<view class="goods-item row align-c" wx:for="{{goodsList}}" wx:key="id"> <view class="goods-item row align-c" wx:for="{{goodsList}}" wx:key="id">
<view class="goods-img"> <view class="goods-img">
<image mode="widthFix" src="{{item.cover}}"></image> <image mode="aspectFill" src="{{item.cover}}"></image>
</view> </view>
<view class="goods-name">{{item.name}}</view> <view class="goods-name">{{item.name}}</view>
<view class="goods-price-num col"> <view class="goods-price-num col">
...@@ -38,47 +39,32 @@ ...@@ -38,47 +39,32 @@
</view> </view>
</view> </view>
</view> </view>
<view class="list-wrapper"> <view class="list-wrapper" wx:for="{{userList}}" wx:key="index">
<view class="title-wrapper">订单详情</view> <view class="title-wrapper">订单详情</view>
<view class="info-wrapper row con-b"> <view class="info-wrapper row con-b">
<view class="info-name">姓名</view> <view class="info-name">姓名</view>
<view class="info-text">{{orderInfo.name}}</view> <view class="info-text">{{item.name}}</view>
</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-name">手机</view>
<view class="info-text">{{orderInfo.phone}}</view> <view class="info-text">{{item.phone}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view>
</view>
</view> </view>
<view class="list-wrapper"> <view class="info-wrapper row con-b" wx:if="{{item.idNum}}">
<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-name">身份证</view> <view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view> <view class="info-text">{{item.idNum}}</view>
</view> </view>
</view> </view>
<view class="list-wrapper" wx:if="{{note}}"> <view class="list-wrapper" wx:if="{{remarks}}">
<view class="title-wrapper">备注</view> <view class="title-wrapper">备注</view>
<view class="info-wrapper row con-b"> <view class="info-wrapper row con-b">
<view class="info-name">{{note}}</view> <view class="info-name">{{remarks}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="footer-wrapper"> <view class="footer-wrapper">
<view class="footer-btn row con-b align-e"> <view class="footer-btn row con-b align-e">
<view class="cancel-btn">取消核销</view> <view class="cancel-btn" bindtap="cancelOperation">取消核销</view>
<view class="confirm-btn">确认核销</view> <view class="confirm-btn" bindtap="submitOperation">确认核销</view>
</view> </view>
<Blank></Blank> <Blank></Blank>
</view> </view>
.container { .container {
margin-top: 120rpx; margin-top: 150rpx;
padding-bottom: 196rpx; padding-bottom: 196rpx;
} }
.list-wrapper { .list-wrapper {
......
const App = getApp()
Page({ Page({
data: { data: {
avatarUrl: '/pages/mine/home/image/avatar.png', avatarUrl: '/pages/mine/home/image/avatar.png',
showDialog: false showDialog: false,
showDialogSmg: '非本店券码,无法使用',
couponCode: '',
}, },
onLoad: function (options) { onLoad: function (options) {
}, },
handleWriteOff() { handleWriteOff() {
let showDialog = true this.getVolumeDetails(this.data.couponCode)
},
//券码输入
bindCouponInput(e) {
this.setData({ this.setData({
showDialog couponCode: e.detail.value
}) })
}, },
// 扫码
handleScanCode() { handleScanCode() {
let that = this
wx.scanCode({ wx.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
success: (res) => { success: (res) => {
console.log(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
})
} }
}) })
} }
......
<navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation> <navigation class="navigation" titleText="券码核销" backIcon="/image/back.png"></navigation>
<l-toast l-image-class="toast-image"></l-toast>
<view class="container"> <view class="container">
<!-- 头像信息 --> <!-- 头像信息 -->
<view class="header col align-c"> <view class="header col align-c">
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
</view> </view>
<!-- 核销输入框 --> <!-- 核销输入框 -->
<view class="coupon-input-wrapper row con-b"> <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> <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="非本店券码,无法使用"> <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> <!-- <view class="dialog-content">所属门店:原味舒食</view> -->
</l-dialog> </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> </view>
<!-- 扫码核销 --> <!-- 扫码核销 -->
......
...@@ -12,25 +12,19 @@ Page({ ...@@ -12,25 +12,19 @@ Page({
content: '', // 评价内容, content: '', // 评价内容,
imgUrls: [], // 评价图片本地路径 imgUrls: [], // 评价图片本地路径
orderInfo: { orderInfo: {
orderId: '02aaa9a62d5645c59109218c27d2174a', id: '',
name: '精灵鸟理想国年卡', name: '',
price: '1680.00', amount: '',
quantity: 4, commodity: []
coverList: [
{
id: 0,
imgUrl: ''
}, },
{
id: 1,
imgUrl: ''
},
{
id: 2,
imgUrl: ''
}
]
}, },
onLoad: function (options) {
console.log(options, '----------options------');
let orderItem = JSON.parse(options.orderItem)
this.setData({
orderInfo: orderItem
})
}, },
/** /**
...@@ -41,9 +35,16 @@ Page({ ...@@ -41,9 +35,16 @@ Page({
*/ */
onChangeScore: function (event) { onChangeScore: function (event) {
// type 1: 服务评价 2: 产品评价 3: 环境评价 // type 1: 服务评价 2: 产品评价 3: 环境评价
const { index, type } = event.currentTarget.dataset const {
index,
type
} = event.currentTarget.dataset
console.log(index, type) console.log(index, type)
let { scoreServe, scoreProduct, scoreEnvironment } = this.data let {
scoreServe,
scoreProduct,
scoreEnvironment
} = this.data
switch (type) { switch (type) {
case 1: case 1:
scoreServe = index + 1 scoreServe = index + 1
...@@ -130,7 +131,7 @@ Page({ ...@@ -130,7 +131,7 @@ Page({
// fileUrls // fileUrls
// }) // })
let formData = {} let formData = {}
formData.orderId = this.data.orderInfo.orderId formData.orderId = this.data.orderInfo.id
formData.imgUrls = fileUrls, formData.imgUrls = fileUrls,
formData.serviceEvaluation = this.data.scoreServeText formData.serviceEvaluation = this.data.scoreServeText
formData.productEvaluation = this.data.scoreProductText formData.productEvaluation = this.data.scoreProductText
...@@ -149,6 +150,9 @@ Page({ ...@@ -149,6 +150,9 @@ Page({
}, },
success: (response) => { success: (response) => {
console.log(response) console.log(response)
wx.navigateBack({
delta: 0,
})
} }
}) })
} }
......
...@@ -6,22 +6,22 @@ ...@@ -6,22 +6,22 @@
<text>购买商品</text> <text>购买商品</text>
</view> </view>
<view class="row align-c"> <view class="row align-c">
<block wx:for="{{orderInfo.coverList}}" wx:key="id"> <block wx:for="{{orderInfo.commodity}}" wx:key="id">
<view class="order-cover"> <view class="order-cover">
<image src="{{item.imgUrl}}"></image> <image src="{{item.cover}}"></image>
</view> </view>
</block> </block>
<view class="order-name" wx:if="{{orderInfo.coverList.length === 1}}"> <view class="order-name" wx:if="{{orderInfo.commodity.length === 1}}">
<text>{{orderInfo.name}}</text> <text>{{orderInfo.name}}</text>
</view> </view>
<view class="order-price-wrapper col align-e"> <view class="order-price-wrapper col align-e">
<view class="order-price"> <view class="order-price">
<text class="price-symbol">¥</text> <text class="price-symbol">¥</text>
<text>{{orderInfo.price}}</text> <text>{{orderInfo.amount}}</text>
</view> </view>
<view class="order-quantity"> <view class="order-quantity">
<text>{{'共' + orderInfo.quantity + '件'}}</text> <text>{{'共' + orderInfo.commodity.length + '件'}}</text>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -142,6 +142,7 @@ ...@@ -142,6 +142,7 @@
padding: 30rpx 40rpx 0; padding: 30rpx 40rpx 0;
background-color: #fff; background-color: #fff;
border-top: 1px solid #E2E7EF; border-top: 1px solid #E2E7EF;
z-index: 5;
} }
.comment-btn { .comment-btn {
width: 670rpx; width: 670rpx;
......
...@@ -14,6 +14,8 @@ Page({ ...@@ -14,6 +14,8 @@ Page({
codeInfo: {}, codeInfo: {},
isFromUse: false, isFromUse: false,
winCode: false, winCode: false,
residuePayTime: "", //剩余支付时间
}, },
onLoad: function (options) { onLoad: function (options) {
...@@ -37,6 +39,7 @@ Page({ ...@@ -37,6 +39,7 @@ Page({
* @returns * @returns
*/ */
queryOrderDetail: function () { queryOrderDetail: function () {
let that = this
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/getOrderDetail', url: '/api/v1/order/getOrderDetail',
data: { data: {
...@@ -53,7 +56,6 @@ Page({ ...@@ -53,7 +56,6 @@ Page({
'contactPhone': funcResponse.mobilePhone, // 联系人电话 'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodityType': Number(funcResponse.goodType), // 商品类型 'commodityType': Number(funcResponse.goodType), // 商品类型
'commodity': [], 'commodity': [],
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号 'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipTimeSubmit': funcResponse.createDate, 'tipTimeSubmit': funcResponse.createDate,
'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'), 'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'),
...@@ -73,6 +75,35 @@ Page({ ...@@ -73,6 +75,35 @@ Page({
} }
funcOrderInfo.commodity.push(funcCommodityItem) 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({ this.setData({
orderInfo: funcOrderInfo orderInfo: funcOrderInfo
...@@ -87,6 +118,8 @@ Page({ ...@@ -87,6 +118,8 @@ Page({
}) })
}, },
onCouponCode: function (event) { onCouponCode: function (event) {
let funcOrderInfo = event.currentTarget.dataset.item let funcOrderInfo = event.currentTarget.dataset.item
App.wxRequest({ App.wxRequest({
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<text>订单待付款</text> <text>订单待付款</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>请在 {{residuePayTime}} 内付款,否则将自动取消订单</text>
</view> </view>
</view> </view>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<text>订单已过期</text> <text>订单已过期</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>有效期xxx-xxx</text>
</view> </view>
</view> </view>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<text>订单已取消</text> <text>订单已取消</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>下单后15分钟内未付款,自动取消订单</text>
</view> </view>
</view> </view>
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
<text class="info-content-item-tip">18030303030</text> <text class="info-content-item-tip">18030303030</text>
</view> </view>
</view> </view>
<view class="info-line row con-b align-c"> <view class="info-line row con-b align-c">
<view class="info-line-point-left"></view> <view class="info-line-point-left"></view>
<view class="info-line-line"></view> <view class="info-line-line"></view>
......
...@@ -18,21 +18,17 @@ Page({ ...@@ -18,21 +18,17 @@ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
animation: {}, animation: {},
shopInfo: {}, shopInfo: {},
orderId: '', orderId: '',
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 orderType: 1, // 1 - 年卡月卡,2 - 普通商品, 3 - 门票商品, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
formName: '', formName: '',
formPhone: '', formPhone: '',
formIdNum: '', formIdNum: '',
isSubmit: false, isSubmit: false,
winToast: false,
toastContent: '',
// 购买内容 // 购买内容
buyContent: '', // 商品封面 buyContent: '', // 商品封面
buyContentCover: '', buyContentCover: '',
...@@ -51,25 +47,26 @@ Page({ ...@@ -51,25 +47,26 @@ Page({
entryEndDate: '', entryEndDate: '',
// 数量选择组件属性 // 数量选择组件属性
quantityTitle: '选择购买数量', quantityTitle: '',
quantityError: '', quantityError: '',
quantityTipText: '剩余库存', quantityTipText: '',
quantityTipNumber: 0, quantityTipNumber: 0,
quantity: 1, quantity: 1,
quantityMax: 20, quantityMax: 20,
quantityMin: 1, quantityMin: 1,
// 购买人员信息 // 购买人员信息
contactTitle: '填写购票人信息', contactTitle: '',
// 用户信息 // 用户信息
registerTitle: '',
registerInfo: [], registerInfo: [],
// 立即支付 // 立即支付
payAmount: '', payAmount: '',
// 购买须知详情 // 购买须知详情
noticeDetail: App.globalData.appResourcesBase + 'pay/notice-detail.png', noticeDetail: '',
// 以下变量均为界面控制 // 以下变量均为界面控制
winBuyContent: false, // 购买内容 winBuyContent: false, // 购买内容
...@@ -83,9 +80,11 @@ Page({ ...@@ -83,9 +80,11 @@ Page({
winButtonPay: false, // 立即支付 winButtonPay: false, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
winNoticeDetail: false, // 购买须知详情 winNoticeDetail: false, // 购买须知详情
stockList: [],
winStockTip: false,
}, },
onLoad: function (options) { onLoad: function (options) {
console.log(options)
if (options.type) options.type = Number(options.type) if (options.type) options.type = Number(options.type)
logicData.option = options logicData.option = options
...@@ -115,6 +114,8 @@ Page({ ...@@ -115,6 +114,8 @@ Page({
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContent: this.data.shoppingCartList[0].cover, buyContent: this.data.shoppingCartList[0].cover,
quantityTitle: '选择购买数量',
quantityTipText: '剩余库存',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -127,12 +128,17 @@ Page({ ...@@ -127,12 +128,17 @@ Page({
winButtonPay: true, // 立即支付 winButtonPay: true, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
}) })
this.setStock()
break break
case 2: case 2:
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContent: this.data.shoppingCartList[0].cover, buyContent: this.data.shoppingCartList[0].cover,
quantityTitle: '选择购买数量',
quantityTipText: '剩余库存',
contactTitle: '填写购票人信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -145,6 +151,8 @@ Page({ ...@@ -145,6 +151,8 @@ Page({
winButtonPay: true, // 立即支付 winButtonPay: true, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
}) })
this.setStock()
break break
case 3: case 3:
...@@ -152,6 +160,9 @@ Page({ ...@@ -152,6 +160,9 @@ Page({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentAmount: '360.00', buyContentAmount: '360.00',
quantityTitle: '选择购买数量',
quantityTipText: '剩余库存',
contactTitle: '填写取货人信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -164,13 +175,15 @@ Page({ ...@@ -164,13 +175,15 @@ Page({
winButtonPay: true, // 立即支付 winButtonPay: true, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
}) })
this.setStock()
break break
case 4: case 4:
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-12:00', quantityTitle: '选择购买数量',
contactTitle: '填写取货人信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: true, // 购买清单 winShoppingCart: true, // 购买清单
...@@ -189,7 +202,8 @@ Page({ ...@@ -189,7 +202,8 @@ Page({
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30', quantityTitle: '选择购买数量',
contactTitle: '填写取货人信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: true, // 购买清单 winShoppingCart: true, // 购买清单
...@@ -208,8 +222,11 @@ Page({ ...@@ -208,8 +222,11 @@ Page({
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30', noticeText: '报名须知',
buyContentAmount: '36.00', buyContentAmount: '36.00',
quantityTitle: '报名人数',
quantityTipText: '剩余库存',
contactTitle: '填写报名信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -222,14 +239,18 @@ Page({ ...@@ -222,14 +239,18 @@ Page({
winButtonPay: true, // 立即支付 winButtonPay: true, // 立即支付
winButtonAppointment: false, // 确认预约 winButtonAppointment: false, // 确认预约
}) })
this.setStock()
break break
case 7: case 7:
this.setData({ this.setData({
orderType: logicData.option.type, orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name, buyContentTitle: this.data.shopInfo.name,
buyContentTime: '8月4日 19:30-21:30', noticeText: '预约须知',
buyContentAmount: '免费', buyContentAmount: '免费',
quantityTitle: '选择预约座位',
quantityTipText: '剩余座位',
contactTitle: '填写预约信息',
winBuyContent: true, // 购买内容 winBuyContent: true, // 购买内容
winShoppingCart: false, // 购买清单 winShoppingCart: false, // 购买清单
...@@ -242,6 +263,7 @@ Page({ ...@@ -242,6 +263,7 @@ Page({
winButtonPay: false, // 立即支付 winButtonPay: false, // 立即支付
winButtonAppointment: true, // 确认预约 winButtonAppointment: true, // 确认预约
}) })
this.setStock()
break break
} }
...@@ -261,6 +283,26 @@ Page({ ...@@ -261,6 +283,26 @@ Page({
this.setData({ this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer'), shopInfo: wx.getStorageSync('shopInfoBuffer'),
}) })
// 获取地点营业时间
let funcPointId = ''
for (let i = 0, l = App.globalData.pointInfo.length; i < l; i++) {
if (this.data.shopInfo.appId === App.globalData.pointInfo[i].appId) {
funcPointId = App.globalData.pointInfo[i].id
break
}
}
App.wxRequest({
url: '/api/v1/park/getDetail',
data: {
'id': funcPointId
},
success: (response) => {
this.setData({
buyContentTime: response.data.businessTime
})
}
})
}, },
setShoppingCartData: function () { setShoppingCartData: function () {
...@@ -329,6 +371,46 @@ Page({ ...@@ -329,6 +371,46 @@ Page({
}) })
}, },
/**
* 同步库存信息
* @function
* @param
* @returns
*/
setStock: function () {
console.log('funcCommodity')
console.log(this.data.shoppingCartList)
let funcItem = this.data.shoppingCartList[0]
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
let funcRegisterTitle
let funcQuantityStock
// 年卡月卡
if (funcResponse.inventorie) {
funcRegisterTitle = funcResponse.inventorie[0].cardName
funcQuantityStock = funcResponse.inventorie[0].number
} else {
funcQuantityStock = funcResponse.number
}
this.setData({
registerTitle: funcRegisterTitle,
quantityTipNumber: funcQuantityStock,
quantityMax: funcQuantityStock < this.data.quantityMax ? funcQuantityStock : this.data.quantityMax
})
}
})
},
onInputBlur: function(event) { onInputBlur: function(event) {
let funcType = event.target.dataset.type let funcType = event.target.dataset.type
let funcIndex = event.target.dataset.index let funcIndex = event.target.dataset.index
...@@ -348,7 +430,7 @@ Page({ ...@@ -348,7 +430,7 @@ Page({
}, },
/** /**
* 购买须知详情 * 须知详情
* @function * @function
* @param * @param
* @returns * @returns
...@@ -370,10 +452,27 @@ Page({ ...@@ -370,10 +452,27 @@ Page({
}) })
clearTimeout(funcTimer) clearTimeout(funcTimer)
}, 100) }, 100)
App.wxRequest({
url: '/api/v1/commodity/getNotification',
data: {
'notificationId': this.data.shoppingCartList[0].notificationId
},
success: (response) => {
let funcRichText = response.data.particulars
.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ')
.replace(/<section/g, '<div')
.replace(/\/section>/g, '\div>')
this.setData({
noticeDetail: funcRichText
})
}
})
}, },
/** /**
* 关闭购买须知详情 * 关闭须知详情
* @function * @function
* @param * @param
* @returns * @returns
...@@ -428,7 +527,7 @@ Page({ ...@@ -428,7 +527,7 @@ Page({
// 购买数量最大为 20 // 购买数量最大为 20
if (this.data.quantity >= this.data.quantityMax) { if (this.data.quantity >= this.data.quantityMax) {
this.setData({ this.setData({
quantityError: '每笔订单购买数量上限为20', quantityError: '已达数量购买上限',
}) })
return return
} }
...@@ -463,6 +562,7 @@ Page({ ...@@ -463,6 +562,7 @@ Page({
*/ */
inspectData: function () { inspectData: function () {
let funcPass = true let funcPass = true
let funcErrorIndex = null
// 校验数组用户信息 // 校验数组用户信息
let funcRegisterInfo = this.data.registerInfo let funcRegisterInfo = this.data.registerInfo
...@@ -470,11 +570,13 @@ Page({ ...@@ -470,11 +570,13 @@ Page({
if (funcRegisterInfo[i].name === '' || funcRegisterInfo[i].errorName !== '') { if (funcRegisterInfo[i].name === '' || funcRegisterInfo[i].errorName !== '') {
this.setUserInfo('name', funcRegisterInfo[i].name, i, App.modular.rule.item('name', funcRegisterInfo[i].name)) this.setUserInfo('name', funcRegisterInfo[i].name, i, App.modular.rule.item('name', funcRegisterInfo[i].name))
funcPass = false funcPass = false
if (funcErrorIndex === null) funcErrorIndex = i
} }
if (funcRegisterInfo[i].phone === '' || funcRegisterInfo[i].errorPhone !== '') { if (funcRegisterInfo[i].phone === '' || funcRegisterInfo[i].errorPhone !== '') {
this.setUserInfo('phone', funcRegisterInfo[i].phone, i, App.modular.rule.item('phone', funcRegisterInfo[i].phone)) this.setUserInfo('phone', funcRegisterInfo[i].phone, i, App.modular.rule.item('phone', funcRegisterInfo[i].phone))
funcPass = false funcPass = false
if (funcErrorIndex === null) funcErrorIndex = i
} }
// 仅在需要的订单场景下校验 // 仅在需要的订单场景下校验
...@@ -482,9 +584,22 @@ Page({ ...@@ -482,9 +584,22 @@ Page({
if (funcRegisterInfo[i].identity === '' || funcRegisterInfo[i].errorIdentity !== '') { if (funcRegisterInfo[i].identity === '' || funcRegisterInfo[i].errorIdentity !== '') {
this.setUserInfo('identity', funcRegisterInfo[i].identity, i, App.modular.rule.item('identity', funcRegisterInfo[i].identity)) this.setUserInfo('identity', funcRegisterInfo[i].identity, i, App.modular.rule.item('identity', funcRegisterInfo[i].identity))
funcPass = false funcPass = false
if (funcErrorIndex === null) funcErrorIndex = i
} }
} }
} }
// 定位到当前问题位置
if (funcErrorIndex !== null) {
const funcQuery = wx.createSelectorQuery()
funcQuery.selectAll('.register-item-title').boundingClientRect()
funcQuery.exec((response) => {
console.log(response)
wx.pageScrollTo({
scrollTop: response[0][funcErrorIndex].top
})
})
}
return funcPass return funcPass
}, },
...@@ -497,6 +612,11 @@ Page({ ...@@ -497,6 +612,11 @@ Page({
onPaySubmit: function () { onPaySubmit: function () {
// 数据校验不通过 // 数据校验不通过
if (!this.inspectData()) return if (!this.inspectData()) return
// 支付正在进行
if (this.data.isPaySubmit) return
this.setData({
isPaySubmit: true,
})
// 整合商品数据 // 整合商品数据
let funcCommodity = [] let funcCommodity = []
...@@ -543,18 +663,26 @@ Page({ ...@@ -543,18 +663,26 @@ Page({
'smPersonalDetails': funcUserInfo 'smPersonalDetails': funcUserInfo
}, },
success: (response) => { success: (response) => {
// 库存不足
console.log(response) console.log(response)
if (/库存不足/.test(response.data.message)) { if (/库存不足/.test(response.data.msg)) {
let funcList = []
for (let i = 0, l = response.data.data.list.length; i < l; i++) {
let funcItem = {
'cover': response.data.data.list[i].imgUrl,
'name': response.data.data.list[i].name
}
funcList.push(funcItem)
}
this.setData({ this.setData({
winToast: true, winStockTip: true,
toastContent: response.msg, stockList: funcList,
isPaySubmit: false,
}) })
return return
} }
let funcResponse = response.data.wxRequest
// 库存充足正常下单支付 // 库存充足正常下单支付
let funcResponse = response.data.wxRequest
pagePayId = response.data.orderId pagePayId = response.data.orderId
this.setData({ this.setData({
orderId: pagePayId orderId: pagePayId
...@@ -624,6 +752,9 @@ Page({ ...@@ -624,6 +752,9 @@ Page({
*/ */
payStatus: function (funcPayResult) { payStatus: function (funcPayResult) {
clearInterval(App.globalData.payStateTimer) clearInterval(App.globalData.payStateTimer)
this.setData({
isPaySubmit: false,
})
if (funcPayResult) { if (funcPayResult) {
// 支付成功进入成功页面 // 支付成功进入成功页面
wx.reLaunch({ wx.reLaunch({
...@@ -632,8 +763,17 @@ Page({ ...@@ -632,8 +763,17 @@ Page({
} else { } else {
// 取消支付直接进入订单 // 取消支付直接进入订单
wx.reLaunch({ wx.reLaunch({
url: '/pages/pay/order-detail/order-detail?id=' + this.data.orderId + '&fromPage=order' url: '/pages/pay/order/order'
}) })
} }
}, },
onStockTipClose: function () {
this.setData({
winStockTip: false,
})
wx.navigateBack({
delta: 1
})
}
}) })
\ No newline at end of file
<l-toast show="{{winToast}}" icon="error" title="{{toastContent}}"></l-toast>
<!-- 购买须知详情 --> <!-- 购买须知详情 -->
<view class="notice-detail" wx:if="{{winNoticeDetail}}" bindtap="onNoticeClose"> <view class="notice-detail" wx:if="{{winNoticeDetail}}" bindtap="onNoticeClose">
<view class="notice-item" animation="{{animation}}"> <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>
</view> </view>
...@@ -171,11 +174,13 @@ ...@@ -171,11 +174,13 @@
</view> </view>
<view class="quantity-input row con-b align-c"> <view class="quantity-input row con-b align-c">
<l-button l-class="input-button input-cut" special="{{true}}" bind:lintap="onQuantityCut"> <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> </l-button>
<text class="text" style="{{formQuantity === 0 ? 'color: #C2C7CF' : 'color: #15191F'}}">{{quantity}}</text> <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"> <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> </l-button>
</view> </view>
<view class="quantity-other row con-b align-c"> <view class="quantity-other row con-b align-c">
...@@ -190,7 +195,7 @@ ...@@ -190,7 +195,7 @@
</view> </view>
<!-- winContact --> <!-- winContact -->
<view class="contact" wx:if="{{winContact && !winNoticeDetail}}"> <view class="contact" wx:if="{{winContact && !winNoticeDetail && !winStockTip}}">
<view class="contact-title col"> <view class="contact-title col">
<text>{{contactTitle}}</text> <text>{{contactTitle}}</text>
<text>仅用于接收订单确认短信</text> <text>仅用于接收订单确认短信</text>
...@@ -202,13 +207,13 @@ ...@@ -202,13 +207,13 @@
</view> </view>
<view class="contact-input col"> <view class="contact-input col">
<text>手机号</text> <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> <text>{{registerInfo[0].errorPhone}}</text>
</view> </view>
</view> </view>
<!-- winRegister --> <!-- winRegister -->
<view class="register" wx:if="{{winRegister && !winNoticeDetail}}"> <view class="register" wx:if="{{winRegister && !winNoticeDetail && !winStockTip}}">
<view class="register-title col"> <view class="register-title col">
<text>填写贵宾信息</text> <text>填写贵宾信息</text>
</view> </view>
...@@ -219,7 +224,7 @@ ...@@ -219,7 +224,7 @@
<block wx:for="{{registerInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index"> <block wx:for="{{registerInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="register-item-title"> <view class="register-item-title">
<text>{{'年卡' + (index + 1)}}</text> <text>{{registerTitle + (index + 1)}}</text>
</view> </view>
<view class="contact-input col"> <view class="contact-input col">
<text>姓名</text> <text>姓名</text>
...@@ -228,7 +233,7 @@ ...@@ -228,7 +233,7 @@
</view> </view>
<view class="contact-input col"> <view class="contact-input col">
<text>手机号</text> <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> <text>{{item.errorPhone}}</text>
</view> </view>
<view class="contact-input col"> <view class="contact-input col">
...@@ -241,7 +246,7 @@ ...@@ -241,7 +246,7 @@
</view> </view>
<!-- winButtonPay --> <!-- 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-view class="pay-tip row align-c">
<cover-image src="{{imageBase + 'fail-icon-4.png'}}"></cover-image> <cover-image src="{{imageBase + 'fail-icon-4.png'}}"></cover-image>
<cover-view class="pay-tip-text row con-c align-c">付款后一经确认不得退款</cover-view> <cover-view class="pay-tip-text row con-c align-c">付款后一经确认不得退款</cover-view>
...@@ -256,3 +261,23 @@ ...@@ -256,3 +261,23 @@
<cover-view class="appointment row con-c align-c" wx:if="{{winButtonAppointment && !winNoticeDetail}}"> <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 class="appointment-confirm row con-c align-c">确认预约</cover-view>
</cover-view> </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 @@ ...@@ -14,15 +14,31 @@
left: 0; left: 0;
bottom: -950rpx; bottom: -950rpx;
width: 750rpx; width: 750rpx;
padding: 28px 0 50rpx 0; height: 70%;
padding: 130rpx 40rpx 50rpx 40rpx;
border-radius: 24px 24px 0px 0px; border-radius: 24px 24px 0px 0px;
background: #FFFFFF; background: #FFFFFF;
} }
.notice-item image { .notice-title {
display: block; position: absolute;
width: 750rpx; top: 50rpx;
height: 950rpx; 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 { .container {
...@@ -866,3 +882,72 @@ ...@@ -866,3 +882,72 @@
font-size: 26rpx; font-size: 26rpx;
line-height: 44rpx; 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() const App = getApp()
let logicData = {
pageScrollLock: false,
pageScrollTimer: 0,
}
Page({ Page({
data: { data: {
bannerImg: App.globalData.appResourcesBase + 'play/home/type.png', bannerImg: App.globalData.appResourcesBase + 'play/home/type.png',
...@@ -12,6 +7,10 @@ Page({ ...@@ -12,6 +7,10 @@ Page({
navigationLogoTop: 0, navigationLogoTop: 0,
navigationLogoMarginTop: 0, navigationLogoMarginTop: 0,
movieList: [],
recentList: [ recentList: [
{ {
id: 0, id: 0,
...@@ -61,7 +60,8 @@ Page({ ...@@ -61,7 +60,8 @@ Page({
}, },
onShow: function () { onShow: function () {
this.getActivityList(1) this.queryActivity()
this.queryMovie()
}, },
/** /**
...@@ -82,42 +82,22 @@ Page({ ...@@ -82,42 +82,22 @@ Page({
}, },
/** /**
* 设置标题高度 * 查询主题活动
* @function * @function
* @param * @param
* @returns * @returns
*/ */
onActivity: function () { queryActivity: 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) {
var that = this var that = this
App.wxRequest({ App.wxRequest({
url: '/api/v1/activity/getList', url: '/api/v1/activity/getList',
data: { data: {
listType: type, listType: 1,
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
tagId: '101', tagId: '101',
}, },
success: function (res) { success: (res) => {
var tmpArr = []; var tmpArr = [];
res.data.list.forEach(item => { res.data.list.forEach(item => {
var tmpItem = { var tmpItem = {
...@@ -131,24 +111,84 @@ Page({ ...@@ -131,24 +111,84 @@ Page({
tmpArr.push(tmpItem) tmpArr.push(tmpItem)
}) })
// 活动开始时间倒序排序 this.setData({
// tmpArr.sort(function(a,b) {
// return new Date(b.beginDate.replace(/月/g,"\/").replace(/日/g,"\/")) - new Date(a.beginDate.replace(/月/g,"\/").replace(/日/g,"\/"))
// })
if (type == 1) {
that.setData({
banner: tmpArr 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 () { onToArt: function () {
wx.navigateTo({ wx.navigateTo({
...@@ -195,8 +235,11 @@ Page({ ...@@ -195,8 +235,11 @@ Page({
}) })
}, },
onAllActivity: function () {
wx.navigateTo({
url: '/pages/play/activity/activity'
})
},
onAllRecent: function () { onAllRecent: function () {
wx.navigateTo({ wx.navigateTo({
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
<view class="title row con-b align-c"> <view class="title row con-b align-c">
<image src="./image/title-activity.png">近期活动</image> <image src="./image/title-activity.png">近期活动</image>
<text bindtap="onAllRecent">查看全部</text> <text bindtap="onAllRecent" bindtap="onAllActivity">查看全部</text>
</view> </view>
<swiper class="recent-swiper" next-margin="38rpx" bindchange="swiperRecentChange"> <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"> <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> </swiper-item>
</block> </block>
</swiper> </swiper>
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
<swiper-item class="movie-item col con-e"> <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-wrapper {{swiperMovieCurrent === index ? 'movie-item-left' : '' }} {{swiperMovieCurrent === movieList.length - 1 ? 'movie-item-center' : ''}}">
<view class="movie-cover"> <view class="movie-cover">
<image src="{{item.img}}"></image> <image src="{{item.cover}}"></image>
</view> </view>
<view class="movie-info-wrapper"> <view class="movie-info-wrapper">
<view class="movie-name row"> <view class="movie-name row">
<text>{{item.name}}</text> <text>{{item.movieName}}</text>
<view class="movie-dimensional"> <view class="movie-dimensional">
<text>{{item.dimensional}}</text> <text>{{item.movieType}}</text>
</view> </view>
</view> </view>
<view class="movie-info row"> <view class="movie-info row">
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<text>类型</text> <text>类型</text>
</view> </view>
<view class="movie-info-right"> <view class="movie-info-right">
<text>{{item.type}}</text> <text>{{item.movieType}}</text>
</view> </view>
</view> </view>
<view class="movie-info row"> <view class="movie-info row">
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<text>导演</text> <text>导演</text>
</view> </view>
<view class="movie-info-right"> <view class="movie-info-right">
<text>{{item.director}}</text> <text>{{item.movieDirector}}</text>
</view> </view>
</view> </view>
<view class="movie-btn"> <view class="movie-btn">
......
...@@ -190,11 +190,8 @@ ...@@ -190,11 +190,8 @@
} }
.movie-info-right { .movie-info-right {
display: -webkit-box;
margin-left: 8rpx; margin-left: 8rpx;
color: #656e7b; color: #656e7b;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden; overflow: hidden;
} }
......
...@@ -10,6 +10,7 @@ Page({ ...@@ -10,6 +10,7 @@ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
option: {},
// 导航栏相关属性 // 导航栏相关属性
navigationStyle: { navigationStyle: {
...@@ -69,8 +70,9 @@ Page({ ...@@ -69,8 +70,9 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
options.id = 1 this.setData({
logicData.option = options option: options
})
this.queryDetail(Number(options.id)) this.queryDetail(Number(options.id))
}, },
...@@ -80,12 +82,12 @@ Page({ ...@@ -80,12 +82,12 @@ Page({
* @param {string} - funcToken * @param {string} - funcToken
* @returns * @returns
*/ */
queryDetail: function (funcIndex) { queryDetail: function (funcAppId) {
funcIndex = funcIndex - 1 let funcIndex = 0
// 预设数据 // 预设数据
let funcDetail = [ let funcDetail = [
{ {
id: 1, appId: 1,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-1-1-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-1-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-1-1-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-1-1-2.png',
...@@ -144,7 +146,7 @@ Page({ ...@@ -144,7 +146,7 @@ Page({
], ],
contact: '13316748039' contact: '13316748039'
}, { }, {
id: 2, appId: 5,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-1-2-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-1-2-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-1-2-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-1-2-2.png',
...@@ -158,7 +160,7 @@ Page({ ...@@ -158,7 +160,7 @@ Page({
], ],
contact: '13316748039' contact: '13316748039'
}, { }, {
id: 3, appId: 7,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-2-1-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-2-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-2-1-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-2-1-2.png',
...@@ -175,7 +177,7 @@ Page({ ...@@ -175,7 +177,7 @@ Page({
], ],
contact: '13316748039' contact: '13316748039'
}, { }, {
id: 4, appId: 6,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-3-1-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-3-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-3-1-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-3-1-2.png',
...@@ -195,7 +197,7 @@ Page({ ...@@ -195,7 +197,7 @@ Page({
], ],
contact: '13316748039' contact: '13316748039'
}, { }, {
id: 5, appId: 4,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-3-2-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-3-2-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-3-2-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-3-2-2.png',
...@@ -209,7 +211,7 @@ Page({ ...@@ -209,7 +211,7 @@ Page({
], ],
contact: '13316748039' contact: '13316748039'
}, { }, {
id: 6, appId: 2,
banner: [ banner: [
App.globalData.appResourcesBase + 'shop/banner/banner-4-1-1.png', App.globalData.appResourcesBase + 'shop/banner/banner-4-1-1.png',
App.globalData.appResourcesBase + 'shop/banner/banner-4-1-2.png', App.globalData.appResourcesBase + 'shop/banner/banner-4-1-2.png',
...@@ -228,7 +230,30 @@ Page({ ...@@ -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({ this.setData({
banner: funcDetail[funcIndex].banner, banner: funcDetail[funcIndex].banner,
...@@ -252,9 +277,17 @@ Page({ ...@@ -252,9 +277,17 @@ Page({
} }
}, },
queryDetailActivity: function () {
},
queryDetailCommodity: function () {
},
onLocation: function () { onLocation: function () {
wx.navigateTo({ 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 = { ...@@ -25,9 +25,17 @@ let output = {
* @returns * @returns
*/ */
formatAmount: function (funcAmountValue) { 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') 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