123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <view class="box">
- <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
- <image :src="item.img" mode="" class="itemImg"></image>
- <view class="timeBox">
- <image v-if="item.state==2" src="http://dmsphoto.66km.com.cn/thFiles/85EAAA7F-01A6-41A6-B25B-72FAD3E451AC.png" mode="" class="state"></image>
- <image v-if="item.state==1" src="http://dmsphoto.66km.com.cn/thFiles/EB46639B-85C9-4246-A3E3-EA87944DFC36.png" mode="" class="state"></image>
- <view class="time" v-if="item.startTime">{{item.startTime.slice(0,10)}}-{{item.endTime.slice(0,10)}}</view>
- </view>
- <view class="name">{{item.activityName}}</view>
- <view class="groupType" v-if="item.groupType">拼团</view>
- </view>
- <!-- 上拉 加载更多 -->
- <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
- <!-- 无数据空白页 -->
- <nodata v-if="itemData.length==0"></nodata>
- <!-- 手机号授权 -->
- <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
- <view class="authorizCont" @click.stop="">
- <view class="authorizName">{{wxOpenData.miniAppName}}</view>
- <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
- <view class="sqLine">
- <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
- <view class="sqRefuse" @click="authorizShowHide">拒绝</view>
- </view>
- </view>
- <view style="text-align: center;padding-top: 56rpx;">
- <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
- </view>
- </view>
- </view>
- </template>
- <script scoped>
- import nodata from '../../components/nodata/nodata.vue'
- export default {
- components: {
- nodata,
- },
- data() {
- return {
- userInfo: '',
- authorizShow: false,
- code: '',
- wxOpenData: '',
- page: 1,
- itemData: [],
- noMoreShow: false,
- ext:'',
- themeColor:'',
- }
- },
- onLoad() {
- this.userInfo = this.$store.state.userInfo;
- this.wxOpenData = this.$store.state.wxOpenData
-
- this.ext=this.$common.getExtStoreId();
- this.page = 1
- this.myOrderCoupon();
- this.themeColor = uni.getStorageSync("themeColor");
- if(this.themeColor){
- if(this.themeColor=='6F2BE8'){
- var backgroundImage='/static/tabimg/activty6F2BE8.png'
- }
- if(this.themeColor=='1677FF'){
- var backgroundImage='/static/tabimg/activty1677FF.png'
- }
- if(this.themeColor=='FF4F00'){
- var backgroundImage='/static/tabimg/activtyFF4F00.png'
- }
- if(this.themeColor=='D53533'){
- var backgroundImage='/static/tabimg/activity1.png'
- }
- uni.setTabBarStyle({
- // color: '#FF0000',
- selectedColor: '#'+this.themeColor,
- })
- uni.setTabBarItem({
- index: 2,
- text: '活动',
- selectedIconPath: backgroundImage
- })
- }
- },
- methods: {
- goDetail(id) {
- this.$store.commit('mutationsckshopInfo', '')
- uni.navigateTo({
- url: 'jkDetail?id=' + id
- })
- /* uni.navigateTo({
- url: '../subPack/jkDetail?id=' + id
- }) */
- },
- myOrderCoupon() {
- uni.showLoading({
- title: '加载中'
- })
- this.$http('openHome/queryActivityList', {
- // page: this.page,
- // limit: 10,
- unionId:this.ext.unionId
- }, 'GET').then(res => {
- uni.hideLoading();
- // var list = res.data.Items
- var list = res.data
- // 处理 undefined和null转为空白字符串
- // list.forEach((item, index) => {
- // for (const key in item) {
- // item[key] = this.$praseStrEmpty(item[key])
- // }
- // })
- if (this.page == 1) {
- this.itemData = list
- } else {
- this.itemData = this.itemData.concat(list)
- }
- if (list.length < 10) {
- this.noMoreShow = true
- } else {
- this.noMoreShow = false
- }
- })
- },
- },
- // 下拉刷新 上拉加载更多
- onPullDownRefresh() {
- this.page = 1
- this.myOrderCoupon()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() {
- // this.page++;
- this.myOrderCoupon()
- },
- }
- </script>
- <style scoped lang="less">
- .box {
- background: #F4F5F7;
- min-height: 100vh;
- padding-top: 20rpx;
- }
- .authorizBox {
- width: 100vw;
- height: 100vh;
- background: rgba(0, 0, 0, 0.5);
- position: fixed;
- top: 0;
- left: 0;
- }
- .authorizCont {
- margin-top: 30vh;
- width: 564rpx;
- height: 408rpx;
- background: #FFFFFF;
- border-radius: 24rpx;
- margin-left: 93rpx;
- position: relative;
- }
- .authorizCloseImg {
- width: 62rpx;
- height: 62rpx;
- }
- .sqLogoBox {
- width: 180rpx;
- height: 180rpx;
- background: #FFFFFF;
- border-radius: 90rpx;
- text-align: center;
- position: absolute;
- top: -50rpx;
- left: 192rpx;
- }
- .authorizName {
- color: #333333;
- line-height: 42rpx;
- font-size: 30rpx;
- text-align: center;
- padding-top: 58rpx;
- }
- .authorizMs {
- color: #999999;
- line-height: 36rpx;
- font-size: 26rpx;
- width: 452rpx;
- padding-top: 24rpx;
- text-align: center;
- margin-left: 56rpx;
- }
- .authorizContbutton{
- width: 210rpx;
- height: 66rpx;
- background: #D53533;
- border-radius: 44rpx;
- line-height: 66rpx;
- text-align: center;
- font-size:30rpx;
- color: #FFFFFF;
-
- margin-left:40rpx;
- }
- .sqRefuse{
- width: 210rpx;
- height: 66rpx;
- border: 1px solid #eaeaea;
- line-height: 66rpx;
- border-radius: 36rpx;
- text-align: center;
- font-size:30rpx;
- margin-right:40rpx;
- color: #999999;
- }
- .sqLine{
- margin-top: 62rpx;
- display: flex;
- justify-content: space-between;
- }
- .itemHistory {
- margin: 0rpx 24rpx 20rpx;
- background-color: #FFFFFF;
- border-radius: 10rpx;
- position: relative;
- }
- .groupType{
- width: 76rpx;color: #FFFFFF;
- height: 36rpx;line-height: 36rpx;text-align: center;
- background: linear-gradient(109deg, #FD5A04 0%, #FD0900 100%);
- border-radius: 0rpx 10rpx 0rpx 10rpx;
- position: absolute;font-weight: 500;
- top: 0;right: 0;font-size: 24rpx;
- }
- .itemImg {
- height: 280rpx;
- width: 702rpx;
- border-radius: 10rpx 10rpx 0px 0px;
- display: block;
- }
- .timeBox {
- display: flex;
- margin-top: -61rpx;
- align-items: flex-end;
- }
- .state{
- width: 102rpx;
- height: 53rpx;
- position: relative;
- }
- .time {
- padding: 5rpx 10rpx;
- color: #FFFFFF;
- font-size: 24rpx;
- background: rgba(0, 0, 0, 0.5);
- margin-left: -8rpx;
- border-radius: 0 10rpx 0 0;
- }
- .name {
- padding: 24rpx 20rpx;
- color: #333333;
- font-size: 28rpx;
- background: #FFFFFF;
- border-radius: 0 0 10rpx 10rpx;
- }
- .noMore {
- text-align: center;
- line-height: 50rpx;
- color: #999999;
- font-size: 28rpx;
- }
- </style>
|