Commit 3e8752536e82282df8953a82a1f654ab5afa783c

Authored by vking
1 parent 20e92328

商家红包活动

@@ -8,9 +8,12 @@ @@ -8,9 +8,12 @@
8 <view class="line"></view> 8 <view class="line"></view>
9 <view class="type"> 9 <view class="type">
10 <view class="card_title">{{quan.card_title}}</view> 10 <view class="card_title">{{quan.card_title}}</view>
11 - <view class="card-date"> 11 + <view class="card-date" wx:if="{{quan.start_time>0}}">
12 {{util.unixtoTime(quan.start_time,"YYYY.MM.DD")}}-{{util.unixtoTime(quan.end_time,"YYYY.MM.DD")}} 12 {{util.unixtoTime(quan.start_time,"YYYY.MM.DD")}}-{{util.unixtoTime(quan.end_time,"YYYY.MM.DD")}}
13 </view> 13 </view>
  14 + <view class="card-date" wx:else="">
  15 + 长期有效
  16 + </view>
14 </view> 17 </view>
15 <view class="opt"> 18 <view class="opt">
16 <slot></slot> 19 <slot></slot>
@@ -32,9 +32,12 @@ Component({ @@ -32,9 +32,12 @@ Component({
32 }) 32 })
33 }, 33 },
34 hide(){ 34 hide(){
35 - this.setData({  
36 - display:false,  
37 - }) 35 + this.triggerEvent('event',{act:'reflush'});
  36 + setTimeout(()=>{
  37 + this.setData({
  38 + display:false,
  39 + })
  40 + },300)
38 }, 41 },
39 discountFormat(checkout){ 42 discountFormat(checkout){
40 if(!checkout) return; 43 if(!checkout) return;
@@ -42,7 +45,7 @@ Component({ @@ -42,7 +45,7 @@ Component({
42 let disObj={} 45 let disObj={}
43 let subsidy_price=0; 46 let subsidy_price=0;
44 checkout.discount.forEach(q=>{ 47 checkout.discount.forEach(q=>{
45 - checkout.disabled=false 48 + q.disabled=false
46 if(q.checked){ 49 if(q.checked){
47 num++; 50 num++;
48 disObj[q.owner+'-'+q.receive_condition]=true 51 disObj[q.owner+'-'+q.receive_condition]=true
@@ -51,7 +54,7 @@ Component({ @@ -51,7 +54,7 @@ Component({
51 }) 54 })
52 checkout.discount.forEach(q=>{ 55 checkout.discount.forEach(q=>{
53 if(!q.checked && disObj[q.owner+'-'+q.receive_condition]){ 56 if(!q.checked && disObj[q.owner+'-'+q.receive_condition]){
54 - checkout.disabled=true 57 + q.disabled=true
55 } 58 }
56 }) 59 })
57 checkout.subsidy_price=subsidy_price 60 checkout.subsidy_price=subsidy_price
@@ -59,11 +62,13 @@ Component({ @@ -59,11 +62,13 @@ Component({
59 checkedNum:num, 62 checkedNum:num,
60 checkoutObj:checkout 63 checkoutObj:checkout
61 }) 64 })
  65 + console.log('discountFormat',checkout)
62 }, 66 },
63 discountChecked(e) { 67 discountChecked(e) {
64 console.log('discountChecked', e) 68 console.log('discountChecked', e)
65 let index = util.attr(e, 'index') 69 let index = util.attr(e, 'index')
66 let checkout = this.data.checkout 70 let checkout = this.data.checkout
  71 + if(checkout.discount[index].disabled) return false;
67 checkout.discount[index].checked = !checkout.discount[index].checked 72 checkout.discount[index].checked = !checkout.discount[index].checked
68 this.discountFormat(checkout) 73 this.discountFormat(checkout)
69 App.Customer.ChangeDiscountCombination({ 74 App.Customer.ChangeDiscountCombination({
@@ -72,7 +77,7 @@ Component({ @@ -72,7 +77,7 @@ Component({
72 owner:checkout.discount[index].owner, 77 owner:checkout.discount[index].owner,
73 status:checkout.discount[index].checked?1:0, 78 status:checkout.discount[index].checked?1:0,
74 }).then(()=>{ 79 }).then(()=>{
75 - this.triggerEvent('event',{act:'reflush'}); 80 + //this.triggerEvent('event',{act:'reflush'});
76 }) 81 })
77 }, 82 },
78 } 83 }
@@ -13,8 +13,10 @@ @@ -13,8 +13,10 @@
13 </view> 13 </view>
14 <view class="list"> 14 <view class="list">
15 <view class="quan" wx:for="{{checkoutObj.discount}}" wx:key="discount"> 15 <view class="quan" wx:for="{{checkoutObj.discount}}" wx:key="discount">
16 - <quan quan="{{item}}">  
17 - <radio data-index="{{index}}" checked="{{item.checked}}" color="#F05522" 16 + <quan quan="{{item}}" cla="{{item.disabled?'quan-disabled':''}}">
  17 + <radio data-index="{{index}}"
  18 + disabled="{{item.disabled}}"
  19 + checked="{{item.checked}}" color="#F05522"
18 bindtap="discountChecked"/> 20 bindtap="discountChecked"/>
19 </quan> 21 </quan>
20 </view> 22 </view>
  1 +// pack-checkout/components/xfCard.js
  2 +import App from '../../utils/api'
  3 +Component({
  4 + /**
  5 + * 组件的属性列表
  6 + */
  7 + properties: {
  8 + checkout:Object,
  9 + },
  10 +
  11 + /**
  12 + * 组件的初始数据
  13 + */
  14 + data: {
  15 + display:false,
  16 + },
  17 +
  18 + /**
  19 + * 组件的方法列表
  20 + */
  21 + methods: {
  22 + show(){
  23 + App.Customer.SetCardRel({
  24 + sid:this.data.checkout.sid,
  25 + //price:3,
  26 + price:this.data.checkout.should_price,
  27 + receive_type:4,//任务领取
  28 + }).then(res=>{
  29 + if(res.data){
  30 + this.setData({
  31 + card:res.data,
  32 + display:true,
  33 + })
  34 + }
  35 + })
  36 + },
  37 + hide(){
  38 + this.setData({
  39 + display:false,
  40 + })
  41 + },
  42 + }
  43 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--pack-checkout/components/xfCard.wxml-->
  2 +<view class="mask flex-vc" wx:if="{{display}}">
  3 + <view class="card">
  4 + <view class="close" bindtap="hide"></view>
  5 + </view>
  6 +</view>
  1 +/* pack-checkout/components/xfCard.wxss */
  2 +@import "/app.wxss";
  3 +.card{
  4 + width: 578rpx;
  5 + height: calc(686rpx - 60rpx);
  6 + background-image: url("http://nosqn.colorcun.com/sellerbaobao/baobao.png");
  7 + background-size: 100% 100%;
  8 + position: relative;
  9 +}
  10 +.close{
  11 + background-image: url("http://nosqn.colorcun.com/sellerbaobao/close2.png");
  12 + background-size: 100% 100%;
  13 + width:48rpx;
  14 + height:48rpx;
  15 + position: absolute;
  16 + top:-60rpx;
  17 + right:0;
  18 +}
@@ -159,6 +159,8 @@ Page({ @@ -159,6 +159,8 @@ Page({
159 App.PushMsg.SendUrgeMsg({rid:this.data.checkout.rid}) 159 App.PushMsg.SendUrgeMsg({rid:this.data.checkout.rid})
160 }, 160 },
161 pay(){ 161 pay(){
  162 + this.selectComponent('#xfCard').show();
  163 + return;
162 App.PayOnline.CombineTransactions({ 164 App.PayOnline.CombineTransactions({
163 rid:this.data.checkout.rid, 165 rid:this.data.checkout.rid,
164 }).then(res=>{ 166 }).then(res=>{
@@ -167,6 +169,7 @@ Page({ @@ -167,6 +169,7 @@ Page({
167 wx.requestPayment({ 169 wx.requestPayment({
168 ...res.data, 170 ...res.data,
169 success:res=>{ 171 success:res=>{
  172 + this.selectComponent('#xfCard').show();
170 this.GetCheckout() 173 this.GetCheckout()
171 }, 174 },
172 }) 175 })
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "invoice":"/components/userinfo/invoice", 8 "invoice":"/components/userinfo/invoice",
9 "subscribe":"/components/userinfo/subscribe", 9 "subscribe":"/components/userinfo/subscribe",
10 "jinduBar":"../components/jinduBar", 10 "jinduBar":"../components/jinduBar",
11 - "discount":"../components/discount" 11 + "discount":"../components/discount",
  12 + "xfCard":"../components/xfCard"
12 } 13 }
13 } 14 }
@@ -140,4 +140,5 @@ @@ -140,4 +140,5 @@
140 </block> 140 </block>
141 </view> 141 </view>
142 <showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal> 142 <showModal id="showModal" confirmText="知道了" bindshowModal="showModal" cla="checkout"></showModal>
143 -<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount>  
  143 +<discount id="discount" checkout="{{checkout}}" bindevent="discountEvent"></discount>
  144 +<xfCard id="xfCard" checkout="{{checkout}}"></xfCard>