微信小程序,发放优惠券,领取卡券添加到卡包

1.使用微信提供的  send-coupon   发券插件,样式可自定义

<send-coupon   
                @customevent="getcoupon"  
                :send_coupon_params="send_coupon_params"  // 发券参数
                :sign="sign"  //签名
                :send_coupon_merchant="send_coupon_merchant" v-if="yhqPop">    // 发券商户号
                <view class="getuhq-pop centerboth">
                    <view class="yhq-pop-count">
                        <view class="amtit centerboth">温馨提示:</view>
                        <view class="amens centerboth">恭喜您有新的优惠券了</view>
                        <view class="btn centerboth">确定</view>
                    </view>
                </view>  
        </send-coupon>

2.领取操作
     

 getcoupon: function(params) {
       this.yhqPop = false;
 }

3.领取卡券到卡包(领取会员卡操作)

   let data = res.data.data;
   // #ifdef MP-WEIXIN
   wx.addCard({
      cardList: [{
       "cardExt":'{"nonce_str":"'+data.nonce_str+'","code":"'+data.code+'","signature":"'+data.signature+'","timestamp":"'+data.timestamp+'"}',
 "cardId": data.cardId
      }],
       success(res) {
           if(res.cardList[0].isSuccess){
                uni.showToast({
                    title: '领取成功',
                    icon: 'none'
                })
            }
        }
    })
  // #endif


 


       

猜你喜欢

转载自blog.csdn.net/qq_35086913/article/details/120193919