Commit 3a05bb83104217a6cca6c2095031d92ed74328f3

Authored by yvan.ni
1 parent ef14e486

充值有礼的优化

packageA/pages/chongzhi/chongzhi.js
... ... @@ -183,16 +183,45 @@ Page({
183 183 app.goto('../chongzhiDetails/chongzhiDetails?id=' + id+"&type=1");
184 184 },
185 185  
186   - viewDetails(e){
  186 + viewDetails(e){
187 187 var index=e.currentTarget.dataset.index;
188   - var WriteOffCode=this.data.list[index].WriteOffCode;
  188 + //var WriteOffCode=this.data.list[index].WriteOffCode;
  189 + var id=this.data.list[index].ID;
  190 +
  191 + this.detail_next(id);
  192 + },
  193 +
  194 + async detail_next(id){
  195 + var code='';
  196 + //获取二维码,强制更新
  197 + let res= await getApp().request.promisePut("/api/weshop/store/updateErpApi",{
  198 + data:{
  199 + store_id:getApp().globalData.setting.stoid,
  200 + ApiName:"/api/erp/vip/buyaddmoneyactDetails/updateMainCode",
  201 + Id:id,
  202 + VIPId:getApp().globalData.userInfo.erpvipid
  203 + }
  204 + })
  205 + if(res){
  206 + if(res.data.code==-1){
  207 + util.m_toast(res.data.msg);
  208 + return false;
  209 + }
  210 + if(res.data.data)
  211 + code = res.data.data.WriteOffCode;
  212 + }
  213 + if(!code){
  214 + util.m_toast('未找到二维码');
  215 + return false;
  216 + }
  217 +
  218 +
189 219 var qrcode = this.selectComponent("#qrcode"); //组件的id
190   - var code=WriteOffCode;
191   - var e={is_fw:1,val:code,code:code}
192   - qrcode.open(e);
193   -
  220 + var e={is_fw:1,val:code,code:code}
  221 + qrcode.open(e);
194 222 },
195   -
  223 +
  224 +
196 225 // 检测上拉滚动到底部
197 226 // scrollToLower: function (requestData, callback) {
198 227 // // 数据总量
... ...
packageA/pages/chongzhi/chongzhi.wxml
... ... @@ -28,7 +28,7 @@
28 28 <view class="fs28 ellipsis-2 txt-justify">{{item.ActName}}</view>
29 29 <view>
30 30 <view class="price fs24">零售价:¥{{item.PosPrice}}</view>
31   - <view class="date fs24">{{(currentIndex == 0 ? '兑换截止日期': '核销时间') + ':' + item.BeginDate + '至' + (item.EndDate==''?'不限':item.EndDate)}}</view>
  31 + <view class="date fs24">购买时间:{{item.BillDate}}</view>
32 32 </view>
33 33 </view>
34 34 </view>
... ... @@ -36,7 +36,7 @@
36 36 <view class="bottom" wx:if="{{currentIndex == 0}}" >
37 37 <text wx:if="{{g_filter.is_acting(item.EndDate) || item.EndDate==''}}"
38 38 catchtap="viewDetails" data-index="{{index}}" class="btn" >立即使用</text>
39   - <text wx:else class="btn" style="background-color: #ccc;">已过期</text>
  39 + <text wx:else class="btn" style="background-color: #ccc;">已过期</text>
40 40 <text data-index="{{index}}" class="btn details" >详情</text>
41 41 </view>
42 42 <view class="bottom" wx:if="{{currentIndex == 1}}" >
... ...
packageA/pages/chongzhiDetails/chongzhiDetails.js
... ... @@ -63,7 +63,8 @@ Page({
63 63 if(options.type==1){
64 64 api="/api/weshop/users/getBuyaddmoneyactDetails";
65 65 }
66   -
  66 +
  67 + this.data.op_id=options.id;
67 68 app.request.get(api, {
68 69 data: {
69 70 Id:options.id,
... ... @@ -71,8 +72,8 @@ Page({
71 72 user_id: UserInfo.user_id,
72 73 },
73 74 success: function (res) {
  75 +
74 76 var result=res.data.data;
75   -
76 77 var now=new Date();
77 78 var reg = RegExp("-", "g");
78 79 var endtime = result.EndDate.replace(reg, '/');
... ... @@ -136,11 +137,41 @@ Page({
136 137  
137 138 },
138 139  
139   - onUse() {
140   - var qrcode = this.selectComponent("#qrcode"); //组件的id
141   - var code=this.data.result.WriteOffCode;
142   - var e={is_fw:1,val:code,code:code}
143   - qrcode.open(e);
  140 + async onUse() {
  141 + //-- 如果过期就不可用 ---
  142 + if(this.data.result.IsGQ){
  143 + return false;
  144 + }
  145 +
  146 +
  147 + //var code=this.data.result.WriteOffCode;
  148 + var code='';
  149 +
  150 + //获取二维码
  151 + let res= await getApp().request.promisePut("/api/weshop/store/updateErpApi",{
  152 + data:{
  153 + store_id:os.stoid,
  154 + ApiName:"/api/erp/vip/buyaddmoneyactDetails/updateMainCode",
  155 + Id:this.data.op_id,
  156 + VIPId:getApp().globalData.userInfo.erpvipid
  157 + }
  158 + })
  159 + if(res){
  160 + if(res.data.code==-1){
  161 + util.m_toast(res.data.msg);
  162 + return false;
  163 + }
  164 + if(res.data.data)
  165 + code = res.data.data.WriteOffCode;
  166 + }
  167 + if(!code){
  168 + util.m_toast('未找到二维码');
  169 + return false;
  170 + }
  171 +
  172 + var qrcode = this.selectComponent("#qrcode"); //组件的id
  173 + var e={is_fw:1,val:code,code:code}
  174 + qrcode.open(e);
144 175 },
145 176  
146 177  
... ... @@ -286,5 +317,53 @@ Page({
286 317 if(url){
287 318 getApp().goto(url);
288 319 }
  320 + },
  321 +
  322 + //-- 显示二维码 --
  323 + getcode(e) {
  324 + var idx = e.currentTarget.dataset.index;
  325 + var item = this.data.result.givelist[idx];
  326 + this.get_code_next(item);
  327 + },
  328 +
  329 + async get_code_next(item){
  330 + var th = this;
  331 + //--获取成功的时候--
  332 + var no = '';
  333 +
  334 + var id=item.GiftsId;
  335 + var IsRetrieval=item.IsRetrieval;
  336 +
  337 + //-- 有调起的时候 --
  338 + if(IsRetrieval){
  339 + no=item.WriteOffCodeOne;
  340 + }else {
  341 + //获取二维码
  342 + let res = await getApp().request.promisePut("/api/weshop/store/updateErpApi", {
  343 + data: {
  344 + store_id: os.stoid,
  345 + ApiName: "/api/erp/vip/buyaddmoneyactDetails/updateMainCodeOne",
  346 + Id: id,
  347 + VIPId: getApp().globalData.userInfo.erpvipid
  348 + }
  349 + })
  350 + if (res) {
  351 + if (res.data.code == -1) {
  352 + util.m_toast(res.data.msg);
  353 + return false;
  354 + }
  355 + if (res.data.data)
  356 + no = res.data.data.WriteOffCode;
  357 + }
  358 + }
  359 + if(!no){
  360 + util.m_toast('未找到二维码');
  361 + return false;
  362 + }
  363 +
  364 +
  365 + var qc_com = th.selectComponent("#qrcode"); //组件的id
  366 + var e={is_fw:1,val:no,code:no}
  367 + qc_com.open(e)
289 368 }
290 369 })
291 370 \ No newline at end of file
... ...
packageA/pages/chongzhiDetails/chongzhiDetails.wxml
... ... @@ -39,13 +39,23 @@
39 39 <image wx:if="{{item.PAdvanceItemId>0}}" src="{{url}}/miniapp/images/giftbag/gift01.png"></image><!-- 预存 -->
40 40 </view>
41 41 <!-- 右 -->
42   - <view class="info">
  42 + <view class="info" style="position: relative;">
43 43 <view wx:if="{{item.GiveType=='0'}}">{{item.CouponSum}}元优惠券</view>
44 44 <view wx:elif="{{item.Integral>0}}">{{item.Integral}}积分</view>
45 45 <view wx:elif="{{item.GradeSum>0}}">{{item.GradeSum}}成长值</view>
46 46 <view wx:else>{{item.GiveName}}</view>
47 47 <!-- <view class="fs28 pdv10 txt-justify">节日可免费享受专业美甲,可以享受1次。</view> -->
48   - <view wx:if="{{item.Qty>0}}" class="t-r fs24">数量:{{item.Qty}}</view>
  48 + <view wx:if="{{item.Qty>0}}" class="fs24">数量:{{item.Qty}}</view>
  49 + <view wx:if="{{item.GiveType=='2'}}" class="date fs24">{{'兑换截止日期' + ':' + item.BeginDate + '至' + (item.EndDate==''?'不限':item.EndDate) }}</view>
  50 +
  51 + <!-- 优化显示二维码 -->
  52 + <view class="box_ware_code data-v-3a5b7e36" wx:if="{{item.GiveType=='2' && item.IsQrCode==1}}">
  53 + <!-- <block wx:if="{{c_state==0}}"> -->
  54 + <image src="{{url+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode"
  55 + data-index="{{index}}"
  56 + class="data-v-3a5b7e36"></image>
  57 + </view>
  58 +
49 59 </view>
50 60 </view>
51 61 </view>
... ... @@ -57,7 +67,7 @@
57 67 <text wx:if="{{type==0}}" data-advance="{{result.Id}}" data-money="{{result.BeginSum}}"
58 68 class="btn" bindtap="go_buy">立即充值</text>
59 69 <block wx:else>
60   - <text wx:if="{{result.AddType==0 || result.AddType=='0'}}" class="btn" bindtap="onUse">立即使用</text>
  70 + <text wx:if="{{result.AddType==0 || result.AddType=='0'}}" class="btn {{result.IsGQ?'bk_huise':''}} " bindtap="onUse">立即使用</text>
61 71 <text wx:if="{{result.AddType==1 || result.AddType=='1'}}" class="btn" >已核销</text>
62 72 </block>
63 73 </view>
... ...
packageA/pages/chongzhiDetails/chongzhiDetails.wxss
... ... @@ -109,6 +109,10 @@
109 109 font-size: 28rpx;
110 110 }
111 111  
  112 +.btn.bk_huise {
  113 + background-color: gainsboro;
  114 +}
  115 +
112 116 .img-block {
113 117 display: block;
114 118 width: 100%;
... ... @@ -147,4 +151,20 @@
147 151  
148 152 .container{
149 153 display: block;min-height: 100%;width: 100%;position: absolute;left: 0;top: 0;z-index: 1;
  154 +}
  155 +
  156 +.date {
  157 + padding-top: 10rpx;
  158 + color: #FE6867;
  159 +}
  160 +
  161 +.box_ware_code.data-v-3a5b7e36 {
  162 + position: absolute;
  163 + right: 10rpx;
  164 + top: 10rpx;
  165 +}
  166 +
  167 +.box_ware_code image.data-v-3a5b7e36 {
  168 + width: 50rpx;
  169 + height: 50rpx;
150 170 }
151 171 \ No newline at end of file
... ...