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

53
pages/login/login.js

@ -73,27 +73,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { 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(){ // wxlogin(){
// var that = this // var that = this
@ -136,20 +116,25 @@ Page({
//微信一键登录 //微信一键登录
tapWeixinLogin : function(e) { tapWeixinLogin : function(e) {
var that = this var that = this
WXAPI.wxLogin({ wx.login({
code: that.data.code, success: function (res) {
storeId: 239, var code = res.code;
storeType: 1, WXAPI.wxLogin({
}).then(res => { code: code,
if (res.code == 200) { storeId: 239,
var data = res.data storeType: 1,
app.globalData.accessId = data.access_id; }).then(res => {
wx.setStorageSync('accessId', data.access_id) if (res.code == 200) {
wx.setStorageSync('isLogin', true); var data = res.data
wx.setStorageSync('userInfo', data.user); app.globalData.accessId = data.access_id;
wx.navigateBack() 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; position: relative;
} }
.logistics_centent{ .logistics_centent{
/* position: absolute; */
margin-top: -25rpx; margin-top: -25rpx;
margin-left: 100rpx; margin-left: 100rpx;
font-size: 30rpx; font-size: 30rpx;

14
pages/order/order.js

@ -223,8 +223,20 @@ Page({
currentStatus: options.status currentStatus: options.status
}) })
that.reloadData(); 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: [], pays: [],
itemData: {}, itemData: {},
userId: 0, userId: 0,
paytype: 'wxPay', //支付方式 paytype: 'bank_pay', //支付方式
cartId: 0, cartId: 0,
addrId: 0, //收货地址//测试-- addrId: 0, //收货地址//测试--
btnDisabled: false, btnDisabled: false,
@ -71,7 +71,6 @@ Page({
} }
} }
}, },
onLoad: function (options) { onLoad: function (options) {
// console.log(options) // console.log(options)
var that = this; var that = this;
@ -91,6 +90,19 @@ Page({
wallet: wallet, // 钱包状态 wallet: wallet, // 钱包状态
}); });
this.Settlement(options); 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 () { onReady: function () {
@ -156,6 +168,12 @@ Page({
// } // }
}, },
//单选支付方式
updataRadio:function(e){
this.setData({
paytype: e.detail.value
})
},
// 进入结算页面 // 进入结算页面
Settlement: function (options) { Settlement: function (options) {
var that = this; var that = this;
@ -181,10 +199,10 @@ Page({
} }
var pays = [] var pays = []
if (data.payment.bank_pay == 1) { 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) { // 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({ that.setData({
productAry: options.product, productAry: options.product,
@ -542,7 +560,7 @@ Page({
remarks: '', remarks: '',
vipSource: 0, vipSource: 0,
product: that.data.productAry, product: that.data.productAry,
pay_type: 'bank_pay', pay_type: that.data.paytype,
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
var data = res.data var data = res.data

169
pages/order/pay.wxml

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

7
pages/order/pay.wxss

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

8
pages/set/set.js

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

29
pages/user/user.js

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

3
pages/user/user.wxml

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

4
utils/server.js

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

Loading…
Cancel
Save