Browse Source

扫码付款页面内容的添加及布局调整优化

master
W夏日 2 years ago
parent
commit
91663c291b
  1. 3
      app.json
  2. 441
      pages/scan-code/scan-code.js
  3. 6
      pages/scan-code/scan-code.json
  4. 33
      pages/scan-code/scan-code.wxml
  5. 123
      pages/scan-code/scan-code.wxss

3
app.json

@ -6,7 +6,8 @@
"pages/withdrawal-management/withdrawal-management",
"pages/account-opened/account-opened",
"pages/withdrawal-history/withdrawal-history",
"pages/queuing-information/queuing-information"
"pages/queuing-information/queuing-information",
"pages/scan-code/scan-code"
],
"requiredPrivateInfos": [
"chooseAddress"

441
pages/scan-code/scan-code.js

@ -0,0 +1,441 @@
// order.js
var api = require('../../api.js');
var app = getApp();
var is_no_more = false;
var is_loading = false;
var pageSize = 5;
var pageNum = 1;
var utils = require('../../utils.js');
var util = require('../../utils/util.js');
Page({
/**
* 页面的初始数据
*/
data: {
imgServer: api.default.img_server,
status: -1,
order_list: [],
show_no_data_tip: false,
hide: 1,
qrcode: "",
key:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var page = this;
is_no_more = false;
is_loading = false;
page.data.key = ""
pageNum = 1;
pageSize = 1000;
page.loadOrderList(options.status || -1);
var pages = getCurrentPages();
if (pages.length < 9) {
page.setData({
show_index: true,
});
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// this.loadOrderList(this.data.status);
},
formSubmit: function (e) {
var page = this;
pageNum = 1;
page.data.key = e.detail.value.search;
page.loadOrderList(page.data.status);
}
,
loadOrderList: function(status) {
var access_token = wx.getStorageSync("access_token");
if (status == undefined)
status = -1;
var page = this;
page.setData({
status: status,
});
wx.showLoading({
title: "正在加载",
mask: true,
});
app.request({
url: api.order.list,
data: {
userid: access_token,
pageNum: pageNum,
pageSize: pageSize,
key:page.data.key,
status: page.data.status,
},
success: function(res) {
console.log(res)
if (res.code == 200) {
page.setData({
order_list: res.data.list,
});
if (res.data.total > pageSize) {
is_no_more = false
pageNum++
} else {
is_no_more = true
}
}
page.setData({
show_no_data_tip: (page.data.order_list.length == 0),
});
},
complete: function() {
wx.hideLoading();
}
});
},
statusChange: function(e) {
var page = this;
pageNum = 1;
is_no_more = false;
is_loading = false;
var status = e.currentTarget.dataset.status
page.setData({
status: status
});
page.loadOrderList(status)
},
onReachBottom: function() {
var access_token = wx.getStorageSync("access_token");
var page = this;
if (is_loading || is_no_more)
return;
is_loading = true;
app.request({
url: api.order.list,
data: {
userid: access_token,
pageNum: pageNum,
pageSize: pageSize,
key:page.data.key,
status: page.data.status,
},
success: function(res) {
console.log(res)
if (res.code == 200) {
var order_list = page.data.order_list.concat(res.data.list);
page.setData({
order_list: order_list,
});
if (res.data.total > order_list.length) {
is_no_more = false
pageNum++
} else {
is_no_more = true
}
}
},
complete: function() {
is_loading = false;
}
});
},
orderPay: function(e) {
wx.showLoading({
title: "正在提交",
mask: true,
});
app.request({
url: api.order.pay_data,
data: {
order_id: e.currentTarget.dataset.id,
pay_type: "WECHAT_PAY",
},
complete: function() {
wx.hideLoading();
},
success: function(res) {
console.log(res);
if (res.code == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: function(e) {
console.log("success");
console.log(e);
wx.requestSubscribeMessage({
tmplIds: ['bPgXd4I-7E-GYafPJSNJEAQMuptkU_SYG1OscN7MM0o'],
success(res) {
console.log(res)
},
fail(error) {
console.log(error)
}
});
},
fail: function(e) {
console.log("fail");
console.log(e);
},
complete: function(e) {
console.log("complete");
console.log(e);
if (e.errMsg == "requestPayment:fail" || e.errMsg == "requestPayment:fail cancel") { //支付失败转到待支付订单列表
wx.showModal({
title: "提示",
content: "订单尚未支付",
showCancel: false,
confirmText: "确认",
success: function(res) {
if (res.confirm) {
wx.redirectTo({
url: "/pages/order/order?status=9",
});
}
}
});
return;
}
wx.redirectTo({
url: "/pages/order/order?status=9",
});
},
});
}
if (res.code == 1) {
wx.showToast({
title: res.msg,
image: "/images/icon-warning.png",
});
}
}
});
},
onShareAppMessage: function (e) {
var page = this;
console.log("+++++++++");
console.log(e);
var res = {
path: "/pages/order-detail-daifu/order-detail-daifu?id="
+ e.target.dataset.id,
success: function (e) {
console.log(e);
share_count++;
if (share_count == 1)
app.shareSendCoupon(page);
},
title: "帮我代付一下,江湖救急~",
imageUrl: "https://lovehomelive.oss-cn-beijing.aliyuncs.com/ic_logo.png",
};
return res;
},
toPay: function(e) {
//获取支付数据
app.request({
url: api.order.pay_data,
data: {
id: e.currentTarget.dataset.id,
payType: 2,
},
success: function(res) {
console.log(res);
if (res.code == 200) {
//发起支付
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: function(e) {
console.log('1');
console.log(e);
wx.requestSubscribeMessage({
tmplIds: ['bPgXd4I-7E-GYafPJSNJEAQMuptkU_SYG1OscN7MM0o'],
success(res) {
console.log(res)
},
fail(error) {
console.log(error)
}
});
wx.redirectTo({
url: "/pages/order/order?status=3",
});
},
fail: function(e) {
console.log('2');
console.log(e);
},
complete: function(e) {
console.log('3');
console.log(e);
if (e.errMsg == "requestPayment:fail" || e.errMsg == "requestPayment:fail cancel") { //支付失败转到待支付订单列表
wx.showModal({
title: "提示",
content: "订单尚未支付",
showCancel: false,
confirmText: "确认",
success: function(res) {
if (res.confirm) {
wx.redirectTo({
url: "/pages/order/order?status=2",
});
}
}
});
return;
}
if (e.errMsg == "requestPayment:ok") {
return;
}
},
});
return;
}
if (res.code == 1) {
wx.showToast({
title: res.msg,
image: "/images/icon-warning.png",
});
return;
}
}
});
},
orderRevoke: function(e) {
var page = this;
wx.showModal({
title: "提示",
content: "是否取消该订单?",
cancelText: "否",
confirmText: "是",
success: function(res) {
if (res.cancel)
return true;
if (res.confirm) {
wx.showLoading({
title: "操作中",
});
app.request({
url: api.order.revoke,
data: {
orderId: e.currentTarget.dataset.id,
},
success: function(res) {
wx.hideLoading();
page.loadOrderList(page.data.status);
}
});
}
}
});
},
orderConfirm: function (e) {
var page = this;
wx.requestSubscribeMessage({
tmplIds: ['LYqmtO9TqZNW4MUcdIjfZ6id2t_LheP98foMtJA92j4','CKLCPm5agmZHhhXItoo7foFN_S_5bt2CWiw-_-OvIVw'],
success(res) {
page.orderConfirm2(e);
console.log(res)
}
})
},
orderConfirm2: function(e) {
var page = this;
wx.showModal({
title: "提示",
content: "是否确认已收到货?",
cancelText: "否",
confirmText: "是",
success: function(res) {
if (res.cancel)
return true;
if (res.confirm) {
wx.showLoading({
title: "操作中",
});
app.request({
url: api.order.confirm,
data: {
orderId: e.currentTarget.dataset.id,
},
success: function(res) {
wx.hideLoading();
wx.showToast({
title: res.msg,
});
if (res.code == 200) {
page.loadOrderList(3);
}
}
});
}
}
});
},
orderQrcode: function(e) {
var page = this;
var order_list = page.data.order_list;
var index = e.target.dataset.index;
wx.showLoading({
title: "正在加载",
mask: true,
});
if (page.data.order_list[index].offline_qrcode) {
page.setData({
hide: 0,
qrcode: page.data.order_list[index].offline_qrcode
});
wx.hideLoading();
} else {
app.request({
url: api.order.get_qrcode,
data: {
order_no: order_list[index].order_no
},
success: function(res) {
page.setData({
hide: 0,
qrcode: res.data.url
});
},
complete: function() {
wx.hideLoading();
}
});
}
},
hide: function(e) {
this.setData({
hide: 1
});
}
});

6
pages/scan-code/scan-code.json

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "扫码",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#EDEDED",
"navigationBarTextStyle": "black"
}

33
pages/scan-code/scan-code.wxml

@ -0,0 +1,33 @@
<view class="page-content">
<view class="avatar-information">
<view class="head-sculpture">
<image class="default-avatar" src="https://common-1257637852.cos.ap-guangzhou.myqcloud.com/paidui-pay/default-avatar.png" />
</view>
<view class="information-content">
<view class="information-content-title">付款给李姐烧烤(普罗旺斯店)</view>
<view class="address-information">
<view class="address-content">广西南宁市江南区波尔多庄园2-109号商铺</view>
<image class="address-icon" src="https://common-1257637852.cos.ap-guangzhou.myqcloud.com/paidui-pay/address-icon.png" />
</view>
</view>
</view>
<view class="payment-content">
<view class="payment-title">付款金额(元)</view>
<view class="amount-input">
<view class="amount-characters">¥</view>
<input class="enter-amount-input" bindinput= "" name="phone" placeholder="请输入金额" value="" />
</view>
<view class="prompt-content">向商家询问支付金额</view>
</view>
<view class="remind-content">
<view class="remind-content-left">
<view class="content-left-title">支付金额给商户</view>
<view class="line-style"></view>
<view class="payment-type">
<image class="alipay-icon" src="https://common-1257637852.cos.ap-guangzhou.myqcloud.com/paidui-pay/alipay-icon.png" />
<view class="payment-type-text">支付宝支付</view>
</view>
</view>
<view class="content-right">查看活动规则</view>
</view>
</view>

