oil-station/gasStation-uni/pagesHome/PointsMall/PointsMall.vue

474 lines
9.7 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" color="#ffffff" size="16"></uni-icons>
</view>
<view class="my-text">积分商城</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="top-lanmu">
2023-12-11 09:43:13 +08:00
<view class="hby">
<view class="">
<view class="title-bai">{{myPoints}} <text style="font-size: 16px;">积分</text> </view>
<view class="size-bai">
<uni-icons type="location" color="#ffffff" size="16"></uni-icons>
<text>{{storeName}}</text>
<!-- <uni-icons type="right" color="#ffffff" size="16"></uni-icons> -->
</view>
</view>
<view class="tp">
<image src="../../static/imgs/hby.png" mode=""></image>
2023-11-27 09:24:16 +08:00
</view>
2023-12-11 09:43:13 +08:00
2023-11-27 09:24:16 +08:00
</view>
<view class="box-bai">
<view class="box-box" @click="gojg(1)">
<view class="img-jg">
<uni-icons type="calendar-filled" color="#ffffff" size="40"></uni-icons>
</view>
<view class="">积分签到</view>
</view>
<view class="box-box" @click="gojg(2)">
<view class="img-jg" style="background: #fa801c;">
<u-icon name="coupon-fill" color="#ffffff" size="40"></u-icon>
</view>
<view class="">积分明细</view>
</view>
<view class="box-box" @click="gojg(3)">
<view class="img-jg" style="background: #1fcabc;">
<u-icon name="info-circle-fill" color="#ffffff" size="40"></u-icon>
</view>
<view class="">积分规则</view>
</view>
<view class="box-box" @click="gojg(4)">
<view class="img-jg" style="background: #f76b17;">
<u-icon name="file-text-fill" color="#ffffff" size="40"></u-icon>
</view>
<view class="">我的订单</view>
</view>
</view>
2023-12-11 09:43:13 +08:00
<view class="bai-center">
<scroll-view scroll-x="true" class="tap-top">
<view class="sz" @click="transferIndex(-1)">
<view class="box" :class="{'xztap': qhindex === -1}">全部</view>
<view class="gang" v-if="qhindex === -1"></view>
2023-11-27 09:24:16 +08:00
</view>
2023-12-11 09:43:13 +08:00
<view class="sz" v-for="(item, index) in categoryList" :key="index"
@click="transferIndex(index,item.id)">
<view class="box" :class="{'xztap': qhindex === index}">{{item.categoryName}}</view>
<view class="gang" v-if="qhindex === index"></view>
2023-11-27 09:24:16 +08:00
</view>
2023-12-11 09:43:13 +08:00
</scroll-view>
<view class="wrap-box">
<view class="box-goods" v-for="(item,index) in integralGiftList" :key="index"
@click="godetails(item)">
<view class="goods-img">
<image :src="baseUrl+item.coverImage" mode=""></image>
</view>
<view class="goods-title">
{{item.giftName}}
</view>
<view class="good-red">
<view style="display: flex;align-items: center;">
<view class="bi" v-if="item.exchangeMethod != '金额'">
<image src="../../static/imgs/jb.png" mode=""></image>
</view>
<view style="color: #FC1708;font-weight: bold;">
<span
v-if="item.exchangeMethod == '积分' || item.exchangeMethod == '积分+金额' || item.exchangeMethod == '积分+加钱购'">{{item.exchangePoints}}</span>
<span v-if="item.exchangeMethod == '积分+金额'">+</span>
<span
v-if="item.exchangeMethod == '金额' || item.exchangeMethod == '积分+金额'">{{item.exchangeAmount}}</span>
</view>
2023-11-27 09:24:16 +08:00
</view>
2023-12-11 09:43:13 +08:00
<view class="hui-time">
库存:{{item.remainingInventory === -1?"不限":item.remainingInventory}}
2023-11-30 18:11:49 +08:00
</view>
</view>
2023-12-11 09:43:13 +08:00
<view class="anniux">
<text>立即兑换</text>
2023-11-27 09:24:16 +08:00
</view>
</view>
</view>
2023-12-11 09:43:13 +08:00
2023-11-27 09:24:16 +08:00
</view>
</view>
</view>
</view>
</template>
<script>
2023-11-28 18:10:16 +08:00
import config from '@/config'
2023-11-30 09:06:08 +08:00
import request from '../../utils/request'
2023-11-30 18:11:49 +08:00
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
2023-12-01 15:29:00 +08:00
myPoints: 0,
2023-12-07 10:22:52 +08:00
storeName: '',
2023-11-30 18:11:49 +08:00
categoryList: {},
integralGiftList: {},
2023-11-27 09:24:16 +08:00
title: '',
2023-11-30 18:11:49 +08:00
qhindex: -1,
2023-11-30 09:06:08 +08:00
baseUrl: config.baseUrl,
2023-12-05 13:33:30 +08:00
storeId: uni.getStorageSync('storeId'),
2023-11-27 15:53:33 +08:00
query: {
2023-12-05 13:33:30 +08:00
storeId: uni.getStorageSync('storeId'),
2023-11-27 15:53:33 +08:00
categoryId: '',
giftName: '',
2023-11-30 18:11:49 +08:00
deliveryMethod: '',
2023-11-27 15:53:33 +08:00
page: 1,
pageSize: 10000
}
2023-11-27 09:24:16 +08:00
}
},
components: {
2023-11-27 15:53:33 +08:00
},
onLoad() {
2023-11-29 14:03:47 +08:00
this.getCategoryList();
this.getIntegralGiftList();
2023-11-27 09:24:16 +08:00
},
2023-12-01 15:29:00 +08:00
onShow() {
this.getUserInfoList()
2023-12-07 10:22:52 +08:00
// 获取店铺信息
this.getInfoByStoreId()
2023-12-01 15:29:00 +08:00
},
2023-11-27 09:24:16 +08:00
methods: {
2023-11-30 18:11:49 +08:00
transferIndex(index, categoryId) {
2023-11-27 09:24:16 +08:00
this.qhindex = index
2023-11-30 18:11:49 +08:00
if (categoryId == undefined || categoryId == null) {
this.query.categoryId = ''
} else {
this.query.categoryId = categoryId
}
this.getIntegralGiftList()
2023-11-27 09:24:16 +08:00
},
2023-11-27 15:53:33 +08:00
// 获取积分商城分类
getCategoryList() {
request({
2023-12-05 13:33:30 +08:00
url: 'business/integral/integralGiftCategory/queryListByStoreId',
2023-11-27 15:53:33 +08:00
method: 'get',
2023-12-05 13:33:30 +08:00
params: {
storeId: this.storeId
}
2023-11-30 18:11:49 +08:00
}).then((res) => {
if (res.code == 200) {
2023-12-05 13:33:30 +08:00
this.categoryList = res.data
2023-11-27 15:53:33 +08:00
}
})
},
// 获取积分商城列表
getIntegralGiftList() {
request({
2023-12-05 13:33:30 +08:00
url: 'business/integral/integralGift/queryByPageByStoreId',
2023-11-27 15:53:33 +08:00
method: 'get',
2023-11-30 18:11:49 +08:00
params: this.query
}).then((res) => {
if (res.code == 200) {
2023-11-30 09:06:08 +08:00
this.integralGiftList = res.data.records
2023-11-27 15:53:33 +08:00
}
})
},
2023-12-01 15:29:00 +08:00
2023-11-27 09:24:16 +08:00
gojg(nmb) {
if (nmb == 1) {
uni.navigateTo({
url: '/pagesMy/integral/integral'
})
}
if (nmb == 2) {
uni.navigateTo({
url: '/pagesHome/PointsMing/PointsMing'
})
}
if (nmb == 3) {
uni.navigateTo({
url: '/pagesHome/Pointsdetail/Pointsdetail'
})
}
if (nmb == 4) {
uni.navigateTo({
url: '/pagesHome/myPointsOrder/myPointsOrder'
})
}
},
2023-11-30 18:11:49 +08:00
godetails(data) {
uni.$on('un', function() {
uni.$emit('goodsInfo', data)
})
2023-11-27 09:24:16 +08:00
uni.navigateTo({
2023-11-30 18:11:49 +08:00
url: '/pagesHome/goodsDetails/goodsDetails',
2023-11-27 09:24:16 +08:00
})
},
goback() {
uni.navigateBack()
2023-12-01 15:29:00 +08:00
},
// 查询我的积分
getUserInfoList() {
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',
2023-12-05 15:16:15 +08:00
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
2023-12-01 15:29:00 +08:00
}).then((res) => {
if (res.code == 200) {
this.myPoints = res.data.points
}
})
},
2023-12-07 10:22:52 +08:00
// 根据storeId查询店铺信息
getInfoByStoreId() {
request({
url: '/business/storeInformation/store/storeInfoUni',
method: 'get',
params: {
storeId: uni.getStorageSync('storeId')
}
}).then((res) => {
if (res.code == 200) {
this.storeName = res.data.name
}
})
}
2023-11-30 18:11:49 +08:00
},
onUnload() {
uni.$off('goodsInfo')
},
2023-11-27 09:24:16 +08:00
}
</script>
<style scoped lang="scss">
2023-12-11 09:43:13 +08:00
.content {}
2023-11-27 09:24:16 +08:00
.container {
width: 100%;
box-sizing: border-box;
padding-top: 88px;
2023-12-11 09:43:13 +08:00
background: linear-gradient(180deg, #ff5c28 0%, #ff5c28 20%, #ffd8d8 37%, #ffd8d8 100%);
2023-11-27 09:24:16 +08:00
padding-bottom: 40px;
}
.my-header {
width: 100%;
height: 88px;
2023-12-11 09:43:13 +08:00
background: #ff5c28;
2023-11-27 09:24:16 +08:00
display: flex;
align-items: center;
justify-content: space-between;
color: #fff;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 9999;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
.top-lanmu {
width: 100%;
2023-12-11 09:43:13 +08:00
// background: linear-gradient(180deg, #ff5c28 0%, #ff5c28 57%, #ffd8d8 100%);
2023-11-27 09:24:16 +08:00
box-sizing: border-box;
padding-top: 1px;
}
.box-bai {
width: 90%;
margin: 10px auto;
background-color: #ffffff;
border-radius: 8px;
box-sizing: border-box;
padding: 10px;
display: flex;
align-items: center;
justify-content: space-around;
font-size: 14px;
2023-12-11 09:43:13 +08:00
margin-top: 0px;
2023-11-27 09:24:16 +08:00
}
.size-bai {
color: #ffffff;
font-size: 14px;
}
.title-bai {
font-size: 28px;
font-weight: bold;
color: #ffffff;
}
.box-box {
width: 25%;
text-align: center;
}
.img-jg {
width: 50px;
height: 50px;
background-color: #1678ff;
border-radius: 12px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 5px;
}
.bai-center {
width: 90%;
border-radius: 8px;
background-color: #ffffff;
margin: 0 auto;
box-sizing: border-box;
padding: 10px;
2023-12-11 09:43:13 +08:00
margin-top: 15px;
2023-11-27 09:24:16 +08:00
}
.tap-top {
margin-top: 20rpx;
width: 100%;
// padding-bottom: 22rpx;
box-sizing: border-box;
// border-bottom: 1px solid #EEEEEE;
white-space: nowrap;
.sz {
display: inline-block;
}
.box {
// margin: 0 auto;
text-align: center;
font-size: 32rpx;
margin-right: 50rpx;
line-height: 32rpx;
text-align: center;
// font-weight: bold;
color: #666666;
margin-bottom: 22rpx;
}
}
.xztap {
color: #333333 !important;
font-weight: bold !important;
}
.gang {
2023-12-11 09:43:13 +08:00
width: 38rpx;
2023-11-27 09:24:16 +08:00
height: 8rpx;
2023-12-11 09:43:13 +08:00
background: #ff5c28;
2023-11-27 09:24:16 +08:00
border-radius: 14rpx;
2023-12-11 09:43:13 +08:00
2023-11-27 09:24:16 +08:00
}
.wrap-box {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin: 10px auto;
}
.box-goods {
width: 49%;
margin-bottom: 15px;
}
.goods-img {
width: 100%;
height: 150px;
image {
width: 100%;
height: 100%;
}
}
.anniux {
background-color: #ecf5ff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
box-sizing: border-box;
padding: 10px;
width: 100%;
margin: 10px auto;
color: #1678ff;
font-weight: bold;
}
.goods-title {
font-size: 16px;
font-weight: bold;
color: #000000;
margin: 5px 0px;
}
.good-red {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.hui-time {
font-size: 14px;
color: #8895AB;
}
.bi {
width: 18px;
height: 18px;
margin-right: 2px;
image {
width: 100%;
height: 100%;
}
}
2023-12-11 09:43:13 +08:00
.hby {
width: 90%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.tp {
width: 200px;
height: 120px;
image {
width: 100%;
height: 100%;
}
}
2023-11-27 09:24:16 +08:00
</style>