Commit 0e038a8b385090591527db300734b58df66f6af8

Authored by abson
1 parent 54611e04

plus 回车事件

pages/user/plus/plus.js
... ... @@ -39,6 +39,7 @@ Page({
39 39 def_serviceman: null, //分享人的营业员
40 40 fir_leader: 0, //分享人的ID
41 41 staffNo_arr: [], //多个营业员
  42 + focus:false,
42 43 is_select: false, //是否选择营业员过
43 44 },
44 45 swiperChange: function (e) {
... ... @@ -286,17 +287,16 @@ Page({
286 287 //选择营业员
287 288 select_serviceman(e) {
288 289 let StaffNo = e.currentTarget.dataset.staffno;
289   - // let {req_data,req} = this.data;
290   - // if (StaffNo || StaffNo !== "") {
291   - // req_data.staffNo = StaffNo;
292   - // req.serviceman = StaffNo;
293   - // };
294   -
  290 + let {req_data,req} = this.data;
  291 + if (StaffNo || StaffNo !== "") {
  292 + req_data.staffNo = StaffNo;
  293 + req.serviceman = StaffNo;
  294 + };
295 295 this.setData({
296 296 is_select: 1,
297 297 staffNo_arr:[],
298   - inp_serviceman:StaffNo,
299 298 })
  299 + this.check_serviceman(req_data,req)
300 300 },
301 301 //--绑定邀请码的输入--
302 302 b_input: function (e) {
... ... @@ -317,6 +317,7 @@ Page({
317 317 },
318 318 //--立即购买卡--
319 319 buy_card: async function () {
  320 + console.log(11111);
320 321 var th = this;
321 322 var is_card = 0;
322 323 //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期--
... ... @@ -359,6 +360,9 @@ Page({
359 360 if (th.data.is_salesman) {
360 361 if (!th.data.inp_serviceman) {
361 362 getApp().my_warnning("请输入营业员", 0, th);
  363 + th.setData({
  364 + focus:true
  365 + })
362 366 return false;
363 367 }
364 368 req.serviceman = th.data.inp_serviceman
... ... @@ -379,35 +383,37 @@ Page({
379 383 req_data,
380 384 req,
381 385 })
382   - getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", {
383   - data: req_data,
384   - success: function (res) {
385   - if (res.data.code == 0) {
386   - if(res.data.data.length > 1 && !th.data.is_select){
387   - th.setData({
388   - staffNo_arr:res.data.data
389   - })
390   - }else{
391   - t_pay.pay(req, th.success, function () {
392   - getApp().my_warnning("支付失败", 0, th);
393   - th.setData({
394   - is_select:0,
395   - })
396   - });
397   - }
398   - } else {
399   - getApp().my_warnning(res.data.msg, 0, th);
400   - th.setData({
401   - is_select:0,
402   - })
403   - }
404   - }
405   - })
  386 + th.check_serviceman(req_data,req)
  387 + // getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", {
  388 + // data: req_data,
  389 + // success: function (res) {
  390 + // if (res.data.code == 0) {
  391 + // if(res.data.data.length > 1 && !th.data.is_select){
  392 + // th.setData({
  393 + // staffNo_arr:res.data.data
  394 + // })
  395 + // }else{
  396 + // t_pay.pay(req, th.success, function () {
  397 + // getApp().my_warnning("支付失败", 0, th);
  398 + // th.setData({
  399 + // is_select:0,
  400 + // })
  401 + // });
  402 + // }
  403 + // } else {
  404 + // getApp().my_warnning(res.data.msg, 0, th);
  405 + // th.setData({
  406 + // is_select:0,
  407 + // })
  408 + // }
  409 + // }
  410 + // })
406 411 } else {
407 412 t_pay.pay(req, th.success, function () {
408 413 getApp().my_warnning("支付失败", 0, th);
409 414 th.setData({
410 415 is_select:0,
  416 + focus:true,
411 417 })
412 418 });
413 419 }
... ... @@ -424,30 +430,35 @@ Page({
424 430 staffNo_arr: [],
425 431 });
426 432 },
427   - // check_serviceman(data,req) {
428   - // let th = this;
429   - // getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", {
430   - // data,
431   - // success: function (res) {
432   - // if (res.data.code == 0) {
433   - // if (res.data.data.length > 1 && !th.data.is_select) {
434   - // th.setData({
435   - // staffNo_arr: res.data.data
436   - // })
437   - // }else{
438   - // t_pay.pay(req, th.success, function () {
439   - // getApp().my_warnning("支付失败", 0, th);
440   - // });
441   - // }
442   - // } else {
443   - // getApp().my_warnning(res.data.msg, 0, th);
444   - // }
445   - // th.setData({
446   - // is_select:0,
447   - // })
448   - // }
449   - // })
450   - // },
  433 + check_serviceman(data,req) {
  434 + let th = this;
  435 + getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", {
  436 + data,
  437 + success: function (res) {
  438 + if (res.data.code == 0) {
  439 + if (res.data.data.length > 1 && !th.data.is_select) {
  440 + th.setData({
  441 + staffNo_arr: res.data.data
  442 + })
  443 + }else{
  444 + t_pay.pay(req, th.success, function () {
  445 + getApp().my_warnning("支付失败", 0, th);
  446 + th.setData({
  447 + is_select:0,
  448 + focus:true,
  449 + })
  450 + });
  451 + }
  452 + } else {
  453 + getApp().my_warnning(res.data.msg, 0, th);
  454 + th.setData({
  455 + is_select:0,
  456 + focus:true,
  457 + })
  458 + }
  459 + }
  460 + })
  461 + },
451 462 //返回会员中心
452 463 back_user: function () {
453 464 setTimeout(function () {
... ... @@ -476,7 +487,6 @@ Page({
476 487 url: u_url
477 488 })
478 489 }
479   -
480 490 },
481 491  
482 492  
... ...
pages/user/plus/plus.wxml
... ... @@ -134,14 +134,14 @@
134 134 <view class="flex ai_and Enter_phone" wx:if="{{isyaoqingma}}">
135 135 <image class="phone_image" src="{{url}}/miniapp/images/plus/Invitation_code.png"></image>
136 136 <view class="phone">
137   - <input bindinput="b_input" data-name="inp_recommon" class="fs30" placeholder="请输入邀请码(推荐人手机号)" type="number" maxlength="20" />
  137 + <input bindinput="b_input" bindconfirm="buy_card" data-name="inp_recommon" class="fs30" placeholder="请输入邀请码(推荐人手机号)" type="number" maxlength="20" />
138 138 </view>
139 139 </view>
140 140 <!-- 输入营业员 -->
141 141 <view class="flex ai_and enter_SalesClerk" wx:if="{{is_salesman}}">
142 142 <image class="SalesClerk_image" src="{{url}}/miniapp/images/plus/Sales_Clerk.png"></image>
143 143 <view class="SalesClerk">
144   - <input bindinput="b_input" class="fs30" data-name="inp_serviceman" value="{{inp_serviceman}}" placeholder="请输入营业员" maxlength="30" />
  144 + <input bindinput="b_input" bindconfirm="buy_card" class="fs30" focus="{{focus}}" data-name="inp_serviceman" value="{{inp_serviceman}}" placeholder="请输入营业员" maxlength="30" />
145 145 </view>
146 146 </view>
147 147 <!-- 确认购买 -->
... ... @@ -169,13 +169,13 @@
169 169 <text class="dialog_close" bindtap="dialog_close">X</text>
170 170 </view>
171 171 <view class="dialog_name">
172   - <text>编号</text>
173   - <text>姓名</text>
  172 + <text class="w50">编号</text>
  173 + <text class="w50">姓名</text>
174 174 </view>
175 175 </view>
176 176 <view class="dialog_name" bindtap="select_serviceman" data-StaffNo="{{item.StaffNo}}" wx:for="{{staffNo_arr}}" wx:key="id" hover-class="weui-active" hover-start-time="200" style="background-color: #fff;">
177   - <view>{{item.StaffNo}}</view>
178   - <view>{{item.StaffName}}</view>
  177 + <view class="w50">{{item.StaffNo}}</view>
  178 + <view class="w50">{{item.StaffName}}</view>
179 179 </view>
180 180 </view>
181 181 </view>
... ...
pages/user/plus/plus.wxss
... ... @@ -48,11 +48,16 @@ page {
48 48 display: flex;
49 49 border-bottom: 1rpx solid #f7f7f7;
50 50 justify-content: space-around;
  51 +
51 52 }
52 53 .weui-active{
53 54 opacity: 0.9;
54 55 background: #f7f7f7;
55 56 }
  57 +.w50 {
  58 + width: 50%;
  59 + text-align: center;
  60 +}
56 61 .Opening_bk image {
57 62 position: absolute;
58 63 z-index: 2;
... ...