Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严立
/
mini-shimao
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
42506e46
authored
Sep 09, 2020
by
严立
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
LL - 订单填写逻辑
parent
a2b3f5c0
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
616 additions
and
454 deletions
app.js
app.json
pages/commodity/home/home.js
pages/commodity/home/home.json
pages/commodity/home/home.wxml
pages/commodity/home/home.wxss
pages/commodity/shopping-cart/shopping-cart.js
pages/commodity/shopping-cart/shopping-cart.wxml
pages/commodity/snacks/snacks.js
pages/commodity/snacks/snacks.wxml
pages/commodity/snacks/snacks.wxss
pages/home/service/service.json
pages/home/service/service.wxml
pages/home/service/service.wxss
pages/pay/order-input/order-input.js
pages/pay/order-input/order-input.wxml
pages/pay/order-input/order-input.wxss
utils/rule/rule-key.js
utils/utils.js
app.js
View file @
42506e46
import
iMiment
from
'./npm/miment.js'
import
iUtils
from
'./utils/utils.js'
import
iRule
from
'./utils/rule/rule.js'
import
iEnvironmental
from
'./environmental.js'
App
({
modular
:
{
'rule'
:
iRule
,
'utils'
:
iUtils
,
'miment'
:
iMiment
,
},
...
...
app.json
View file @
42506e46
...
...
@@ -30,6 +30,7 @@
"pages/commodity/art/art"
,
"pages/commodity/room/room"
,
"pages/commodity/room-appointment/room-appointment"
,
"pages/campsite/home/home"
,
"pages/campsite/home-mirror/home-mirror"
,
...
...
@@ -52,6 +53,7 @@
"pages/pay/coupon/coupon"
,
"pages/pay/coupon-input/coupon-input"
,
"pages/pay/coupon-detail/coupon-detail"
,
"pages/login/login"
],
"usingComponents"
:
{
...
...
pages/commodity/home/home.js
View file @
42506e46
// pages/home/service/service.js
const
App
=
getApp
()
Page
({
data
:
{
/**
* 页面的初始数据
*/
data
:
{
imageBase
:
App
.
globalData
.
appResourcesBase
,
data
:
[
//畅想美食
{
url
:
'/image/ywssLogo@2x.png'
,
bgc
:
'#586A46'
,
},
{
url
:
'/image/Logo@2x (3).png'
,
bgc
:
'#13625F'
},
],
data1
:
[
{
url
:
App
.
globalData
.
appResourcesBase
+
'commodity/home-shop-3.png'
},
{
url
:
App
.
globalData
.
appResourcesBase
+
'commodity/home-shop-4.png'
},
],
phone
:
'13316748039'
,
hotline
:
false
,
//客服热线
},
//客服热线拨打
call
()
{
wx
.
makePhoneCall
({
phoneNumber
:
this
.
data
.
phone
,
})
},
onLoad
:
function
(
options
)
{
//取消拨打
cancel
()
{
this
.
setData
({
hotline
:
false
,
})
},
})
\ No newline at end of file
pages/commodity/home/home.json
View file @
42506e46
{
"usingComponents"
:
{}
"usingComponents"
:
{}
}
\ No newline at end of file
pages/commodity/home/home.wxml
View file @
42506e46
<!--pages/home/home/home.wxml-->
<text>pages/home/home/home.wxml</text>
<!--pages/home/service/service.wxml-->
<navigation class="navigation"></navigation>
<view class="container">
<view class="greetings_header">
<view class="greetings_title">Monica , 早上好!</view>
<image src="/image/cxms@2x.png" class="title_img"></image>
<view class="greetings_header_describe">这里有来自大自然的馈赠用心烹饪的美食</view>
</view>
<view class="greetings_body">
<swiper indicator-dots="true" style="height:1469rpx;">
<block wx:for="{{data}}">
<swiper-item>
<view class="service_store" style="background:{{item.bgc}}">
<image src="{{item.url}}" class="{{index == 0? 'store_img' : 'store_img1'}} "></image>
<view class="order_button">立即点餐</view>
</view>
<view class="service_store_shop">
<view class="service_store_shop_item" wx:for="{{4}}">
<image class="shop_img"></image>
<text class="shop_goods">炭烤猪肋排拼盘</text>
</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="service_item" style="margin-bottom:136rpx;">
<view style="padding-left:40rpx;" class="greetings_header_describe">您可以用最优惠的价格享受超级服务</view>
<view class="item_banner">
<image style="z-index:-1;" class="item_banner_img" src="{{imageBase + 'commodity/home-head.png'}}"></image>
<view class="goods_buy">立即选购</view>
</view>
<view class="item_container">
<image wx:for="{{3}}" class="items_img"></image>
</view>
</view>
<view class="service_item">
<view style="padding-left:40rpx;white-space:pre-wrap" class="greetings_header_describe">尽情玩耍 随时为你补充能量
</view>
<view class="item_banner" style="background: #E8F1F6;text-align:center;z-index:-1;height:512rpx;">
<image style="width:312rpx;height:56rpx;margin-top:152rpx;" src="{{imageBase + 'commodity/home-title-1.png'}}"></image>
<view>
<image style="width:148rpx;height:16rpx;margin-top:8rpx;" src="{{imageBase + 'commodity/home-tip-1.png'}}"></image>
</view>
</view>
<view class="item_container">
<view style="margin-bottom:64rpx;" wx:for="{{2}}">
<image class="items_img" style="margin-bottom:0;"></image>
<view class="items_text">儿童营地接待区</view>
</view>
</view>
</view>
<view class="service_item">
<image style="margin-left:40rpx;" src="/image/wcsc@2x.png" class="title_img"></image>
<view style="padding-left:40rpx;white-space:pre-wrap" class="greetings_header_describe">可以为家人、朋友 准备一份精心的礼物
</view>
<view class="greetings_body">
<swiper indicator-dots="true" style="height:1469rpx;">
<block wx:for="{{data1}}">
<swiper-item>
<view class="service_store">
<image src="{{item.url}}" class="item_banner_img"></image>
<view style="width:750rpx;height:382rpx;"></view>
<view style="background:{{index== 0 ?'#C93120' : '#BD5B66' }} ;color: #FAF0DF;" class="order_button">立即选购</view>
</view>
<view class="service_store_shop">
<view class="service_store_shop_item" wx:for="{{4}}">
<image class="shop_img"></image>
<text class="shop_goods">炭烤猪肋排拼盘</text>
</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<view class="service_item">
<view style="padding-left:40rpx;white-space:pre-wrap;width:472rpx;" class="greetings_header_describe">滨海温泉院墅 足不出户即可享受滨海温泉
</view>
<view style="position: relative;">
<image class="home_footer" src="{{imageBase + 'commodity/home-footer.png'}}"></image>
<view class="seeHouse">预约看房</view>
<view class="call" bindtap="call">拨打客服</view>
</view>
</view>
</view>
<!-- 客服热线 -->
<l-arc-popup show="{{hotline}}" arc-radius="30">
<view class="phone">{{phone}}</view>
<view class="call" bindtap="call">呼叫</view>
<view style="height:10rpx;background-color:rgb(246,247,249);"></view>
<view class="call" bindtap="cancel">取消</view>
</l-arc-popup>
\ No newline at end of file
pages/commodity/home/home.wxss
View file @
42506e46
/* pages/home/home/home.wxss */
\ No newline at end of file
.greetings_header {
padding-top: 196rpx;
padding-left: 46rpx;
width: 750rpx;
}
.greetings_title {
font-size: 58rpx;
font-weight: 500;
color: #15191f;
text-align: left;
}
.title_img {
width: 214rpx;
height: 50rpx;
margin-top: 128rpx;
}
.greetings_header_describe {
font-weight: 300;
color: #15191f;
margin-top: 12rpx;
width: 414rpx;
font-size: 34rpx;
line-height: 58rpx;
letter-spacing: 1px;
}
.greetings_body {
width: 750rpx;
height: height;
margin-top: 64rpx;
margin-bottom: 200rpx;
}
.service_store {
width: 750rpx;
height: 600rpx;
/* background: #586A46; */
text-align: center;
}
.store_img {
width: 178rpx;
height: 186rpx;
margin-top: 92rpx;
margin-bottom: 48rpx;
}
.store_img1 {
width: 320rpx;
height: 120rpx;
margin-top: 134rpx;
margin-bottom: 72rpx;
}
.order_button {
background: #ebe2ce;
width: 200rpx;
height: 64rpx;
border-radius: 4rpx;
font-size: 26rpx;
font-weight: 500;
line-height: 64rpx;
color: #586a46;
margin: auto;
}
.service_store_shop {
width: 670rpx;
/* height: 932rpx; */
margin: auto;
margin-top: -100rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.service_store_shop_item {
width: 328rpx;
height: 410rpx;
text-align: center;
margin-bottom: 48rpx;
}
.shop_img {
width: 328rpx;
height: 328rpx;
background-color: blue;
}
.shop_goods {
font-weight: 300;
color: #15191f;
line-height: 42px;
}
.service_item {
width: 750rpx;
height: auto;
/* margin-bottom: 136rpx; */
}
.item_banner {
width: 750rpx;
height: 600rpx;
margin-top: 64rpx;
position: relative;
/* background-color: red; */
}
.item_banner_img {
width: 750rpx;
height: 600rpx;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
.item_container {
width: 670rpx;
height: auto;
margin: auto;
margin-top: -100rpx;
}
.items_img {
width: 670rpx;
height: 328rpx;
background-color: blue;
margin-bottom: 64rpx;
}
.goods_buy {
position: absolute;
width: 200rpx;
height: 64rpx;
top: 308rpx;
left: 276rpx;
border-radius: 4px;
background: #86c5e1;
font-weight: 500;
color: #fff;
font-size: 26rpx;
line-height: 64rpx;
text-align: center;
}
.items_text {
text-align: center;
margin-top: 45rpx;
font-weight: 300;
color: #000;
letter-spacing: 3px;
line-height: 42rpx;
}
.home_footer {
width: 750rpx;
height: 1640rpx;
margin-top: 64rpx;
}
.seeHouse {
position: absolute;
background: #86c5e1;
border-radius: 4px;
top: 294rpx;
width: 200rpx;
height: 64rpx;
left: 276rpx;
line-height: 64rpx;
color: #fff;
font-size: 26rpx;
text-align: center;
font-weight: 500;
}
.call {
position: absolute;
top: 1310rpx;
width: 200rpx;
height: 64rpx;
background: #d0b08f;
left: 276rpx;
line-height: 64rpx;
color: #fff;
font-size: 26rpx;
text-align: center;
font-weight: 500;
}
pages/commodity/shopping-cart/shopping-cart.js
View file @
42506e46
...
...
@@ -98,6 +98,12 @@ Page({
console
.
log
(
JSON
.
stringify
(
funcShoppingCart
))
},
/**
* 设置本店信息
* @function
* @param
* @returns
*/
setShopInfo
:
function
()
{
let
funcShopInfo
=
wx
.
getStorageSync
(
'shopInfoBuffer'
)
this
.
setData
({
...
...
@@ -236,24 +242,23 @@ Page({
// 根据价格类型计算优惠金额
// funcAmountDiscount 是原价累计数值,最后减去特价即是优惠金额
// 金额 * 100 是为了将金额小数转化为整数计算,避免小数计算出错
switch
(
funcShoppingCart
[
i
].
priceType
)
{
case
1
:
// 活动价
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
priceDiscount
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
priceDiscount
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
funcShoppingCart
[
i
].
quantity
break
case
2
:
// 业主价
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
priceSpecial
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
priceSpecial
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
funcShoppingCart
[
i
].
quantity
break
case
3
:
// 普通价
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
price
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
100
*
funcShoppingCart
[
i
].
quantity
funcAmountPay
=
funcAmountPay
+
funcShoppingCart
[
i
].
price
*
funcShoppingCart
[
i
].
quantity
funcAmountDiscount
=
funcAmountDiscount
+
funcShoppingCart
[
i
].
price
*
funcShoppingCart
[
i
].
quantity
break
}
}
...
...
@@ -261,8 +266,8 @@ Page({
// 格式化金额
funcAmountDiscount
=
funcAmountDiscount
-
funcAmountPay
funcAmountPay
=
funcAmountPay
.
toString
().
replace
(
/
([
0-9
]{2})
$/
,
'.$1'
)
funcAmountDiscount
=
funcAmountDiscount
.
toString
().
replace
(
/
([
0-9
]{2})
$/
,
'.$1'
)
funcAmountPay
=
App
.
modular
.
utils
.
formatAmount
(
funcAmountPay
)
funcAmountDiscount
=
App
.
modular
.
utils
.
formatAmount
(
funcAmountDiscount
)
this
.
setData
({
amountPay
:
funcAmountPay
,
...
...
@@ -270,6 +275,21 @@ Page({
selectionTotal
:
funcSelectionTotal
,
allSelectionIsActive
:
funcCommodityTotal
===
funcSelectionTotal
?
true
:
false
,
})
// 只要改变购物车数据就缓存
wx
.
setStorageSync
(
'shoppingCartBuffer'
,
this
.
data
.
shoppingCart
)
},
onPaySubmit
:
function
()
{
// let isEnough = true
// this.setData({
// isEnough
// })
// 在此之前需要校验用户是否登录,以及商品库存是否充足
wx
.
navigateTo
({
url
:
'/pages/pay/order-input/order-input?type=5'
+
'&amount='
+
this
.
data
.
amountPay
})
},
handleItemAllCheck
()
{
...
...
@@ -277,12 +297,6 @@ Page({
let
cart
=
this
.
data
.
cart
cart
.
forEach
(
v
=>
v
.
checked
=
allChecked
)
},
handleOrderPay
()
{
let
isEnough
=
true
this
.
setData
({
isEnough
})
},
handleBackCart
()
{
let
isEnough
=
false
this
.
setData
({
...
...
pages/commodity/shopping-cart/shopping-cart.wxml
View file @
42506e46
...
...
@@ -2,7 +2,7 @@
<view class="container">
<view class="shop-info row align-c">
<image mode="aspectFill" src="{{resourcesBase + 'commodity/' + shopLogo}}" />
<image
wx:if="{{shopLogo}}"
mode="aspectFill" src="{{resourcesBase + 'commodity/' + shopLogo}}" />
<text bindtap="onClearn">清空</text>
</view>
...
...
@@ -28,12 +28,12 @@
<view class="list-item-price" wx:if="{{item.priceType === 1}}">
<view class="list-item-price-main row align-c">
<text>¥</text>
<text>{{item.priceDiscount}}</text>
<text>{{item.priceDiscount
Text
}}</text>
<text class="price-discount">活动价</text>
</view>
<view class="list-item-price-minor row">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
</view>
</view>
...
...
@@ -41,12 +41,12 @@
<view class="list-item-price" wx:if="{{item.priceType === 2}}">
<view class="list-item-price-main row align-c">
<text>¥</text>
<text>{{item.priceSpecial}}</text>
<text>{{item.priceSpecial
Text
}}</text>
<text class="price-special">业主价</text>
</view>
<view class="list-item-price-minor row">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
</view>
</view>
...
...
@@ -54,7 +54,7 @@
<view class="list-item-price" wx:if="{{item.priceType === 3}}">
<view class="list-item-price-main row align-c">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
<text></text>
</view>
<view class="list-item-price-minor row">
...
...
@@ -106,7 +106,7 @@
<text>{{'共' + selectionTotal + '件,优惠 ¥' + amountDiscount}}</text>
</view>
</view>
<view class="order_pay_wrap row con-c align-c" bindtap="
handleOrderPay
">结算</view>
<view class="order_pay_wrap row con-c align-c" bindtap="
onPaySubmit
">结算</view>
<!-- 库存提示弹窗 -->
<l-popup show="{{isEnough}}" content-align="center" locked="{{true}}">
<view class="popup_wrap">
...
...
pages/commodity/snacks/snacks.js
View file @
42506e46
...
...
@@ -93,10 +93,13 @@ Page({
let
funcItem
=
{
'id'
:
funcResponse
[
i
].
id
,
'name'
:
funcResponse
[
i
].
name
,
'cover'
:
funcResponse
[
i
].
coverImg
,
// 商品封面
'price'
:
funcResponse
[
i
].
sightseerPrice
,
// 普通价
'priceSpecial'
:
funcResponse
[
i
].
ownerPrice
,
// 业主价
'priceDiscount'
:
funcResponse
[
i
].
price
,
// 活动价
'cover'
:
funcResponse
[
i
].
coverImg
,
// 商品封面
'price'
:
funcResponse
[
i
].
sightseerPrice
,
// 普通价
'priceText'
:
App
.
modular
.
utils
.
formatAmount
(
funcResponse
[
i
].
sightseerPrice
),
// 普通价文本格式
'priceSpecial'
:
funcResponse
[
i
].
ownerPrice
,
// 业主价
'priceSpecialText'
:
App
.
modular
.
utils
.
formatAmount
(
funcResponse
[
i
].
ownerPrice
),
// 业主价文本格式
'priceDiscount'
:
funcResponse
[
i
].
price
,
// 活动价
'priceDiscountText'
:
App
.
modular
.
utils
.
formatAmount
(
funcResponse
[
i
].
price
),
// 活动价文本格式
'priceType'
:
1
,
'describe'
:
funcResponse
[
i
].
synopsis
,
'tags'
:
funcResponse
[
i
].
tags
,
...
...
@@ -162,7 +165,6 @@ Page({
let
funcResponse
=
response
.
data
funcItem
.
banner
=
funcResponse
.
imgs
.
split
(
'|'
)
funcItem
.
banner
.
pop
()
console
.
log
(
funcItem
.
banner
)
this
.
setData
({
commodityDetail
:
funcItem
,
winCommodityDetail
:
true
...
...
pages/commodity/snacks/snacks.wxml
View file @
42506e46
...
...
@@ -17,7 +17,7 @@
<scroll-view scroll-top="{{scrollTop}}" scroll-y class="right-content">
<view class="right-content-title">{{menuTitle}}</view>
<block wx:for="{{commodityList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="item row">
<view class="
commodity-
item row">
<view class="item-img" data-item="{{item}}" bindtap="onCommodityDetail">
<image src="{{item.cover}}" mode="widthFix"></image>
</view>
...
...
@@ -33,12 +33,12 @@
<view wx:if="{{item.priceType === 1}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.priceDiscount}}</text>
<text>{{item.priceDiscount
Text
}}</text>
<text class="item-price-discount">活动价</text>
</view>
<view class="item-info-old-price row align-c">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
</view>
</view>
...
...
@@ -46,12 +46,12 @@
<view wx:if="{{item.priceType === 2}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.priceSpecial}}</text>
<text>{{item.priceSpecial
Text
}}</text>
<text class="item-price-special">业主价</text>
</view>
<view class="item-info-old-price row align-c">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
</view>
</view>
...
...
@@ -59,7 +59,7 @@
<view wx:if="{{item.priceType === 3}}">
<view class="item-price row align-c">
<text>¥</text>
<text>{{item.price}}</text>
<text>{{item.price
Text
}}</text>
<text></text>
</view>
</view>
...
...
@@ -113,11 +113,11 @@
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.priceDiscount}}</text>
<text>{{commodityDetail.priceDiscount
Text
}}</text>
</view>
<view class="popup-price-old">
<text>¥</text>
<text>{{commodityDetail.price}}</text>
<text>{{commodityDetail.price
Text
}}</text>
</view>
</view>
...
...
@@ -128,11 +128,11 @@
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.priceSpecial}}</text>
<text>{{commodityDetail.priceSpecial
Text
}}</text>
</view>
<view class="popup-price-old">
<text>¥</text>
<text>{{commodityDetail.price}}</text>
<text>{{commodityDetail.price
Text
}}</text>
</view>
</view>
...
...
@@ -143,7 +143,7 @@
</view>
<view class="detail-price">
<text>¥</text>
<text>{{commodityDetail.price}}</text>
<text>{{commodityDetail.price
Text
}}</text>
</view>
</view>
...
...
pages/commodity/snacks/snacks.wxss
View file @
42506e46
...
...
@@ -48,6 +48,10 @@
padding: 0 32rpx 0 28rpx;
}
.right-content::-webkit-scrollbar {
width: 0;
}
.right-content-title {
height: 100rpx;
padding: 32rpx 0;
...
...
@@ -84,9 +88,10 @@
height: 48rpx;
}
.item {
.
commodity-
item {
width: 100%;
height: 250rpx;
min-height: 250rpx;
padding-bottom: 56rpx;
box-sizing: border-box;
}
...
...
pages/home/service/service.json
View file @
42506e46
{
"usingComponents"
:
{}
"usingComponents"
:
{}
}
\ No newline at end of file
pages/home/service/service.wxml
View file @
42506e46
<!--pages/home/service/service.wxml-->
<navigation class="navigation"></navigation>
<view class="container">
<view class="greetings_header">
<view class="greetings_title">Monica , 早上好!</view>
<image src="/image/cxms@2x.png" class="title_img"></image>
<view class="greetings_header_describe">这里有来自大自然的馈赠用心烹饪的美食</view>
</view>
<view class="greetings_body">
<swiper indicator-dots="true" style="height:1469rpx;">
<block wx:for="{{data}}">
<swiper-item >
<view class="service_store" style="background:{{item.bgc}}">
<image src="{{item.url}}" class="{{index == 0? 'store_img' : 'store_img1'}} "></image>
<view class="order_button">立即点餐</view>
</view>
<view class="service_store_shop">
<view class="service_store_shop_item" wx:for="{{4}}">
<image class="shop_img"></image>
<text class="shop_goods">炭烤猪肋排拼盘</text>
</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="service_item" style="margin-bottom:136rpx;">
<view style="padding-left:40rpx;" class="greetings_header_describe">您可以用最优惠的价格享受超级服务</view>
<view class="item_banner">
<image style="z-index:-1;" class="item_banner_img" src="{{imageBase + 'commodity/home-head.png'}}"></image>
<view class="goods_buy">立即选购</view>
</view>
<view class="item_container">
<image wx:for="{{3}}" class="items_img"></image>
</view>
</view>
<view class="service_item">
<view style="padding-left:40rpx;white-space:pre-wrap" class="greetings_header_describe">尽情玩耍
随时为你补充能量</view>
<view class="item_banner" style="background: #E8F1F6;text-align:center;z-index:-1;height:512rpx;">
<image style="width:312rpx;height:56rpx;margin-top:152rpx;" src="{{imageBase + 'commodity/home-title-1.png'}}"></image>
<view>
<image style="width:148rpx;height:16rpx;margin-top:8rpx;" src="{{imageBase + 'commodity/home-tip-1.png'}}"></image>
</view>
</view>
<view class="item_container">
<view style="margin-bottom:64rpx;" wx:for="{{2}}">
<image class="items_img" style="margin-bottom:0;"></image>
<view class="items_text">儿童营地接待区</view>
</view>
</view>
</view>
<view class="service_item">
<image style="margin-left:40rpx;" src="/image/wcsc@2x.png" class="title_img"></image>
<view style="padding-left:40rpx;white-space:pre-wrap" class="greetings_header_describe">可以为家人、朋友
准备一份精心的礼物</view>
<view class="greetings_body">
<swiper indicator-dots="true" style="height:1469rpx;">
<block wx:for="{{data1}}">
<swiper-item >
<view class="service_store">
<image src="{{item.url}}" class="item_banner_img"></image>
<view style="width:750rpx;height:382rpx;"></view>
<view style="background:{{index== 0 ?'#C93120' : '#BD5B66' }} ;color: #FAF0DF;" class="order_button">立即选购</view>
</view>
<view class="service_store_shop">
<view class="service_store_shop_item" wx:for="{{4}}">
<image class="shop_img"></image>
<text class="shop_goods">炭烤猪肋排拼盘</text>
</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<view class="service_item">
<view style="padding-left:40rpx;white-space:pre-wrap;width:472rpx;" class="greetings_header_describe">滨海温泉院墅
足不出户即可享受滨海温泉</view>
<view style="position: relative;">
<image class="home_footer" src="{{imageBase + 'commodity/home-footer.png'}}"></image>
<view class="seeHouse">预约看房</view>
<view class="call" bindtap="call">拨打客服</view>
</view>
</view>
</view>
<!-- 客服热线 -->
<l-arc-popup show="{{hotline}}" arc-radius="30">
<view class="phone">{{phone}}</view>
<view class="call" bindtap="call">呼叫</view>
<view style="height:10rpx;background-color:rgb(246,247,249);"></view>
<view class="call" bindtap="cancel">取消</view>
</l-arc-popup>
pages/home/service/service.wxss
View file @
42506e46
/* pages/home/service/service.wxss */
.greetings_header{
padding-top: 196rpx;
padding-left: 46rpx;
width: 750rpx;
}
.greetings_title{
font-size: 58rpx;
font-weight: 500;
color: #15191F;
text-align: left;
}
.title_img{
width: 214rpx;
height: 50rpx;
margin-top: 128rpx;
}
.greetings_header_describe{
font-weight: 300;
color: #15191F;
margin-top: 12rpx;
width: 414rpx;
font-size: 34rpx;
line-height: 58rpx;
letter-spacing: 1px;
}
.greetings_body{
width: 750rpx;
height: height;
margin-top: 64rpx;
margin-bottom: 200rpx;
}
.service_store{
width: 750rpx;
height: 600rpx;
/* background: #586A46; */
text-align: center;
}
.store_img{
width: 178rpx;
height: 186rpx;
margin-top: 92rpx;
margin-bottom: 48rpx;
}
.store_img1{
width: 320rpx;
height: 120rpx;
margin-top: 134rpx;
margin-bottom: 72rpx;
}
.order_button{
background: #EBE2CE;
width: 200rpx;
height: 64rpx;
border-radius: 4rpx;
font-size: 26rpx;
font-weight: 500;
line-height: 64rpx;
color: #586A46;
margin: auto;
}
.service_store_shop{
width: 670rpx;
/* height: 932rpx; */
margin: auto;
margin-top: -100rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.service_store_shop_item{
width:328rpx;
height: 410rpx;
text-align: center;
margin-bottom: 48rpx;
}
.shop_img{
width: 328rpx;
height: 328rpx;
background-color: blue;
}
.shop_goods{
font-weight: 300;
color: #15191F;
line-height: 42px;
}
.service_item{
width: 750rpx;
height: auto;
/* margin-bottom: 136rpx; */
}
.item_banner{
width: 750rpx;
height: 600rpx;
margin-top: 64rpx;
position: relative;
/* background-color: red; */
}
.item_banner_img{
width: 750rpx;
height: 600rpx;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
.item_container{
width: 670rpx;
height: auto;
margin: auto;
margin-top: -100rpx;
}
.items_img{
width: 670rpx;
height: 328rpx;
background-color: blue;
margin-bottom: 64rpx;
}
.goods_buy{
position: absolute;
width: 200rpx;
height: 64rpx;
top: 308rpx;
left: 276rpx;
border-radius: 4px;
background: #86C5E1;
font-weight: 500;
color: #FFFFFF;
font-size: 26rpx;
line-height: 64rpx;
text-align: center;
}
.items_text{
text-align: center;
margin-top: 45rpx;
font-weight: 300;
color: #000000;
letter-spacing: 3px;
text-align: center;
line-height: 42rpx;
}
.home_footer{
width: 750rpx;
height:1640rpx;
margin-top: 64rpx;
}
.seeHouse{
position: absolute;
background: #86C5E1;
border-radius: 4px;
top: 294rpx;
width: 200rpx;
height: 64rpx;
left: 276rpx;
line-height: 64rpx;
color: #FFFFFF;
font-size: 26rpx;
text-align: center;
font-weight: 500;
}
.call{
position: absolute;
top: 1310rpx;
width: 200rpx;
height: 64rpx;
background: #D0B08F;
left: 276rpx;
line-height: 64rpx;
color: #FFFFFF;
font-size: 26rpx;
text-align: center;
font-weight: 500;
}
pages/pay/order-input/order-input.js
View file @
42506e46
...
...
@@ -17,6 +17,10 @@ Page({
imageBase
:
App
.
globalData
.
appImageBase
,
animation
:
{},
shopId
:
''
,
shopName
:
''
,
shopLogo
:
''
,
orderType
:
1
,
// 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
formName
:
''
,
...
...
@@ -41,17 +45,7 @@ Page({
buyContentAmount
:
'36.00'
,
// 购买清单
shoppingCartList
:
[{
cover
:
''
,
name
:
'《海错图》超级豪华精致古风限量版折扇'
,
quantity
:
12
,
price
:
'60.50'
,
},
{
cover
:
''
,
name
:
'《海错图》主题画册'
,
quantity
:
12
,
price
:
'60.50'
,
}],
shoppingCartList
:
[],
noticeText
:
'购买须知'
,
...
...
@@ -71,16 +65,12 @@ Page({
// 购买人员信息
contactTitle
:
'填写购票人信息'
,
contactName
:
''
,
contactPhone
:
''
,
contactErrorName
:
''
,
contactErrorPhone
:
''
,
//
注册
信息
//
用户
信息
registerInfo
:
[],
// 立即支付
payAmount
:
'
59.00
'
,
payAmount
:
''
,
// 购买须知详情
noticeDetail
:
App
.
globalData
.
appResourcesBase
+
'pay/notice-detail.png'
,
...
...
@@ -101,6 +91,11 @@ Page({
onLoad
:
function
(
options
)
{
if
(
options
.
type
)
options
.
type
=
Number
(
options
.
type
)
if
(
options
.
passType
)
options
.
passType
=
Number
(
options
.
passType
)
if
(
options
.
amount
)
{
this
.
setData
({
payAmount
:
options
.
amount
})
}
// options.type = 7
// options.passType = 1
...
...
@@ -111,17 +106,21 @@ Page({
duration
:
700
,
timingFunction
:
'ease'
})
this
.
setShopInfo
()
this
.
setShoppingCartData
()
},
setView
:
function
()
{
this
.
setData
({
registerInfo
:
[
JSON
.
parse
(
JSON
.
stringify
(
logicData
.
registerInfoItem
))]
})
switch
(
logicData
.
option
.
type
)
{
case
1
:
let
funcList
=
[]
funcList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
logicData
.
registerInfoItem
)))
this
.
setData
({
orderType
:
logicData
.
option
.
type
,
buyContent
:
this
.
data
.
buyPass
[
logicData
.
option
.
passType
],
registerInfo
:
funcList
,
winBuyContent
:
true
,
// 购买内容
winShoppingCart
:
false
,
// 购买清单
...
...
@@ -280,75 +279,100 @@ Page({
})
},
/**
* 设置本店信息
* @function
* @param
* @returns
*/
setShopInfo
:
function
()
{
let
funcShopInfo
=
wx
.
getStorageSync
(
'shopInfoBuffer'
)
this
.
setData
({
shopId
:
funcShopInfo
.
id
,
shopName
:
funcShopInfo
.
name
,
shopLogo
:
funcShopInfo
.
logo
})
console
.
log
(
this
.
data
.
shopLogo
)
},
setShoppingCartData
:
function
()
{
// 读取上级页面的购物车数据,默认选中所有。
let
funcShoppingCart
=
wx
.
getStorageSync
(
'shoppingCartBuffer'
)
console
.
log
(
'funcShoppingCart'
,
JSON
.
stringify
(
funcShoppingCart
))
// 设置商品的最终提交价格,仅用于展示
for
(
let
i
=
0
,
l
=
funcShoppingCart
.
length
;
i
<
l
;
i
++
)
{
switch
(
funcShoppingCart
[
i
].
priceType
)
{
case
1
:
// 活动价
funcShoppingCart
[
i
].
priceConfirm
=
funcShoppingCart
[
i
].
priceDiscountText
break
case
2
:
// 业主价
funcShoppingCart
[
i
].
priceConfirm
=
funcShoppingCart
[
i
].
priceSpecialText
break
case
3
:
// 普通价
funcShoppingCart
[
i
].
priceConfirm
=
funcShoppingCart
[
i
].
priceText
break
}
}
onInputBlur
:
function
(
event
)
{
let
funcType
=
event
.
target
.
dataset
.
type
let
funcValue
=
event
.
detail
.
value
this
.
setData
({
shoppingCartList
:
funcShoppingCart
})
},
/**
* 设置对应的用户数据
* @function
* @param
* @returns
*/
setUserInfo
:
function
(
funcType
,
funcValue
,
funcIndex
,
funcMessage
)
{
let
funcRegisterInfo
=
this
.
data
.
registerInfo
switch
(
funcType
)
{
case
'name'
:
this
.
setData
({
formName
:
funcValue
})
funcRegisterInfo
[
funcIndex
].
name
=
funcValue
funcRegisterInfo
[
funcIndex
].
errorName
=
funcMessage
break
case
'phone'
:
this
.
setData
({
formPhone
:
funcValue
})
funcRegisterInfo
[
funcIndex
].
phone
=
funcValue
funcRegisterInfo
[
funcIndex
].
errorPhone
=
funcMessage
break
case
'idNum'
:
this
.
setData
({
formPhone
:
funcValue
})
case
'identity'
:
funcRegisterInfo
[
funcIndex
].
identity
=
funcValue
funcRegisterInfo
[
funcIndex
].
errorIdentity
=
funcMessage
break
}
this
.
inspectForm
()
this
.
setData
({
registerInfo
:
funcRegisterInfo
})
},
inspectForm
:
function
()
{
if
(
this
.
data
.
formName
===
''
)
{
this
.
setData
({
isSubmit
:
false
,
errorName
:
'请填写姓名'
})
}
else
{
this
.
setData
({
errorName
:
''
})
}
if
(
this
.
data
.
formPhone
===
''
)
{
this
.
setData
({
isSubmit
:
false
,
errorPhone
:
'请输入正确的手机号码'
})
}
else
if
(
this
.
data
.
formPhone
.
length
!=
11
)
{
this
.
setData
({
isSubmit
:
false
,
errorPhone
:
'请输入正确的手机号码'
})
}
else
{
this
.
setData
({
errorPhone
:
''
})
}
onInputBlur
:
function
(
event
)
{
console
.
log
(
event
)
let
funcType
=
event
.
target
.
dataset
.
type
let
funcIndex
=
event
.
target
.
dataset
.
index
let
funcValue
=
event
.
detail
.
value
if
(
this
.
data
.
formIdNum
===
''
)
{
this
.
setData
({
isSubmit
:
false
,
errorIdNum
:
'请输入正确的身份证号'
})
}
else
if
(
this
.
data
.
formIdNum
.
length
!=
16
)
{
this
.
setData
({
isSubmit
:
false
,
errorIdNum
:
'请输入正确的身份证号'
})
}
else
{
this
.
setData
({
errorIdNum
:
''
})
switch
(
funcType
)
{
case
'name'
:
this
.
setUserInfo
(
funcType
,
funcValue
,
funcIndex
,
App
.
modular
.
rule
.
item
(
'name'
,
funcValue
))
break
case
'phone'
:
this
.
setUserInfo
(
funcType
,
funcValue
,
funcIndex
,
App
.
modular
.
rule
.
item
(
'phone'
,
funcValue
))
break
case
'identity'
:
this
.
setUserInfo
(
funcType
,
funcValue
,
funcIndex
,
App
.
modular
.
rule
.
item
(
'identity'
,
funcValue
))
break
}
this
.
setData
({
isSubmit
:
true
})
},
/**
...
...
@@ -428,17 +452,103 @@ Page({
return
}
let
funcRegisterInfo
=
this
.
data
.
registerInfo
funcRegisterInfo
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
logicData
.
registerInfoItem
)))
this
.
setData
({
quantity
:
this
.
data
.
quantity
+
1
quantity
:
this
.
data
.
quantity
+
1
,
registerInfo
:
funcRegisterInfo
})
},
if
(
this
.
data
.
orderType
===
1
)
{
let
funcRegisterInfo
=
this
.
data
.
registerInfo
funcRegisterInfo
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
logicData
.
registerInfoItem
)))
/**
* 检验数据是否都通过
* @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
!==
''
)
{
funcPass
=
false
break
}
this
.
setData
({
registerInfo
:
funcRegisterInfo
})
if
(
funcRegisterInfo
[
i
].
phone
===
''
||
funcRegisterInfo
[
i
].
errorPhone
!==
''
)
{
funcPass
=
false
break
}
// 仅在需要的订单场景下校验
if
([
1
].
indexOf
(
this
.
data
.
orderType
)
>=
0
)
{
if
(
funcRegisterInfo
[
i
].
identity
===
''
||
funcRegisterInfo
[
i
].
errorIdentity
!==
''
)
{
funcPass
=
false
break
}
}
}
return
funcPass
},
/**
* 提交订单
* @function
* @param
* @returns
*/
onPaySubmit
:
function
()
{
// 数据校验不通过
if
(
!
this
.
inspectData
())
return
// 整合商品数据
let
funcCommodity
=
[]
let
funcShoppingCartList
=
this
.
data
.
shoppingCartList
for
(
let
i
=
0
,
l
=
funcShoppingCartList
.
length
;
i
<
l
;
i
++
)
{
let
funcItem
=
{
'smCommodity'
:
{
'id'
:
funcShoppingCartList
[
i
].
id
,
},
'smInventory'
:
{
'id'
:
''
,
},
'goodType'
:
''
,
'name'
:
funcShoppingCartList
[
i
].
name
,
'number'
:
funcShoppingCartList
[
i
].
quantity
,
'unitPrice'
:
Number
(
funcShoppingCartList
[
i
].
priceConfirm
),
'totalPrices'
:
funcShoppingCartList
[
i
].
quantity
*
Number
(
funcShoppingCartList
[
i
].
priceConfirm
)
}
funcCommodity
.
push
(
funcItem
)
}
// 整合用户数据
let
funcUserInfo
=
[]
let
funcRegisterInfo
=
this
.
data
.
registerInfo
for
(
let
i
=
0
,
l
=
funcRegisterInfo
.
length
;
i
<
l
;
i
++
)
{
let
funcItem
=
{
'name'
:
funcRegisterInfo
[
i
].
name
,
'cellphone'
:
funcRegisterInfo
[
i
].
phone
,
'identityCard'
:
funcRegisterInfo
[
i
].
identity
,
}
funcUserInfo
.
push
(
funcItem
)
}
return
// 发送下单请求
App
.
wxRequest
({
url
:
'/api/v1/order/doOrder'
,
data
:
{
'isPayment'
:
2
,
'totalMoney'
:
Number
(
this
.
data
.
payAmount
),
'office'
:
{
'id'
:
this
.
data
.
shopId
},
'smOrderDetails'
:
funcCommodity
,
'smPersonalDetails'
:
funcUserInfo
},
success
:
(
response
)
=>
{
let
funcResponse
=
response
.
data
}
})
},
})
\ No newline at end of file
pages/pay/order-input/order-input.wxml
View file @
42506e46
...
...
@@ -106,14 +106,14 @@
<text>{{item.name}}</text>
</view>
<view class="shopping-cart-item-info col">
<text>
¥123
</text>
<text>
x3
</text>
<text>
{{'¥' + item.priceConfirm}}
</text>
<text>
{{'x' + item.quantity}}
</text>
</view>
</view>
</block>
<view class="shopping-cart-total row con-b align-c">
<text>总计</text>
<text>
¥181.80
</text>
<text>
{{'¥' + payAmount}}
</text>
</view>
</view>
</view>
...
...
@@ -195,13 +195,13 @@
</view>
<view class="contact-input col">
<text>姓名</text>
<input placeholder="请输入姓名"></input>
<text>{{
contactE
rrorName}}</text>
<input placeholder="请输入姓名"
data-type="name" data-index="{{0}}" bindblur="onInputBlur"
></input>
<text>{{
registerInfo[0].e
rrorName}}</text>
</view>
<view class="contact-input col">
<text>手机号</text>
<input placeholder="请输入手机号"></input>
<text>{{
contactE
rrorPhone}}</text>
<input placeholder="请输入手机号"
maxlength="11" data-type="phone" data-index="{{0}}" bindblur="onInputBlur"
></input>
<text>{{
registerInfo[0].e
rrorPhone}}</text>
</view>
</view>
...
...
@@ -221,17 +221,17 @@
</view>
<view class="contact-input col">
<text>姓名</text>
<input placeholder="请输入姓名"></input>
<input placeholder="请输入姓名"
data-type="name" data-index="{{index}}" bindblur="onInputBlur"
></input>
<text>{{item.errorName}}</text>
</view>
<view class="contact-input col">
<text>手机号</text>
<input placeholder="请输入手机号"></input>
<input placeholder="请输入手机号"
maxlength="11" data-type="phone" data-index="{{index}}" bindblur="onInputBlur"
></input>
<text>{{item.errorPhone}}</text>
</view>
<view class="contact-input col">
<text>身份证号</text>
<input placeholder="请输入身份证号"></input>
<input placeholder="请输入身份证号"
data-type="identity" data-index="{{index}}" bindblur="onInputBlur"
></input>
<text>{{item.errorIdentity}}</text>
</view>
</block>
...
...
@@ -246,13 +246,11 @@
</cover-view>
<cover-view class="pay-operation row con-b align-c">
<cover-view class="pay-operation-amount row con-c align-c">{{'¥' + payAmount}}</cover-view>
<cover-view class="pay-operation-confirm row con-c align-c">立即支付</cover-view>
<cover-view class="pay-operation-confirm row con-c align-c"
bindtap="onPaySubmit"
>立即支付</cover-view>
</cover-view>
</cover-view>
<!-- winButtonAppointment -->
<cover-view class="appointment row con-c align-c" wx:if="{{winButtonAppointment && !winNoticeDetail}}">
<cover-view class="appointment-confirm row con-c align-c">确认预约</cover-view>
</cover-view>
<!-- <cover-view class="iphonexr-fill"></cover-view> -->
\ No newline at end of file
</cover-view>
\ No newline at end of file
pages/pay/order-input/order-input.wxss
View file @
42506e46
...
...
@@ -865,15 +865,4 @@
color: #959da9;
font-size: 26rpx;
line-height: 44rpx;
}
/* iphone x 底部颜色填充 */
.iphonexr-fill {
z-index: -1;
position: fixed;
bottom: 0;
left: 0;
width: 750rpx;
height: 68rpx;
background: #FFFFFF;
}
\ No newline at end of file
utils/rule/rule-key.js
View file @
42506e46
...
...
@@ -104,21 +104,6 @@ let Output = {
}
return
funMessage
},
/**
* 顾问
* @function
* @param {string} value
* @returns {string}
*/
'adviser'
:
function
(
value
)
{
let
funMessage
=
''
// let funcScene = wx.getStorageSync('scene')
// if (funcScene.type !== 2 && value.name === '未知') {
// funMessage = '请选择顾问'
// }
return
funMessage
},
}
export
default
Output
\ No newline at end of file
utils/utils.js
View file @
42506e46
...
...
@@ -16,7 +16,20 @@ let output = {
if
(
funcElementHeightPx
<
funcCapsuleHeight
)
{
return
(
funcCapsuleHeight
-
funcElementHeightPx
)
/
2
+
funcStatusHeight
-
4
*
funcUnitProportion
}
}
},
/**
* 金额格式化函数
* @function
* @param {number} - funcAmountValue 金额,单位分
* @returns
*/
formatAmount
:
function
(
funcAmountValue
)
{
if
(
funcAmountValue
===
0
)
funcAmountValue
=
'000'
if
(
!
funcAmountValue
)
return
return
funcAmountValue
.
toString
().
replace
(
/
([
0-9
]{2})
$/
,
'.$1'
)
},
}
export
default
output
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment