Browse Source

新增支付方式选择

master
杜叶春 2 years ago
parent
commit
4b99efa294
  1. BIN
      images/钱包支付.png
  2. 2
      pages/cart/cart.wxss
  3. 29
      pages/login/login.js
  4. 1
      pages/logistics/logistics.wxss
  5. 14
      pages/order/order.js
  6. 28
      pages/order/pay.js
  7. 13
      pages/order/pay.wxml
  8. 7
      pages/order/pay.wxss
  9. 8
      pages/set/set.js
  10. 29
      pages/user/user.js
  11. 3
      pages/user/user.wxml
  12. 4
      utils/server.js

BIN
images/钱包支付.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

2
pages/cart/cart.wxss

@ -297,7 +297,7 @@ page{
.pp{
text-align: center;
margin-top:264rpx;
margin-top:300rpx;
}
.cla{
font-family: '微软雅黑';

29
pages/login/login.js

@ -73,27 +73,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.reloadData()
},
reloadData() {
var that = this
wx.login({
success: function (res) {
var code = res.code;
that.setData({
code: code,
})
WXAPI.getWXTemplates({
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
wx.setStorageSync('logmsgId', [data.delivery])
}
})
}
});
},
// wxlogin(){
// var that = this
@ -136,8 +116,11 @@ Page({
//微信一键登录
tapWeixinLogin : function(e) {
var that = this
wx.login({
success: function (res) {
var code = res.code;
WXAPI.wxLogin({
code: that.data.code,
code: code,
storeId: 239,
storeType: 1,
}).then(res => {
@ -150,6 +133,8 @@ Page({
wx.navigateBack()
}
})
}
});
},
/**
* 生命周期函数--监听页面显示

1
pages/logistics/logistics.wxss

@ -14,7 +14,6 @@
position: relative;
}
.logistics_centent{
/* position: absolute; */
margin-top: -25rpx;
margin-left: 100rpx;
font-size: 30rpx;

14
pages/order/order.js

@ -223,8 +223,20 @@ Page({
currentStatus: options.status
})
that.reloadData();
that.getWXTemplate()
},
getWXTemplate() {
WXAPI.getWXTemplate({
storeId: 239,
storeType: 1,
type: 2,
}).then(res => {
if (res.code == 200) {
var data = res.data
wx.setStorageSync('logmsgId', [data.template_id])
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

28
pages/order/pay.js

@ -7,7 +7,7 @@ Page({
pays: [],
itemData: {},
userId: 0,
paytype: 'wxPay', //支付方式
paytype: 'bank_pay', //支付方式
cartId: 0,
addrId: 0, //收货地址//测试--
btnDisabled: false,
@ -71,7 +71,6 @@ Page({
}
}
},
onLoad: function (options) {
// console.log(options)
var that = this;
@ -91,6 +90,19 @@ Page({
wallet: wallet, // 钱包状态
});
this.Settlement(options);
this.getWXTemplate();
},
getWXTemplate() {
WXAPI.getWXTemplate({
storeId: 239,
storeType: 1,
type: 2,
}).then(res => {
if (res.code == 200) {
var data = res.data
wx.setStorageSync('logmsgId', [data.template_id])
}
})
},
//页面加载完成函数
onReady: function () {
@ -156,6 +168,12 @@ Page({
// }
},
//单选支付方式
updataRadio:function(e){
this.setData({
paytype: e.detail.value
})
},
// 进入结算页面
Settlement: function (options) {
var that = this;
@ -181,10 +199,10 @@ Page({
}
var pays = []
if (data.payment.bank_pay == 1) {
pays.push({'name':'公对公支付','icon':'/images/公对公.png'})
pays.push({'name':'公对公支付','icon':'/images/公对公.png','type':'bank_pay','checked':true})
}
// if (data.payment.wallet_pay == 1) {
// pays.push({'name':'余额支付','icon':'/images/weixin.png'})
// pays.push({'name':'余额支付','icon':'/images/钱包支付.png','type':'wallet_pay','checked':false})
// }
that.setData({
productAry: options.product,
@ -542,7 +560,7 @@ Page({
remarks: '',
vipSource: 0,
product: that.data.productAry,
pay_type: 'bank_pay',
pay_type: that.data.paytype,
}).then(res => {
if (res.code == 200) {
var data = res.data

13
pages/order/pay.wxml

@ -33,7 +33,8 @@
<view class='iconfont icon-dizhi' style='margin:auto 0;'></view>
<view class="df_1 c6">
<view class="l_h20 pay_xt" style='color:#333333;font-size:16px;'>
<text style='color:#333333;font-size:18px;'>{{address.name}}</text> {{address.tel}}</view>
<text style='color:#333333;font-size:18px;'>{{address.name}}</text> {{address.tel}}
</view>
<view class="l_h20 mt5 pay_xt" style='color:#333333;padding:0 4px;'>地址:{{address.address_xq}}</view>
<input type="text" style='display:none;' name="address" value="{{address.address_xq}}" />
</view>
@ -105,15 +106,15 @@
<text class="left">选择支付方式</text>
</view>
<view class="pay_zf pd" style='border-bottom:none;padding-right:3px;'>
<checkbox-group class="radio-group left">
<label class="radio" wx:for-items="{{pays}}" wx:key="key" style='border-bottom:1px solid #eee;'>
<radio-group class="radio-group left" bindchange="updataRadio">
<view class="radio" wx:for="{{pays}}" wx:key="key">
<view class="payment">
<image src='{{item.icon}}'></image>
<text>{{item.name}}</text>
<!-- <switch bindchange="switchChange" checked="{{item.checked}}" data-index="{{index}}" data-check="{{item.value}}" class="right" style='vertical-align:2px;float:right;margin-bottom:20px;' /> -->
<radio class="select" value="{{item.type}}" checked="{{item.checked}}" />
</view>
</view>
</label>
</checkbox-group>
</radio-group>
</view>
</view>
</view>

7
pages/order/pay.wxss

@ -596,8 +596,6 @@ color:#fff;
/* color: #FF6347; */
}
.radio-group {
display:block;
width:100%;
@ -615,7 +613,10 @@ color:#fff;
.payment text{
margin-left: 15rpx;
}
.select{
position: absolute;
right: 20rpx;
}
/*优惠券 */
.orderDetails {
border-bottom: 10px solid #f3f3f3;

8
pages/set/set.js

@ -72,9 +72,11 @@ Page({
wx.clearStorage({
success: (res) => {
wx.clearStorageSync('isLogin');
wx.reLaunch({
url: '/pages/login/login',
})
wx.clearStorageSync('accessId');
wx.navigateBack()
// wx.reLaunch({
// url: '/pages/login/login',
// })
},
})
} else {

29
pages/user/user.js

@ -41,6 +41,8 @@ Page({
remind: '加载中',
tjr: false,
user:'',
xxnum: 0,
accessId: app.globalData.accessId,
},
//下拉刷新
onPullDownRefresh: function () {
@ -81,14 +83,14 @@ Page({
},
onShow: function () {
var that = this;
var cont = that.data.cont;
if (cont > 1) {
// var cont = that.data.cont;
// if (cont > 1) {
that.requestMyData();
} else {
that.setData({
cont: cont + 1
})
}
// } else {
// that.setData({
// cont: cont + 1
// })
// }
},
requestMyData: function () {
var that = this;
@ -102,8 +104,8 @@ Page({
var data = res.data;
if (data.data) {
that.setData({
xxnum: data.data.xxnum,
user: data.data.user,
// article: data.data.article,
logo: data.data.logo,
company: data.data.company,
th: data.data.th,
@ -117,6 +119,17 @@ Page({
});
}
else {
that.setData({
xxnum: '',
user: '',
logo: '',
company: '',
th: '',
dfh_num: '',
dfk_num: '',
dpj_num: '',
dsh_num: '',
});
wx.removeStorageSync('accessId')
wx.removeStorageSync('isLogin');
wx.removeStorageSync('userInfo');

3
pages/user/user.wxml

@ -54,8 +54,7 @@
<view class="top-message">
<image src="/images/grxx.png" class="btnimgl" lazy-load="true" bindtap="navToNotice">
</image>
<view class="xxnum" v-if="access_id1&&user.xxnum>0">{{ user.xxnum > 99 ? '99+' : user.xxnum }}
</view>
<view class="xxnum" wx:if="{{xxnum>0}}">{{ xxnum > 99 ? '99+' : xxnum }}</view>
</view>
</view>

4
utils/server.js

@ -65,8 +65,8 @@ module.exports = {
logout: (data) => { //退出登录
return requestServer('app.login.quit', 'post', data)
},
getWXTemplates: (data) => { //获取订阅消息模板
return requestServer('app.message.getWxTemplates', 'post', data)
getWXTemplate: (data) => { //获取订阅消息模板
return requestServer('app.message.getWxTemplate', 'post', data)
},
/* 首页 */
homeIndex: (data) => { //首页

Loading…
Cancel
Save