Commit 82ea6e24 authored by 黄媛媛's avatar 黄媛媛

update

parent 50559876
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
let md5 = require('utils/md5.js') let md5 = require('utils/md5.js')
let javaUrl = 'https://efficient.oytour.com/'; let javaUrl = 'https://efficient.oytour.com/';
// let javaUrl = 'http://47.96.12.235:9001/'; // let javaUrl = 'http://47.96.12.235:9001/';
// let netUrl = 'https://reborn.oytour.com/api/common/post'; let netUrl = 'https://reborn.oytour.com/api/common/post';
let netUrl = 'http://192.168.2.65:8025/api/Common/Post'; // let netUrl = 'http://192.168.2.65:8025/api/Common/Post';
App({ App({
// 小程序初始化时 // 小程序初始化时
onLaunch: function(options) { onLaunch: function(options) {
......
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
"pages/mine/UseDetails/UseDetails", "pages/mine/UseDetails/UseDetails",
"pages/shopPage/shopPage", "pages/shopPage/shopPage",
"pages/webview/webview", "pages/webview/webview",
"pages/Home/pay/pay" "pages/Home/pay/pay",
"pages/Home/payOk/payOk"
], ],
"navigateToMiniProgramAppIdList": [ "navigateToMiniProgramAppIdList": [
"wxb6bcc99626870225" "wxb6bcc99626870225"
......
diff a/pages/GroupTour/FillOrder/FillOrder.js b/pages/GroupTour/FillOrder/FillOrder.js (rejected hunks)
@@ -14,15 +14,189 @@
ContactMobile: "",
ContactName: "",
},
+ code: '', //输入的 兑换码
+ userInfo: {},
+ RedEnvelopeMoneyALL: 0, //获取的 存折金额
+ RedMoney: '', //输入的 红包金额
+ teamType: '',// 0 跟团游 1自由行 2当地游
+ cpList: [], // 优惠券数据
+ cpBoxShow: false,
+ SettlementPrice: 0,
+ CouponLength: '',
+ GoodsView: false
},
+ // 关闭或打开 价格详情
+ CloseGoodsView: function (){
+ this.setData({
+ GoodsView: !this.data.GoodsView,
+ })
+ },
+ // 关闭打开优惠券选择box
+ closeBox: function(){
+ this.setData({
+ cpBoxShow: !this.data.cpBoxShow
+ })
+ },
+ // 选择优惠券 一些逻辑
+ clickCP: function (e) {
+ let index = e.currentTarget.dataset.index
+ let list = this.data.cpList;
+ if (list[index].dis) { // 禁用了的点击直接爬开
+ return
+ }
+ let jishu = 0;
+ list[index].checkd = !list[index].checkd;
+ // 先判断是否叠加
+ if (list[index].overlapUse == 1) { // 可叠加
+ for (let i = 0; i < list.length; i++) {
+ if (list[index].id !== list[i].id && list[i].overlapUse !== 1) { // 排除自己 禁用不可叠加
+ list[i].dis = true
+ }
+ }
+ } else { // 不可叠加
+ for (let i = 0; i < list.length; i++) {
+ if (list[index].id !== list[i].id) { // 排除自己 全部禁用
+ list[i].dis = true
+ }
+ }
+ }
+ for (let i = 0; i < list.length; i++) { // 获取选中的个数
+ if (list[i].checkd) {
+ jishu = jishu + 1
+ }
+ }
+ if (jishu == 0){ // 莫得选中的解除全部禁用
+ list.map(i=>{
+ i.dis = false
+ })
+ }
+ this.setData({
+ cpList: list
+ })
+ // 计算金额
+ this.getCpPrice()
+ //有点麻烦 先凑合用
+ },
+ // 获取优惠券优惠金额
+ getCpPrice: function(){
+ let price = this.data.payInfo.PreferPrice,
+ yPrice = 0, cpList = this.data.cpList, type = 0, CouponMoney = 0, CouponSale = 1, CouponIds = '', CouponLength = 0, SettlementPrice = 0;
+ cpList.map(item => {
+ if (item.checkd) {
+
+ type = item.couponsType
+ CouponLength = CouponLength + 1
+ CouponIds = CouponIds + item.id + ','
+ if (item.couponsType === 1) {
+ CouponMoney = CouponMoney + item.denomination
+ } else {
+ CouponSale = CouponSale * (item.denomination / 10)
+ }
+ }
+ if (type === 1) {
+ SettlementPrice = price - (price - CouponMoney)
+ } else if (type === 2) {
+ SettlementPrice = price - (price * CouponSale)
+ } else if (type === 0) {
+ SettlementPrice = 0
+ }
+ })
+ this.setData({
+ CouponLength: CouponLength,
+ CouponIds: CouponIds,
+ SettlementPrice: SettlementPrice,
+ })
+ },
+ // 获取优惠券
+ getCpList: function (){
+ let msg = {
+ lineId: this.data.payInfo.lineId,
+ lineteamId: this.data.payInfo.lineteamId,
+ CouponsUseScope: 2,
+ }
+ app.$apiJavaData("api/b2b/user/getUserCanUseCouponList", { ActivateCode: this.data.code }).then(res => {
+ let data = res.data
+ let list = [];
+ for(let i = 0; i < data.length; i++) {
+ data[i].effectDate = data[i].effectDate.split(' ')[0].replace(/-/g,'.')
+ data[i].expirationDate = data[i].expirationDate.split(' ')[0].replace(/-/g, '.')
+ data[i].dis = false
+ data[i].ckeckd = false
+ if (this.data.payInfo.PreferPrice > data[i].useCondition){
+ list.push(data[i])
+ }
+ }
+ this.setData({
+ cpList: list
+ })
+ }).catch(err => { })
+ },
+ //输入使用存折金额
+ changeRedMoney: function (e){
+ let money = 0;
+ if (/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) {
+ money = e.detail.value;
+ } else {
+ money = e.detail.value.substring(0, e.detail.value.length - 1);
+ }
+ console.log(money)
+ if (money !== "" && parseFloat(money) > this.data.RedEnvelopeMoneyALL) {
+ money = this.data.RedEnvelopeMoneyALL
+ wx.showToast({
+ title: '最大金额不能超过余额',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ this.setData({
+ RedMoney: parseFloat(money)
+ })
+ },
+ // 获取幸福存折余额
+ getHappyMoney: function (){
+ app.$api('customer_post_GetCustomerBigRedEnvelopeBalance', { CustomerId: this.data.userInfo.id}).then(res => {
+ this.setData({
+ RedEnvelopeMoneyALL: res
+ })
+ }).catch(err => {
+ })
+ },
+ //兑换码兑换
+ subCode: function () {
+ if (this.data.code == "") {
+ wx.showToast({
+ title: '请输入兑换码',
+ icon: 'none',
+ duration: 2000
+ })
+ return
+ }
+ app.$apiJavaData("api/b2b/user/updateUseCouponBycode", { ActivateCode: this.data.code}).then(res => {
+ wx.showToast({
+ title: '兑换成功,请到优惠券列表查看',
+ icon: 'none',
+ duration: 2000
+ })
+ this.getCpList()
+ }).catch(err => { })
+ },
+ // 写入兑换码
+ setCode: function (e) {
+ this.setData({
+ code: e.detail.value
+ })
+ },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
+ console.log(options)
let payInfo = wx.getStorageSync('payInfo');
this.setData({
- payInfo: payInfo
+ payInfo: payInfo,
+ userInfo: wx.getStorageSync('admin'),
+ teamType: options.teamType
})
let that = this;
let msg = {};
// pages/Home/home.js // pages/Home/home.js
let app = getApp(); let app = getApp();
var util = require('../../utils/util.js')
Page({ Page({
/** /**
...@@ -23,6 +24,11 @@ Page({ ...@@ -23,6 +24,11 @@ Page({
localList:[], localList:[],
}, },
goWebView(){ goWebView(){
let userinfo= wx.getStorageSync('admin');
if (!userinfo){
util.shownone("请先登录!");
return;
}
wx.navigateTo({ wx.navigateTo({
url:'/pages/webview/webview' url:'/pages/webview/webview'
}) })
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<!-- 超值特卖 --> <!-- 超值特卖 -->
<view class="CztmView"> <view class="CztmView">
<view bindtap="goWebView" class="imageView"> <view bindtap="goWebView" class="imageView">
<image class="bannerImg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191112104155316.png"></image> <image class="bannerImg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191113110225683.png"></image>
<image class="small" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108013907065.png"></image> <image class="small" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108013907065.png"></image>
</view> </view>
<view class="ContentView"> <view class="ContentView">
......
let app = getApp(); let app = getApp();
let md5 = require('../../../utils/md5.js') let md5 = require('../../../utils/md5.js')
var util = require('../../../utils/util.js')
Page({ Page({
...@@ -27,8 +28,8 @@ Page({ ...@@ -27,8 +28,8 @@ Page({
console.log("options", options) console.log("options", options)
let info = that.data.payInfo; let info = that.data.payInfo;
let payInfo = JSON.parse(options.data) let payInfo = JSON.parse(options.data)
// info.sOrderNo = payInfo.sOrderNo; info.sOrderNo = payInfo.sOrderNo;
info.sOrderNo =22; // info.sOrderNo =26;
info.sProductName = payInfo.sProductName; info.sProductName = payInfo.sProductName;
info.dTotalPrice = payInfo.dTotalPrice; info.dTotalPrice = payInfo.dTotalPrice;
info.productId = payInfo.productId; info.productId = payInfo.productId;
...@@ -67,33 +68,41 @@ Page({ ...@@ -67,33 +68,41 @@ Page({
let that = this; let that = this;
let dataInfo = that.data.dataInfo; let dataInfo = that.data.dataInfo;
if (!that.data.payBtn){ if (!that.data.payBtn){
wx.showToast({ util.shownone("您已经超出支付时间!");
title: "您已经超出支付时间!",
icon: 'none',
duration: 1000
})
return; return;
} }
// let paySign="";
// paySign = md5(`appId=${dataInfo.appid}&nonceStr=${dataInfo.noncestr}&package=prepay_id=${dataInfo.prepayid}&signType=MD5&timeStamp=${dataInfo.timestamp}&key=936110e2c2214340b9829a3608bde6b0`)
// paySign = paySign.toUpperCase()
// console.log("paySign", paySign)
wx.requestPayment({ wx.requestPayment({
'timeStamp': dataInfo.timeStamp, 'timeStamp': dataInfo.timeStamp,
'nonceStr': dataInfo.nonceStr, 'nonceStr': dataInfo.nonceStr,
// 'package': `prepay_id=${dataInfo.prepayid}`,
'package': dataInfo.package, 'package': dataInfo.package,
'signType': 'MD5', 'signType': 'MD5',
// 'signType': dataInfo.signType, 'paySign': dataInfo.sign,
'paySign': dataInfo.paySign, // 'timeStamp': '1573612335',
// 'paySign': paySign, // 'nonceStr': '3328BDF9A4B9504B9398284244FE97C2',
// 'package': 'prepay_id=wx1310321771415863507046d91230616800',
// 'signType': 'MD5',
// 'paySign':'1B61F0ECA72CCC185A28EB3F431CD1CD',
'success': function(res) { 'success': function(res) {
console.log("res",res); console.log("res",res);
}, },
'fail': function(res) {}, 'fail': function(res) {
'complete': function(res) {} console.log("res",res)
util.shownone("支付失败!");
},
'complete': function(res) {
if (res.errMsg == "requestPayment:ok") {
util.shownone('支付成功');
wx.navigateTo({
url: '/pages/Home/payOk/payOk'
})
}
}
}) })
}, },
getOpenid() { getOpenid() {
......
// pages/Home/payOk/payOk.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
seeBtn(){
wx.navigateTo({
url: '/pages/member/Coupon/Coupon'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="payok">
<view style="text-align:center;margin-top:200rpx">
<image style="width:100rpx;height:100rpx" src="../../../images/visa/xunazhong.png"></image>
</view>
<view style="text-align:center;margin-top:20rpx;color:#EE4454">支付成功</view>
<view style="text-align:center;margin-top:100rpx;">
<text bindtap="seeBtn" class="seeBtn">前往查看</text>
</view>
<view class="sm">您也可以在[我的->我的优惠券]查看优惠券信息</view>
</view>
\ No newline at end of file
.payok{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: #fff;
}
.seeBtn{
border: 1px solid #EE4454;
padding: 13rpx 38rpx;
color:#EE4454;
border-radius: 10rpx;
}
.sm{
position: absolute;
bottom: 70rpx;
color: #aaaaaa;
font-size: 28rpx;
text-align: center;
width: 100%;
}
\ No newline at end of file
...@@ -5,7 +5,7 @@ Page({ ...@@ -5,7 +5,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
urlHref:"http://127.0.0.1:5500/html/GT_activities.html", urlHref:"http://activity.oytour.com/html/GT_activities.html",
}, },
onLoad: function (options) { onLoad: function (options) {
......
...@@ -221,6 +221,13 @@ ...@@ -221,6 +221,13 @@
"pathName": "pages/Home/pay/pay", "pathName": "pages/Home/pay/pay",
"query": "", "query": "",
"scene": null "scene": null
},
{
"id": -1,
"name": "支付成功",
"pathName": "pages/Home/payOk/payOk",
"query": "",
"scene": null
} }
] ]
} }
......
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