This commit is contained in:
zhangmanman
2021-06-30 09:52:55 +08:00
parent 34590d9f72
commit 7cb9e1e92e
6 changed files with 104 additions and 85 deletions

View File

@@ -71,7 +71,7 @@ const fridayInfo = (werlfare_id, address_id, is_deliver) => req({url: "welfare/o
const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}}) const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}})
//洗车券-获取跳转地址 //洗车券-获取跳转地址
const washcarUrl = (welfare_id, right_config_id) => req({url: "washcar/infourl", data: {welfare_id: welfare_id, right_config_id: right_config_id}}) const washcarUrl = (welfare_id, right_config_id) => req({url: "washcar/infourl", data: {welfare_id: welfare_id || '', right_config_id: right_config_id}})
//洗车券-获取跳转地址 //洗车券-获取跳转地址
const washcarCoupon = (coupon) => req({url: "washcar/" + coupon + "/info",method: "POST"}) const washcarCoupon = (coupon) => req({url: "washcar/" + coupon + "/info",method: "POST"})

View File

@@ -24,6 +24,7 @@ Page({
remark : '', //使用须知 remark : '', //使用须知
score : '', //应付总积分 score : '', //应付总积分
freight : '', //运费 freight : '', //运费
welfareType : '', //权益类型
noticeShow : false, //须知显示状态 noticeShow : false, //须知显示状态
addressShow : false, //收货地址显示 addressShow : false, //收货地址显示
payWayIndex : 0, payWayIndex : 0,
@@ -84,6 +85,7 @@ Page({
amount : res.data.total, amount : res.data.total,
moreAmount : res.data.amount, moreAmount : res.data.amount,
score : res.data.score, score : res.data.score,
welfareType : res.data.type,
remark : res.data.detail.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'), remark : res.data.detail.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
content : res.data.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"') content : res.data.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
}) })
@@ -157,6 +159,13 @@ Page({
* 商品数量加减 * 商品数量加减
*/ */
goodsNumber(e){ goodsNumber(e){
if(this.data.welfareType == 'welfare') {
wx.showToast({
title : '抱歉,只能购买一张',
icon : 'none'
})
return
}
let num = this.data.num let num = this.data.num
if (e.currentTarget.dataset.type == 'plus'){ if (e.currentTarget.dataset.type == 'plus'){
num ++; num ++;
@@ -207,25 +216,16 @@ Page({
wx.$api.user.washcarCreate(welfare_id, right_id, qty, address_id, is_deliver).then(res=>{ wx.$api.user.washcarCreate(welfare_id, right_id, qty, address_id, is_deliver).then(res=>{
let dataUrl = '', //定义接口来源名称 let dataUrl = '', //定义接口来源名称
type = res.data.type //订单来源 Newtype = res.data.type //订单来源
// welfare为福利活动购买 // welfare为福利活动购买
if(type == 'welfare') dataUrl = wx.$api.index.fridayInfo(welfare_id, address_id, is_deliver) if(Newtype == 'welfare') dataUrl = wx.$api.index.fridayPay(res.data.trade_no)
// right为权益购买 // right为权益购买
if(type == 'right') dataUrl = wx.$api.index.rightStore(right_id, address_id, is_deliver, qty) if(Newtype == 'right') dataUrl = wx.$api.index.wechat(res.data.trade_no)
// 第一步接口调取 // 第一步接口调取
dataUrl.then(dataRes=>{ dataUrl.then(payEes=>{
let payUrl = '', //定义接口来源名称
Newtype = dataRes.data.type //订单来源
// welfare为福利活动购买
if(Newtype == 'welfare') payUrl = wx.$api.index.fridayPay(dataRes.data.trade_no)
// right为权益购买
if(Newtype == 'right') payUrl = wx.$api.index.wechat(dataRes.data.trade_no)
// 第一步接口调取
payUrl.then(payEes=>{
let payInfo = JSON.parse(payEes.data) let payInfo = JSON.parse(payEes.data)
wx.requestPayment({ wx.requestPayment({
timeStamp: payInfo.timeStamp, timeStamp: payInfo.timeStamp,
@@ -268,6 +268,8 @@ Page({
} }
}, },
fail : res=>{ fail : res=>{
console.log(this.data.isdeliver)
console.log(Newtype)
if(Newtype == 'welfare'){ if(Newtype == 'welfare'){
if(this.data.isdeliver == 1) { if(this.data.isdeliver == 1) {
wx.reLaunch({ wx.reLaunch({
@@ -293,7 +295,7 @@ Page({
} }
}) })
}) })
})
}) })
} }
}) })

View File

@@ -1,5 +1,5 @@
<!-- 下单状态 --> <!-- 下单状态 -->
<view class="state"> <view class="state {{platformCp[platIndex].name == '快递' ? 'active' : ''}}">
<view class="state-title"> <view class="state-title">
等待买家付款 等待买家付款
<text>请您尽快下单购买</text> <text>请您尽快下单购买</text>
@@ -9,7 +9,7 @@
<!-- 默认地址 --> <!-- 默认地址 -->
<view class="content"> <view class="content">
<view class="site"> <view class="site" wx:if="{{platformCp[platIndex].name == '快递'}}">
<view class="siteCont" wx:if="{{address != ''}}" bindtap="addressTap"> <view class="siteCont" wx:if="{{address != ''}}" bindtap="addressTap">
<image class="siteCont-site" src="/static/img/car_site.png"></image> <image class="siteCont-site" src="/static/img/car_site.png"></image>
<view class="siteCont-right"> <view class="siteCont-right">
@@ -62,7 +62,7 @@
<view class="labelList-label">{{detail.attribute.form_pay}}</view> <view class="labelList-label">{{detail.attribute.form_pay}}</view>
<view class="labelList-price rightsLabel-red">¥{{amount}}</view> <view class="labelList-price rightsLabel-red">¥{{amount}}</view>
</view> </view>
<view class="labelList"> <view class="labelList" wx:if="{{platformCp[platIndex].name == '快递'}}">
<view class="labelList-label"> <view class="labelList-label">
运费 运费
</view> </view>

View File

@@ -1,7 +1,7 @@
/* 下单状态 */ /* 下单状态 */
.state { .state {
background: #2e71e3; background: #2e71e3;
padding: 30rpx 100rpx 60rpx; padding: 30rpx 60rpx;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
color: #fff; color: #fff;
@@ -9,6 +9,10 @@
display: flex; display: flex;
} }
.state.active {
padding: 30rpx 100rpx 60rpx;
}
.state-title { .state-title {
flex: 1; flex: 1;
font-size: 32rpx; font-size: 32rpx;

View File

@@ -77,13 +77,26 @@ Page({
* 处理未登录时的转跳 * 处理未登录时的转跳
*/ */
userNav(e){ userNav(e){
let id = e.currentTarget.dataset.id let newid = e.currentTarget.dataset.id,
canFrom = e.currentTarget.dataset.from
wx.getStorage({ wx.getStorage({
key : 'token', key : 'token',
success:res=>{ success:res=>{
wx.navigateTo({ if(canFrom == 'washcar') {
url: '/pages/rights/rights?rightsId=' + id wx.$api.index.washcarUrl('', newid).then(res=>{
const newUrl = res.data
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/washcar/washcar?url=${url}`
});
}) })
} else {
// 跳转权益详情页
wx.navigateTo({
url: '/pages/rights/rights?rightsId=' + newid
})
}
}, },
fail: (err) => { fail: (err) => {
wx.navigateTo({ wx.navigateTo({

View File

@@ -30,7 +30,7 @@
<view class="special-list"> <view class="special-list">
<block wx:if="{{infoItems.length > 0}}"> <block wx:if="{{infoItems.length > 0}}">
<view bindtap="userNav" class="special-label" wx:for="{{infoItems}}" wx:key="infoItems" <view bindtap="userNav" class="special-label" wx:for="{{infoItems}}" wx:key="infoItems"
data-id="{{item.right_config_id}}"> data-id="{{item.right_config_id}}" data-from="{{item.from}}">
<view class="special-rebate" wx:if="{{item.label != ''}}">{{item.label}}</view> <view class="special-rebate" wx:if="{{item.label != ''}}">{{item.label}}</view>
<scroll-view scroll-x class="welfareCont-top" scroll-with-animation> <scroll-view scroll-x class="welfareCont-top" scroll-with-animation>
<view class="welfareCont-list-img" wx:for="{{item.logos}}" wx:key="logos" wx:for-item="items"> <view class="welfareCont-list-img" wx:for="{{item.logos}}" wx:key="logos" wx:for-item="items">