【新增】新增全局优惠展示接口,前端商品详情增加全局优惠显示入口。

This commit is contained in:
jianweie code
2023-11-10 02:16:40 +08:00
parent 685a9a39f1
commit 9f03934127
9 changed files with 576 additions and 5 deletions

View File

@@ -419,6 +419,11 @@ const install = (Vue, vm) => {
//本地选择图片转base64再上传服务器存储返回地址
let uploadFilesFByBase64 = (params, config = {}) => http.post('/Api/Common/UploadFilesFByBase64', params, { custom: { methodName: 'topUp.uploadFilesFByBase64', needToken: true } });
//获取全局促销列表
let getPromotionList = (params, config = {}) => http.post('/Api/Promotion/GetPromotionList', params, { custom: { methodName: 'promotion.getPromotionList', needToken: false } });
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
@@ -619,7 +624,8 @@ const install = (Vue, vm) => {
getTypeDetail,
uploadFilesFByBase64
uploadFilesFByBase64,
getPromotionList
};
}

View File

@@ -108,6 +108,23 @@ export const loadStatus = {
};
//优惠促销类型
export const promotionType = {
// 促销
promotion: 1,
// 优惠券
coupon: 2,
// 团购
group: 3,
// 秒杀
seckill: 4,
};
//nav页面导航类型
export const navLinkType = {
urlLink: 1, //"URL链接"

View File

@@ -81,8 +81,25 @@
</view>
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
<!--全局促销-->
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row" @tap="promotionListTap" v-if="promotionList.length>0">
<view class="coreshop-basis-2">
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">优惠</text>
</view>
<view class="coreshop-basis-7 coreshop-flex coreshop-align-center">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-align-center">
<u-icon name="info-circle" size="12" labelSize="12" color="#e54d42" :label="item.name" v-for="(item, index) in promotionList" :key="index" style="margin-right: 10px; margin-bottom: 10px;"></u-icon>
</view>
</view>
<view class="coreshop-basis-1">
<view class="coreshop-float-right">
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="promotionList.length>0" />
<!--服务-->
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row" @tap="serviceTap" v-if="serviceDescription.service.length>0">
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-padding-top-10" @tap="serviceTap" v-if="serviceDescription.service.length>0">
<view class="coreshop-basis-2">
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">服务</text>
</view>
@@ -408,14 +425,14 @@
</view>
<!--弹出框-->
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" safeAreaInsetTop>
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" :safeAreaInsetTop="true">
<view class="radius coreshop-bg-white">
<!--标题-->
<view class="coreshop-text-black coreshop-text-center coreshop-margin-top-15 coreshop-margin-bottom-15 coreshop-font-lg coreshop-title-bar">
<text>{{modalTitle}}</text>
</view>
<!--内容区域-->
<view class="coreshop-modal-content">
<view class="coreshop-modal-content" style="max-height: calc(100vh - 327.5px); overflow-y: auto; ">
<!--服务区域-->
<view class="coreshop-common-view-box service" v-if="modalType=='service'">
<view v-for="(item, index) in serviceDescription.service" :key="index">
@@ -435,6 +452,54 @@
<text class="coreshop-margin-left-10 u-line-5 coreshop-text-black">{{item.name}}</text>
</view>
</view>
<!--全平台促销区域-->
<view class="coreshop-common-view-box promotion" v-if="modalType=='promotionList'">
<view class="coreshop-solid coreshop-padding-10 coreshop-margin-bottom-10" v-for="(item, index) in promotionList" :key="index">
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-bottom-10">
<u--text :text="'活动'+(index+1)+''+item.name" size="17" bold="true" :lines="2"></u--text>
</view>
<u-line margin="10rpx 0"></u-line>
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-top-8" v-if="item.conditions">
<view class="coreshop-text-grey coreshop-font-14 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
<view class="coreshop-margin-right-5">
<u-icon name="setting" size="18"></u-icon>
</view>
<view class="coreshop-text-grey coreshop-font-13 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
满足条件<view class="coreshop-text-red">要求同时满足下面所有条件</view>
</view>
</view>
</view>
<u-line margin="10rpx 0"></u-line>
<view class="coreshop-flex coreshop-flex-direction coreshop-justify-start">
<text class="coreshop-font-sm coreshop-margin-bottom-5 coreshop-margin-top-5" style="line-height: 20px;" v-for="(itemC, indexC) in item.conditions" :key="indexC">
条件{{indexC+1}} {{itemC}}
</text>
</view>
<u-line margin="10rpx 0"></u-line>
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-top-8" v-if="item.results">
<view class="coreshop-text-grey coreshop-font-14 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
<view class="coreshop-margin-right-5">
<u-icon name="bell" size="18"></u-icon>
</view>
<view class="coreshop-text-grey coreshop-font-13 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
活动结果<view class="coreshop-text-red">{{item.results[0]}}</view>
</view>
</view>
</view>
<u-line margin="10rpx 0"></u-line>
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-bottom-10">
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
<view class="coreshop-margin-right-5">
<u-icon name="calendar" size="18"></u-icon>
</view>
<view class="coreshop-text-grey coreshop-font-13">
活动时间{{$u.timeFormat(item.startTime, 'yyyy-mm-dd hh:MM')}} {{$u.timeFormat(item.endTime, 'yyyy-mm-dd hh:MM')}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
@@ -495,7 +560,8 @@
autoplay: true,
userAgent: {},
userAgentGrade: {},
agentProducts: []
agentProducts: [],
promotionList: [],
}
},
onLoad(options) {
@@ -538,6 +604,7 @@
}
})
};
this.getPromotionList();
},
onShow() {
},
@@ -980,6 +1047,11 @@
this.modalType = 'promotion';
this.showModal();
},
promotionListTap() {
this.modalTitle = "全平台促销优惠";
this.modalType = 'promotionList';
this.showModal();
},
showModal() {
this.bottomModal = true;
},
@@ -988,6 +1060,17 @@
this.modalTitle = "";
this.modalType = '';
},
getPromotionList() {
let data = {
id: this.$globalConstVars.promotionType.promotion,
};
this.$u.api.getPromotionList(data).then(res => {
if (res.status) {
this.promotionList = res.data;
}
console.log(data);
});
},
},
watch: {
goodsInfo: {