123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <template>
- <view class="exchangeDetailBox">
- <global-loading />
- <view class="topBg">
- <view class="exchangeCoupon flex-items">
- <view class="couponInfo">
- <view class="font-color-FFF fs60">
- {{ currentCoupon.couponType === 1
- ? `满${currentCoupon.fullMoney}减${currentCoupon.reduceMoney}元` : `打${currentCoupon.reduceMoney}折` }}
- </view>
- <view class="font-color-FFF mar-top-30 fs48">{{ currentCoupon.couponType === 1 ? '满减券' : '折扣券' }}</view>
- </view>
- </view>
- </view>
- <view class="cent mar-top-30">
- <view class="bg integralInfo flex-display flex-sp-between">
- <view class="integralLeft flex-display">
- <view>
- <view class="fs48 font-color-C83732 flex-items">
- <view class="mar-right-20">{{ currentCoupon.credit || 0 }}积分</view>
- <view class="remaining fs24 font-color-C83732">
- 还剩{{ currentCoupon.stockNumber || 0 }}件
- </view>
- </view>
- <view v-if="currentCoupon.fullMoney !== 0" class="fs32 font-color-333">
- 满{{ currentCoupon.fullMoney }}{{
- currentCoupon.couponType === 1 ? '减' : '打' }}{{ currentCoupon.reduceMoney }}{{ currentCoupon.couponType ===
- 1 ? '元' : '折' }}券
- </view>
- <view v-if="currentCoupon.fullMoney === 0" class="fs32 font-color-333">
- 无门槛{{ currentCoupon.couponType === 1
- ? '减' : '打' }}{{ currentCoupon.reduceMoney }}{{ currentCoupon.couponType === 1 ? '元' : '折' }}券
- </view>
- </view>
- </view>
- <view class="integralRight flex-column-plus flex-end">
- <view class="remaining fs28 font-color-999">已兑{{ currentCoupon.takeCount || 0 }}</view>
- </view>
- </view>
- </view>
- <view class="cent mar-top-30">
- <view class="bg exchangeCondition">
- <view class="conditionTit fs32 font-color-333 font-weight-bold">兑换条件</view>
- <view class="flex-items flex-sp-between mar-top-30">
- <text class="fs28 font-color-333">有效期</text>
- <text class="fs28 font-color-999">
- {{ currentCoupon.startTime.replace(/-/g, '.') }}-{{
- currentCoupon.endTime.replace(/-/g, '.') }}
- </text>
- </view>
- <view class="flex-items flex-sp-between mar-top-30">
- <text class="fs28 font-color-333">兑换须知</text>
- <text class="fs28 font-color-999">虚拟权益兑换后不可退换</text>
- </view>
- </view>
- </view>
- <view class="cent mar-top-30">
- <view class="bg proCondition">
- <view class="conditionTit fs32 font-color-333 font-weight-bold">可用商品</view>
- <view class="productItemBox mar-top-30">
- <view
- v-for="item in productList" :key="item.productId" class="productItem"
- @click="goodsDateils(item.shopId, item.productId, item.skuId)"
- >
- <view class="productImg">
- <image :src="item.image"></image>
- </view>
- <view class="productTit mar-top-10 fs28 font-color-333">{{ item.productName }}</view>
- <view class="productPrice font-color-C83732 fs40">¥{{ item.price }}</view>
- </view>
- </view>
- </view>
- </view>
- <WxSendCoupon :coupon-list="[ currentCoupon ]" :is-exchange="true" @success="success">
- <view class="exchangeBtnBg flex-items">
- <view class="exchangeBtn">立即兑换</view>
- </view>
- </WxSendCoupon>
- <!-- 签到弹窗 -->
- <TuiModal :show="exchangeTips" :custom="true" :fadein="true">
- <view class="Put-box1">
- <view class="text-align fs34 fs-bold">
- 是否兑换此优惠券
- </view>
- <view class="flex-display flex-sp-between">
- <view class="btn" @click="exchangeTips = false">
- 取消
- </view>
- <view class="btn submit" @click="exchangeFn">
- 确定
- </view>
- </view>
- </view>
- </TuiModal>
- </view>
- </template>
- <script>
- import tuiModal from '@/components/modal/modal'
- import NET from '../../utils/request'
- import API from '../../config/api'
- import WxSendCoupon from '../../components/wx/wxSendCoupon'
- export default {
- name: 'ExchangeDetail',
- components: {
- WxSendCoupon,
- TuiModal: tuiModal
- },
- data() {
- return {
- productList: [],
- page: 1,
- pageSize: 10,
- loadingType: 0,
- currentCoupon: {
- stockNumber: 0,
- credit: 0,
- takeCount: 0
- },
- exchangeTips: false
- }
- },
- onReachBottom() {
- if (this.loadingType == 1) {
- uni.stopPullDownRefresh()
- } else {
- this.page = this.page + 1
- this.getProductList()
- }
- },
- onLoad(options) {
- if (options.data) {
- this.currentCoupon = JSON.parse(options.data)
- this.getProductList()
- }
- },
- methods: {
- getProductList() {
- // uni.showLoading({
- // title: '加载中...',
- // })
- NET.request(API.getCouponProducts, {
- activityId: this.currentCoupon.couponId,
- page: this.page,
- pageSize: this.pageSize
- }, 'GET').then((res) => {
- // uni.hideLoading()
- if (res.data.list.length === 0) {
- this.loadingType = 1
- } else {
- this.productList = this.productList.concat(res.data.list)
- }
- })
- .catch((res) => {
- // uni.hideLoading()
- })
- },
- receiveCoupon() {
- this.exchangeTips = true
- },
- exchangeFn() {
- const paramsData = {
- couponId: this.currentCoupon.couponId,
- source: 3
- }
- NET.request(API.exchangeCoupon, paramsData, 'POST').then((res) => {
- this.exchangeTips = false
- uni.showToast({
- title: '兑换成功',
- icon: 'success'
- })
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages_category_page1/integral/index?tabActive=2'
- })
- }, 1500)
- })
- .catch((res) => {
- if (res.code !== '200') {
- uni.showToast({
- title: res.data.message,
- icon: 'none'
- })
- }
- })
- },
- // 商品详情
- goodsDateils(shopId, productId, skuId) {
- uni.navigateTo({
- url: '/pages_category_page1/goodsModule/goodsDetails?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
- })
- },
- success() {
- uni.showToast({
- title: '兑换成功',
- icon: 'success'
- })
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages_category_page1/integral/index?tabActive=2'
- })
- }, 1500)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background: #F8F8F8;
- }
- .exchangeDetailBox {
- padding-bottom: 200rpx;
- background: #F8F8F8;
- .topBg {
- background: url("../../static/images/origin/addBankBg.png") no-repeat left top;
- background-size: contain;
- height: 350rpx;
- padding: 40rpx 20rpx 0 20rpx;
- .exchangeCoupon {
- background: url("../../static/images/origin/exchagneCoupon.png") no-repeat left top;
- background-size: contain;
- height: 302rpx;
- border-radius: 16rpx;
- .couponInfo {
- color: #FDFED6;
- margin-left: 48rpx;
- font-weight: 400;
- }
- }
- }
- .cent {
- padding: 0 20rpx;
- .bg {
- background: #FFFFFF;
- padding: 30rpx;
- border-radius: 16rpx;
- }
- }
- .integralInfo {
- .integralLeft {
- .remaining {
- width: auto;
- height: 48rpx;
- line-height: 48rpx;
- padding: 0 15rpx;
- text-align: center;
- background: rgba(200, 55, 50, 0.16);
- border-radius: 24rpx 24rpx 24rpx 0;
- font-weight: 300;
- }
- }
- }
- .conditionTit {
- border-bottom: 2rpx solid #F3F4F5;
- height: 92rpx;
- line-height: 92rpx;
- }
- .productItemBox {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- width: 100%;
- .productItem {
- height: 420rpx;
- flex: 1;
- margin: 0 20rpx 40rpx 0;
- width: calc((100% - 20rpx) / 2);
- min-width: calc((100% - 20rpx) / 2);
- max-width: calc((100% - 20rpx) / 2);
- &:nth-child(2n) {
- margin-right: 0;
- }
- }
- }
- .proCondition {
- .productItem {
- .productImg {
- width: 325rpx;
- height: 325rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .productTit {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .productPrice {
- margin-top: 15rpx;
- }
- }
- }
- .exchangeBtnBg {
- width: 750rpx;
- height: 164rpx;
- background: #FFFFFF;
- box-shadow: 0 -1rpx 0rpx rgba(197, 202, 207, 0.5);
- padding: 0 20rpx;
- position: fixed;
- left: 0;
- bottom: 0;
- .exchangeBtn {
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- text-align: center;
- background: #333333;
- border-radius: 50rpx;
- color: #FFEBC4;
- }
- }
- .Put-box1 {
- .btn {
- text-align: center;
- margin-top: 40rpx;
- border: 1px solid #333333;
- height: 80upx;
- line-height: 80upx;
- width: 100%;
- color: #333333;
- }
- .submit {
- background-color: #333333;
- color: #FFEBC4;
- margin-left: 20rpx;
- }
- }
- }
- </style>
|