123
pages/scan-code/scan-code.wxss

@ -0,0 +1,123 @@
page{
background: #EDEDED;
}
.page-content{
padding: 30rpx;
}
.avatar-information{
display: flex;
justify-content: left;
align-items: center;
padding: 30rpx 0;
}
image.default-avatar{
width: 110rpx;
height: 110rpx;
background-size: cover;
}
.information-content{
margin-left: 30rpx;
}
.information-content-title{
font-family: PingFangSC-Regular, sans-serif;
font-size: 32rpx;
color: #454545;
font-weight: bold;
}
.address-information{
width: 552rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
}
.address-content{
font-family: PingFangSC-Regular, sans-serif;
font-size: 24rpx;
color: #666666;
}
image.address-icon{
width: 30rpx;
height: 36rpx;
background-size: cover;
}
.payment-content{
background: #fff;
}
.payment-title{
font-family: PingFangSC-Regular, sans-serif;
font-size: 30rpx;
color: #454545;
padding: 30rpx;
}
.amount-input{
display: flex;
justify-content: left;
align-items: center;
padding: 30rpx;
padding-bottom: 50rpx;
}
.amount-characters{
font-family: PingFangSC-Regular, sans-serif;
font-size: 30rpx;
color: #454545;
font-weight: bold;
}
input.enter-amount-input{
height: 88rpx;
font-family: PingFangSC-Regular, sans-serif;
font-size: 60rpx;
color: #CFCFCF;
margin-left: 30rpx;
}
.prompt-content{
font-family: PingFangSC-Regular, sans-serif;
font-size: 24rpx;
color: #666666;
border-top: 1rpx solid #eee;
padding: 40rpx 30rpx;
}
.remind-content{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 30rpx;
}
.remind-content-left{
display: flex;
justify-content: left;
align-items: center;
}
.content-left-title{
font-family: PingFangSC-Regular, sans-serif;
font-size: 24rpx;
color: #666666;
}
.line-style{
width: 1rpx;
height: 22rpx;
background: #CCCCCC;
margin: 0 30rpx;
}
.payment-type{
display: flex;
justify-content: left;
align-items: center;
}
image.alipay-icon{
width: 30rpx;
height: 30rpx;
background-size: cover;
}
.payment-type-text{
font-family: PingFangSC-Regular, sans-serif;
font-size: 24rpx;
color: #999999;
margin-left: 10rpx;
}
.content-right{
font-family: PingFangSC-Regular, sans-serif;
font-size: 24rpx;
color: #1783FF;
}
Loading…
Cancel
Save