| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <view class="special-item-page">
- <scroll-view class="list-wrap" scroll-y>
- <view class="item" v-for="item in activityList" :key="item.storeSpecialActivityId" @click="handItem(item)">
- <view class="cover">
- <image class="icon" src="../../static/imgs/mine/tjc.png"/>
- </view>
- <view class="cont">
- <view class="row">
- <view class="name">{{item.activityName}}</view>
- <view class="date">{{item.startDate|formatDate('MM.dd')}} ~ {{item.endDate|formatDate('MM.dd')}}</view>
- </view>
- <view class="row">
- <view class="desc">
- {{item.activityComment}}
- </view>
- <view v-if="item.status==1" class="status">进行中</view>
- <view v-else class="status-unused">停止</view>
- </view>
- </view>
- </view>
- </scroll-view>
- <view class="add-special-item">
- <view class="add" @click="addSpecialItem">添加特价菜活动</view>
- </view>
- </view>
- </template>
- <script>
- import {mapState} from 'vuex';
- export default {
- data () {
- return {
- getStoreSpecialActivityListUrl: '/storeSpecialActivityApi/getStoreSpecialActivityListForStore',
- activityList: []
- }
- },
- computed: {
- ...mapState(['storeInfo'])
- },
- methods: {
- handItem(item) {
- uni.navigateTo({
- url: '/pages/activity/special-item-info?id=' + item.storeSpecialActivityId
- });
- },
- addSpecialItem () {
- if (this.activityList.length >= 5) {
- this.$api.msg("最多只能创建五个活动,请先删除不需要的活动");
- return;
- } else {
- uni.navigateTo({
- url: '/pages/activity/special-item-edit'
- });
- }
- },
- getStoreSpecialActivityList() {
- uni.showLoading({
- title: '加载中'
- });
- var dateStr = (new Date()).getTime();
- var sign = this.getSign('' + this.storeInfo.storeId + dateStr);
- this.requst({
- url: this.getStoreSpecialActivityListUrl,
- data: {
- timestamp: dateStr,
- sign: sign,
- storeId: this.storeInfo.storeId
- },
- success: res => {
- this.activityList = res.data.list;
- uni.hideLoading();
- },
- fail: (e) => {
- console.log("接口调用失败:" + JSON.stringify(e));
- uni.hideLoading();
- },
- })
- }
- },
- onShow () {
- this.getStoreSpecialActivityList();
- }
- }
- </script>
- <style lang="scss" scoped>
- .special-item-page {
- width: 100vw;
- height: 100vh;
- background-color: #f5f5f5;
- overflow: hidden;
- }
- .list-wrap {
- height: calc(100vh - 140rpx - env(safe-area-inset-bottom));
- height: calc(100vh - 140rpx - constant(safe-area-inset-bottom));
- margin-top: 20rpx;
- .item {
- margin-bottom: 20rpx;
- background-color: #fff;
- padding: 40rpx;
- box-sizing: border-box;
- @include flexStart;
- }
- .cover {
- min-width: 60rpx;
- width: 60rpx;
- height: 60rpx;
- margin-right: 40rpx;
- border-radius: 50%;
- overflow: hidden;
- @include flexCenter;
- box-shadow: 0 0 10rpx pink;
- }
- .icon {
- width: 42rpx;
- height: 42rpx;
- }
- .cont {
- width: calc(100% - 100rpx);
- font-size: $font-base;
- }
- .row {
- width: 100%;
- @include between;
- margin-bottom: 10rpx;
- }
- .name {
- color: $text-color;
- width: calc(100% - 240rpx);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- word-break: break-all;
- }
- .date {
- width: 240rpx;
- text-align: right;
- }
- .desc {
- color: $desc-color;
- }
- .status {
- width: 240rpx;
- text-align: right;
- color: $uni-color-button;
- }
- .status-unused {
- width: 240rpx;
- text-align: right;
- color: $theme-color;
- }
- }
- .add-special-item {
- width: 100vw;
- @include flexCenter;
- margin-top: 40rpx;
- .add {
- width: 80vw;
- height: 80rpx;
- border-radius: 40rpx;
- background-color: $theme-color;
- color: #fff;
- @include flexCenter;
- }
- }
- </style>
|