添加抢购功能

This commit is contained in:
wangxiaowei 2024-09-28 22:51:17 +08:00
parent 5450434074
commit 4e9aeb5425
7 changed files with 60 additions and 20 deletions

@ -132,6 +132,6 @@ export function getLocalStoreRecord(params) {
return request.get("LocalStore/record", {params})
}
export function getPanic(params) {
return request.post("GroupBuyGoods/getGroupBuyGoods", params)
export function getPanic(data) {
return request.get("GroupBuyGoods/getGroupBuyGoods", {data})
}

@ -1,18 +1,22 @@
<template>
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption">
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" :down="upDown">
<u-navbar id="navbar" :border-bottom="false" :background="{ background: 'rgba(256,256,256, 0)'}"
:back-bg="'rgba(0, 0, 0, 0.2)'" back-icon-color="rgba(256, 256, 256, 1)" :immersive="true">
</u-navbar>
<view class="content">
<view class="head"></view>
<view class="rule bold xl text-center m-b-20" @click="showModel = true">
活动规则
</view>
<!-- <view class="time">
距离活动结束仅剩
<u-count-down separator="zh" :timestamp="getCancelTime(cancelTime)"
:separator-size="26" :font-size="26"
bg-color="transparent" @end="refresh"></u-count-down>
</view> -->
<view class="list">
<view class="item flex" v-for="(item, index) in list" :key="index" @click="toPage(item.goods_id)">
<view class="item flex" v-for="(item, index) in list" :key="index" @click="toPage(item.goods_id, item.activity_sn)">
<u-image class="img" :src="item.goods_image" width="240rpx" height="240rpx" border-radius="10rpx"></u-image>
<view class="info m-l-20">
<view class="line-2 xl bold goods-name">{{item.goods_name}}</view>
@ -27,6 +31,14 @@
</view>
</view>
</view>
<u-modal v-model="showModel" :mask-close-able="true">
<view class="bold p-l-20">商品活动规则</view>
<view class="p-20">
<u-parse :html="rule"></u-parse>
</view>
</u-modal>
</view>
</mescroll-body>
</template>
@ -42,11 +54,17 @@
empty: {
icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/order_null.png',
tip: '暂无记录', // 提示
}
},
textColor: '#ccc'
},
upDown: {
bgColor: '#fff'
},
storeState: 1,
list: [],
cancelTime: 1727169974
cancelTime: 1727169974,
showModel: false,
rule: ''
}
},
methods: {
@ -73,16 +91,18 @@
let hasNext = !!res.data.more;
if (page.num == 1) this.list = [];
this.list = this.list.concat(curPageData);
this.rule = res.data.rule;
this.mescroll.endSuccess(curPageLen, hasNext);
}
})
},
toPage(goods_id){
toPage(goods_id, activity_sn){
this.$Router.push({
path: '/pages/goods_details/goods_details',
query: {
id: goods_id
id: goods_id,
activity_sn
}
})
}
@ -91,8 +111,10 @@
</script>
<style lang="scss">
.content {
page {
background: #c22921;
}
.content {
padding-bottom: 20rpx;
}
@ -103,6 +125,11 @@
min-height: 800rpx;
max-height: 800rpx;
}
.rule {
color: #fff;
text-decoration: underline;
}
.time {
text-align: center;
@ -164,4 +191,12 @@
}
}
}
.upwrap-nodata {
color: #fff
}
.rule-box {
border-radius: 10rpx;
}
</style>

@ -46,14 +46,14 @@
</view>
<!-- #endif -->
<!-- 秒杀 -->
<!-- <view class="seckill m-t-20" v-if="seckillGoods.length">
<!-- <view class="seckill m-t-20" v-if="seckillGoods.length">
<home-seckill :list="seckillGoods"></home-seckill>
</view> -->
<!-- 抢购 -->
<!-- <view class="m-t-20">
<panic-buying :list="panicList"></panic-buying>
</view> -->
<view class="m-t-20">
<panic-buying v-if="panicList.lists && panicList.lists.length" :list="panicList"></panic-buying>
</view>
<view class="seckill m-t-20" v-if="mallNews != ''">
<mall-news :list="mallNews"></mall-news>

@ -17,7 +17,7 @@
<view class="m-l-20 m-t-20">
<scroll-view style="white-space: nowrap;" scroll-x="true" scroll-with-animation="true">
<view class="flex item">
<router-link v-for="(item, index) in list.lists" :key="index" class="p-r-20" :to="{path: '/pages/goods_details/goods_details', query: {id: item.goods_id}}">
<router-link v-for="(item, index) in list.lists" :key="index" class="p-r-20" :to="{path: '/pages/goods_details/goods_details', query: {id: item.goods_id, activity_sn: item.activity_sn}}">
<u-image :src="item.goods_image" width="260rpx" height="260rpx" border-radius="10rpx"></u-image>
<view class="price-block flex">
<view class="bold text-center price">

@ -100,7 +100,7 @@
bargainLaunchId: -1,
invoiceArr: [],
subsidy_type: 1,
goods_type: 0 // 当为4(抢购)的时候会改变这个值
order_type: 0 ,// 当为4(抢购)的时候会改变这个值,
};
},

@ -431,7 +431,8 @@ team_min_price
distribution: {},
invite_code: '',
see_wholesale: false,
code: ''
code: '',
activity_sn: 0
};
},
onUnload() {
@ -448,6 +449,8 @@ team_min_price
this.set = this.$store.getters.hasSetId;
const options = this.$Route.query;
if (options) {
this.activity_sn = options.activity_sn || 0
if (options.scene) {
// 生成海报 区分普通商品和集采、代发、批发
const scene = strToParams(decodeURIComponent(options.scene));
@ -691,7 +694,8 @@ team_min_price
w_price: e.detail.w_price,
set: this.set,
invite_code: this.invite_code,
price_type: e.detail.price_type
price_type: e.detail.price_type,
activity_sn: this.goodsType == 4 ? this.activity_sn : 0
}],
type: 'buy'
};
@ -796,10 +800,11 @@ team_min_price
const {
goodsDetail,
inviteCode,
team
team,
activity_sn
} = this;
let url = '/pages/goods_details/goods_details?id=' + this.id + "&invite_code=" + inviteCode + '&path=goods_details';
let url = '/pages/goods_details/goods_details?id=' + this.id + "&invite_code=" + inviteCode + '&path=goods_details&activity_sn=' + activity_sn;
if (this.p_id) {
url += '&p_id=' + this.p_id;
if (this.goodsDetail.set_price_type == 0 || this.goodsDetail.set_price_type == 3) {

@ -304,7 +304,7 @@
padding: 0;
}
.index-bg {
background-image: url('https://dlh.hainings.com/uploads/images/202305310842517659b6584.png');
background-image: url('https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uploads/images/202305310842517659b6584.png');
background-size: 100% auto;
background-repeat: no-repeat;
}