|
@@ -124,37 +124,37 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<van-popup v-model="showPopup" round position="bottom" closeable close-icon="close"
|
|
|
- v-bind:style="{ height: '80%' }">
|
|
|
- <div style="height:90%;" class="mescroll-touch-y mescroll">
|
|
|
- <div class="flex" v-for="(item,index) in couponList" :key="index">
|
|
|
- <div class="flex" style="margin: 0.1rem 0;" v-on:click="selected(item)">
|
|
|
- <div class="couponleft">
|
|
|
- <div class="flex a-end j-center">
|
|
|
- <div>¥</div>
|
|
|
- <div>{{item.bonus}}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="flex col"
|
|
|
- style="justify-content: space-between;border-top:1px solid #dadada;border-right:1px solid #dadada;border-bottom:1px solid #dadada;height:2rem;width: 5.1rem;">
|
|
|
- <div class="flex"
|
|
|
- style="justify-content: space-between;margin: auto 0;padding-left: 0.1rem;">
|
|
|
- <div>
|
|
|
- <div style="font-size: 0.5rem;">{{item.bonus}}元优惠券</div>
|
|
|
- <div style="font-size: 0.25rem;color: #888;">失效时间:{{item.expireTime}}</div>
|
|
|
+ v-bind:style="{ height: '80%' }">
|
|
|
+ <div style="height:90%;" class="mescroll-touch-y mescroll">
|
|
|
+ <div class="flex" v-for="(item,index) in couponList" :key="index">
|
|
|
+ <div class="flex" style="margin: 0.1rem 0;" v-on:click="selected(item)">
|
|
|
+ <div class="couponleft">
|
|
|
+ <div class="flex a-end j-center">
|
|
|
+ <div>¥</div>
|
|
|
+ <div>{{item.bonus}}</div>
|
|
|
</div>
|
|
|
- <!-- <div style="margin: auto 0;padding-right: 0.1rem;">
|
|
|
- <van-checkbox v-model="item.checked"></van-checkbox>
|
|
|
- </div> -->
|
|
|
</div>
|
|
|
- <div class="flex"
|
|
|
- style="border-top:1px dashed #dadada;height: .4rem;align-items: center;padding-left: 0.1rem;">
|
|
|
- <div style="font-size: 0.18rem;">适用范围:{{item.couponDescribe}}</div>
|
|
|
+ <div class="flex col"
|
|
|
+ style="justify-content: space-between;border-top:1px solid #dadada;border-right:1px solid #dadada;border-bottom:1px solid #dadada;height:2rem;width: 5.1rem;">
|
|
|
+ <div class="flex"
|
|
|
+ style="justify-content: space-between;margin: auto 0;padding-left: 0.1rem;">
|
|
|
+ <div>
|
|
|
+ <div style="font-size: 0.5rem;">{{item.bonus}}元优惠券</div>
|
|
|
+ <div style="font-size: 0.25rem;color: #888;">失效时间:{{item.expireTime}}</div>
|
|
|
+ </div>
|
|
|
+ <div style="margin: auto 0;padding-right: 0.1rem;">
|
|
|
+ <van-checkbox v-model="item.checked"></van-checkbox>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="flex"
|
|
|
+ style="border-top:1px dashed #dadada;height: .4rem;align-items: center;padding-left: 0.1rem;">
|
|
|
+ <div style="font-size: 0.18rem;">适用范围:{{item.couponDescribe}}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </van-popup>
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
@@ -180,13 +180,14 @@
|
|
|
canClick: true,
|
|
|
showPopup: false,
|
|
|
couponList: [],
|
|
|
- couponNum: ""
|
|
|
+ couponNum: "",
|
|
|
+ addd: [],
|
|
|
+ checkNum: 0
|
|
|
},
|
|
|
created: function () {
|
|
|
this.store.map(function (item) {
|
|
|
item.couponName = "选择优惠券";
|
|
|
item.couponId = ""
|
|
|
- item.couponData = ""
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
@@ -239,6 +240,12 @@
|
|
|
* 扫码入库
|
|
|
*/
|
|
|
showPopups: function (item) {
|
|
|
+ if(this.checkNum>=this.couponNum){
|
|
|
+ api.toast({
|
|
|
+ msg: "最多使用" + this.couponNum + "张优惠券"
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
this.showPopup = true
|
|
|
var data = {
|
|
|
"storeId": this.userid,
|
|
@@ -252,40 +259,35 @@
|
|
|
}
|
|
|
var url = "storeCouponMessage",
|
|
|
_this = this;
|
|
|
- this.selectedData=item
|
|
|
+ this.selectedData = item
|
|
|
this.$post(url, data, function (ret) {
|
|
|
if (ret.code == 0) {
|
|
|
ret.data.map(function (e) {
|
|
|
e.checked = false;
|
|
|
})
|
|
|
_this.couponList = ret.data
|
|
|
- // _this.getcouponData(item, ret.data)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
selected: function (a) {
|
|
|
this.selectedData
|
|
|
- var _this=this;
|
|
|
+ var _this = this;
|
|
|
this.store
|
|
|
- .filter(function (e) {
|
|
|
- return e.tirenumber==_this.selectedData.tirenumber && e.checked == false
|
|
|
- })
|
|
|
- .forEach(function (e) {
|
|
|
- e.couponName = "-¥"+a.bonus;
|
|
|
- e.popupid = a.id;
|
|
|
- e.checked=true
|
|
|
- })
|
|
|
- this.showPopup=false
|
|
|
- },
|
|
|
- getcouponData: function (a, b) {
|
|
|
- // alertJson(b)
|
|
|
- this.store.filter(function (e) {
|
|
|
- return e.tirenumber == a.tirenumber
|
|
|
- }).forEach(function (e) {
|
|
|
- // alertJson(e)
|
|
|
- e.couponData = b
|
|
|
+ .filter(function (e) {
|
|
|
+ return e.tirenumber == _this.selectedData.tirenumber
|
|
|
+ })
|
|
|
+ .forEach(function (e) {
|
|
|
+ e.couponName = "-¥" + a.bonus;
|
|
|
+ e.couponId = a.id;
|
|
|
+ // e.checked=true
|
|
|
+ })
|
|
|
+ this.checkNum = 0
|
|
|
+ this.store.map(function (cart, index) {
|
|
|
+ if (cart.couponName != "选择优惠券") {
|
|
|
+ _this.checkNum += 1
|
|
|
+ }
|
|
|
})
|
|
|
- alertJson(this.store)
|
|
|
+ this.showPopup = false
|
|
|
},
|
|
|
doneChoose: function () {
|
|
|
if (!this.address.lat || !this.address.lon) {
|