Commit f9c4a6acb3aa773446f8869fecfd65c343c1b79e

Authored by yiren
1 parent 697968fe

会员录入判断是否录入过,修改和新增接口

... ... @@ -97,8 +97,35 @@ Page({
totalize: (price * num1).toFixed(2)
})
},
// 输入事件
bindKeyNameInput(event){
let price = this.data.detail.price * 1;
const value = event.detail.value.replace(/\s+/g, "")*1;
if(value && /(^[1-9]\d*$)/.test(value)){
wx.hideToast()
this.setData({
num: value,
totalize: (price * value).toFixed(2)
})
}else{
wx.showToast({
title:'请输入正整数',
icon:'none',
duration:1000,
mask:true,
})
}
},
// 提交订单
submitOrder() {
if(this.data.num && !/(^[1-9]\d*$)/.test(this.data.num)){
return wx.showToast({
title:'请输入正确的购买数量',
duration:2000,
mask:true,
icon:'none'
})
}
if(this.data.detail.grant_last=='0'){
return wx.showToast({
title:'您来晚了,当前优惠券已经售罄,请与商家联系!',
... ...
... ... @@ -13,7 +13,7 @@
</view>
<view class="operation">
<image class="countimgs" src="https://qn.colorcun.com/WechatIMG699.png" bindtap="subtraction"/>
<input type="number" model:value="{{num}}" />
<input type="number" model:value="{{num}}" bindinput="bindKeyNameInput"/>
<image class="countimgs" src="https://qn.colorcun.com/WechatIMG698.png" bindtap="addition" mode=""/>
</view>
</view>
... ...
... ... @@ -81,9 +81,10 @@ Page({
showModal() {
this.modal.showModal() //调用组件中打开模态框方法
},
confirmPayment() {
confirmPayment(gid) {
App.PayOnline.CombineTransactionsByNewRecharge({
combine_out_trade_no: this.data.opt.combine_out_trade_no
combine_out_trade_no: this.data.opt.combine_out_trade_no,
gid:gid?gid:'',
}).then(res => {
console.log(res.data);
let that = this;
... ... @@ -99,7 +100,6 @@ Page({
})
}
if (res.ret == '200') {
console.log(res.ret);
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
... ... @@ -223,24 +223,53 @@ Page({
}, 3500);
return
}
this.addInfo()
this.getInfo()
} else {
this.confirmPayment()
}
},
addInfo() {
let params = {
sellerid: this.data.opt.sid,
rname: this.data.name,
sex: this.data.indexs * 1 + 1, //1男 2女 3公司
getInfo() {
let sex = this.data.indexs * 1 + 1; //1男 2女 3公司
App.GuestManage.GetIsMemberByPhone({
sid: this.data.opt.sid,
phone: this.data.phone,
c_day: this.data.calendarData
}
console.log({...params});
}).then(res => {
console.log('用户是否录入',res);
let params = {
sellerid: this.data.opt.sid,
rname: this.data.name,
sex,
phone: this.data.phone,
c_day: this.data.calendarData
}
console.log({...params});
if (res.data && res.data.id) {
if (this.data.phone == res.data.phone && this.data.name == res.data.rname && sex == res.data.sex && this.data.calendarData == res.data.c_day) {
console.log('信息都一样,直接支付');
this.confirmPayment(res.data.id)
} else {
params.id=res.data.id;
console.log('要修改信息');
this.editInfo(params)
}
} else {
console.log('没有客户信息,保存信息');
this.addInfo(params)
}
})
},
// 修改客户信息
editInfo(params) {
App.GuestManage.SetGuestInfo(params).then(res => {
if (res.data) {
this.confirmPayment(params.id)
}
})
},
// 新增客户信息
addInfo(params) {
App.GuestManage.InsGuest(params).then(res => {
console.log(res);
if (res.ret == '200') {
this.confirmPayment()
if (res.ret == '200' && res.data && res.data.id) {
let obj = {
name: this.data.name,
phone: this.data.phone,
... ... @@ -249,13 +278,14 @@ Page({
date: this.data.date,
}
wx.setStorageSync('info', obj)
this.confirmPayment(res.data.id)
}
})
},
// 选择日期
bind_ChangeDate(event) {
let date = event.detail.value
var calendarData = new Date(date) * 1/1000;
var calendarData = new Date(date) * 1 / 1000;
this.setData({
date,
calendarData
... ...
... ... @@ -700,6 +700,14 @@ export default {
'App.Advance.GetOrderInfo':{
openid:'openid'
},
// 获取手机号是否为商家会员
'App.GuestManage.GetIsMemberByPhone':{
openid:'openid'
},
// 修改客户信息
'App.GuestManage.SetGuestInfo':{
openid:'openid'
},
}
\ No newline at end of file
... ...