Browse Source

券码兑换接口对接

kk.shi 3 years ago
parent
commit
98518a5437

+ 7 - 0
api/welfareMall.js

@@ -224,6 +224,13 @@ class WelfareMall extends request {
   static delStoreStaff(params) {
     return this.postRequest(`${this.BASE_URL}open/staff/del-store-staff`, params);
   }
+
+   /**
+   * 兑换码
+   */
+  static exchangeCoupon(params) {
+    return this.postRequest(`${this.BASE_URL}/open/coupon/exchange-coupon`, params);
+  }
   
 }
 

+ 1 - 1
components/couponWrap/index.wxml

@@ -54,7 +54,7 @@
                     <image wx:if="{{!flodMap[index]}}" class="fold-btn" src="../../images/welfareMall/down-ico.png" />
                     <image wx:else class="fold-btn" src="../../images/welfareMall/up-ico.png" />
                   </view>
-                  <image wx:if="{{nums.formatDiscount(item) == 0}}" class="tiktok-img" src="../../images/welfareMall/tiktok-img.png"></image>
+                  <image wx:if="{{item.businessType == 105}}" class="tiktok-img" src="../../images/welfareMall/tiktok-img.png"></image>
                 </view>
                 <block wx:if="{{flodMap[index]}}">
                    <view class="coupon-detail-line" style="margin-top: 22rpx;">

+ 60 - 2
pages/welfareMall/exchangeCode/exchangeCode.js

@@ -1,5 +1,6 @@
 // pages/welfareMall/exchangeCode/exchangeCode.js
-import {getColor} from '../../../utils/user'
+import WelfareMall from '../../../api/welfareMall'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync, getColor} from '../../../utils/user'
 Page({
 
   /**
@@ -7,6 +8,9 @@ Page({
    */
   data: {
     config: {},
+    sn: '',
+    querySn: '',
+    hideWindowValue: false,
   },
 
   /**
@@ -66,5 +70,59 @@ Page({
    */
   onShareAppMessage() {
 
-  }
+  },
+
+  bindText: function (e) {
+    var text = e.detail.value;
+    this.setData({
+      sn: text,
+    }) 
+  },
+
+    /**
+   * 弹框
+   */
+  hideWindow(){
+    this.setData({
+      hideWindowValue:true
+    })
+  },
+
+  goPerson(){
+    wx.switchTab({
+         url: '../personal/personal'
+     })
+  },
+
+     /**
+    * 确认
+    */
+   toConfirm: function() {
+    if(this.data.sn == null || this.data.sn == '' || this.data.sn == undefined){
+     wx.showToast({
+       title: '兑换码必填',
+       icon: 'none',
+       duration: 1500
+     })
+     return
+    }
+   WelfareMall.exchangeCoupon({
+     mobile: getMobileCache(),
+     sn: this.data.sn,
+   }).then(res => {
+      //  if (res.code == 200) {
+      //   wx.showToast({
+      //     title: this.data.sn + '券码兑换成功',
+      //     icon: 'none',
+      //     duration: 1500
+      //   })
+      //   this.setData({
+      //     querySn: '',
+      //   })
+      //  }
+      this.hideWindow()
+   }).catch(_ => {
+       console.log(_)
+   })
+ },
 })

+ 1 - 1
pages/welfareMall/exchangeCode/exchangeCode.json

@@ -1,4 +1,4 @@
 {
   "usingComponents": {},
-  "navigationBarTitleText": "兑换券码"
+  "navigationBarTitleText": "券码兑换"
 }

+ 14 - 3
pages/welfareMall/exchangeCode/exchangeCode.wxml

@@ -1,9 +1,9 @@
 <!--pages/welfareMall/exchangeCode/exchangeCode.wxml-->
-<input class="exchangeCode-query" placeholder="请输入兑换码" placeholder-class="exchangeCode-query-placeholder"></input>
-<view class="exchangeCode-confirm"  style="background: {{config.mainColor?config.mainColor:'#B01717'}};">确认</view>
+<input class="exchangeCode-query" placeholder="请输入兑换码" placeholder-class="exchangeCode-query-placeholder" bindinput="bindText" value="{{querySn}}"></input>
+<view class="exchangeCode-confirm" style="background: {{config.mainColor?config.mainColor:'#B01717'}};" catchtap="toConfirm">确认</view>
 <view class="exchangeCode-process" style="border: {{config.mainColor?config.mainColor:'#B01717'}} 2rpx solid;">
   <view class="exchangeCode-process-style">
-    <view class="exchangeCode-process-tittle"  style="color: {{config.secColor?config.secColor:'#B01717'}};">抖音兑换码获取流程</view>
+    <view class="exchangeCode-process-tittle" style="color: {{config.secColor?config.secColor:'#B01717'}};">抖音兑换码获取流程</view>
     <view class="process-style flex-row">
       <view class="exchangeCode-process-speed">
         <view class="exchangeCode-process-img">
@@ -49,4 +49,15 @@
       </view>
     </view>
   </view>
+</view>
+
+<!-- 弹框 -->
+<view class="bg-zindex" wx:if="{{hideWindowValue}}">
+  <view class="success_window flex-column">
+    <view class="w_title">兑换券码成功</view>
+    <view class="w_text"><text class="hsay_text">沪上阿姨抖音优惠多多<br />
+        欢迎您的参与</text></view>
+    <view class="w_border"></view>
+    <view class="w_go_order" bindtap="goPerson">我知道了</view>
+  </view>
 </view>

+ 55 - 0
pages/welfareMall/exchangeCode/exchangeCode.wxss

@@ -125,4 +125,59 @@ page{
 
 .exchangeCode-process-speed{
   width: 180rpx;
+}
+
+.bg-zindex{
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top: 0;
+  background: rgba(0, 0, 0, 0.8);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  z-index: 999;
+}
+
+
+.success_window{
+  width: 656rpx;
+  height: 454rpx;
+  background: #FFFFFF;
+  border-radius: 20rpx;
+  position: relative;
+  z-index: 9999;
+  align-items: center;
+}
+
+.w_title{
+  font-size: 36rpx;
+  font-weight: 600;
+  color: #444444;
+  margin-top: 54rpx;
+}
+
+.w_text{
+  margin-top: 64rpx;
+  text-align: center;
+}
+
+.hsay_text{
+  margin-top: 16rpx;
+  font-size: 24rpx;
+  font-weight: 500;
+  color: #444444;
+}
+.w_border{
+  width: 600rpx;
+  height: 2rpx;
+  background: #A0A0A0;
+  margin-top: 72rpx;
+}
+.w_go_order{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #444444;
+  margin-top: 32rpx;
 }