IndexVoucherItem.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="div main-content">
  3. <view class="div list-wrap-item hongbao-list-wrap-item" @click="exchangeVoucher(item)">
  4. <view class="div img-box">
  5. <view class="div img-content">
  6. <image mode="aspectFit" class="img" :src="hongbaobg" />
  7. <!---->
  8. </view>
  9. </view>
  10. <view class="div content">
  11. <view class="div coupon hongbao">
  12. <view class="div coupon_left">
  13. <view class="div price ">
  14. <text class="span text-content">
  15. <text class="span">¥</text>
  16. </text>{{item.vouchertemplate_price}}
  17. </view>
  18. <view class="div coupon_condition font-size-activity-tag">
  19. <text class="span text-content">
  20. <text class="span">{{item.vouchertemplate_storename}}</text>
  21. </text>
  22. </view>
  23. </view>
  24. <view class="div coupon_right flex">
  25. <view class="div coupon_btn">
  26. 兑换
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  33. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  34. </uni-popup>
  35. </view>
  36. </template>
  37. <script>
  38. import { mapState } from 'vuex'
  39. import { exchangePointVoucher } from '../../../api/homePointsgoods'
  40. import { env } from '../../../static/config'
  41. export default {
  42. name: 'index',
  43. data(){
  44. return {
  45. dialog:{},
  46. hongbaobg: env.SITE_URL+'/uploads/home/h5/home/hongbao_bg.png'
  47. }
  48. },
  49. computed: {
  50. ...mapState({
  51. isOnline: state => state.member.isOnline,
  52. token: state => state.member.token
  53. })
  54. },
  55. props: ['item'],
  56. components: {
  57. },
  58. methods:{
  59. closeDialog(){
  60. },
  61. confirmDialog(value){
  62. exchangePointVoucher({ vid: this.dialog.data.vouchertemplate_id, key: this.token }).then(res => {
  63. uni.showToast({icon:'none',title: res.message})
  64. }).catch(error => {
  65. uni.showToast({icon:'none',title: error.message})
  66. })
  67. },
  68. exchangeVoucher (item) {
  69. this.dialog={content:'您确定需要使用' + item.vouchertemplate_points + '积分兑换代金券吗?',data:item}
  70. this.$refs.confirm.open()
  71. }
  72. }
  73. }
  74. </script>
  75. <style scoped lang="scss">
  76. .font-size-activity-tag {font-size:$h6!important;}
  77. .color-tip { color: #909399!important; }
  78. .color-base-text {color: #ff4544!important;}
  79. .img-content >img{width: 100%;height: 100%;}
  80. .list-wrap-item {display: inline-block;width: 165px;overflow: hidden;position: relative}
  81. .list-wrap-item.hongbao-list-wrap-item {height: 70px}
  82. .list-wrap-item .img-box {width: 100%;height: 100%;position: absolute;top: 0;left: 0}
  83. .list-wrap-item .img-box .img-content {width: 100%;height: 100%}
  84. .list-wrap-item .content {position: relative;z-index: 9}
  85. .list-wrap-item .content .coupon {background-size: 100% 100%;background-repeat: no-repeat;border-radius: 5px;display: flex;padding: 10px 0}
  86. .list-wrap-item .content .coupon .coupon_right {position: relative;width: 70px;min-width: 70px}
  87. .list-wrap-item .content .coupon .coupon_right.flex {display: flex;align-items: center}
  88. .list-wrap-item .content .coupon .coupon_right .coupon_btn {margin: 0px auto 0;width: 40px;height: 20px;line-height: 20px;font-size:$fontSize;text-align: center;border-radius: 20px;border-width: 1px;border-style: solid}
  89. .list-wrap-item .content .coupon .coupon_right .coupon_num {margin-top: 5px;text-align: center;-webkit-box-pack: center;-webkit-justify-content: center;justify-content: center}
  90. .list-wrap-item .content .coupon .coupon_right::after {position: absolute;top: 0;margin-left: 0;content: "";width: 0;height: 100%;border-left: 1px dashed;opacity: .2}
  91. .list-wrap-item .content .coupon .coupon_left {-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;text-align: left;padding: 0 0 0 10px}
  92. .list-wrap-item .content .coupon .coupon_left .price {font-size:1.2rem;font-weight: 500;margin-top: 0!important;padding: 0;font-weight: 600}
  93. .list-wrap-item .content .coupon .coupon_left .price .text-content {font-size:$fontSize}
  94. .list-wrap-item .content .coupon .coupon_left .coupon_condition {width: 85px;margin-top: 10px;line-height: 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}
  95. .list-wrap-item .content .hongbao .coupon_left .price, .list-wrap-item .content .hongbao .coupon_left .coupon_condition {color: #fff}
  96. .list-wrap-item .content .hongbao .coupon_right .coupon_num {color: #fff}
  97. .list-wrap-item .content .hongbao .coupon_right .coupon_btn {color: #fff;border-color: #fff}
  98. .list-wrap-item .content .hongbao .coupon_right::after {position: absolute;top: 0;margin-left: 0;content: "";width: 0;height: 100%;border-left: 0;opacity: .2}
  99. .list-wrap-item .content .coupon-price-wrap {width: 100%;height: 52px;display: flex;-webkit-box-pack: justify;-webkit-justify-content: space-between;justify-content: space-between}
  100. .list-wrap-item .content .coupon-price-wrap .coupon-price {font-size:1.2rem;margin-top: 5px;margin-left: 10px}
  101. .list-wrap-item .content .coupon-price-wrap .coupon-price .text-content {font-size:$fontSize}
  102. .list-wrap-item .content .coupon-point .coupon-point-num {width: 80px;height: 22px;position: relative}
  103. .list-wrap-item .content .coupon-point .coupon-point-num .img-content {width: 100%;height: 100%;position: absolute}
  104. .list-wrap-item .content .coupon-point .coupon-point-num .text-content {position: relative;z-index: 9;color: #fff;font-size:$fontSize;display: inline-block;width: 100%;line-height: 22px;text-align: center;vertical-align: top}
  105. .list-wrap-item .content .coupon-point .coupon-conditions {font-size:$h6;color: #909399;line-height: 1;margin-top: 12px}
  106. .list-wrap-item .content .coupon-name {font-size:$fontSize;color: #303133;margin-top: 11px;line-height: 1;padding: 0 11px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}
  107. .list-wrap-item .content.hongbao-content {background-color: #fff;border-radius: 10px;padding-bottom: 15px}
  108. .list-wrap-item .content .hongbao-img {height: 165px}
  109. .list-wrap-item .content .hongbao-img .img-content {width: 100%;height: 100%}
  110. .list-wrap-item .content .price {font-size:$subFontSize;color: #303133;line-height: 1;padding-left: 13px;margin-top: 10px}
  111. .list-wrap-item .content .point {font-size:$h2;padding-left: 13px;margin-top: 8px;line-height: 1}
  112. .list-wrap-item .content .point .text-content {font-size:$fontSize}
  113. .list-wrap-item .content .stock {font-size:$h6;color: #909399;line-height: 1;padding-left: 13px;margin-top: 10px}
  114. </style>