123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <template>
- <view >
- <ujp-navbar title="我的优惠券"><view class="exchange oldTextjp2" oldstyle="font-size: 16px;" @click="toConversion">兑换</view></ujp-navbar>
-
- <u-alert-tips size="12" :show-icon="true" type="warning"
- description="同类型优惠券只显示一张"></u-alert-tips>
-
-
- <view class="list-item"
-
- v-for="(item,index) in myCouponList"
- :style="item.chooseStatus == '0' ? 'opacity: 0.5':'' "
- @click="ckselectObj(item)"
- :key="item.id">
-
- <view
- :style="item.chooseStatus == '0' ? 'background-color:#9F9F9F':'' "
-
- class="voucher" v-if="item.classify == '1'">优惠券</view>
- <view
- :style="item.chooseStatus == '0' ? 'background-color:#9F9F9F':'' "
-
- class="voucher" v-if="item.classify == '2'">折扣卷</view>
- <view class="checked" v-if="selectObj.id==item.id">
- <img src="../../../static/img/选中.png" alt="">
- </view>
-
-
- <view class="item-left">
- <view class="title oldTextjp" oldstyle="font-size: 18px;">
- {{item.couponName}}
- </view>
- <view class="useful-life oldTextjp2" oldstyle="font-size: 16px;">
- 有效期至{{item.endDate&&item.endDate.slice(0,10)}}{{" "}}
- <span class="item-left-explain" @click.stop="gotoUrl('pages/user/coupon/couponDetails?id=' + item.id)">使用说明</span>
- </view>
- </view>
- <view class="item-right">
-
- <view class="price"
- :style="item.chooseStatus == '0' ? 'color:#666':'' "
-
- v-if="item.classify == '1'">{{item.value}}元</view>
- <view class="price2"
- :style="item.chooseStatus == '0' ? 'color:#666':'' "
-
- v-if="item.classify == '2'">服务费{{item.value}}折</view>
-
- <view class="contidion oldTextjp2" oldstyle="font-size: 16px;">
- {{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'元可用'}}
- </view>
- </view>
- </view>
- <u-divider v-if="myCouponList.length > 0" style="margin-top: 10px;background-color: #F2F4F4;">已经到底了</u-divider>
- <view v-if="myCouponList.length > 0" style="padding-bottom: 80px;" ></view>
- <view class="carNone" v-if="myCouponList.length == 0">
- <img src="static/img/暂无数据-缺省页.png" alt="">
- <p>暂无优惠券</p>
- </view>
-
- <view class="bottom">
- <view class="text">
-
- <view class="num">
-
- <view class="price" v-if="selectObj.classify == '1'">抵扣{{selectObj.value}}元</view>
- <view class="price" v-if="selectObj.classify == '2'">服务费{{selectObj.value}}折</view>
-
- </view>
- </view>
- <u-button
- :style="selectObj.id ?'' : 'background-color:#9F9F9F'"
- @click="submitBtn"
- class="confirm" >
- <span>确定</span>
- </u-button>
- </view>
-
-
-
- </view>
- </template>
- <script>
- //import * as userApi from '@/apis/user.js'
- import * as userApi from '@/apis/chargeProcess.js'
-
- export default{
- data(){
- return{
- selectObj:{},
- amount:0,
- uuid:0,
- myCouponList: [],
- pageIndex: 1,
- recordsTotal: 0,
- stationId:"",
- }
- },
- onReachBottom() {
- if (this.myCouponList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- onLoad(op) {
- if(op.uuid){
- this.amount=op.amount
- this.uuid=op.uuid
- this.stationId=op.stationId;
- }
-
- },
- onShow() {
- this.getCouponList();
- },
- methods:{
- submitBtn(){
- if(this.selectObj.id){
- this.carhelp.set("chooseCoupons",{
- uuid:this.uuid,
- selectObj:this.selectObj
- })
- uni.navigateBack({
-
- })
- }
- },
- ckselectObj(item){
- if(item.chooseStatus==1){
- this.selectObj=item;
- }else{
- uni.showToast({
- title:"不满足使用条件"
- })
- }
-
- },
- toConversion() {
- uni.navigateTo({
- url: '/pages/user/coupon/conversion'
- })
- },
- getCouponList(bl) {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.myCouponList = [];
- this.pageIndex = 1;
- }
- userApi.useCoupon({
- amount:this.amount,
- stationId:this.stationId
- }).then((res) => {
- uni.hideLoading();
-
- this.myCouponList =res.data.userCouponList
- this.recordsTotal = res.data.recordsTotal;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- myLoadmore() {
- this.pageIndex += 1;
- this.getCouponList()
- },
- }
- }
- </script>
- <style lang="scss">
- .carNone{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- img{
- width: 100%;
- height: 100%;
- }
- p{
- margin-top: -60px;
- }
- }
- .exchange{
- margin-left: 85.3%;
- color: rgba(119, 119, 119, 100);
- font-size: 12px
- }
- .list-item{
- width: 91.4%;
- display: flex;
- justify-content: space-between;
- background-color: #fff;
- margin: 12px auto 0;
- border-radius: 8px;
- position: relative;
- .voucher{
- width: 60px;
- height: 20px;
- line-height: 20px;
- border-radius: 8px 0px 8px 0px;
- background-color: rgba(0, 185, 98, 100);
- color: rgba(255, 255, 255, 100);
- font-size: 12px;
- text-align: center;
- position: absolute;
- top: 0;
- left: 0;
- }
- .checked{
- width: 28px;
- height: 28px;
- position: absolute;
- top: 0;
- right: 0;
- img{
- width: 100%;
- height: 100%;
- }
- }
- .item-left{
- padding: 24px 0 20px 5px;
- .title{
- line-height: 25px;
- color: rgba(16, 16, 16, 100);
- font-size: 18px;
- font-weight: 600;
- }
- .useful-life{
- line-height: 22px;
- color: rgba(51, 51, 51, 100);
- font-size: 14px;
- margin-top: 1px;
- }
- .item-left-explain {
- color: rgba(0, 185, 98, 100);
- font-size: 14px;
- }
- }
- .item-right{
- padding: 19px 5px 18px 0;
-
- .price{
- height: 38px;
- color: rgba(0, 185, 98, 100);
- font-size: 32px;
- text-align: right;
- }
- .price2{
- height: 38px;
- color: rgba(0, 185, 98, 100);
- font-size: 20px;
- text-align: right;
- }
- .contidion{
- height: 22px;
- color: rgba(51, 51, 51, 100);
- font-size: 16px;
- text-align: right;
- margin-top: 4px;
- }
- }
- }
- .have-used{
-
- width: 54px;
- height: 54px;
- position: absolute;
- top: -12px;
- right: 0;
- img{
- width: 100%;
- height: 100%;
- }
- }
- .bottom{
- position: fixed;
- bottom: 0;
- right: 0;
- width: 100%;
- height: 64px;
- line-height: 64px;
- background-color: #fff;
- padding: 0 16px;
- display: flex;
- justify-content: space-between;
- .text{
- height: 20px;
- color: rgba(16, 16, 16, 100);
- font-size: 18px;
- display: flex;
- .num{
- color: orangered;
- font-size: 18px
- }
- }
- .confirm{
- width: 100px;
- height: 40px;
- border-radius: 50px;
- background-color: rgba(0, 185, 98, 100);
- color: rgba(255, 255, 255, 100);
- font-size: 18px;
- text-align: center;
- margin: auto 10px ;
- }
- }
- </style>
|