Browse Source

新增支付方式选择

master
杜叶春 2 years ago
parent
commit
4b99efa294
  1. BIN
      images/钱包支付.png
  2. 14
      pages/cart/cart.wxss
  3. 53
      pages/login/login.js
  4. 1
      pages/logistics/logistics.wxss
  5. 14
      pages/order/order.js
  6. 28
      pages/order/pay.js
  7. 169
      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

14
pages/cart/cart.wxss

@ -140,8 +140,8 @@ page{
height:160rpx;
border: 1px solid #eee;
}
.kong{
width:200rpx;
.kong{
width:200rpx;
height:200rpx;
}
@ -290,24 +290,24 @@ page{
padding-bottom: 60rpx;
}
.reds{
color: red;
color: red;
}
.pp{
text-align: center;
margin-top:264rpx;
margin-top:300rpx;
}
.cla{
font-family: '微软雅黑';
color: #ccc;
font-family: '微软雅黑';
color: #ccc;
}
.heji{
display:flex;
align-items:center;
width: 71%;
border-top: 1px solid #eee;
border-top: 1px solid #eee;
}

53
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,20 +116,25 @@ Page({
//微信一键登录
tapWeixinLogin : function(e) {
var that = this
WXAPI.wxLogin({
code: that.data.code,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
app.globalData.accessId = data.access_id;
wx.setStorageSync('accessId', data.access_id)
wx.setStorageSync('isLogin', true);
wx.setStorageSync('userInfo', data.user);
wx.navigateBack()
wx.login({
success: function (res) {
var code = res.code;
WXAPI.wxLogin({
code: code,
storeId: 239,
storeType: 1,
}).then(res => {
if (res.code == 200) {
var data = res.data
app.globalData.accessId = data.access_id;
wx.setStorageSync('accessId', data.access_id)
wx.setStorageSync('isLogin', true);
wx.setStorageSync('userInfo', data.user);
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

169
pages/order/pay.wxml

@ -25,111 +25,112 @@
<!-- 加载页面结束 -->
<block wx:else>
<!--普通结算开始 -->
<view class="w100" style='padding-bottom:100px;'>
<!-- 收货地址 -->
<view class="p_all bg_white mt10 font_14 top_xt" wx:if="{{addrId != ''}}">
<view bindtap='go' data-url="../address/index?cartId={{cartId}}" hover-class="none">
<view class="df">
<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>
<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 class="w100" style='padding-bottom:100px;'>
<!-- 收货地址 -->
<view class="p_all bg_white mt10 font_14 top_xt" wx:if="{{addrId != ''}}">
<view bindtap='go' data-url="../address/index?cartId={{cartId}}" hover-class="none">
<view class="df">
<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>
<image class="x_right mt15" src="/images/x_right.png"></image>
<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>
<image class="x_right mt15" src="/images/x_right.png"></image>
</view>
</view>
<view class="p_all bg_white mt10 font_14" wx:else>
<view bindtap='go' data-url="../address/index?cartId={{cartId}}" hover-class="none">
<view class="df">添加收货地址</view>
</view>
</view>
<view class="p_all bg_white mt10 font_14" wx:else>
<view bindtap='go' data-url="../address/index?cartId={{cartId}}" hover-class="none">
<view class="df">添加收货地址</view>
</view>
<view style='height:10px;width:100%;background:#eee;'></view>
<!-- 产品信息 -->
<view class="shop-list" wx:key="key" wx:for="{{productData}}" >
</view>
<view style='height:10px;width:100%;background:#eee;'></view>
<!-- 产品信息 -->
<view class="shop-list" wx:key="key" wx:for="{{productData}}">
<view class="shopView">
<image src="{{item.shop_logo}}" mode="aspectFill"></image>
<text class="left">{{item.shop_name}}</text>
<image class="jiantou-img" src="/images/x_right.png" mode="aspectFill"></image>
</view>
<view style="margin-left:30rpx;width:720px;height:2rpx;background-color:#eee;"></view>
<view class="p_all bg_white df item" style='height:70px;' wx:key="key" wx:for="{{item.list}}">
<view class="cp_photo">
<image src="{{item.img}}" mode="aspectFill"></image>
</view>
<view class="df_1">
<view class="sp_text">
<view style='width:70%;'>
<view class="sp_tit ovh1" style="color: #000;">{{item.product_title}}</view>
<view class="sp_tit ovh1" style='color:#808080'>[{{item.size}}]</view>
<view class='sp_tit ovh1'>¥ {{item.price}} </view>
</view>
<view class="sp_jg">
<view class='guige'>x{{item.num}}</view>
</view>
<view class="p_all bg_white df item" style='height:70px;' wx:key="key" wx:for="{{item.list}}">
<view class="cp_photo">
<image src="{{item.img}}" mode="aspectFill"></image>
</view>
<view class="df_1">
<view class="sp_text">
<view style='width:70%;'>
<view class="sp_tit ovh1" style="color: #000;">{{item.product_title}}</view>
<view class="sp_tit ovh1" style='color:#808080'>[{{item.size}}]</view>
<view class='sp_tit ovh1'>¥ {{item.price}} </view>
</view>
<view class="sp_jg">
<view class='guige'>x{{item.num}}</view>
</view>
</view>
</view>
</view>
</view>
<!-- 信息 -->
<view style='background:#fff;'>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">运费</text>
<text wx:if="{{freight == 0}}" class="right">包邮</text>
<text wx:else class="right">{{freight}}元</text>
</view>
<view wx:if="{{discount}}" bindtap="setModalStatus" data-type="" data-status="1" style='border-bottom:1px solid #eee;padding:10px;'>
<view style='float:left;font-size:16px;'>优惠券</view>
<view style='float:right'>
<text wx:if="{{money}}" class="right" style="font-size: 16px;">使用优惠券:{{money}}</text>
<image src='../../images/x_right.png' style='width:25rpx;height:25rpx;'></image>
</view>
<view style='clear:both;'></view>
</view>
<view class="pay_zf pd" wx:if="{{name}}">
<text class="left">活动</text>
<text class="right" style='color:{{bgcolor}};'>{{name}}</text>
</view>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">钱包余额</text>
<text wx:if="{{d_yuan}}" class="right">余额抵扣{{d_yuan}}</text>
<text wx:else class="right">{{user_money}}元</text>
</view>
<view wx:if="{{pay_xs}}">
<view style='height:10px;width:100%;background:#eee;'></view>
<view class="pay_zf pd">
<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;'>
<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;' /> -->
</view>
</label>
</checkbox-group>
<!-- 信息 -->
<view style='background:#fff;'>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">运费</text>
<text wx:if="{{freight == 0}}" class="right">包邮</text>
<text wx:else class="right">{{freight}}元</text>
</view>
<view wx:if="{{discount}}" bindtap="setModalStatus" data-type="" data-status="1" style='border-bottom:1px solid #eee;padding:10px;'>
<view style='float:left;font-size:16px;'>优惠券</view>
<view style='float:right'>
<text wx:if="{{money}}" class="right" style="font-size: 16px;">使用优惠券:{{money}}</text>
<image src='../../images/x_right.png' style='width:25rpx;height:25rpx;'></image>
</view>
<view style='clear:both;'></view>
</view>
<view class="pay_zf pd" wx:if="{{name}}">
<text class="left">活动</text>
<text class="right" style='color:{{bgcolor}};'>{{name}}</text>
</view>
<view class="pay_qb pd" style='border-bottom:1px solid #eee;'>
<text class="left">钱包余额</text>
<text wx:if="{{d_yuan}}" class="right">余额抵扣{{d_yuan}}</text>
<text wx:else class="right">{{user_money}}元</text>
</view>
<view wx:if="{{pay_xs}}">
<view style='height:10px;width:100%;background:#eee;'></view>
<view class="pay_zf pd">
<text class="left">选择支付方式</text>
</view>
<view class="pay_zf pd" style='border-bottom:none;padding-right:3px;'>
<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>
<radio class="select" value="{{item.type}}" checked="{{item.checked}}" />
</view>
</view>
</view>
</radio-group>
</view>
</view>
</view>
<!--普通结束 -->
<!-- 结算 -->
<view class='pay_foot'>
<view class="pay_fk">
<view class="zhifu mt10 ">合计:
<span class="font_20 red" total="{{total}}">¥ {{total}}</span>
</view>
<button wx:if="{{pay_xs}}" class="right btn_zf" type="primary" id="{{paytype}}" style='background:#FA5151;;border-radius:0;' disabled="{{btnDisabled}}" formType="submit" bindtap="createProductOrderByWX">立即支付</button>
<button wx:else class="right btn_zf" type="primary" id="{{paytype}}" style='background:background;border-radius:0;' disabled="{{btnDisabled}}" formType="submit">提交订单</button>
</view>
<!--普通结束 -->
<!-- 结算 -->
<view class='pay_foot'>
<view class="pay_fk">
<view class="zhifu mt10 ">合计:
<span class="font_20 red" total="{{total}}">¥ {{total}}</span>
</view>
<button wx:if="{{pay_xs}}" class="right btn_zf" type="primary" id="{{paytype}}" style='background:#FA5151;;border-radius:0;' disabled="{{btnDisabled}}" formType="submit" bindtap="createProductOrderByWX">立即支付</button>
<button wx:else class="right btn_zf" type="primary" id="{{paytype}}" style='background:background;border-radius:0;' disabled="{{btnDisabled}}" formType="submit">提交订单</button>
</view>
</view>
</view>
<!--普通结算结束 -->
</block>

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