Commit c05279b8 by 严立

LL - 商品购买问题修复

parent 862a7ead
......@@ -14,6 +14,7 @@ App({
appImageBase: '../../../image/',
appResourcesBase: 'https://sm-web.meiqicloud.com/userfiles/appResourcesS2/',
shopId: iEnvironmental.shopId,
pointInfo: iEnvironmental.pointInfo,
payStateTimer: 0,
......@@ -67,7 +68,7 @@ App({
}
} else if (402 == code) { // token失效
this.refreshToken({
success: function () {
success: () => {
this.wxRequest(obj)
}
})
......
......@@ -4,6 +4,8 @@ Page({
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
option: {},
phone: '13316748039',
hotline: false, //客服热线
......@@ -13,8 +15,12 @@ Page({
shopRecommendD: [], // 底部第二商店推荐
},
onLoad: function () {
onLoad: function (option) {
this.setData({
option: option
})
// formPage=order&shopAppId=1&commodityType=5
},
onShow: function () {
......@@ -303,7 +309,7 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
url: '/pages/commodity/menu-food/menu-food'
})
},
......@@ -320,7 +326,26 @@ Page({
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-art/menu-art'
url: '/pages/commodity/menu-food/menu-food'
})
},
/**
* 点击推荐文创
* @function
* @param {object} - event
* @returns
*/
onBuyRecommendOriginality: function (event) {
// funcShopType 使用函数区分商品类型,所以每个函数里的数值是固定的
let funcShopType = 4
let funcShopAppId = event.currentTarget.dataset.id
let funcCommodityItem = event.currentTarget.dataset.item
console.log(funcCommodityItem)
this.setShopInfo(funcShopAppId, funcShopType)
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food?commodityId=' + funcCommodityItem.id + '&sideBarId=' + funcCommodityItem.sideBarId
})
},
......
......@@ -113,7 +113,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendC}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c" data-id="{{1}}" data-item="{{item}}" bindtap="onBuyRecommendFood">
<view class="shop-menu-item col con-c align-c" data-id="{{1}}" data-item="{{item}}" bindtap="onBuyRecommendOriginality">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......@@ -129,7 +129,7 @@
</view>
<view class="shop-menu">
<block wx:for="{{shopRecommendD}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="shop-menu-item col con-c align-c" data-id="{{3}}" data-item="{{item}}" bindtap="onBuyRecommendFood">
<view class="shop-menu-item col con-c align-c" data-id="{{3}}" data-item="{{item}}" bindtap="onBuyRecommendOriginality">
<image src="{{item.cover}}"></image>
<text>{{item.name}}</text>
</view>
......
......@@ -16,6 +16,7 @@ Page({
shopInfo: {},
sideBar: [], // 侧边菜单
sideBarTopPadding: 0,
menuTitle: '', // 商品列表标题
commodityList: [], // 商品列表
commodityDetail: {}, // 商品详情
......@@ -37,6 +38,8 @@ Page({
option: option
})
this.setSideBarStyle()
this.resetShoppingCart()
this.setCartAnimation()
......@@ -55,6 +58,12 @@ Page({
}
},
setSideBarStyle: function () {
this.setData({
sideBarTopPadding: wx.getStorageSync('navigationStatusHeight') + wx.getStorageSync('navigationCapsuleHeight')
})
},
/**
* 添加动画初始
* @function
......
......@@ -21,7 +21,7 @@
<view class="row">
<!-- 侧边菜单 -->
<view class="side-bar">
<view class="side-bar" style="{{'padding-top: ' + sideBarTopPadding + 'px;'}}">
<block wx:for="{{sideBar}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="menu-item {{currentIndex === index ? 'active' : ''}}" data-index="{{index}}" bindtap="onSelectionSideBar">
<text>{{item.tab}}</text>
......
......@@ -13,7 +13,6 @@ page {
.side-bar {
width: 160rpx;
height: 100vh;
padding-top: 126rpx;
overflow-y: scroll;
background: #f2f3f5;
}
......
......@@ -263,6 +263,7 @@ Page({
// 格式化金额
funcAmountDiscount = funcAmountDiscount - funcAmountPay
console.log('funcAmountDiscount', funcAmountDiscount)
funcAmountPay = App.modular.utils.formatAmount(funcAmountPay)
funcAmountDiscount = App.modular.utils.formatAmount(funcAmountDiscount)
......
......@@ -47,7 +47,7 @@
.shopping-cart-list {
width: 750rpx;
margin-top: 50rpx;
padding-bottom: 200rpx;
padding-bottom: 240rpx;
}
.list-item {
......
......@@ -8,6 +8,9 @@ let logicData = {
Page({
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
mapCss: '',
pointDetail: './image/card/01.png',
winPointDetail: false,
......
......@@ -19,7 +19,7 @@
<navigation class="navigation" titleText="智慧导览" backIcon="/image/back.png"></navigation>
<scroll-view class="guide" scroll-x scroll-left="{{selectionPoint}}">
<image id="guide-map" src="http://sm-web.meiqicloud.com/userfiles/appResources/guide/guide.png" style="{{mapCss}}"></image>
<image id="guide-map" src="{{resourcesBase + 'guide/guide.png'}}" style="{{mapCss}}"></image>
<view class="point-map" style="{{mapCss}}" catch:tap="onCancel">
<block wx:for="{{pointInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
......@@ -44,7 +44,7 @@
</scroll-view>
<view class="point-detail" hidden="{{!winPointDetail}}" catch:tap="onPointDetail">
<image src="{{pointDetail}}"></image>
<image src="{{resourcesBase + pointDetail}}"></image>
</view>
<view class="save-map row con-c align-c" bindtap="onSaveMap">
......
......@@ -5,7 +5,7 @@ let output = [
id: '',
name: '温泉洋房(建设中)',
icon: './image/icon/01.png',
card: './image/card/01.png',
card: 'guide/card/01.png',
detail: '/pages/play/point-detail/point-detail?id=105',
isActive: false,
}, {
......@@ -14,7 +14,7 @@ let output = [
id: '',
name: '海错图2号馆',
icon: './image/icon/02.png',
card: './image/card/02.png',
card: 'guide/card/02.png',
detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false,
}, {
......@@ -23,7 +23,7 @@ let output = [
id: 1,
name: '海错图1号馆',
icon: './image/icon/03.png',
card: './image/card/03.png',
card: 'guide/card/03.png',
detail: '/pages/play/service-detail/service-detail?id=1',
isActive: false,
}, {
......@@ -32,7 +32,7 @@ let output = [
id: 4,
name: '原味舒食',
icon: './image/icon/04.png',
card: './image/card/04.png',
card: 'guide/card/04.png',
detail: '/pages/play/service-detail/service-detail?id=4',
isActive: false,
}, {
......@@ -41,7 +41,7 @@ let output = [
id: 6,
name: '星空影院',
icon: './image/icon/05.png',
card: './image/card/05.png',
card: 'guide/card/05.png',
detail: '/pages/play/service-detail/service-detail?id=6',
isActive: false,
}, {
......@@ -50,7 +50,7 @@ let output = [
id: 3,
name: '元养水韵SPA',
icon: './image/icon/06.png',
card: './image/card/06.png',
card: 'guide/card/06.png',
detail: '/pages/play/service-detail/service-detail?id=3',
isActive: false,
}, {
......@@ -59,7 +59,7 @@ let output = [
id: 5,
name: '原野MOJITO',
icon: './image/icon/07.png',
card: './image/card/07.png',
card: 'guide/card/07.png',
detail: '/pages/play/service-detail/service-detail?id=5',
isActive: false,
}, {
......@@ -68,7 +68,7 @@ let output = [
id: 2,
name: '拾光花坊',
icon: './image/icon/08.png',
card: './image/card/08.png',
card: 'guide/card/08.png',
detail: '/pages/play/service-detail/service-detail?id=2',
isActive: false,
}, {
......@@ -77,7 +77,7 @@ let output = [
id: '',
name: '星光广场',
icon: './image/icon/09.png',
card: './image/card/09.png',
card: 'guide/card/09.png',
detail: '/pages/play/point-detail/point-detail?id=101',
isActive: false,
}, {
......@@ -86,7 +86,7 @@ let output = [
id: '',
name: '云之亭',
icon: './image/icon/10.png',
card: './image/card/10.png',
card: 'guide/card/10.png',
detail: '/pages/play/point-detail/point-detail?id=102',
isActive: false,
}, {
......@@ -95,7 +95,7 @@ let output = [
id: '',
name: '湿地公园',
icon: './image/icon/11.png',
card: './image/card/11.png',
card: 'guide/card/11.png',
detail: '/pages/play/point-detail/point-detail?id=103',
isActive: false,
}, {
......@@ -104,7 +104,7 @@ let output = [
id: '',
name: '新月码头',
icon: './image/icon/12.png',
card: './image/card/12.png',
card: 'guide/card/12.png',
detail: '/pages/play/point-detail/point-detail?id=104',
isActive: false,
}, {
......@@ -113,7 +113,7 @@ let output = [
id: '',
name: '儿童营地',
icon: './image/icon/13.png',
card: './image/card/13.png',
card: 'guide/card/13.png',
detail: '/pages/campsite/home-mirror/home-mirror',
isActive: false,
}, {
......@@ -122,7 +122,7 @@ let output = [
id: '',
name: '星耀银湖',
icon: './image/icon/14.png',
card: './image/card/14.png',
card: 'guide/card/14.png',
detail: '/pages/play/point-detail/point-detail?id=106',
isActive: false,
}, {
......@@ -131,7 +131,7 @@ let output = [
id: '',
name: '奇幻森林',
icon: './image/icon/15.png',
card: './image/card/15.png',
card: 'guide/card/15.png',
detail: '/pages/play/point-detail/point-detail?id=107',
isActive: false,
},
......
......@@ -59,13 +59,14 @@ Page({
contactTitle: '',
// 用户信息
registerTitle: '',
registerInfo: [],
// 立即支付
payAmount: '',
// 购买须知详情
noticeDetail: App.globalData.appResourcesBase + 'pay/notice-detail.png',
noticeDetail: '',
// 以下变量均为界面控制
winBuyContent: false, // 购买内容
......@@ -84,7 +85,6 @@ Page({
winStockTip: false,
},
onLoad: function (options) {
console.log(options)
if (options.type) options.type = Number(options.type)
logicData.option = options
......@@ -182,7 +182,6 @@ Page({
this.setData({
orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-12:00',
quantityTitle: '选择购买数量',
contactTitle: '填写取货人信息',
......@@ -203,7 +202,6 @@ Page({
this.setData({
orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30',
quantityTitle: '选择购买数量',
contactTitle: '填写取货人信息',
......@@ -224,7 +222,7 @@ Page({
this.setData({
orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30',
noticeText: '报名须知',
buyContentAmount: '36.00',
quantityTitle: '报名人数',
quantityTipText: '剩余库存',
......@@ -248,7 +246,7 @@ Page({
this.setData({
orderType: logicData.option.type,
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '8月4日 19:30-21:30',
noticeText: '预约须知',
buyContentAmount: '免费',
quantityTitle: '选择预约座位',
quantityTipText: '剩余座位',
......@@ -285,6 +283,26 @@ Page({
this.setData({
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 () {
......@@ -374,8 +392,18 @@ Page({
},
success: (response) => {
let funcResponse = response.data
let funcQuantityStock = funcResponse.inventorie ? funcResponse.inventorie[0].number : funcResponse.number
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
})
......@@ -402,7 +430,7 @@ Page({
},
/**
* 购买须知详情
* 须知详情
* @function
* @param
* @returns
......@@ -424,10 +452,27 @@ Page({
})
clearTimeout(funcTimer)
}, 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
* @param
* @returns
......@@ -517,6 +562,7 @@ Page({
*/
inspectData: function () {
let funcPass = true
let funcErrorIndex = null
// 校验数组用户信息
let funcRegisterInfo = this.data.registerInfo
......@@ -524,11 +570,13 @@ Page({
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 (funcErrorIndex === null) funcErrorIndex = i
}
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 (funcErrorIndex === null) funcErrorIndex = i
}
// 仅在需要的订单场景下校验
......@@ -536,8 +584,21 @@ Page({
if (funcRegisterInfo[i].identity === '' || funcRegisterInfo[i].errorIdentity !== '') {
this.setUserInfo('identity', funcRegisterInfo[i].identity, i, App.modular.rule.item('identity', funcRegisterInfo[i].identity))
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
},
......@@ -702,7 +763,7 @@ Page({
} else {
// 取消支付直接进入订单
wx.reLaunch({
url: '/pages/pay/order-detail/order-detail?id=' + this.data.orderId + '&fromPage=order'
url: '/pages/pay/order/order'
})
}
},
......@@ -711,5 +772,8 @@ Page({
this.setData({
winStockTip: false,
})
wx.navigateBack({
delta: 1
})
}
})
\ No newline at end of file
<!-- 购买须知详情 -->
<view class="notice-detail" wx:if="{{winNoticeDetail}}" bindtap="onNoticeClose">
<view class="notice-item" animation="{{animation}}">
<image src="{{noticeDetail}}"></image>
<view class="notice-title">
<text>{{noticeText}}</text>
</view>
<view class="notice-rich">
<rich-text nodes="{{noticeDetail}}"></rich-text>
</view>
</view>
</view>
......@@ -219,7 +224,7 @@
<block wx:for="{{registerInfo}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="register-item-title">
<text>{{'年卡' + (index + 1)}}</text>
<text>{{registerTitle + (index + 1)}}</text>
</view>
<view class="contact-input col">
<text>姓名</text>
......
......@@ -14,15 +14,31 @@
left: 0;
bottom: -950rpx;
width: 750rpx;
padding: 28px 0 50rpx 0;
height: 70%;
padding: 130rpx 40rpx 50rpx 40rpx;
border-radius: 24px 24px 0px 0px;
background: #FFFFFF;
}
.notice-item image {
display: block;
width: 750rpx;
height: 950rpx;
.notice-title {
position: absolute;
top: 50rpx;
width: 670rpx;
height: 130rpx;
}
.notice-title text {
height: 58rpx;
font-size: 42rpx;
font-weight: 500;
line-height: 58rpx;
color: #15191F;
}
.notice-rich {
width: 670rpx;
height: 100%;
overflow-y: scroll;
}
.container {
......
......@@ -25,9 +25,17 @@ let output = {
* @returns
*/
formatAmount: function (funcAmountValue) {
if (funcAmountValue === 0) funcAmountValue = '000'
if (!funcAmountValue && funcAmountValue !== 0) return
console.log(funcAmountValue, funcAmountValue.toString().length)
switch (funcAmountValue.toString().length) {
case 1:
funcAmountValue = '00' + funcAmountValue
break
if (!funcAmountValue) return
case 2:
funcAmountValue = '0' + funcAmountValue
break
}
return funcAmountValue.toString().replace(/([0-9]{2})$/, '.$1')
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment