修改html标签为uni标签,修改rem单位为rpx,修改提示及确认为uniapi,修改登录模块为uni接口,修改css入口为APP.vue,增加app端样式支持
This commit is contained in:
@ -1,80 +1,88 @@
|
||||
<template>
|
||||
<div v-if="couponList.length > 0">
|
||||
<div class="coupon-window" :class="value ? 'on' : ''">
|
||||
<div class="couponWinList">
|
||||
<div
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, couponwindiwIndex) in couponList"
|
||||
:key="couponwindiwIndex"
|
||||
>
|
||||
<div class="money font-color-red">
|
||||
¥<span class="num">{{ item.coupon_price }}</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
<div class="name">
|
||||
购物买{{ item.use_min_price }}减{{ item.coupon_price }}
|
||||
</div>
|
||||
<div v-if="item.end_time">
|
||||
{{ item.start_time }}-{{ item.end_time }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height:1.2rem"></div>
|
||||
</div>
|
||||
<div class="lid">
|
||||
<div class="bnt font-color-red" @click="checked">立即领取</div>
|
||||
<div class="iconfont icon-guanbi3" @click="close"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mask" @touchmove.prevent :hidden="!value"></div>
|
||||
</div>
|
||||
<view v-if="couponList.length > 0">
|
||||
<view class="coupon-window" :class="value ? 'on' : ''">
|
||||
<view class="couponWinList">
|
||||
<view class="item acea-row row-between-wrapper" v-for="(item, couponwindiwIndex) in couponList" :key="couponwindiwIndex">
|
||||
<view class="money font-color-red">
|
||||
¥<text class="num">{{ item.coupon_price }}</text>
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="name">
|
||||
购物买{{ item.use_min_price }}减{{ item.coupon_price }}
|
||||
</view>
|
||||
<view v-if="item.end_time">
|
||||
{{ item.start_time }}-{{ item.end_time }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height:1.2rem"></view>
|
||||
</view>
|
||||
<view class="lid">
|
||||
<view class="bnt font-color-red" @click="checked">立即领取</view>
|
||||
<view class="iconfont icon-guanbi3" @click="close"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" @touchmove.prevent :hidden="!value"></view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import toLogin from "@/libs/login";
|
||||
import { couponReceiveBatch } from "@/api/user";
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import toLogin from "@/libs/login";
|
||||
import {
|
||||
couponReceiveBatch
|
||||
} from "@/api/user";
|
||||
|
||||
export default {
|
||||
name: "CouponWindow",
|
||||
props: {
|
||||
couponList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
computed: mapGetters(["isLogin"]),
|
||||
data: function() {
|
||||
return {
|
||||
value: true
|
||||
};
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
checked() {
|
||||
const isLogin = this.isLogin;
|
||||
if (!isLogin) return toLogin();
|
||||
export default {
|
||||
name: "CouponWindow",
|
||||
props: {
|
||||
couponList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
computed: mapGetters(["isLogin"]),
|
||||
data: function() {
|
||||
return {
|
||||
value: true
|
||||
};
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
checked() {
|
||||
const isLogin = this.isLogin;
|
||||
if (!isLogin) return toLogin();
|
||||
|
||||
const ids = this.couponList.reduce((initial, coupon) => {
|
||||
initial.push(coupon.id);
|
||||
return initial;
|
||||
}, []);
|
||||
couponReceiveBatch(ids)
|
||||
.then(() => {
|
||||
this.$emit("success");
|
||||
this.$dialog.toast({ mes: "领取成功" });
|
||||
})
|
||||
.catch(() => {
|
||||
this.$dialog.toast({ mes: "已领取" });
|
||||
});
|
||||
if (isLogin) {
|
||||
this.value = false;
|
||||
this.$emit("checked");
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
this.value = false;
|
||||
this.$emit("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
const ids = this.couponList.reduce((initial, coupon) => {
|
||||
initial.push(coupon.id);
|
||||
return initial;
|
||||
}, []);
|
||||
couponReceiveBatch(ids)
|
||||
.then(() => {
|
||||
this.$emit("success");
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
uni.showToast({
|
||||
title: '已领取',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
if (isLogin) {
|
||||
this.value = false;
|
||||
this.$emit("checked");
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
this.value = false;
|
||||
this.$emit("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user