Commit 23943668 by 严立

LL - 订单支付

parent b92a75d6
......@@ -116,25 +116,26 @@ App({
this.wxRequest({
url: '/api/v1/login/getSmallSession?code=' + res.code,
method: 'GET',
success: function (res) {
console.log(res)
that.globalData.token = res.data.token
that.globalData.refreshToken = res.data.refreshToken
wx.setStorageSync('expires_in', res.data.expires_in)
wx.setStorageSync('openid', res.data.openid)
wx.setStorageSync('session_key', res.data.session_key)
wx.setStorageSync('mobile', res.data.mobile)
wx.setStorageSync('nickName', res.data.nickName)
wx.setStorageSync('avatarUrl', res.data.avatarUrl)
wx.setStorageSync('userType', res.data.userType) // 0 游客 1 业主
wx.setStorageSync('sex', res.data.sex)
wx.setStorageSync('birthday', res.data.birthday)
wx.setStorageSync('address', res.data.address)
success: (response) => {
let funcResponse = response.data
this.globalData.token = funcResponse.token
this.globalData.refreshToken = funcResponse.refreshToken
let funcUserInfo = {
'openId': funcResponse.openid,
'name': funcResponse.nickName,
'phone': funcResponse.mobile,
'avatar': funcResponse.avatarUrl,
'address': funcResponse.address,
'birthday': funcResponse.birthday,
'sex': funcResponse.sex,
'userType': Number(funcResponse.userType),
}
wx.setStorageSync('userInfo', funcUserInfo)
if (obj.success) {
obj.success(res.data.token)
obj.success(funcResponse.token)
}
},
})
......
......@@ -32,7 +32,7 @@
"pages/campsite/home/home",
"pages/campsite/home-mirror/home-mirror",
"pages/mine/home/home",
"pages/mine/info/info",
"pages/mine/order/order",
......@@ -48,12 +48,14 @@
"pages/pay/home/home",
"pages/pay/order-input/order-input",
"pages/pay/order-state/order-state",
"pages/pay/order-detail/order-detail",
"pages/pay/coupon/coupon",
"pages/pay/coupon-input/coupon-input",
"pages/pay/coupon-detail/coupon-detail",
"pages/login/login"
],
"usingComponents": {
"navigation": "../component/navigation/navigation",
......@@ -99,22 +101,26 @@
"iconPath": "image/tabbar/home.png",
"selectedIconPath": "image/tabbar/home-s.png",
"text": "首页"
}, {
},
{
"pagePath": "pages/play/home/home",
"iconPath": "image/tabbar/play.png",
"selectedIconPath": "image/tabbar/play-s.png",
"text": "畅玩"
}, {
},
{
"pagePath": "pages/commodity/home/home",
"iconPath": "image/tabbar/play.png",
"selectedIconPath": "image/tabbar/play-s.png",
"text": "服务"
},{
},
{
"pagePath": "pages/campsite/home/home",
"iconPath": "image/tabbar/campsite.png",
"selectedIconPath": "image/tabbar/campsite-s.png",
"text": "营地"
}, {
},
{
"pagePath": "pages/mine/home/home",
"iconPath": "image/tabbar/mine.png",
"selectedIconPath": "image/tabbar/mine-s.png",
......
......@@ -27,18 +27,6 @@ Component({
type: String,
value: ''
},
fontSize: {
type: Number,
value: 34
},
iconWidth: {
type: Number,
value: 58
},
iconHeight: {
type: Number,
value: 19
},
// 标题栏滚动指定位置动态变换颜色属性
// 优先级高于 background 属性
......@@ -132,6 +120,8 @@ Component({
* @returns
*/
setNavigationStyle: function () {
let funcUnitProportion = wx.getStorageSync('unitProportion')
let funcStatusStyle = {
'height': this.data.statusHeight + 'px',
'background': this.data.background,
......@@ -153,21 +143,25 @@ Component({
}
let funcTextStyle = {
'font-size': this.data.fontSize + 'rpx',
'color': this.data.color,
}
let funcIconStyle = {
'width': this.data.iconWidth + 'px',
'height': this.data.iconHeight + 'px',
'width': 52 * funcUnitProportion + 'px',
'height': 52 * funcUnitProportion + 'px',
'margin-right': 8 * funcUnitProportion + 'px',
}
this.setData({
statusCss: App.cssObjectToCssString(funcStatusStyle),
titleCss: App.cssObjectToCssString(funcTitleStyle),
textCss: App.cssObjectToCssString(funcTextStyle),
iconCss: App.cssObjectToCssString(funcIconStyle),
})
console.log(this.data.iconCss)
},
/**
......
<view class="navigation">
<!-- 状态栏 -->
<view id="status" class='status' style="{{statusCss}}"></view>
<view class="status" style="{{statusCss}}"></view>
<!-- 标题栏 -->
<view id="navbar" class='title' style="{{titleCss}}">
<view class='back-icon' wx:if="{{backIcon}}" bindtap='onBack'>
<image src='{{backIcon}}'></image>
<view class="navbar" style="{{titleCss}}">
<view class="navbar-operation">
<image class="navbar-operation-back" style="{{iconCss}}" src="{{backIcon}}" bindtap='onBack'></image>
<image class="navbar-operation-home" style="{{iconCss}}" src="{{homeIcon}}" bindtap='onHome'></image>
</view>
<view class='home-icon' wx:if="{{homeIcon}}" bindtap='onHome'>
<image src='{{homeIcon}}'></image>
<view class="title-text" style="{{titleCss}}" wx:if="{{titleText && !titleImg}}">
<text style="{{textCss}}">{{titleText}}</text>
</view>
<view class='title-icon' wx:if="{{titleImg}}">
<image src='{{titleImg}}' style='{{iconCss}}'></image>
</view>
<view class='title-text' style="{{titleCss}}" wx:if="{{titleText && !titleImg}}">
<text style='{{textCss}}'>{{titleText}}</text>
<view class="navbar-operation">
</view>
</view>
</view>
\ No newline at end of file
.navigation {
.navbar {
z-index: 2000;
}
.status {
width: 750rpx;
}
.title {
position: relative;
}
.back-icon,
.home-icon {
z-index: 1900;
width: 28px;
height: 100%;
position: absolute;
transform: translateY(-50%);
top: 50%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.back-icon {
left: 16px;
}
.home-icon {
left: 44px
}
.back-icon image {
width: 28px;
height: 28px;
margin: auto;
}
.home-icon image {
width: 20px;
height: 20px;
margin: auto;
}
.title-icon {
.navbar-operation {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 200rpx;
}
.navbar-operation-back,
.navbar-operation-home {
display: block;
}
.title-text {
......@@ -53,7 +23,8 @@
flex-direction: row;
justify-content: center;
align-items: center;
position: absolute;
width: 750rpx;
font-weight: bold;
}
.title-text text {
font-size: 14px;
}
\ No newline at end of file
let Environmental = 'dev'
let Development = {
host: 'https://sm-web.meiqicloud.com',
// 景点信息
pointInfo: [
{ appId: 1, id: '21a0cbbd39604380bc46fba38ac5fb63', name: '海错图' },
{ appId: 2, id: '29e79743f0f94e5eb726e0ebdfe64248', name: '星空影院' },
{ appId: 3, id: '559d980e9eaf4459883fb3a556d24347', name: '儿童营地' },
{ appId: 4, id: '81078c007c034d46b7dfe59935d84f7a', name: '原野MOJITO' },
{ appId: 5, id: 'b8f04379bf164b7f8bca69be14146a17', name: '拾光花坊' },
{ appId: 6, id: 'd0e5ff414f794e15bc33c4e11f5356a8', name: '原味舒食' },
{ appId: 7, id: 'd8922a8f759245d4949b62693099edb5', name: '元养水韵SPA' },
],
// 门店信息
shopId: [
{
miniAppId: 1,
databaseId: '581be62a80bb4f0485abd87abcf64dc0',
name: '海错图1号馆',
logo: 'shopping-cart-logo-4.png',
}, {
miniAppId: 2,
databaseId: '26c40446fc454a02abe61758176597f6',
name: '拾光花坊',
logo: 'shopping-cart-logo-7.png',
}, {
miniAppId: 3,
databaseId: '2614f117406548718bc091f24368c16e',
name: '元养水韵SPA',
logo: '',
}, {
miniAppId: 4,
databaseId: 'd9436d7018de43809824b6ec221ea01f',
name: '原味舒食',
logo: 'shopping-cart-logo-1.png',
}, {
miniAppId: 5,
databaseId: 'c63893bb472f43bca4ec72f890bcb4fd',
name: '原野MOJITO',
logo: '',
}, {
miniAppId: 6,
databaseId: '3cfe2e3b8b4342e8b62f8b45daf60d91',
name: '5D星空影院',
logo: '',
}, {
miniAppId: 7,
databaseId: '8a3e59c57f564c569b3d7bb278ea50b3',
name: '儿童营地',
logo: 'shopping-cart-logo-6.png',
}
{ appId: 1, id: '581be62a80bb4f0485abd87abcf64dc0', name: '海错图', logo: 'shopping-cart-logo-4.png', title: ['', '海错图购票', '11', '海错图文创店', '22', '儿童营地接待区', '33'] },
{ appId: 2, id: '3cfe2e3b8b4342e8b62f8b45daf60d91', name: '星空影院', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] },
{ appId: 3, id: '8a3e59c57f564c569b3d7bb278ea50b3', name: '儿童营地', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '11', '1', '1', '儿童营地接待区', '1'] },
{ appId: 4, id: 'c63893bb472f43bca4ec72f890bcb4fd', name: '原野MOJITO', logo: 'shopping-cart-logo-6.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
{ appId: 5, id: '26c40446fc454a02abe61758176597f6', name: '拾光花坊', logo: 'shopping-cart-logo-7.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
{ appId: 6, id: 'd9436d7018de43809824b6ec221ea01f', name: '原味舒食', logo: 'shopping-cart-logo-1.png', title: ['', '儿童营地入园购票', '1', '1', '1', '原味舒食', '1'] },
{ appId: 7, id: '2614f117406548718bc091f24368c16e', name: '元养水韵SPA', logo: 'shopping-cart-logo-7.png', title: ['', '儿童营地入园购票', '1', '1', '1', '儿童营地接待区', '1'] },
]
}
......
......@@ -6,18 +6,70 @@ Page({
* 页面的初始数据
*/
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' },
],
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
phone: '13316748039',
hotline: false, //客服热线
},
onGoShop: function (event) {
let funcShopType = event.currentTarget.dataset.type
let funcShopAppId = event.currentTarget.dataset.id
// 获取门店基本信息
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,
'shopType': funcShopType,
}
wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break
}
}
// 1 - 年卡月卡,2 - 普通商品,3 - 门票商品,4 - 文创商品,5 - 餐品,6 - 积分商品
switch (funcShopType) {
case 1:
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
})
break
case 4:
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
})
break
case 5:
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
})
break
}
},
/**
* 跳转门票页面
* @function
* @param {object} - event
* @returns
*/
onMemberList: function (event) {
},
onReceptionList: function (event) {
},
//客服热线拨打
call() {
wx.makePhoneCall({
......
......@@ -17,16 +17,6 @@
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;
......@@ -191,3 +181,179 @@
text-align: center;
font-weight: 500;
}
.title {
width: 750rpx;
height: 280rpx;
}
.title image {
width: 750rpx;
height: 80rpx;
}
/* 商店样式 */
.shop,
swiper {
width: 750rpx;
min-height: 1444rpx;
}
.shop-name image {
width: 670rpx;
height: 60rpx;
}
.shop-title {
width: 670rpx;
height: 172rpx;
margin: 32rpx 40rpx 0 40rpx;
}
.shop-title text {
font-size: 34rpx;
font-weight: 300;
line-height: 64rpx;
color: #15191F;
}
.shop-banner {
position: relative;
}
.shop-banner > image {
width: 750rpx;
height: 600rpx;
}
.shop-banner > button {
position: absolute;
top: 330rpx;
width: 204rpx;
height: 120rpx;
background: rgba(0, 0, 0, 0);
font-size: 26rpx;
font-weight: 500;
line-height: 36rpx;
color: #586A46;
}
.shop-menu {
position: relative;
top: -100rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
flex-direction: row;
margin: 0 40rpx;
}
.shop-menu-item > image {
display: block;
width: 328rpx;
height: 328rpx;
background: #999999;
}
.shop-menu-item > text {
display: block;
margin: 40rpx 0 48rpx 0;
font-size: 30rpx;
font-weight: 300;
line-height: 42rpx;
color: #15191F;
}
/* 项目服务样式 */
.services {
margin-top: 200rpx;
}
.services-title {
width: 670rpx;
height: 172rpx;
}
.services-title text {
font-size: 34rpx;
font-weight: 300;
line-height: 64rpx;
color: #15191F;
}
.services-banner image {
display: block;
width: 750rpx;
height: 600rpx;
}
.services-item {
margin-bottom: 64rpx;
}
.services-list {
position: relative;
top: -164rpx;
}
.services-list-item {
margin-top: 64rpx;
}
.services-list-item > image {
display: block;
width: 670rpx;
height: 329rpx;
border-radius: 4px;
}
/* 能量补给站样式 */
.reception-title {
width: 670rpx;
height: 172rpx;
}
.reception-title text {
font-size: 34rpx;
font-weight: 300;
line-height: 64rpx;
color: #15191F;
}
.reception-banner image {
display: block;
width: 750rpx;
height: 512rpx;
}
.reception-item {
margin-bottom: 64rpx;
}
.reception-list {
position: relative;
top: -164rpx;
}
.reception-list-item {
margin-top: 64rpx;
}
.reception-list-item > image {
display: block;
width: 670rpx;
height: 329rpx;
border-radius: 4px;
}
.reception-list-item > text {
height: 42rpx;
margin-top: 48rpx;
font-size: 30rpx;
font-weight: 300;
line-height: 42rpx;
color: #000000;
}
\ No newline at end of file
......@@ -2,9 +2,8 @@ let App = getApp()
Page({
data: {
shopId: '',
shopName: '',
shopLogo: '',
shopInfo: {},
sideBar: [], // 侧边菜单
menuTitle: '', // 商品列表标题
commodityList: [], // 商品列表
......@@ -23,22 +22,18 @@ Page({
},
onLoad: function () {
// 儿童营地小程序内部 id
let funcMiniAppId = 7
let funcShopId = App.globalData.shopId
for (let i = 0, l = funcShopId.length; i < l; i++) {
if (funcMiniAppId === funcShopId[i].miniAppId) {
this.setData({
shopId: funcShopId[i].databaseId,
shopName: funcShopId[i].name,
shopLogo: funcShopId[i].logo,
})
break
}
}
this.setShopInfo()
this.querySideBar()
},
setShopInfo: function () {
let funcShopInfo = wx.getStorageSync('shopInfoBuffer')
this.setData({
shopInfo: funcShopInfo
})
console.log(this.data.shopInfo)
},
/**
* 查询分类
* @function
......@@ -49,8 +44,8 @@ Page({
App.wxRequest({
url: '/api/v1/commodity/getClassifys',
data: {
'officeId': this.data.shopId,
'genre': 5
'officeId': this.data.shopInfo.id,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcSideBar = []
......@@ -61,6 +56,16 @@ Page({
'tab': funcResponse[i].name,
}
funcSideBar.push(funcItem)
funcSideBar.push({ id: '1', tab: '2' })
funcSideBar.push({ id: '1', tab: '3' })
funcSideBar.push({ id: '1', tab: '4' })
funcSideBar.push({ id: '1', tab: '5' })
funcSideBar.push({ id: '1', tab: '6' })
funcSideBar.push({ id: '1', tab: '7' })
funcSideBar.push({ id: '1', tab: '8' })
funcSideBar.push({ id: '1', tab: '9' })
funcSideBar.push({ id: '1', tab: '10' })
funcSideBar.push({ id: '1', tab: '11' })
}
this.setData({
......@@ -86,16 +91,18 @@ Page({
App.wxRequest({
url: '/api/v1/commodity/getCommoditys',
data: {
'officeId': this.data.shopId,
'officeId': this.data.shopInfo.id,
'classifyId': this.data.sideBar[this.data.currentIndex].id,
'genre': 5,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcCommodityList = []
let funcResponse = response.data
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].id,
'id': funcResponse[i].id, // 商品标识
'typeId': funcResponse[i].classifyId, // 商品分类标识
'inventoriesId': funcResponse[i].inventoriesId, // 仓库标识
'name': funcResponse[i].name,
'cover': funcResponse[i].coverImg, // 商品封面
'price': funcResponse[i].sightseerPrice, // 普通价
......@@ -109,13 +116,14 @@ Page({
'tags': funcResponse[i].tags,
}
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (funcItem.priceDiscount) {
funcItem.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (funcItem.price !== funcItem.priceSpecial) {
if (funcItem.price !== funcItem.priceSpecial && funcUserType) {
funcItem.priceType = 2
} else {
funcItem.priceType = 3
......@@ -158,13 +166,13 @@ Page({
*/
onCommodityDetail: function (event) {
let funcItem = event.currentTarget.dataset.item
let funcCommodityId = funcItem.id
App.wxRequest({
url: '/api/v1/commodity/getCommodityParticulars',
data: {
'commodityId': funcCommodityId,
'genre': 5
'commodityId': funcItem.id,
'classifyId': funcItem.typeId,
'genre': this.data.shopInfo.shopType,
},
success: (response) => {
let funcResponse = response.data
......@@ -200,8 +208,10 @@ Page({
let funcShoppingCart = this.data.shoppingCart
// 详情加入购物车按钮商品数据不会存在于 event 对象中,所以要区分
let funcWinToast = false
let funcItem = event.currentTarget.dataset.item
if (!funcItem) {
funcWinToast = true
funcItem = this.data.commodityDetail
}
......@@ -233,7 +243,7 @@ Page({
this.setData({
shoppingCart: funcShoppingCart,
shoppingCartTotal: funcShoppingCartTotal,
winToast: true,
winToast: funcWinToast,
winCommodityDetail: false,
})
},
......@@ -245,7 +255,6 @@ Page({
* @returns
*/
onShoppingCart: function() {
wx.setStorageSync('shopInfoBuffer', { 'id': this.data.shopId, 'name': this.data.shopName, 'logo': this.data.shopLogo })
wx.setStorageSync('shoppingCartBuffer', this.data.shoppingCart)
wx.navigateTo({
url: '/pages/commodity/shopping-cart/shopping-cart',
......
page {
overflow: hidden;
}
.navigation {
z-index: 1100;
position: fixed;
......@@ -6,18 +10,10 @@
width: 750rpx;
}
.cates {
height: 100%;
margin-top: 150rpx;
}
.cates-container {
height: 100vh;
display: flex;
}
.side-bar {
width: 160rpx;
height: 100vh;
margin-top: 140rpx;
overflow-y: scroll;
background: #f2f3f5;
}
......@@ -42,10 +38,13 @@
border-left: 8rpx solid #86c5e1;
}
.right-content {
position: relative;
flex: 1;
padding: 0 32rpx 0 28rpx;
.menu-list {
width: 590rpx;
height: 100vh;
margin-top: 140rpx;
padding: 0 32rpx 200rpx 32rpx;
overflow-y: scroll;
background: #FFFFFF;
}
.right-content::-webkit-scrollbar {
......@@ -206,8 +205,8 @@
}
.popup-wrap {
position: relative;
width: 606rpx;
margin-top: 100rpx;
background-color: #fff;
border-radius: 4rpx;
}
......
......@@ -342,10 +342,4 @@ Page({
url: '/pages/pay/order-detail/order-detail?type=' + event.currentTarget.dataset.index
})
},
onShop: function (event) {
wx.navigateTo({
url: '/pages/commodity/menu-snacks/menu-snacks'
})
},
})
\ No newline at end of file
......@@ -92,8 +92,5 @@
<button class="test-button" data-index="{{3}}" bindtap="onTest3">订单 已取消</button>
<button class="test-button" data-index="{{4}}" bindtap="onTest3">订单 已评价</button>
<button class="test-button" data-index="{{5}}" bindtap="onTest3">订单 待付款</button>
<button class="test-button" data-shop="{{4}}" bindtap="onShop">餐品列表1111</button>
</view>
</view>
\ No newline at end of file
......@@ -129,7 +129,22 @@ Page({
winOrderType: false,
},
onLoad: function (options) {
this.queryOrder()
},
queryOrder: function () {
App.wxRequest({
url: '/api/v1/order/getOrderList',
data: {
'goodType': '',
'status': '',
'pageSize': -1,
'pageNo': '',
},
success: (response) => {
console.log(response)
}
})
},
onOrderType: function () {
......
......@@ -12,14 +12,15 @@ let logicData = {
}
}
let pagePayId = ''
let pagePayStateTimer = 0
Page({
data: {
imageBase: App.globalData.appImageBase,
animation: {},
shopId: '',
shopName: '',
shopLogo: '',
shopInfo: {},
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
......@@ -89,6 +90,11 @@ Page({
winNoticeDetail: false, // 购买须知详情
},
onLoad: function (options) {
// 设置门店信息
this.setData({
shopInfo: wx.getStorageSync('shopInfoBuffer')
})
if (options.type) options.type = Number(options.type)
if (options.passType) options.passType = Number(options.passType)
if (options.amount) {
......@@ -97,8 +103,6 @@ Page({
})
}
// options.type = 7
// options.passType = 1
logicData.option = options
this.setView()
......@@ -106,8 +110,6 @@ Page({
duration: 700,
timingFunction: 'ease'
})
this.setShopInfo()
this.setShoppingCartData()
},
......@@ -156,7 +158,7 @@ Page({
case 3:
this.setData({
orderType: logicData.option.type,
buyContentTitle: '肌底补水保湿焕肤提华SPA套餐',
buyContentTitle: this.data.shopInfo.name,
buyContentAmount: '360.00',
winBuyContent: true, // 购买内容
......@@ -175,7 +177,7 @@ Page({
case 4:
this.setData({
orderType: logicData.option.type,
buyContentTitle: '海错图文创商店',
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-12:00',
shoppingCartList: [{
cover: '',
......@@ -205,7 +207,7 @@ Page({
case 5:
this.setData({
orderType: logicData.option.type,
buyContentTitle: '原味舒食',
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30',
shoppingCartList: [{
cover: '',
......@@ -235,7 +237,7 @@ Page({
case 6:
this.setData({
orderType: logicData.option.type,
buyContentTitle: '拾光花坊插花分享会',
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '周一至周日 10:00-21:30',
buyContentAmount: '36.00',
......@@ -255,7 +257,7 @@ Page({
case 7:
this.setData({
orderType: logicData.option.type,
buyContentTitle: '《哈利波特与死亡圣器》',
buyContentTitle: this.data.shopInfo.name,
buyContentTime: '8月4日 19:30-21:30',
buyContentAmount: '免费',
......@@ -279,23 +281,6 @@ 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')
......@@ -512,9 +497,9 @@ Page({
'id': funcShoppingCartList[i].id,
},
'smInventory': {
'id': '',
'id': funcShoppingCartList[i].inventoriesId,
},
'goodType': '',
'goodType': funcShoppingCartList[i].typeId,
'name': funcShoppingCartList[i].name,
'number': funcShoppingCartList[i].quantity,
'unitPrice': Number(funcShoppingCartList[i].priceConfirm),
......@@ -534,7 +519,6 @@ Page({
}
funcUserInfo.push(funcItem)
}
return
// 发送下单请求
App.wxRequest({
......@@ -542,13 +526,81 @@ Page({
data: {
'isPayment': 2,
'totalMoney': Number(this.data.payAmount),
'office': { 'id': this.data.shopId },
'office': { 'id': this.data.shopInfo.id },
'smOrderDetails': funcCommodity,
'smPersonalDetails': funcUserInfo
},
success: (response) => {
let funcResponse = response.data
let funcResponse = response.data.wxRequest
pagePayId = response.data.orderId
wx.requestPayment({
'timeStamp': funcResponse.timeStamp,
'nonceStr': funcResponse.nonceStr,
'package': funcResponse.package,
'signType': funcResponse.signType,
'paySign': funcResponse.paySign,
'success': function (response) {
if (response.errMsg === 'requestPayment:ok') {
// 用户点击支付完成按钮回调
// This.payStatus(true)
}
if (response.errMsg === 'requestPayment:fail cancel') {
clearInterval(pagePayStateTimer)
this.payStatus(false)
}
},
'fail': function (response) {
clearInterval(pagePayStateTimer)
this.payStatus(false)
}
})
// 开启支付状态轮询
// wx.showLoading({ title: '正在获取数据', mask: true })
this.queryPayStatus(pagePayId)
}
})
},
queryPayStatus: function () {
let funcIndex = 0
pagePayStateTimer = setInterval(() => {
if (!pagePayId) return
App.wxRequest({
url: '/api/v1/order/getOrderStatus',
data: {
'orderId': pagePayId
},
success: (response) => {
console.log(response)
// -1 - 已取消,0 - 未付款,1 - 未发货,2 - 待使用,3 - 已使用,4 - 已过期
let funcResponse = response.data
if (funcResponse.status === '2') {
this.payStatus(true)
}
}
})
funcIndex = funcIndex + 1
if (funcIndex >= 90) {
this.payStatus(false)
}
}, 2000)
},
/**
* 支付状态轮询结果
* @function
* @returns
*/
payStatus: function (funcPayResult) {
clearInterval(pagePayStateTimer)
wx.navigateTo({
url: '/pages/pay/order-state/order-state?state=' + funcPayResult + '&amount=' + this.data.buyContentAmount
})
},
})
\ No newline at end of file
let App = getApp()
Page({
data: {
imageBase: App.globalData.appImageBase,
payState: '',
payAmount: 0,
},
onLoad: function (options) {
console.log(options)
if (options.state === 'true') {
this.setData({
payState: true,
payAmount: App.modular.utils.formatAmount(Number(options.amount * 100))
})
} else {
this.setData({
payState: false,
payAmount: App.modular.utils.formatAmount(Number(options.amount * 100))
})
}
},
onHome: function () {
wx.switchTab({
url: '/pages/home/home/home'
})
},
onPayDetail: function () {
},
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="container pay-result">
<view class="pay-result-content col con-c align-c">
<view class="content-state-icon">
<image wx:if="{{payState}}" src="{{imageBase + 'icon/pay-success.png'}}"></image>
<image wx:if="{{!payState}}" src="{{imageBase + 'icon/pay-fail.png'}}"></image>
</view>
<view class="content-state-message">
<text>{{payState ? '支付成功' : '支付失败'}}</text>
</view>
<view class="content-state-amount">
<text>¥</text>
<text>{{payAmount}}</text>
</view>
</view>
<view class="operation">
<button class="operation-home row con-c align-c" bindtap="onHome">返回首页</button>
<button class="operation-detail row con-c align-c" bindtap="onPayDetail">查看订单</button>
</view>
</view>
\ No newline at end of file
.pay-result {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100%;
}
.pay-result-content {
flex-grow: 1;
}
.content-state-icon image {
display: block;
width: 136rpx;
height: 136rpx;
}
.content-state-message {
margin-top: 24rpx;
}
.content-state-message text {
height: 64rpx;
font-size: 46rpx;
font-weight: 500;
line-height: 64rpx;
color: #15191F;
}
.content-state-amount {
margin-top: 8rpx;
}
.content-state-amount text:nth-child(1) {
height: 42rpx;
font-size: 22rpx;
font-weight: 500;
line-height: 32rpx;
color: #959DA9;
}
.content-state-amount text:nth-child(2) {
height: 42rpx;
font-size: 30rpx;
font-weight: 500;
line-height: 32rpx;
color: #959DA9;
}
.operation-home {
width: 670rpx;
height: 96rpx;
border-radius: 4px;
border: 1px solid #86C5E1;
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
color: #86C5E1;
}
.operation-detail {
width: 670rpx;
height: 96rpx;
margin: 40rpx 0 130rpx 0;
background: #86C5E1;
border-radius: 4px;
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
color: #FFFFFF;
}
\ No newline at end of file
/**
* unionId:
* scene: // 场景信息
* value: { scene: 0, value: '' }
* scene: 0 - 正常进入,1 - 无房源公众号进入,2 - 有房源扫码进入
* customerInfo:用户信息
* value:
*
*/
\ No newline at end of file
// 程序缓存关键字说明
// shopInfoBuffer: 门店详情信息
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