Init project
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<view class="bargain-record" ref="container">
|
||||
<view class="item" v-for="(item, bargainrecordIndex) in bargain" :key="bargainrecordIndex">
|
||||
<view class="picTxt acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-column-around">
|
||||
<view class="line1">{{ item.title }}</view>
|
||||
<count-down
|
||||
:isDay="true"
|
||||
:tipText="'倒计时 '"
|
||||
:dayText="' 天 '"
|
||||
:hourText="' 时 '"
|
||||
:minuteText="' 分 '"
|
||||
:secondText="' 秒'"
|
||||
:datatime="item.datatime"
|
||||
></count-down>
|
||||
<view class="money font-color-red">
|
||||
已砍至
|
||||
<text class="symbol">¥</text>
|
||||
<text class="num">{{ item.residuePrice }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom acea-row row-between-wrapper">
|
||||
<view class="purple" v-if="item.status === 1">活动进行中</view>
|
||||
<view class="success" v-else-if="item.status === 3">砍价成功</view>
|
||||
<view class="end" v-else>活动已结束</view>
|
||||
<view class="acea-row row-middle row-right">
|
||||
<view
|
||||
class="bnt cancel"
|
||||
v-if="item.status === 1"
|
||||
@click="getBargainUserCancel(item.bargainId)"
|
||||
>取消活动</view>
|
||||
<view
|
||||
class="bnt bg-color-red"
|
||||
v-if="item.status === 1"
|
||||
@click="goDetail(item.bargainId)"
|
||||
>继续砍价</view>
|
||||
<view class="bnt bg-color-red" v-else @click="goList">重开一个</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<Loading :loaded="status" :loading="loadingList"></Loading>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import CountDown from "@/components/CountDown";
|
||||
import { getBargainUserList, getBargainUserCancel } from "@/api/activity";
|
||||
import Loading from "@/components/Loading";
|
||||
|
||||
export default {
|
||||
name: "BargainRecord",
|
||||
components: {
|
||||
CountDown,
|
||||
Loading
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
bargain: [],
|
||||
status: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
loadingList: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 20 //数量
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
this.getBargainUserList();
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loadingList && this.getBargainUserList();
|
||||
},
|
||||
methods: {
|
||||
goDetail: function(id) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/DargainDetails/index",
|
||||
query: { id, partake: 0 }
|
||||
});
|
||||
},
|
||||
goList: function() {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GoodsBargain/index"
|
||||
});
|
||||
},
|
||||
getBargainUserList: function() {
|
||||
var that = this;
|
||||
if (that.loadingList) return;
|
||||
if (that.status) return;
|
||||
getBargainUserList({ page: that.page, limit: that.limit })
|
||||
.then(res => {
|
||||
that.status = res.data.length < that.limit;
|
||||
that.bargain.push.apply(that.bargain, res.data);
|
||||
that.page++;
|
||||
that.loadingList = false;
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
getBargainUserCancel: function(bargainId) {
|
||||
var that = this;
|
||||
getBargainUserCancel({ bargainId: bargainId })
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000
|
||||
});
|
||||
that.status = false;
|
||||
that.loadingList = false;
|
||||
that.page = 1;
|
||||
that.bargain = [];
|
||||
that.getBargainUserList();
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,617 @@
|
||||
<template>
|
||||
<view class="bargain">
|
||||
<!-- 在header上加 on 为请求支援 -->
|
||||
<view :class="[bargainPartake != userInfo.uid ? 'header on' : 'header']">
|
||||
<view class="people">{{ lookCount }}人查看 丨 {{ shareCount }}人分享 丨 {{ userCount }}人参与</view>
|
||||
<!-- 帮助砍价、帮砍成功:-->
|
||||
<view class="pictxt acea-row row-center-wrapper" v-if="bargainPartake != userInfo.uid">
|
||||
<view class="pictrue">
|
||||
<image :src="bargainUserInfo.avatar" />
|
||||
</view>
|
||||
<view class="text">
|
||||
{{ bargainUserInfo.nickname }}
|
||||
<text>邀请您帮忙砍价</text>
|
||||
</view>
|
||||
</view>
|
||||
<count-down
|
||||
:isDay="true"
|
||||
:tipText="'倒计时 '"
|
||||
:dayText="' 天 '"
|
||||
:hourText="' 时 '"
|
||||
:minuteText="' 分 '"
|
||||
:secondText="' 秒'"
|
||||
:datatime="datatime"
|
||||
></count-down>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="pictxt acea-row row-between-wrapper" @click="openAlone">
|
||||
<view class="pictrue">
|
||||
<image :src="bargain.image" />
|
||||
<view class="bargain_view">
|
||||
查看商品
|
||||
<view class="iconfont icon-jiantou iconfonts"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text acea-row row-column-around">
|
||||
<view class="line2" v-text="bargain.title"></view>
|
||||
<view class="money font-color-red">
|
||||
已砍至: ¥
|
||||
<text class="num" v-text="price"></text>
|
||||
</view>
|
||||
<view class="acea-row row-middle">
|
||||
<view class="successNum" v-text="'原价' + bargain.price"></view>
|
||||
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-progress acea-row row-middle round margin-top">
|
||||
<view
|
||||
class="acea-row row-middle bg-red"
|
||||
:style="{ width: loading ? pricePercent + '%' : '' }"
|
||||
></view>
|
||||
</view>
|
||||
<view class="balance acea-row row-between-wrapper">
|
||||
<view v-text="'已砍' + alreadyPrice + '元'"></view>
|
||||
<view v-if="surplusPrice === 0">砍价成功</view>
|
||||
<view v-else v-text="'还剩' + surplusPrice + '元'"></view>
|
||||
</view>
|
||||
<!-- 帮助砍价、帮砍成功:-->
|
||||
<view
|
||||
class="bargainSuccess"
|
||||
v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading"
|
||||
>
|
||||
<span class="iconfont icon-xiaolian"></span>已成功帮助好友砍价
|
||||
</view>
|
||||
<!-- 砍价成功:-->
|
||||
<view
|
||||
class="bargainSuccess"
|
||||
v-if="
|
||||
surplusPrice === 0 &&
|
||||
bargainPartake === userInfo.uid &&
|
||||
userBargainStatus === 1 &&
|
||||
!helpListLoading
|
||||
"
|
||||
>
|
||||
<span class="iconfont icon-xiaolian"></span>恭喜您砍价成功,快去支付吧~
|
||||
</view>
|
||||
<view
|
||||
v-if="userBargainStatus == 0 && bargainPartake === userInfo.uid"
|
||||
class="bargainBnt"
|
||||
@click="goParticipate"
|
||||
>立即参与砍价</view>
|
||||
<view
|
||||
class="bargainBnt"
|
||||
@click="goPoster"
|
||||
v-if="
|
||||
surplusPrice > 0 &&
|
||||
bargainPartake === userInfo.uid &&
|
||||
userBargainStatus === 1 &&
|
||||
!helpListLoading
|
||||
"
|
||||
>邀请好友帮砍价</view>
|
||||
<view
|
||||
class="bargainBnt"
|
||||
@click="getBargainHelp"
|
||||
v-else-if="
|
||||
bargainPartake != userInfo.uid &&
|
||||
userBargainStatus == 1 &&
|
||||
statusUser &&
|
||||
!helpListLoading
|
||||
"
|
||||
>帮好友砍一刀</view>
|
||||
<view
|
||||
class="bargainBnt"
|
||||
@click="getBargainStart"
|
||||
v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading"
|
||||
>我也要参与</view>
|
||||
<view
|
||||
class="bargainBnt"
|
||||
@click="goPay"
|
||||
v-if="
|
||||
surplusPrice === 0 &&
|
||||
bargainPartake === userInfo.uid &&
|
||||
userBargainStatus === 1
|
||||
"
|
||||
>立即支付</view>
|
||||
<view class="bargainBnt on" @click="goList">抢更多商品</view>
|
||||
<view class="tip">
|
||||
已有
|
||||
<span class="font-color-red" v-text="helpCount"></span>
|
||||
位好友成功帮您砍价
|
||||
</view>
|
||||
<view class="lock"></view>
|
||||
</view>
|
||||
<view class="bargainGang">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
<view class="titleCon">砍价帮</view>
|
||||
<view class="pictrue on">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, bargainHelpListIndex) in bargainHelpList"
|
||||
:key="bargainHelpListIndex"
|
||||
>
|
||||
<view class="pictxt acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="item.avatar" />
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="name line1" v-text="item.nickname"></view>
|
||||
<view class="line1" v-text="item.add_time"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money font-color-red">
|
||||
<text class="iconfont icon-kanjia"></text>
|
||||
砍掉{{ item.price }}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="load font-color-red"
|
||||
v-if="!helpListStatus && !helpListLoading"
|
||||
@click="getBargainHelpList"
|
||||
>点击加载更多</view>
|
||||
<view class="lock"></view>
|
||||
</view>
|
||||
<view class="goodsDetails">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
<view class="titleCon">商品详情</view>
|
||||
<view class="pictrue on">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="conter" v-html="bargain.description"></view>
|
||||
<view class="lock"></view>
|
||||
</view>
|
||||
<view class="goodsDetails">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
<view class="titleCon">活动规则</view>
|
||||
<view class="pictrue on">
|
||||
<image :src="webUrl+'/20230304134450627525.png'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="conter" v-html="bargain.rule"></view>
|
||||
</view>
|
||||
<view class="bargainTip" :class="active === true ? 'on' : ''">
|
||||
<!-- <view class="pictrue">
|
||||
<image src="@/static/images/bargainBg.jpg" />
|
||||
<view class="iconfont icon-guanbi" @click="close"></view>
|
||||
</view>-->
|
||||
<view class="cutOff" v-if="bargainPartake === userInfo.uid">
|
||||
您已砍掉
|
||||
<text class="font-color-red" v-text="bargainHelpPrice"></text>元,听说分享次数越多砍价成功的机会越大哦!
|
||||
</view>
|
||||
<view class="cutOff on" v-else>
|
||||
<view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>,您也可以砍价低价拿哦,快去挑选心仪的商品吧~
|
||||
</view>
|
||||
<view class="tipBnt" @click="goPoster" v-if="bargainPartake === userInfo.uid">邀请好友帮砍价</view>
|
||||
<view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view>
|
||||
</view>
|
||||
<view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import CountDown from "@/components/CountDown";
|
||||
import {
|
||||
getBargainDetail,
|
||||
getBargainShare,
|
||||
getBargainStart,
|
||||
getBargainHelp,
|
||||
getBargainHelpPrice,
|
||||
getBargainHelpList,
|
||||
getBargainHelpCount,
|
||||
getBargainStartUser
|
||||
} from "@/api/activity";
|
||||
import { postCartAdd } from "@/api/store";
|
||||
import { mapGetters } from "vuex";
|
||||
import {} from "@/libs/wechat";
|
||||
import { isWeixin, parseQuery, handleQrCode } from "@/utils/index";
|
||||
|
||||
const NAME = "DargainDetails";
|
||||
|
||||
export default {
|
||||
name: "DargainDetails",
|
||||
components: {
|
||||
CountDown
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
price: 0,
|
||||
bargainId: 0, //砍价编号
|
||||
bargainPartake: 0, //参与砍价
|
||||
bargain: [], //砍价产品信息
|
||||
partake: null,
|
||||
bargainSumCount: 0, //砍价成功人数
|
||||
activeMsg: "",
|
||||
active: false,
|
||||
loading: false,
|
||||
datatime: 0,
|
||||
lookCount: 0, //查看人数
|
||||
shareCount: 0, //分享人数
|
||||
userCount: 0, //参与人数
|
||||
bargainHelpPrice: 0, //砍掉金额
|
||||
bargainHelpList: [],
|
||||
helpListStatus: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
helpListLoading: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 2, //数量
|
||||
helpCount: 0, //砍价帮总人数
|
||||
surplusPrice: 0, //剩余金额
|
||||
alreadyPrice: 0, //已砍掉价格
|
||||
pricePercent: 0, //砍价进度条
|
||||
bargainUserInfo: [], //砍价 开启砍价用户信息
|
||||
userBargainStatus: 2, //砍价状态
|
||||
statusUser: false ,// 是否帮别人砍,没砍是true,砍了false
|
||||
share:{
|
||||
title:'',
|
||||
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`,
|
||||
imageUrl:'',
|
||||
desc:'',
|
||||
content:''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["userInfo", "isLogin"]),
|
||||
// watch: {
|
||||
// $yroute: function(n) {
|
||||
// var that = this;
|
||||
// if (n.name === NAME) {
|
||||
// that.mountedStart();
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
mounted: function() {
|
||||
var that = this;
|
||||
that.mountedStart();
|
||||
setTimeout(function() {
|
||||
that.loading = true;
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
//参与砍价
|
||||
goParticipate() {
|
||||
if (this.bargainPartake === this.userInfo.uid) this.getBargainStart();
|
||||
else this.getBargainStartUser();
|
||||
this.getBargainHelpCount();
|
||||
},
|
||||
openAlone: function() {
|
||||
this.$yrouter.push({ path: "/detail/" + this.bargain.productId });
|
||||
},
|
||||
mountedStart: function() {
|
||||
var that = this;
|
||||
let url = handleQrCode();
|
||||
if (url) {
|
||||
that.bargainId = url.bargainId;
|
||||
that.partake = url.uid;
|
||||
} else {
|
||||
that.bargainId = that.$yroute.query.id;
|
||||
that.partake = parseInt(that.$yroute.query.partake);
|
||||
}
|
||||
if (
|
||||
this.partake === undefined ||
|
||||
this.partake <= 0 ||
|
||||
isNaN(this.partake)
|
||||
) {
|
||||
that.bargainPartake = that.userInfo.uid;
|
||||
// that.$yrouter.push({
|
||||
// path: "/pages/activity/DargainDetails/index",
|
||||
// query: { id: that.bargainId, partake: that.bargainPartake }
|
||||
// });
|
||||
} else {
|
||||
that.bargainPartake = parseInt(this.partake);
|
||||
}
|
||||
that.getBargainHelpCountStart();
|
||||
that.getBargainDetail();
|
||||
that.getBargainShare(0);
|
||||
// if (that.bargainPartake !== that.userInfo.uid) that.getBargainStartUser();
|
||||
if (that.bargainPartake === that.userInfo.uid) {
|
||||
// that.getBargainStart();
|
||||
} else {
|
||||
that.getBargainStartUser();
|
||||
}
|
||||
},
|
||||
goPay: function() {
|
||||
var data = {};
|
||||
var that = this;
|
||||
data.productId = that.bargain.productId;
|
||||
data.cartNum = that.bargain.num;
|
||||
data.uniqueId = "";
|
||||
data.bargainId = that.bargainId;
|
||||
data.new = 1;
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: { id: res.data.cartId }
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
goPoster: function() {
|
||||
var that = this;
|
||||
that.getBargainShare(that.bargainId);
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/Poster/index",
|
||||
query: { id: that.bargainId, type: 2 }
|
||||
});
|
||||
},
|
||||
goList: function() {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GoodsBargain/index"
|
||||
});
|
||||
},
|
||||
//砍价分享
|
||||
//bargainId 0 获取 查看人数 分享人数 参与人数
|
||||
//bargainId 砍价产品编号 添加分享次数 获取 查看人数 分享人数 参与人数
|
||||
getBargainShare: function(bargainId) {
|
||||
var that = this;
|
||||
getBargainShare({ bargainId: bargainId }).then(res => {
|
||||
that.lookCount = res.data.lookCount;
|
||||
that.shareCount = res.data.shareCount;
|
||||
that.userCount = res.data.userCount;
|
||||
});
|
||||
},
|
||||
// 获取产品详情
|
||||
getBargainDetail: function() {
|
||||
var that = this;
|
||||
getBargainDetail(that.bargainId)
|
||||
.then(res => {
|
||||
res.data.bargain = res.data.bargain.replace(
|
||||
/\<img/gi,
|
||||
'<img style="max-width:100%;height:auto;"'
|
||||
);
|
||||
that.bargain = res.data.bargain;
|
||||
that.datatime = that.bargain.stopTime / 1000;
|
||||
that.getBargainHelpCount();
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
//开启砍价
|
||||
getBargainStart: function() {
|
||||
var that = this;
|
||||
getBargainStart({ bargainId: that.bargainId })
|
||||
.then(() => {
|
||||
that.bargainPartake = that.userInfo.uid;
|
||||
that.getBargainHelp();
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
//参与砍价
|
||||
getBargainHelp: function() {
|
||||
var that = this;
|
||||
if (
|
||||
that.surplusPrice === 0 &&
|
||||
that.bargainPartake !== that.userInfo.uid
|
||||
) {
|
||||
return uni.showToast({
|
||||
title: "好友已经砍价成功",
|
||||
icon: "success",
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
var data = {
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake
|
||||
};
|
||||
getBargainHelp(data)
|
||||
.then(res => {
|
||||
that.activeMsg = res.data.status;
|
||||
if (
|
||||
res.data.status === "SUCCESSFUL" &&
|
||||
that.bargainPartake !== that.userInfo.uid
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "您已经砍过了",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
that.helpListStatus = false;
|
||||
that.page = 1;
|
||||
that.bargainHelpList = [];
|
||||
that.getBargainHelpPrice();
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
//获取砍掉的金额
|
||||
getBargainHelpPrice: function() {
|
||||
var that = this;
|
||||
getBargainHelpPrice({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake
|
||||
})
|
||||
.then(res => {
|
||||
that.bargainHelpPrice = res.data.price;
|
||||
that.getBargainHelpCount();
|
||||
that.getBargainHelpList();
|
||||
switch (that.activeMsg) {
|
||||
case "SUCCESSFUL":
|
||||
break;
|
||||
case "SUCCESS":
|
||||
that.active = true;
|
||||
break;
|
||||
}
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
//砍价帮
|
||||
getBargainHelpList: function() {
|
||||
var that = this;
|
||||
if (that.helpListLoading === true) return;
|
||||
if (that.helpListStatus === true) return;
|
||||
that.helpListLoading = true;
|
||||
getBargainHelpList({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake,
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
})
|
||||
.then(res => {
|
||||
that.helpListStatus = res.data.length < that.limit;
|
||||
that.helpListLoading = false;
|
||||
that.page++;
|
||||
that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
getBargainHelpCountStart: function() {
|
||||
var that = this;
|
||||
getBargainHelpCount({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake
|
||||
})
|
||||
.then(() => {})
|
||||
.catch(() => {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/DargainDetails/index",
|
||||
query: { id: that.bargainId, partake: that.userInfo.uid }
|
||||
});
|
||||
// that.$router.push({
|
||||
// path:
|
||||
// "/activity/dargain_detail/" +
|
||||
// that.bargainId +
|
||||
// "/" +
|
||||
// that.userInfo.uid
|
||||
// });
|
||||
});
|
||||
},
|
||||
getBargainHelpCount: function() {
|
||||
var that = this;
|
||||
getBargainHelpCount({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake
|
||||
})
|
||||
.then(res => {
|
||||
that.userBargainStatus = res.data.status;
|
||||
that.helpCount = res.data.count;
|
||||
that.surplusPrice = res.data.price;
|
||||
that.alreadyPrice = res.data.alreadyPrice;
|
||||
that.pricePercent = res.data.pricePercent;
|
||||
that.price = (that.bargain.price - that.alreadyPrice).toFixed(2);
|
||||
console.log(that);
|
||||
})
|
||||
.catch(() => {
|
||||
that.bargainPartake = that.userInfo.uid;
|
||||
// that.$yrouter.push({
|
||||
// path: "/pages/activity/DargainDetails/index",
|
||||
// query: { id: that.bargainId, partake: that.userInfo.uid }
|
||||
// });
|
||||
});
|
||||
},
|
||||
getBargainStartUser: function() {
|
||||
var that = this;
|
||||
getBargainStartUser({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainPartake
|
||||
})
|
||||
.then(res => {
|
||||
that.bargainUserInfo = res.data;
|
||||
that.getBargainHelpList();
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
// ,
|
||||
// onShareAppMessage() {
|
||||
// return {
|
||||
// path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`
|
||||
// };
|
||||
// }
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
page {
|
||||
background-color: #eb3729;
|
||||
}
|
||||
.bargainBnt_hui {
|
||||
font-size: 0.3 * 100rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
width: 6 * 100rpx;
|
||||
height: 0.8 * 100rpx;
|
||||
border-radius: 0.4 * 100rpx;
|
||||
background: #bbb;
|
||||
text-align: center;
|
||||
line-height: 0.8 * 100rpx;
|
||||
margin-top: 0.32 * 100rpx;
|
||||
}
|
||||
.bargain_view {
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0.48 * 100rpx;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
opacity: 1;
|
||||
border-radius: 0 0 0.06 * 100rpx 0.06 * 100rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
font-size: 0.22 * 100rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 0.48 * 100rpx;
|
||||
}
|
||||
.iconfonts {
|
||||
font-size: 0.22 * 100rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<view class="bargain-list">
|
||||
<!-- <view class="header">
|
||||
<image src="@/static/images/cut-bg.png" alt="">
|
||||
</view>-->
|
||||
<view class="list" v-if="bargainLis.length > 0">
|
||||
<view class="item acea-row row-between-wrapper" v-for="(item, bargainLisIndex) in bargainLis"
|
||||
:key="bargainLisIndex">
|
||||
<view class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-column-around">
|
||||
<view class="line1" v-text="item.title"></view>
|
||||
<view class="num">
|
||||
<text class="iconfont icon-pintuan"></text>
|
||||
{{ item.people }}人正在参与
|
||||
</view>
|
||||
<view class="money font-color-red">
|
||||
可砍至: ¥
|
||||
<text class="price">{{item.minPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cutBnt bg-color-red" @click="goDetail(item.id)">
|
||||
<text class="iconfont icon-kanjia"></text>参与砍价
|
||||
</view>
|
||||
</view>
|
||||
<view class="load font-color-red" v-if="!status" @click="getBargainList">点击加载更多</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getBargainList
|
||||
} from "@/api/activity";
|
||||
export default {
|
||||
name: "GoodsBargain",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
bargainLis: [], //砍价列表
|
||||
status: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
loading: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 20 //数量
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
this.getBargainList();
|
||||
},
|
||||
methods: {
|
||||
getBargainList: function() {
|
||||
var that = this;
|
||||
if (that.loading) return;
|
||||
if (that.status) return;
|
||||
that.loading = true;
|
||||
getBargainList({
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
}).then(res => {
|
||||
that.status = res.data.length < that.limit;
|
||||
that.bargainLis.push.apply(that.bargainLis, res.data);
|
||||
that.page++;
|
||||
that.loading = false;
|
||||
});
|
||||
},
|
||||
goDetail: function(id) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/DargainDetails/index",
|
||||
query: {
|
||||
id,
|
||||
partake: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: rgb(245, 245, 245);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<view class="group-list" ref="container">
|
||||
<view class="list" v-if="combinationList.length>0">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, combinationListIndex) in combinationList"
|
||||
:key="combinationListIndex"
|
||||
@click="link(item.id)"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="line1" v-text="item.title"></view>
|
||||
<view class="acea-row">
|
||||
<view class="team acea-row row-middle cart-color">
|
||||
<view class="iconfont icon-pintuan"></view>
|
||||
<view class="num" v-text="item.people + '人团'"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom acea-row row-between-wrapper">
|
||||
<view class="money">
|
||||
¥
|
||||
<text class="num" v-text="item.price"></text>
|
||||
<text class="y-money" v-text="'¥' + item.productPrice"></text>
|
||||
</view>
|
||||
<view class="groupBnt bg-color-red">
|
||||
去拼团
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<Loading :loaded="status" :loading="loadingList"></Loading>
|
||||
</view>
|
||||
<view class="noCommodity" style="background-color: #fff;" v-if="combinationList.length === 0">
|
||||
<view class="noPictrue">
|
||||
<image :src="webUrl+'/20210203153900181449.png'" class="image" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getCombinationList } from "@/api/activity";
|
||||
import Loading from "@/components/Loading";
|
||||
|
||||
export default {
|
||||
name: "GoodsGroup",
|
||||
components: {
|
||||
Loading
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
webUrl:this.$VUE_APP_RESOURCES_URL,
|
||||
combinationList: [],
|
||||
status: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
loading: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 20, //数量
|
||||
loadingList: false
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
// document.querySelector('body').setAttribute('style', 'background-color:#eb3729');
|
||||
this.getCombinationList();
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loadingList && this.getCombinationList();
|
||||
},
|
||||
methods: {
|
||||
getCombinationList: function() {
|
||||
var that = this;
|
||||
if (that.loading) return;
|
||||
if (that.status) return;
|
||||
getCombinationList({ page: that.page, limit: that.limit }).then(res => {
|
||||
that.status = res.data.length < that.limit;
|
||||
that.combinationList.push.apply(that.combinationList, res.data);
|
||||
that.page++;
|
||||
that.loading = false;
|
||||
});
|
||||
},
|
||||
link: function(id) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GroupDetails/index",
|
||||
query: { id }
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,261 @@
|
||||
<template>
|
||||
<view class="flash-sale" ref="container">
|
||||
<view class="header" v-if="headerImg">
|
||||
<image :src="headerImg"/>
|
||||
</view>
|
||||
<scroll-view scroll-y="false" scroll-x="true">
|
||||
<view class="timeScroll">
|
||||
<view v-for="(item, index) in timeList" :key="index">
|
||||
<view v-if="active==index" class="timeItem active" @click="setTime(index)">
|
||||
<view class="time">{{ item.time }}</view>
|
||||
<view class="state">{{ item.state }}</view>
|
||||
</view>
|
||||
<view v-if="active!=index" class="timeItem" @click="setTime(index)">
|
||||
<view class="time">{{ item.time }}</view>
|
||||
<view class="state">{{ item.state }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-for="(item, index) in timeList" :key="index">
|
||||
<view v-if="active == index">
|
||||
<view class="countDown font-color-red acea-row row-center-wrapper">
|
||||
<view v-if="item.status === 0" class="activity">活动已结束</view>
|
||||
<count-down
|
||||
:isDay="false"
|
||||
:tipText="'距结束仅剩 '"
|
||||
:dayText="false"
|
||||
:hourText="' : '"
|
||||
:minuteText="' : '"
|
||||
:secondText="false"
|
||||
:datatime="datatime"
|
||||
v-if="item.status === 1"
|
||||
></count-down>
|
||||
<view v-if="item.status === 2" class="activity">活动即将开始</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(itemSeckill, indexSeckill) in seckillList"
|
||||
:key="indexSeckill"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="itemSeckill.image"/>
|
||||
</view>
|
||||
<view class="text acea-row row-column-around">
|
||||
<view class="line1" v-text="itemSeckill.title"></view>
|
||||
<view class="money">
|
||||
限时价
|
||||
<text class="num font-color-red" v-text="'¥' + itemSeckill.price"></text>
|
||||
</view>
|
||||
<view class="progress cart-color">
|
||||
<view class="bg-red" :style="{ width: loading ? itemSeckill.percent + '%' : '' }"></view>
|
||||
<view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="grab bg-color-red"
|
||||
v-if="item.status === 1 && itemSeckill.stock > 0"
|
||||
@click="goDetail(itemSeckill.id)"
|
||||
>马上抢
|
||||
</view>
|
||||
<view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view>
|
||||
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view>
|
||||
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="noCommodity"
|
||||
style="background-color: #fff;"
|
||||
v-if="seckillList.length === 0 && page > 1"
|
||||
>
|
||||
<view class="noPictrue">
|
||||
<image :src="webUrl+'/20210203153900181449.png'" class="image"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {getSeckillConfig, getSeckillList} from "@/api/activity";
|
||||
import CountDown from "@/components/CountDown";
|
||||
|
||||
export default {
|
||||
name: "GoodsSeckill",
|
||||
components: {
|
||||
CountDown
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
headerImg: "",
|
||||
timeList: [],
|
||||
sticky: false,
|
||||
loading: false,
|
||||
datatime: 0,
|
||||
active: 0,
|
||||
seckillList: [],
|
||||
status: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
loadingList: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 5, //数量
|
||||
title: []
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
this.mountedStart();
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loadingList && this.getSeckillList();
|
||||
},
|
||||
methods: {
|
||||
changeTime: function (index) {
|
||||
this.active = index;
|
||||
this.getSeckillList();
|
||||
},
|
||||
mountedStart: function () {
|
||||
var that = this;
|
||||
uni.showLoading();
|
||||
getSeckillConfig().then(res => {
|
||||
that.$set(that, "headerImg", res.data.lovely);
|
||||
that.$set(that, "timeList", res.data.seckillTime);
|
||||
that.$set(that, "active", res.data.seckillTimeIndex);
|
||||
|
||||
let title = [];
|
||||
title = res.data.seckillTime.map((item, index) => {
|
||||
return {
|
||||
name: "div",
|
||||
attrs: {
|
||||
class: "timeItem"
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: "div",
|
||||
attrs: {
|
||||
class: "time"
|
||||
},
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
text: item.time
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "div",
|
||||
attrs: {
|
||||
class: "state"
|
||||
},
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
text: item.state
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
that.$set(that, "title", title);
|
||||
that.datatime = that.timeList[that.active].stop;
|
||||
that.getSeckillList();
|
||||
that.$nextTick(function () {
|
||||
that.sticky = true;
|
||||
uni.hideLoading();
|
||||
});
|
||||
});
|
||||
},
|
||||
setTime: function (index) {
|
||||
var that = this;
|
||||
that.page = 1;
|
||||
that.loadingList = false;
|
||||
that.status = false;
|
||||
that.active = index;
|
||||
that.datatime = that.timeList[that.active].stop;
|
||||
this.seckillList = [];
|
||||
that.getSeckillList();
|
||||
},
|
||||
getSeckillList: function () {
|
||||
var that = this;
|
||||
if (that.loadingList) return;
|
||||
if (that.status) return;
|
||||
var time = that.timeList[that.active].id;
|
||||
getSeckillList(time, {
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
}).then(res => {
|
||||
that.status = res.data.length < that.limit;
|
||||
that.seckillList.push.apply(that.seckillList, res.data);
|
||||
that.page++;
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
goDetail: function (id) {
|
||||
var that = this;
|
||||
var time = that.timeList[that.active].stop;
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/SeckillDetails/index",
|
||||
query: {
|
||||
id,
|
||||
time
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.timeScroll {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.timeItem {
|
||||
font-size: 0.22 * 100rpx;
|
||||
color: #282828;
|
||||
width: 150rpx;
|
||||
text-align: center;
|
||||
padding: 0.11 * 100rpx 0;
|
||||
background-color: none;
|
||||
|
||||
&.active {
|
||||
.time {
|
||||
color: #eb3729;
|
||||
}
|
||||
|
||||
.state {
|
||||
background-color: #eb3729;
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
border-radius: 30rpx;
|
||||
padding: 0 0.2 * 100rpx;
|
||||
font-weight: 800;
|
||||
height: 0.37 * 100rpx;
|
||||
line-height: 0.37 * 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.timeItem .time {
|
||||
font-size: 0.32 * 100rpx;
|
||||
font-weight: bold;
|
||||
height: 0.37 * 100rpx;
|
||||
line-height: 0.37 * 100rpx;
|
||||
}
|
||||
|
||||
.timeItem .state {
|
||||
height: 0.37 * 100rpx;
|
||||
line-height: 0.37 * 100rpx;
|
||||
}
|
||||
|
||||
.activity {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .grab {
|
||||
background-color: #999;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,375 @@
|
||||
<template>
|
||||
<view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus">
|
||||
<product-con-swiper :imgUrls="imgUrls"></product-con-swiper>
|
||||
<view class="wrapper">
|
||||
<view class="share acea-row row-between row-bottom">
|
||||
<view class="money font-color-red">
|
||||
¥
|
||||
<text class="num" v-text="storeInfo.price"></text>
|
||||
<text class="y-money" v-text="'¥' + storeInfo.productPrice"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="introduce" v-text="storeInfo.title"></view>
|
||||
<view class="label acea-row row-between-wrapper">
|
||||
<view v-text="'类型:' + storeInfo.people + '人团'"></view>
|
||||
<view v-text="'库存:' + storeInfo.stock + storeInfo.unitName"></view>
|
||||
<view v-text="'已拼:' + storeInfo.sales + storeInfo.unitName"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice acea-row row-middle">
|
||||
<view class="num font-color-red">
|
||||
<text class="iconfont icon-laba"></text>
|
||||
已拼{{ storeInfo.sales
|
||||
}}{{ storeInfo.unitName }}
|
||||
<text class="line">|</text>
|
||||
</view>
|
||||
<view class="swiper-no-swiping swiper">
|
||||
<swiper class="swiper-wrapper" :options="swiperTip" :autoplay="true" :interval="3000">
|
||||
<block v-for="(item, itemNewIndex) in itemNew" :key="itemNewIndex">
|
||||
<swiper-item>
|
||||
<view class="line1">{{ item }}</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<view class="assemble">
|
||||
<view v-for="(item, groupListindex) in groupList" :key="groupListindex">
|
||||
<view class="item acea-row row-between-wrapper" v-if="groupListindex < groupListCount">
|
||||
<view class="pictxt acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="item.avatar" class="image" />
|
||||
</view>
|
||||
<view class="text line1" v-text="item.nickname"></view>
|
||||
</view>
|
||||
<view class="right acea-row row-middle">
|
||||
<view>
|
||||
<view class="lack">
|
||||
<text>还差</text>
|
||||
<text class="font-color-red" v-text="item.count"></text>
|
||||
<text>人成团</text>
|
||||
</view>
|
||||
<count-down
|
||||
:isDay="false"
|
||||
:tipText="'剩余 '"
|
||||
:dayText="false"
|
||||
:hourText="':'"
|
||||
:minuteText="':'"
|
||||
:secondText="false"
|
||||
:datatime="item.stopTime/1000"
|
||||
></count-down>
|
||||
</view>
|
||||
<view class="spellBnt" @click="groupRule(item.id)">
|
||||
去拼单
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="more" v-if="groupList.length > groupListCount" @click="setGroupListCount">
|
||||
查看更多
|
||||
<text class="iconfont icon-xiangxia"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="playWay">
|
||||
<view class="title acea-row row-between-wrapper">
|
||||
<view>拼团玩法</view>
|
||||
</view>
|
||||
<view class="way acea-row row-middle">
|
||||
<view class="item">
|
||||
<text class="num">①</text>开团/参团
|
||||
</view>
|
||||
<view class="iconfont icon-arrow"></view>
|
||||
<view class="item">
|
||||
<text class="num">②</text>邀请好友
|
||||
</view>
|
||||
<view class="iconfont icon-arrow"></view>
|
||||
<view class="item">
|
||||
<view>
|
||||
<text class="num">③</text>满员发货
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="userEvaluation">
|
||||
<view class="title acea-row row-between-wrapper">
|
||||
<view v-text="'用户评价(' + replyCount + ')'"></view>
|
||||
<view class="praise" @click="goReply">
|
||||
<text class="font-color-red" v-text="replyChance + '%'"></text>好评率
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view>
|
||||
<UserEvaluation :reply="reply"></UserEvaluation>
|
||||
</view>
|
||||
<view class="product-intro">
|
||||
<view class="title">产品介绍</view>
|
||||
<view class="conter" v-html="storeInfo.description"></view>
|
||||
<!-- <view class="conter" v-html=""></view> -->
|
||||
</view>
|
||||
<view style="height:100rpx;"></view>
|
||||
<view class="footer-group acea-row row-between-wrapper">
|
||||
<!-- <view class="customerSer acea-row row-center-wrapper row-column">
|
||||
<view class="iconfont icon-kefu"></view>
|
||||
<view>客服</view>
|
||||
</view>-->
|
||||
<view class="customerSer acea-row row-center-wrapper row-column" @click="setCollect">
|
||||
<view class="iconfont" :class="userCollect ? 'icon-shoucang1' : 'icon-shoucang'"></view>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
<view class="bnt bg-color-violet" @click="openAlone">单独购买</view>
|
||||
<view class="bnt bg-color-red" @click="openTeam">立即开团</view>
|
||||
</view>
|
||||
<ProductWindow v-if="cartNum" v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
|
||||
<StorePoster
|
||||
v-on:setPosterImageStatus="setPosterImageStatus"
|
||||
:posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData"
|
||||
></StorePoster>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
||||
|
||||
import ProductConSwiper from "@/components/ProductConSwiper";
|
||||
import CountDown from "@/components/CountDown";
|
||||
import UserEvaluation from "@/components/UserEvaluation";
|
||||
import ProductWindow from "@/components/ProductWindow";
|
||||
import StorePoster from "@/components/StorePoster";
|
||||
import { getCombinationDetail } from "@/api/activity";
|
||||
import { postCartAdd } from "@/api/store";
|
||||
import { imageBase64 } from "@/api/public";
|
||||
import {
|
||||
getCoupon,
|
||||
getCollectAdd,
|
||||
getCollectDel,
|
||||
getUserInfo
|
||||
} from "@/api/user";
|
||||
const NAME = "GroupDetails";
|
||||
|
||||
export default {
|
||||
name: "GroupDetails",
|
||||
components: {
|
||||
ProductConSwiper,
|
||||
CountDown,
|
||||
UserEvaluation,
|
||||
// swiper,
|
||||
// swiperSlide,
|
||||
ProductWindow,
|
||||
StorePoster
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
domStatus: false,
|
||||
posterData: {
|
||||
image: "",
|
||||
title: "",
|
||||
price: "",
|
||||
code: ""
|
||||
},
|
||||
posterImageStatus: false,
|
||||
reply: [],
|
||||
replyCount: 0,
|
||||
replyChance: 0,
|
||||
imgUrls: [],
|
||||
storeInfo: {},
|
||||
itemNew: {},
|
||||
groupListCount: 2,
|
||||
groupList: {},
|
||||
swiperTip: {
|
||||
direction: "vertical",
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true
|
||||
},
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productSelect: {
|
||||
image: "",
|
||||
store_name: "",
|
||||
price: "",
|
||||
stock: "",
|
||||
unique: "",
|
||||
cart_num: 1
|
||||
}
|
||||
},
|
||||
cartNum: 1,
|
||||
userCollect: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$yroute: function(n) {
|
||||
var that = this;
|
||||
if (n.name === NAME) {
|
||||
that.mountedStart();
|
||||
}
|
||||
}
|
||||
},
|
||||
onShow: function() {
|
||||
this.mountedStart();
|
||||
},
|
||||
methods: {
|
||||
openAlone: function() {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: { id: this.storeInfo.productId }
|
||||
});
|
||||
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
|
||||
},
|
||||
//收藏商品
|
||||
setCollect: function() {
|
||||
let that = this,
|
||||
id = that.storeInfo.id,
|
||||
category = "product";
|
||||
if (that.userCollect) {
|
||||
getCollectDel(id, category).then(function() {
|
||||
that.userCollect = !that.userCollect;
|
||||
});
|
||||
} else {
|
||||
getCollectAdd(id, category).then(function() {
|
||||
that.userCollect = !that.userCollect;
|
||||
});
|
||||
}
|
||||
},
|
||||
mountedStart: function() {
|
||||
var that = this;
|
||||
let id = that.$yroute.query.id;
|
||||
getCombinationDetail(id).then(res => {
|
||||
that.userCollect = res.data.userCollect;
|
||||
res.data.storeInfo.description = res.data.storeInfo.description.replace(
|
||||
/\<img/gi,
|
||||
'<img style="max-width:100%;height:auto;"'
|
||||
);
|
||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||
that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr);
|
||||
that.$set(that, "itemNew", res.data.pinkOkList);
|
||||
that.$set(that, "groupList", res.data.pink);
|
||||
that.$set(that, "reply", [res.data.reply]);
|
||||
that.$set(that, "replyCount", res.data.replyCount);
|
||||
that.$set(that, "replyChance", res.data.replyChance);
|
||||
that.setProductSelect();
|
||||
that.posterData.image = that.storeInfo.image;
|
||||
if (that.storeInfo.title.length > 30) {
|
||||
that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
|
||||
} else {
|
||||
that.posterData.title = that.storeInfo.title;
|
||||
}
|
||||
that.posterData.price = that.storeInfo.price;
|
||||
that.posterData.code = that.storeInfo.code_base;
|
||||
that.domStatus = true;
|
||||
//that.getImageBase64();
|
||||
});
|
||||
},
|
||||
getImageBase64: function() {
|
||||
let that = this;
|
||||
imageBase64(this.posterData.image, that.posterData.code).then(res => {
|
||||
that.posterData.image = res.data.image;
|
||||
that.posterData.code = res.data.code;
|
||||
});
|
||||
},
|
||||
setPosterImageStatus: function() {
|
||||
// var sTop = document.body || document.documentElement;
|
||||
// sTop.scrollTop = 0;
|
||||
this.posterImageStatus = !this.posterImageStatus;
|
||||
},
|
||||
groupRule: function(id) {
|
||||
var that = this;
|
||||
that.$yrouter.push({
|
||||
path: "/pages/activity/GroupRule/index",
|
||||
query: { id }
|
||||
});
|
||||
},
|
||||
goReply: function() {
|
||||
var that = this;
|
||||
that.$yrouter.push({
|
||||
path: "/pages/shop/EvaluateList/index",
|
||||
query: { id: that.storeInfo.product_id }
|
||||
});
|
||||
},
|
||||
setGroupListCount: function() {
|
||||
this.groupListCount = this.groupListCount + 2;
|
||||
},
|
||||
//将父级向子集多次传送的函数合二为一;
|
||||
changeFun: function(opt) {
|
||||
if (typeof opt !== "object") opt = {};
|
||||
let action = opt.action || "";
|
||||
let value = opt.value === undefined ? "" : opt.value;
|
||||
this[action] && this[action](value);
|
||||
},
|
||||
changeattr: function(res) {
|
||||
var that = this;
|
||||
that.attr.cartAttr = res;
|
||||
},
|
||||
ChangeCartNum: function(res) {
|
||||
var that = this;
|
||||
that.attr.productSelect.cart_num = 1;
|
||||
that.cartNum = 1;
|
||||
uni.showToast({
|
||||
title: "每人每次限购1" + that.storeInfo.unitName,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
setProductSelect: function() {
|
||||
var that = this;
|
||||
var attr = that.attr;
|
||||
attr.productSelect.image = that.storeInfo.image;
|
||||
attr.productSelect.store_name = that.storeInfo.title;
|
||||
attr.productSelect.price = that.storeInfo.price;
|
||||
attr.productSelect.stock = that.storeInfo.stock;
|
||||
attr.cartAttr = false;
|
||||
that.$set(that, "attr", attr);
|
||||
},
|
||||
openTeam: function() {
|
||||
var that = this;
|
||||
if (that.attr.cartAttr == false) {
|
||||
that.attr.cartAttr = !this.attr.cartAttr;
|
||||
} else {
|
||||
var data = {};
|
||||
data.productId = that.storeInfo.productId;
|
||||
data.cartNum = that.attr.productSelect.cart_num;
|
||||
data.uniqueId = that.attr.productSelect.unique;
|
||||
data.combinationId = that.storeInfo.id;
|
||||
data.new = 1;
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: { id: res.data.cartId }
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.product-con .wrapper {
|
||||
padding-bottom: 0.26 * 100rpx;
|
||||
}
|
||||
.noscroll {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.product-con .footer-group .bnt {
|
||||
// flex:1;
|
||||
width: 43%;
|
||||
}
|
||||
.product-con .footer-group .bnt.bg-color-violet {
|
||||
background-color: #fa8013;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<view class="group-con">
|
||||
<view class="header acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="storeCombination.image" />
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="line1" v-text="storeCombination.title"></view>
|
||||
<view class="money">
|
||||
<text>¥</text>
|
||||
<text class="num" v-text="storeCombination.price"></text>
|
||||
<text class="team cart-color" v-text="storeCombination.people + '人拼'"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="pinkBool === -1" class="iconfont icon-pintuanshibai"></view>
|
||||
<view v-else-if="pinkBool === 1" class="iconfont icon-pintuanchenggong font-color-red"></view>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="title acea-row row-center-wrapper">
|
||||
<view class="line"></view>
|
||||
<view class="name acea-row row-center-wrapper">
|
||||
<text>剩余</text>
|
||||
<count-down
|
||||
:isDay="false"
|
||||
:tipText="false"
|
||||
:dayText="false"
|
||||
:hourText="' : '"
|
||||
:minuteText="' : '"
|
||||
:secondText="false"
|
||||
:datatime="pinkT.stopTime/1000"
|
||||
></count-down>
|
||||
<text>结束</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
<view class="tips-warp">
|
||||
<text class="tips font-color-red" v-if="pinkBool === 1">恭喜您拼团成功</text>
|
||||
<text class="tips" v-else-if="pinkBool === -1">还差{{ count }}人,拼团失败</text>
|
||||
<text class="tips font-color-red" v-else-if="pinkBool === 0">拼团中,还差{{ count }}人拼团成功</text>
|
||||
</view>
|
||||
<view
|
||||
class="list acea-row row-middle"
|
||||
:class="[pinkBool === 1 || pinkBool === -1 ? 'result' : '',iShidden ? 'on' : '']"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="pinkT.avatar" />
|
||||
</view>
|
||||
<view class="acea-row row-middle" v-if="pinkAll.length > 0">
|
||||
<view class="pictrue" v-for="(item, pinkAllIndex) in pinkAll" :key="pinkAllIndex">
|
||||
<image :src="item.avatar" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="pictrue" v-for="countIndex in count" :key="countIndex">
|
||||
<image class="img-none" :src="webUrl+'/20230304204903336964.png'" />
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="(pinkBool === 1 || pinkBool === -1) && count > 9"
|
||||
class="lookAll acea-row row-center-wrapper"
|
||||
@click="lookAll"
|
||||
>
|
||||
{{ iShidden ? "收起" : "查看全部" }}
|
||||
<text class="iconfont" :class="iShidden ? 'icon-xiangshang' : 'icon-xiangxia'"></text>
|
||||
</view>
|
||||
<view
|
||||
class="teamBnt bg-color-red"
|
||||
v-if="userBool === 1 && isOk == 0 && pinkBool === 0"
|
||||
@click="goPoster"
|
||||
>邀请好友参团</view>
|
||||
<view
|
||||
class="teamBnt bg-color-red"
|
||||
v-else-if="userBool === 0 && pinkBool === 0 && count > 0"
|
||||
@click="pay"
|
||||
>我要参团</view>
|
||||
<view
|
||||
class="teamBnt bg-color-red"
|
||||
v-if="pinkBool === 1 || pinkBool === -1"
|
||||
@click="goDetail(storeCombination.id)"
|
||||
>再次开团</view>
|
||||
<view class="cancel" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">
|
||||
<text class="iconfont icon-guanbi3"></text>
|
||||
<text>取消开团</text>
|
||||
</view>
|
||||
<view class="lookOrder" v-if="pinkBool === 1" @click="goOrder">
|
||||
<text>查看订单信息</text>
|
||||
<text class="iconfont icon-xiangyou"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import CountDown from "@/components/CountDown";
|
||||
import { getCombinationPink, getCombinationRemove } from "@/api/activity";
|
||||
import { postCartAdd } from "@/api/store";
|
||||
import { isWeixin, parseQuery, handleQrCode } from "@/utils/index";
|
||||
|
||||
const NAME = "GroupRule";
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
CountDown
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
currentPinkOrder: "", //当前拼团订单
|
||||
isOk: 0, //判断拼团是否完成
|
||||
pinkBool: 0, //判断拼团是否成功|0=失败,1=成功
|
||||
userBool: 0, //判断当前用户是否在团内|0=未在,1=在
|
||||
pinkAll: [], //团员
|
||||
pinkT: [], //团长信息
|
||||
storeCombination: [], //拼团产品
|
||||
pinkId: 0,
|
||||
count: 0, //拼团剩余人数
|
||||
iShidden: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$yroute(n) {
|
||||
var that = this;
|
||||
if (n.name === NAME) {
|
||||
that.pinkId = that.$yroute.query.id;
|
||||
that.getCombinationPink();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
var that = this;
|
||||
let url = handleQrCode();
|
||||
if (url) {
|
||||
that.pinkId = url.pinkId;
|
||||
} else {
|
||||
that.pinkId = that.$yroute.query.id;
|
||||
}
|
||||
that.getCombinationPink();
|
||||
},
|
||||
methods: {
|
||||
pay: function() {
|
||||
var that = this;
|
||||
var data = {};
|
||||
data.productId = that.storeCombination.productId;
|
||||
data.cartNum = that.pinkT.totalNum;
|
||||
data.uniqueId = "";
|
||||
data.combinationId = that.storeCombination.id;
|
||||
data.new = 1;
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: {
|
||||
id: res.data.cartId,
|
||||
pinkid: that.pinkId
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
goPoster: function() {
|
||||
var that = this;
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/Poster/index",
|
||||
query: {
|
||||
id: that.pinkId,
|
||||
type: 1
|
||||
}
|
||||
});
|
||||
},
|
||||
goOrder: function() {
|
||||
var that = this;
|
||||
this.$yrouter.push({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: {
|
||||
id: that.currentPinkOrder
|
||||
}
|
||||
});
|
||||
},
|
||||
//拼团列表
|
||||
goList: function() {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GoodsGroup/index"
|
||||
});
|
||||
},
|
||||
//拼团详情
|
||||
goDetail: function(id) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GroupDetails/index",
|
||||
query: {
|
||||
id
|
||||
}
|
||||
});
|
||||
},
|
||||
//拼团信息
|
||||
getCombinationPink: function() {
|
||||
var that = this;
|
||||
getCombinationPink(that.pinkId).then(res => {
|
||||
that.$set(that, "storeCombination", res.data.storeCombination);
|
||||
that.$set(that, "pinkT", res.data.pinkT);
|
||||
that.$set(that, "pinkAll", res.data.pinkAll);
|
||||
that.$set(that, "count", res.data.count);
|
||||
that.$set(that, "userBool", res.data.userBool);
|
||||
that.$set(that, "pinkBool", res.data.pinkBool);
|
||||
that.$set(that, "isOk", res.data.isOk);
|
||||
that.$set(that, "currentPinkOrder", res.data.currentPinkOrder);
|
||||
});
|
||||
},
|
||||
//拼团取消
|
||||
getCombinationRemove: function() {
|
||||
var that = this;
|
||||
getCombinationRemove({
|
||||
id: that.pinkId,
|
||||
cid: that.storeCombination.id
|
||||
})
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
lookAll: function() {
|
||||
this.iShidden = !this.iShidden;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.tips-warp {
|
||||
text-align: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<view class="poster-poster" v-if="status === false">
|
||||
<view class="tip">
|
||||
<text class="iconfont icon-shuoming"></text>提示:长按图片保存至手机相册
|
||||
</view>
|
||||
<view class="poster">
|
||||
<image :src="image" mode="widthFix" show-menu-by-longpress />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getBargainPoster, getCombinationPoster } from "@/api/activity";
|
||||
|
||||
export default {
|
||||
name: "Poster",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
status: true,
|
||||
id: 0,
|
||||
image: ""
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
var that = this;
|
||||
var id = that.$yroute.query.id;
|
||||
var type = that.$yroute.query.type;
|
||||
that.id = id;
|
||||
if (type == 2) {
|
||||
that.getBargainPoster();
|
||||
} else {
|
||||
that.getCombinationPoster();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getBargainPoster: function() {
|
||||
var that = this;
|
||||
getBargainPoster({ bargainId: that.id, from: "wechat" })
|
||||
.then(res => {
|
||||
that.image = res.data.url;
|
||||
that.status = false;
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
// 拼团海报
|
||||
getCombinationPoster: function() {
|
||||
var that = this;
|
||||
getCombinationPoster({ id: that.id, from: "wechat" })
|
||||
.then(res => {
|
||||
that.image = res.data.url;
|
||||
that.status = false;
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
page {
|
||||
background-color: #eb3729;
|
||||
}
|
||||
.poster-poster {
|
||||
height: unset !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus">
|
||||
<product-con-swiper :imgUrls="imgUrls"></product-con-swiper>
|
||||
<view class="nav acea-row row-between-wrapper">
|
||||
<view class="money">
|
||||
¥
|
||||
<text class="num" v-text="storeInfo.price"></text>
|
||||
<text class="y-money" v-text="'¥' + storeInfo.price"></text>
|
||||
</view>
|
||||
<view class="acea-row row-middle">
|
||||
<view class="times">
|
||||
<view>距秒杀结束仅剩</view>
|
||||
<count-down
|
||||
:isDay="false"
|
||||
:tipText="false"
|
||||
:dayText="false"
|
||||
:hourText="' : '"
|
||||
:minuteText="' : '"
|
||||
:secondText="false"
|
||||
:datatime="datatime"
|
||||
></count-down>
|
||||
</view>
|
||||
<view class="iconfont icon-jiantou"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapperRush">
|
||||
<view class="introduce acea-row row-between">
|
||||
<view class="infor" v-text="storeInfo.title"></view>
|
||||
<!-- <view class="iconfont icon-fenxiang" @click="setPosterImageStatus"></view> -->
|
||||
</view>
|
||||
<view class="label acea-row row-middle">
|
||||
<view class="stock" v-text="'库存:' + storeInfo.stock + '件'"></view>
|
||||
<view v-text="'销量:' + storeInfo.sales + '件'"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="product-intro">
|
||||
<view class="title">产品介绍</view>
|
||||
<view class="conter" v-html="storeInfo.description"></view>
|
||||
</view>
|
||||
<view style="height:100rpx;"></view>
|
||||
<view class="footerRush acea-row row-between-wrapper">
|
||||
<!-- <view
|
||||
class="customerSer acea-row row-center-wrapper row-column"
|
||||
@click="routerGo()"
|
||||
>
|
||||
<view class="iconfont icon-kefu"></view>
|
||||
<view>客服</view>
|
||||
</view> -->
|
||||
<view class="bnt bg-color-red" @click="tapBuy">立即购买</view>
|
||||
</view>
|
||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
|
||||
<StorePoster
|
||||
v-on:setPosterImageStatus="setPosterImageStatus"
|
||||
:posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData"
|
||||
></StorePoster>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="less">
|
||||
.noscroll {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import ProductConSwiper from "@/components/ProductConSwiper";
|
||||
import CountDown from "@/components/CountDown";
|
||||
import ProductWindow from "@/components/ProductWindow";
|
||||
import StorePoster from "@/components/StorePoster";
|
||||
import { getSeckillDetail } from "@/api/activity";
|
||||
import { postCartAdd } from "@/api/store";
|
||||
import { imageBase64 } from "@/api/public";
|
||||
const NAME = "SeckillDetails";
|
||||
|
||||
export default {
|
||||
name: "SeckillDetails",
|
||||
components: {
|
||||
ProductConSwiper,
|
||||
CountDown,
|
||||
ProductWindow,
|
||||
StorePoster
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
domStatus: false,
|
||||
posterData: {
|
||||
image: "",
|
||||
title: "",
|
||||
price: "",
|
||||
code: ""
|
||||
},
|
||||
posterImageStatus: false,
|
||||
action: "",
|
||||
imgUrls: [],
|
||||
storeInfo: [],
|
||||
replyCount: 0,
|
||||
reply: [],
|
||||
cartNum: 1,
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productSelect: {
|
||||
image: "",
|
||||
store_name: "",
|
||||
price: "",
|
||||
stock: "",
|
||||
unique: "",
|
||||
cart_num: 1
|
||||
}
|
||||
},
|
||||
datatime: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$yroute: function(n) {
|
||||
var that = this;
|
||||
if (n.name === NAME) {
|
||||
that.mountedStart();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.mountedStart();
|
||||
},
|
||||
methods: {
|
||||
routerGo(item) {
|
||||
this.$yrouter.push({ path: '/pages/user/CustomerList/index' })
|
||||
},
|
||||
mountedStart: function() {
|
||||
var that = this;
|
||||
let id = that.$yroute.query.id;
|
||||
that.datatime = parseInt(that.$yroute.query.time);
|
||||
getSeckillDetail(id).then(res => {
|
||||
res.data.storeInfo.description = res.data.storeInfo.description.replace(
|
||||
/\<img/gi,
|
||||
'<img style="max-width:100%;height:auto;"'
|
||||
);
|
||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||
that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr);
|
||||
that.$set(that, "replyCount", res.data.replyCount);
|
||||
that.$set(that, "reply", res.data.reply);
|
||||
that.posterData.image = that.storeInfo.image_base;
|
||||
that.updateTitle();
|
||||
if (that.storeInfo.title.length > 30) {
|
||||
that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
|
||||
} else {
|
||||
that.posterData.title = that.storeInfo.title;
|
||||
}
|
||||
that.posterData.price = that.storeInfo.price;
|
||||
that.posterData.code = that.storeInfo.code_base;
|
||||
that.setProductSelect();
|
||||
that.domStatus = true;
|
||||
});
|
||||
},
|
||||
updateTitle() {
|
||||
// document.title = this.storeInfo.title || this.$yroute.meta.title;
|
||||
},
|
||||
setPosterImageStatus: function() {
|
||||
// var sTop = document.body || document.documentElement;
|
||||
// sTop.scrollTop = 0;
|
||||
this.posterImageStatus = !this.posterImageStatus;
|
||||
},
|
||||
//将父级向子集多次传送的函数合二为一;
|
||||
changeFun: function(opt) {
|
||||
if (typeof opt !== "object") opt = {};
|
||||
let action = opt.action || "";
|
||||
let value = opt.value === undefined ? "" : opt.value;
|
||||
this[action] && this[action](value);
|
||||
},
|
||||
changeattr: function(res) {
|
||||
var that = this;
|
||||
that.attr.cartAttr = res;
|
||||
},
|
||||
ChangeCartNum: function(res) {
|
||||
var that = this;
|
||||
if (res) {
|
||||
if (that.attr.productSelect.cart_num < that.storeInfo.stock) {
|
||||
that.attr.productSelect.cart_num++;
|
||||
this.cartNum++;
|
||||
}
|
||||
} else {
|
||||
if (that.attr.productSelect.cart_num > 1) {
|
||||
that.attr.productSelect.cart_num--;
|
||||
this.cartNum--;
|
||||
}
|
||||
}
|
||||
},
|
||||
setProductSelect: function() {
|
||||
var that = this;
|
||||
var attr = that.attr;
|
||||
attr.productSelect.image = that.storeInfo.image;
|
||||
attr.productSelect.store_name = that.storeInfo.title;
|
||||
attr.productSelect.price = that.storeInfo.price;
|
||||
attr.productSelect.stock = that.storeInfo.stock;
|
||||
attr.cartAttr = false;
|
||||
that.$set(that, "attr", attr);
|
||||
},
|
||||
selecAttrTap: function() {
|
||||
this.cartAttr = true;
|
||||
},
|
||||
tapBuy: function() {
|
||||
var that = this;
|
||||
if (that.attr.cartAttr == false) {
|
||||
that.attr.cartAttr = !this.attr.attrcartAttr;
|
||||
} else {
|
||||
var data = {};
|
||||
data.productId = that.storeInfo.productId;
|
||||
data.cartNum = that.attr.productSelect.cart_num;
|
||||
data.uniqueId = that.attr.productSelect.unique;
|
||||
data.secKillId = that.storeInfo.id;
|
||||
data.new = 1;
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: { id: res.data.cartId }
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg|| err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.product-con .nav {
|
||||
padding: 0 0.2*100rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user