123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <view class="coupon">
- <!-- 列表 -->
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
-
- <view class="discounts-item" v-for="(item,index) in list" :key="index" >
- <view class="type-box">
- <view class="price">
- ¥{{item.discount/100}}
- </view>
- <view class="type">
- {{item | filterType}}
- </view>
- </view>
- <view class="info">
- <view class="title">
- {{item.promotionDesc}}
- </view>
- <view class="limit">
- {{$u.timeFormat(item.startTimestamp*1000, 'yyyy-mm-dd hh:MM:ss') }}后可用
- </view>
- <view class="desc">
- {{item.statusDesc || '-'}}
- </view>
-
- </view>
- <view class="radio-box">
- <image class="radio" @click="handleRadio(item)" :src="item.allowanceId == info.allowanceId?require('@/static/choosed.png'):require('@/static/unChoose.png')" mode=""></image>
- </view>
-
- </view>
- </zs-list>
-
- <view class="btn-box">
- <button class="save-btn" type="default" @click="save">确定</button>
- </view>
-
- </view>
- </template>
- <script>
- import {queryOrderPromotionList } from '@/api/refuel.js';
- export default {
- data() {
- return {
- that:this,
- type:'',//判断是线下支付还是线上支付
- open:999,
- status:'more',
- query:{
- "orderAmount": 0,
- "storeId": ""
- },
- list:[],
- info:{
- allowanceId:'',
- allowanceType:2,
- },//订单金额信息,用于返回订单页面传回
- }
- },
- filters: {
- filterPrice: function(val) {
- if(val.couponType == 1){
- return `¥${val.couponDiscount}`
- }else if(val.couponType == 2){
- return `${val.couponDiscount}折`
- }else if(val.couponType == 3){
- return `¥${val.couponDiscount}`
- }
- },
- filterType: function(val) {
- if(val.promotionType == 1){
- return `满${val.amount/100}立减`
- }else{
- return '无门槛立减'
-
- }
- },
-
- },
- methods: {
- handleRadio(item){
- if(item.allowanceId == this.info.allowanceId){
- this.info.allowanceId = ''
- this.info.couponName = ''
- }else{
- this.info.allowanceId = item.allowanceId
- // this.info.allowanceType = item.promotionType
- this.info.couponName = item.promotionDesc
- }
- },
-
- handleOpen(val,open){
- if(val === this[open]){
- this[open] = 999
- }else{
- this[open] = val
- }
- },
-
- loadMore(){
- // this.getMyCouponList()
- },
- getMyCouponList(){
- this.status = 'loading'
- queryOrderPromotionList(this.query).then(res=>{
- if(res.state == 'Success'){
- this.list = res.content
- this.status = 'noMore'
- }
- })
- },
- save(){
- console.log(999,this.query.storeId,this.info.epId);
- let that = this
- uni.navigateTo({
- url:`/refuel/refuelDetail?id=${this.query.storeId}&epId=${this.info.epId}`,
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('pay', that.info)
- },
- complete() {
- console.log('跳转完成');
- }
- })
- },
- },
- created() {
- },
- onLoad(options) {
- this.query.storeId = options.storeId
- // this.info.amount = options.amount
- // this.info.itemId = options.itemId
- // this.info.num = options.num
- // this.info.epId = options.epId
- let that = this
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.on('coupon', function(data) {
- that.query.orderAmount = data.amount*100
- that.info = {...that.info,...data}
- console.log(111,that.info);
- that.getMyCouponList()
- })
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .coupon{
- background: #f5f5f5;
- padding: 20rpx 24rpx 130rpx;
- min-height: 100vh;
- .tab-group{
- display: flex;
- align-items: center;
- background: #fff;
- position: fixed;
- height: 80rpx;
- top: 0%;
- left: 0%;
- width: 100%;
- z-index: 9;
- .tab{
- width: 150rpx;
- padding: 15rpx 30rpx;
- text-align: center;
- color: #999999;
- font-size: 28rpx;
- }
- .active{
- font-weight: bold;
- font-size: 32rpx;
- position: relative;
- color: #222222;
- &::before{
- display: block;
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0%;
- transform: translateX(-50%);
- width: 40rpx;
- height: 8rpx;
- background: linear-gradient(265deg, #FF4A39 0%, #FC8B45 100%);
- box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- }
-
- }
- }
-
- .discounts-item {
- margin-bottom: 20rpx;
- display: flex;
- align-items: center;
- background-color: rgb(239, 239, 239);
- background: url('@/static/new-card.png') no-repeat;
- background-repeat: no-repeat;
- background-size: 100% 144rpx;
- border-radius: 16rpx;
- height: 144rpx;
- padding: 0 24rpx;
- box-sizing: border-box;
- .type-box{
- width: 135rpx;
- text-align: center;
- .price{
- ont-size: 40rpx;
- color: #FF4D3A;
- }
- .type{
- font-size: 20rpx;
- color: #AAAAAA;
- margin-top: 12rpx;
- }
- }
- .info {
- flex: 1;
- margin-left: 40rpx;
- .title {
- font-size: 28rpx;
- color: #222222;
- }
- .desc{
- font-size: 20rpx;
- color: #AAAAAA;
- }
- .limit{
- font-size: 20rpx;
- color: #AAAAAA;
- margin:10rpx 0;
- }
- }
- .radio-box{
- padding-right: 30rpx;
- .radio{
- width: 40rpx;
- height: 40rpx;
- vertical-align: bottom;
- }
-
- .unChoose{
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- box-sizing: border-box;
- border: 2rpx solid #FF4D3A;
- }
- }
- .num{
- position: absolute;
- white-space: nowrap;
- bottom: 10rpx;
- right: 10rpx;
- font-size: 18rpx;
- color: #FFFFFF;
- }
-
- .card-desc{
- font-size: 20rpx;
- color: #AAAAAA;
- padding: 20rpx 10rpx;
- background: #FFFFFF;
- border-radius: 0rpx 0rpx 16rpx 16rpx;
- .time{
-
- }
- .desc{
- margin-top: 22rpx;
- }
- }
- }
-
- .btn-box{
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- box-sizing: border-box;
- background: #fff;
- padding: 20rpx 0 40rpx;
- .save-btn{
- margin: 0 auto;
- width: 690rpx;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 40rpx;
- background: $uni-color-primary;
- color: #fff;
- }
- }
- }
- </style>
|