Commit c1748bc3 authored by 黄媛媛's avatar 黄媛媛

update

parent f36cc072
......@@ -2,8 +2,8 @@
let md5 = require('utils/md5.js')
let javaUrl = 'https://efficient.oytour.com/';
// let javaUrl = 'http://47.96.12.235:9001/';
let netUrl = 'https://reborn.oytour.com/api/common/post';
// let netUrl = 'http://192.168.2.65:8025/api/Common/Post';
// let netUrl = 'https://reborn.oytour.com/api/common/post';
let netUrl = 'http://192.168.2.65:8025/api/Common/Post';
App({
// 小程序初始化时
onLaunch: function(options) {
......@@ -85,6 +85,31 @@ App({
})
return promise;
},
$apiNew: function (url, data) {
var promise = new Promise((resolve, reject) => {
wx.showLoading({
title: '加载中',
});
let timestamp = (new Date()).valueOf()
let sign = md5('cmd=' + url + '&' + 'msg=' + encodeURIComponent(data).toLowerCase() + '&' + 'timestamp=' + timestamp + '&' + 'token=' + getApp().state.admin.token + '&' + 'key=' + '')
wx.request({
url: netUrl,
method: 'POST',
data: {
cmd: url,
msg: data,
timestamp: timestamp,
token: getApp().state.admin.token,
sign: sign
},
success(res) {
wx.hideLoading()
resolve(res.data.data);
}
})
})
return promise;
},
// 请求接口
$apiSaveFormId: function (url, data) {
var promise = new Promise((resolve, reject) => {
......
......@@ -65,7 +65,9 @@
"pages/Pay/Pay",
"pages/mine/Happypassbook/Happypassbook",
"pages/mine/UseDetails/UseDetails",
"pages/shopPage/shopPage"
"pages/shopPage/shopPage",
"pages/webview/webview",
"pages/Home/pay/pay"
],
"permission": {
"scope.userLocation": {
......
......@@ -3,7 +3,7 @@
<view class="headerView">
<image class="headerbg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108110833785.png"></image>
<view class="hdjxView">
<image class="headimg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108110853895.png"></image>
<image class="headimg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191112104209660.png"></image>
</view>
<view id="searchView">
<search id="CityComp" bind:ChangeSite="ChangeSite"></search>
......@@ -64,12 +64,12 @@
<!-- 超值特卖 -->
<view class="CztmView">
<view bindtap="goWebView" class="imageView">
<image class="bannerImg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108013851924.png"></image>
<image class="bannerImg" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191112104155316.png"></image>
<image class="small" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108013907065.png"></image>
</view>
<view class="ContentView">
<view>
<image style="width:165rpx;height:26rpx" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191108015629462.png"></image>
<image style="width:165rpx;height:26rpx" src="http://imgfile.oytour.com/New/Upload/Cloud/2019-11/20191112104204160.png"></image>
<text bindtap="goMore" data-url="/pages/GroupTour/GroupList/GroupList" style="font-size:24rpx;color:#888888;float:right;margin-top:15rpx">查看更多</text>
</view>
<view class="cztm cztm1">
......
let app = getApp();
Page({
data: {
timestamp: '',
openid: '',
customerId: '',
payInfo: {},
payBtn: true,
second: 180,
changesecond: true,
},
onLoad: function(options) {
let that = this;
let timestamp = parseInt(new Date().getTime() / 1000);
this.getOpenid();
let admin = wx.getStorageSync('admin');
this.setData({
customerId: admin.id
})
if (options.data) {
let info = that.data.payInfo;
let payInfo = JSON.parse(options.data)
info.sOrderNo = payInfo.sOrderNo;
info.sProductName = payInfo.sProductName;
info.dTotalPrice = payInfo.dTotalPrice;
info.productId = payInfo.productId;
that.setData({
payInfo: info
})
console.log("payInfo", that.data.payInfo)
}
that.countdown(that);
},
getInfo() {
let that = this;
let payInfo = that.data.payInfo;
let msg = {
sType: 'wechatminpay',
sOrderNo: payInfo.sOrderNo,
sProductName: payInfo.sProductName,
dTotalPrice: payInfo.dTotalPrice,
CustomerId: that.data.customerId,
productId: payInfo.productId,
openid: that.data.openid,
type: '',
};
console.log("msg", msg)
app.$apiSaveFormId('sellorder_get_GetPayInfo', msg).then(res => {
console.log("res", res);
}).catch(err => {})
},
payBtn() {
let that = this;
if (!that.data.payBtn){
wx.showToast({
title: "您已经超出支付时间!",
icon: 'none',
duration: 1000
})
return;
}
wx.requestPayment({
'timeStamp': that.data.timestamp,
'nonceStr': '',
'package': '',
'signType': 'MD5',
'paySign': '',
'success': function(res) {},
'fail': function(res) {},
'complete': function(res) {}
})
},
getOpenid() {
let that = this;
wx.login({
success: res => {
this.setData({
code: res.code
})
if (res.code) {
app.$apiNew('miniProgram_customer_LoginByMinOpenId', {
code: res.code
}).then(res => {
this.setData({
openid: res.openid,
})
that.getInfo();
}).catch(err => {
})
} else {
wx.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 1000
})
}
}
})
},
countdown(that) {
var second = that.data.second
if (second == 0) {
that.setData({
payBtn: false,
changesecond: '00:00'
});
return;
}
var time = setTimeout(function() {
let str = that.formatSeconds(second);
that.setData({
second: second - 1,
changesecond:str,
});
that.countdown(that);
}, 1000)
},
formatSeconds(value) {
var theTime = parseInt(value); // 秒
var theTime1 = 0; // 分
if (theTime > 60) {
theTime1 = parseInt(theTime / 60);
theTime = parseInt(theTime % 60);
if (theTime1 > 60) {
theTime1 = parseInt(theTime1 % 60);
}
}
var result = "" + parseInt(theTime); //秒
if (10 > theTime > 0) {
result = "0" + parseInt(theTime); //秒
} else {
result = "" + parseInt(theTime); //秒
}
if (10 > theTime1 > 0) {
result = "0" + parseInt(theTime1) + ":" + result; //分,不足两位数,首位补充0,
} else {
result = "" + parseInt(theTime1) + ":" + result; //分
}
return result;
},
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="bgView">
<view class="pay">
<view class="c99 f22 text">支付剩余时间 00:{{changesecond}}</view>
<view style="margin:20rpx 0" class="f30 text">¥{{payInfo.dTotalPrice}}</view>
<view class="c99 f22 text">{{payInfo.sProductName}}</view>
<view style="margin-top:50rpx;padding:0 30rpx">
<image style="width:30rpx;height:30rpx" src="../../../images/group/wx.png"></image>
<text style="margin-left:30rpx">微信支付</text>
<image style="width:36rpx;height:36rpx;float:right;margin-top:8rpx" src="../../../images/visa/xunazhong.png"></image>
</view>
</view>
<view bindtap="payBtn" class="{{payBtn?'ljzf':'ljzf disabled'}}">立即支付</view>
</view>
\ No newline at end of file
/* pages/Home/pay/pay.wxss */
.disabled{
background: #ccc!important;
color: #000000!important;
}
.pay{
background: #fff;
padding-bottom: 30rpx;
}
.text{
text-align: center;
}
.c99{
color: #999999;
}
.f22{
font-size: 22rpx;
}
.f30{
font-size: 30rpx;
}
.bgView{
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.ljzf{
width:700rpx;
height:82rpx;
line-height:82rpx;
background:rgba(238,68,84,1);
border-radius:12rpx;
text-align: center;
color: #fff;
font-size:28rpx;
margin: 0 auto;
margin-top: 400rpx;
}
\ No newline at end of file
......@@ -5,14 +5,27 @@ Page({
* 页面的初始数据
*/
data: {
// urlHref: "http://activity.oytour.com/html/GT_activities.html",
urlHref:"http://127.0.0.1:5500/html/GT_activities.html",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let admin = wx.getStorageSync('admin');
let customerId = admin.id;
let accountId = admin.customerAccountId;
let token = admin.token;
let secretKey = admin.secretKey;
let platform = "xcx";
let urlHref = this.data.urlHref + "?customerId=" + customerId + '&accountId=' + accountId + '&token=' + token + '&secretKey=' + secretKey + '&platform=' + platform;
console.log("urlHref", urlHref)
this.setData({
urlHref: urlHref
})
},
/**
......
<web-view src="https://www.baidu.com/"></web-view>
\ No newline at end of file
<web-view src="{{urlHref}}"></web-view>
\ No newline at end of file
......@@ -9,8 +9,16 @@
"postcss": true,
"minified": true,
"newFeature": true,
"coverView": true,
"autoAudits": false,
"checkInvalidKey": true
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "2.7.7",
......@@ -206,6 +214,13 @@
"pathName": "pages/product/SametradeZW/SametradeZW",
"query": "",
"scene": null
},
{
"id": -1,
"name": "活动支付",
"pathName": "pages/Home/pay/pay",
"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