Commit 307fe7bfba7fed91f9b98708f328db391e9d209c

Authored by yiren
1 parent 39697eeb

购买代金券和充值优惠接口对接

... ... @@ -11,9 +11,9 @@ Page({
name: '',
id:'',
oid:'',
use:{},
sid:'',
},
use:{},
detail:{},
exp_date:{},
num: 1,
... ... @@ -26,12 +26,12 @@ Page({
*/
onLoad(options) {
this.setData({
use:JSON.parse(options.use),
opt:{
id:options.id,
name:options.name,
sid:options.sid,
oid:options.oid,
use:JSON.parse(options.use)
}
})
console.log('onLoad',{...this.data.opt});
... ... @@ -108,6 +108,14 @@ Page({
}).then(res=>{
console.log(res);
if(res.ret=='200'){
let totalize=this.data.totalize*1;
if(totalize==0){
util.toast('购买成功','none');
wx.reLaunch({
url: '/pages/me/coupon_news'
})
return
}
wx.navigateTo({
url: `./confirmPayment?type=1&detail=${JSON.stringify(detail)}&orderId=${res.data.id}&totalize=${this.data.totalize}`,
})
... ...
... ... @@ -12,9 +12,9 @@
{{detail.price}}元
</view>
<view class="operation">
<text class="font30r" bindtap="subtraction">-</text>
<image class="countimgs" src="./bb.png" bindtap="subtraction"/>
<input type="number" model:value="{{num}}" />
<text class="font30r" bindtap="addition">+</text>
<image class="countimgs" src="./add.png" bindtap="addition" mode=""/>
</view>
</view>
</view>
... ... @@ -42,21 +42,21 @@
{{util.unixtoTime(detail.etime,'YYYY-MM-DD')}}
</view>
</view>
<view class="info">
<view class="info info2">
<view class="info_left font32r">
使用限制:
</view>
<view wx:if="{{exp_date.is_week=='1' || exp_date.is_week*1}}" class="info_right text_info font32r" >
<view wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info_right text_info font32r" >
{{exp_date.week_show?exp_date.week_show+'可用':''}}
</view>
<view wx:if="{{exp_date.is_none=='1' || exp_date.is_none*1}}" class="info_right text_info font32r" >
<view wx:if="{{exp_date.is_none=='1' || exp_date.is_none===true}}" class="info_right text_info font32r" >
无限制
</view>
<view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday*1}}" class="info_right text_info font32r" >
生日当天可用
<view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday===true}}" class="info_right text_info font32r" >
会员生日当天
</view>
</view>
<view class="info">
<view wx:if="{{detail.explain}}" class="info">
<view class="info_left font32r">
券说明
</view>
... ...
... ... @@ -10,14 +10,18 @@ page {
justify-content: space-between;
align-items: center;
margin-left: 32rpx;
border-bottom: 2rpx solid #E7E7E7;
border-bottom:2rpx solid #E7E7E7;
}
.info1 {
padding: 28rpx 40rpx;
padding-right: 24rpx;
margin-left: 0;
border-bottom: 2rpx solid #dbdbdb;
border-bottom: 4rpx solid #DBDBDB;
}
.info2{
border-bottom: 4rpx solid #DBDBDB;
}
.info_left {
... ... @@ -53,8 +57,9 @@ page {
margin: 0 14rpx;
}
.operation text {
padding: 16rpx;
.countimgs {
width: 32rpx;
height: 32rpx;
}
.text_info {
... ... @@ -92,7 +97,6 @@ page {
.shoppingCart_img {
position: relative;
}
.shoppingCart_img view {
width: 38rpx;
height: 38rpx;
... ...
// pack-activity/pack/confirmPayment.js
import util from '../../utils/util';
import util, { unixtoTime } from '../../utils/util';
import App from '../../utils/api';
Page({
... ... @@ -13,14 +13,28 @@ Page({
totalize:'',
},
type: '',
price:'',
detail:{},
time: 300,
countdown: '',
tip: '',
date: "",
sex:"先生",
sexObj:{},
index:0,
sexList:[
{
sex:'先生',
value:'1',
},
{
sex:'女士',
value:'2',
},
{
sex:'公司',
value:'3',
}
]
},
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -29,9 +43,10 @@ Page({
opt:{
detail:options.detail?JSON.parse(options.detail):'',
orderId:options.orderId,
totalize:options.totalize?options.totalize:''
totalize:options.totalize?options.totalize:'',
sellerid:options.sellerid?options.sellerid:'',
},
type:options.type
type:options.type,
})
console.log('onLoad',{...this.data.opt});
this.countdown()
... ... @@ -40,31 +55,17 @@ Page({
showModal() {
this.modal.showModal() //调用组件中打开模态框方法
},
recharge(){
console.log('11111111111111111',this.data.opt.detail.oid);
this.closeModal()
wx.reLaunch({
url: `/miniprogram/pages/customer/detail_owner_invitation_new.wxml?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
})
},
certificate(){
console.log('11111111111111111',this.data.opt.detail.oid);
this.closeModal()
wx.reLaunch({
url: '/miniprogram/pages/me/coupon_news'
})
},
confirmPayment(){
console.log(11111);
App.PayOnline.CombineTransactionsByRecharge({
id:this.data.opt.orderId
}).then(res=>{
console.log(res.ret);
console.log(res.data);
let that=this;
if(res.ret!='200'){
return util.toast(res.msg,'none');
}
if(res.ret=='200'){
console.log(res.ret);
this.setData({
price:res.data.price
})
wx.requestPayment({
timeStamp: res.data.timeStamp+'',
nonceStr: res.data.nonceStr,
... ... @@ -72,22 +73,40 @@ Page({
signType: res.data.signType,
paySign: res.data.paySign,
success (ress) {
this.showModal()
if (ress.errMsg == 'requestPayment:ok') {
that.showModal()
console.log('支付成功',ress);
}
console.log('支付失败',ress);
},
fail (ress) {
console.log(ress);
}
console.log('支付失败',ress);
},
})
}
})
},
recharge(){
console.log('充值完成跳转',this.data.opt.detail.oid);
this.closeModal()
wx.reLaunch({
url: `/pages/customer/detail_owner_invitation_new?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
})
},
certificate(){
this.closeModal()
wx.reLaunch({
url: '/pages/me/coupon_news'
})
},
closeModal() {
this.modal.closeModal() //调用组件中关闭模态框方法
},
// 充值————点击确认支付
// 点击确认支付
formSubmit(e) {
console.log(this.data.type);
if(this.data.time==0){
return util.toast('当前订单已过期,请重新进入优惠券购买页面下单', 'none');
}
if(this.data.type=='2'){
let form=e.detail.value
if (!form.name) {
... ... @@ -102,18 +121,47 @@ Page({
util.toast('手机号码错误', 'none')
return;
}
let recharge_money=this.data.opt.detail.recharge_money*1;
if(recharge_money==0){
setTimeout(() => {
util.toast('您的会员充值已经在办理中,到店消费时请和收银核实,谢谢!','none',3000);
wx.navigateBack(1)
}, 3500);
return
}
this.addInfo(form)
}else{
this.confirmPayment()
}
console.log(1111);
this.confirmPayment()
},
addInfo(form){
App.GuestManage.InsGuest({
sellerid:this.data.opt.sellerid,
rname:form.name,
sex:this.data.sexObj.value,//1男 2女 3公司
phone:form.phone,
})
},
// 选择日期
bind_ChangeDate(event) {
console.log();
let date = event.detail.value
this.setData({
date
})
},
// 选择性别
bind_Changesex(event){
console.log('event.detail',{...event.detail});
let index = event.detail.value
let sexObj = this.data.sexList[index]
this.setData({
sexObj,
index
})
console.log('sexsexsex',sexObj);
console.log('index',index);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ... @@ -129,15 +177,24 @@ Page({
},
// 倒计时
countdown() {
var minute = Math.floor(this.data.time / 60);
var second = this.data.time % 60
var minute = Math.floor(this.data.time*1 / 60);
var second = this.data.time % 60;
second < 10 ? second = '0' + second : '';
this.setData({
countdown: minute + ':' + second,
time: this.data.time - 1
})
if(this.data.time==0){
this.setData({
countdown: '0:00'
})
return false;
}
setTimeout(this.countdown, 1000);
},
navEvent(){
wx.navigateBack(2);
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
<!--pack-activity/pack/confirmPayment.wxml 代金券和充值支付页面-->
<nav>{{opt.detail.name}}</nav>
<nav bindNavEvent="navEvent">{{opt.detail.name}}</nav>
<view class="box_wrap">
<view wx:if="{{type=='1'}}" class="box">
<view class="countdown font24r">
支付剩余时间 {{countdown}}
</view>
<view class="money_text">
{{opt.detail.aname}}
{{opt.totalize}}
</view>
<view class="nameText font24r">
{{opt.detail.totalize}}
... ... @@ -20,8 +20,12 @@
<view class="page-section">
<view class="page-section-title font32r">您的姓名</view>
<view class="weui-cells weui-cell__bd" style="margin: 30rpx 0">
<input class="weui-input" name="name" placeholder="点击输入您的姓名" placeholder-style="color:#999;" />
<input class="weui-input name-input" name="name" placeholder="点击输入您的姓名" placeholder-style="color:#999;" />
</view>
<picker mode="selector" value="{{index}}" range-key="sex" data-sex='{{sexList[index].sex}}' range="{{sexList}}" bindchange="bind_Changesex" class="pickerSex">
<text class="sexText">{{sexList[index].sex}}</text>
<image src="./imgs.png" mode="" class="imgs"/>
</picker>
</view>
<view class="page-section">
<view class="page-section-title font32r">联系电话</view>
... ... @@ -44,19 +48,25 @@
{{opt.detail.recharge_money}}元
</view>
</view>
<view class="page-section">
<view class="page-section-title font32r">支付剩余时间 </view>
<view class="weui-cells weui-cell__bd sum colorSty">
{{countdown}}
</view>
</view>
<view wx:if="{{type=='2'}}" class="fixed_box">
<button class="font32r btns" formType="submit">确认支付
</button>
</view>
</form>
</view>
</view>
<view wx:if="{{type=='2'}}" class="fixed_box">
<button class="font32r btns" formType="submit">确认支付
</button>
</view>
<view wx:if="{{type=='1'}}" class="fixed_box">
<button class="font32r btns" bindtap="formSubmit">确认支付
</button>
</view>
<my-modal id="payModal" fadeStyle="slideUp" height="380px">
<view slot="modalName" class="titleModal">成功支付{{price}}元</view>
<view slot="modalName" class="titleModal">成功支付{{opt.totalize}}元</view>
<view slot="modalContent">
<view class="explain" wx:if="{{type=='2'}}">
您的会员充值已经在办理中,到店消费时请和收银核实,谢谢!
... ...
... ... @@ -112,7 +112,7 @@
.page-section-title {
color: #515151;
font-family: PingFang SC;
margin-right: 30rpx;
margin-right: 32rpx;
}
.weui-input {
... ... @@ -120,6 +120,11 @@
margin-right: 30rpx;
font-size: 32rpx;
}
.name-input{
margin-right: 0;
text-align: left;
}
.pickerBox {
display: flex;
... ... @@ -145,3 +150,13 @@
color: #999999;
font-size: 32rpx;
}
.pickerSex image{
width: 48rpx;
height: 48rpx;
margin-right: 30rpx;
}
.sexText{
position: relative;
top: -10rpx;
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@ Page({
},
stime: '',
etime:'',
exp_date:{},
},
/**
... ... @@ -46,14 +47,17 @@ Page({
id: this.data.opt.id
}).then(res => {
let detail=res.data[0];
let stime=util.unixtoTime(detail.stime,'YYYY-MM-DD');
let etime=util.unixtoTime(detail.etime,'YYYY-MM-DD');
let stime=util.unixtoTime(detail.stime,'YYYY.MM.DD HH:II');
let etime=util.unixtoTime(detail.etime,'YYYY.MM.DD HH:II');
let exp_date=detail.exp_date?JSON.parse(detail.exp_date):'';
this.setData({
detail,
stime,
etime
etime,
exp_date
})
console.log('detail',{...detail});
console.log('exp_date',exp_date);
})
},
/**
... ...
... ... @@ -30,12 +30,33 @@
{{etime}}
</view>
</view>
<view class="info">
<view wx:if="{{exp_date.is_week==='1' || exp_date.is_week===true}}" class="info infoWeek">
<view class="flex-lr infoWeek1">
<view class="info_left font32r">
使用限制:
</view>
<view class="info_right text_info font32r">
每周指定日期餐段可用
</view>
</view>
<text class="weekShow">
{{exp_date.week_show}}
</text>
</view>
<view wx:if="{{exp_date.is_birthday==='1' || exp_date.is_birthday===true}}" class="info">
<view class="info_left font32r">
使用限制:
</view>
<view class="info_right text_info font32r">
会员生日当天
</view>
</view>
<view wx:if="{{exp_date.is_none==='1' || exp_date.is_none===true}}" class="info">
<view class="info_left font32r">
使用限制:
</view>
<view class="info_right text_info font32r">
<!-- 没做 -->
无限制
</view>
</view>
<view class="info info1">
... ...
... ... @@ -17,6 +17,27 @@
border-bottom: none;
}
.infoWeek {
width: 100%;
flex-direction: column;
padding-bottom: 0 !important;
}
.infoWeek1 {
box-sizing: border-box;
width: 100%;
padding-right: 32rpx;
}
.weekShow {
width: 100%;
color: #999999;
font-family: PingFang SC;
font-size: 32rpx;
position: relative;
top: -10rpx;
}
.info_left {
color: #515151;
font-family: PingFang SC;
... ...
... ... @@ -88,10 +88,9 @@ Page({
price:this.data.detail.recharge_money,
type:'2',
}).then(res=>{
console.log(res);
if(res.ret=='200'){
wx.navigateTo({
url: `./confirmPayment?type=2&detail=${JSON.stringify(detail)}&orderId=${res.data.id}`,
url: `./confirmPayment?type=2&detail=${JSON.stringify(detail)}&sellerid=${this.data.opt.sid}&orderId=${res.data.id}&totalize=${this.data.detail.recharge_money}`,
})
}else{
wx.showToast({
... ...
... ... @@ -51,7 +51,7 @@
{{item.aname}}
</view>
</view>
<view class="week" wx:if="{{exp_date.is_week=='1'}}">
<view class="week" wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}">
<view class="week_top">
<view class="week_left font32r">
充值日期限制:
... ... @@ -64,7 +64,7 @@
{{exp_date.week_date_show}}
</view>
</view>
<view class="week" wx:if="{{exp_date.is_birthday=='1'}}">
<view class="week" wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday===true}}">
<view class="week_top">
<view class="week_left font32r">
充值日期限制:
... ... @@ -74,7 +74,7 @@
</view>
</view>
</view>
<view class="week" wx:if="{{exp_date.is_fix=='1'}}">
<view class="week" wx:if="{{exp_date.is_fix=='1' || exp_date.is_fix===true}}">
<view class="week_top">
<view class="week_left font32r">
充值日期限制:
... ...
... ... @@ -102,9 +102,9 @@ page {
.list {
margin: 0 32rpx;
padding-bottom: 24rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
border-bottom: 2rpx solid #dbdbdb;
}
... ... @@ -112,6 +112,7 @@ page {
color: #0143a3;
font-family: PingFang SC;
margin-right: 18rpx;
padding-bottom: 24rpx;
}
.week {
... ...
... ... @@ -27,7 +27,7 @@ Page({
recharge_data:{},
coupon_data:{},
homeColor: '',
use:'',
stringifyUse:'',
current: 0,
theme: 'blackGold', //blue green blackGold
seller: {
... ... @@ -270,7 +270,7 @@ Page({
store = data.store ? JSON.parse(data.store) : '';
home = data.home ? JSON.parse(data.home) : '';
coupon_data=marketing.coupon_data;
let use=JSON.stringify(marketing.coupon_data.use)
let stringifyUse=JSON.stringify(marketing.coupon_data.use)
if(marketing.is_recharge=='1' && marketing.recharge_data){
let recharge_data=marketing.recharge_data
recharge_list=marketing.recharge_data.recharge_list
... ... @@ -284,7 +284,7 @@ Page({
}
this.setData({
coupon_data,
use
stringifyUse
})
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if(marketing.is_coupon=='1' && coupon_data && (!coupon_data.use.is_cash || coupon_data.use.is_cash=='1')){
... ... @@ -295,8 +295,7 @@ Page({
console.log('price',price);
console.log('discount',discount);
this.setData({
discount,
coupon_data
discount
})
}
if(store && store.images.length>0) store.images =store.images?JSON.parse(store.images):'';
... ... @@ -311,6 +310,8 @@ Page({
}else{
homeColor ='67,142,147,1'
}
console.log('coupon_data', coupon_data);
console.log('stringifyUse', stringifyUse);
console.log('chef', chef);
console.log('reserve', reserve);
console.log('signboard', signboard);
... ...
... ... @@ -84,7 +84,7 @@
<view class="introduce" wx:if="{{store && store.style=='1'}}">
<view class="IntroductionItems" wx:for="{{store.images}}" wx:key="arryIndex" wx:for-index="arryIndex">
<view class="imgMask">
<image src="{{item}}" mode="aspectFill" />
<!-- <image src="{{item}}" mode="aspectFill" /> -->
<view class="IntroduceColor chief Introducepublic {{theme+'chief'}}" wx:if="{{arryIndex=='0'}}">
<view class="englishText">Introduce</view>
<view class="chefText">品牌介绍</view>
... ... @@ -117,7 +117,7 @@
</text>
</view>
</view>
<image src="{{item}}" mode="aspectFill"/>
<!-- <image src="{{item}}" mode="aspectFill"/> -->
</view>
</view>
</view>
... ... @@ -198,19 +198,19 @@
<text>{{coupon_data.aname}}</text>
<text class="price" wx:if="{{coupon_data.price}}">¥{{coupon_data.price}}</text>
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{coupon_data.use.is_cash=='1' || coupon_data.use.is_cash}}" class="discount">{{discount}}折</text>
<text wx:if="{{discount!='0.00' && (coupon_data.use.is_cash=='1' || coupon_data.use.is_cash)}}" class="discount">{{discount}}折</text>
</view>
<view wx:if="{{coupon_data.exp_date.is_week=='1' || coupon_data.exp_date.is_week}}" class="bottom" >
<view wx:if="{{coupon_data.exp_date.is_week=='1' || coupon_data.exp_date.is_week===true}}" class="bottom" >
{{coupon_data.exp_date.week_show?coupon_data.exp_date.week_show+'可用':''}}{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_none=='1' || coupon_data.exp_date.is_none}}" class="bottom" >
<view wx:if="{{coupon_data.exp_date.is_none=='1' || coupon_data.exp_date.is_none===true}}" class="bottom" >
无限制{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_birthday=='1' || coupon_data.exp_date.is_birthday}}" class="bottom" >
生日当天可用{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
<view wx:if="{{coupon_data.exp_date.is_birthday=='1' || coupon_data.exp_date.is_birthday===true}}" class="bottom" >
会员生日当天可用{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
</view>
<navigator url="/pack-activity/pack/buyCoupon?id={{coupon_data.id}}&name={{seller.name}}&use={{use}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/buyCoupon?id={{coupon_data.id}}&name={{seller.name}}&use={{stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
<view class="font24r orderingFood">
去抢购
</view>
... ...
... ... @@ -644,5 +644,11 @@ export default {
//合单支付
'App.PayOnline.CombineTransactionsByRecharge':{
openid:'openid'
}
},
//新增客户信息
'App.GuestManage.InsGuest':{
openid:'openid'
},
}
\ No newline at end of file
... ...