Commit beecd6a616460e513f10af6b9c370f819ea18177

Authored by yvan.ni
1 parent d7a8df8d

卡的续费 接口验证是否等级会员的调整

Showing 1 changed file with 20 additions and 8 deletions
pages/user/cardinfo/cardinfo.js
... ... @@ -15,7 +15,6 @@ Page({
15 15 */
16 16 data: {
17 17 images: [o.imghost + "/miniapp/images/plus/card_one.jpg", o.imghost + "/miniapp/images/plus/card_two.jpg", o.imghost + "/miniapp/images/plus/card_three.jpg"],
18   -
19 18 url: o.imghost,
20 19 screenWidth: 0,
21 20 screenheight: 0,
... ... @@ -70,9 +69,7 @@ Page({
70 69  
71 70 }).then(res => {
72 71 var plusCard = res.data.data;
73   - if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg"+(i + 1)+ ".jpg?v=1";
74   - var big_card = null;
75   - var big_cards = null;
  72 + var big_cards = null,big_card=null;
76 73 console.log(plusCard, "数据什么的", res);
77 74 for (var i = 0; i < plusCard.length; i++) {
78 75 if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg" + (i + 1) + ".jpg?v=1";
... ... @@ -709,14 +706,29 @@ Page({
709 706  
710 707 //-----立即续费的功能------
711 708 xufei:async function(){
712   - var th = this;
713   - var is_card = 0;
  709 + var th = this,is_card = 0,end_time=0;
  710 + await getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=1&type=3",
  711 + {1:1}).then(res => {
  712 + if (res.data.code == 0) {
  713 + end_time=res.data.data.pageData[0].end_time;
  714 + }
  715 + })
  716 + var now=ut.gettimestamp();
  717 + if(end_time<now){
  718 + getApp().my_warnning("请联系商家升级plus功能", 0, th);
  719 + return false;
  720 + }
  721 +
  722 + end_time=ut.format(end_time,'yyyy-MM-dd');
  723 + var errmsg="";
714 724 //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期--
715 725 await getApp().request.promiseGet("/api/weshop/plus/plus/card/register",
716   - { data: { storeId: os.stoid } }).then(res => {
  726 + { data: { storeId: os.stoid,isRenewal:1,endData: end_time,userId:getApp().globalData.user_id} }).then(res => {
717 727 if (res.data.code == 0) is_card = 1;
  728 + else errmsg=res.data.msg;
718 729 })
719   - if (is_card == 0) getApp().my_warnning("请联系商家升级plus功能", 0, th);
  730 +
  731 + if (is_card == 0){ getApp().my_warnning(errmsg?errmsg:"请联系商家升级plus功能", 0, th);}
720 732  
721 733 var item = th.data.user_card;
722 734 var req = {};
... ...