Commit d580ec02527067f1555a5933022bb4114197b522

Authored by yiren
1 parent 307fe7bf

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

... ... @@ -12,9 +12,9 @@
{{detail.price}}元
</view>
<view class="operation">
<image class="countimgs" src="./bb.png" bindtap="subtraction"/>
<image class="countimgs" src="https://qn.colorcun.com/WechatIMG699.png" bindtap="subtraction"/>
<input type="number" model:value="{{num}}" />
<image class="countimgs" src="./add.png" bindtap="addition" mode=""/>
<image class="countimgs" src="https://qn.colorcun.com/WechatIMG698.png" bindtap="addition" mode=""/>
</view>
</view>
</view>
... ... @@ -46,9 +46,9 @@
<view class="info_left font32r">
使用限制:
</view>
<view wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info_right text_info font32r" >
<text 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>
</text>
<view wx:if="{{exp_date.is_none=='1' || exp_date.is_none===true}}" class="info_right text_info font32r" >
无限制
</view>
... ... @@ -65,7 +65,7 @@
</view>
<view class="fixed_box">
<view class="shoppingCart_img">
<image src="../../pages/image/shoppingCart.png" mode="" />
<image src="https://qn.colorcun.com/WechatIMG711.png" mode="" />
<view wx:if="{{num}}">{{num}}</view>
</view>
<view class="content font24r">
... ...
... ... @@ -21,10 +21,12 @@ page {
}
.info2{
padding: 0 32rpx 32rpx 0;
border-bottom: 4rpx solid #DBDBDB;
}
.info_left {
width:200rpx ;
color: #515151;
font-family: PingFang SC;
}
... ...
... ... @@ -15,9 +15,11 @@ Page({
type: '',
time: 300,
countdown: '',
name:"",
date: "",
phone:"",
calendarData:'',
sex:"先生",
sexObj:{},
index:0,
sexList:[
{
... ... @@ -49,6 +51,19 @@ Page({
type:options.type,
})
console.log('onLoad',{...this.data.opt});
let obj=wx.getStorageSync('info')
console.log('objobjobjobj',{...obj})
this.setData({
name:obj.name,
date:obj.date,
phone:obj.phone,
index:obj.sex*1-1,
calendarData:obj.calendarData,
})
this.data.name=obj.name;
this.data.date=obj.date;
this.data.phone=obj.phone;
this.data.index=obj.sex*1-1;
this.countdown()
this.modal = this.selectComponent("#payModal"); //通过给组件所起的id调用组件
},
... ... @@ -74,18 +89,42 @@ Page({
paySign: res.data.paySign,
success (ress) {
if (ress.errMsg == 'requestPayment:ok') {
that.showModal()
console.log('支付成功',ress);
return that.showModal()
}
console.log('支付失败',ress);
wx.showToast({
title: '支付失败,请重新下单',
duration: 1000,
success: function () {
setTimeout(function () {
wx.reLaunch({
url: `/pages/customer/detail_owner_invitation_new?id=${that.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
})
}, 1000);
}
})
},
fail (ress) {
console.log('支付失败',ress);
wx.showToast({
title: '支付失败,请重新下单',
duration: 1000,
icon:'none',
success: function () {
setTimeout(function () {
wx.reLaunch({
url: `/pages/customer/detail_owner_invitation_new?id=${that.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
})
}, 1000);
}
})
},
})
}
})
},
// 充值后跳转
recharge(){
console.log('充值完成跳转',this.data.opt.detail.oid);
this.closeModal()
... ... @@ -93,8 +132,25 @@ Page({
url: `/pages/customer/detail_owner_invitation_new?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
})
},
// 绑定名称
bindKeyNameInput(event){
const value = event.detail.value.replace(/\s+/g, "");
this.setData({
name: value
})
console.log(value);
},
// 绑定电话
bindKeyPhoneInput(event){
const value = event.detail.value.replace(/\s+/g, "");
this.setData({
phone: value
})
console.log(value);
},
// 购买代金券后跳转
certificate(){
this.closeModal()
console.log({...this.data.opt.detail});
wx.reLaunch({
url: '/pages/me/coupon_news'
})
... ... @@ -103,21 +159,21 @@ Page({
this.modal.closeModal() //调用组件中关闭模态框方法
},
// 点击确认支付
formSubmit(e) {
formSubmit() {
if(this.data.time==0){
return util.toast('当前订单已过期,请重新进入优惠券购买页面下单', 'none');
}
if(this.data.type=='2'){
let form=e.detail.value
if (!form.name) {
let data=this.data
if (!data.name) {
util.toast('未填写姓名', 'none')
return;
}
if (!form.phone) {
if (!data.phone) {
util.toast('未填写手机号码', 'none')
return;
}
if (!/^1\d{10}$/.test(form.phone)) {
if (!/^1\d{10}$/.test(data.phone)) {
util.toast('手机号码错误', 'none')
return;
}
... ... @@ -129,37 +185,57 @@ Page({
}, 3500);
return
}
this.addInfo(form)
this.addInfo()
}else{
this.confirmPayment()
}
},
addInfo(form){
App.GuestManage.InsGuest({
addInfo(){
let params={
sellerid:this.data.opt.sellerid,
rname:form.name,
sex:this.data.sexObj.value,//1男 2女 3公司
phone:form.phone,
rname:this.data.name,
sex:this.data.index*1+1,//1男 2女 3公司
phone:this.data.phone,
c_day:this.data.calendarData
}
console.log({...params});
App.GuestManage.InsGuest(params).then(res=>{
console.log(res);
if(res.ret=='200'){
this.confirmPayment()
let obj={
name:this.data.name,
phone:this.data.phone,
sex:this.data.index*1+1,
calendarData:this.data.calendarData,
date:this.data.date,
}
wx.setStorageSync('info', obj)
}
})
},
// 选择日期
bind_ChangeDate(event) {
let date = event.detail.value
let dateGl=event.detail.value.split('-');
let calendarData;
if(dateGl.length==3){
calendarData=dateGl[0]+'年'+dateGl[1]+'月'+dateGl[2]+'日(公历)';
console.log(dateGl);
console.log(calendarData);
}
this.setData({
date
date,
calendarData
})
},
// 选择性别
bind_Changesex(event){
console.log('event.detail',{...event.detail});
let index = event.detail.value
let sexObj = this.data.sexList[index]
let index = event.detail.value;
this.setData({
sexObj,
index
})
console.log('sexsexsex',sexObj);
console.log('index',index);
},
/**
... ...
... ... @@ -20,17 +20,17 @@
<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-input" name="name" placeholder="点击输入您的姓名" placeholder-style="color:#999;" />
<input class="weui-input name-input" value="{{name}}" data-params="name" placeholder="点击输入您的姓名" placeholder-style="color:#999;" bindinput="bindKeyNameInput"/>
</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"/>
<image src="https://qn.colorcun.com/WechatIMG695.png" mode="" class="imgs"/>
</picker>
</view>
<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" type="number" name="phone" maxlength="11" placeholder="点击输入您的电话" placeholder-style="color:#999;" style="color: #999" />
<input class="weui-input" type="number" name="phone" value="{{phone}}" data-params="phone" maxlength="11" placeholder="点击输入您的电话" placeholder-style="color:#999;" bindinput="bindKeyPhoneInput" style="color: #999" />
</view>
</view>
<view class="page-section page-section1">
... ... @@ -71,9 +71,9 @@
<view class="explain" wx:if="{{type=='2'}}">
您的会员充值已经在办理中,到店消费时请和收银核实,谢谢!
</view>
<button wx:if="{{type=='2'}}" class="font32r btnsPay" bindtap="recharge">完成
<button wx:if="{{type=='2'}}" class="font32r btnsPay" bindtap="recharge">朕知道了
</button>
<button wx:else class="font32r btnsPay" bindtap="certificate">朕知道了
<button wx:else class="font32r btnsPay" bindtap="certificate">完成
</button>
</view>
</my-modal>
\ No newline at end of file
... ...
// pack-activity/pack/examineCertificate.js
import App from '../../utils/api'
Page({
/**
* 页面的初始数据
*/
data: {
explain: '预设文本预设文本预设文本预设文本',
type: 'group',
status: 'birthday', //none 无限制 birthday 生日当天 week 指定日期
id:'',
detail:{
qrcode:null,
},
sellerObj:{
sellername:'',
seller_image:'',
real_address:'',
cateStr:'',
},
certificateDetail:{},
exp_date:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
id:options.id
})
console.log(this.data.id);
this.getDetail()
},
/**
... ... @@ -30,6 +44,69 @@ Page({
onShow() {
},
getDetail(){
App.Activity.GetOrderRechargeByid({
orderid:this.data.id
}).then(res=>{
if(res.data.length>0){
let detail=res.data[0];
let exp_date=detail.exp_date?JSON.parse(detail.exp_date):'';
this.setData({
detail,
exp_date
})
console.log('detaildetail',{...this.data.detail});
console.log('exp_date',{...this.data.exp_date});
this.getSeller(res.data[0].sellerid)
this.getCertificateDetail(res.data[0].recharge_id)
}
})
},
getCertificateDetail(id){
App.Activity.GetActivityById({
id
}).then(res => {
if(res.data.length>0){
let certificateDetail =res.data[0];
let exp_date=certificateDetail.exp_date?JSON.parse(certificateDetail.exp_date):'';
this.setData({
certificateDetail,
exp_date,
})
console.log('certificateDetail',{...certificateDetail});
console.log('exp_date',{...exp_date});
}
})
},
getSeller(sid){
App.Customer.GetSellerDetail({
sid,
}).then(res=>{
let data=res.data;
let cate=data.cate;
let cateStr;
if(cate && cate.length>0){
cateStr=[];
cate.some(cate=>{
cateStr.push(cate);
if(cateStr.length>2){return true}
})
cateStr=cateStr.join('/')
}
let sellerObj={
sellername:data.sellername,
seller_image:data.seller_image,
real_address:data.real_address,
cateStr
}
this.setData({
sellerObj
})
console.log({...sellerObj});
})
},
// 申请退款
subscribeDrawback() {
wx.navigateTo({
... ...
<!--pack-activity/pack/examineCertificate.wxml 二维码验券页面-->
<nav>唐人街1号中餐厅</nav>
<wxs src="../../utils/util.wxs" module="util" />
<nav>{{detail.sellername}}</nav>
<view class="box_wrap">
<view class="top_box">
<view class="discount_name font40r">
9折折扣券
{{detail.aname}}
</view>
<view class="shop_name font28r">
唐人街1号中餐店
{{detail.sellername}}
</view>
<view class="lineBox">
<view class="line"></view>
<image wx:if="{{type=='group2'}}" class="group" src="../../pages/image/group2.png" mode="" />
<image wx:if="{{type=='group'}}" class="group" src="../../pages/image/group.png" mode="" />
<image wx:if="{{type=='group2'}}" class="group" src="https://qn.colorcun.com/WechatIMG714.png" mode="" />
<image wx:if="{{type=='group'}}" class="group" src="https://qn.colorcun.com/WechatIMG713.png" mode="" />
</view>
<image class="qcode" src="../../pages/image/qcode.png" mode="" />
<image class="qcode" src="{{detail.qrcode}}" mode="" />
<view class="orderNumber font28r">
NO.01774420230223150306
{{detail.order_no}}
</view>
</view>
<view class="center_box">
... ... @@ -24,7 +25,7 @@
券要求
</view>
<view class="info_right font32r">
满200可用
{{detail.desc}}
</view>
</view>
<view class="info">
... ... @@ -32,7 +33,7 @@
有效期从
</view>
<view class="info_right font32r">
2023-08-28
{{util.unixtoTime(detail.stime,'YYYY-MM-DD')}}
</view>
</view>
<view class="info">
... ... @@ -40,10 +41,10 @@
有效期至
</view>
<view class="info_right font32r">
2023-08-28
{{util.unixtoTime(detail.etime,'YYYY-MM-DD')}}
</view>
</view>
<view wx:if="{{status=='none'}}" class="info">
<view wx:if="{{exp_date.is_none=='1' || exp_date.is_none===true}}" class="info">
<view class="info_left font32r">
使用限制:
</view>
... ... @@ -51,7 +52,7 @@
无限制
</view>
</view>
<view wx:if="{{status=='birthday'}}" class="info">
<view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday===true}}" class="info">
<view class="info_left font32r">
使用限制:
</view>
... ... @@ -59,7 +60,7 @@
会员生日当天
</view>
</view>
<view wx:if="{{status=='week'}}" class="week">
<view wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="week">
<view class="week_top">
<view class="week_left font32r">
充值日期限制:
... ... @@ -68,29 +69,26 @@
每周指定日期餐段可用
</view>
</view>
<view class="dateList texts font30r">
午:周一 周二 周三 周四 周五 周六 周日
</view>
<view class="dateList texts font30r">
晚:周一 周二 周三 周四 周五 周六 周日
</view>
<text class="dateList texts font30r">
{{exp_date.week_show?exp_date.week_show+'可用':''}}
</text>
</view>
<view class="info info1">
<view class="info info1" wx:if="{{detail.explain}}">
<view class="info_left font32r">
券说明
</view>
</view>
<view class="explain_news">{{explain}}</view>
<view class="explain_news">{{detail.explain}}</view>
</view>
<view class="btns">
<button class="font24r" plain="true" bindtap="subscribeDrawback">申请退费</button>
</view>
<view class="canteen_box">
<image src="http://nosqn.colorcun.com/20200214153224_561e1ca9088d9224782aeb4ef8002c45?imageView2/2/w/860/interlace/0/q/100" mode="heightFix" />
<image src="{{sellerObj.seller_image}}" mode="heightFix" />
<view class="info_right">
<view class="font38r">唐人街1号中餐厅</view>
<view class="font24r">中餐/京菜鲁菜</view>
<view class="font28r">学院路长宁道路口南行100米</view>
<view class="font38r">{{sellerObj.sellername}}</view>
<view class="font24r">{{sellerObj.cateStr}}</view>
<view class="font28r">{{sellerObj.real_address}}</view>
</view>
</view>
<view class="bottom_box">
... ...
... ... @@ -192,6 +192,7 @@
.week_top {
padding: 24rpx 0;
padding-bottom: 0;
width: 100%;
display: flex;
align-items: center;
... ... @@ -211,6 +212,8 @@
.dateList {
width: 100%;
display: flex;
justify-content: flex-end;
padding-bottom: 24rpx;
position: relative;
top: -10rpx;
letter-spacing:2rpx;
}
\ No newline at end of file
... ...
... ... @@ -59,7 +59,7 @@
无限制
</view>
</view>
<view class="info info1">
<view class="info info1" wx:if="{{detail.explain}}">
<view class="info_left font32r">
券说明
</view>
... ...
... ... @@ -35,7 +35,8 @@
font-family: PingFang SC;
font-size: 32rpx;
position: relative;
top: -10rpx;
top: -10rpx;
letter-spacing: 4rpx;
}
.info_left {
... ...
... ... @@ -76,10 +76,10 @@
</view>
</view>
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr">
<image src="../add.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
</view>
<view wx:else class="algorithmImg flex-lr calculate">
<image src="../reduce.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="one" />
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="one" />
<view class="box flex-cc">
<view class="num flex-cc">
{{item.quantum}}<view>份</view>
... ... @@ -88,7 +88,7 @@
清蒸
</view>
</view>
<image src="../add.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
</view>
<view class="wrapIine"></view>
</view>
... ... @@ -103,28 +103,28 @@
{{item.quantum}}
<image src="{{item.image}}" mode="aspectFill" />
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr oneImg">
<image src="../add.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
</view>
<view wx:else class="algorithmImg flex-lr twoImgs">
<image src="../reduce.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="two" />
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="two" />
<view class="box flex-cc">
<view class="num flex-cc">
{{item.quantum}}
</view>
</view>
<image src="../add.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
</view>
</view>
</view>
<view class="fixedBox flex-lr">
<view class="left flex-cmc">
<image src="../img1.png" mode="" />
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
菜品分类
</view>
</view>
<view class="right flex-cmc">
<image src="../img2.png" mode="" />
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
已选菜品
</view>
... ...
import util from '../../utils/util';
import App from '../../utils/api';
Page({
data: {
list:[],
},
onLoad() {
this.init();
this.getlist();
},
getlist() {
App.Activity.ActivityListByOpenid().then((json) => {
App.Activity.GetNewRechargeListByOpenid().then((json) => {
console.log(json);
if (json.ret == 200) {
this.setData({
list: json.data.concat(json.data)
list: json.data
})
}
})
... ... @@ -20,9 +23,10 @@ Page({
let reg = /ios/i;
let pt = 20; //导航状态栏上内边距
let h = 44; //导航状态栏高度
console.log(systemInfo.system);
if (reg.test(systemInfo.system)) {
pt = systemInfo.statusBarHeight;
h = 44;
h = 130;
} else {
pt = systemInfo.statusBarHeight;
h = 48;
... ...
<!--pages/taocan/coupon_news.wxml 用户端--我的--卡券-->
<nav>优惠券</nav>
<wxs src="../../utils/util.wxs" module="util" />
<nav>卡券</nav>
<scroll-view class="list" style="height:{{contentHeight}}px;padding-bottom: 140rpx;" bindscrolltolower="getnext" scroll-y>
<block wx:for="{{list}}">
<view class="card bg-white {{mark}}" bindtap="todetail" data-id="{{item.aid}}">
<view class="flex-vl {{mark=='canuse' ? 'orange-font' : 'gray-font'}} card-main {{mark}}" style="justify-content:space-between;">
<view class="seller-info flex-ll">
<view class="smooth font-siny font32r">{{item.sellername}}</view>
<view class="smooth font-siny font32r" wx:if="{{item.recharge_name}}">{{item.recharge_name}}</view>
</view>
<view class="font24r font-bold text1">{{item.aname}}</view>
<view class="font24r font-bold text1">NO.01774420230223150306</view>
<view class="font24r font-bold text1" wx:if="{{item.sellername}}">{{item.sellername}}</view>
<view class="font24r font-bold text1" wx:if="{{item.order_no}}">{{item.order_no}}</view>
</view>
<button class="flex-cc card-info font30r font-bold smooth" style="color:{{mark=='canuse' ? '#F05522' : '#999999'}};">{{mark=='used' ? (item.status==1 ? '已使用' : '已过期') : '去使用'}}</button>
<view class="{{mark=='canuse' ? 'orange-font' : 'gray-font'}} font24r texts smooth">有效时间:{{util.unixtoTime(item.stime,'YYYY.MM.DD HH:II')}}-{{util.unixtoTime(item.etime,'YYYY.MM.DD HH:II')}}</view>
<view class="{{mark=='canuse' ? 'orange-font' : 'gray-font'}} font24r texts smooth">有效时间:{{util.unixtoTime(item.stime,'YYYY-MM-DD')}}-{{util.unixtoTime(item.etime,'YYYY-MM-DD')}}</view>
</view>
</block>
</scroll-view>
<view class="card-used flex-cc bg-white gray-font font32r" bindtap="toused">查看卡券历史记录<view class="more" style="margin-left: 20rpx;"></view>
<view class="card-used flex-cc bg-white gray-font font32r">
<view class="wananchi">
关注<text>周到安排</text>公众号,及时获取更多优惠信息
</view>
<view class="more" style="margin-left: 20rpx;"></view>
</view>
<menu></menu>
<service></service>
\ No newline at end of file
... ...
... ... @@ -58,8 +58,8 @@
.card-info {
padding: 0 26rpx;
height: 40rpx;
line-height: 40rpx;
height: 54rpx;
line-height: 54rpx;
box-sizing: border-box;
margin: 0;
position: absolute;
... ... @@ -125,19 +125,29 @@
}
.card-used {
width: 100%;
width: 90%;
box-sizing: border-box;
height: 120rpx;
box-shadow: 0 0 8rpx #EEF0F2;
background: #FFFFFF;
position: fixed;
left: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
color: #999999;
font-family: PingFang SC;
font-weight: 500;
font-size: 28rpx;
}
.wananchi text{
color: #515151;
}
.texts {
width: 100%;
height: 60rpx;
padding-left: 42rpx;
padding-left: 24rpx;
box-sizing: border-box;
display: flex;
align-items: center;
... ...
... ... @@ -651,4 +651,13 @@ export default {
openid:'openid'
},
// 未使用优惠券列表
'App.Activity.GetNewRechargeListByOrderid':{
openid:'openid'
},
// 未使用优惠券列表
'App.Activity.GetNewRechargeListByOpenid':{
openid:'openid'
},
}
\ No newline at end of file
... ...