作者 宋国杰

添加支付功能 电子商城页面跳转

{
"pages": [
"pages/index/index",
"pages/chailvcode/chailvcode",
"pages/login/login",
"pages/register/register",
"pages/coupon/coupon",
"pages/lingqucoupon/lingqucoupon",
"pages/startindex/startindex",
"pages/zuji/zuji",
"pages/messagedetail/messagedetail",
"pages/message/message",
"pages/shop_cart/shop_cart",
"pages/classify/classify",
"pages/my/my",
"pages/shop_detail/shop_detail",
"pages/order/order",
"pages/Collection/collection",
"pages/order/return_goods/return_goods",
"pages/my/about_us/about_us",
"pages/my/my_integral/my_integral",
"pages/address/address",
"pages/address/edit_address/edit_address",
"pages/address/add_address/add_address",
"pages/search/search",
"pages/search/search_result/search_result",
"pages/order/order_list/order_list",
"pages/order/order_detail/order_detail",
"pages/logistics/logistics",
"pages/notice/notice",
"pages/outerChain/outerChain",
"pages/outerChain2/outerChain2",
"pages/zhuanqu/zhuanqu",
"pages/taocandetail/taocandetail",
"pages/taocanpay/taocanpay",
"pages/orderdetail/orderdetail",
"pages/xianshi/xianshi",
"pages/coupon",
"pages/pinpaibox/pinpaibox",
"pages/jumplink/jumplink",
"pages/birthday/birthday"
],
"subpackages": [
{
"root": "packageA",
"pages": [
"pages": [
"pages/index/index",
"pages/choujiang/choujiang",
"pages/rule/rule",
"pages/record/record",
"pages/register/register",
"pages/chailvcode/chailvcode",
"pages/login/login",
"pages/register/register",
"pages/coupon/coupon",
"pages/lingqucoupon/lingqucoupon",
"pages/startindex/startindex",
"pages/zuji/zuji",
"pages/messagedetail/messagedetail",
"pages/message/message",
"pages/message/message",
"pages/shop_cart/shop_cart",
"pages/classify/classify",
"pages/my/my",
... ... @@ -64,64 +20,111 @@
"pages/my/about_us/about_us",
"pages/my/my_integral/my_integral",
"pages/address/address",
"pages/address/edit_address/edit_address",
"pages/address/edit_address/edit_address",
"pages/address/add_address/add_address",
"pages/search/search",
"pages/search/search_result/search_result",
"pages/order/order_list/order_list",
"pages/order/order_list/order_list",
"pages/order/order_detail/order_detail",
"pages/logistics/logistics",
"pages/notice/notice",
"pages/outerChain/outerChain",
"pages/outerChain2/outerChain2",
"pages/zhuanqu/zhuanqu",
"pages/taocandetail/taocandetail",
"pages/taocanpay/taocanpay",
"pages/orderdetail/orderdetail",
"pages/xianshi/xianshi"
]
}
],
"preloadRule":{
"pages/index/index":{
"network":"all",
"packages": ["packageA"]
}
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#3D9AF8",
"navigationBarTitleText": "海创诚品",
"navigationBarTextStyle": "white"
},
"tabBar": {
"custom": true,
"list": [
{
"pagePath": "pages/index/index",
"text": "商品",
"iconPath": "images/tabbar/icon_75.png",
"selectedIconPath": "images/tabbar/icon_68.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "images/tabbar/message.png",
"selectedIconPath": "images/tabbar/messageactive.png"
},
{
"pagePath": "pages/shop_cart/shop_cart",
"text": "购物车",
"iconPath": "images/tabbar/icon_70.png",
"selectedIconPath": "images/tabbar/icon_73.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "images/tabbar/icon_71.png",
"selectedIconPath": "images/tabbar/icon_72.png"
}
"pages/xianshi/xianshi",
"pages/coupon",
"pages/pinpaibox/pinpaibox",
"pages/jumplink/jumplink",
"pages/birthday/birthday",
"pages/pay/pay"
],
"subpackages": [
{
"root": "packageA",
"pages": [
"pages/index/index",
"pages/choujiang/choujiang",
"pages/rule/rule",
"pages/record/record",
"pages/register/register",
"pages/login/login",
"pages/startindex/startindex",
"pages/zuji/zuji",
"pages/messagedetail/messagedetail",
"pages/message/message",
"pages/shop_cart/shop_cart",
"pages/classify/classify",
"pages/my/my",
"pages/shop_detail/shop_detail",
"pages/order/order",
"pages/Collection/collection",
"pages/order/return_goods/return_goods",
"pages/my/about_us/about_us",
"pages/my/my_integral/my_integral",
"pages/address/address",
"pages/address/edit_address/edit_address",
"pages/address/add_address/add_address",
"pages/search/search",
"pages/search/search_result/search_result",
"pages/order/order_list/order_list",
"pages/order/order_detail/order_detail",
"pages/logistics/logistics",
"pages/notice/notice",
"pages/outerChain/outerChain",
"pages/zhuanqu/zhuanqu",
"pages/taocandetail/taocandetail",
"pages/taocanpay/taocanpay",
"pages/orderdetail/orderdetail",
"pages/xianshi/xianshi"
]
}
],
"selectedColor": "#05091A"
},
"sitemapLocation": "sitemap.json"
"preloadRule": {
"pages/index/index": {
"network": "all",
"packages": [
"packageA"
]
}
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#3D9AF8",
"navigationBarTitleText": "海创诚品",
"navigationBarTextStyle": "white"
},
"tabBar": {
"custom": true,
"list": [
{
"pagePath": "pages/index/index",
"text": "商品",
"iconPath": "images/tabbar/icon_75.png",
"selectedIconPath": "images/tabbar/icon_68.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "images/tabbar/message.png",
"selectedIconPath": "images/tabbar/messageactive.png"
},
{
"pagePath": "pages/shop_cart/shop_cart",
"text": "购物车",
"iconPath": "images/tabbar/icon_70.png",
"selectedIconPath": "images/tabbar/icon_73.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "images/tabbar/icon_71.png",
"selectedIconPath": "images/tabbar/icon_72.png"
}
],
"selectedColor": "#05091A"
},
"sitemapLocation": "sitemap.json"
}
\ No newline at end of file
... ...
... ... @@ -166,6 +166,7 @@ Page({
url: '/pages/outerChain2/outerChain2?src=' + encodeURIComponent(url)
})
},
// 进入劳保商城
laobao() {
... ... @@ -349,10 +350,16 @@ Page({
wx.navigateTo({
url: '/pages/birthday/birthday?type=' + e.currentTarget.id,
})
}
},
//跳转电子商城
elecshop(){
let url = "https://store.800890.com/mobile/pages/index/index?channel=2c90808b93d561160193f1b34884147b&thirdId=2";
wx.navigateTo({
url: '/pages/outerChain2/outerChain2?src=' + encodeURIComponent(url)
})
},
onLoad: function (options) {
console.log(app.globalData.index)
... ...
... ... @@ -99,7 +99,7 @@
<view class="fenleiitem" bindtap="zaixian">
<image src="/images/movie.png" mode="widthFix"></image>
</view>
<view class="fenleiitem">
<view class="fenleiitem" bindtap="elecshop">
<image src="/images/elecshop.png" mode="widthFix"></image>
</view>
<view class="fenleiitem">
... ...
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
success: false,
order_sn:'',
pay_total:''
},
//开放订单支付
order_pay(order_sn,pay_total) {
let that = this;
let url = '/order/payH5'
let params = {
order_sn,
pay_total
}
app.postk(url, params).then((res) => {
that.payment(res.data)
})
},
payment(res) {
let that = this;
console.log(347734748)
var timeStamp = res.timeStamp.toString();
// console.log(timeStamp);
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: res.signType,
paySign: res.paySign,
success: function (res) {
let url = "https://store.800890.com/mobile/pages/package-C/order/order-list/index";
console.log(encodeURIComponent(url));
wx.navigateTo({
url: '/pages/outerChain2/outerChain2?src=' + encodeURIComponent(url)
})
},
fail: function (res) {
let url = "https://store.800890.com/mobile/pages/package-C/order/order-list/index";
console.log(encodeURIComponent(url));
wx.navigateTo({
url: '/pages/outerChain2/outerChain2?src=' + encodeURIComponent(url)
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
if(options.order_sn==null || options.order_sn==undefined ){
wx.showToast({
title: '请传入订单编号',
icon:'error'
})
}
if(options.pay_total==null || options.pay_total==undefined ){
wx.showToast({
title: '请传入支付金额',
icon:'error'
})
}
this.setData({
order_sn:options.order_sn,
pay_total:options.pay_total
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function (options) {
console.log('onshow')
console.log(options);
this.order_pay(this.data.order_sn,this.data.pay_total)
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "订单支付",
"usingComponents": {}
}
\ No newline at end of file
... ...
/* pages/pay/pay.wxss */
\ No newline at end of file
... ...
... ... @@ -5,6 +5,13 @@
"miniprogram": {
"list": [
{
"name": "三方支付",
"pathName": "pages/pay/pay",
"query": "order_sn=11111111&pay_total=0.01",
"launchMode": "default",
"scene": null
},
{
"name": "自定义菜单",
"pathName": "pages/register/register",
"query": "",
... ...