Commit 0e072b0e authored by qipeng's avatar qipeng

Merge branch 'develop' of http://git.tbd.yanzuoguang.com/panyongping/uni-pdtravel into develop

parents a9aa5d94 9de7d4dd
...@@ -139,12 +139,6 @@ ...@@ -139,12 +139,6 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "pages/payment/changeNumPayment/changeNumPayment",
"style": {
"navigationBarTitleText": "支付",
"enablePullDownRefresh": false
}
}, },
{ {
"path": "pages/indexs/center/center", "path": "pages/indexs/center/center",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<view class="middle"> <view class="middle">
<view class="tabbar"> <view class="tabbar">
<view @click="jumpPage(item.projectLinkUrl)" v-for="(item,index) in iconList" :key='index'> <view @click="jumpPage(item.projectLinkUrl)" v-for="(item,index) in iconList" :key='index' v-show="item.projectStatus==0">
<image :src="item.projectImgUrl"></image> <image :src="item.projectImgUrl"></image>
<view> <view>
{{item.merchantExtendProjectName}} {{item.merchantExtendProjectName}}
...@@ -181,7 +181,44 @@ export default { ...@@ -181,7 +181,44 @@ export default {
image: 'http://wx.pangdly.com/static/img/home3.df60ec3.jpg' image: 'http://wx.pangdly.com/static/img/home3.df60ec3.jpg'
} }
], ],
iconList:[],//图标列表 iconList:[//图标列表
{
merchantExtendProjectName:'景区名称',
projectImgUrl:'/static/img/index/classify1.png',
projectLinkUrl:'/pages/scenic/scenicIndex/scenicIndex',
projectStatus:0
},
{
merchantExtendProjectName:'酒店民宿',
projectImgUrl:'/static/img/index/classify2.png',
projectLinkUrl:'/pages/hotel/hotelIndex/hotelIndex',
projectStatus:0
},
{
merchantExtendProjectName:'周边游',
projectImgUrl:'/static/img/index/classify4.png',
projectLinkUrl:'/pages/scenic/scenicIndex/scenicIndex',
projectStatus:0
},
{
merchantExtendProjectName:'跟团游',
projectImgUrl:'/static/img/index/classify5.png',
projectLinkUrl:'/pages/scenic/scenicIndex/scenicIndex',
projectStatus:0
},
{
merchantExtendProjectName:'亲子游',
projectImgUrl:'/static/img/index/classify6.png',
projectLinkUrl:'/pages/scenic/scenicIndex/scenicIndex',
projectStatus:0
},
{
merchantExtendProjectName:'行程订制',
projectImgUrl:'/static/img/index/classify7.png',
projectLinkUrl:'/pages/my/travelList/travelList/travelList',
projectStatus:0
}
],
} }
}, },
onLoad(option){ onLoad(option){
...@@ -226,7 +263,7 @@ export default { ...@@ -226,7 +263,7 @@ export default {
} }
this.$request('scenic/merchantExtendProject/loadList',data).then((res)=>{ this.$request('scenic/merchantExtendProject/loadList',data).then((res)=>{
if(res.code=='00'){ if(res.code=='00'){
this.iconList=res.data||[] this.iconList=res.data
} }
}) })
}, },
......
...@@ -23,13 +23,12 @@ export default { ...@@ -23,13 +23,12 @@ export default {
methods:{ methods:{
//---登录 //---登录
login(){ login(){
let _this = this
uni.getProvider({ uni.getProvider({
service: 'oauth', service: 'oauth',
success(proRes) { success:proRes=>{
uni.login({ uni.login({
provider: proRes.provider[0], provider: proRes.provider[0],
success: function(res) { success:res=> {
if (res.code) { if (res.code) {
let source = '' let source = ''
if (proRes.provider[0] == 'weixin') { if (proRes.provider[0] == 'weixin') {
...@@ -45,13 +44,13 @@ export default { ...@@ -45,13 +44,13 @@ export default {
if(uni.getStorageSync('enterOptions').query){ if(uni.getStorageSync('enterOptions').query){
data.companyId=uni.getStorageSync('enterOptions').query.companyId||'' data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
} }
_this.$request('wechat/wx/getUserInfoByCode', data).then(res => { this.$request('wechat/wx/getUserInfoByCode', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
let openid = res.data.openid let openid = res.data.openid
uni.setStorageSync('openid', openid) uni.setStorageSync('openid', openid)
let userId = res.data.userId || '' let userId = res.data.userId || ''
let datas = { openid, source, userId } let datas = { openid, source, userId }
_this.$request('wechatUser/login/findWxUserAndLogin', datas).then(res => { this.$request('wechatUser/login/findWxUserAndLogin', datas).then(res => {
//通过openid获取token //通过openid获取token
if (res.code == '00') { if (res.code == '00') {
let token = res.data.token || '' let token = res.data.token || ''
...@@ -71,7 +70,7 @@ export default { ...@@ -71,7 +70,7 @@ export default {
url: '/' + enterOptions.path + '?' + queryTotal url: '/' + enterOptions.path + '?' + queryTotal
}) })
//保存当前日期 //保存当前日期
let oldDate=_this.$commonjs.today() let oldDate=this.$commonjs.today()
uni.setStorageSync('oldDate', oldDate) uni.setStorageSync('oldDate', oldDate)
// uni.navigateBack({ // uni.navigateBack({
// delta:1 // delta:1
...@@ -88,8 +87,8 @@ export default { ...@@ -88,8 +87,8 @@ export default {
title: '登录失败,请退出并重新登录', title: '登录失败,请退出并重新登录',
icon: 'none' icon: 'none'
}) })
_this.timer = setTimeout(() => { this.timer = setTimeout(() => {
_this.login() this.login()
}, 2000) }, 2000)
}) })
} else { } else {
...@@ -103,8 +102,8 @@ export default { ...@@ -103,8 +102,8 @@ export default {
title: '登录失败,请退出并重新登录', title: '登录失败,请退出并重新登录',
icon: 'none' icon: 'none'
}) })
_this.timer = setTimeout(() => { this.timer = setTimeout(() => {
_this.login() this.login()
}, 2000) }, 2000)
}) })
} }
......
<template>
<!-- 传入价格,通过改变数量改变价格的支付页面 -->
<view class="wrap">
<view class="top">
<view class="name">
皇冠大扶梯
</view>
<view class="number">
<text>
购买数量
</text>
<u-number-box
v-model="buyNumber"
bg-color='#3688FF'
color='#ffffff'
:input-height="60"
size='28'>
</u-number-box>
</view>
<view class="price">
<text>
总价
</text>
<text>
¥6.00
</text>
</view>
<view class="remark">
<input placeholder="添加备注(20字以内)" maxlength="20" v-model.trim="remark" style="margin-bottom:20rpx;" />
</view>
<view class="tips">
温馨提示:请核对以上付款金额、付款对象等信息与交易匹配。
</view>
</view>
<view class="bottom">
<text class="btn">立即支付</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
remark:'',//备注
payType:'',//支付方式
buyNumber:'',//购买数量
}
},
onLoad(option) {
//#ifdef MP-WEIXIN
this.payType = 42
//#endif
//#ifdef MP-ALIPAY
this.payType = 33
//#endif
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.wrap{
height: 100%;
background: #ffffff;
}
.top{
padding: 40rpx 24rpx;
}
.name{
font-size: 32rpx;
font-weight: bold;
color: #191919;
text-align: center;
}
.number{
display: flex;
justify-content: space-between;
font-weight: bold;
margin-top: 80rpx;
align-items: center;
}
.price{
display: flex;
justify-content: space-between;
font-weight: bold;
margin-top: 48rpx;
text:nth-child(2){
font-size: 40rpx;
color: $red;
}
}
.remark{
margin-top: 48rpx;
color: $grey;
}
.tips{
margin-top: 24rpx;
color: $grey;
font-size: 24rpx;
}
.bottom{
position: fixed;
width: 100%;
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
bottom: 0;
box-shadow: 0px -4px 12px 2px rgba(0,0,0,0.08);
background: #ffffff;
}
.btn{
display: flex;
align-items: center;
justify-content: center;
width: 90%;
height: 80rpx;
background: #3688FF;
border-radius: 8rpx;
font-size: 32rpx;
font-weight: bold;
}
</style>
...@@ -97,13 +97,12 @@ export default { ...@@ -97,13 +97,12 @@ export default {
methods: { methods: {
login() { login() {
//---登录 //---登录
let _this = this
uni.getProvider({ uni.getProvider({
service: 'oauth', service: 'oauth',
success(proRes) { success:proRes=>{
uni.login({ uni.login({
provider: proRes.provider[0], provider: proRes.provider[0],
success: function(res) { success: res=>{
if (res.code) { if (res.code) {
let source = '' let source = ''
if (proRes.provider[0] == 'weixin') { if (proRes.provider[0] == 'weixin') {
...@@ -119,12 +118,12 @@ export default { ...@@ -119,12 +118,12 @@ export default {
if(uni.getStorageSync('enterOptions').query){ if(uni.getStorageSync('enterOptions').query){
data.companyId=uni.getStorageSync('enterOptions').query.companyId||'' data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
} }
_this.$request('wechat/wx/getUserInfoByCode', data) this.$request('wechat/wx/getUserInfoByCode', data)
.then(res => { .then(res => {
if (res.code == '00') { if (res.code == '00') {
_this.openid = res.data.openid this.openid = res.data.openid
uni.setStorageSync('openid', _this.openid) uni.setStorageSync('openid', this.openid)
_this.initDetail() this.initDetail()
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -203,7 +202,6 @@ export default { ...@@ -203,7 +202,6 @@ export default {
}, },
goPay() { goPay() {
//-------------------------------------------------------去支付 //-------------------------------------------------------去支付
let _this = this
if (this.errorMessage) { if (this.errorMessage) {
uni.showToast({ uni.showToast({
title: this.errorMessage, title: this.errorMessage,
...@@ -224,9 +222,9 @@ export default { ...@@ -224,9 +222,9 @@ export default {
package: this.package, package: this.package,
signType: this.signType, signType: this.signType,
paySign: this.paySign, paySign: this.paySign,
success: function(res) { success:res=>{
uni.navigateTo({ uni.navigateTo({
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId+'&afterBuyUrl=' + _this.afterBuyUrl + '&ifyukuaiCode=' + _this.ifyukuaiCode url: '/pages/payment/paySuccess/paySuccess?orderId=' + this.orderId+'&afterBuyUrl=' + this.afterBuyUrl + '&ifyukuaiCode=' + this.ifyukuaiCode
}) })
}, },
fail: function(err) { fail: function(err) {
...@@ -242,9 +240,9 @@ export default { ...@@ -242,9 +240,9 @@ export default {
uni.requestPayment({ uni.requestPayment({
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.orderInfo, // 支付宝订单号 orderInfo: this.orderInfo, // 支付宝订单号
success: function(res) { success: res=> {
uni.navigateTo({ uni.navigateTo({
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId+'&afterBuyUrl=' + _this.afterBuyUrl + '&ifyukuaiCode=' + _this.ifyukuaiCode url: '/pages/payment/paySuccess/paySuccess?orderId=' + this.orderId+'&afterBuyUrl=' + this.afterBuyUrl + '&ifyukuaiCode=' + this.ifyukuaiCode
}) })
}, },
fail: function(err) { fail: function(err) {
......
<template> <template>
<view class="bigBox"> <view class="bigBox" :style="{background:backgroundColor}">
<view class="top"> <template v-if="showMoney">
<view class="topName"> <view class="top">
<text>{{ name }}</text> <view class="topName">
</view> <text>{{ companyName }}</text>
<view class="topMoney">
<view class="moneyText">
付款金额
</view> </view>
<view class="moneyNumber"> <view class="topMoney">
<text class="iconfont icon-fl-renminbi" style="font-size: 56rpx"></text> <view class="moneyText"> 付款金额 </view>
<text>{{ buyMoney }}</text> <view class="moneyNumber">
<text></text> <text class="iconfont icon-fl-renminbi" style="font-size: 56rpx"></text>
<text>{{ orderMoney }}</text>
<text></text>
</view>
</view> </view>
</view> <!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- -->
<!-- -----------------------------有可用优惠券,并且未选中----------------------------------------------------- --> <view
<view class="topCoupon"
class="topCoupon" v-if="couponData.masterSlaveCouponList && couponData.masterSlaveCouponList.length > 0 && chooseCouponObj == ''"
v-if="couponData.masterSlaveCouponList && couponData.masterSlaveCouponList.length > 0 && chooseCouponObj == ''" @click="showCoupon()"
@click="showCoupon()" >
> <view class="couponLeft">
<view class="couponLeft"> <text></text>
<text></text> <text>{{ couponData.masterSlaveCouponList[0].couponName }}</text>
<text>{{ couponData.masterSlaveCouponList[0].couponName }}</text> </view>
<view class="couponRight">
<text>未选优惠券</text>
<text class="iconfont icon-you" style="font-size: 32rpx"></text>
</view>
</view> </view>
<!-- -----------------------------有可用优惠券----------------------------------------------------- -->
<view class="couponRight"> <view class="topCoupon" v-if="chooseCouponObj != '' && savedMoney > 0" @click="showCoupon()">
<text>未选优惠券</text> <view class="couponLeft">
<text class="iconfont icon-you" style="font-size: 32rpx"></text> <text></text>
<text>{{ chooseCouponObj.couponName }}</text>
</view>
<view class="couponRight">
<text>-</text>
<text>{{ parseFloat(savedMoney.toFixed(2)) }}</text>
<text class="iconfont icon-you" style="font-size: 32rpx"></text>
</view>
</view> </view>
</view> <!-- -----------------------------------------------可用优惠券条件--------------------------------------- -->
<!-- -----------------------------有可用优惠券----------------------------------------------------- --> <view class="topCoupon" v-if="ableConpon != ''" @click="showCoupon()">
<view class="topCoupon" v-if="chooseCouponObj != '' && savedMoney > 0" @click="showCoupon()"> <view class="couponLeft">
<view class="couponLeft"> <text></text>
<text></text> <text>{{ ableConpon.couponName }}</text>
<text>{{ chooseCouponObj.couponName }}</text> </view>
<view class="couponRight">
<text>{{ ableConpon.couponRule }}</text>
<text class="iconfont icon-you" style="font-size: 32rpx"></text>
</view>
</view> </view>
</view>
<view class="couponRight">
<text>-</text> <view class="middle">
<text>{{ parseFloat(savedMoney.toFixed(2)) }}</text> <view>
<text class="iconfont icon-you" style="font-size: 32rpx"></text> <input placeholder="添加备注(20字以内)" maxlength="20" v-model.trim="remark" style="margin-bottom: 20rpx" />
</view> </view>
<view style="font-size: 24rpx"> 温馨提示:请核对以上付款金额、付款对象等信息与交易匹配。 </view>
</view> </view>
<!-- -----------------------------------------------可用优惠券条件--------------------------------------- -->
<view class="topCoupon" v-if="ableConpon != ''" @click="showCoupon()"> <view class="bottom">
<view class="couponLeft"> <view class="botLeft">
<text></text> <view v-for="(item, index) of leftList" :key="index">
<text>{{ ableConpon.couponName }}</text> <text @click="clickNum(items.text, index, a)" v-for="(items, a) of item.child" :key="a" :style="{ background: items.background }">{{
items.text
}}</text>
</view>
</view> </view>
<view class="couponRight"> <view class="botRight">
<text>{{ ableConpon.couponRule }}</text> <view class="rightOne" @click="clickEnter()" :style="{ background: spaceBackground }">
<text class="iconfont icon-you" style="font-size: 32rpx"></text> <text class="iconfont icon-im_huige" style="font-size: 70rpx"></text>
</view>
<view class="rightTwo" ref="pay" @click="clickPay()" :style="{ background: payBackground }">
<view>立即</view>
<view>支付</view>
</view>
</view> </view>
</view> </view>
</view> </template>
<view class="middle"> <template v-if="showNumber">
<view> <view class="top2">
<input placeholder="添加备注(20字以内)" maxlength="20" v-model.trim="remark" style="margin-bottom:20rpx;" /> <view class="top2-name">
</view> {{companyName}}
<view style="font-size:24rpx;">
温馨提示:请核对以上付款金额、付款对象等信息与交易匹配。
</view>
</view>
<view class="bottom">
<view class="botLeft">
<view v-for="(item, index) of leftList" :key="index">
<text @click="clickNum(items.text, index, a)" v-for="(items, a) of item.child" :key="a" :style="{ background: items.background }">{{
items.text
}}</text>
</view> </view>
</view> <view class="top2-number">
<text>
<view class="botRight"> 购买数量
<view class="rightOne" @click="clickEnter()" :style="{ background: spaceBackground }"> </text>
<text class="iconfont icon-im_huige" style="font-size: 70rpx"></text>
<u-number-box
@change='numberChange'
v-model="buyNum"
bg-color='#3688FF'
color='#ffffff'
:input-height="60"
:min="1"
size='28'>
</u-number-box>
</view>
<view class="top2-price">
<text>
总价
</text>
<text>
¥{{orderMoney}}
</text>
</view>
<view class="top2-remark">
<input placeholder="添加备注(20字以内)" maxlength="20" v-model.trim="remark" style="margin-bottom:20rpx;" />
</view> </view>
<view class="rightTwo" ref="pay" @click="clickPay()" :style="{ background: payBackground }"> <view class="top2-tips">
<view>立即</view> 温馨提示:请核对以上付款金额、付款对象等信息与交易匹配。
<view>支付</view>
</view> </view>
</view> </view>
</view>
<view class="bottom2">
<text class="btn" @click="clickPay()" :style="{ background: payBackground }">立即支付</text>
</view>
</template>
<!-------------------------------------------券弹窗------------------------------> <!-------------------------------------------券弹窗------------------------------>
<orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon> <orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon>
</view> </view>
...@@ -99,12 +138,16 @@ export default { ...@@ -99,12 +138,16 @@ export default {
}, },
data() { data() {
return { return {
remark:'',//备注 backgroundColor:'#f5f5f5',//背景颜色
enterUrl: '', //进入页面路由 showMoney:false,//显示输入金额页面
buyMoney: '', //输入金额 showNumber:false,//显示输入数量页面
tollPoint:'',//收费点信息
buyNum:1,//购买数量
remark: '', //备注
orderMoney: '', //订单金额
companyId: '', //公司Id companyId: '', //公司Id
merchantId: '', //商户Id merchantId: '', //商户Id
name: '', //商家名称 companyName: '', //商家名称
payType: '', //支付类型,微信小程序42,支付宝小程序33 payType: '', //支付类型,微信小程序42,支付宝小程序33
paySign: '', //签名 paySign: '', //签名
signType: '', //签名方式 signType: '', //签名方式
...@@ -160,34 +203,26 @@ export default { ...@@ -160,34 +203,26 @@ export default {
}, },
onLoad(option) { onLoad(option) {
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
this.enterUrl = option.q
this.payType = 42 this.payType = 42
//#endif //#endif
//#ifdef MP-ALIPAY //#ifdef MP-ALIPAY
this.enterUrl = uni.getStorageSync('alipayQrCode')
uni.removeStorageSync('alipayQrCode') //临时解决出租车扫码之后跳转到组合票时,参数会有问题,有时间再根本解决 uni.removeStorageSync('alipayQrCode') //临时解决出租车扫码之后跳转到组合票时,参数会有问题,有时间再根本解决
this.payType = 33 this.payType = 33
//#endif //#endif
if (this.enterUrl) { this.merchantId=this.$commonjs.getKey(option,'merchantId')
//扫普通二维码进入 this.companyId=this.$commonjs.getKey(option,'companyId')
this.merchantId = this.getUrlKey('merchantId') this.extendInfo=this.$commonjs.getKey(option,'extendInfo')
this.companyId = this.getUrlKey('companyId') if(!this.extendInfo){
this.extendInfo = this.getUrlKey('extendInfo') this.showMoney=true
} else {
//扫小程序二维码进入
this.merchantId = option.merchantId
this.companyId = option.companyId
this.extendInfo = option.extendInfo
} }
if (uni.getStorageSync('openid')) { if (uni.getStorageSync('openid')) {
this.openid = uni.getStorageSync('openid')
if (this.merchantId) { if (this.merchantId) {
//大商家的有merchantId //大商家的有merchantId
this.init() this.initMerchant()
} else { } else {
//小商家没有merchantId //小商家没有merchantId
this.initTwo() this.initCompany()
} }
this.initCoupon() this.initCoupon()
} else { } else {
...@@ -205,13 +240,12 @@ export default { ...@@ -205,13 +240,12 @@ export default {
methods: { methods: {
login() { login() {
//---登录 //---登录
let _this = this
uni.getProvider({ uni.getProvider({
service: 'oauth', service: 'oauth',
success(proRes) { success:proRes=>{
uni.login({ uni.login({
provider: proRes.provider[0], provider: proRes.provider[0],
success: function (res) { success:res=>{
if (res.code) { if (res.code) {
let source = '' let source = ''
if (proRes.provider[0] == 'weixin') { if (proRes.provider[0] == 'weixin') {
...@@ -222,88 +256,80 @@ export default { ...@@ -222,88 +256,80 @@ export default {
let data = { let data = {
code: res.code, code: res.code,
source, //微信小程序3,支付宝小程序4 source, //微信小程序3,支付宝小程序4
appid: uni.getStorageSync('appid') || '' appid: uni.getStorageSync('appid') || '',
} companyId:this.companyId
if (uni.getStorageSync('enterOptions').query) {
data.companyId = uni.getStorageSync('enterOptions').query.companyId || ''
} }
_this.$request('wechat/wx/getUserInfoByCode', data).then(res => { this.$request('wechat/wx/getUserInfoByCode', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
_this.openid = res.data.openid let openid = res.data.openid||''
uni.setStorageSync('openid', _this.openid) uni.setStorageSync('openid', openid)
if (_this.merchantId) { if (this.merchantId) {
//大商家的有merchantId //大商家的有merchantId
_this.init() this.initMerchant()
} else { } else {
//小商家没有merchantId //小商家没有merchantId
_this.initTwo() this.initCompany()
} }
_this.initCoupon() this.initCoupon()
//用于获取token等信息 //用于获取token等信息
let userId = res.data.userId || '' let userId = res.data.userId || ''
let openid = res.data.openid || ''
let datas = { openid, source, userId } let datas = { openid, source, userId }
_this this.$request('wechatUser/login/findWxUserAndLogin', datas).then(res => {
.$request('wechatUser/login/findWxUserAndLogin', datas) if (res.code == '00') {
.then(res => { let token = res.data.token || ''
if (res.code == '00') { uni.setStorageSync('token', token)
let token = res.data.token || '' let createUserId = res.data.personId || ''
uni.setStorageSync('token', token) uni.setStorageSync('createUserId', createUserId)
let createUserId = res.data.personId || '' let userId = res.data.userId || ''
uni.setStorageSync('createUserId', createUserId) uni.setStorageSync('userId', userId)
let userId = res.data.userId || '' } else {
uni.setStorageSync('userId', userId)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
.catch(err => {
uni.showToast({ uni.showToast({
title: '登录失败', title: res.message,
icon: 'none' icon: 'none'
}) })
_this.timer = setTimeout(() => { }
_this.login() }).catch(err => {
}, 2000) uni.showToast({
title: '登录失败',
icon: 'none'
}) })
this.timer = setTimeout(() => {
this.login()
}, 2000)
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: 'none' icon: 'none'
}) })
} }
}) }).catch(err => {
.catch(err => { uni.showToast({
uni.showToast({ title: '登录失败',
title: '登录失败', icon: 'none'
icon: 'none'
})
_this.timer = setTimeout(() => {
_this.login()
}, 2000)
}) })
this.timer = setTimeout(() => {
this.login()
}, 2000)
})
} }
} }
}) })
} }
}) })
}, },
getUrlKey(name) { //---数量改变时
//---获取url numberChange(e){
return ( let price=this.tollPoint.tollPointPrice
(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ''])[1].replace(/\+/g, '%20') || '' this.orderMoney=parseFloat((price*e.value).toFixed(2))
)
}, },
//---输入数字
clickNum(i, index, a) { clickNum(i, index, a) {
//---输入数字
//不超过14位数 //不超过14位数
if (this.buyMoney.length > 13) { if (this.orderMoney.length > 13) {
return return
} }
this.buyMoney += i this.orderMoney += i
this.leftList[index].child[a].background = '#dddddd' this.leftList[index].child[a].background = '#dddddd'
setTimeout(() => { setTimeout(() => {
this.leftList[index].child[a].background = '' this.leftList[index].child[a].background = ''
...@@ -313,9 +339,9 @@ export default { ...@@ -313,9 +339,9 @@ export default {
this.initCoupon() this.initCoupon()
}, 1500) }, 1500)
}, },
//---退格
clickEnter() { clickEnter() {
//---退格 this.orderMoney = this.orderMoney.substr(0, this.orderMoney.length - 1)
this.buyMoney = this.buyMoney.substr(0, this.buyMoney.length - 1)
this.spaceBackground = '#dddddd' this.spaceBackground = '#dddddd'
setTimeout(() => { setTimeout(() => {
this.spaceBackground = '' this.spaceBackground = ''
...@@ -339,57 +365,73 @@ export default { ...@@ -339,57 +365,73 @@ export default {
//---展示券列表 //---展示券列表
this.$refs.orderCoupon.showCoupon() this.$refs.orderCoupon.showCoupon()
}, },
init() { //---初始化获取商家名称,大商家
//---初始化获取商家名称,大商家 initMerchant() {
let data = { let data = {
merchantId: this.merchantId, merchantId: this.merchantId,
companyId: this.companyId companyId: this.companyId
} }
uni.showLoading({ title: '加载中', mask: true }) uni.showLoading({ title: '加载中', mask: true })
this.$request('scenic/order/findCodePayInfo', data) this.$request('scenic/order/findCodePayInfo', data).then(res => {
.then(res => { uni.hideLoading()
uni.hideLoading() if (res.code == '00') {
if (res.code == '00') { this.companyName = res.data.name
this.name = res.data.name } else {
} else { uni.showToast({
uni.showToast({ title: res.message,
title: res.message, icon: 'none'
icon: 'none' })
}) }
} }).catch(err => {
}) uni.hideLoading()
.catch(err => { })
uni.hideLoading()
})
}, },
initTwo() { //---初始化获取商家名称,没有merchantId的小商家
//---初始化获取商家名称,没有merchantId的小商家 initCompany() {
let data = { let data = {
id: this.companyId id: this.companyId,//公司Id
tollPoint:this.extendInfo,//扩展信息
} }
uni.showLoading({ title: '加载中', mask: true }) uni.showLoading({ title: '加载中', mask: true })
this.$request('user/company/detail', data) this.$request('user/newCompany/findCompanyById', data).then(res => {
.then(res => { uni.hideLoading()
uni.hideLoading() if (res.code == '00') {
if (res.code == '00') { this.companyAttribute = res.data.companyAttribute
this.companyAttribute = res.data.companyVo.companyAttribute this.paydJumpUrl = res.data.paydJumpUrl
this.paydJumpUrl = res.data.paydJumpUrl if (this.companyAttribute == 5) {
if (this.companyAttribute == 5) { //出租车显示联系人姓名,其他显示公司名称
//出租车显示联系人姓名,其他显示公司名称 this.companyName = res.data.contactName
this.name = res.data.companyVo.contactName
} else {
this.name = res.data.companyVo.companyName
}
} else { } else {
uni.showToast({ this.companyName = res.data.companyName
title: res.message,
icon: 'none'
})
} }
}) let list=res.data.companyTollPointVoList
.catch(err => { list.forEach(item=>{
uni.hideLoading() if(item.tollPoints==this.extendInfo){
}) this.tollPoint=item
}
})
if(this.tollPoint.tollPointsModel==0){
//显示输入金额页面
this.showMoney=true
}
if(this.tollPoint.tollPointsModel==1){
//显示数量页面
this.backgroundColor='#ffffff'
this.showNumber=true
//默认总价为一张的价格
this.orderMoney=this.tollPoint.tollPointPrice
//优先取收费点名称,然后是公司名称,然后是联系人名称
this.companyName=this.tollPoint.tollPointByname||res.data.companyName||res.data.contactName
}
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch(err => {
uni.hideLoading()
})
}, },
initCoupon() { initCoupon() {
//---加载优惠券 //---加载优惠券
...@@ -397,11 +439,11 @@ export default { ...@@ -397,11 +439,11 @@ export default {
this.chooseCouponObj = '' this.chooseCouponObj = ''
this.ableConpon = '' this.ableConpon = ''
let data = { let data = {
money: parseFloat(this.buyMoney) || 0, //订单总价,不算券,和现金红包 money: parseFloat(this.orderMoney) || 0, //订单总价,不算券,和现金红包
merchantId: this.merchantId, //商户Id merchantId: this.merchantId, //商户Id
companyId: this.companyId, //公司Id companyId: this.companyId, //公司Id
orderSource: this.orderSource, //订单来源 8扫码支付 orderSource: this.orderSource, //订单来源 8扫码支付
openid: this.openid openid:uni.getStorageSync('openid')||''
} }
this.$request('wechatUser/myPage/usableCouponList', data).then(res => { this.$request('wechatUser/myPage/usableCouponList', data).then(res => {
if (res.code == '00') { if (res.code == '00') {
...@@ -447,7 +489,7 @@ export default { ...@@ -447,7 +489,7 @@ export default {
}, },
clickPay() { clickPay() {
//---点击立即支付,获取支付需要的参数 //---点击立即支付,获取支付需要的参数
if (!parseFloat(this.buyMoney)) { if (!parseFloat(this.orderMoney)&&this.showMoney) {
uni.showToast({ uni.showToast({
title: '请输入正确金额', title: '请输入正确金额',
icon: 'none' icon: 'none'
...@@ -485,14 +527,22 @@ export default { ...@@ -485,14 +527,22 @@ export default {
let data = { let data = {
companyId: this.companyId, companyId: this.companyId,
merchantId: this.merchantId, merchantId: this.merchantId,
userId: this.openid, userId: uni.getStorageSync('openid')||'',
orderMoney: parseFloat(this.buyMoney), orderMoney: parseFloat(this.orderMoney),//总价
buyNum:this.buyNum,//数量
payType: this.payType, //支付类型, payType: this.payType, //支付类型,
orderSource: this.orderSource, //订单来源 8扫码支付 orderSource: this.orderSource, //订单来源 8扫码支付
couponList, //券列表 couponList, //券列表
extendInfo: this.extendInfo ,//额外信息 extendInfo: this.extendInfo, //额外信息
remark:this.remark,//备注信息 remark: this.remark //备注信息
}
if(this.showMoney){
//输入金额页面
data.unitPrice=parseFloat(this.orderMoney)
}
if(this.showNumber){
//输入数量页面
data.unitPrice=this.tollPoint.tollPointPrice
} }
this.payBackground = '#cccccc' this.payBackground = '#cccccc'
//重新加载优惠券 //重新加载优惠券
...@@ -533,7 +583,6 @@ export default { ...@@ -533,7 +583,6 @@ export default {
}, },
goPay() { goPay() {
//---去支付 //---去支付
let _this = this
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
...@@ -542,15 +591,15 @@ export default { ...@@ -542,15 +591,15 @@ export default {
package: this.package, package: this.package,
signType: this.signType, signType: this.signType,
paySign: this.paySign, paySign: this.paySign,
success: function (res) { success:res=>{
if (_this.companyAttribute == 5) { if (this.companyAttribute == 5) {
//出租车跳转分销组合票页面 //出租车跳转分销组合票页面
uni.navigateTo({ uni.navigateTo({
url: _this.paydJumpUrl url: this.paydJumpUrl
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId url: '/pages/payment/paySuccess/paySuccess?orderId=' + this.orderId
}) })
} }
}, },
...@@ -567,15 +616,15 @@ export default { ...@@ -567,15 +616,15 @@ export default {
uni.requestPayment({ uni.requestPayment({
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.orderInfo, // 支付宝订单号 orderInfo: this.orderInfo, // 支付宝订单号
success: function (res) { success:res=>{
if (_this.companyAttribute == 5) { if (this.companyAttribute == 5) {
//出租车跳转分销组合票页面 //出租车跳转分销组合票页面
uni.navigateTo({ uni.navigateTo({
url: _this.paydJumpUrl url: this.paydJumpUrl
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId url: '/pages/payment/paySuccess/paySuccess?orderId=' + this.orderId
}) })
} }
}, },
...@@ -590,31 +639,31 @@ export default { ...@@ -590,31 +639,31 @@ export default {
} }
}, },
watch: { watch: {
buyMoney(val, oldVal) { orderMoney(val, oldVal) {
if (val == '.' && oldVal == '') { if (val == '.' && oldVal == '') {
//首位数是小数点自动加上0 //首位数是小数点自动加上0
this.buyMoney = 0 + '.' this.orderMoney = 0 + '.'
} }
if (val == '0' && oldVal == '') { if (val == '0' && oldVal == '') {
//首位数是0自动加上小数点 //首位数是0自动加上小数点
this.buyMoney = 0 + '.' this.orderMoney = 0 + '.'
} }
if (val.length == 2) { if (val.length == 2) {
//防止回退之后出现01,02等状况 //防止回退之后出现01,02等状况
if (val.substr(0, 1) == 0 && val.substr(1, 2) != '.') { if (val.substr(0, 1) == 0 && val.substr(1, 2) != '.') {
this.buyMoney = val.substr(1, 2) this.orderMoney = val.substr(1, 2)
} }
} }
if (isNaN(val) && val != '.') { if (isNaN(val) && val != '.') {
//出现非数字,输入无效 //出现非数字,输入无效
this.buyMoney = oldVal this.orderMoney = oldVal
} }
var x = String(this.buyMoney).indexOf('.') + 1 //小数点的位置 var x = String(this.orderMoney).indexOf('.') + 1 //小数点的位置
var y = String(this.buyMoney).length - x //小数的位数 var y = String(this.orderMoney).length - x //小数的位数
if (y > 2 && x > 0) { if (y > 2 && x > 0) {
this.buyMoney = oldVal this.orderMoney = oldVal
} }
if (parseFloat(this.buyMoney)) { if (parseFloat(this.orderMoney)) {
this.payBackground = '#3688FF' this.payBackground = '#3688FF'
} else { } else {
this.payBackground = '#cccccc' this.payBackground = '#cccccc'
...@@ -625,8 +674,8 @@ export default { ...@@ -625,8 +674,8 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
// 输入金额页面样式
.bigBox { .bigBox {
background: #f5f5f5;
height: 100%; height: 100%;
} }
/*上部分*/ /*上部分*/
...@@ -665,7 +714,7 @@ export default { ...@@ -665,7 +714,7 @@ export default {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.moneyNumber{ .moneyNumber {
margin-top: 30rpx; margin-top: 30rpx;
} }
.moneyNumber text:nth-child(2) { .moneyNumber text:nth-child(2) {
...@@ -792,4 +841,61 @@ export default { ...@@ -792,4 +841,61 @@ export default {
opacity: 1; opacity: 1;
} }
} }
//输入数字页面样式
.top2{
padding: 40rpx 24rpx;
}
.top2-name{
font-size: 32rpx;
font-weight: bold;
color: #191919;
text-align: center;
}
.top2-number{
display: flex;
justify-content: space-between;
font-weight: bold;
margin-top: 80rpx;
align-items: center;
}
.top2-price{
display: flex;
justify-content: space-between;
font-weight: bold;
margin-top: 48rpx;
text:nth-child(2){
font-size: 40rpx;
color: $red;
}
}
.top2-remark{
margin-top: 48rpx;
color: $grey;
}
.top2-tips{
margin-top: 24rpx;
color: $grey;
font-size: 24rpx;
}
.bottom2{
position: fixed;
width: 100%;
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
bottom: 0;
box-shadow: 0px -4px 12px 2px rgba(0,0,0,0.08);
background: #ffffff;
}
.btn{
display: flex;
align-items: center;
justify-content: center;
width: 90%;
height: 80rpx;
border-radius: 8rpx;
font-size: 32rpx;
font-weight: bold;
}
</style> </style>
...@@ -57,14 +57,22 @@ export default { ...@@ -57,14 +57,22 @@ export default {
let data = { let data = {
orderId: this.orderId orderId: this.orderId
} }
this.$request('order/order/getStatusById', data).then((res) => { this.$request('order/userOrder/getStatusById', data).then((res) => {
if (res.code == '00') { if (res.code == '00') {
this.status = res.data //如果是组合票,直接跳订单列表页面
let orderType=res.data.orderType
if(orderType=='10'){
uni.reLaunch({
url:this.afterBuyUrl+'?orderId=' + this.orderId+'&ifyukuaiCode='+this.ifyukuaiCode
})
return
}
this.status = res.data.orderStatus
if (this.status == '2' || this.status == '4' || this.status == '5') { if (this.status == '2' || this.status == '4' || this.status == '5') {
//1.跳订单列表,2.订单详情,3.停留该页面显示支付成功(ourPayment页面跳入时,无afterBuyUrl,停留在该页面) //1.跳订单列表,2.订单详情,3.停留该页面显示支付成功(ourPayment页面跳入时,无afterBuyUrl,停留在该页面)
this.title='支付成功!' this.title='支付成功!'
this.loadImg=false this.loadImg=false
uni.redirectTo({ uni.reLaunch({
url:this.afterBuyUrl+'?orderId=' + this.orderId+'&ifyukuaiCode='+this.ifyukuaiCode url:this.afterBuyUrl+'?orderId=' + this.orderId+'&ifyukuaiCode='+this.ifyukuaiCode
}) })
} }
......
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 to comment